diff --git a/packages/astro/performance/fixtures/md/package.json b/packages/astro/performance/fixtures/md/package.json index 8213de22c..1a00dc341 100644 --- a/packages/astro/performance/fixtures/md/package.json +++ b/packages/astro/performance/fixtures/md/package.json @@ -1,15 +1,17 @@ { - "name": "md", + "name": "@performance/md", "version": "1.0.0", "description": "", "main": "index.js", + "private": true, "scripts": { "build": "astro build --perf" }, "keywords": [], "author": "", - "license": "ISC", + "license": "unlicensed", "dependencies": { + "@performance/utils": "^0.0.0", "astro": "^2.0.12" } } diff --git a/packages/astro/performance/fixtures/md/src/pages/index.astro b/packages/astro/performance/fixtures/md/src/pages/index.astro index 5fc1d7ed6..e76157139 100644 --- a/packages/astro/performance/fixtures/md/src/pages/index.astro +++ b/packages/astro/performance/fixtures/md/src/pages/index.astro @@ -1,29 +1,8 @@ --- -import { getCollection } from "astro:content"; +import { getCollection } from 'astro:content'; +import { RenderContent } from '@performance/utils'; -const posts = await getCollection('posts'); +const posts = await getCollection('generated'); --- - - - - - - - Md render test - - - { - posts.map(async (entry) => { - const { Content } = await entry.render(); - return ( -
-

{entry.data.title}

-

{entry.data.description}

- -
- ); - }) - } - - + diff --git a/packages/astro/performance/fixtures/utils/RenderContent.astro b/packages/astro/performance/fixtures/utils/RenderContent.astro new file mode 100644 index 000000000..ae0d45f4b --- /dev/null +++ b/packages/astro/performance/fixtures/utils/RenderContent.astro @@ -0,0 +1,31 @@ +--- +type Props = { + posts: any[]; +} + +const { posts } = Astro.props; +--- + + + + + + + + Md render test + + + { + posts.map(async (entry) => { + const { Content } = await entry.render(); + return ( +
+

{entry.data.title}

+

{entry.data.description}

+ +
+ ); + }) + } + + diff --git a/packages/astro/performance/fixtures/utils/index.ts b/packages/astro/performance/fixtures/utils/index.ts new file mode 100644 index 000000000..d906362a3 --- /dev/null +++ b/packages/astro/performance/fixtures/utils/index.ts @@ -0,0 +1,2 @@ +// @ts-ignore +export { default as RenderContent } from './RenderContent.astro'; diff --git a/packages/astro/performance/fixtures/utils/package.json b/packages/astro/performance/fixtures/utils/package.json new file mode 100644 index 000000000..50174fdbb --- /dev/null +++ b/packages/astro/performance/fixtures/utils/package.json @@ -0,0 +1,17 @@ +{ + "name": "@performance/utils", + "version": "0.0.0", + "description": "", + "main": "index.js", + "type": "module", + "private": true, + "keywords": [], + "author": "", + "license": "unlicensed", + "devDependencies": { + "astro": "^2.0.12" + }, + "exports": { + ".": "./index.ts" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1872741e4..8eff0b9b3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1106,10 +1106,31 @@ importers: astro: link:../../.. vue: 3.2.47 + packages/astro/performance: + specifiers: {} + packages/astro/performance/fixtures/md: specifiers: + '@performance/utils': ^0.0.0 astro: ^2.0.12 dependencies: + '@performance/utils': link:../utils + astro: link:../../.. + + packages/astro/performance/fixtures/mdx: + specifiers: + '@astrojs/mdx': ^0.16.2 + '@performance/utils': ^0.0.0 + astro: ^2.0.12 + dependencies: + '@astrojs/mdx': link:../../../../integrations/mdx + '@performance/utils': link:../utils + astro: link:../../.. + + packages/astro/performance/fixtures/utils: + specifiers: + astro: ^2.0.12 + devDependencies: astro: link:../../.. packages/astro/test/benchmark/simple: