diff --git a/.changeset/blue-spiders-carry.md b/.changeset/blue-spiders-carry.md
new file mode 100644
index 0000000000..a9819f5db5
--- /dev/null
+++ b/.changeset/blue-spiders-carry.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Fixes a bug where MDX files with certain characters in the name would cause builds to fail
diff --git a/.changeset/famous-teachers-hug.md b/.changeset/famous-teachers-hug.md
new file mode 100644
index 0000000000..988f2993f9
--- /dev/null
+++ b/.changeset/famous-teachers-hug.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Fix a bug that caused builds to fail if an image had a quote mark in its name
diff --git a/.changeset/fast-adults-lick.md b/.changeset/fast-adults-lick.md
new file mode 100644
index 0000000000..22b2617bed
--- /dev/null
+++ b/.changeset/fast-adults-lick.md
@@ -0,0 +1,6 @@
+---
+'@astrojs/markdoc': patch
+'astro': patch
+---
+
+Fixes a bug where the experimental feature `experimental.svg` was incorrectly used when generating ESM images
diff --git a/.changeset/green-coins-tie.md b/.changeset/green-coins-tie.md
new file mode 100644
index 0000000000..349bf67244
--- /dev/null
+++ b/.changeset/green-coins-tie.md
@@ -0,0 +1,5 @@
+---
+'@astrojs/vue': patch
+---
+
+fix vite peer dependency issue for vue integration
diff --git a/.changeset/shy-worms-talk.md b/.changeset/shy-worms-talk.md
new file mode 100644
index 0000000000..c22501e2d2
--- /dev/null
+++ b/.changeset/shy-worms-talk.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Fixes astro info copy to clipboard process not returning to prompt in certain cases.
diff --git a/.changeset/unlucky-kids-compete.md b/.changeset/unlucky-kids-compete.md
deleted file mode 100644
index e4b59791ea..0000000000
--- a/.changeset/unlucky-kids-compete.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'astro': patch
----
-
-Fixes a regression where Astro was trying to access `Request.headers`
diff --git a/.github/ISSUE_TEMPLATE/---01-bug-report.yml b/.github/ISSUE_TEMPLATE/---01-bug-report.yml
index 3a2ec98666..9f9bb166de 100644
--- a/.github/ISSUE_TEMPLATE/---01-bug-report.yml
+++ b/.github/ISSUE_TEMPLATE/---01-bug-report.yml
@@ -42,7 +42,7 @@ body:
id: bug-reproduction
attributes:
label: Link to Minimal Reproducible Example
- description: 'Use [astro.new](https://astro.new) to create a minimal reproduction of the problem. **A minimal reproduction is required** so that others can help debug your issue. If a report is vague (e.g. just a generic error message) and has no reproduction, it may be auto-closed. Not sure how to create a minimal example? [Read our guide](https://docs.astro.build/en/guides/troubleshooting/#creating-minimal-reproductions)'
+ description: 'Use [StackBlitz](https://astro.new/repro) to create a minimal reproduction of the problem. **A minimal reproduction is required** so that others can help debug your issue. If a report is vague (e.g. just a generic error message) and has no reproduction, it may be auto-closed. Not sure how to create a minimal example? [Read our guide](https://docs.astro.build/en/guides/troubleshooting/#creating-minimal-reproductions)'
placeholder: 'https://stackblitz.com/abcd1234'
validations:
required: true
diff --git a/.github/labeler.yml b/.github/labeler.yml
index c1025ad117..b0d27800ba 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -40,5 +40,5 @@
- packages/integrations/vue/**
'docs pr':
-- packages/astro/src/@types/astro.ts
+- packages/astro/src/types/public/**
- packages/astro/src/core/errors/errors-data.ts
diff --git a/.github/renovate.json5 b/.github/renovate.json5
index 527ef6df7d..ead596c395 100644
--- a/.github/renovate.json5
+++ b/.github/renovate.json5
@@ -16,6 +16,7 @@
"@biomejs/biome",
"@types/node",
"@preact/preset-vite", // v2.8.3 starts to use Vite's esbuild for perf, but this conflicts with the react plugin
+ "astro-embed", // TODO: investigate upgrade (zod import issues with atproto)
"drizzle-orm", // TODO: investigate upgrade (has type issues)
"sharp",
diff --git a/.github/scripts/announce.mjs b/.github/scripts/announce.mjs
index 2e05a7ae8a..df73040372 100755
--- a/.github/scripts/announce.mjs
+++ b/.github/scripts/announce.mjs
@@ -6,7 +6,7 @@ import { setOutput } from './utils.mjs';
const { GITHUB_REF = 'main' } = process.env;
const baseUrl = new URL(`https://github.com/withastro/astro/blob/${GITHUB_REF}/`);
-const emojis = ['🎉', '🥳', '🚀', '🧑🚀', '🎊', '🏆', '✅', '🤩', '🤖', '🙌'];
+const emojis = ['🎉', '🥳', '🚀', '🧑', '🎊', '🏆', '✅', '🤩', '🤖', '🙌'];
const descriptors = [
'new releases',
'hot and fresh updates',
@@ -141,7 +141,7 @@ async function generateMessage() {
message += `\nAlso ${item(extraVerbs)}:`;
const remainingPackages = packages.filter((p) => p.name !== name);
- for (const { name, version, url } of remainingPackages) {
+ for (const { name, version, _url } of remainingPackages) {
message += `\n• \`${name}@${version}\``;
}
@@ -159,7 +159,7 @@ async function generateMessage() {
async function run() {
const content = await generateMessage();
- console.log(content);
+ console.info(content);
setOutput('DISCORD_MESSAGE', content);
}
diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml
index f265b5fedb..85dbb1c948 100644
--- a/.github/workflows/benchmark.yml
+++ b/.github/workflows/benchmark.yml
@@ -39,7 +39,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
- node-version: 18
+ node-version: 22
cache: "pnpm"
- name: Install dependencies
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index c1b4919901..f8c7ceb49d 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -11,7 +11,7 @@ on:
- "examples/**"
- ".github/workflows/check.yml"
- "scripts/smoke/check.js"
- - "packages/astro/src/@types/astro.ts"
+ - "packages/astro/src/types/public/**"
- "pnpm-lock.yaml"
- "packages/astro/types.d.ts"
@@ -36,7 +36,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
- node-version: 18
+ node-version: 22
cache: "pnpm"
- name: Install dependencies
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index cde351c7c2..e7bb0eb7b1 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -5,7 +5,6 @@ on:
push:
branches:
- main
- - next
merge_group:
pull_request:
paths-ignore:
@@ -39,7 +38,7 @@ jobs:
strategy:
matrix:
OS: [ubuntu-latest, windows-latest]
- NODE_VERSION: [18]
+ NODE_VERSION: [22]
fail-fast: true
steps:
# Disable crlf so all OS can share the same Turbo cache
@@ -86,7 +85,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
- node-version: 18
+ node-version: 22
cache: "pnpm"
- name: Install dependencies
@@ -109,12 +108,12 @@ jobs:
strategy:
matrix:
OS: [ubuntu-latest]
- NODE_VERSION: [18, 20]
+ NODE_VERSION: [18, 20, 22]
include:
- os: macos-14
- NODE_VERSION: 18
+ NODE_VERSION: 22
- os: windows-latest
- NODE_VERSION: 18
+ NODE_VERSION: 22
fail-fast: false
env:
NODE_VERSION: ${{ matrix.NODE_VERSION }}
@@ -151,7 +150,7 @@ jobs:
strategy:
matrix:
OS: [ubuntu-latest, windows-latest]
- NODE_VERSION: [18]
+ NODE_VERSION: [22]
fail-fast: false
env:
NODE_VERSION: ${{ matrix.NODE_VERSION }}
@@ -188,7 +187,7 @@ jobs:
strategy:
matrix:
OS: [ubuntu-latest, windows-latest]
- NODE_VERSION: [18]
+ NODE_VERSION: [22]
env:
NODE_VERSION: ${{ matrix.NODE_VERSION }}
steps:
@@ -238,7 +237,7 @@ jobs:
filters: |
docs:
- 'packages/integrations/*/README.md'
- - 'packages/astro/src/@types/astro.ts'
+ - "packages/astro/src/types/public/**"
- 'packages/astro/src/core/errors/errors-data.ts'
- name: Build autogenerated docs pages from current astro branch
diff --git a/.github/workflows/continuous_benchmark.yml b/.github/workflows/continuous_benchmark.yml
index 00a7e0c5b1..1b382f8dc6 100644
--- a/.github/workflows/continuous_benchmark.yml
+++ b/.github/workflows/continuous_benchmark.yml
@@ -37,7 +37,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
- node-version: 18
+ node-version: 22
cache: "pnpm"
- name: Install dependencies
@@ -47,9 +47,10 @@ jobs:
run: pnpm run build
- name: Run the benchmarks
- uses: CodSpeedHQ/action@fa1dcde8d58f2ab0b407a6a24d6cc5a8c1444a8c # v3.1.0
+ uses: CodSpeedHQ/action@513a19673a831f139e8717bf45ead67e47f00044 # v3.2.0
timeout-minutes: 30
with:
- run: pnpm benchmark codspeed
+ working-directory: ./benchmark
+ run: pnpm bench
token: ${{ secrets.CODSPEED_TOKEN }}
diff --git a/.github/workflows/examples-deploy.yml b/.github/workflows/examples-deploy.yml
new file mode 100644
index 0000000000..91ef304f01
--- /dev/null
+++ b/.github/workflows/examples-deploy.yml
@@ -0,0 +1,22 @@
+# This workflow runs when changes to examples are pushed to main.
+# It calls a build hook on Netlify that will redeploy preview.astro.new with the latest changes.
+
+name: Redeploy preview.astro.new
+
+on:
+ push:
+ branches:
+ - main
+ paths:
+ - 'examples/**'
+ workflow_dispatch:
+
+jobs:
+ deploy:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: Send a POST request to Netlify to rebuild preview.astro.new
+ run: 'curl -X POST -d {} ${{ env.BUILD_HOOK }}'
+ env:
+ BUILD_HOOK: ${{ secrets.NETLIFY_PREVIEWS_BUILD_HOOK }}
diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml
index 8723639c7f..b0a0e80c77 100644
--- a/.github/workflows/issue-labeled.yml
+++ b/.github/workflows/issue-labeled.yml
@@ -26,5 +26,5 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
- Hello @${{ github.event.issue.user.login }}. Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository or [StackBlitz](https://astro.new). Issues marked with `needs repro` will be closed if they have no activity within 3 days.
+ Hello @${{ github.event.issue.user.login }}. Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository or [StackBlitz](https://astro.new/repro). Issues marked with `needs repro` will be closed if they have no activity within 3 days.
labels: "needs triage"
diff --git a/.github/workflows/preview-release.yml b/.github/workflows/preview-release.yml
index df6a44f484..bba55c028e 100644
--- a/.github/workflows/preview-release.yml
+++ b/.github/workflows/preview-release.yml
@@ -47,7 +47,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
- node-version: 18
+ node-version: 22
cache: "pnpm"
- name: Install dependencies
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index eb5cd362e5..738028a744 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -7,7 +7,7 @@ on:
- "1-legacy"
- "2-legacy"
- "3-legacy"
- - next
+ - "4-legacy"
defaults:
run:
@@ -35,7 +35,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
- node-version: 18
+ node-version: 22
cache: "pnpm"
- name: Install dependencies
diff --git a/.github/workflows/scripts.yml b/.github/workflows/scripts.yml
index df934876ab..542f943ac3 100644
--- a/.github/workflows/scripts.yml
+++ b/.github/workflows/scripts.yml
@@ -38,7 +38,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
- node-version: 18
+ node-version: 22
cache: "pnpm"
- name: Install dependencies
diff --git a/.github/workflows/snapshot-release.yml b/.github/workflows/snapshot-release.yml
index ae8d3060fa..c12834264c 100644
--- a/.github/workflows/snapshot-release.yml
+++ b/.github/workflows/snapshot-release.yml
@@ -63,7 +63,13 @@ jobs:
ref: ${{ steps.refs.outputs.head_ref }}
fetch-depth: 0
- - run: git fetch origin main:main
+ - name: Extract base branch from .changeset/config.json
+ id: getBaseBranch
+ run: |
+ baseBranch=$(jq -r '.baseBranch' .changeset/config.json)
+ echo "baseBranch=${baseBranch}" >> $GITHUB_OUTPUT
+
+ - run: git fetch origin ${{ steps.getBaseBranch.outputs.baseBranch }}:${{ steps.getBaseBranch.outputs.baseBranch }}
- name: Setup PNPM
uses: pnpm/action-setup@v3
@@ -71,7 +77,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
- node-version: 18
+ node-version: 22
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
diff --git a/.github/workflows/sync-examples.yml b/.github/workflows/sync-examples.yml
index a18d62738e..8603a951e8 100644
--- a/.github/workflows/sync-examples.yml
+++ b/.github/workflows/sync-examples.yml
@@ -12,7 +12,6 @@ on:
push:
branches:
- main
- - next
# Automatically cancel in-progress actions on the same branch
concurrency:
diff --git a/.github/workflows/test-hosts.yml b/.github/workflows/test-hosts.yml
index e26e250d23..546d82e07a 100644
--- a/.github/workflows/test-hosts.yml
+++ b/.github/workflows/test-hosts.yml
@@ -27,7 +27,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
- node-version: 18
+ node-version: 22
cache: 'pnpm'
- name: Install dependencies
diff --git a/.vscode/settings.json b/.vscode/settings.json
index a626d0892c..97aeabec0f 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -15,7 +15,7 @@
"editor.defaultFormatter": "biomejs.biome"
},
"editor.codeActionsOnSave": {
- "quickFix.biome": "explicit",
- "source.fixAll.biome": "explicit"
- }
+ "quickFix.biome": "explicit",
+ "source.fixAll.biome": "explicit"
+ }
}
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4464b99fbe..d44be03b8c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -289,7 +289,7 @@ Server-side rendering (SSR) can be complicated. The Astro package (`packages/ast
- `components/`: Built-in components to use in your project (e.g. `import Code from 'astro/components/Code.astro'`)
- `src/`: Astro source
- - `@types/`: TypeScript types. These are centralized to cut down on circular dependencies
+ - `types/`: TypeScript types. These are centralized to cut down on circular dependencies
- `cli/`: Code that powers the `astro` CLI command
- `core/`: Code that executes **in the top-level scope** (in Node). Within, you’ll find code that powers the `astro build` and `astro dev` commands, as well as top-level SSR code.
- `runtime/`: Code that executes **in different scopes** (i.e. not in a pure Node context). You’ll have to think about code differently here.
@@ -369,20 +369,22 @@ Full documentation: https://github.com/changesets/changesets/blob/main/docs/prer
### Entering prerelease mode
-If you have gotten permission from the core contributors, you can enter into prerelease mode by following the following steps:
+If you have gotten permission from the core contributors, you can enter into prerelease mode with the following steps:
- Run: `pnpm exec changeset pre enter next` in the project root
+- Update `.changeset/config.json` with `"baseBranch": "next"` (for easier changesets creation)
- Create a new PR from the changes created by this command
-- Review, approve, and more the PR to enter prerelease mode.
+- Review, approve, and merge the PR to enter prerelease mode.
- If successful, The "[ci] release" PR (if one exists) will now say "[ci] release (next)".
### Exiting prerelease mode
-Exiting prerelease mode should happen once an experimental release is ready to go from `npm install astro@next` to `npm install astro`. Only a core contributor run these steps. These steps should be run before
+Exiting prerelease mode should happen once an experimental release is ready to go from `npm install astro@next` to `npm install astro`. Only a core contributor can run these steps:
- Run: `pnpm exec changeset pre exit` in the project root
+- Update `.changeset/config.json` with `"baseBranch": "main"`
- Create a new PR from the changes created by this command.
-- Review, approve, and more the PR to enter prerelease mode.
+- Review, approve, and merge the PR to enter prerelease mode.
- If successful, The "[ci] release (next)" PR (if one exists) will now say "[ci] release".
### Releasing `astro@latest` while in prerelease mode
diff --git a/README.md b/README.md
index 668594fdf5..f42323a863 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,6 @@
[](https://github.com/withastro/astro/actions/workflows/ci.yml)
-[](https://github.com/withastro/astro/actions/workflows/ci.yml)
[](https://github.com/withastro/astro/blob/main/LICENSE)
[](https://badge.fury.io/js/astro)
diff --git a/benchmark/bench/_template.js b/benchmark/bench/_template.js
index 867ecf13b6..ae96d72ad5 100644
--- a/benchmark/bench/_template.js
+++ b/benchmark/bench/_template.js
@@ -6,7 +6,7 @@ export const defaultProject = 'project-name';
* Use `console.log` to report the results too. Logs that start with 10 `=`
* and end with 10 `=` will be extracted by CI to display in the PR comment.
* Usually after the first 10 `=` you'll want to add a title like `#### Test`.
- * @param {URL} projectDir
- * @param {URL} outputFile
+ * @param {URL} _projectDir
+ * @param {URL} _outputFile
*/
-export async function run(projectDir, outputFile) {}
+export async function run(_projectDir, _outputFile) {}
diff --git a/benchmark/bench/_util.js b/benchmark/bench/_util.js
index b16a16e1ce..d9dfe5b190 100644
--- a/benchmark/bench/_util.js
+++ b/benchmark/bench/_util.js
@@ -19,3 +19,14 @@ export function calculateStat(numbers) {
const max = Math.max(...numbers);
return { avg, stdev, max };
}
+
+export async function makeProject(name) {
+ console.log('Making project:', name);
+ const projectDir = new URL(`../projects/${name}/`, import.meta.url);
+
+ const makeProjectMod = await import(`../make-project/${name}.js`);
+ await makeProjectMod.run(projectDir);
+
+ console.log('Finished making project:', name);
+ return projectDir;
+}
diff --git a/benchmark/bench/codspeed.bench.js b/benchmark/bench/codspeed.bench.js
new file mode 100644
index 0000000000..4073ebed85
--- /dev/null
+++ b/benchmark/bench/codspeed.bench.js
@@ -0,0 +1,48 @@
+import { fileURLToPath } from 'node:url';
+import { exec } from 'tinyexec';
+import { beforeAll, bench, describe } from 'vitest';
+import { astroBin, makeProject } from './_util.js';
+let streamingApp;
+let nonStreamingApp;
+beforeAll(async () => {
+ const render = await makeProject('render-bench');
+ const root = fileURLToPath(render);
+ await exec(astroBin, ['build'], {
+ nodeOptions: {
+ cwd: root,
+ stdio: 'inherit',
+ },
+ });
+ const entry = new URL('./dist/server/entry.mjs', `file://${root}`);
+ const { manifest, createApp } = await import(entry);
+ streamingApp = createApp(manifest, true);
+ nonStreamingApp = createApp(manifest, false);
+}, 900000);
+
+describe('Bench rendering', () => {
+ bench('Rendering: streaming [true], .astro file', async () => {
+ const request = new Request(new URL('http://exmpale.com/astro'));
+ await streamingApp.render(request);
+ });
+ bench('Rendering: streaming [true], .md file', async () => {
+ const request = new Request(new URL('http://exmpale.com/md'));
+ await streamingApp.render(request);
+ });
+ bench('Rendering: streaming [true], .mdx file', async () => {
+ const request = new Request(new URL('http://exmpale.com/mdx'));
+ await streamingApp.render(request);
+ });
+
+ bench('Rendering: streaming [false], .astro file', async () => {
+ const request = new Request(new URL('http://exmpale.com/astro'));
+ await nonStreamingApp.render(request);
+ });
+ bench('Rendering: streaming [false], .md file', async () => {
+ const request = new Request(new URL('http://exmpale.com/md'));
+ await nonStreamingApp.render(request);
+ });
+ bench('Rendering: streaming [false], .mdx file', async () => {
+ const request = new Request(new URL('http://exmpale.com/mdx'));
+ await nonStreamingApp.render(request);
+ });
+});
diff --git a/benchmark/bench/codspeed.js b/benchmark/bench/codspeed.js
deleted file mode 100644
index 2643b1ec8a..0000000000
--- a/benchmark/bench/codspeed.js
+++ /dev/null
@@ -1,64 +0,0 @@
-import path from 'node:path';
-import { withCodSpeed } from '@codspeed/tinybench-plugin';
-import { Bench } from 'tinybench';
-import { exec } from 'tinyexec';
-import { astroBin } from './_util.js';
-
-export async function run({ memory: _memory, render, stress: _stress }) {
- const options = {
- iterations: 10,
- };
- const bench = process.env.CODSPEED ? withCodSpeed(new Bench(options)) : new Bench(options);
- 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 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/index.js b/benchmark/index.js
index 2f2846e1db..956b9c3afa 100755
--- a/benchmark/index.js
+++ b/benchmark/index.js
@@ -1,7 +1,8 @@
-import mri from 'mri';
import fs from 'node:fs/promises';
import path from 'node:path';
-import {fileURLToPath, pathToFileURL} from 'node:url';
+import { fileURLToPath, pathToFileURL } from 'node:url';
+import mri from 'mri';
+import { makeProject } from './bench/_util.js';
const args = mri(process.argv.slice(2));
@@ -14,7 +15,6 @@ Command
memory Run build memory and speed test
render Run rendering speed test
server-stress Run server stress test
- codspeed Run codspeed test
cli-startup Run CLI startup speed test
Options
@@ -30,7 +30,6 @@ const benchmarks = {
render: () => import('./bench/render.js'),
'server-stress': () => import('./bench/server-stress.js'),
'cli-startup': () => import('./bench/cli-startup.js'),
- codspeed: () => import('./bench/codspeed.js')
};
if (commandName && !(commandName in benchmarks)) {
@@ -39,26 +38,12 @@ if (commandName && !(commandName in benchmarks)) {
}
if (commandName) {
- if (commandName === 'codspeed') {
- const render = await makeProject('render-bench');
- const rootRender = fileURLToPath(render);
- const bench = benchmarks[commandName];
- const benchMod = await bench();
- const payload = {
- render: {
- root: rootRender,
- output: await getOutputFile('render')
- },
- };
- await benchMod.run(payload);
- } else {
- // Run single benchmark
- const bench = benchmarks[commandName];
- const benchMod = await bench();
- const projectDir = await makeProject(args.project || benchMod.defaultProject);
- const outputFile = await getOutputFile(commandName);
- await benchMod.run(projectDir, outputFile);
- }
+ // Run single benchmark
+ const bench = benchmarks[commandName];
+ const benchMod = await bench();
+ const projectDir = await makeProject(args.project || benchMod.defaultProject);
+ const outputFile = await getOutputFile(commandName);
+ await benchMod.run(projectDir, outputFile);
} else {
// Run all benchmarks
for (const name in benchmarks) {
@@ -70,21 +55,10 @@ if (commandName) {
}
}
-export async function makeProject(name) {
- console.log('Making project:', name);
- const projectDir = new URL(`./projects/${name}/`, import.meta.url);
-
- const makeProjectMod = await import(`./make-project/${name}.js`);
- await makeProjectMod.run(projectDir);
-
- console.log('Finished making project:', name);
- return projectDir;
-}
-
/**
* @param {string} benchmarkName
*/
-async function getOutputFile(benchmarkName) {
+export async function getOutputFile(benchmarkName) {
let file;
if (args.output) {
file = pathToFileURL(path.resolve(args.output));
diff --git a/benchmark/make-project/markdown-cc1.js b/benchmark/make-project/markdown-cc1.js
index 6c83959601..1e3aaa5177 100644
--- a/benchmark/make-project/markdown-cc1.js
+++ b/benchmark/make-project/markdown-cc1.js
@@ -8,11 +8,13 @@ export async function run(projectDir) {
await fs.rm(projectDir, { recursive: true, force: true });
await fs.mkdir(new URL('./src/pages/blog', projectDir), { recursive: true });
await fs.mkdir(new URL('./src/content/blog', projectDir), { recursive: true });
- await fs.copyFile(new URL('./image.jpg', import.meta.url), new URL('./src/image.jpg', projectDir));
+ await fs.copyFile(
+ new URL('./image.jpg', import.meta.url),
+ new URL('./src/image.jpg', projectDir),
+ );
const promises = [];
-
for (let i = 0; i < 10000; i++) {
const content = `\
# Article ${i}
@@ -24,11 +26,10 @@ ${loremIpsumMd}
`;
promises.push(
- fs.writeFile(new URL(`./src/content/blog/article-${i}.md`, projectDir), content, 'utf-8')
+ fs.writeFile(new URL(`./src/content/blog/article-${i}.md`, projectDir), content, 'utf-8'),
);
}
-
await fs.writeFile(
new URL(`./src/pages/blog/[...slug].astro`, projectDir),
`\
@@ -46,7 +47,7 @@ const { Content } = await entry.render();
{entry.data.title}
`,
- 'utf-8'
+ 'utf-8',
);
await Promise.all(promises);
@@ -58,6 +59,6 @@ import { defineConfig } from 'astro/config';
export default defineConfig({
});`,
- 'utf-8'
+ 'utf-8',
);
}
diff --git a/benchmark/make-project/markdown-cc2.js b/benchmark/make-project/markdown-cc2.js
index 73c6afe7a8..ba60813c0d 100644
--- a/benchmark/make-project/markdown-cc2.js
+++ b/benchmark/make-project/markdown-cc2.js
@@ -23,7 +23,7 @@ ${loremIpsumMd}
`;
promises.push(
- fs.writeFile(new URL(`./data/blog/article-${i}.md`, projectDir), content, 'utf-8')
+ fs.writeFile(new URL(`./data/blog/article-${i}.md`, projectDir), content, 'utf-8'),
);
}
@@ -39,7 +39,7 @@ ${loremIpsumMd}
export const collections = { blog }
- `
+ `,
);
await fs.writeFile(
@@ -60,7 +60,7 @@ const { Content } = await render(entry);
{entry.data.title}
`,
- 'utf-8'
+ 'utf-8',
);
await Promise.all(promises);
@@ -70,11 +70,7 @@ const { Content } = await render(entry);
`\
import { defineConfig } from 'astro/config';
-export default defineConfig({
- experimental: {
- contentLayer: true
- }
-});`,
- 'utf-8'
+export default defineConfig({});`,
+ 'utf-8',
);
}
diff --git a/benchmark/make-project/mdx-cc1.js b/benchmark/make-project/mdx-cc1.js
index 98e1495d13..a948ce1940 100644
--- a/benchmark/make-project/mdx-cc1.js
+++ b/benchmark/make-project/mdx-cc1.js
@@ -8,11 +8,13 @@ export async function run(projectDir) {
await fs.rm(projectDir, { recursive: true, force: true });
await fs.mkdir(new URL('./src/pages/blog', projectDir), { recursive: true });
await fs.mkdir(new URL('./src/content/blog', projectDir), { recursive: true });
- await fs.copyFile(new URL('./image.jpg', import.meta.url), new URL('./src/image.jpg', projectDir));
+ await fs.copyFile(
+ new URL('./image.jpg', import.meta.url),
+ new URL('./src/image.jpg', projectDir),
+ );
const promises = [];
-
for (let i = 0; i < 10000; i++) {
const content = `\
# Article ${i}
@@ -24,11 +26,10 @@ ${loremIpsumMd}
`;
promises.push(
- fs.writeFile(new URL(`./src/content/blog/article-${i}.mdx`, projectDir), content, 'utf-8')
+ fs.writeFile(new URL(`./src/content/blog/article-${i}.mdx`, projectDir), content, 'utf-8'),
);
}
-
await fs.writeFile(
new URL(`./src/pages/blog/[...slug].astro`, projectDir),
`\
@@ -46,7 +47,7 @@ const { Content } = await entry.render();
{entry.data.title}
`,
- 'utf-8'
+ 'utf-8',
);
await Promise.all(promises);
@@ -61,6 +62,6 @@ import mdx from '@astrojs/mdx';
export default defineConfig({
integrations: [mdx()],
});`,
- 'utf-8'
+ 'utf-8',
);
}
diff --git a/benchmark/make-project/mdx-cc2.js b/benchmark/make-project/mdx-cc2.js
index c08c2fb9fe..f50b63c9ee 100644
--- a/benchmark/make-project/mdx-cc2.js
+++ b/benchmark/make-project/mdx-cc2.js
@@ -23,7 +23,7 @@ ${loremIpsumMd}
`;
promises.push(
- fs.writeFile(new URL(`./data/blog/article-${i}.mdx`, projectDir), content, 'utf-8')
+ fs.writeFile(new URL(`./data/blog/article-${i}.mdx`, projectDir), content, 'utf-8'),
);
}
@@ -39,7 +39,7 @@ ${loremIpsumMd}
export const collections = { blog }
- `
+ `,
);
await fs.writeFile(
@@ -60,7 +60,7 @@ const { Content } = await render(entry);
{entry.data.title}
`,
- 'utf-8'
+ 'utf-8',
);
await Promise.all(promises);
@@ -74,10 +74,7 @@ import mdx from '@astrojs/mdx';
export default defineConfig({
integrations: [mdx()],
- experimental: {
- contentLayer: true
- }
});`,
- 'utf-8'
+ 'utf-8',
);
}
diff --git a/benchmark/make-project/memory-default.js b/benchmark/make-project/memory-default.js
index e3652dd579..1087c3d4aa 100644
--- a/benchmark/make-project/memory-default.js
+++ b/benchmark/make-project/memory-default.js
@@ -20,7 +20,7 @@ const i = ${i};
{i}
`;
promises.push(
- fs.writeFile(new URL(`./src/pages/page-${i}.astro`, projectDir), content, 'utf-8')
+ fs.writeFile(new URL(`./src/pages/page-${i}.astro`, projectDir), content, 'utf-8'),
);
}
@@ -31,7 +31,7 @@ const i = ${i};
${loremIpsum}
`;
promises.push(
- fs.writeFile(new URL(`./src/content/blog/article-${i}.md`, projectDir), content, 'utf-8')
+ fs.writeFile(new URL(`./src/content/blog/article-${i}.md`, projectDir), content, 'utf-8'),
);
}
@@ -42,7 +42,7 @@ ${loremIpsum}
${loremIpsum}
`;
promises.push(
- fs.writeFile(new URL(`./src/content/blog/post-${i}.mdx`, projectDir), content, 'utf-8')
+ fs.writeFile(new URL(`./src/content/blog/post-${i}.mdx`, projectDir), content, 'utf-8'),
);
}
@@ -63,7 +63,7 @@ const { Content } = await entry.render();
{entry.data.title}
`,
- 'utf-8'
+ 'utf-8',
);
await Promise.all(promises);
@@ -77,6 +77,6 @@ import mdx from '@astrojs/mdx';
export default defineConfig({
integrations: [mdx()],
});`,
- 'utf-8'
+ 'utf-8',
);
}
diff --git a/benchmark/make-project/render-bench.js b/benchmark/make-project/render-bench.js
index 9d10d9bf5f..e2964fbd23 100644
--- a/benchmark/make-project/render-bench.js
+++ b/benchmark/make-project/render-bench.js
@@ -112,7 +112,7 @@ export async function run(projectDir) {
await Promise.all(
Object.entries(renderFiles).map(([name, content]) => {
return fs.writeFile(new URL(`./src/${name}`, projectDir), content, 'utf-8');
- })
+ }),
);
await fs.writeFile(
@@ -127,6 +127,6 @@ export default defineConfig({
output: 'server',
adapter: adapter(),
});`,
- 'utf-8'
+ 'utf-8',
);
}
diff --git a/benchmark/make-project/render-default.js b/benchmark/make-project/render-default.js
index f42340fd3b..7ea54b936e 100644
--- a/benchmark/make-project/render-default.js
+++ b/benchmark/make-project/render-default.js
@@ -112,7 +112,7 @@ export async function run(projectDir) {
await Promise.all(
Object.entries(renderFiles).map(([name, content]) => {
return fs.writeFile(new URL(`./src/${name}`, projectDir), content, 'utf-8');
- })
+ }),
);
await fs.writeFile(
@@ -127,6 +127,6 @@ export default defineConfig({
output: 'server',
adapter: timer(),
});`,
- 'utf-8'
+ 'utf-8',
);
}
diff --git a/benchmark/make-project/server-stress-default.js b/benchmark/make-project/server-stress-default.js
index 79e8b260af..1724f8f825 100644
--- a/benchmark/make-project/server-stress-default.js
+++ b/benchmark/make-project/server-stress-default.js
@@ -38,13 +38,13 @@ const content = "${loremIpsum}"