diff --git a/benchmark/bench/codspeed.js b/benchmark/bench/codspeed.js index 2ad783e8aa7d..2643b1ec8a5f 100644 --- a/benchmark/bench/codspeed.js +++ b/benchmark/bench/codspeed.js @@ -2,7 +2,6 @@ import path from 'node:path'; import { withCodSpeed } from '@codspeed/tinybench-plugin'; import { Bench } from 'tinybench'; import { exec } from 'tinyexec'; -import { renderPages } from '../make-project/render-default.js'; import { astroBin } from './_util.js'; export async function run({ memory: _memory, render, stress: _stress }) { @@ -10,40 +9,55 @@ export async function run({ memory: _memory, render, stress: _stress }) { iterations: 10, }; const bench = process.env.CODSPEED ? withCodSpeed(new Bench(options)) : new Bench(options); - let app; - bench.add( - 'Rendering', - async () => { + await exec(astroBin, ['build'], { + nodeOptions: { + cwd: render.root, + stdio: 'inherit', + }, + }); + + const entry = new URL('./dist/server/entry.mjs', `file://${render.root}`); + const { manifest, createApp } = await import(entry); + const streamingApp = createApp(manifest, true); + const nonStreamingApp = createApp(manifest, false); + bench + .add('Rendering: streaming [true], .astro file', async () => { console.info('Start task.'); - const result = {}; - for (const fileName of renderPages) { - const pathname = '/' + fileName.slice(0, -path.extname(fileName).length); - const request = new Request(new URL(pathname, 'http://exmpale.com')); - const response = await app.render(request); - const html = await response.text(); - if (!result[pathname]) result[pathname] = []; - result[pathname].push(html); - } + const request = new Request(new URL('http://exmpale.com/astro')); + await streamingApp.render(request); console.info('Finish task.'); - return result; - }, - { - async beforeAll() { - // build for rendering - await exec(astroBin, ['build'], { - nodeOptions: { - cwd: render.root, - stdio: 'inherit', - }, - }); + }) + .add('Rendering: streaming [true], .md file', async () => { + console.info('Start task.'); + const request = new Request(new URL('http://exmpale.com/md')); + await streamingApp.render(request); + console.info('Finish task.'); + }) + .add('Rendering: streaming [true], .mdx file', async () => { + console.info('Start task.'); + const request = new Request(new URL('http://exmpale.com/mdx')); + await streamingApp.render(request); + console.info('Finish task.'); + }) - const entry = new URL('./dist/server/entry.mjs', `file://${render.root}`); - const { manifest, createApp } = await import(entry); - app = createApp(manifest); - app.manifest = manifest; - }, - }, - ); + .add('Rendering: streaming [false], .astro file', async () => { + console.info('Start task.'); + const request = new Request(new URL('http://exmpale.com/astro')); + await nonStreamingApp.render(request); + console.info('Finish task.'); + }) + .add('Rendering: streaming [false], .md file', async () => { + console.info('Start task.'); + const request = new Request(new URL('http://exmpale.com/md')); + await nonStreamingApp.render(request); + console.info('Finish task.'); + }) + .add('Rendering: streaming [false], .mdx file', async () => { + console.info('Start task.'); + const request = new Request(new URL('http://exmpale.com/mdx')); + await nonStreamingApp.render(request); + console.info('Finish task.'); + }); await bench.run(); console.table(bench.table()); diff --git a/benchmark/packages/adapter/src/server.ts b/benchmark/packages/adapter/src/server.ts index ca69fe28f262..10e212adbedd 100644 --- a/benchmark/packages/adapter/src/server.ts +++ b/benchmark/packages/adapter/src/server.ts @@ -7,11 +7,9 @@ applyPolyfills(); class MyApp extends App { #manifest: SSRManifest | undefined; - #streaming: boolean; constructor(manifest: SSRManifest, streaming = false) { super(manifest, streaming); this.#manifest = manifest; - this.#streaming = streaming; } async render(request: Request) { diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index 4bbb934655c4..bca3430009bc 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -12,7 +12,7 @@ "dependencies": { "@astrojs/preact": "^3.5.3", "@astrojs/react": "^3.6.2", - "@astrojs/solid-js": "^4.4.2", + "@astrojs/solid-js": "^4.4.3", "@astrojs/svelte": "^6.0.0-beta.2", "@astrojs/vue": "^5.0.0-beta.1", "@types/react": "^18.3.12", @@ -22,7 +22,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "solid-js": "^1.9.3", - "svelte": "^4.2.19", + "svelte": "^5.1.16", "vue": "^3.5.12" } } diff --git a/examples/framework-multiple/src/components/svelte/SvelteCounter.svelte b/examples/framework-multiple/src/components/svelte/SvelteCounter.svelte index 01e58574a6ec..641312ae1b9f 100644 --- a/examples/framework-multiple/src/components/svelte/SvelteCounter.svelte +++ b/examples/framework-multiple/src/components/svelte/SvelteCounter.svelte @@ -2,7 +2,14 @@ A counter written with Svelte -->
- +
{count}
- +
- + {@render children?.()}
diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index 31b0691ca386..da283570d951 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "@astrojs/solid-js": "^4.4.2", + "@astrojs/solid-js": "^4.4.3", "astro": "^5.0.0-beta.8", "solid-js": "^1.9.2" } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index c7308a1ab374..56e22f6be56f 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -10,8 +10,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/svelte": "^6.0.0-beta.2", + "@astrojs/svelte": "^6.0.0", "astro": "^5.0.0-beta.8", - "svelte": "^4.2.19" + "svelte": "^5.1.16" } } diff --git a/examples/framework-svelte/src/components/Counter.svelte b/examples/framework-svelte/src/components/Counter.svelte index 1353736aaab7..a11538645e6c 100644 --- a/examples/framework-svelte/src/components/Counter.svelte +++ b/examples/framework-svelte/src/components/Counter.svelte @@ -1,5 +1,12 @@
- +
{count}
- +
- + {@render children?.()}
- diff --git a/examples/ssr/src/components/Cart.svelte b/examples/ssr/src/components/Cart.svelte index 74db0bc7947c..5d4b7d2510c1 100644 --- a/examples/ssr/src/components/Cart.svelte +++ b/examples/ssr/src/components/Cart.svelte @@ -1,5 +1,5 @@
- +
{ count }
- +
- + {@render children?.()}
diff --git a/packages/astro/e2e/fixtures/errors/package.json b/packages/astro/e2e/fixtures/errors/package.json index 3730d61f1bd0..77c40677853c 100644 --- a/packages/astro/e2e/fixtures/errors/package.json +++ b/packages/astro/e2e/fixtures/errors/package.json @@ -14,7 +14,7 @@ "react-dom": "^18.3.1", "sass": "^1.80.6", "solid-js": "^1.9.3", - "svelte": "^4.2.19", + "svelte": "^5.1.16", "vue": "^3.5.12" } } diff --git a/packages/astro/e2e/fixtures/errors/src/components/svelte/SvelteRuntimeError.svelte b/packages/astro/e2e/fixtures/errors/src/components/svelte/SvelteRuntimeError.svelte index 54dbab6a7540..69d62a884f73 100644 --- a/packages/astro/e2e/fixtures/errors/src/components/svelte/SvelteRuntimeError.svelte +++ b/packages/astro/e2e/fixtures/errors/src/components/svelte/SvelteRuntimeError.svelte @@ -1,5 +1,5 @@
- +
{ count }
- +
- + {@render children?.()}
- +
{ count }
- +
diff --git a/packages/astro/test/fixtures/astro-client-only/src/components/PersistentCounterStandalone.svelte b/packages/astro/test/fixtures/astro-client-only/src/components/PersistentCounterStandalone.svelte index c851a42f86c6..cb2d5149649f 100644 --- a/packages/astro/test/fixtures/astro-client-only/src/components/PersistentCounterStandalone.svelte +++ b/packages/astro/test/fixtures/astro-client-only/src/components/PersistentCounterStandalone.svelte @@ -1,8 +1,8 @@
- +
{ count }
- +
\ No newline at end of file diff --git a/packages/astro/test/fixtures/astro-dynamic/src/components/SvelteCounter.svelte b/packages/astro/test/fixtures/astro-dynamic/src/components/SvelteCounter.svelte index 8d6b3f5e1688..d4972b7f92a8 100644 --- a/packages/astro/test/fixtures/astro-dynamic/src/components/SvelteCounter.svelte +++ b/packages/astro/test/fixtures/astro-dynamic/src/components/SvelteCounter.svelte @@ -1,7 +1,7 @@
- +
{ count }
- +
- + {@render children?.()}
diff --git a/packages/astro/test/fixtures/astro-markdown/astro.config.mjs b/packages/astro/test/fixtures/astro-markdown/astro.config.mjs index ac3f1ab6439e..201ce52f26ef 100644 --- a/packages/astro/test/fixtures/astro-markdown/astro.config.mjs +++ b/packages/astro/test/fixtures/astro-markdown/astro.config.mjs @@ -1,8 +1,6 @@ -import svelte from "@astrojs/svelte"; -import { defineConfig } from 'astro/config'; +import { defineConfig } from "astro/config"; // https://astro.build/config export default defineConfig({ - integrations: [svelte()], - site: 'https://astro.build/', + site: "https://astro.build/", }); diff --git a/packages/astro/test/fixtures/astro-markdown/package.json b/packages/astro/test/fixtures/astro-markdown/package.json index c1903a941ea1..9fe9dae0124d 100644 --- a/packages/astro/test/fixtures/astro-markdown/package.json +++ b/packages/astro/test/fixtures/astro-markdown/package.json @@ -3,7 +3,6 @@ "version": "0.0.0", "private": true, "dependencies": { - "@astrojs/svelte": "workspace:*", "astro": "workspace:*" } } diff --git a/packages/astro/test/fixtures/astro-markdown/src/components/Counter.svelte b/packages/astro/test/fixtures/astro-markdown/src/components/Counter.svelte deleted file mode 100644 index 4e91b26596c4..000000000000 --- a/packages/astro/test/fixtures/astro-markdown/src/components/Counter.svelte +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/packages/astro/test/fixtures/astro-slots-nested/package.json b/packages/astro/test/fixtures/astro-slots-nested/package.json index 114e369d6cd6..6d541872ec11 100644 --- a/packages/astro/test/fixtures/astro-slots-nested/package.json +++ b/packages/astro/test/fixtures/astro-slots-nested/package.json @@ -13,7 +13,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "solid-js": "^1.9.3", - "svelte": "^4.2.19", + "svelte": "^5.1.16", "vue": "^3.5.12" } } diff --git a/packages/astro/test/fixtures/component-library-shared/Counter.svelte b/packages/astro/test/fixtures/component-library-shared/Counter.svelte index 2f4c07339060..0ca9f08b0d96 100644 --- a/packages/astro/test/fixtures/component-library-shared/Counter.svelte +++ b/packages/astro/test/fixtures/component-library-shared/Counter.svelte @@ -1,5 +1,6 @@
- +
{ count }
- +
- + {@render children?.()}