github withastro/astro astro@0.23.0-next.7

latest releases: astro@5.0.0-beta.4, @astrojs/svelte@6.0.0-beta.1, astro@4.15.12...
pre-release2 years ago

Patch Changes

  • #2586 d6d35bca Thanks @tony-sull! - Support for non-HTML pages

    ⚠️ This feature is currently only supported with the --experimental-static-build CLI flag. This feature may be refined over the next few weeks/months as SSR support is finalized.

    This adds support for generating non-HTML pages form .js and .ts pages during the build. Built file and extensions are based on the source file's name, ex: src/pages/data.json.ts will be built to dist/data.json.

    Is this different from SSR? Yes! This feature allows JSON, XML, etc. files to be output at build time. Keep an eye out for full SSR support if you need to build similar files when requested, for example as a serverless function in your deployment host.

    Examples

    // src/pages/company.json.ts
    export async function get() {
    	return {
    		body: JSON.stringify({
    			name: 'Astro Technology Company',
    			url: 'https://astro.build/',
    		}),
    	};
    }

    What about getStaticPaths()? It just works™.

    export async function getStaticPaths() {
        return [
            { params: { slug: 'thing1' }},
            { params: { slug: 'thing2' }}
        ]
    }
    
    export async function get(params) {
        const { slug } = params
    
        return {
            body: // ...JSON.stringify()
        }
    }
  • #2548 ba5e2b5e Thanks @matthewp! - Experimental SSR Support

    ⚠️ If you are a user of Astro and see this PR and think that you can start deploying your app to a server and get SSR, slow down a second! This is only the initial flag and very basic support. Styles are not loading correctly at this point, for example. Like we did with the --experimental-static-build flag, this feature will be refined over the next few weeks/months and we'll let you know when its ready for community testing.

    Changes

    • This adds a new --experimental-ssr flag to astro build which will result in dist/server/ and dist/client/ directories.

    • SSR can be used through this API:

      import { createServer } from 'http';
      import { loadApp } from 'astro/app/node';
      
      const app = await loadApp(new URL('./dist/server/', import.meta.url));
      
      createServer((req, res) => {
        const route = app.match(req);
        if(route) {
          let html = await app.render(req, route);
        }
      
      }).listen(8080);
    • This API will be refined over time.

    • This only works in Node.js at the moment.

    • Many features will likely not work correctly, but rendering HTML at least should.

  • #2581 ec6f148f Thanks @matthewp! - Fix for resolving relative imports from hoisted scripts in the static build.

  • #2594 085468e9 Thanks @natemoo-re! - Upgrade @astrojs/compiler to v0.10.2

Don't miss a new astro release

NewReleases is sending notifications on new releases.