diff --git a/benchmark/bench/_util.js b/benchmark/bench/_util.js index c9108695c..23c472604 100644 --- a/benchmark/bench/_util.js +++ b/benchmark/bench/_util.js @@ -1,6 +1,9 @@ -import { createRequire } from 'module'; +import { createRequire } from 'node:module'; +import path from 'node:path'; -export const astroBin = createRequire(import.meta.url).resolve('astro'); +const astroPkgPath = createRequire(import.meta.url).resolve('astro/package.json'); + +export const astroBin = path.resolve(astroPkgPath, '../astro.js'); /** @typedef {{ avg: number, stdev: number, max: number }} Stat */ diff --git a/benchmark/make-project/server-stress-default.js b/benchmark/make-project/server-stress-default.js index 20094daa6..cbeeeda3b 100644 --- a/benchmark/make-project/server-stress-default.js +++ b/benchmark/make-project/server-stress-default.js @@ -7,11 +7,13 @@ import { loremIpsum } from './_util.js'; export async function run(projectDir) { await fs.rm(projectDir, { recursive: true, force: true }); await fs.mkdir(new URL('./src/pages', projectDir), { recursive: true }); + await fs.mkdir(new URL('./src/components', projectDir), { recursive: true }); await fs.writeFile( new URL('./src/pages/index.astro', projectDir), `\ --- +import Paragraph from '../components/Paragraph.astro' const content = "${loremIpsum}" --- @@ -25,13 +27,22 @@ const content = "${loremIpsum}"
{content}
')} + ${Array.from({ length: 100 }).map(() => '{content}
').join('\n')} +