diff --git a/.changeset/giant-ravens-look.md b/.changeset/giant-ravens-look.md new file mode 100644 index 0000000000..dfa5d6d95b --- /dev/null +++ b/.changeset/giant-ravens-look.md @@ -0,0 +1,50 @@ +--- +'astro': minor +--- + +Adds a new `astro:routes:resolved` hook to the Integration API. Also update the `astro:build:done` hook by deprecating `routes` and adding a new `assets` map. + +When building an integration, you can now get access to routes inside the `astro:routes:resolved` hook: + +```js +const integration = () => { + return { + name: 'my-integration', + hooks: { + 'astro:routes:resolved': ({ routes }) => { + console.log(routes) + } + } + } +} +``` + +This hook runs before `astro:config:done`, and whenever a route changes in development. + +The `routes` array from `astro:build:done` is now deprecated, and exposed properties are now available on `astro:routes:resolved`, except for `distURL`. For this, you can use the newly exposed `assets` map: + +```diff +const integration = () => { ++ let routes + return { + name: 'my-integration', + hooks: { ++ 'astro:routes:resolved': (params) => { ++ routes = params.routes ++ }, + 'astro:build:done': ({ +- routes ++ assets + }) => { ++ for (const route of routes) { ++ const distURL = assets.get(route.pattern) ++ if (distURL) { ++ Object.assign(route, { distURL }) ++ } ++ } + console.log(routes) + } + } + } +} +``` \ No newline at end of file diff --git a/.changeset/pre.json b/.changeset/pre.json index a08df62b1c..f49826835c 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -34,12 +34,15 @@ "afraid-apricots-buy", "blue-boats-relax", "blue-sloths-stare", + "blue-socks-doubt", "brave-elephants-fly", "breezy-colts-promise", + "brown-bulldogs-share", "chatty-teachers-sit", "chilly-terms-know", "clean-camels-drive", "clean-donuts-walk", + "clean-moles-rest", "cold-bananas-hear", "cool-mangos-shop", "cuddly-shoes-press", @@ -61,6 +64,7 @@ "funny-wolves-dream", "fuzzy-pugs-live", "gentle-scissors-bow", + "giant-ravens-look", "giant-rocks-thank", "gorgeous-foxes-divide", "healthy-ads-scream", @@ -95,8 +99,10 @@ "poor-seals-clap", "pretty-walls-camp", "proud-games-repair", + "proud-terms-swim", "quick-ads-exercise", "quick-onions-leave", + "rotten-dodos-judge", "rotten-phones-scream", "selfish-cats-crash", "selfish-impalas-grin", @@ -116,6 +122,7 @@ "tame-rats-cross", "ten-students-repair", "ten-walls-tap", + "thirty-clocks-jump", "three-days-cough", "three-olives-reflect", "tough-planets-dress", diff --git a/.changeset/proud-terms-swim.md b/.changeset/proud-terms-swim.md index e33b3d1aff..08824a8aba 100644 --- a/.changeset/proud-terms-swim.md +++ b/.changeset/proud-terms-swim.md @@ -1,5 +1,90 @@ --- -'astro': patch +'astro': minor --- -Adds experimental reponsive image support +Adds experimental support for automatic responsive images + +This feature is experimental and may change in future versions. To enable it, set `experimental.responsiveImages` to `true` in your `astro.config.mjs` file. + + ```js title=astro.config.mjs + { + experimental: { + responsiveImages: true, + }, + } + ``` + + When this flag is enabled, you can pass a `layout` prop to any `` or `` component to create a responsive image. When a layout is set, images have automatically generated `srcset` and `sizes` attributes based on the image's dimensions and the layout type. Images with `responsive` and `full-width` layouts will have styles applied to ensure they resize according to their container. + + ```astro + --- + import { Image, Picture } from 'astro:assets'; + import myImage from '../assets/my_image.png'; + --- + A description of my image. + + ``` + This `` component will generate the following HTML output: + ```html title=Output + + A description of my image + ``` + + #### Responsive image properties + + These are additional properties available to the `` and `` components when responsive images are enabled: + + - `layout`: The layout type for the image. Can be `responsive`, `fixed`, `full-width` or `none`. Defaults to value of `image.experimentalLayout`. + - `fit`: Defines how the image should be cropped if the aspect ratio is changed. Values match those of CSS `object-fit`. Defaults to `cover`, or the value of `image.experimentalObjectFit` if set. + - `position`: Defines the position of the image crop if the aspect ratio is changed. Values match those of CSS `object-position`. Defaults to `center`, or the value of `image.experimentalObjectPosition` if set. + - `priority`: If set, eagerly loads the image. Otherwise images will be lazy-loaded. Use this for your largest above-the-fold image. Defaults to `false`. + +#### Default responsive image settings + + You can enable responsive images for all `` and `` components by setting `image.experimentalLayout` with a default value. This can be overridden by the `layout` prop on each component. + + **Example:** + ```js title=astro.config.mjs + { + image: { + // Used for all `` and `` components unless overridden + experimentalLayout: 'responsive', + }, + experimental: { + responsiveImages: true, + }, + } + ``` + + ```astro + --- + import { Image } from 'astro:assets'; + import myImage from '../assets/my_image.png'; + --- + + This will use responsive layout + + This will use full-width layout + + This will disable responsive images + ``` + +For a complete overview, and to give feedback on this experimental API, see the [Responsive Images RFC](https://github.com/withastro/roadmap/blob/responsive-images/proposals/0053-responsive-images.md). diff --git a/.changeset/rotten-dodos-judge.md b/.changeset/rotten-dodos-judge.md new file mode 100644 index 0000000000..cb1cea275e --- /dev/null +++ b/.changeset/rotten-dodos-judge.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Call server island early so it can set headers diff --git a/.changeset/thirty-clocks-jump.md b/.changeset/thirty-clocks-jump.md new file mode 100644 index 0000000000..39864b2ecb --- /dev/null +++ b/.changeset/thirty-clocks-jump.md @@ -0,0 +1,7 @@ +--- +'astro': minor +--- + +Changes the default content config location from `src/content/config.*` to `src/content.config.*`. + +The previous location is still supported, and is required if the `legacy.collections` flag is enabled. diff --git a/.github/scripts/announce.mjs b/.github/scripts/announce.mjs index 346e0f112b..2e05a7ae8a 100755 --- a/.github/scripts/announce.mjs +++ b/.github/scripts/announce.mjs @@ -1,6 +1,6 @@ -import { globby as glob } from 'globby'; -import { fileURLToPath } from 'node:url'; import { readFile } from 'node:fs/promises'; +import { fileURLToPath } from 'node:url'; +import { globby as glob } from 'globby'; import { setOutput } from './utils.mjs'; const { GITHUB_REF = 'main' } = process.env; @@ -18,34 +18,34 @@ const descriptors = [ 'updates', ]; const verbs = [ - "just went out!", - "just launched!", - "now available!", - "in the wild!", - "now live!", - "hit the registry!", - "to share!", - "for you!", - "for y’all! 🤠", - "comin’ your way!", - "comin’ atcha!", - "comin’ in hot!", - "freshly minted on the blockchain! (jk)", - "[is] out (now with 100% more reticulated splines!)", - "(as seen on TV!)", - "just dropped!", - "– artisanally hand-crafted just for you.", - "– oh happy day!", - "– enjoy!", - "now out. Be the first on your block to download!", - "made with love 💕", - "[is] out! Our best [version] yet!", - "[is] here. DOWNLOAD! DOWNLOAD! DOWNLOAD!", - "... HUZZAH!", - "[has] landed!", - "landed! The internet just got a little more fun.", - "– from our family to yours.", - "– go forth and build!" + 'just went out!', + 'just launched!', + 'now available!', + 'in the wild!', + 'now live!', + 'hit the registry!', + 'to share!', + 'for you!', + 'for y’all! 🤠', + 'comin’ your way!', + 'comin’ atcha!', + 'comin’ in hot!', + 'freshly minted on the blockchain! (jk)', + '[is] out (now with 100% more reticulated splines!)', + '(as seen on TV!)', + 'just dropped!', + '– artisanally hand-crafted just for you.', + '– oh happy day!', + '– enjoy!', + 'now out. Be the first on your block to download!', + 'made with love 💕', + '[is] out! Our best [version] yet!', + '[is] here. DOWNLOAD! DOWNLOAD! DOWNLOAD!', + '... HUZZAH!', + '[has] landed!', + 'landed! The internet just got a little more fun.', + '– from our family to yours.', + '– go forth and build!', ]; const extraVerbs = [ 'new', @@ -72,7 +72,7 @@ const plurals = new Map([ function pluralize(text) { return text.replace(/(\[([^\]]+)\])/gm, (_, _full, match) => - plurals.has(match) ? plurals.get(match) : `${match}s` + plurals.has(match) ? plurals.get(match) : `${match}s`, ); } @@ -91,7 +91,7 @@ async function generatePackageMap() { const pkgFile = fileURLToPath(new URL(pkg, packageRoot)); const content = await readFile(pkgFile).then((res) => JSON.parse(res.toString())); packageMap.set(content.name, `./packages/${pkg.replace('/package.json', '')}`); - }) + }), ); } @@ -110,7 +110,7 @@ async function generateMessage() { version, url: new URL(`${p}/CHANGELOG.md#${version.replace(/\./g, '')}`, baseUrl).toString(), }; - }) + }), ); const emoji = item(emojis); @@ -122,7 +122,7 @@ async function generateMessage() { if (packages.length === 1) { const { name, version, url } = packages[0]; message += `${emoji} \`${name}@${version}\` ${singularlize( - verb + verb, )}\nRead the [release notes →](<${url}>)\n`; } else { message += `${emoji} Some ${descriptor} ${pluralize(verb)}\n\n`; diff --git a/.github/scripts/bundle-size.mjs b/.github/scripts/bundle-size.mjs index 690d6e9284..76d6b3f297 100644 --- a/.github/scripts/bundle-size.mjs +++ b/.github/scripts/bundle-size.mjs @@ -1,18 +1,18 @@ -import { build } from 'esbuild'; import { existsSync } from 'node:fs'; +import { build } from 'esbuild'; const CLIENT_RUNTIME_PATH = 'packages/astro/src/runtime/client/'; function formatBytes(bytes, decimals = 2) { - if (bytes === 0) return '0 B'; + if (bytes === 0) return '0 B'; - const k = 1024; - const dm = decimals < 0 ? 0 : decimals; - const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + const k = 1024; + const dm = decimals < 0 ? 0 : decimals; + const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; - const i = Math.floor(Math.log(bytes) / Math.log(k)); + const i = Math.floor(Math.log(bytes) / Math.log(k)); - return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; + return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; } export default async function checkBundleSize({ github, context }) { @@ -24,7 +24,7 @@ export default async function checkBundleSize({ github, context }) { pull_number: PR_NUM, }); const clientRuntimeFiles = files.filter((file) => { - return file.filename.startsWith(CLIENT_RUNTIME_PATH) && file.status !== 'removed' + return file.filename.startsWith(CLIENT_RUNTIME_PATH) && file.status !== 'removed'; }); if (clientRuntimeFiles.length === 0) return; @@ -35,17 +35,24 @@ export default async function checkBundleSize({ github, context }) { const output = await bundle(clientRuntimeFiles); for (let [filename, { oldSize, newSize, sourceFile }] of Object.entries(output)) { - filename = ['idle', 'load', 'media', 'only', 'visible'].includes(filename) ? `client:${filename}` : filename; - const prefix = (newSize - oldSize) === 0 ? '' : (newSize - oldSize) > 0 ? '+ ' : '- '; + filename = ['idle', 'load', 'media', 'only', 'visible'].includes(filename) + ? `client:${filename}` + : filename; + const prefix = newSize - oldSize === 0 ? '' : newSize - oldSize > 0 ? '+ ' : '- '; const change = `${prefix}${formatBytes(newSize - oldSize)}`; - table.push(`| [\`${filename}\`](https://github.com/${context.repo.owner}/${context.repo.repo}/tree/${context.payload.pull_request.head.ref}/${sourceFile}) | ${formatBytes(oldSize)} | ${formatBytes(newSize)} | ${change} |`); + table.push( + `| [\`${filename}\`](https://github.com/${context.repo.owner}/${context.repo.repo}/tree/${context.payload.pull_request.head.ref}/${sourceFile}) | ${formatBytes(oldSize)} | ${formatBytes(newSize)} | ${change} |`, + ); } const { data: comments } = await github.rest.issues.listComments({ ...context.repo, - issue_number: PR_NUM - }) - const comment = comments.find(comment => comment.user.login === 'github-actions[bot]' && comment.body.includes('Bundle Size Check')); + issue_number: PR_NUM, + }); + const comment = comments.find( + (comment) => + comment.user.login === 'github-actions[bot]' && comment.body.includes('Bundle Size Check'), + ); const method = comment ? 'updateComment' : 'createComment'; const payload = comment ? { comment_id: comment.id } : { issue_number: PR_NUM }; await github.rest.issues[method]({ @@ -60,9 +67,11 @@ ${table.join('\n')}`, } async function bundle(files) { - const { metafile } = await build({ - entryPoints: [...files.map(({ filename }) => filename), ...files.map(({ filename }) => `main/${filename}`).filter(f => existsSync(f))], + entryPoints: [ + ...files.map(({ filename }) => filename), + ...files.map(({ filename }) => `main/${filename}`).filter((f) => existsSync(f)), + ], bundle: true, minify: true, sourcemap: false, @@ -70,17 +79,24 @@ async function bundle(files) { outdir: 'out', external: ['astro:*', 'aria-query', 'axobject-query'], metafile: true, - }) + }); return Object.entries(metafile.outputs).reduce((acc, [filename, info]) => { filename = filename.slice('out/'.length); if (filename.startsWith('main/')) { filename = filename.slice('main/'.length).replace(CLIENT_RUNTIME_PATH, '').replace('.js', ''); const oldSize = info.bytes; - return Object.assign(acc, { [filename]: Object.assign(acc[filename] ?? { oldSize: 0, newSize: 0 }, { oldSize }) }); + return Object.assign(acc, { + [filename]: Object.assign(acc[filename] ?? { oldSize: 0, newSize: 0 }, { oldSize }), + }); } filename = filename.replace(CLIENT_RUNTIME_PATH, '').replace('.js', ''); const newSize = info.bytes; - return Object.assign(acc, { [filename]: Object.assign(acc[filename] ?? { oldSize: 0, newSize: 0 }, { newSize, sourceFile: Object.keys(info.inputs).find(src => src.endsWith('.ts')) }) }); + return Object.assign(acc, { + [filename]: Object.assign(acc[filename] ?? { oldSize: 0, newSize: 0 }, { + newSize, + sourceFile: Object.keys(info.inputs).find((src) => src.endsWith('.ts')), + }), + }); }, {}); } diff --git a/.github/scripts/utils.mjs b/.github/scripts/utils.mjs index da5befc2c2..7683022301 100644 --- a/.github/scripts/utils.mjs +++ b/.github/scripts/utils.mjs @@ -1,59 +1,53 @@ -import * as fs from 'node:fs' -import * as os from 'node:os' -import * as crypto from 'node:crypto' +import * as crypto from 'node:crypto'; +import * as fs from 'node:fs'; +import * as os from 'node:os'; /** Based on https://github.com/actions/toolkit/blob/4e3b068ce116d28cb840033c02f912100b4592b0/packages/core/src/file-command.ts */ export function setOutput(key, value) { - const filePath = process.env['GITHUB_OUTPUT'] || '' - if (filePath) { - return issueFileCommand('OUTPUT', prepareKeyValueMessage(key, value)) - } - process.stdout.write(os.EOL) + const filePath = process.env['GITHUB_OUTPUT'] || ''; + if (filePath) { + return issueFileCommand('OUTPUT', prepareKeyValueMessage(key, value)); + } + process.stdout.write(os.EOL); } function issueFileCommand(command, message) { - const filePath = process.env[`GITHUB_${command}`] - if (!filePath) { - throw new Error( - `Unable to find environment variable for file command ${command}` - ) - } - if (!fs.existsSync(filePath)) { - throw new Error(`Missing file at path: ${filePath}`) - } + const filePath = process.env[`GITHUB_${command}`]; + if (!filePath) { + throw new Error(`Unable to find environment variable for file command ${command}`); + } + if (!fs.existsSync(filePath)) { + throw new Error(`Missing file at path: ${filePath}`); + } - fs.appendFileSync(filePath, `${toCommandValue(message)}${os.EOL}`, { - encoding: 'utf8' - }) + fs.appendFileSync(filePath, `${toCommandValue(message)}${os.EOL}`, { + encoding: 'utf8', + }); } function prepareKeyValueMessage(key, value) { - const delimiter = `gh-delimiter-${crypto.randomUUID()}` - const convertedValue = toCommandValue(value) + const delimiter = `gh-delimiter-${crypto.randomUUID()}`; + const convertedValue = toCommandValue(value); - // These should realistically never happen, but just in case someone finds a - // way to exploit uuid generation let's not allow keys or values that contain - // the delimiter. - if (key.includes(delimiter)) { - throw new Error( - `Unexpected input: name should not contain the delimiter "${delimiter}"` - ) - } + // These should realistically never happen, but just in case someone finds a + // way to exploit uuid generation let's not allow keys or values that contain + // the delimiter. + if (key.includes(delimiter)) { + throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); + } - if (convertedValue.includes(delimiter)) { - throw new Error( - `Unexpected input: value should not contain the delimiter "${delimiter}"` - ) - } + if (convertedValue.includes(delimiter)) { + throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`); + } - return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}` + return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`; } function toCommandValue(input) { - if (input === null || input === undefined) { - return '' - } else if (typeof input === 'string' || input instanceof String) { - return input - } - return JSON.stringify(input) + if (input === null || input === undefined) { + return ''; + } else if (typeof input === 'string' || input instanceof String) { + return input; + } + return JSON.stringify(input); } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dc024dd3a..7d0331c26b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,9 +95,12 @@ jobs: - name: Build Packages run: pnpm run build - - name: Lint + - name: Lint source code run: pnpm run lint:ci + - name: Lint publish code + run: pnpm run publint + test: name: "Test: ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})" runs-on: ${{ matrix.os }} diff --git a/.github/workflows/continuous_benchmark.yml b/.github/workflows/continuous_benchmark.yml index 10abc7bcd2..00a7e0c5b1 100644 --- a/.github/workflows/continuous_benchmark.yml +++ b/.github/workflows/continuous_benchmark.yml @@ -5,20 +5,24 @@ on: pull_request: branches: - main + paths: + - 'packages/astro/src/**/*.ts' + - 'benchmark/**' push: branches: - main + paths: + - 'packages/astro/src/**/*.ts' + - 'benchmark/**' env: TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TEAM: ${{ secrets.TURBO_TEAM }} FORCE_COLOR: true - CODSPEED_TOKEN: ${{ secrets.CODSPEED_TOKEN }} CODSPEED: true jobs: codspeed: - if: ${{ github.repository_owner == 'withastro' }} runs-on: ubuntu-latest permissions: contents: read @@ -47,4 +51,5 @@ jobs: timeout-minutes: 30 with: run: pnpm benchmark codspeed + token: ${{ secrets.CODSPEED_TOKEN }} diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index 52501fa383..0c7239cfc1 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -16,8 +16,8 @@ Anything enforced by linting and formatting is considered a **style rule.** It i These style rules are maintained in configuration files, and therefore not documented in this document. Read any of the following configuration files to learn more about the style rules that we strictly enforced across the codebase: -- [ESLint](https://github.com/withastro/astro/blob/main/.eslintrc.cjs) (Linting) -- [Prettier](https://github.com/withastro/astro/blob/main/.prettierrc.json) (Formatting) +- [ESLint](https://github.com/withastro/astro/blob/main/eslint.config.js) (Linting) +- [Prettier](https://github.com/withastro/astro/blob/main/prettier.config.js) (Formatting) Alternatively, don't worry too much about style rules and trust that our tools will catch these issues for you and offer inline suggestions as you work. diff --git a/biome.jsonc b/biome.jsonc index edd0ea8717..adadd8f597 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -1,19 +1,13 @@ { "$schema": "https://biomejs.dev/schemas/1.9.3/schema.json", "files": { - "ignore": [ - "vendor", - "**/dist/**", - "**/smoke/**", - "**/fixtures/**", - "**/_temp-fixtures/**", - "**/vendor/**", - "**/.vercel/**", - "benchmark/projects/", - "benchmark/results/", - "benchmark/bench/_template.js", - ], - "include": ["test/**", "e2e/**", "packages/**", "/scripts/**", "benchmark/bench"], + "ignore": ["**/smoke/**", "**/fixtures/**", "**/_temp-fixtures/**", "**/vendor/**"], + "include": ["test/**", "e2e/**", "packages/**", "scripts/**", "benchmark/bench"], + }, + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true, }, "formatter": { "indentStyle": "tab", diff --git a/examples/basics/package.json b/examples/basics/package.json index 7073ff822a..10076e7c54 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.0.0-beta.8" + "astro": "^5.0.0-beta.10" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index 0e13ddef6d..55c4c8e974 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -13,6 +13,6 @@ "@astrojs/mdx": "^4.0.0-beta.3", "@astrojs/rss": "^4.0.9", "@astrojs/sitemap": "^3.2.1", - "astro": "^5.0.0-beta.8" + "astro": "^5.0.0-beta.10" } } diff --git a/examples/blog/src/content/config.ts b/examples/blog/src/content.config.ts similarity index 100% rename from examples/blog/src/content/config.ts rename to examples/blog/src/content.config.ts diff --git a/examples/component/package.json b/examples/component/package.json index 27c20d0592..e7d389c998 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^5.0.0-beta.8" + "astro": "^5.0.0-beta.10" }, "peerDependencies": { "astro": "^4.0.0 || ^5.0.0" diff --git a/examples/container-with-vitest/package.json b/examples/container-with-vitest/package.json index 5cb0084ac1..0bf514bab3 100644 --- a/examples/container-with-vitest/package.json +++ b/examples/container-with-vitest/package.json @@ -11,8 +11,8 @@ "test": "vitest run" }, "dependencies": { - "astro": "^5.0.0-beta.8", - "@astrojs/react": "^3.6.2", + "astro": "^5.0.0-beta.10", + "@astrojs/react": "^3.6.3-beta.0", "react": "^18.3.1", "react-dom": "^18.3.1", "vitest": "^2.1.4" diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index 698088fcfe..3e293ee029 100644 --- a/examples/framework-alpine/package.json +++ b/examples/framework-alpine/package.json @@ -13,6 +13,6 @@ "@astrojs/alpinejs": "^0.4.0", "@types/alpinejs": "^3.13.10", "alpinejs": "^3.14.3", - "astro": "^5.0.0-beta.8" + "astro": "^5.0.0-beta.10" } } diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index bca3430009..2dd01dfdf4 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -10,14 +10,14 @@ "astro": "astro" }, "dependencies": { - "@astrojs/preact": "^3.5.3", - "@astrojs/react": "^3.6.2", - "@astrojs/solid-js": "^4.4.3", - "@astrojs/svelte": "^6.0.0-beta.2", - "@astrojs/vue": "^5.0.0-beta.1", + "@astrojs/preact": "^3.5.4-beta.0", + "@astrojs/react": "^3.6.3-beta.0", + "@astrojs/solid-js": "^4.4.4-beta.0", + "@astrojs/svelte": "^6.0.2-beta.0", + "@astrojs/vue": "^5.0.0-beta.2", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", - "astro": "^5.0.0-beta.8", + "astro": "^5.0.0-beta.10", "preact": "^10.24.3", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index 445c836fcf..71005811f6 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -10,9 +10,9 @@ "astro": "astro" }, "dependencies": { - "@astrojs/preact": "^3.5.3", + "@astrojs/preact": "^3.5.4-beta.0", "@preact/signals": "^1.3.0", - "astro": "^5.0.0-beta.8", + "astro": "^5.0.0-beta.10", "preact": "^10.24.3" } } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index b0541cba7c..2c1d587d40 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -10,10 +10,10 @@ "astro": "astro" }, "dependencies": { - "@astrojs/react": "^3.6.2", + "@astrojs/react": "^3.6.3-beta.0", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", - "astro": "^5.0.0-beta.8", + "astro": "^5.0.0-beta.10", "react": "^18.3.1", "react-dom": "^18.3.1" } diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index da283570d9..a77744ba75 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -10,8 +10,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/solid-js": "^4.4.3", - "astro": "^5.0.0-beta.8", - "solid-js": "^1.9.2" + "@astrojs/solid-js": "^4.4.4-beta.0", + "astro": "^5.0.0-beta.10", + "solid-js": "^1.9.3" } } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index 56e22f6be5..b6ad5c83f6 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", - "astro": "^5.0.0-beta.8", + "@astrojs/svelte": "^6.0.2-beta.0", + "astro": "^5.0.0-beta.10", "svelte": "^5.1.16" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index ae8a1403f3..cd31147fac 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -10,8 +10,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/vue": "^5.0.0-beta.1", - "astro": "^5.0.0-beta.8", + "@astrojs/vue": "^5.0.0-beta.2", + "astro": "^5.0.0-beta.10", "vue": "^3.5.12" } } diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json index 71bdd46ea7..1b0a167ae3 100644 --- a/examples/hackernews/package.json +++ b/examples/hackernews/package.json @@ -11,6 +11,6 @@ }, "dependencies": { "@astrojs/node": "^9.0.0-alpha.1", - "astro": "^5.0.0-beta.8" + "astro": "^5.0.0-beta.10" } } diff --git a/examples/integration/package.json b/examples/integration/package.json index b591fedb58..f6a938729c 100644 --- a/examples/integration/package.json +++ b/examples/integration/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^5.0.0-beta.8" + "astro": "^5.0.0-beta.10" }, "peerDependencies": { "astro": "^4.0.0" diff --git a/examples/minimal/package.json b/examples/minimal/package.json index f792c9b96a..ede3198ce8 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.0.0-beta.8" + "astro": "^5.0.0-beta.10" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index fe41095bdd..c57436a3a7 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.0.0-beta.8" + "astro": "^5.0.0-beta.10" } } diff --git a/examples/portfolio/src/content/config.ts b/examples/portfolio/src/content.config.ts similarity index 100% rename from examples/portfolio/src/content/config.ts rename to examples/portfolio/src/content.config.ts diff --git a/examples/ssr/package.json b/examples/ssr/package.json index 1a468ec123..be337e5e44 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -12,8 +12,8 @@ }, "dependencies": { "@astrojs/node": "^9.0.0-alpha.1", - "@astrojs/svelte": "^6.0.0", - "astro": "^5.0.0-beta.8", + "@astrojs/svelte": "^6.0.2-beta.0", + "astro": "^5.0.0-beta.10", "svelte": "^5.1.16" } } diff --git a/examples/starlog/package.json b/examples/starlog/package.json index ffcae20cca..3c0188e1a9 100644 --- a/examples/starlog/package.json +++ b/examples/starlog/package.json @@ -9,7 +9,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.0.0-beta.8", + "astro": "^5.0.0-beta.10", "sass": "^1.80.6", "sharp": "^0.33.3" } diff --git a/examples/starlog/src/content/config.ts b/examples/starlog/src/content.config.ts similarity index 100% rename from examples/starlog/src/content/config.ts rename to examples/starlog/src/content.config.ts diff --git a/examples/toolbar-app/package.json b/examples/toolbar-app/package.json index 5b03d6f85e..636be71faa 100644 --- a/examples/toolbar-app/package.json +++ b/examples/toolbar-app/package.json @@ -15,6 +15,6 @@ "./app": "./dist/app.js" }, "devDependencies": { - "astro": "^5.0.0-beta.8" + "astro": "^5.0.0-beta.10" } } diff --git a/examples/with-markdoc/package.json b/examples/with-markdoc/package.json index 9916a48510..3203a63909 100644 --- a/examples/with-markdoc/package.json +++ b/examples/with-markdoc/package.json @@ -11,6 +11,6 @@ }, "dependencies": { "@astrojs/markdoc": "^0.12.0-beta.0", - "astro": "^5.0.0-beta.8" + "astro": "^5.0.0-beta.10" } } diff --git a/examples/with-markdoc/src/content/config.ts b/examples/with-markdoc/src/content.config.ts similarity index 100% rename from examples/with-markdoc/src/content/config.ts rename to examples/with-markdoc/src/content.config.ts diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index 4642aa9ef4..b2b3071c47 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -11,8 +11,8 @@ }, "dependencies": { "@astrojs/mdx": "^4.0.0-beta.3", - "@astrojs/preact": "^3.5.3", - "astro": "^5.0.0-beta.8", + "@astrojs/preact": "^3.5.4-beta.0", + "astro": "^5.0.0-beta.10", "preact": "^10.24.3" } } diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 19cd884f95..80cd73b77b 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -10,9 +10,9 @@ "astro": "astro" }, "dependencies": { - "@astrojs/preact": "^3.5.3", + "@astrojs/preact": "^3.5.4-beta.0", "@nanostores/preact": "^0.5.2", - "astro": "^5.0.0-beta.8", + "astro": "^5.0.0-beta.10", "nanostores": "^0.11.3", "preact": "^10.24.3" } diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index fcfe676f17..4e5049ceae 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -13,7 +13,7 @@ "@astrojs/mdx": "^4.0.0-beta.3", "@astrojs/tailwind": "^5.1.2", "@types/canvas-confetti": "^1.6.4", - "astro": "^5.0.0-beta.8", + "astro": "^5.0.0-beta.10", "autoprefixer": "^10.4.20", "canvas-confetti": "^1.9.3", "postcss": "^8.4.47", diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index 24c9cb1b02..912bbbf300 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -11,7 +11,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^5.0.0-beta.8", + "astro": "^5.0.0-beta.10", "vitest": "^2.1.4" } } diff --git a/package.json b/package.json index 56dc0765f8..fb9e1dd266 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "private": true, "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git" + "url": "git+https://github.com/withastro/astro.git" }, "scripts": { "release": "pnpm run build && changeset publish", @@ -37,6 +37,7 @@ "lint": "biome lint && eslint . --report-unused-disable-directives", "lint:ci": "biome ci --formatter-enabled=false --organize-imports-enabled=false --reporter=github && eslint . --report-unused-disable-directives", "lint:fix": "biome lint --write --unsafe", + "publint": "pnpm -r --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --no-bail exec publint", "version": "changeset version && node ./scripts/deps/update-example-versions.js && pnpm install --no-frozen-lockfile && pnpm run format", "preinstall": "npx only-allow pnpm" }, @@ -65,6 +66,7 @@ "only-allow": "^1.2.1", "prettier": "^3.3.3", "prettier-plugin-astro": "^0.14.1", + "publint": "^0.2.12", "turbo": "^2.2.3", "typescript": "~5.6.3", "typescript-eslint": "^8.13.0" diff --git a/packages/astro-prism/package.json b/packages/astro-prism/package.json index 82c0c33605..f3ba16f4e8 100644 --- a/packages/astro-prism/package.json +++ b/packages/astro-prism/package.json @@ -8,7 +8,7 @@ "bugs": "https://github.com/withastro/astro/issues", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/astro-prism" }, "homepage": "https://docs.astro.build/en/reference/api-reference/#prism-", diff --git a/packages/astro-rss/package.json b/packages/astro-rss/package.json index 8de405fd7c..627b4dd6ca 100644 --- a/packages/astro-rss/package.json +++ b/packages/astro-rss/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/astro-rss" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 0cae3a4da7..0781972458 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,201 @@ # astro +## 5.0.0-beta.10 + +### Patch Changes + +- [#12486](https://github.com/withastro/astro/pull/12486) [`dc3d842`](https://github.com/withastro/astro/commit/dc3d842e4c6f3b7e59da8a13447a1450013e10dc) Thanks [@matthewp](https://github.com/matthewp)! - Call server island early so it can set headers + +## 5.0.0-beta.9 + +### Minor Changes + +- [#12067](https://github.com/withastro/astro/pull/12067) [`c48916c`](https://github.com/withastro/astro/commit/c48916cc4e6f7c31e3563d04b68a8698d8775b65) Thanks [@stramel](https://github.com/stramel)! - Adds experimental support for built-in SVG components. + + This feature allows you to import SVG files directly into your Astro project as components. By default, Astro will inline the SVG content into your HTML output. + + To enable this feature, set `experimental.svg` to `true` in your Astro config: + + ```js + { + experimental: { + svg: true, + }, + } + ``` + + To use this feature, import an SVG file in your Astro project, passing any common SVG attributes to the imported component. Astro also provides a `size` attribute to set equal `height` and `width` properties: + + ```astro + --- + import Logo from './path/to/svg/file.svg'; + --- + + + ``` + + For a complete overview, and to give feedback on this experimental API, see the [Feature RFC](https://github.com/withastro/roadmap/pull/1035). + +- [#12329](https://github.com/withastro/astro/pull/12329) [`8309c61`](https://github.com/withastro/astro/commit/8309c61f0dfa5991d3f6c5c5fca4403794d6fda2) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Adds a new `astro:routes:resolved` hook to the Integration API. Also update the `astro:build:done` hook by deprecating `routes` and adding a new `assets` map. + + When building an integration, you can now get access to routes inside the `astro:routes:resolved` hook: + + ```js + const integration = () => { + return { + name: 'my-integration', + hooks: { + 'astro:routes:resolved': ({ routes }) => { + console.log(routes); + }, + }, + }; + }; + ``` + + This hook runs before `astro:config:done`, and whenever a route changes in development. + + The `routes` array from `astro:build:done` is now deprecated, and exposed properties are now available on `astro:routes:resolved`, except for `distURL`. For this, you can use the newly exposed `assets` map: + + ```diff + const integration = () => { + + let routes + return { + name: 'my-integration', + hooks: { + + 'astro:routes:resolved': (params) => { + + routes = params.routes + + }, + 'astro:build:done': ({ + - routes + + assets + }) => { + + for (const route of routes) { + + const distURL = assets.get(route.pattern) + + if (distURL) { + + Object.assign(route, { distURL }) + + } + + } + console.log(routes) + } + } + } + } + ``` + +- [#12377](https://github.com/withastro/astro/pull/12377) [`af867f3`](https://github.com/withastro/astro/commit/af867f3910ecd8fc04a5337f591d84f03192e3fa) Thanks [@ascorbic](https://github.com/ascorbic)! - Adds experimental support for automatic responsive images + + This feature is experimental and may change in future versions. To enable it, set `experimental.responsiveImages` to `true` in your `astro.config.mjs` file. + + ```js title=astro.config.mjs + { + experimental: { + responsiveImages: true, + }, + } + ``` + + When this flag is enabled, you can pass a `layout` prop to any `` or `` component to create a responsive image. When a layout is set, images have automatically generated `srcset` and `sizes` attributes based on the image's dimensions and the layout type. Images with `responsive` and `full-width` layouts will have styles applied to ensure they resize according to their container. + + ```astro + --- + import { Image, Picture } from 'astro:assets'; + import myImage from '../assets/my_image.png'; + --- + + A description of my image. + + ``` + + This `` component will generate the following HTML output: + + ```html title=Output + A description of my image + ``` + + #### Responsive image properties + + These are additional properties available to the `` and `` components when responsive images are enabled: + + - `layout`: The layout type for the image. Can be `responsive`, `fixed`, `full-width` or `none`. Defaults to value of `image.experimentalLayout`. + - `fit`: Defines how the image should be cropped if the aspect ratio is changed. Values match those of CSS `object-fit`. Defaults to `cover`, or the value of `image.experimentalObjectFit` if set. + - `position`: Defines the position of the image crop if the aspect ratio is changed. Values match those of CSS `object-position`. Defaults to `center`, or the value of `image.experimentalObjectPosition` if set. + - `priority`: If set, eagerly loads the image. Otherwise images will be lazy-loaded. Use this for your largest above-the-fold image. Defaults to `false`. + + #### Default responsive image settings + + You can enable responsive images for all `` and `` components by setting `image.experimentalLayout` with a default value. This can be overridden by the `layout` prop on each component. + + **Example:** + + ```js title=astro.config.mjs + { + image: { + // Used for all `` and `` components unless overridden + experimentalLayout: 'responsive', + }, + experimental: { + responsiveImages: true, + }, + } + ``` + + ```astro + --- + import { Image } from 'astro:assets'; + import myImage from '../assets/my_image.png'; + --- + + This will use responsive layout + + This will use full-width layout + + This will disable responsive images + ``` + + For a complete overview, and to give feedback on this experimental API, see the [Responsive Images RFC](https://github.com/withastro/roadmap/blob/responsive-images/proposals/0053-responsive-images.md). + +- [#12475](https://github.com/withastro/astro/pull/12475) [`3f02d5f`](https://github.com/withastro/astro/commit/3f02d5f12b167514fff6eb9693b4e25c668e7a31) Thanks [@ascorbic](https://github.com/ascorbic)! - Changes the default content config location from `src/content/config.*` to `src/content.config.*`. + + The previous location is still supported, and is required if the `legacy.collections` flag is enabled. + +### Patch Changes + +- [#12424](https://github.com/withastro/astro/pull/12424) [`4364bff`](https://github.com/withastro/astro/commit/4364bff27332e52f92da72392620a36110daee42) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where an incorrect usage of Astro actions was lost when porting the fix from v4 to v5 + +- [#12438](https://github.com/withastro/astro/pull/12438) [`c8f877c`](https://github.com/withastro/astro/commit/c8f877cad2d8f1780f70045413872d5b9d32ebed) Thanks [@ascorbic](https://github.com/ascorbic)! - Fixes a bug where legacy content types were generated for content layer collections if they were in the content directory + ## 5.0.0-beta.8 ### Minor Changes @@ -1195,6 +1391,22 @@ - Updated dependencies [[`83a2a64`](https://github.com/withastro/astro/commit/83a2a648418ad30f4eb781d1c1b5f2d8a8ac846e)]: - @astrojs/markdown-remark@6.0.0-alpha.0 +## 4.16.14 + +### Patch Changes + +- [#12480](https://github.com/withastro/astro/pull/12480) [`c3b7e7c`](https://github.com/withastro/astro/commit/c3b7e7cfa13603c08eb923703f31a92d514e82db) Thanks [@matthewp](https://github.com/matthewp)! - Removes the default throw behavior in `astro:env` + +- [#12444](https://github.com/withastro/astro/pull/12444) [`28dd3ce`](https://github.com/withastro/astro/commit/28dd3ce5222a667fe113238254edf59318b3fa14) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where a server island hydration script might fail case the island ID misses from the DOM. + +- [#12476](https://github.com/withastro/astro/pull/12476) [`80a9a52`](https://github.com/withastro/astro/commit/80a9a5299a9d51f2b09900d3200976d687feae8f) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where the Content Layer `glob()` loader would not update when renaming or deleting an entry + +- [#12418](https://github.com/withastro/astro/pull/12418) [`25baa4e`](https://github.com/withastro/astro/commit/25baa4ed0c5f55fa85c2c7e2c15848937ed1dc9b) Thanks [@oliverlynch](https://github.com/oliverlynch)! - Fix cached image redownloading if it is the first asset + +- [#12477](https://github.com/withastro/astro/pull/12477) [`46f6b38`](https://github.com/withastro/astro/commit/46f6b386b3db6332f286d79958ef10261958cceb) Thanks [@ematipico](https://github.com/ematipico)! - Fixes an issue where the SSR build was emitting the `dist/server/entry.mjs` file with an incorrect import at the top of the file/ + +- [#12365](https://github.com/withastro/astro/pull/12365) [`a23985b`](https://github.com/withastro/astro/commit/a23985b02165c2ddce56d511b3f97b6815c452c9) Thanks [@apatel369](https://github.com/apatel369)! - Fixes an issue where `Astro.currentLocale` was not correctly returning the locale for 404 and 500 pages. + ## 4.16.13 ### Patch Changes diff --git a/packages/astro/client.d.ts b/packages/astro/client.d.ts index f9badff245..0832344b4f 100644 --- a/packages/astro/client.d.ts +++ b/packages/astro/client.d.ts @@ -111,7 +111,7 @@ declare module '*.svg' { type Props = { /** * Accesible, short-text description - * + * * {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title|MDN Reference} */ title?: string; @@ -122,9 +122,9 @@ declare module '*.svg' { /** * Override the default rendering mode for SVGs */ - mode?: import('./dist/assets/utils/svg.js').SvgRenderMode - } & astroHTML.JSX.SVGAttributes - + mode?: import('./dist/assets/utils/svg.js').SvgRenderMode; + } & astroHTML.JSX.SVGAttributes; + const Component: ((_props: Props) => any) & ImageMetadata; export default Component; } diff --git a/packages/astro/package.json b/packages/astro/package.json index 4d354b0af4..e1d5a7e428 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,13 +1,13 @@ { "name": "astro", - "version": "5.0.0-beta.8", + "version": "5.0.0-beta.10", "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.", "type": "module", "author": "withastro", "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/astro" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/astro/src/actions/integration.ts b/packages/astro/src/actions/integration.ts index d7c99fc421..13d76e8b60 100644 --- a/packages/astro/src/actions/integration.ts +++ b/packages/astro/src/actions/integration.ts @@ -18,10 +18,11 @@ export default function astroIntegrationActionsRouteHandler({ name: VIRTUAL_MODULE_ID, hooks: { async 'astro:config:setup'(params) { - params.injectRoute({ + settings.injectedRoutes.push({ pattern: ACTION_RPC_ROUTE_PATTERN, entrypoint: 'astro/actions/runtime/route.js', prerender: false, + origin: 'internal', }); params.addMiddleware({ diff --git a/packages/astro/src/assets/build/generate.ts b/packages/astro/src/assets/build/generate.ts index 00261d5b7f..37b6915255 100644 --- a/packages/astro/src/assets/build/generate.ts +++ b/packages/astro/src/assets/build/generate.ts @@ -153,6 +153,9 @@ export async function generateImagesForPath( const isLocalImage = isESMImportedImage(options.src); const finalFileURL = new URL('.' + filepath, env.clientRoot); + const finalFolderURL = new URL('./', finalFileURL); + await fs.promises.mkdir(finalFolderURL, { recursive: true }); + // For remote images, instead of saving the image directly, we save a JSON file with the image data and expiration date from the server const cacheFile = basename(filepath) + (isLocalImage ? '' : '.json'); const cachedFileURL = new URL(cacheFile, env.assetsCacheDir); @@ -194,9 +197,6 @@ export async function generateImagesForPath( // If the cache file doesn't exist, just move on, and we'll generate it } - const finalFolderURL = new URL('./', finalFileURL); - await fs.promises.mkdir(finalFolderURL, { recursive: true }); - // The original filepath or URL from the image transform const originalImagePath = isLocalImage ? (options.src as ImageMetadata).src diff --git a/packages/astro/src/assets/endpoint/config.ts b/packages/astro/src/assets/endpoint/config.ts index a910df25cc..b9309d4469 100644 --- a/packages/astro/src/assets/endpoint/config.ts +++ b/packages/astro/src/assets/endpoint/config.ts @@ -63,5 +63,6 @@ function getImageEndpointData( pathname: settings.config.image.endpoint.route, prerender: false, fallbackRoutes: [], + origin: 'internal', }; } diff --git a/packages/astro/src/assets/internal.ts b/packages/astro/src/assets/internal.ts index 3363a5648d..d9c2db5a05 100644 --- a/packages/astro/src/assets/internal.ts +++ b/packages/astro/src/assets/internal.ts @@ -150,6 +150,7 @@ export async function getImage( resolvedOptions.fetchpriority ??= 'auto'; } delete resolvedOptions.priority; + delete resolvedOptions.densities; } const validatedOptions = service.validateOptions diff --git a/packages/astro/src/assets/utils/index.ts b/packages/astro/src/assets/utils/index.ts index 98044ac9fa..3fae182000 100644 --- a/packages/astro/src/assets/utils/index.ts +++ b/packages/astro/src/assets/utils/index.ts @@ -13,4 +13,4 @@ export { } from './remotePattern.js'; export { hashTransform, propsToFilename } from './transformToPath.js'; export { inferRemoteSize } from './remoteProbe.js'; -export { makeSvgComponent } from './svg.js' +export { makeSvgComponent } from './svg.js'; diff --git a/packages/astro/src/assets/utils/svg.ts b/packages/astro/src/assets/utils/svg.ts index 70088ba64a..6f9c54381c 100644 --- a/packages/astro/src/assets/utils/svg.ts +++ b/packages/astro/src/assets/utils/svg.ts @@ -1,7 +1,7 @@ import { parse, renderSync } from 'ultrahtml'; -import type { ImageMetadata } from '../types.js'; import type { SvgComponentProps } from '../runtime.js'; import { dropAttributes } from '../runtime.js'; +import type { ImageMetadata } from '../types.js'; function parseSvg(contents: string) { const root = parse(contents); @@ -13,7 +13,11 @@ function parseSvg(contents: string) { export type SvgRenderMode = 'inline' | 'sprite'; -export function makeSvgComponent(meta: ImageMetadata, contents: Buffer | string, options?: { mode?: SvgRenderMode }) { +export function makeSvgComponent( + meta: ImageMetadata, + contents: Buffer | string, + options?: { mode?: SvgRenderMode }, +) { const file = typeof contents === 'string' ? contents : contents.toString('utf-8'); const { attributes, body: children } = parseSvg(file); const props: SvgComponentProps = { diff --git a/packages/astro/src/assets/vite-plugin-assets.ts b/packages/astro/src/assets/vite-plugin-assets.ts index 7cb04c1bde..e09fc15975 100644 --- a/packages/astro/src/assets/vite-plugin-assets.ts +++ b/packages/astro/src/assets/vite-plugin-assets.ts @@ -17,8 +17,8 @@ import { getAssetsPrefix } from './utils/getAssetsPrefix.js'; import { isESMImportedImage } from './utils/imageKind.js'; import { emitESMImage } from './utils/node/emitAsset.js'; import { getProxyCode } from './utils/proxy.js'; -import { hashTransform, propsToFilename } from './utils/transformToPath.js'; import { makeSvgComponent } from './utils/svg.js'; +import { hashTransform, propsToFilename } from './utils/transformToPath.js'; const resolvedVirtualModuleId = '\0' + VIRTUAL_MODULE_ID; @@ -217,7 +217,9 @@ export default function assets({ settings }: { settings: AstroSettings }): vite. if (settings.config.experimental.svg && /\.svg$/.test(id)) { const { contents, ...metadata } = imageMetadata; // We know that the contents are present, as we only emit this property for SVG files - return makeSvgComponent(metadata, contents!, { mode: settings.config.experimental.svg.mode }); + return makeSvgComponent(metadata, contents!, { + mode: settings.config.experimental.svg.mode, + }); } // We can only reliably determine if an image is used on the server, as we need to track its usage throughout the entire build. diff --git a/packages/astro/src/container/index.ts b/packages/astro/src/container/index.ts index 7694f3afa2..2564e28750 100644 --- a/packages/astro/src/container/index.ts +++ b/packages/astro/src/container/index.ts @@ -544,6 +544,7 @@ export class experimental_AstroContainer { type, fallbackRoutes: [], isIndex: false, + origin: 'internal', }; } diff --git a/packages/astro/src/content/loaders/glob.ts b/packages/astro/src/content/loaders/glob.ts index 154ae7d7b7..1e080c57a6 100644 --- a/packages/astro/src/content/loaders/glob.ts +++ b/packages/astro/src/content/loaders/glob.ts @@ -130,6 +130,7 @@ export function glob(globOptions: GlobOptions): Loader { const existingEntry = store.get(id); const digest = generateDigest(contents); + const filePath = fileURLToPath(fileUrl); if (existingEntry && existingEntry.digest === digest && existingEntry.filePath) { if (existingEntry.deferredRender) { @@ -141,11 +142,10 @@ export function glob(globOptions: GlobOptions): Loader { store.addAssetImports(existingEntry.assetImports, existingEntry.filePath); } + fileToIdMap.set(filePath, id); return; } - const filePath = fileURLToPath(fileUrl); - const relativePath = posixRelative(fileURLToPath(config.root), filePath); const parsedData = await parseData({ diff --git a/packages/astro/src/content/runtime.ts b/packages/astro/src/content/runtime.ts index 6a8d3f214a..81590da8b3 100644 --- a/packages/astro/src/content/runtime.ts +++ b/packages/astro/src/content/runtime.ts @@ -26,12 +26,22 @@ type GlobResult = Record; type CollectionToEntryMap = Record; type GetEntryImport = (collection: string, lookupId: string) => Promise; +export function getImporterFilename() { + // The 4th line in the stack trace should be the importer filename + const stackLine = new Error().stack?.split('\n')?.[3]; + if (!stackLine) { + return null; + } + // Extract the relative path from the stack line + const match = /\/(src\/.*?):\d+:\d+/.exec(stackLine); + return match?.[1] ?? null; +} + export function defineCollection(config: any) { if ('loader' in config) { if (config.type && config.type !== CONTENT_LAYER_TYPE) { throw new AstroUserError( - 'Collections that use the Content Layer API must have a `loader` defined and no `type` set.', - "Check your collection definitions in `src/content/config.*`.'", + `Collections that use the Content Layer API must have a \`loader\` defined and no \`type\` set. Check your collection definitions in ${getImporterFilename() ?? 'your content config file'}.`, ); } config.type = CONTENT_LAYER_TYPE; diff --git a/packages/astro/src/content/server-listeners.ts b/packages/astro/src/content/server-listeners.ts index 28f5b16a83..33ab2c8959 100644 --- a/packages/astro/src/content/server-listeners.ts +++ b/packages/astro/src/content/server-listeners.ts @@ -24,8 +24,16 @@ export async function attachContentServerListeners({ settings, }: ContentServerListenerParams) { const contentPaths = getContentPaths(settings.config, fs); - - if (fs.existsSync(contentPaths.contentDir)) { + if (!settings.config.legacy?.collections) { + const contentGenerator = await createContentTypesGenerator({ + fs, + settings, + logger, + viteServer, + contentConfigObserver: globalContentConfigObserver, + }); + await contentGenerator.init(); + } else if (fs.existsSync(contentPaths.contentDir)) { logger.debug( 'content', `Watching ${cyan( diff --git a/packages/astro/src/content/types-generator.ts b/packages/astro/src/content/types-generator.ts index c5123acef2..fe76400bba 100644 --- a/packages/astro/src/content/types-generator.ts +++ b/packages/astro/src/content/types-generator.ts @@ -86,13 +86,12 @@ export async function createContentTypesGenerator({ async function init(): Promise< { typesGenerated: true } | { typesGenerated: false; reason: 'no-content-dir' } > { - if (!fs.existsSync(contentPaths.contentDir)) { - return { typesGenerated: false, reason: 'no-content-dir' }; - } - events.push({ name: 'add', entry: contentPaths.config.url }); if (settings.config.legacy.collections) { + if (!fs.existsSync(contentPaths.contentDir)) { + return { typesGenerated: false, reason: 'no-content-dir' }; + } const globResult = await glob('**', { cwd: fileURLToPath(contentPaths.contentDir), fs: { diff --git a/packages/astro/src/content/utils.ts b/packages/astro/src/content/utils.ts index f67a7ad63d..1cdafa1907 100644 --- a/packages/astro/src/content/utils.ts +++ b/packages/astro/src/content/utils.ts @@ -597,7 +597,7 @@ export async function autogenerateCollections({ }) as any, }; } - if (!usesContentLayer) { + if (!usesContentLayer && fs.existsSync(contentDir)) { // If the user hasn't defined any collections using the content layer, we'll try and help out by checking for // any orphaned folders in the content directory and creating collections for them. const orphanedCollections = []; @@ -623,7 +623,7 @@ export async function autogenerateCollections({ console.warn( ` Auto-generating collections for folders in "src/content/" that are not defined as collections. -This is deprecated, so you should define these collections yourself in "src/content/config.ts". +This is deprecated, so you should define these collections yourself in "src/content.config.ts". The following collections have been auto-generated: ${orphanedCollections .map((name) => green(name)) .join(', ')}\n`, @@ -715,10 +715,10 @@ export type ContentPaths = { }; export function getContentPaths( - { srcDir }: Pick, + { srcDir, legacy }: Pick, fs: typeof fsMod = fsMod, ): ContentPaths { - const configStats = search(fs, srcDir); + const configStats = search(fs, srcDir, legacy?.collections); const pkgBase = new URL('../../', import.meta.url); return { contentDir: new URL('./content/', srcDir), @@ -728,10 +728,16 @@ export function getContentPaths( config: configStats, }; } -function search(fs: typeof fsMod, srcDir: URL) { - const paths = ['config.mjs', 'config.js', 'config.mts', 'config.ts'].map( - (p) => new URL(`./content/${p}`, srcDir), - ); +function search(fs: typeof fsMod, srcDir: URL, legacy?: boolean) { + const paths = [ + ...(legacy + ? [] + : ['content.config.mjs', 'content.config.js', 'content.config.mts', 'content.config.ts']), + 'content/config.mjs', + 'content/config.js', + 'content/config.mts', + 'content/config.ts', + ].map((p) => new URL(`./${p}`, srcDir)); for (const file of paths) { if (fs.existsSync(file)) { return { exists: true, url: file }; diff --git a/packages/astro/src/core/app/pipeline.ts b/packages/astro/src/core/app/pipeline.ts index 3492d56c59..c6d748af06 100644 --- a/packages/astro/src/core/app/pipeline.ts +++ b/packages/astro/src/core/app/pipeline.ts @@ -49,7 +49,6 @@ export class AppPipeline extends Pipeline { undefined, undefined, undefined, - false, defaultRoutes, ); pipeline.#manifestData = manifestData; diff --git a/packages/astro/src/core/base-pipeline.ts b/packages/astro/src/core/base-pipeline.ts index ad7de6de5a..545cf5ed28 100644 --- a/packages/astro/src/core/base-pipeline.ts +++ b/packages/astro/src/core/base-pipeline.ts @@ -56,7 +56,6 @@ export abstract class Pipeline { * Used for `Astro.site`. */ readonly site = manifest.site ? new URL(manifest.site) : undefined, - readonly callSetGetEnv = true, /** * Array of built-in, internal, routes. * Used to find the route module @@ -70,13 +69,6 @@ export abstract class Pipeline { createI18nMiddleware(i18n, manifest.base, manifest.trailingSlash, manifest.buildFormat), ); } - // In SSR, getSecret should fail by default. Setting it here will run before the - // adapter override. - if (callSetGetEnv && manifest.envGetSecretEnabled) { - setGetEnv(() => { - throw new AstroError(AstroErrorData.EnvUnsupportedGetSecret); - }, true); - } } abstract headElements(routeData: RouteData): Promise | HeadElements; diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index 1a35e06a4b..1cc25aaee7 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -30,6 +30,7 @@ import type { import type { SSRManifest, SSRManifestI18n } from '../app/types.js'; import { NoPrerenderedRoutesWithDomains } from '../errors/errors-data.js'; import { AstroError, AstroErrorData } from '../errors/index.js'; +import { NOOP_MIDDLEWARE_FN } from '../middleware/noop-middleware.js'; import { getRedirectLocationOrThrow, routeIsRedirect } from '../redirects/index.js'; import { RenderContext } from '../render-context.js'; import { callGetStaticPaths } from '../render/route-cache.js'; @@ -59,14 +60,9 @@ export async function generatePages(options: StaticBuildOptions, internals: Buil const baseDirectory = getOutputDirectory(options.settings); const renderersEntryUrl = new URL('renderers.mjs', baseDirectory); const renderers = await import(renderersEntryUrl.toString()); - let middleware: MiddlewareHandler = (_, next) => next(); - try { - // middleware.mjs is not emitted if there is no user middleware - // in which case the import fails with ERR_MODULE_NOT_FOUND, and we fall back to a no-op middleware - middleware = await import(new URL('middleware.mjs', baseDirectory).toString()).then( - (mod) => mod.onRequest, - ); - } catch {} + const middleware: MiddlewareHandler = internals.middlewareEntryPoint + ? await import(internals.middlewareEntryPoint.toString()).then((mod) => mod.onRequest) + : NOOP_MIDDLEWARE_FN; manifest = createBuildManifest( options.settings, internals, diff --git a/packages/astro/src/core/build/pipeline.ts b/packages/astro/src/core/build/pipeline.ts index 478d0a21ad..14bb08662a 100644 --- a/packages/astro/src/core/build/pipeline.ts +++ b/packages/astro/src/core/build/pipeline.ts @@ -130,15 +130,13 @@ export class BuildPipeline extends Pipeline { const renderersEntryUrl = new URL(`renderers.mjs?time=${Date.now()}`, baseDirectory); const renderers = await import(renderersEntryUrl.toString()); - const middleware = await import(new URL('middleware.mjs', baseDirectory).toString()) - .then((mod) => { - return function () { - return { onRequest: mod.onRequest }; - }; - }) - // middleware.mjs is not emitted if there is no user middleware - // in which case the import fails with ERR_MODULE_NOT_FOUND, and we fall back to a no-op middleware - .catch(() => manifest.middleware); + const middleware = internals.middlewareEntryPoint + ? await import(internals.middlewareEntryPoint.toString()).then((mod) => { + return function () { + return { onRequest: mod.onRequest }; + }; + }) + : manifest.middleware; if (!renderers) { throw new Error( diff --git a/packages/astro/src/core/build/plugins/plugin-ssr.ts b/packages/astro/src/core/build/plugins/plugin-ssr.ts index 6acc236aed..d0174e4b4c 100644 --- a/packages/astro/src/core/build/plugins/plugin-ssr.ts +++ b/packages/astro/src/core/build/plugins/plugin-ssr.ts @@ -170,7 +170,6 @@ function generateSSRCode(adapter: AstroAdapter, middlewareId: string) { `import { renderers } from '${RENDERERS_MODULE_ID}';`, `import * as serverEntrypointModule from '${ADAPTER_VIRTUAL_MODULE_ID}';`, `import { manifest as defaultManifest } from '${SSR_MANIFEST_VIRTUAL_MODULE_ID}';`, - edgeMiddleware ? `` : `import { onRequest as middleware } from '${middlewareId}';`, `import { serverIslandMap } from '${VIRTUAL_ISLAND_MAP_ID}';`, ]; diff --git a/packages/astro/src/core/config/schema.ts b/packages/astro/src/core/config/schema.ts index a3099fc8c7..3f01eea835 100644 --- a/packages/astro/src/core/config/schema.ts +++ b/packages/astro/src/core/config/schema.ts @@ -562,16 +562,16 @@ export const AstroConfigSchema = z.object({ .optional(), }) .optional(), - svg: z.union([ - z.boolean(), - z - .object({ - mode: z - .union([z.literal('inline'), z.literal('sprite')]) - .optional() - .default(ASTRO_CONFIG_DEFAULTS.experimental.svg.mode), - }) - ]) + svg: z + .union([ + z.boolean(), + z.object({ + mode: z + .union([z.literal('inline'), z.literal('sprite')]) + .optional() + .default(ASTRO_CONFIG_DEFAULTS.experimental.svg.mode), + }), + ]) .optional() .transform((svgConfig) => { // Handle normalization of `experimental.svg` config boolean values diff --git a/packages/astro/src/core/dev/container.ts b/packages/astro/src/core/dev/container.ts index 3f9090498b..0ca40cd74b 100644 --- a/packages/astro/src/core/dev/container.ts +++ b/packages/astro/src/core/dev/container.ts @@ -7,6 +7,7 @@ import * as vite from 'vite'; import { runHookConfigDone, runHookConfigSetup, + runHookRoutesResolved, runHookServerDone, runHookServerStart, } from '../../integrations/hooks.js'; @@ -83,10 +84,11 @@ export async function createContainer({ .filter(Boolean) as string[]; // Create the route manifest already outside of Vite so that `runHookConfigDone` can use it to inform integrations of the build output - let manifest = await createRouteManifest({ settings, fsMod: fs }, logger); + let manifest = await createRouteManifest({ settings, fsMod: fs }, logger, { dev: true }); const devSSRManifest = createDevelopmentManifest(settings); manifest = injectDefaultDevRoutes(settings, devSSRManifest, manifest); + await runHookRoutesResolved({ settings, logger, routes: manifest.routes }); await runHookConfigDone({ settings, logger, command: 'dev' }); diff --git a/packages/astro/src/core/errors/errors-data.ts b/packages/astro/src/core/errors/errors-data.ts index 2466945402..f3a06266fa 100644 --- a/packages/astro/src/core/errors/errors-data.ts +++ b/packages/astro/src/core/errors/errors-data.ts @@ -1245,17 +1245,6 @@ export const EnvInvalidVariables = { `The following environment variables defined in \`env.schema\` are invalid:\n\n${errors.map((err) => `- ${err}`).join('\n')}\n`, } satisfies ErrorData; -/** - * @docs - * @description - * The `astro:env/server` exported function `getSecret()` is not supported by your adapter. - */ -export const EnvUnsupportedGetSecret = { - name: 'EnvUnsupportedGetSecret', - title: 'Unsupported astro:env getSecret', - message: '`astro:env/server` exported function `getSecret` is not supported by your adapter.', -} satisfies ErrorData; - /** * @docs * @description @@ -1476,7 +1465,8 @@ export const GenerateContentTypesError = { title: 'Failed to generate content types.', message: (errorMessage: string) => `\`astro sync\` command failed to generate content collection types: ${errorMessage}`, - hint: 'This error is often caused by a syntax error inside your content, or your content configuration file. Check your `src/content/config.*` file for typos.', + hint: (fileName?: string) => + `This error is often caused by a syntax error inside your content, or your content configuration file. Check your ${fileName ?? 'content config'} file for typos.`, } satisfies ErrorData; /** * @docs @@ -1488,7 +1478,7 @@ export const GenerateContentTypesError = { * @docs * @description * Astro encountered an unknown error loading your content collections. - * This can be caused by certain errors inside your `src/content/config.ts` file or some internal errors. + * This can be caused by certain errors inside your `src/content.config.ts` file or some internal errors. * * If you can reliably cause this error to happen, we'd appreciate if you could [open an issue](https://astro.build/issues/) */ @@ -1531,7 +1521,7 @@ export const GetEntryDeprecationError = { * @description * A Markdown or MDX entry does not match its collection schema. * Make sure that all required fields are present, and that all fields are of the correct type. - * You can check against the collection schema in your `src/content/config.*` file. + * You can check against the collection schema in your `src/content.config.*` file. * See the [Content collections documentation](https://docs.astro.build/en/guides/content-collections/) for more information. */ export const InvalidContentEntryFrontmatterError = { @@ -1558,7 +1548,7 @@ export const InvalidContentEntryFrontmatterError = { * @description * A content entry does not match its collection schema. * Make sure that all required fields are present, and that all fields are of the correct type. - * You can check against the collection schema in your `src/content/config.*` file. + * You can check against the collection schema in your `src/content.config.*` file. * See the [Content collections documentation](https://docs.astro.build/en/guides/content-collections/) for more information. */ export const InvalidContentEntryDataError = { @@ -1583,7 +1573,7 @@ export const InvalidContentEntryDataError = { * @description * A content entry does not match its collection schema. * Make sure that all required fields are present, and that all fields are of the correct type. - * You can check against the collection schema in your `src/content/config.*` file. + * You can check against the collection schema in your `src/content.config.*` file. * See the [Content collections documentation](https://docs.astro.build/en/guides/content-collections/) for more information. */ export const ContentEntryDataError = { diff --git a/packages/astro/src/core/middleware/vite-plugin.ts b/packages/astro/src/core/middleware/vite-plugin.ts index 0b7f46c0c1..10c5683f74 100644 --- a/packages/astro/src/core/middleware/vite-plugin.ts +++ b/packages/astro/src/core/middleware/vite-plugin.ts @@ -13,7 +13,6 @@ export const MIDDLEWARE_MODULE_ID = '\0astro-internal:middleware'; const NOOP_MIDDLEWARE = '\0noop-middleware'; export function vitePluginMiddleware({ settings }: { settings: AstroSettings }): VitePlugin { - let isCommandBuild = false; let resolvedMiddlewareId: string | undefined = undefined; const hasIntegrationMiddleware = settings.middlewares.pre.length > 0 || settings.middlewares.post.length > 0; @@ -21,9 +20,6 @@ export function vitePluginMiddleware({ settings }: { settings: AstroSettings }): return { name: '@astro/plugin-middleware', - config(_, { command }) { - isCommandBuild = command === 'build'; - }, async resolveId(id) { if (id === MIDDLEWARE_MODULE_ID) { const middlewareId = await this.resolve( @@ -53,15 +49,6 @@ export function vitePluginMiddleware({ settings }: { settings: AstroSettings }): if (!userMiddlewareIsPresent && settings.config.i18n?.routing === 'manual') { throw new AstroError(MissingMiddlewareForInternationalization); } - // In the build, tell Vite to emit this file - if (isCommandBuild) { - this.emitFile({ - type: 'chunk', - preserveSignature: 'strict', - fileName: 'middleware.mjs', - id, - }); - } const preMiddleware = createMiddlewareImports(settings.middlewares.pre, 'pre'); const postMiddleware = createMiddlewareImports(settings.middlewares.post, 'post'); @@ -124,7 +111,7 @@ export function vitePluginMiddlewareBuild( writeBundle(_, bundle) { for (const [chunkName, chunk] of Object.entries(bundle)) { - if (chunk.type !== 'asset' && chunk.fileName === 'middleware.mjs') { + if (chunk.type !== 'asset' && chunk.facadeModuleId === MIDDLEWARE_MODULE_ID) { const outputDirectory = getOutputDirectory(opts.settings); internals.middlewareEntryPoint = new URL(chunkName, outputDirectory); } diff --git a/packages/astro/src/core/render-context.ts b/packages/astro/src/core/render-context.ts index 33cb241d30..bf2a0ea067 100644 --- a/packages/astro/src/core/render-context.ts +++ b/packages/astro/src/core/render-context.ts @@ -29,6 +29,7 @@ import { callMiddleware } from './middleware/callMiddleware.js'; import { sequence } from './middleware/index.js'; import { renderRedirect } from './redirects/render.js'; import { type Pipeline, Slots, getParams, getProps } from './render/index.js'; +import { isRoute404or500 } from './routing/match.js'; import { copyRequest, getOriginPathname, setOriginPathname } from './routing/rewrite.js'; import { SERVER_ISLAND_COMPONENT } from './server-islands/endpoint.js'; import { AstroSession } from './session.js'; @@ -579,11 +580,9 @@ export class RenderContext { computedLocale = computeCurrentLocale(referer, locales, defaultLocale); } } else { - if (routeData.pathname) { - computedLocale = computeCurrentLocale(routeData.pathname, locales, defaultLocale); - } else { - computedLocale = computeCurrentLocale(url.pathname, locales, defaultLocale); - } + const pathname = + routeData.pathname && !isRoute404or500(routeData) ? routeData.pathname : url.pathname; + computedLocale = computeCurrentLocale(pathname, locales, defaultLocale); } this.#currentLocale = computedLocale ?? fallbackTo; diff --git a/packages/astro/src/core/routing/astro-designed-error-pages.ts b/packages/astro/src/core/routing/astro-designed-error-pages.ts index 671221b5d6..4348e6e974 100644 --- a/packages/astro/src/core/routing/astro-designed-error-pages.ts +++ b/packages/astro/src/core/routing/astro-designed-error-pages.ts @@ -15,6 +15,7 @@ export const DEFAULT_404_ROUTE: RouteData = { route: '/404', fallbackRoutes: [], isIndex: false, + origin: 'internal', }; export const DEFAULT_500_ROUTE: RouteData = { @@ -29,6 +30,7 @@ export const DEFAULT_500_ROUTE: RouteData = { route: '/500', fallbackRoutes: [], isIndex: false, + origin: 'internal', }; export function ensure404Route(manifest: ManifestData) { diff --git a/packages/astro/src/core/routing/manifest/create.ts b/packages/astro/src/core/routing/manifest/create.ts index 33b5216998..6dbcf18aee 100644 --- a/packages/astro/src/core/routing/manifest/create.ts +++ b/packages/astro/src/core/routing/manifest/create.ts @@ -8,6 +8,7 @@ import { fileURLToPath } from 'node:url'; import { bold } from 'kleur/colors'; import pLimit from 'p-limit'; import { toRoutingStrategy } from '../../../i18n/utils.js'; +import { runHookRoutesResolved } from '../../../integrations/hooks.js'; import { getPrerenderDefault } from '../../../prerender/utils.js'; import type { AstroConfig } from '../../../types/public/config.js'; import type { RouteData, RoutePart } from '../../../types/public/internal.js'; @@ -255,6 +256,7 @@ function createFileBasedRoutes( prerender, fallbackRoutes: [], distURL: [], + origin: 'project', }); } } @@ -280,7 +282,7 @@ function createInjectedRoutes({ settings, cwd }: CreateRouteManifestParams): Rou const routes: RouteData[] = []; for (const injectedRoute of settings.injectedRoutes) { - const { pattern: name, entrypoint, prerender: prerenderInjected } = injectedRoute; + const { pattern: name, entrypoint, prerender: prerenderInjected, origin } = injectedRoute; const { resolved, component } = resolveInjectedRoute(entrypoint.toString(), config.root, cwd); const segments = removeLeadingForwardSlash(name) @@ -320,6 +322,7 @@ function createInjectedRoutes({ settings, cwd }: CreateRouteManifestParams): Rou prerender: prerenderInjected ?? prerender, fallbackRoutes: [], distURL: [], + origin, }); } @@ -389,6 +392,7 @@ function createRedirectRoutes( redirectRoute: routeMap.get(destination), fallbackRoutes: [], distURL: [], + origin: 'project', }); } @@ -480,6 +484,7 @@ function detectRouteCollision(a: RouteData, b: RouteData, _config: AstroConfig, export async function createRouteManifest( params: CreateRouteManifestParams, logger: Logger, + { dev = false }: { dev?: boolean } = {}, ): Promise { const { settings } = params; const { config } = settings; @@ -727,6 +732,10 @@ export async function createRouteManifest( } } + if (!dev) { + await runHookRoutesResolved({ routes, settings, logger }); + } + return { routes, }; diff --git a/packages/astro/src/core/routing/manifest/serialization.ts b/packages/astro/src/core/routing/manifest/serialization.ts index c0cf600f0b..3d6214876c 100644 --- a/packages/astro/src/core/routing/manifest/serialization.ts +++ b/packages/astro/src/core/routing/manifest/serialization.ts @@ -41,5 +41,6 @@ export function deserializeRouteData(rawRouteData: SerializedRouteData): RouteDa return deserializeRouteData(fallback); }), isIndex: rawRouteData.isIndex, + origin: rawRouteData.origin, }; } diff --git a/packages/astro/src/core/routing/match.ts b/packages/astro/src/core/routing/match.ts index 403b3fb953..0e8a9e3387 100644 --- a/packages/astro/src/core/routing/match.ts +++ b/packages/astro/src/core/routing/match.ts @@ -16,3 +16,13 @@ export function matchRoute(pathname: string, manifest: ManifestData): RouteData export function matchAllRoutes(pathname: string, manifest: ManifestData): RouteData[] { return manifest.routes.filter((route) => route.pattern.test(decodeURI(pathname))); } + +/** + * Determines if the given route matches a 404 or 500 error page. + * + * @param {RouteData} route - The route data to check. + * @returns {boolean} `true` if the route matches a 404 or 500 error page, otherwise `false`. + */ +export function isRoute404or500(route: RouteData): boolean { + return route.pattern.test('/404') || route.pattern.test('/500'); +} diff --git a/packages/astro/src/core/server-islands/endpoint.ts b/packages/astro/src/core/server-islands/endpoint.ts index 540f75b843..ca24b54af4 100644 --- a/packages/astro/src/core/server-islands/endpoint.ts +++ b/packages/astro/src/core/server-islands/endpoint.ts @@ -4,6 +4,7 @@ import { renderComponent, renderTemplate, } from '../../runtime/server/index.js'; +import { isAstroComponentFactory } from '../../runtime/server/render/astro/factory.js'; import { createSlotValueFromString } from '../../runtime/server/render/slot.js'; import type { ComponentInstance, ManifestData } from '../../types/astro.js'; import type { RouteData, SSRManifest } from '../../types/public/internal.js'; @@ -31,6 +32,7 @@ export function getServerIslandRouteData(config: ConfigFields) { isIndex: false, fallbackRoutes: [], route: SERVER_ISLAND_ROUTE, + origin: 'internal', }; return route; } @@ -120,17 +122,31 @@ export function createEndpoint(manifest: SSRManifest) { const key = await manifest.key; const encryptedProps = data.encryptedProps; + const propString = await decryptString(key, encryptedProps); const props = JSON.parse(propString); const componentModule = await imp(); - const Component = (componentModule as any)[data.componentExport]; + let Component = (componentModule as any)[data.componentExport]; const slots: ComponentSlots = {}; for (const prop in data.slots) { slots[prop] = createSlotValueFromString(data.slots[prop]); } + // Wrap Astro components so we can set propagation to + // `self` which is needed to force the runtime to wait + // on the component before sending out the response headers. + // This allows the island to set headers (cookies). + if (isAstroComponentFactory(Component)) { + const ServerIsland = Component; + Component = function (this: typeof ServerIsland, ...args: Parameters) { + return ServerIsland.apply(this, args); + }; + Object.assign(Component, ServerIsland); + Component.propagation = 'self'; + } + return renderTemplate`${renderComponent(result, 'Component', Component, props, slots)}`; }; diff --git a/packages/astro/src/core/sync/index.ts b/packages/astro/src/core/sync/index.ts index 5fba6196a8..67fdccc543 100644 --- a/packages/astro/src/core/sync/index.ts +++ b/packages/astro/src/core/sync/index.ts @@ -21,7 +21,6 @@ import { resolveConfig } from '../config/config.js'; import { createNodeLogger } from '../config/logging.js'; import { createSettings } from '../config/settings.js'; import { createVite } from '../create-vite.js'; -import { collectErrorMetadata } from '../errors/dev/utils.js'; import { AstroError, AstroErrorData, @@ -31,7 +30,6 @@ import { isAstroError, } from '../errors/index.js'; import type { Logger } from '../logger/core.js'; -import { formatErrorMessage } from '../messages.js'; import { createRouteManifest } from '../routing/index.js'; import { ensureProcessNodeEnv } from '../util.js'; @@ -255,7 +253,22 @@ async function syncContentCollections( if (isAstroError(e)) { throw e; } - const hint = AstroUserError.is(e) ? e.hint : AstroErrorData.GenerateContentTypesError.hint; + let configFile; + try { + const contentPaths = getContentPaths(settings.config, fs); + if (contentPaths.config.exists) { + const matches = /\/(src\/.+)/.exec(contentPaths.config.url.href); + if (matches) { + configFile = matches[1]; + } + } + } catch { + // ignore + } + + const hint = AstroUserError.is(e) + ? e.hint + : AstroErrorData.GenerateContentTypesError.hint(configFile); throw new AstroError( { ...AstroErrorData.GenerateContentTypesError, diff --git a/packages/astro/src/integrations/hooks.ts b/packages/astro/src/integrations/hooks.ts index 4c1d4a1ae2..5a4b723b20 100644 --- a/packages/astro/src/integrations/hooks.ts +++ b/packages/astro/src/integrations/hooks.ts @@ -24,7 +24,9 @@ import type { import type { AstroIntegration, AstroRenderer, + BaseIntegrationHooks, HookParameters, + IntegrationResolvedRoute, IntegrationRouteData, RouteOptions, } from '../types/public/integrations.js'; @@ -39,7 +41,7 @@ async function withTakingALongTimeMsg({ logger, }: { name: string; - hookName: string; + hookName: keyof BaseIntegrationHooks; hookResult: T | Promise; timeoutMs?: number; logger: Logger; @@ -204,7 +206,7 @@ export async function runHookConfigSetup({ ); injectRoute.entrypoint = injectRoute.entryPoint as string; } - updatedSettings.injectedRoutes.push(injectRoute); + updatedSettings.injectedRoutes.push({ ...injectRoute, origin: 'external' }); }, addWatchFile: (path) => { updatedSettings.watchFiles.push(path instanceof URL ? fileURLToPath(path) : path); @@ -599,6 +601,9 @@ export async function runHookBuildDone({ settings, pages, routes, logging }: Run pages: pages.map((p) => ({ pathname: p })), dir, routes: integrationRoutes, + assets: new Map( + routes.filter((r) => r.distURL !== undefined).map((r) => [r.route, r.distURL!]), + ), logger, }), logger: logging, @@ -648,6 +653,47 @@ export async function runHookRouteSetup({ } } +export async function runHookRoutesResolved({ + routes, + settings, + logger, +}: { routes: Array; settings: AstroSettings; logger: Logger }) { + for (const integration of settings.config.integrations) { + if (integration?.hooks?.['astro:routes:resolved']) { + const integrationLogger = getLogger(integration, logger); + + await withTakingALongTimeMsg({ + name: integration.name, + hookName: 'astro:routes:resolved', + hookResult: integration.hooks['astro:routes:resolved']({ + routes: routes.map((route) => toIntegrationResolvedRoute(route)), + logger: integrationLogger, + }), + logger, + }); + } + } +} + +function toIntegrationResolvedRoute(route: RouteData): IntegrationResolvedRoute { + return { + isPrerendered: route.prerender, + entrypoint: route.component, + pattern: route.route, + params: route.params, + origin: route.origin, + generate: route.generate, + patternRegex: route.pattern, + segments: route.segments, + type: route.type, + pathname: route.pathname, + redirect: route.redirect, + redirectRoute: route.redirectRoute + ? toIntegrationResolvedRoute(route.redirectRoute) + : undefined, + }; +} + function toIntegrationRouteData(route: RouteData): IntegrationRouteData { return { route: route.route, diff --git a/packages/astro/src/runtime/server/render/server-islands.ts b/packages/astro/src/runtime/server/render/server-islands.ts index 3e5e993d96..97bf1d3314 100644 --- a/packages/astro/src/runtime/server/render/server-islands.ts +++ b/packages/astro/src/runtime/server/render/server-islands.ts @@ -119,22 +119,23 @@ let response = await fetch('${serverIslandUrl}', { }); ` } - -if(response.status === 200 && response.headers.get('content-type') === 'text/html') { - let html = await response.text(); - - // Swap! - while(script.previousSibling && - script.previousSibling.nodeType !== 8 && - script.previousSibling.data !== '[if astro]>server-island-startserver-island-start`); }, }; diff --git a/packages/astro/src/types/astro.ts b/packages/astro/src/types/astro.ts index 7e2f2af7e0..1227ed381a 100644 --- a/packages/astro/src/types/astro.ts +++ b/packages/astro/src/types/astro.ts @@ -10,12 +10,10 @@ import type { ContentEntryType, DataEntryType } from './public/content.js'; import type { AstroAdapter, AstroRenderer, - InjectedRoute, InjectedScriptStage, InjectedType, - ResolvedInjectedRoute, } from './public/integrations.js'; -import type { RouteData } from './public/internal.js'; +import type { InternalInjectedRoute, ResolvedInjectedRoute, RouteData } from './public/internal.js'; import type { DevToolbarAppEntry } from './public/toolbar.js'; export type SerializedRouteData = Omit< @@ -35,7 +33,7 @@ export interface AstroSettings { config: AstroConfig; adapter: AstroAdapter | undefined; preferences: AstroPreferences; - injectedRoutes: InjectedRoute[]; + injectedRoutes: InternalInjectedRoute[]; resolvedInjectedRoutes: ResolvedInjectedRoute[]; pageExtensions: string[]; contentEntryTypes: ContentEntryType[]; diff --git a/packages/astro/src/types/public/config.ts b/packages/astro/src/types/public/config.ts index 3a59579d8b..1ebe3900d1 100644 --- a/packages/astro/src/types/public/config.ts +++ b/packages/astro/src/types/public/config.ts @@ -1749,7 +1749,7 @@ export interface ViteUserConfig extends OriginalViteUserConfig { * When you are ready to remove this flag and migrate to the new Content Layer API for your legacy collections, you must define a collection for any directories in `src/content/` that you want to continue to use as a collection. It is sufficient to declare an empty collection, and Astro will implicitly generate an appropriate definition for your legacy collections: * * ```js - * // src/content/config.ts + * // src/content.config.ts * import { defineCollection, z } from 'astro:content'; * * const blog = defineCollection({ }) @@ -1941,11 +1941,10 @@ export interface ViteUserConfig extends OriginalViteUserConfig { * - `position`: Defines the position of the image crop if the aspect ratio is changed. Values match those of CSS `object-position`. Defaults to `center`, or the value of `image.experimentalObjectPosition` if set. * - `priority`: If set, eagerly loads the image. Otherwise images will be lazy-loaded. Use this for your largest above-the-fold image. Defaults to `false`. * - * The following `` component properties should not be used with responsive images as these are automatically generated: + * The `widths` and `sizes` attributes are automatically generated based on the image's dimensions and the layout type, and in most cases should not be set manually. The generated `sizes` attribute for `responsive` and `full-width` images + * is based on the assumption that the image is displayed at close to the full width of the screen when the viewport is smaller than the image's width. If it is significantly different (e.g. if it's in a multi-column layout on small screens) you may need to adjust the `sizes` attribute manually for best results. * - * - `densities` - * - `widths` - * - `sizes` + * The `densities` attribute is not compatible with responsive images and will be ignored if set. */ responsiveImages?: boolean; diff --git a/packages/astro/src/types/public/integrations.ts b/packages/astro/src/types/public/integrations.ts index 4d0709fab4..2d0b13e963 100644 --- a/packages/astro/src/types/public/integrations.ts +++ b/packages/astro/src/types/public/integrations.ts @@ -8,7 +8,7 @@ import type { getToolbarServerCommunicationHelpers } from '../../integrations/ho import type { DeepPartial } from '../../type-utils.js'; import type { AstroConfig } from './config.js'; import type { RefreshContentOptions } from './content.js'; -import type { RouteData } from './internal.js'; +import type { InternalInjectedRoute, RouteData } from './internal.js'; import type { DevToolbarAppEntry } from './toolbar.js'; export interface RouteOptions { @@ -138,15 +138,7 @@ export type AstroAdapterFeatureMap = { */ export type InjectedScriptStage = 'before-hydration' | 'head-inline' | 'page' | 'page-ssr'; -export interface InjectedRoute { - pattern: string; - entrypoint: string | URL; - prerender?: boolean; -} - -export interface ResolvedInjectedRoute extends InjectedRoute { - resolvedEntryPoint?: URL; -} +export type InjectedRoute = Omit; export interface InjectedType { filename: string; @@ -225,13 +217,19 @@ export interface BaseIntegrationHooks { 'astro:build:done': (options: { pages: { pathname: string }[]; dir: URL; + /** @deprecated Use the `assets` map and the new `astro:routes:resolved` hook */ routes: IntegrationRouteData[]; + assets: Map; logger: AstroIntegrationLogger; }) => void | Promise; 'astro:route:setup': (options: { route: RouteOptions; logger: AstroIntegrationLogger; }) => void | Promise; + 'astro:routes:resolved': (options: { + routes: IntegrationResolvedRoute[]; + logger: AstroIntegrationLogger; + }) => void | Promise; } export interface AstroIntegration { @@ -245,13 +243,45 @@ export interface AstroIntegration { /** * A smaller version of the {@link RouteData} that is used in the integrations. + * @deprecated Use {@link IntegrationResolvedRoute} */ export type IntegrationRouteData = Omit< RouteData, - 'isIndex' | 'fallbackRoutes' | 'redirectRoute' + 'isIndex' | 'fallbackRoutes' | 'redirectRoute' | 'origin' > & { /** * {@link RouteData.redirectRoute} */ redirectRoute?: IntegrationRouteData; }; + +export interface IntegrationResolvedRoute + extends Pick< + RouteData, + 'generate' | 'params' | 'pathname' | 'segments' | 'type' | 'redirect' | 'origin' + > { + /** + * {@link RouteData.route} + */ + pattern: RouteData['route']; + + /** + * {@link RouteData.pattern} + */ + patternRegex: RouteData['pattern']; + + /** + * {@link RouteData.component} + */ + entrypoint: RouteData['component']; + + /** + * {@link RouteData.prerender} + */ + isPrerendered: RouteData['prerender']; + + /** + * {@link RouteData.redirectRoute} + */ + redirectRoute?: IntegrationResolvedRoute; +} diff --git a/packages/astro/src/types/public/internal.ts b/packages/astro/src/types/public/internal.ts index c970ab3d18..a17ee76506 100644 --- a/packages/astro/src/types/public/internal.ts +++ b/packages/astro/src/types/public/internal.ts @@ -136,6 +136,11 @@ export interface RouteData { * - src/pages/blog/index.astro */ isIndex: boolean; + + /** + * Whether the route comes from Astro core, an integration or the user's project + */ + origin: 'internal' | 'external' | 'project'; } /** @@ -284,3 +289,16 @@ export interface SSRMetadata { } export type SSRError = Error & ViteErrorPayload['err']; + +// `origin` is set within the hook, but the user doesn't have access to this property. That's why +// we need an intermediary interface +export interface InternalInjectedRoute { + pattern: string; + entrypoint: string | URL; + prerender?: boolean; + origin: RouteData['origin']; +} + +export interface ResolvedInjectedRoute extends InternalInjectedRoute { + resolvedEntryPoint?: URL; +} diff --git a/packages/astro/src/vite-plugin-astro-server/plugin.ts b/packages/astro/src/vite-plugin-astro-server/plugin.ts index 6e5e655ff8..74468bf8ce 100644 --- a/packages/astro/src/vite-plugin-astro-server/plugin.ts +++ b/packages/astro/src/vite-plugin-astro-server/plugin.ts @@ -1,10 +1,12 @@ import { AsyncLocalStorage } from 'node:async_hooks'; import type fs from 'node:fs'; import { IncomingMessage } from 'node:http'; +import { fileURLToPath } from 'node:url'; import type * as vite from 'vite'; +import { normalizePath } from 'vite'; import type { SSRManifest, SSRManifestI18n } from '../core/app/types.js'; import { warnMissingAdapter } from '../core/dev/adapter-validation.js'; -import { createKey } from '../core/encryption.js'; +import { createKey, getEnvironmentKey, hasEnvironmentKey } from '../core/encryption.js'; import { getViteErrorPayload } from '../core/errors/dev/index.js'; import { AstroError, AstroErrorData } from '../core/errors/index.js'; import { patchOverlay } from '../core/errors/overlay.js'; @@ -13,7 +15,9 @@ import { NOOP_MIDDLEWARE_FN } from '../core/middleware/noop-middleware.js'; import { createViteLoader } from '../core/module-loader/index.js'; import { injectDefaultDevRoutes } from '../core/routing/dev-default.js'; import { createRouteManifest } from '../core/routing/index.js'; +import { getRoutePrerenderOption } from '../core/routing/manifest/prerender.js'; import { toFallbackType, toRoutingStrategy } from '../i18n/utils.js'; +import { runHookRoutesResolved } from '../integrations/hooks.js'; import type { AstroSettings, ManifestData } from '../types/astro.js'; import { baseMiddleware } from './base.js'; import { createController } from './controller.js'; @@ -50,26 +54,46 @@ export default function createVitePluginAstroServer({ const controller = createController({ loader }); const localStorage = new AsyncLocalStorage(); - /** rebuild the route cache + manifest, as needed. */ - async function rebuildManifest(needsManifestRebuild: boolean) { + /** rebuild the route cache + manifest */ + async function rebuildManifest(path: string | null = null) { pipeline.clearRouteCache(); - if (needsManifestRebuild) { + + // If a route changes, we check if it's part of the manifest and check for its prerender value + if (path !== null) { + const route = routeManifest.routes.find( + (r) => + normalizePath(path) === + normalizePath(fileURLToPath(new URL(r.component, settings.config.root))), + ); + if (!route) { + return; + } + if (route.type !== 'page' && route.type !== 'endpoint') return; + + const routePath = fileURLToPath(new URL(route.component, settings.config.root)); + try { + const content = await fsMod.promises.readFile(routePath, 'utf-8'); + await getRoutePrerenderOption(content, route, settings, logger); + } catch (_) {} + } else { routeManifest = injectDefaultDevRoutes( settings, devSSRManifest, - await createRouteManifest({ settings, fsMod }, logger), // TODO: Handle partial updates to the manifest + await createRouteManifest({ settings, fsMod }, logger, { dev: true }), ); - warnMissingAdapter(logger, settings); - pipeline.manifest.checkOrigin = - settings.config.security.checkOrigin && settings.buildOutput === 'server'; - pipeline.setManifestData(routeManifest); } + await runHookRoutesResolved({ routes: routeManifest.routes, settings, logger }); + + warnMissingAdapter(logger, settings); + pipeline.manifest.checkOrigin = + settings.config.security.checkOrigin && settings.buildOutput === 'server'; + pipeline.setManifestData(routeManifest); } - // Rebuild route manifest on file change, if needed. - viteServer.watcher.on('add', rebuildManifest.bind(null, true)); - viteServer.watcher.on('unlink', rebuildManifest.bind(null, true)); - viteServer.watcher.on('change', rebuildManifest.bind(null, false)); + // Rebuild route manifest on file change + viteServer.watcher.on('add', rebuildManifest.bind(null, null)); + viteServer.watcher.on('unlink', rebuildManifest.bind(null, null)); + viteServer.watcher.on('change', rebuildManifest); function handleUnhandledRejection(rejection: any) { const error = new AstroError({ @@ -168,7 +192,7 @@ export function createDevelopmentManifest(settings: AstroSettings): SSRManifest checkOrigin: (settings.config.security?.checkOrigin && settings.buildOutput === 'server') ?? false, envGetSecretEnabled: false, - key: createKey(), + key: hasEnvironmentKey() ? getEnvironmentKey() : createKey(), middleware() { return { onRequest: NOOP_MIDDLEWARE_FN, diff --git a/packages/astro/src/vite-plugin-integrations-container/index.ts b/packages/astro/src/vite-plugin-integrations-container/index.ts index 0af181e39c..81b720aef1 100644 --- a/packages/astro/src/vite-plugin-integrations-container/index.ts +++ b/packages/astro/src/vite-plugin-integrations-container/index.ts @@ -5,7 +5,7 @@ import type { AstroSettings } from '../types/astro.js'; import { normalizePath } from 'vite'; import { runHookServerSetup } from '../integrations/hooks.js'; -import type { InjectedRoute, ResolvedInjectedRoute } from '../types/public/integrations.js'; +import type { InternalInjectedRoute, ResolvedInjectedRoute } from '../types/public/internal.js'; /** Connect Astro integrations into Vite, as needed. */ export default function astroIntegrationsContainerPlugin({ @@ -33,7 +33,7 @@ export default function astroIntegrationsContainerPlugin({ async function resolveEntryPoint( this: PluginContext, - route: InjectedRoute, + route: InternalInjectedRoute, ): Promise { const resolvedId = await this.resolve(route.entrypoint.toString()) .then((res) => res?.id) diff --git a/packages/astro/test/astro-sync.test.js b/packages/astro/test/astro-sync.test.js index 94e6b326b7..e9ab90cf75 100644 --- a/packages/astro/test/astro-sync.test.js +++ b/packages/astro/test/astro-sync.test.js @@ -209,7 +209,7 @@ describe('astro sync', () => { assert.fail(); } }); - it('Does not throw if a virtual module is imported in content/config.ts', async () => { + it('Does not throw if a virtual module is imported in content.config.ts', async () => { try { await fixture.load('./fixtures/astro-env-content-collections/'); fixture.clean(); diff --git a/packages/astro/test/content-layer.test.js b/packages/astro/test/content-layer.test.js index 7353c23843..16aa96c293 100644 --- a/packages/astro/test/content-layer.test.js +++ b/packages/astro/test/content-layer.test.js @@ -285,7 +285,7 @@ describe('Content Layer', () => { it('clears the store on new build if the config has changed', async () => { let newJson = devalue.parse(await fixture.readFile('/collections.json')); assert.equal(newJson.increment.data.lastValue, 1); - await fixture.editFile('src/content/config.ts', (prev) => { + await fixture.editFile('src/content.config.ts', (prev) => { return `${prev}\nexport const foo = 'bar';`; }); await fixture.build(); @@ -424,5 +424,26 @@ describe('Content Layer', () => { assert.equal(res.status, 500); assert.ok(text.includes('RenderUndefinedEntryError')); }); + + it('update the store when a file is renamed', async () => { + const rawJsonResponse = await fixture.fetch('/collections.json'); + const initialJson = devalue.parse(await rawJsonResponse.text()); + assert.equal(initialJson.numbers.map((e) => e.id).includes('src/data/glob-data/three'), true); + + const oldPath = new URL('./data/glob-data/three.json', fixture.config.srcDir); + const newPath = new URL('./data/glob-data/four.json', fixture.config.srcDir); + + await fs.rename(oldPath, newPath); + await fixture.onNextDataStoreChange(); + + try { + const updatedJsonResponse = await fixture.fetch('/collections.json'); + const updated = devalue.parse(await updatedJsonResponse.text()); + assert.equal(updated.numbers.map((e) => e.id).includes('src/data/glob-data/three'), false); + assert.equal(updated.numbers.map((e) => e.id).includes('src/data/glob-data/four'), true); + } finally { + await fs.rename(newPath, oldPath); + } + }); }); }); diff --git a/packages/astro/test/core-image-svg.test.js b/packages/astro/test/core-image-svg.test.js index d6134aaf77..e346cb6a72 100644 --- a/packages/astro/test/core-image-svg.test.js +++ b/packages/astro/test/core-image-svg.test.js @@ -53,7 +53,7 @@ describe('astro:assets - SVG Components', () => { assert.equal(!!$(this).attr('mode'), false); const $use = $(this).children('use'); assert.equal($use.length, 0); - }) + }); }); it('Adds the tag with the definition', () => { @@ -64,7 +64,7 @@ describe('astro:assets - SVG Components', () => { const $symbol = $svg.children('symbol'); assert.equal($symbol.length, 1); assert.equal($symbol.attr('id').startsWith('a:'), true); - + const $use = $svg.children('use'); assert.equal($use.length, 1); assert.equal($use.attr('href').startsWith('#a:'), true); @@ -78,7 +78,7 @@ describe('astro:assets - SVG Components', () => { const $symbol = $svg.children('symbol'); assert.equal($symbol.length, 0); - const definitionId = $('#definition svg symbol').attr('id') + const definitionId = $('#definition svg symbol').attr('id'); const $use = $svg.children('use'); assert.equal($use.length, 1); assert.equal($use.attr('href').startsWith('#a:'), true); @@ -167,13 +167,13 @@ describe('astro:assets - SVG Components', () => { assert.equal($svg.attr('role'), 'img'); assert.equal(!!$svg.attr('mode'), false); - const $symbol = $svg.children('symbol') + const $symbol = $svg.children('symbol'); assert.equal($symbol.length, 0); - const $use = $svg.children('use') + const $use = $svg.children('use'); assert.equal($use.length, 0); const $path = $svg.children('path'); assert.equal($path.length, 1); - }) + }); it('adds the svg into the document directly', () => { let $svg = $('#inline svg'); assert.equal($svg.length, 1); @@ -183,9 +183,9 @@ describe('astro:assets - SVG Components', () => { assert.equal($svg.attr('role'), 'img'); assert.equal(!!$svg.attr('mode'), false); - const $symbol = $svg.children('symbol') + const $symbol = $svg.children('symbol'); assert.equal($symbol.length, 0); - const $use = $svg.children('use') + const $use = $svg.children('use'); assert.equal($use.length, 0); const $path = $svg.children('path'); assert.equal($path.length, 1); @@ -199,13 +199,13 @@ describe('astro:assets - SVG Components', () => { assert.equal($svg.attr('role'), 'img'); assert.equal(!!$svg.attr('mode'), false); - const $symbol = $svg.children('symbol') + const $symbol = $svg.children('symbol'); assert.equal($symbol.length, 0); - const $use = $svg.children('use') + const $use = $svg.children('use'); assert.equal($use.length, 0); const $path = $svg.children('path'); assert.equal($path.length, 1); - }) + }); it('adds the svg into the document as a sprite, overridding the default', () => { let $svg = $('#definition svg'); assert.equal($svg.length, 1); @@ -215,10 +215,10 @@ describe('astro:assets - SVG Components', () => { assert.equal($svg.attr('role'), 'img'); assert.equal(!!$svg.attr('mode'), false); - let $symbol = $svg.children('symbol') + let $symbol = $svg.children('symbol'); assert.equal($symbol.length, 1); assert.equal(!!$symbol.attr('viewBox'), true); - let $use = $svg.children('use') + let $use = $svg.children('use'); assert.equal($use.length, 1); let $path = $svg.children('path'); assert.equal($path.length, 0); @@ -231,14 +231,14 @@ describe('astro:assets - SVG Components', () => { assert.equal($svg.attr('role'), 'img'); assert.equal(!!$svg.attr('mode'), false); - $symbol = $svg.children('symbol') + $symbol = $svg.children('symbol'); assert.equal($symbol.length, 0); assert.equal(!!$symbol.attr('viewBox'), false); - $use = $svg.children('use') + $use = $svg.children('use'); assert.equal($use.length, 1); $path = $svg.children('path'); assert.equal($path.length, 0); - }) + }); }); describe('title', () => { let $; @@ -255,7 +255,7 @@ describe('astro:assets - SVG Components', () => { const $title = $('#base svg > title'); assert.equal($title.length, 1); - assert.equal($title.text(), 'GitHub Logo') + assert.equal($title.text(), 'GitHub Logo'); }); }); describe('strip', () => { @@ -291,11 +291,11 @@ describe('astro:assets - SVG Components', () => { assert.equal($svg.attr('class'), 'foobar'); assert.equal($svg.attr('data-state'), 'open'); - const $symbol = $svg.children('symbol') + const $symbol = $svg.children('symbol'); assert.equal($symbol.length, 0); - const $use = $svg.children('use') + const $use = $svg.children('use'); assert.equal($use.length, 0); - const $path = $svg.children('path') + const $path = $svg.children('path'); assert.equal($path.length, 1); }); it('allows overriding the role attribute', () => { @@ -337,7 +337,6 @@ describe('astro:assets - SVG Components', () => { useId = $('.two.use svg > use').attr('id'); assert.equal(defId, useId); - // Third SVG $svg = $('.three svg'); assert.equal($svg.length, 1); @@ -372,9 +371,11 @@ describe('astro:assets - SVG Components', () => { const $svg = $('svg'); assert.equal($svg.length, 2); - $svg.each(function() { assert.equal($(this).attr('role'), 'img') }); + $svg.each(function () { + assert.equal($(this).attr('role'), 'img'); + }); - const definitionId = $($svg[0]).children('symbol').attr('id') + const definitionId = $($svg[0]).children('symbol').attr('id'); const $reuse = $($svg[1]); const $symbol = $reuse.children('symbol'); diff --git a/packages/astro/test/data-collections-schema.test.js b/packages/astro/test/data-collections-schema.test.js index 119cf85427..ff405dca47 100644 --- a/packages/astro/test/data-collections-schema.test.js +++ b/packages/astro/test/data-collections-schema.test.js @@ -1,8 +1,8 @@ // @ts-check import assert from 'node:assert/strict'; import { before, describe, it } from 'node:test'; -import { loadFixture } from './test-utils.js'; import { removeDir } from '@astrojs/internal-helpers/fs'; +import { loadFixture } from './test-utils.js'; describe('Content Collections - data collections', () => { let fixture; diff --git a/packages/astro/test/fixtures/astro-assets-dir/src/content/config.ts b/packages/astro/test/fixtures/astro-assets-dir/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/astro-assets-dir/src/content/config.ts rename to packages/astro/test/fixtures/astro-assets-dir/src/content.config.ts diff --git a/packages/astro/test/fixtures/astro-assets-prefix/src/content/config.ts b/packages/astro/test/fixtures/astro-assets-prefix/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/astro-assets-prefix/src/content/config.ts rename to packages/astro/test/fixtures/astro-assets-prefix/src/content.config.ts diff --git a/packages/astro/test/fixtures/astro-env-content-collections/src/content/config.ts b/packages/astro/test/fixtures/astro-env-content-collections/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/astro-env-content-collections/src/content/config.ts rename to packages/astro/test/fixtures/astro-env-content-collections/src/content.config.ts diff --git a/packages/astro/test/fixtures/content with spaces in folder name/src/content/config.ts b/packages/astro/test/fixtures/content with spaces in folder name/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/content with spaces in folder name/src/content/config.ts rename to packages/astro/test/fixtures/content with spaces in folder name/src/content.config.ts diff --git a/packages/astro/test/fixtures/content-collection-references/src/content/config.ts b/packages/astro/test/fixtures/content-collection-references/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/content-collection-references/src/content/config.ts rename to packages/astro/test/fixtures/content-collection-references/src/content.config.ts diff --git a/packages/astro/test/fixtures/content-collections-base/src/content/config.ts b/packages/astro/test/fixtures/content-collections-base/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/content-collections-base/src/content/config.ts rename to packages/astro/test/fixtures/content-collections-base/src/content.config.ts diff --git a/packages/astro/test/fixtures/content-collections-cache-invalidation/src/content/config.ts b/packages/astro/test/fixtures/content-collections-cache-invalidation/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/content-collections-cache-invalidation/src/content/config.ts rename to packages/astro/test/fixtures/content-collections-cache-invalidation/src/content.config.ts diff --git a/packages/astro/test/fixtures/content-collections-empty-dir/src/content/config.ts b/packages/astro/test/fixtures/content-collections-empty-dir/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/content-collections-empty-dir/src/content/config.ts rename to packages/astro/test/fixtures/content-collections-empty-dir/src/content.config.ts diff --git a/packages/astro/test/fixtures/content-collections-mutation/src/content/config.ts b/packages/astro/test/fixtures/content-collections-mutation/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/content-collections-mutation/src/content/config.ts rename to packages/astro/test/fixtures/content-collections-mutation/src/content.config.ts diff --git a/packages/astro/test/fixtures/content-collections-same-contents/src/content/config.ts b/packages/astro/test/fixtures/content-collections-same-contents/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/content-collections-same-contents/src/content/config.ts rename to packages/astro/test/fixtures/content-collections-same-contents/src/content.config.ts diff --git a/packages/astro/test/fixtures/content-collections/src/content/config.ts b/packages/astro/test/fixtures/content-collections/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/content-collections/src/content/config.ts rename to packages/astro/test/fixtures/content-collections/src/content.config.ts diff --git a/packages/astro/test/fixtures/content-intellisense/src/content/config.ts b/packages/astro/test/fixtures/content-intellisense/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/content-intellisense/src/content/config.ts rename to packages/astro/test/fixtures/content-intellisense/src/content.config.ts diff --git a/packages/astro/test/fixtures/content-layer-markdoc/src/content/config.ts b/packages/astro/test/fixtures/content-layer-markdoc/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/content-layer-markdoc/src/content/config.ts rename to packages/astro/test/fixtures/content-layer-markdoc/src/content.config.ts diff --git a/packages/astro/test/fixtures/content-layer-rendering/src/content/config.ts b/packages/astro/test/fixtures/content-layer-rendering/src/content.config.ts similarity index 84% rename from packages/astro/test/fixtures/content-layer-rendering/src/content/config.ts rename to packages/astro/test/fixtures/content-layer-rendering/src/content.config.ts index eb175fa99b..2a8c005d5f 100644 --- a/packages/astro/test/fixtures/content-layer-rendering/src/content/config.ts +++ b/packages/astro/test/fixtures/content-layer-rendering/src/content.config.ts @@ -4,7 +4,7 @@ import { glob } from 'astro/loaders'; const reptiles = defineCollection({ loader: glob({ pattern: '*.mdx', - base: new URL('../../content-outside-src-mdx', import.meta.url), + base: new URL('../content-outside-src-mdx', import.meta.url), }), schema: () => z.object({ diff --git a/packages/astro/test/fixtures/content-layer/src/content/config.ts b/packages/astro/test/fixtures/content-layer/src/content.config.ts similarity index 98% rename from packages/astro/test/fixtures/content-layer/src/content/config.ts rename to packages/astro/test/fixtures/content-layer/src/content.config.ts index 65c0c5df05..82228f61da 100644 --- a/packages/astro/test/fixtures/content-layer/src/content/config.ts +++ b/packages/astro/test/fixtures/content-layer/src/content.config.ts @@ -1,6 +1,6 @@ import { defineCollection, z, reference } from 'astro:content'; import { file, glob } from 'astro/loaders'; -import { loader } from '../loaders/post-loader.js'; +import { loader } from './loaders/post-loader.js'; import { parse as parseToml } from 'toml'; const blog = defineCollection({ @@ -141,7 +141,7 @@ const birds = defineCollection({ }); // Absolute paths should also work -const absoluteRoot = new URL('space', import.meta.url); +const absoluteRoot = new URL('content/space', import.meta.url); const spacecraft = defineCollection({ loader: glob({ pattern: '*.md', base: absoluteRoot }), diff --git a/packages/astro/test/fixtures/content-layer/src/pages/collections.json.js b/packages/astro/test/fixtures/content-layer/src/pages/collections.json.js index 6bced27e45..5467550d70 100644 --- a/packages/astro/test/fixtures/content-layer/src/pages/collections.json.js +++ b/packages/astro/test/fixtures/content-layer/src/pages/collections.json.js @@ -29,6 +29,8 @@ export async function GET() { const tomlLoader = await getCollection('songs'); const nestedJsonLoader = await getCollection('birds'); + + const numbers = await getCollection('numbers'); return new Response( devalue.stringify({ @@ -41,11 +43,12 @@ export async function GET() { entryWithImagePath, referencedEntry, increment, + numbers, images, probes, yamlLoader, tomlLoader, nestedJsonLoader, - }), + }) ); } diff --git a/packages/astro/test/fixtures/content-static-paths-integration/src/content/config.ts b/packages/astro/test/fixtures/content-static-paths-integration/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/content-static-paths-integration/src/content/config.ts rename to packages/astro/test/fixtures/content-static-paths-integration/src/content.config.ts diff --git a/packages/astro/test/fixtures/core-image-base/src/content/config.ts b/packages/astro/test/fixtures/core-image-base/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/core-image-base/src/content/config.ts rename to packages/astro/test/fixtures/core-image-base/src/content.config.ts diff --git a/packages/astro/test/fixtures/core-image-deletion/src/content/config.ts b/packages/astro/test/fixtures/core-image-deletion/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/core-image-deletion/src/content/config.ts rename to packages/astro/test/fixtures/core-image-deletion/src/content.config.ts diff --git a/packages/astro/test/fixtures/core-image-ssg/src/content/config.ts b/packages/astro/test/fixtures/core-image-ssg/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/core-image-ssg/src/content/config.ts rename to packages/astro/test/fixtures/core-image-ssg/src/content.config.ts diff --git a/packages/astro/test/fixtures/data-collections-schema/src/content/config.ts b/packages/astro/test/fixtures/data-collections-schema/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/data-collections-schema/src/content/config.ts rename to packages/astro/test/fixtures/data-collections-schema/src/content.config.ts diff --git a/packages/astro/test/fixtures/data-collections/src/content/config.ts b/packages/astro/test/fixtures/data-collections/src/content.config.ts similarity index 100% rename from packages/astro/test/fixtures/data-collections/src/content/config.ts rename to packages/astro/test/fixtures/data-collections/src/content.config.ts diff --git a/packages/astro/test/fixtures/i18n-routing/src/pages/404.astro b/packages/astro/test/fixtures/i18n-routing/src/pages/404.astro new file mode 100644 index 0000000000..fce4a30b83 --- /dev/null +++ b/packages/astro/test/fixtures/i18n-routing/src/pages/404.astro @@ -0,0 +1,12 @@ +--- +const currentLocale = Astro.currentLocale; +--- + + + 404 - Not Found + + +

404 - Not Found

+

Current Locale: {currentLocale ? currentLocale : "none"}

+ + diff --git a/packages/astro/test/fixtures/server-islands/ssr/src/components/Island.astro b/packages/astro/test/fixtures/server-islands/ssr/src/components/Island.astro index 49a5a87ae0..2ed0e02706 100644 --- a/packages/astro/test/fixtures/server-islands/ssr/src/components/Island.astro +++ b/packages/astro/test/fixtures/server-islands/ssr/src/components/Island.astro @@ -1,4 +1,5 @@ --- - +await new Promise(resolve => setTimeout(resolve, 1)); +Astro.response.headers.set('X-Works', 'true'); ---

I'm an island

diff --git a/packages/astro/test/i18n-routing.test.js b/packages/astro/test/i18n-routing.test.js index 5b7e8c2e7a..5e3a3d3553 100644 --- a/packages/astro/test/i18n-routing.test.js +++ b/packages/astro/test/i18n-routing.test.js @@ -82,6 +82,18 @@ describe('[DEV] i18n routing', () => { assert.equal(response.status, 200); assert.equal((await response.text()).includes('Endurance'), true); }); + + it('should return the correct locale on 404 page for non existing default locale page', async () => { + const response = await fixture.fetch('/es/nonexistent-page'); + assert.equal(response.status, 404); + assert.equal((await response.text()).includes('Current Locale: es'), true); + }); + + it('should return the correct locale on 404 page for non existing english locale page', async () => { + const response = await fixture.fetch('/en/nonexistent-page'); + assert.equal(response.status, 404); + assert.equal((await response.text()).includes('Current Locale: en'), true); + }); }); describe('i18n routing', () => { @@ -1200,6 +1212,20 @@ describe('[SSR] i18n routing', () => { assert.equal(response.status, 200); assert.equal((await response.text()).includes('Endurance'), true); }); + + it('should return the correct locale on 404 page for non existing default locale page', async () => { + let request = new Request('http://example.com/es/nonexistent-page'); + let response = await app.render(request); + assert.equal(response.status, 404); + assert.equal((await response.text()).includes('Current Locale: es'), true); + }); + + it('should return the correct locale on 404 page for non existing english locale page', async () => { + let request = new Request('http://example.com/en/nonexistent-page'); + let response = await app.render(request); + assert.equal(response.status, 404); + assert.equal((await response.text()).includes('Current Locale: en'), true); + }); }); describe('default', () => { diff --git a/packages/astro/test/server-islands.test.js b/packages/astro/test/server-islands.test.js index 5055369727..913650a950 100644 --- a/packages/astro/test/server-islands.test.js +++ b/packages/astro/test/server-islands.test.js @@ -19,11 +19,13 @@ describe('Server islands', () => { let devServer; before(async () => { + process.env.ASTRO_KEY = 'eKBaVEuI7YjfanEXHuJe/pwZKKt3LkAHeMxvTU7aR0M='; devServer = await fixture.startDevServer(); }); after(async () => { await devServer.stop(); + delete process.env.ASTRO_KEY; }); it('omits the islands HTML', async () => { @@ -34,13 +36,31 @@ describe('Server islands', () => { const serverIslandEl = $('h2#island'); assert.equal(serverIslandEl.length, 0); }); + + it('island can set headers', async () => { + const res = await fixture.fetch('/_server-islands/Island', { + method: 'POST', + body: JSON.stringify({ + componentExport: 'default', + encryptedProps: 'FC8337AF072BE5B1641501E1r8mLIhmIME1AV7UO9XmW9OLD', + slots: {}, + }), + }); + const works = res.headers.get('X-Works'); + assert.equal(works, 'true', 'able to set header from server island'); + }); }); describe('prod', () => { before(async () => { + process.env.ASTRO_KEY = 'eKBaVEuI7YjfanEXHuJe/pwZKKt3LkAHeMxvTU7aR0M='; await fixture.build(); }); + after(async () => { + delete process.env.ASTRO_KEY; + }); + it('omits the islands HTML', async () => { const app = await fixture.loadTestAdapterApp(); const request = new Request('http://example.com/'); diff --git a/packages/astro/test/units/content-collections/frontmatter.test.js b/packages/astro/test/units/content-collections/frontmatter.test.js index 4f587a90fe..feffabf956 100644 --- a/packages/astro/test/units/content-collections/frontmatter.test.js +++ b/packages/astro/test/units/content-collections/frontmatter.test.js @@ -10,7 +10,7 @@ describe('frontmatter', () => { title: One --- `, - '/src/content/config.ts': `\ + '/src/content.config.ts': `\ import { defineCollection, z } from 'astro:content'; const posts = defineCollection({ diff --git a/packages/astro/test/units/content-collections/get-entry-type.test.js b/packages/astro/test/units/content-collections/get-entry-type.test.js index 2876e5bfc3..9d60c4c5c0 100644 --- a/packages/astro/test/units/content-collections/get-entry-type.test.js +++ b/packages/astro/test/units/content-collections/get-entry-type.test.js @@ -8,7 +8,7 @@ const fixtures = [ title: 'Without any underscore above the content directory tree', contentPaths: { config: { - url: new URL('src/content/config.ts', import.meta.url), + url: new URL('src/content.config.ts', import.meta.url), exists: true, }, contentDir: new URL('src/content/', import.meta.url), diff --git a/packages/astro/test/units/dev/collections-mixed-content-errors.test.js b/packages/astro/test/units/dev/collections-mixed-content-errors.test.js index da72f4a768..295662c931 100644 --- a/packages/astro/test/units/dev/collections-mixed-content-errors.test.js +++ b/packages/astro/test/units/dev/collections-mixed-content-errors.test.js @@ -57,7 +57,7 @@ name: Ben # Ben `, '/src/content/authors/tony.json': `{ "name": "Tony" }`, - '/src/content/config.ts': `\ + '/src/content.config.ts': `\ import { z, defineCollection } from 'astro:content'; const authors = defineCollection({ @@ -85,7 +85,7 @@ title: Post # Post `, '/src/content/blog/post.yaml': `title: YAML Post`, - '/src/content/config.ts': `\ + '/src/content.config.ts': `\ import { z, defineCollection } from 'astro:content'; const blog = defineCollection({ @@ -128,7 +128,7 @@ export const collections = { banners }; ...baseFileTree, // Add placeholder to ensure directory exists '/src/content/i18n/_placeholder.txt': 'Need content here', - '/src/content/config.ts': `\ + '/src/content.config.ts': `\ import { z, defineCollection } from 'astro:content'; const i18n = defineCollection({ diff --git a/packages/astro/test/units/dev/collections-renderentry.test.js b/packages/astro/test/units/dev/collections-renderentry.test.js index 42e11c2a22..c30c471b88 100644 --- a/packages/astro/test/units/dev/collections-renderentry.test.js +++ b/packages/astro/test/units/dev/collections-renderentry.test.js @@ -166,7 +166,7 @@ describe('Content Collections - render()', () => { it('can be used in a slot', async () => { const fixture = await createFixture({ ...baseFileTree, - '/src/content/config.ts': ` + '/src/content.config.ts': ` import { z, defineCollection } from 'astro:content'; const blog = defineCollection({ @@ -233,7 +233,7 @@ describe('Content Collections - render()', () => { it('can be called from any js/ts file', async () => { const fixture = await createFixture({ ...baseFileTree, - '/src/content/config.ts': ` + '/src/content.config.ts': ` import { z, defineCollection } from 'astro:content'; const blog = defineCollection({ diff --git a/packages/astro/test/units/integrations/api.test.js b/packages/astro/test/units/integrations/api.test.js index f2365c006b..97da20c193 100644 --- a/packages/astro/test/units/integrations/api.test.js +++ b/packages/astro/test/units/integrations/api.test.js @@ -7,7 +7,7 @@ import { runHookBuildSetup, runHookConfigSetup, } from '../../../dist/integrations/hooks.js'; -import { defaultLogger } from '../test-utils.js'; +import { createFixture, defaultLogger, runInContainer } from '../test-utils.js'; const defaultConfig = { root: new URL('./', import.meta.url), @@ -131,6 +131,221 @@ describe('Integration API', () => { assert.equal(updatedSettings.config.site, site); assert.equal(updatedSettings.config.integrations.length, 2); }); + + describe('Routes resolved hooks', () => { + it('should work in dev', async () => { + let routes = []; + const fixture = await createFixture({ + '/src/pages/about.astro': '', + '/src/actions.ts': 'export const server = {}', + '/src/foo.astro': '', + }); + + await runInContainer( + { + inlineConfig: { + root: fixture.path, + integrations: [ + { + name: 'test', + hooks: { + 'astro:config:setup': (params) => { + params.injectRoute({ + entrypoint: './src/foo.astro', + pattern: '/foo', + }); + }, + 'astro:routes:resolved': (params) => { + routes = params.routes.map((r) => ({ + isPrerendered: r.isPrerendered, + entrypoint: r.entrypoint, + pattern: r.pattern, + params: r.params, + origin: r.origin, + })); + routes.sort((a, b) => a.pattern.localeCompare(b.pattern)); + }, + }, + }, + ], + }, + }, + async (container) => { + assert.deepEqual( + routes, + [ + { + isPrerendered: false, + entrypoint: '_server-islands.astro', + pattern: '/_server-islands/[name]', + params: ['name'], + origin: 'internal', + }, + { + isPrerendered: false, + entrypoint: '../../../../dist/actions/runtime/route.js', + pattern: '/_actions/[...path]', + params: ['...path'], + origin: 'internal', + }, + { + isPrerendered: true, + entrypoint: 'src/pages/about.astro', + pattern: '/about', + params: [], + origin: 'project', + }, + { + isPrerendered: true, + entrypoint: 'src/foo.astro', + pattern: '/foo', + params: [], + origin: 'external', + }, + { + isPrerendered: false, + entrypoint: '../../../../dist/assets/endpoint/node.js', + pattern: '/_image', + params: [], + origin: 'internal', + }, + { + isPrerendered: false, + entrypoint: 'astro-default-404.astro', + pattern: '/404', + params: [], + origin: 'internal', + }, + ].sort((a, b) => a.pattern.localeCompare(b.pattern)), + ); + + await fixture.writeFile('/src/pages/bar.astro', ''); + container.viteServer.watcher.emit( + 'add', + fixture.getPath('/src/pages/bar.astro').replace(/\\/g, '/'), + ); + await new Promise((r) => setTimeout(r, 100)); + + assert.deepEqual( + routes, + [ + { + isPrerendered: false, + entrypoint: '_server-islands.astro', + pattern: '/_server-islands/[name]', + params: ['name'], + origin: 'internal', + }, + { + isPrerendered: false, + entrypoint: '../../../../dist/actions/runtime/route.js', + pattern: '/_actions/[...path]', + params: ['...path'], + origin: 'internal', + }, + { + isPrerendered: true, + entrypoint: 'src/pages/about.astro', + pattern: '/about', + params: [], + origin: 'project', + }, + { + isPrerendered: true, + entrypoint: 'src/pages/bar.astro', + pattern: '/bar', + params: [], + origin: 'project', + }, + { + isPrerendered: true, + entrypoint: 'src/foo.astro', + pattern: '/foo', + params: [], + origin: 'external', + }, + { + isPrerendered: false, + entrypoint: '../../../../dist/assets/endpoint/node.js', + pattern: '/_image', + params: [], + origin: 'internal', + }, + { + isPrerendered: false, + entrypoint: 'astro-default-404.astro', + pattern: '/404', + params: [], + origin: 'internal', + }, + ].sort((a, b) => a.pattern.localeCompare(b.pattern)), + ); + + await fixture.writeFile('/src/pages/about.astro', '---\nexport const prerender=false\n'); + container.viteServer.watcher.emit( + 'change', + fixture.getPath('/src/pages/about.astro').replace(/\\/g, '/'), + ); + await new Promise((r) => setTimeout(r, 100)); + + assert.deepEqual( + routes, + [ + { + isPrerendered: false, + entrypoint: '_server-islands.astro', + pattern: '/_server-islands/[name]', + params: ['name'], + origin: 'internal', + }, + { + isPrerendered: false, + entrypoint: '../../../../dist/actions/runtime/route.js', + pattern: '/_actions/[...path]', + params: ['...path'], + origin: 'internal', + }, + { + isPrerendered: false, + entrypoint: 'src/pages/about.astro', + pattern: '/about', + params: [], + origin: 'project', + }, + { + isPrerendered: true, + entrypoint: 'src/pages/bar.astro', + pattern: '/bar', + params: [], + origin: 'project', + }, + { + isPrerendered: true, + entrypoint: 'src/foo.astro', + pattern: '/foo', + params: [], + origin: 'external', + }, + { + isPrerendered: false, + entrypoint: '../../../../dist/assets/endpoint/node.js', + pattern: '/_image', + params: [], + origin: 'internal', + }, + { + isPrerendered: false, + entrypoint: 'astro-default-404.astro', + pattern: '/404', + params: [], + origin: 'internal', + }, + ].sort((a, b) => a.pattern.localeCompare(b.pattern)), + ); + }, + ); + }); + }); }); describe('Astro feature map', function () { diff --git a/packages/create-astro/package.json b/packages/create-astro/package.json index 9745ad223e..1d20f12b79 100644 --- a/packages/create-astro/package.json +++ b/packages/create-astro/package.json @@ -6,7 +6,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/create-astro" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/db/package.json b/packages/db/package.json index 02576f84ff..d513c4d0bb 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -5,7 +5,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/db" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/integrations/alpinejs/package.json b/packages/integrations/alpinejs/package.json index b0f3f4e3d8..5c506688e5 100644 --- a/packages/integrations/alpinejs/package.json +++ b/packages/integrations/alpinejs/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/alpinejs" }, "keywords": [ diff --git a/packages/integrations/cloudflare/package.json b/packages/integrations/cloudflare/package.json index 9e6bf7f836..05e18bc647 100644 --- a/packages/integrations/cloudflare/package.json +++ b/packages/integrations/cloudflare/package.json @@ -2,6 +2,7 @@ "name": "@astrojs/cloudflare", "version": "0.0.0", "private": true, + "type": "module", "keywords": [], "dont_remove": "This is a placeholder for the sake of the docs smoke test" } diff --git a/packages/integrations/markdoc/package.json b/packages/integrations/markdoc/package.json index 42bac876d5..1c3ec68eea 100644 --- a/packages/integrations/markdoc/package.json +++ b/packages/integrations/markdoc/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/markdoc" }, "keywords": [ diff --git a/packages/integrations/mdx/package.json b/packages/integrations/mdx/package.json index d35e7116ce..16d9864fa7 100644 --- a/packages/integrations/mdx/package.json +++ b/packages/integrations/mdx/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/mdx" }, "keywords": [ diff --git a/packages/integrations/netlify/package.json b/packages/integrations/netlify/package.json index 2d9ce88d39..4b54bb6c09 100644 --- a/packages/integrations/netlify/package.json +++ b/packages/integrations/netlify/package.json @@ -2,6 +2,7 @@ "name": "@astrojs/netlify", "version": "0.0.0", "private": true, + "type": "module", "keywords": [], "dont_remove": "This is a placeholder for the sake of the docs smoke test" } diff --git a/packages/integrations/node/package.json b/packages/integrations/node/package.json index 656c453933..134ba5d86a 100644 --- a/packages/integrations/node/package.json +++ b/packages/integrations/node/package.json @@ -2,6 +2,7 @@ "name": "@astrojs/node", "version": "0.0.0", "private": true, + "type": "module", "keywords": [], "dont_remove": "This is a placeholder for the sake of the docs smoke test" } diff --git a/packages/integrations/partytown/package.json b/packages/integrations/partytown/package.json index e8fd6e5e6b..0a171c1c0e 100644 --- a/packages/integrations/partytown/package.json +++ b/packages/integrations/partytown/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/partytown" }, "keywords": [ diff --git a/packages/integrations/preact/CHANGELOG.md b/packages/integrations/preact/CHANGELOG.md index b7138a78d2..e99ca01e38 100644 --- a/packages/integrations/preact/CHANGELOG.md +++ b/packages/integrations/preact/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/preact +## 3.5.4 + +### Patch Changes + +- [#12481](https://github.com/withastro/astro/pull/12481) [`8a46e80`](https://github.com/withastro/astro/commit/8a46e8074d6afb4a23badbd59ed239d526294e8c) Thanks [@marbrex](https://github.com/marbrex)! - Resolve `vite` peer dependency problem for strict package managers like **Yarn in PnP mode**. + ## 3.5.3 ### Patch Changes diff --git a/packages/integrations/preact/package.json b/packages/integrations/preact/package.json index e88470166e..d039c95ff3 100644 --- a/packages/integrations/preact/package.json +++ b/packages/integrations/preact/package.json @@ -1,14 +1,14 @@ { "name": "@astrojs/preact", "description": "Use Preact components within Astro", - "version": "3.5.3", + "version": "3.5.4-beta.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/preact" }, "keywords": [ @@ -40,7 +40,8 @@ "@preact/preset-vite": "2.8.2", "@preact/signals": "^1.3.0", "babel-plugin-transform-hook-names": "^1.0.2", - "preact-render-to-string": "^6.5.11" + "preact-render-to-string": "^6.5.11", + "vite": "^5.4.10" }, "devDependencies": { "astro": "workspace:*", diff --git a/packages/integrations/react/CHANGELOG.md b/packages/integrations/react/CHANGELOG.md index 65eb7056cb..45f9ffaebe 100644 --- a/packages/integrations/react/CHANGELOG.md +++ b/packages/integrations/react/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/react +## 3.6.3 + +### Patch Changes + +- [#12481](https://github.com/withastro/astro/pull/12481) [`8a46e80`](https://github.com/withastro/astro/commit/8a46e8074d6afb4a23badbd59ed239d526294e8c) Thanks [@marbrex](https://github.com/marbrex)! - Resolve `vite` peer dependency problem for strict package managers like **Yarn in PnP mode**. + ## 3.6.2 ### Patch Changes diff --git a/packages/integrations/react/package.json b/packages/integrations/react/package.json index 3e358a5391..1ce3c5032e 100644 --- a/packages/integrations/react/package.json +++ b/packages/integrations/react/package.json @@ -1,14 +1,14 @@ { "name": "@astrojs/react", "description": "Use React components within Astro", - "version": "3.6.2", + "version": "3.6.3-beta.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/react" }, "keywords": [ @@ -24,14 +24,8 @@ "./actions": "./dist/actions.js", "./client.js": "./client.js", "./client-v17.js": "./client-v17.js", - "./server.js": { - "default": "./server.js", - "types": "./server.d.ts" - }, - "./server-v17.js": { - "default": "./server-v17.js", - "types": "./server-v17.d.ts" - }, + "./server.js": "./server.js", + "./server-v17.js": "./server-v17.js", "./package.json": "./package.json", "./jsx-runtime": "./jsx-runtime.js" }, @@ -56,7 +50,8 @@ }, "dependencies": { "@vitejs/plugin-react": "^4.3.3", - "ultrahtml": "^1.5.3" + "ultrahtml": "^1.5.3", + "vite": "6.0.0-beta.6" }, "devDependencies": { "@types/react": "^18.3.12", @@ -65,8 +60,7 @@ "astro-scripts": "workspace:*", "cheerio": "1.0.0", "react": "^18.3.1", - "react-dom": "^18.3.1", - "vite": "6.0.0-beta.6" + "react-dom": "^18.3.1" }, "peerDependencies": { "@types/react": "^17.0.50 || ^18.0.21", diff --git a/packages/integrations/sitemap/package.json b/packages/integrations/sitemap/package.json index 7e4bfb3a67..ec4c02b824 100644 --- a/packages/integrations/sitemap/package.json +++ b/packages/integrations/sitemap/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/sitemap" }, "keywords": [ diff --git a/packages/integrations/solid/CHANGELOG.md b/packages/integrations/solid/CHANGELOG.md index 2ded2af1ee..3cca257571 100644 --- a/packages/integrations/solid/CHANGELOG.md +++ b/packages/integrations/solid/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/solid-js +## 4.4.4 + +### Patch Changes + +- [#12481](https://github.com/withastro/astro/pull/12481) [`8a46e80`](https://github.com/withastro/astro/commit/8a46e8074d6afb4a23badbd59ed239d526294e8c) Thanks [@marbrex](https://github.com/marbrex)! - Resolve `vite` peer dependency problem for strict package managers like **Yarn in PnP mode**. + ## 4.4.3 ### Patch Changes diff --git a/packages/integrations/solid/package.json b/packages/integrations/solid/package.json index 33b27651ff..f46629d0ff 100644 --- a/packages/integrations/solid/package.json +++ b/packages/integrations/solid/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/solid-js", - "version": "4.4.3", + "version": "4.4.4-beta.0", "description": "Use Solid components within Astro", "type": "module", "types": "./dist/index.d.ts", @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/solid" }, "keywords": [ @@ -35,13 +35,13 @@ "dev": "astro-scripts dev \"src/**/*.ts\"" }, "dependencies": { - "vite-plugin-solid": "^2.10.2" + "vite-plugin-solid": "^2.10.2", + "vite": "6.0.0-beta.6" }, "devDependencies": { "astro": "workspace:*", "astro-scripts": "workspace:*", - "solid-js": "^1.9.3", - "vite": "6.0.0-beta.6" + "solid-js": "^1.9.3" }, "peerDependencies": { "solid-devtools": "^0.30.1", diff --git a/packages/integrations/svelte/CHANGELOG.md b/packages/integrations/svelte/CHANGELOG.md index ab1373bc5f..76b1bbff51 100644 --- a/packages/integrations/svelte/CHANGELOG.md +++ b/packages/integrations/svelte/CHANGELOG.md @@ -1,5 +1,20 @@ # @astrojs/svelte +## 6.0.2 + +### Patch Changes + +- [#12481](https://github.com/withastro/astro/pull/12481) [`8a46e80`](https://github.com/withastro/astro/commit/8a46e8074d6afb4a23badbd59ed239d526294e8c) Thanks [@marbrex](https://github.com/marbrex)! - Resolve `vite` peer dependency problem for strict package managers like **Yarn in PnP mode**. + +- Updated dependencies [[`c48916c`](https://github.com/withastro/astro/commit/c48916cc4e6f7c31e3563d04b68a8698d8775b65), [`4364bff`](https://github.com/withastro/astro/commit/4364bff27332e52f92da72392620a36110daee42), [`c8f877c`](https://github.com/withastro/astro/commit/c8f877cad2d8f1780f70045413872d5b9d32ebed), [`8309c61`](https://github.com/withastro/astro/commit/8309c61f0dfa5991d3f6c5c5fca4403794d6fda2), [`af867f3`](https://github.com/withastro/astro/commit/af867f3910ecd8fc04a5337f591d84f03192e3fa), [`3f02d5f`](https://github.com/withastro/astro/commit/3f02d5f12b167514fff6eb9693b4e25c668e7a31)]: + - astro@5.0.0-beta.9 + +## 6.0.1 + +### Patch Changes + +- [#12442](https://github.com/withastro/astro/pull/12442) [`bde49f1`](https://github.com/withastro/astro/commit/bde49f186e4d620ce0c926353db38215e33dceef) Thanks [@bluwy](https://github.com/bluwy)! - Publishes missing file + ## 6.0.0 ### Major Changes diff --git a/packages/integrations/svelte/package.json b/packages/integrations/svelte/package.json index 2c07837e5a..2d6aebe34b 100644 --- a/packages/integrations/svelte/package.json +++ b/packages/integrations/svelte/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/svelte", - "version": "6.0.0", + "version": "6.0.2-beta.0", "description": "Use Svelte components within Astro", "type": "module", "types": "./dist/index.d.ts", @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/svelte" }, "keywords": [ @@ -24,15 +24,12 @@ "./editor": "./dist/editor.cjs", "./*": "./*", "./client.js": "./client.svelte.js", - "./server.js": { - "default": "./server.js", - "types": "./server.d.ts" - }, + "./server.js": "./server.js", "./package.json": "./package.json" }, "files": [ "dist", - "client.js", + "client.svelte.js", "server.js", "server.d.ts" ], @@ -43,16 +40,16 @@ }, "dependencies": { "@sveltejs/vite-plugin-svelte": "^4.0.0", - "svelte2tsx": "^0.7.22" + "svelte2tsx": "^0.7.22", + "vite": "6.0.0-beta.6" }, "devDependencies": { "astro": "workspace:*", "astro-scripts": "workspace:*", - "svelte": "^5.1.16", - "vite": "6.0.0-beta.6" + "svelte": "^5.1.16" }, "peerDependencies": { - "astro": "^4.0.0", + "astro": "^5.0.0-beta.9", "svelte": "^5.1.16", "typescript": "^5.3.3" }, diff --git a/packages/integrations/tailwind/package.json b/packages/integrations/tailwind/package.json index ba06a9eba5..073de3d411 100644 --- a/packages/integrations/tailwind/package.json +++ b/packages/integrations/tailwind/package.json @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/tailwind" }, "keywords": [ diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json index 7fef2f9b89..57beba344a 100644 --- a/packages/integrations/vercel/package.json +++ b/packages/integrations/vercel/package.json @@ -2,6 +2,7 @@ "name": "@astrojs/vercel", "version": "0.0.0", "private": true, + "type": "module", "keywords": [], "dont_remove": "This is a placeholder for the sake of the docs smoke test" } diff --git a/packages/integrations/vue/CHANGELOG.md b/packages/integrations/vue/CHANGELOG.md index 764f28483d..71f28ed6c9 100644 --- a/packages/integrations/vue/CHANGELOG.md +++ b/packages/integrations/vue/CHANGELOG.md @@ -19,6 +19,12 @@ - Updated dependencies [[`b6fbdaa`](https://github.com/withastro/astro/commit/b6fbdaa94a9ecec706a99e1938fbf5cd028c72e0), [`89bab1e`](https://github.com/withastro/astro/commit/89bab1e70786123fbe933a9d7a1b80c9334dcc5f), [`d74617c`](https://github.com/withastro/astro/commit/d74617cbd3278feba05909ec83db2d73d57a153e), [`e90f559`](https://github.com/withastro/astro/commit/e90f5593d23043579611452a84b9e18ad2407ef9), [`2df49a6`](https://github.com/withastro/astro/commit/2df49a6fb4f6d92fe45f7429430abe63defeacd6), [`8a53517`](https://github.com/withastro/astro/commit/8a5351737d6a14fc55f1dafad8f3b04079e81af6)]: - astro@5.0.0-alpha.0 +## 4.5.3 + +### Patch Changes + +- [#12481](https://github.com/withastro/astro/pull/12481) [`8a46e80`](https://github.com/withastro/astro/commit/8a46e8074d6afb4a23badbd59ed239d526294e8c) Thanks [@marbrex](https://github.com/marbrex)! - Resolve `vite` peer dependency problem for strict package managers like **Yarn in PnP mode**. + ## 4.5.2 ### Patch Changes diff --git a/packages/integrations/vue/package.json b/packages/integrations/vue/package.json index c8677a6072..9b144f83ce 100644 --- a/packages/integrations/vue/package.json +++ b/packages/integrations/vue/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/vue", - "version": "5.0.0-beta.1", + "version": "5.0.0-beta.2", "description": "Use Vue components within Astro", "type": "module", "types": "./dist/index.d.ts", @@ -8,7 +8,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/vue" }, "keywords": [ @@ -24,10 +24,7 @@ "./editor": "./dist/editor.cjs", "./*": "./*", "./client.js": "./client.js", - "./server.js": { - "default": "./server.js", - "types": "./server.d.ts" - }, + "./server.js": "./server.js", "./package.json": "./package.json" }, "files": [ @@ -48,14 +45,14 @@ "@vitejs/plugin-vue": "^5.1.4", "@vitejs/plugin-vue-jsx": "^4.0.1", "@vue/compiler-sfc": "^3.5.12", - "vite-plugin-vue-devtools": "^7.6.3" + "vite-plugin-vue-devtools": "^7.6.3", + "vite": "6.0.0-beta.6" }, "devDependencies": { "astro": "workspace:*", "astro-scripts": "workspace:*", "cheerio": "1.0.0", "linkedom": "^0.18.5", - "vite": "6.0.0-beta.6", "vue": "^3.5.12" }, "peerDependencies": { diff --git a/packages/integrations/web-vitals/package.json b/packages/integrations/web-vitals/package.json index 13ceeb5e6e..d06582b15b 100644 --- a/packages/integrations/web-vitals/package.json +++ b/packages/integrations/web-vitals/package.json @@ -7,7 +7,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/integrations/web-vitals" }, "keywords": [ diff --git a/packages/internal-helpers/package.json b/packages/internal-helpers/package.json index bbf4938b0c..9f5ebfbb06 100644 --- a/packages/internal-helpers/package.json +++ b/packages/internal-helpers/package.json @@ -7,7 +7,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/internal-helpers" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/markdown/remark/package.json b/packages/markdown/remark/package.json index ac6235547f..a5d2da9a44 100644 --- a/packages/markdown/remark/package.json +++ b/packages/markdown/remark/package.json @@ -6,7 +6,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/markdown/remark" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/studio/package.json b/packages/studio/package.json index d049cb063c..05be0d15e2 100644 --- a/packages/studio/package.json +++ b/packages/studio/package.json @@ -5,7 +5,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/studio" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/telemetry/package.json b/packages/telemetry/package.json index 69aac31bc5..5111f168c0 100644 --- a/packages/telemetry/package.json +++ b/packages/telemetry/package.json @@ -7,7 +7,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/telemetry" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/underscore-redirects/package.json b/packages/underscore-redirects/package.json index eb5620c34e..8e0d3941a1 100644 --- a/packages/underscore-redirects/package.json +++ b/packages/underscore-redirects/package.json @@ -7,7 +7,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/underscore-redirects" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/packages/upgrade/package.json b/packages/upgrade/package.json index 38655068b3..872f6e7295 100644 --- a/packages/upgrade/package.json +++ b/packages/upgrade/package.json @@ -6,7 +6,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/withastro/astro.git", + "url": "git+https://github.com/withastro/astro.git", "directory": "packages/upgrade" }, "bugs": "https://github.com/withastro/astro/issues", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 55b371e1ac..c6ebc728f1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -52,6 +52,9 @@ importers: prettier-plugin-astro: specifier: ^0.14.1 version: 0.14.1 + publint: + specifier: ^0.2.12 + version: 0.2.12 turbo: specifier: ^2.2.3 version: 2.2.3 @@ -143,7 +146,7 @@ importers: examples/basics: dependencies: astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro examples/blog: @@ -158,22 +161,22 @@ importers: specifier: ^3.2.1 version: link:../../packages/integrations/sitemap astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro examples/component: devDependencies: astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro examples/container-with-vitest: dependencies: '@astrojs/react': - specifier: ^3.6.2 + specifier: ^3.6.3-beta.0 version: link:../../packages/integrations/react astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro react: specifier: ^18.3.1 @@ -204,25 +207,25 @@ importers: specifier: ^3.14.3 version: 3.14.3 astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro examples/framework-multiple: dependencies: '@astrojs/preact': - specifier: ^3.5.3 + specifier: ^3.5.4-beta.0 version: link:../../packages/integrations/preact '@astrojs/react': - specifier: ^3.6.2 + specifier: ^3.6.3-beta.0 version: link:../../packages/integrations/react '@astrojs/solid-js': - specifier: ^4.4.3 + specifier: ^4.4.4-beta.0 version: link:../../packages/integrations/solid '@astrojs/svelte': - specifier: ^6.0.0-beta.2 + specifier: ^6.0.2-beta.0 version: link:../../packages/integrations/svelte '@astrojs/vue': - specifier: ^5.0.0-beta.1 + specifier: ^5.0.0-beta.2 version: link:../../packages/integrations/vue '@types/react': specifier: ^18.3.12 @@ -231,7 +234,7 @@ importers: specifier: ^18.3.1 version: 18.3.1 astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro preact: specifier: ^10.24.3 @@ -255,13 +258,13 @@ importers: examples/framework-preact: dependencies: '@astrojs/preact': - specifier: ^3.5.3 + specifier: ^3.5.4-beta.0 version: link:../../packages/integrations/preact '@preact/signals': specifier: ^1.3.0 version: 1.3.0(preact@10.24.3) astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro preact: specifier: ^10.24.3 @@ -270,7 +273,7 @@ importers: examples/framework-react: dependencies: '@astrojs/react': - specifier: ^3.6.2 + specifier: ^3.6.3-beta.0 version: link:../../packages/integrations/react '@types/react': specifier: ^18.3.12 @@ -279,7 +282,7 @@ importers: specifier: ^18.3.1 version: 18.3.1 astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro react: specifier: ^18.3.1 @@ -291,22 +294,22 @@ importers: examples/framework-solid: dependencies: '@astrojs/solid-js': - specifier: ^4.4.3 + specifier: ^4.4.4-beta.0 version: link:../../packages/integrations/solid astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro solid-js: - specifier: ^1.9.2 + specifier: ^1.9.3 version: 1.9.3 examples/framework-svelte: dependencies: '@astrojs/svelte': - specifier: ^6.0.0 + specifier: ^6.0.2-beta.0 version: link:../../packages/integrations/svelte astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro svelte: specifier: ^5.1.16 @@ -315,10 +318,10 @@ importers: examples/framework-vue: dependencies: '@astrojs/vue': - specifier: ^5.0.0-beta.1 + specifier: ^5.0.0-beta.2 version: link:../../packages/integrations/vue astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro vue: specifier: ^3.5.12 @@ -330,25 +333,25 @@ importers: specifier: ^9.0.0-alpha.1 version: 9.0.0-alpha.1(astro@packages+astro) astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro examples/integration: devDependencies: astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro examples/minimal: dependencies: astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro examples/portfolio: dependencies: astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro examples/ssr: @@ -357,10 +360,10 @@ importers: specifier: ^9.0.0-alpha.1 version: 9.0.0-alpha.1(astro@packages+astro) '@astrojs/svelte': - specifier: ^6.0.0 + specifier: ^6.0.2-beta.0 version: link:../../packages/integrations/svelte astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro svelte: specifier: ^5.1.16 @@ -369,7 +372,7 @@ importers: examples/starlog: dependencies: astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro sass: specifier: ^1.80.6 @@ -381,7 +384,7 @@ importers: examples/toolbar-app: devDependencies: astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro examples/with-markdoc: @@ -390,7 +393,7 @@ importers: specifier: ^0.12.0-beta.0 version: link:../../packages/integrations/markdoc astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro examples/with-mdx: @@ -399,10 +402,10 @@ importers: specifier: ^4.0.0-beta.3 version: link:../../packages/integrations/mdx '@astrojs/preact': - specifier: ^3.5.3 + specifier: ^3.5.4-beta.0 version: link:../../packages/integrations/preact astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro preact: specifier: ^10.24.3 @@ -411,13 +414,13 @@ importers: examples/with-nanostores: dependencies: '@astrojs/preact': - specifier: ^3.5.3 + specifier: ^3.5.4-beta.0 version: link:../../packages/integrations/preact '@nanostores/preact': specifier: ^0.5.2 version: 0.5.2(nanostores@0.11.3)(preact@10.24.3) astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro nanostores: specifier: ^0.11.3 @@ -438,7 +441,7 @@ importers: specifier: ^1.6.4 version: 1.6.4 astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro autoprefixer: specifier: ^10.4.20 @@ -456,7 +459,7 @@ importers: examples/with-vitest: dependencies: astro: - specifier: ^5.0.0-beta.8 + specifier: ^5.0.0-beta.10 version: link:../../packages/astro vitest: specifier: ^2.1.4 @@ -4405,7 +4408,7 @@ importers: version: 8.3.4(astro@packages+astro) '@astrojs/react': specifier: ^3.6.2 - version: link:../../../../integrations/react + version: 3.6.3(@types/node@18.19.50)(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.80.6) '@types/react': specifier: ^18.3.12 version: 18.3.12 @@ -4975,7 +4978,7 @@ importers: version: 7.25.9(@babel/core@7.26.0) '@preact/preset-vite': specifier: 2.8.2 - version: 2.8.2(@babel/core@7.26.0)(preact@10.24.3)(vite@6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1)) + version: 2.8.2(@babel/core@7.26.0)(preact@10.24.3)(vite@5.4.11(@types/node@18.19.50)(sass@1.80.6)) '@preact/signals': specifier: ^1.3.0 version: 1.3.0(preact@10.24.3) @@ -4985,6 +4988,9 @@ importers: preact-render-to-string: specifier: ^6.5.11 version: 6.5.11(preact@10.24.3) + vite: + specifier: ^5.4.10 + version: 5.4.11(@types/node@18.19.50)(sass@1.80.6) devDependencies: astro: specifier: workspace:* @@ -5004,6 +5010,9 @@ importers: ultrahtml: specifier: ^1.5.3 version: 1.5.3 + vite: + specifier: 6.0.0-beta.6 + version: 6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1) devDependencies: '@types/react': specifier: ^18.3.12 @@ -5026,9 +5035,6 @@ importers: react-dom: specifier: ^18.3.1 version: 18.3.1(react@18.3.1) - vite: - specifier: 6.0.0-beta.6 - version: 6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1) packages/integrations/react/test/fixtures/react-component: dependencies: @@ -5114,6 +5120,9 @@ importers: packages/integrations/solid: dependencies: + vite: + specifier: 6.0.0-beta.6 + version: 6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1) vite-plugin-solid: specifier: ^2.10.2 version: 2.10.2(solid-js@1.9.3)(vite@6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1)) @@ -5127,9 +5136,6 @@ importers: solid-js: specifier: ^1.9.3 version: 1.9.3 - vite: - specifier: 6.0.0-beta.6 - version: 6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1) packages/integrations/svelte: dependencies: @@ -5139,6 +5145,9 @@ importers: svelte2tsx: specifier: ^0.7.22 version: 0.7.22(svelte@5.1.16)(typescript@5.6.3) + vite: + specifier: 6.0.0-beta.6 + version: 6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1) devDependencies: astro: specifier: workspace:* @@ -5149,9 +5158,6 @@ importers: svelte: specifier: ^5.1.16 version: 5.1.16 - vite: - specifier: 6.0.0-beta.6 - version: 6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1) packages/integrations/tailwind: dependencies: @@ -5200,6 +5206,9 @@ importers: '@vue/compiler-sfc': specifier: ^3.5.12 version: 3.5.12 + vite: + specifier: 6.0.0-beta.6 + version: 6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1) vite-plugin-vue-devtools: specifier: ^7.6.3 version: 7.6.3(rollup@4.24.4)(vite@6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1))(vue@3.5.12(typescript@5.6.3)) @@ -5216,9 +5225,6 @@ importers: linkedom: specifier: ^0.18.5 version: 0.18.5 - vite: - specifier: 6.0.0-beta.6 - version: 6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1) vue: specifier: ^3.5.12 version: 3.5.12(typescript@5.6.3) @@ -5637,6 +5643,15 @@ packages: peerDependencies: astro: ^5.0.0-alpha.0 + '@astrojs/react@3.6.3': + resolution: {integrity: sha512-5ihLQDH5Runddug5AZYlnp/Q5T81QxhwnWJXA9rchBAdh11c6UhBbv9Kdk7b2PkXoEU70CGWBP9hSh0VCR58eA==} + engines: {node: ^18.17.1 || ^20.3.0 || >=21.0.0} + peerDependencies: + '@types/react': ^17.0.50 || ^18.0.21 + '@types/react-dom': ^17.0.17 || ^18.0.6 + react: ^17.0.2 || ^18.0.0 || ^19.0.0-beta + react-dom: ^17.0.2 || ^18.0.0 || ^19.0.0-beta + '@astrojs/yaml2ts@0.2.1': resolution: {integrity: sha512-CBaNwDQJz20E5WxzQh4thLVfhB3JEEGz72wRA+oJp6fQR37QLAqXZJU0mHC+yqMOQ6oj0GfRPJrz6hjf+zm6zA==} @@ -8469,6 +8484,9 @@ packages: resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} engines: {node: '>= 8'} + fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + fsevents@2.3.2: resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -8516,6 +8534,11 @@ packages: resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} hasBin: true + glob@8.1.0: + resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} + engines: {node: '>=12'} + deprecated: Glob versions prior to v9 are no longer supported + globals@11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} @@ -8683,6 +8706,10 @@ packages: ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + ignore-walk@5.0.1: + resolution: {integrity: sha512-yemi4pMf51WKT7khInJqAvsIGzoqYXblnsz0ql8tM+yi1EKYTY1evX4NAbJrLL/Aanr2HyZeluqU+Oi7MGHokw==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + ignore@5.3.2: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} @@ -8701,6 +8728,10 @@ packages: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} + inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. + inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} @@ -9271,6 +9302,10 @@ packages: minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + minimatch@5.1.6: + resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} + engines: {node: '>=10'} + minimatch@9.0.5: resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} engines: {node: '>=16 || 14 >=14.17'} @@ -9416,6 +9451,19 @@ packages: resolution: {integrity: sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==} engines: {node: '>=0.10.0'} + npm-bundled@2.0.1: + resolution: {integrity: sha512-gZLxXdjEzE/+mOstGDqR6b0EkhJ+kM6fxM6vUuckuctuVPh80Q6pw/rSZj9s4Gex9GxWtIicO1pc8DB9KZWudw==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + + npm-normalize-package-bin@2.0.0: + resolution: {integrity: sha512-awzfKUO7v0FscrSpRoogyNm0sajikhBWpU0QMrW09AMi9n1PoKU6WaIqUzuJSQnpciZZmJ/jMZ2Egfmb/9LiWQ==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + + npm-packlist@5.1.3: + resolution: {integrity: sha512-263/0NGrn32YFYi4J533qzrQ/krmmrWwhKkzwTuM4f/07ug51odoaNjUexxO4vxlzURHcmYMH1QjvHjsNDKLVg==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + hasBin: true + npm-run-path@5.3.0: resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -9445,6 +9493,9 @@ packages: resolution: {integrity: sha512-y1HRYy8s/RlcBvDUwKXSmkODMdx4KSuIvloCnQYJ2LdBBC1asY4HtfhXwe3UWknLakATZDnbzht2Ijw3M1EqFg==} engines: {node: '>=9.4.0 || ^8.9.4'} + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + onetime@5.1.2: resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} engines: {node: '>=6'} @@ -9614,6 +9665,9 @@ packages: picocolors@1.1.0: resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} @@ -9922,6 +9976,11 @@ packages: psl@1.9.0: resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} + publint@0.2.12: + resolution: {integrity: sha512-YNeUtCVeM4j9nDiTT2OPczmlyzOkIXNtdDZnSuajAxS/nZ6j3t7Vs9SUB4euQNddiltIwu7Tdd3s+hr08fAsMw==} + engines: {node: '>=16'} + hasBin: true + punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} @@ -10151,6 +10210,10 @@ packages: s.color@0.0.15: resolution: {integrity: sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==} + sade@1.8.1: + resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==} + engines: {node: '>=6'} + safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} @@ -10857,6 +10920,37 @@ packages: peerDependencies: vue: '>=3.2.13' + vite@5.4.11: + resolution: {integrity: sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@types/node': ^18.0.0 || >=20.0.0 + less: '*' + lightningcss: ^1.21.0 + sass: '*' + sass-embedded: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + vite@6.0.0-beta.6: resolution: {integrity: sha512-XbMzqwx2CDrOOKDDRvenHMQx+JwUTSm/1a/GgjTL6oC5XwpAk+PgoxmB6vGh2UQi0t9EIVS5d2GZXMWd4P5ahA==} engines: {node: ^18.0.0 || >=20.0.0} @@ -11142,6 +11236,9 @@ packages: resolution: {integrity: sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==} engines: {node: '>=18'} + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + ws@8.16.0: resolution: {integrity: sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==} engines: {node: '>=10.0.0'} @@ -11365,6 +11462,26 @@ snapshots: transitivePeerDependencies: - supports-color + '@astrojs/react@3.6.3(@types/node@18.19.50)(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.80.6)': + dependencies: + '@types/react': 18.3.12 + '@types/react-dom': 18.3.1 + '@vitejs/plugin-react': 4.3.3(vite@5.4.11(@types/node@18.19.50)(sass@1.80.6)) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + ultrahtml: 1.5.3 + vite: 5.4.11(@types/node@18.19.50)(sass@1.80.6) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + '@astrojs/yaml2ts@0.2.1': dependencies: yaml: 2.5.1 @@ -12594,12 +12711,12 @@ snapshots: '@polka/url@1.0.0-next.25': {} - '@preact/preset-vite@2.8.2(@babel/core@7.26.0)(preact@10.24.3)(vite@6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1))': + '@preact/preset-vite@2.8.2(@babel/core@7.26.0)(preact@10.24.3)(vite@5.4.11(@types/node@18.19.50)(sass@1.80.6))': dependencies: '@babel/core': 7.26.0 '@babel/plugin-transform-react-jsx': 7.25.9(@babel/core@7.26.0) '@babel/plugin-transform-react-jsx-development': 7.25.9(@babel/core@7.26.0) - '@prefresh/vite': 2.4.5(preact@10.24.3)(vite@6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1)) + '@prefresh/vite': 2.4.5(preact@10.24.3)(vite@5.4.11(@types/node@18.19.50)(sass@1.80.6)) '@rollup/pluginutils': 4.2.1 babel-plugin-transform-hook-names: 1.0.2(@babel/core@7.26.0) debug: 4.3.7 @@ -12609,7 +12726,7 @@ snapshots: resolve: 1.22.8 source-map: 0.7.4 stack-trace: 1.0.0-pre2 - vite: 6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1) + vite: 5.4.11(@types/node@18.19.50)(sass@1.80.6) transitivePeerDependencies: - preact - supports-color @@ -12629,7 +12746,7 @@ snapshots: '@prefresh/utils@1.2.0': {} - '@prefresh/vite@2.4.5(preact@10.24.3)(vite@6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1))': + '@prefresh/vite@2.4.5(preact@10.24.3)(vite@5.4.11(@types/node@18.19.50)(sass@1.80.6))': dependencies: '@babel/core': 7.26.0 '@prefresh/babel-plugin': 0.5.1 @@ -12637,7 +12754,7 @@ snapshots: '@prefresh/utils': 1.2.0 '@rollup/pluginutils': 4.2.1 preact: 10.24.3 - vite: 6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1) + vite: 5.4.11(@types/node@18.19.50)(sass@1.80.6) transitivePeerDependencies: - supports-color @@ -13026,6 +13143,17 @@ snapshots: '@ungap/structured-clone@1.2.0': {} + '@vitejs/plugin-react@4.3.3(vite@5.4.11(@types/node@18.19.50)(sass@1.80.6))': + dependencies: + '@babel/core': 7.26.0 + '@babel/plugin-transform-react-jsx-self': 7.24.7(@babel/core@7.26.0) + '@babel/plugin-transform-react-jsx-source': 7.24.7(@babel/core@7.26.0) + '@types/babel__core': 7.20.5 + react-refresh: 0.14.2 + vite: 5.4.11(@types/node@18.19.50)(sass@1.80.6) + transitivePeerDependencies: + - supports-color + '@vitejs/plugin-react@4.3.3(vite@6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1))': dependencies: '@babel/core': 7.26.0 @@ -14259,6 +14387,8 @@ snapshots: dependencies: minipass: 3.3.6 + fs.realpath@1.0.0: {} + fsevents@2.3.2: optional: true @@ -14296,6 +14426,14 @@ snapshots: package-json-from-dist: 1.0.0 path-scurry: 1.11.1 + glob@8.1.0: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 5.1.6 + once: 1.4.0 + globals@11.12.0: {} globals@14.0.0: {} @@ -14593,6 +14731,10 @@ snapshots: ieee754@1.2.1: {} + ignore-walk@5.0.1: + dependencies: + minimatch: 5.1.6 + ignore@5.3.2: {} immutable@4.3.7: {} @@ -14606,6 +14748,11 @@ snapshots: imurmurhash@0.1.4: {} + inflight@1.0.6: + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + inherits@2.0.4: {} inline-style-parser@0.1.1: {} @@ -15468,6 +15615,10 @@ snapshots: dependencies: brace-expansion: 1.1.11 + minimatch@5.1.6: + dependencies: + brace-expansion: 2.0.1 + minimatch@9.0.5: dependencies: brace-expansion: 2.0.1 @@ -15583,6 +15734,19 @@ snapshots: normalize-range@0.1.2: {} + npm-bundled@2.0.1: + dependencies: + npm-normalize-package-bin: 2.0.0 + + npm-normalize-package-bin@2.0.0: {} + + npm-packlist@5.1.3: + dependencies: + glob: 8.1.0 + ignore-walk: 5.0.1 + npm-bundled: 2.0.1 + npm-normalize-package-bin: 2.0.0 + npm-run-path@5.3.0: dependencies: path-key: 4.0.0 @@ -15609,6 +15773,10 @@ snapshots: on-net-listen@1.1.2: {} + once@1.4.0: + dependencies: + wrappy: 1.0.2 + onetime@5.1.2: dependencies: mimic-fn: 2.1.0 @@ -15773,6 +15941,8 @@ snapshots: picocolors@1.1.0: {} + picocolors@1.1.1: {} + picomatch@2.3.1: {} picomatch@4.0.2: {} @@ -16105,6 +16275,12 @@ snapshots: psl@1.9.0: {} + publint@0.2.12: + dependencies: + npm-packlist: 5.1.3 + picocolors: 1.1.1 + sade: 1.8.1 + punycode@2.3.1: {} querystringify@2.2.0: {} @@ -16451,6 +16627,10 @@ snapshots: s.color@0.0.15: {} + sade@1.8.1: + dependencies: + mri: 1.2.0 + safe-buffer@5.2.1: {} safer-buffer@2.1.2: {} @@ -17255,6 +17435,16 @@ snapshots: svgo: 3.3.2 vue: 3.5.12(typescript@5.6.3) + vite@5.4.11(@types/node@18.19.50)(sass@1.80.6): + dependencies: + esbuild: 0.21.5 + postcss: 8.4.47 + rollup: 4.24.4 + optionalDependencies: + '@types/node': 18.19.50 + fsevents: 2.3.3 + sass: 1.80.6 + vite@6.0.0-beta.6(@types/node@18.19.50)(jiti@2.4.0)(sass@1.80.6)(yaml@2.5.1): dependencies: esbuild: 0.24.0 @@ -17515,6 +17705,8 @@ snapshots: string-width: 7.2.0 strip-ansi: 7.1.0 + wrappy@1.0.2: {} + ws@8.16.0: {} xml-name-validator@5.0.0: {} diff --git a/scripts/cmd/build.js b/scripts/cmd/build.js index ac1a7b6e85..5de957c5a8 100644 --- a/scripts/cmd/build.js +++ b/scripts/cmd/build.js @@ -73,7 +73,7 @@ export default async function build(...args) { entryPoints, outdir, outExtension: forceCJS ? { '.js': '.cjs' } : {}, - format + format, }); return; } diff --git a/scripts/deps/update-example-versions.js b/scripts/deps/update-example-versions.js index 077c12b978..93b8b71406 100644 --- a/scripts/deps/update-example-versions.js +++ b/scripts/deps/update-example-versions.js @@ -26,7 +26,7 @@ for (const workspaceDir of workspaceDirs) { const packageJson = await readAndParsePackageJson(packageJsonPath); if (!packageJson) continue; - if (packageJson.private === true) continue + if (packageJson.private === true) continue; if (!packageJson.name) { throw new Error(`${packageJsonPath} does not contain a "name" field.`);