diff --git a/benchmark/bench/codspeed.js b/benchmark/bench/codspeed.js
index 2ad783e8aa..2643b1ec8a 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 () => {
- 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);
- }
- console.info('Finish task.');
- return result;
+ await exec(astroBin, ['build'], {
+ nodeOptions: {
+ cwd: render.root,
+ stdio: 'inherit',
},
- {
- async beforeAll() {
- // build for rendering
- 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);
- app = createApp(manifest);
- app.manifest = manifest;
- },
- },
- );
+ 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 request = new Request(new URL('http://exmpale.com/astro'));
+ await streamingApp.render(request);
+ console.info('Finish task.');
+ })
+ .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.');
+ })
+
+ .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 ca69fe28f2..10e212adbe 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 4bbb934655..bca3430009 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 01e58574a6..641312ae1b 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
-->
-
+ {@render children?.()}
diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json
index 31b0691ca3..da283570d9 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 c7308a1ab3..56e22f6be5 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 1353736aaa..a11538645e 100644
--- a/examples/framework-svelte/src/components/Counter.svelte
+++ b/examples/framework-svelte/src/components/Counter.svelte
@@ -1,5 +1,12 @@
-
+ {@render children?.()}
-