From f515b1421afa335b8d6e4491fbe24419df53bfeb Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 19 Dec 2023 11:14:58 -0500 Subject: [PATCH 01/15] Descriptive image error (#9352) Co-authored-by: Florian Lefebvre Co-authored-by: Sarah Rainsberger Co-authored-by: Princesseuh <3019731+Princesseuh@users.noreply.github.com> --- .changeset/famous-cars-sell.md | 5 +++ packages/astro/package.json | 2 +- packages/astro/src/assets/build/generate.ts | 38 ++++++++++++++----- packages/astro/src/assets/endpoint/generic.ts | 1 + packages/astro/src/assets/endpoint/node.ts | 1 + packages/astro/src/assets/internal.ts | 2 +- packages/astro/src/core/errors/errors-data.ts | 17 +++++++++ pnpm-lock.yaml | 18 ++++----- 8 files changed, 63 insertions(+), 21 deletions(-) create mode 100644 .changeset/famous-cars-sell.md diff --git a/.changeset/famous-cars-sell.md b/.changeset/famous-cars-sell.md new file mode 100644 index 000000000000..983945b058eb --- /dev/null +++ b/.changeset/famous-cars-sell.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Add a more descriptive error message when image conversion fails diff --git a/packages/astro/package.json b/packages/astro/package.json index 10ee99683759..79ce323f23d4 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -153,7 +153,7 @@ "mime": "^3.0.0", "ora": "^7.0.1", "p-limit": "^5.0.0", - "p-queue": "^7.4.1", + "p-queue": "^8.0.1", "path-to-regexp": "^6.2.1", "preferred-pm": "^3.1.2", "probe-image-size": "^7.2.3", diff --git a/packages/astro/src/assets/build/generate.ts b/packages/astro/src/assets/build/generate.ts index 0776dc2d6911..4ee210ec3037 100644 --- a/packages/astro/src/assets/build/generate.ts +++ b/packages/astro/src/assets/build/generate.ts @@ -6,6 +6,8 @@ import type { AstroConfig } from '../../@types/astro.js'; import type { BuildPipeline } from '../../core/build/buildPipeline.js'; import { getOutDirWithinCwd } from '../../core/build/common.js'; import { getTimeStat } from '../../core/build/util.js'; +import { AstroError } from '../../core/errors/errors.js'; +import { AstroErrorData } from '../../core/errors/index.js'; import type { Logger } from '../../core/logger/core.js'; import { isRemotePath, prependForwardSlash } from '../../core/path.js'; import { isServerLikeOutput } from '../../prerender/utils.js'; @@ -103,9 +105,11 @@ export async function generateImagesForPath( const originalImageData = await loadImage(originalFilePath, env); for (const [_, transform] of transformsAndPath.transforms) { - queue.add(async () => - generateImage(originalImageData, transform.finalPath, transform.transform) - ); + await queue + .add(async () => generateImage(originalImageData, transform.finalPath, transform.transform)) + .catch((e) => { + throw e; + }); } // In SSR, we cannot know if an image is referenced in a server-rendered page, so we can't delete anything @@ -207,13 +211,27 @@ export async function generateImagesForPath( }; const imageService = (await getConfiguredImageService()) as LocalImageService; - resultData.data = ( - await imageService.transform( - originalImage.data, - { ...options, src: originalImagePath }, - env.imageConfig - ) - ).data; + + try { + resultData.data = ( + await imageService.transform( + originalImage.data, + { ...options, src: originalImagePath }, + env.imageConfig + ) + ).data; + } catch (e) { + const error = new AstroError( + { + ...AstroErrorData.CouldNotTransformImage, + message: AstroErrorData.CouldNotTransformImage.message(originalFilePath), + }, + undefined, + { cause: e } + ); + + throw error; + } try { // Write the cache entry diff --git a/packages/astro/src/assets/endpoint/generic.ts b/packages/astro/src/assets/endpoint/generic.ts index 5243a7e7c2e7..60845dfd9d7e 100644 --- a/packages/astro/src/assets/endpoint/generic.ts +++ b/packages/astro/src/assets/endpoint/generic.ts @@ -71,6 +71,7 @@ export const GET: APIRoute = async ({ request }) => { }, }); } catch (err: unknown) { + console.error('Could not process image request:', err); return new Response(`Server Error: ${err}`, { status: 500 }); } }; diff --git a/packages/astro/src/assets/endpoint/node.ts b/packages/astro/src/assets/endpoint/node.ts index 604d75d255c5..8c85e78be474 100644 --- a/packages/astro/src/assets/endpoint/node.ts +++ b/packages/astro/src/assets/endpoint/node.ts @@ -89,6 +89,7 @@ export const GET: APIRoute = async ({ request }) => { }, }); } catch (err: unknown) { + console.error('Could not process image request:', err); return new Response(`Server Error: ${err}`, { status: 500 }); } }; diff --git a/packages/astro/src/assets/internal.ts b/packages/astro/src/assets/internal.ts index 2098e0d754a7..f6b8e40dc26e 100644 --- a/packages/astro/src/assets/internal.ts +++ b/packages/astro/src/assets/internal.ts @@ -17,7 +17,7 @@ export async function getConfiguredImageService(): Promise { 'virtual:image-service' ).catch((e) => { const error = new AstroError(AstroErrorData.InvalidImageService); - (error as any).cause = e; + error.cause = e; throw error; }); diff --git a/packages/astro/src/core/errors/errors-data.ts b/packages/astro/src/core/errors/errors-data.ts index 1e00e47ace6d..57176e5a3d0a 100644 --- a/packages/astro/src/core/errors/errors-data.ts +++ b/packages/astro/src/core/errors/errors-data.ts @@ -706,6 +706,23 @@ export const MarkdownImageNotFound = { hint: 'This is often caused by a typo in the image path. Please make sure the file exists, and is spelled correctly.', } satisfies ErrorData; +/** + * @docs + * @see + * - [Images](https://docs.astro.build/en/guides/images/) + * @description + * Astro could not transform one of your images. Often, this is caused by a corrupted or malformed image. Re-exporting the image from your image editor may fix this issue. + * + * Depending on the image service you are using, the stack trace may contain more information on the specific error encountered. + */ +export const CouldNotTransformImage = { + name: 'CouldNotTransformImage', + title: 'Could not transform image.', + message: (imagePath: string) => + `Could not transform image \`${imagePath}\`. See the stack trace for more information.`, + hint: 'This is often caused by a corrupted or malformed image. Re-exporting the image from your image editor may fix this issue.', +} satisfies ErrorData; + /** * @docs * @description diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7ac3873c8215..e70e353ad1aa 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -596,8 +596,8 @@ importers: specifier: ^5.0.0 version: 5.0.0 p-queue: - specifier: ^7.4.1 - version: 7.4.1 + specifier: ^8.0.1 + version: 8.0.1 path-to-regexp: specifier: ^6.2.1 version: 6.2.1 @@ -12964,17 +12964,17 @@ packages: aggregate-error: 4.0.1 dev: true - /p-queue@7.4.1: - resolution: {integrity: sha512-vRpMXmIkYF2/1hLBKisKeVYJZ8S2tZ0zEAmIJgdVKP2nq0nh4qCdf8bgw+ZgKrkh71AOCaqzwbJJk1WtdcF3VA==} - engines: {node: '>=12'} + /p-queue@8.0.1: + resolution: {integrity: sha512-NXzu9aQJTAzbBqOt2hwsR63ea7yvxJc0PwN/zobNAudYfb1B7R08SzB4TsLeSbUCuG467NhnoT0oO6w1qRO+BA==} + engines: {node: '>=18'} dependencies: eventemitter3: 5.0.1 - p-timeout: 5.1.0 + p-timeout: 6.1.2 dev: false - /p-timeout@5.1.0: - resolution: {integrity: sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==} - engines: {node: '>=12'} + /p-timeout@6.1.2: + resolution: {integrity: sha512-UbD77BuZ9Bc9aABo74gfXhNvzC9Tx7SxtHSh1fxvx3jTLLYvmVhiQZZrJzqqU0jKbN32kb5VOKiLEQI/3bIjgQ==} + engines: {node: '>=14.16'} dev: false /p-try@2.2.0: From faf6c7e1104ee247e847836020a3ce07a2053705 Mon Sep 17 00:00:00 2001 From: Luiz Ferraz Date: Tue, 19 Dec 2023 16:59:13 -0300 Subject: [PATCH 02/15] Fix transitions with non-recommended headers (#9464) * Reproduce edge case in test * Fix edge case * Add changeset * Update .changeset/khaki-ducks-give.md Co-authored-by: Nate Moore --------- Co-authored-by: Nate Moore --- .changeset/khaki-ducks-give.md | 5 +++++ .../view-transitions/src/pages/one.astro | 1 + .../view-transitions/src/pages/seven.astro | 10 ++++++++++ packages/astro/e2e/view-transitions.test.js | 19 +++++++++++++++++++ packages/astro/src/transitions/router.ts | 3 ++- 5 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 .changeset/khaki-ducks-give.md create mode 100644 packages/astro/e2e/fixtures/view-transitions/src/pages/seven.astro diff --git a/.changeset/khaki-ducks-give.md b/.changeset/khaki-ducks-give.md new file mode 100644 index 000000000000..3f759891b824 --- /dev/null +++ b/.changeset/khaki-ducks-give.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes an edge case with view transitions where some spec-compliant `Content-Type` headers would cause a valid HTML response to be ignored. diff --git a/packages/astro/e2e/fixtures/view-transitions/src/pages/one.astro b/packages/astro/e2e/fixtures/view-transitions/src/pages/one.astro index d05973036e14..b78565c86db9 100644 --- a/packages/astro/e2e/fixtures/view-transitions/src/pages/one.astro +++ b/packages/astro/e2e/fixtures/view-transitions/src/pages/one.astro @@ -6,6 +6,7 @@ import Layout from '../components/Layout.astro'; test go to 2 go to 3 + go to 7 go to long page go to top go to redirect 2 diff --git a/packages/astro/e2e/fixtures/view-transitions/src/pages/seven.astro b/packages/astro/e2e/fixtures/view-transitions/src/pages/seven.astro new file mode 100644 index 000000000000..625c4a8df661 --- /dev/null +++ b/packages/astro/e2e/fixtures/view-transitions/src/pages/seven.astro @@ -0,0 +1,10 @@ +--- +import Layout from '../components/Layout.astro'; + +Astro.response.headers.set('Content-Type', 'text/html ; charset=utf-8'); +--- + +

Page 7

+ +
test content
+
diff --git a/packages/astro/e2e/view-transitions.test.js b/packages/astro/e2e/view-transitions.test.js index 222c9dfdf2aa..a3c88b8b039b 100644 --- a/packages/astro/e2e/view-transitions.test.js +++ b/packages/astro/e2e/view-transitions.test.js @@ -97,6 +97,25 @@ test.describe('View Transitions', () => { expect(loads.length, 'There should only be 1 page load').toEqual(1); }); + test('Clicking on a link to a page with non-recommended headers', async ({page, astro}) => { + const loads = []; + page.addListener('load', (p) => { + loads.push(p.title()); + }); + + // Go to page 4 + await page.goto(astro.resolveUrl('/one')); + let p = page.locator('#one'); + await expect(p, 'should have content').toHaveText('Page 1'); + + // Go to page 1 + await page.click('#click-seven'); + p = page.locator('#seven'); + await expect(p, 'should have content').toHaveText('Page 7'); + + expect(loads.length, 'There should only be 1 page load').toEqual(1); + }); + test('Moving to a page without ViewTransitions triggers a full page navigation', async ({ page, astro, diff --git a/packages/astro/src/transitions/router.ts b/packages/astro/src/transitions/router.ts index e710c2e1b2e8..6588fd71f960 100644 --- a/packages/astro/src/transitions/router.ts +++ b/packages/astro/src/transitions/router.ts @@ -119,8 +119,9 @@ async function fetchHTML( ): Promise { try { const res = await fetch(href, init); + const contentType = res.headers.get('content-type') ?? ''; // drop potential charset (+ other name/value pairs) as parser needs the mediaType - const mediaType = res.headers.get('content-type')?.replace(/;.*$/, ''); + const mediaType = contentType.split(';', 1)[0].trim(); // the DOMParser can handle two types of HTML if (mediaType !== 'text/html' && mediaType !== 'application/xhtml+xml') { // everything else (e.g. audio/mp3) will be handled by the browser but not by us From 69e78822e523988349b1f75437d12b942898730d Mon Sep 17 00:00:00 2001 From: Luiz Ferraz Date: Tue, 19 Dec 2023 20:00:19 +0000 Subject: [PATCH 03/15] [ci] format --- packages/astro/e2e/view-transitions.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/astro/e2e/view-transitions.test.js b/packages/astro/e2e/view-transitions.test.js index a3c88b8b039b..b755fd0d37f1 100644 --- a/packages/astro/e2e/view-transitions.test.js +++ b/packages/astro/e2e/view-transitions.test.js @@ -97,7 +97,7 @@ test.describe('View Transitions', () => { expect(loads.length, 'There should only be 1 page load').toEqual(1); }); - test('Clicking on a link to a page with non-recommended headers', async ({page, astro}) => { + test('Clicking on a link to a page with non-recommended headers', async ({ page, astro }) => { const loads = []; page.addListener('load', (p) => { loads.push(p.title()); From 7ae4928f303720d3b2f611474fc08d3b96c2e4af Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Tue, 19 Dec 2023 21:56:46 +0000 Subject: [PATCH 04/15] fix: remove the manifest file from the `dist/` folder (#9475) --- .changeset/wise-wasps-sell.md | 5 +++++ packages/astro/src/core/build/static-build.ts | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 .changeset/wise-wasps-sell.md diff --git a/.changeset/wise-wasps-sell.md b/.changeset/wise-wasps-sell.md new file mode 100644 index 000000000000..b2d031087df0 --- /dev/null +++ b/.changeset/wise-wasps-sell.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Remove the manifest from the generated files in the `dist/` folder. diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index cd642aca0ed1..86b7740c4b64 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -115,7 +115,7 @@ export async function viteBuild(opts: StaticBuildOptions) { teardown(); } - // For static builds, the SSR output output won't be needed anymore after page generation. + // For static builds, the SSR output won't be needed anymore after page generation. // We keep track of the names here so we only remove these specific files when finished. const ssrOutputChunkNames: string[] = []; for (const output of ssrOutputs) { @@ -139,7 +139,7 @@ export async function staticBuild( case settings.config.output === 'static': { settings.timer.start('Static generate'); await generatePages(opts, internals); - await cleanServerOutput(opts, ssrOutputChunkNames); + await cleanServerOutput(opts, ssrOutputChunkNames, internals); settings.timer.end('Static generate'); return; } @@ -413,10 +413,17 @@ async function cleanStaticOutput( } } -async function cleanServerOutput(opts: StaticBuildOptions, ssrOutputChunkNames: string[]) { +async function cleanServerOutput( + opts: StaticBuildOptions, + ssrOutputChunkNames: string[], + internals: BuildInternals +) { const out = getOutDirWithinCwd(opts.settings.config.outDir); // The SSR output chunks for Astro are all .mjs files const files = ssrOutputChunkNames.filter((f) => f.endsWith('.mjs')); + if (internals.manifestFileName) { + files.push(internals.manifestFileName); + } if (files.length) { // Remove all the SSR generated .mjs files await Promise.all( From e83b5095f164f48ba40fc715a805fc66a3e39dcf Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Wed, 20 Dec 2023 12:54:25 +0100 Subject: [PATCH 05/15] chore: upgrade vite to latest (close #9443) (#9452) * chore: upgrade vite to latest * chore: add changeset * fix: enforce type * fix: postcss * chore: log messages * fix: take vite re-optimizing message into account --------- Co-authored-by: Emanuele Stoppa --- .changeset/eleven-hairs-peel.md | 11 +++ packages/astro/package.json | 2 +- packages/astro/test/cli.test.js | 8 +- packages/integrations/markdoc/package.json | 2 +- packages/integrations/mdx/package.json | 2 +- packages/integrations/react/package.json | 2 +- packages/integrations/svelte/package.json | 2 +- packages/integrations/tailwind/package.json | 2 +- packages/integrations/tailwind/src/index.ts | 4 +- packages/integrations/vue/package.json | 2 +- pnpm-lock.yaml | 91 ++++++++++++--------- 11 files changed, 77 insertions(+), 51 deletions(-) create mode 100644 .changeset/eleven-hairs-peel.md diff --git a/.changeset/eleven-hairs-peel.md b/.changeset/eleven-hairs-peel.md new file mode 100644 index 000000000000..a9de7ecc43aa --- /dev/null +++ b/.changeset/eleven-hairs-peel.md @@ -0,0 +1,11 @@ +--- +'@astrojs/tailwind': patch +'@astrojs/markdoc': patch +'@astrojs/svelte': patch +'@astrojs/react': patch +'@astrojs/mdx': patch +'@astrojs/vue': patch +'astro': patch +--- + +Upgrades vite to latest diff --git a/packages/astro/package.json b/packages/astro/package.json index 79ce323f23d4..c305bcc16df7 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -168,7 +168,7 @@ "tsconfck": "^3.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.1", - "vite": "^5.0.0", + "vite": "^5.0.10", "vitefu": "^0.2.5", "which-pm": "^2.1.1", "yargs-parser": "^21.1.1", diff --git a/packages/astro/test/cli.test.js b/packages/astro/test/cli.test.js index caec4241dace..30461823c677 100644 --- a/packages/astro/test/cli.test.js +++ b/packages/astro/test/cli.test.js @@ -104,9 +104,11 @@ describe('astro cli', () => { const proc = cli('dev', '--root', fileURLToPath(projectRootURL)); const { messages } = await parseCliDevStart(proc); - expect(messages[0]).to.contain('astro'); - expect(messages[0]).to.contain(pkgVersion); - expect(messages[0]).to.contain('ready in'); + const index = messages[0].includes("[vite]") ? 1 : 0 + + expect(messages[index]).to.contain('astro'); + expect(messages[index]).to.contain(pkgVersion); + expect(messages[index]).to.contain('ready in'); }); ['dev', 'preview'].forEach((cmd) => { diff --git a/packages/integrations/markdoc/package.json b/packages/integrations/markdoc/package.json index f75a56466cca..7bec279db6fe 100644 --- a/packages/integrations/markdoc/package.json +++ b/packages/integrations/markdoc/package.json @@ -89,7 +89,7 @@ "devalue": "^4.3.2", "linkedom": "^0.16.4", "mocha": "^10.2.0", - "vite": "^5.0.0" + "vite": "^5.0.10" }, "engines": { "node": ">=18.14.1" diff --git a/packages/integrations/mdx/package.json b/packages/integrations/mdx/package.json index 00ddefe47a3b..51fe0751d21b 100644 --- a/packages/integrations/mdx/package.json +++ b/packages/integrations/mdx/package.json @@ -75,7 +75,7 @@ "remark-shiki-twoslash": "^3.1.3", "remark-toc": "^9.0.0", "unified": "^11.0.4", - "vite": "^5.0.0" + "vite": "^5.0.10" }, "engines": { "node": ">=18.14.1" diff --git a/packages/integrations/react/package.json b/packages/integrations/react/package.json index 4ab958bcc453..c94f9b7235bb 100644 --- a/packages/integrations/react/package.json +++ b/packages/integrations/react/package.json @@ -58,7 +58,7 @@ "cheerio": "1.0.0-rc.12", "react": "^18.1.0", "react-dom": "^18.1.0", - "vite": "^5.0.0", + "vite": "^5.0.10", "mocha": "^10.2.0" }, "peerDependencies": { diff --git a/packages/integrations/svelte/package.json b/packages/integrations/svelte/package.json index 11dd8f0f00cb..9c4fe3a757b7 100644 --- a/packages/integrations/svelte/package.json +++ b/packages/integrations/svelte/package.json @@ -49,7 +49,7 @@ "astro": "workspace:*", "astro-scripts": "workspace:*", "svelte": "^4.2.5", - "vite": "^5.0.0" + "vite": "^5.0.10" }, "peerDependencies": { "astro": "^4.0.0", diff --git a/packages/integrations/tailwind/package.json b/packages/integrations/tailwind/package.json index dd3fcd79af49..91ac5c60b1c1 100644 --- a/packages/integrations/tailwind/package.json +++ b/packages/integrations/tailwind/package.json @@ -40,7 +40,7 @@ "astro": "workspace:*", "astro-scripts": "workspace:*", "tailwindcss": "^3.3.5", - "vite": "^5.0.0" + "vite": "^5.0.10" }, "peerDependencies": { "astro": "^3.0.0 || ^4.0.0", diff --git a/packages/integrations/tailwind/src/index.ts b/packages/integrations/tailwind/src/index.ts index 1333665b6980..5f30ae4b67d6 100644 --- a/packages/integrations/tailwind/src/index.ts +++ b/packages/integrations/tailwind/src/index.ts @@ -24,7 +24,7 @@ async function getPostCssConfig( async function getViteConfiguration( tailwindConfigPath: string | undefined, viteConfig: UserConfig -) { +): Promise> { // We need to manually load postcss config files because when inlining the tailwind and autoprefixer plugins, // that causes vite to ignore postcss config files const postcssConfigResult = await getPostCssConfig(viteConfig.root, viteConfig.css?.postcss); @@ -38,7 +38,7 @@ async function getViteConfiguration( return { css: { postcss: { - options: postcssOptions, + ...postcssOptions, plugins: postcssPlugins, }, }, diff --git a/packages/integrations/vue/package.json b/packages/integrations/vue/package.json index e6edfba0a0dc..5e0c56231a31 100644 --- a/packages/integrations/vue/package.json +++ b/packages/integrations/vue/package.json @@ -53,7 +53,7 @@ "cheerio": "1.0.0-rc.12", "linkedom": "^0.16.4", "mocha": "^10.2.0", - "vite": "^5.0.0", + "vite": "^5.0.10", "vue": "^3.3.8" }, "peerDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e70e353ad1aa..472861ead4ac 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -641,11 +641,11 @@ importers: specifier: ^6.0.1 version: 6.0.1 vite: - specifier: ^5.0.0 - version: 5.0.0(@types/node@18.18.6)(sass@1.69.5) + specifier: ^5.0.10 + version: 5.0.10(@types/node@18.18.6)(sass@1.69.5) vitefu: specifier: ^0.2.5 - version: 0.2.5(vite@5.0.0) + version: 0.2.5(vite@5.0.10) which-pm: specifier: ^2.1.1 version: 2.1.1 @@ -3833,8 +3833,8 @@ importers: specifier: ^10.2.0 version: 10.2.0 vite: - specifier: ^5.0.0 - version: 5.0.0(@types/node@18.18.6)(sass@1.69.5) + specifier: ^5.0.10 + version: 5.0.10(@types/node@18.18.6)(sass@1.69.5) packages/integrations/markdoc/test/fixtures/content-collections: dependencies: @@ -4065,8 +4065,8 @@ importers: specifier: ^11.0.4 version: 11.0.4 vite: - specifier: ^5.0.0 - version: 5.0.0(@types/node@18.18.6)(sass@1.69.5) + specifier: ^5.0.10 + version: 5.0.10(@types/node@18.18.6)(sass@1.69.5) packages/integrations/mdx/test/fixtures/css-head-mdx: dependencies: @@ -4398,7 +4398,7 @@ importers: dependencies: '@vitejs/plugin-react': specifier: ^4.2.0 - version: 4.2.0(vite@5.0.0) + version: 4.2.0(vite@5.0.10) ultrahtml: specifier: ^1.3.0 version: 1.5.2 @@ -4431,8 +4431,8 @@ importers: specifier: ^18.1.0 version: 18.2.0(react@18.2.0) vite: - specifier: ^5.0.0 - version: 5.0.0(@types/node@18.18.6)(sass@1.69.5) + specifier: ^5.0.10 + version: 5.0.10(@types/node@18.18.6)(sass@1.69.5) packages/integrations/react/test/fixtures/react-component: dependencies: @@ -4530,7 +4530,7 @@ importers: dependencies: '@sveltejs/vite-plugin-svelte': specifier: ^3.0.0 - version: 3.0.0(svelte@4.2.5)(vite@5.0.0) + version: 3.0.0(svelte@4.2.5)(vite@5.0.10) svelte2tsx: specifier: ^0.6.25 version: 0.6.25(svelte@4.2.5)(typescript@5.2.2) @@ -4545,8 +4545,8 @@ importers: specifier: ^4.2.5 version: 4.2.5 vite: - specifier: ^5.0.0 - version: 5.0.0(@types/node@18.18.6)(sass@1.69.5) + specifier: ^5.0.10 + version: 5.0.10(@types/node@18.18.6)(sass@1.69.5) packages/integrations/tailwind: dependencies: @@ -4570,8 +4570,8 @@ importers: specifier: ^3.3.5 version: 3.3.5 vite: - specifier: ^5.0.0 - version: 5.0.0(@types/node@18.18.6)(sass@1.69.5) + specifier: ^5.0.10 + version: 5.0.10(@types/node@18.18.6)(sass@1.69.5) packages/integrations/vercel: dependencies: @@ -4779,10 +4779,10 @@ importers: dependencies: '@vitejs/plugin-vue': specifier: ^4.5.0 - version: 4.5.0(vite@5.0.0)(vue@3.3.8) + version: 4.5.0(vite@5.0.10)(vue@3.3.8) '@vitejs/plugin-vue-jsx': specifier: ^3.1.0 - version: 3.1.0(vite@5.0.0)(vue@3.3.8) + version: 3.1.0(vite@5.0.10)(vue@3.3.8) '@vue/babel-plugin-jsx': specifier: ^1.1.5 version: 1.1.5(@babel/core@7.23.3) @@ -4812,8 +4812,8 @@ importers: specifier: ^10.2.0 version: 10.2.0 vite: - specifier: ^5.0.0 - version: 5.0.0(@types/node@18.18.6)(sass@1.69.5) + specifier: ^5.0.10 + version: 5.0.10(@types/node@18.18.6)(sass@1.69.5) vue: specifier: ^3.3.8 version: 3.3.8(typescript@5.2.2) @@ -7197,7 +7197,7 @@ packages: solid-js: 1.8.5 dev: false - /@sveltejs/vite-plugin-svelte-inspector@2.0.0(@sveltejs/vite-plugin-svelte@3.0.0)(svelte@4.2.5)(vite@5.0.0): + /@sveltejs/vite-plugin-svelte-inspector@2.0.0(@sveltejs/vite-plugin-svelte@3.0.0)(svelte@4.2.5)(vite@5.0.10): resolution: {integrity: sha512-gjr9ZFg1BSlIpfZ4PRewigrvYmHWbDrq2uvvPB1AmTWKuM+dI1JXQSUu2pIrYLb/QncyiIGkFDFKTwJ0XqQZZg==} engines: {node: ^18.0.0 || >=20} peerDependencies: @@ -7208,15 +7208,15 @@ packages: vite: optional: true dependencies: - '@sveltejs/vite-plugin-svelte': 3.0.0(svelte@4.2.5)(vite@5.0.0) + '@sveltejs/vite-plugin-svelte': 3.0.0(svelte@4.2.5)(vite@5.0.10) debug: 4.3.4(supports-color@8.1.1) svelte: 4.2.5 - vite: 5.0.0(@types/node@18.18.6)(sass@1.69.5) + vite: 5.0.10(@types/node@18.18.6)(sass@1.69.5) transitivePeerDependencies: - supports-color dev: false - /@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.5)(vite@5.0.0): + /@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.5)(vite@5.0.10): resolution: {integrity: sha512-Th0nupxk8hl5Rcg9jm+1xWylwco4bSUAvutWxM4W4bjOAollpXLmrYqSSnYo9pPbZOO6ZGRm6sSqYa/v1d/Saw==} engines: {node: ^18.0.0 || >=20} peerDependencies: @@ -7226,15 +7226,15 @@ packages: vite: optional: true dependencies: - '@sveltejs/vite-plugin-svelte-inspector': 2.0.0(@sveltejs/vite-plugin-svelte@3.0.0)(svelte@4.2.5)(vite@5.0.0) + '@sveltejs/vite-plugin-svelte-inspector': 2.0.0(@sveltejs/vite-plugin-svelte@3.0.0)(svelte@4.2.5)(vite@5.0.10) debug: 4.3.4(supports-color@8.1.1) deepmerge: 4.3.1 kleur: 4.1.5 magic-string: 0.30.5 svelte: 4.2.5 svelte-hmr: 0.15.3(svelte@4.2.5) - vite: 5.0.0(@types/node@18.18.6)(sass@1.69.5) - vitefu: 0.2.5(vite@5.0.0) + vite: 5.0.10(@types/node@18.18.6)(sass@1.69.5) + vitefu: 0.2.5(vite@5.0.10) transitivePeerDependencies: - supports-color dev: false @@ -7789,7 +7789,7 @@ packages: - supports-color dev: false - /@vitejs/plugin-react@4.2.0(vite@5.0.0): + /@vitejs/plugin-react@4.2.0(vite@5.0.10): resolution: {integrity: sha512-+MHTH/e6H12kRp5HUkzOGqPMksezRMmW+TNzlh/QXfI8rRf6l2Z2yH/v12no1UvTwhZgEDMuQ7g7rrfMseU6FQ==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -7803,12 +7803,12 @@ packages: '@babel/plugin-transform-react-jsx-source': 7.23.3(@babel/core@7.23.3) '@types/babel__core': 7.20.4 react-refresh: 0.14.0 - vite: 5.0.0(@types/node@18.18.6)(sass@1.69.5) + vite: 5.0.10(@types/node@18.18.6)(sass@1.69.5) transitivePeerDependencies: - supports-color dev: false - /@vitejs/plugin-vue-jsx@3.1.0(vite@5.0.0)(vue@3.3.8): + /@vitejs/plugin-vue-jsx@3.1.0(vite@5.0.10)(vue@3.3.8): resolution: {integrity: sha512-w9M6F3LSEU5kszVb9An2/MmXNxocAnUb3WhRr8bHlimhDrXNt6n6D2nJQR3UXpGlZHh/EsgouOHCsM8V3Ln+WA==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -7821,13 +7821,13 @@ packages: '@babel/core': 7.23.3 '@babel/plugin-transform-typescript': 7.23.3(@babel/core@7.23.3) '@vue/babel-plugin-jsx': 1.1.5(@babel/core@7.23.3) - vite: 5.0.0(@types/node@18.18.6)(sass@1.69.5) + vite: 5.0.10(@types/node@18.18.6)(sass@1.69.5) vue: 3.3.8(typescript@5.2.2) transitivePeerDependencies: - supports-color dev: false - /@vitejs/plugin-vue@4.5.0(vite@5.0.0)(vue@3.3.8): + /@vitejs/plugin-vue@4.5.0(vite@5.0.10)(vue@3.3.8): resolution: {integrity: sha512-a2WSpP8X8HTEww/U00bU4mX1QpLINNuz/2KMNpLsdu3BzOpak3AGI1CJYBTXcc4SPhaD0eNRUp7IyQK405L5dQ==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -7837,7 +7837,7 @@ packages: vite: optional: true dependencies: - vite: 5.0.0(@types/node@18.18.6)(sass@1.69.5) + vite: 5.0.10(@types/node@18.18.6)(sass@1.69.5) vue: 3.3.8(typescript@5.2.2) dev: false @@ -12590,6 +12590,11 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + /nanostores@0.9.5: resolution: {integrity: sha512-Z+p+g8E7yzaWwOe5gEUB2Ox0rCEeXWYIZWmYvw/ajNYX8DlXdMvMDj8DWfM/subqPAcsf8l8Td4iAwO1DeIIRQ==} engines: {node: ^16.0.0 || ^18.0.0 || >=20.0.0} @@ -13592,6 +13597,14 @@ packages: picocolors: 1.0.0 source-map-js: 1.0.2 + /postcss@8.4.32: + resolution: {integrity: sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.3.7 + picocolors: 1.0.0 + source-map-js: 1.0.2 + /preact-render-to-string@6.3.1(preact@10.19.2): resolution: {integrity: sha512-NQ28WrjLtWY6lKDlTxnFpKHZdpjfF+oE6V4tZ0rTrunHrtZp6Dm0oFrcJalt/5PNeqJz4j1DuZDS0Y6rCBoqDA==} peerDependencies: @@ -15809,7 +15822,7 @@ packages: mlly: 1.4.2 pathe: 1.1.1 picocolors: 1.0.0 - vite: 4.5.0(@types/node@18.18.6) + vite: 5.0.10(@types/node@18.18.6)(sass@1.69.5) transitivePeerDependencies: - '@types/node' - less @@ -15837,7 +15850,7 @@ packages: merge-anything: 5.1.7 solid-js: 1.8.5 solid-refresh: 0.5.3(solid-js@1.8.5) - vitefu: 0.2.5(vite@5.0.0) + vitefu: 0.2.5(vite@5.0.10) transitivePeerDependencies: - supports-color dev: false @@ -15901,8 +15914,8 @@ packages: fsevents: 2.3.3 dev: false - /vite@5.0.0(@types/node@18.18.6)(sass@1.69.5): - resolution: {integrity: sha512-ESJVM59mdyGpsiNAeHQOR/0fqNoOyWPYesFto8FFZugfmhdHx8Fzd8sF3Q/xkVhZsyOxHfdM7ieiVAorI9RjFw==} + /vite@5.0.10(@types/node@18.18.6)(sass@1.69.5): + resolution: {integrity: sha512-2P8J7WWgmc355HUMlFrwofacvr98DAjoE52BfdbwQtyLH06XKwaL/FMnmKM2crF0iX4MpmMKoDlNCB1ok7zHCw==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -15931,13 +15944,13 @@ packages: dependencies: '@types/node': 18.18.6 esbuild: 0.19.6 - postcss: 8.4.31 + postcss: 8.4.32 rollup: 4.5.0 sass: 1.69.5 optionalDependencies: fsevents: 2.3.3 - /vitefu@0.2.5(vite@5.0.0): + /vitefu@0.2.5(vite@5.0.10): resolution: {integrity: sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==} peerDependencies: vite: ^3.0.0 || ^4.0.0 || ^5.0.0 @@ -15945,7 +15958,7 @@ packages: vite: optional: true dependencies: - vite: 5.0.0(@types/node@18.18.6)(sass@1.69.5) + vite: 5.0.10(@types/node@18.18.6)(sass@1.69.5) dev: false /vitest@0.34.6: From 1f3d72b8d3e961951a31b4b309ac9467f7c1cb74 Mon Sep 17 00:00:00 2001 From: Florian Lefebvre Date: Wed, 20 Dec 2023 11:55:33 +0000 Subject: [PATCH 06/15] [ci] format --- packages/astro/test/cli.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/astro/test/cli.test.js b/packages/astro/test/cli.test.js index 30461823c677..b276e74a4471 100644 --- a/packages/astro/test/cli.test.js +++ b/packages/astro/test/cli.test.js @@ -104,7 +104,7 @@ describe('astro cli', () => { const proc = cli('dev', '--root', fileURLToPath(projectRootURL)); const { messages } = await parseCliDevStart(proc); - const index = messages[0].includes("[vite]") ? 1 : 0 + const index = messages[0].includes('[vite]') ? 1 : 0; expect(messages[index]).to.contain('astro'); expect(messages[index]).to.contain(pkgVersion); From 5062d27a186c5020522614b9d6f3da218f7afd96 Mon Sep 17 00:00:00 2001 From: Ken Powers Date: Wed, 20 Dec 2023 07:37:48 -0500 Subject: [PATCH 07/15] Respect forms with enctype set for view transitions (#9466) * Respect forms with enctype set for view transitions * Add changeset * Revert "Respect forms with enctype set for view transitions" This reverts commit 6d3e04a9598a2de8ccc153911fd6ab629abcaf7a. * Review feedback * Handle submitter case * Move comment * Update .changeset/rude-geckos-rush.md * Add tests --------- Co-authored-by: Nate Moore --- .changeset/rude-geckos-rush.md | 5 ++ .../view-transitions/src/pages/form-one.astro | 10 ++- packages/astro/e2e/view-transitions.test.js | 77 +++++++++++++++++++ packages/astro/src/transitions/router.ts | 20 ++++- 4 files changed, 107 insertions(+), 5 deletions(-) create mode 100644 .changeset/rude-geckos-rush.md diff --git a/.changeset/rude-geckos-rush.md b/.changeset/rude-geckos-rush.md new file mode 100644 index 000000000000..53f058151490 --- /dev/null +++ b/.changeset/rude-geckos-rush.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Updates view transitions `form` handling with logic for the [`enctype`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/enctype) attribute diff --git a/packages/astro/e2e/fixtures/view-transitions/src/pages/form-one.astro b/packages/astro/e2e/fixtures/view-transitions/src/pages/form-one.astro index daa03b723d51..88a36251a72a 100644 --- a/packages/astro/e2e/fixtures/view-transitions/src/pages/form-one.astro +++ b/packages/astro/e2e/fixtures/view-transitions/src/pages/form-one.astro @@ -1,13 +1,15 @@ --- import Layout from '../components/Layout.astro'; const method = Astro.url.searchParams.get('method') ?? 'POST'; +const enctype = Astro.url.searchParams.get('enctype'); const postShowThrow = Astro.url.searchParams.has('throw') ?? false; --- +

Contact Form

-
- - {postShowThrow ? : ''} - + + + {postShowThrow ? : ''} +
diff --git a/packages/astro/e2e/view-transitions.test.js b/packages/astro/e2e/view-transitions.test.js index b755fd0d37f1..125caf00cd3e 100644 --- a/packages/astro/e2e/view-transitions.test.js +++ b/packages/astro/e2e/view-transitions.test.js @@ -976,6 +976,83 @@ test.describe('View Transitions', () => { ).toEqual(1); }); + test('form POST defaults to multipart/form-data (Astro 4.x compatibility)', async ({ + page, + astro, + }) => { + const loads = []; + + page.addListener('load', async (p) => { + loads.push(p); + }); + + const postedEncodings = []; + + await page.route('**/contact', async (route) => { + const request = route.request(); + + if (request.method() === 'POST') { + postedEncodings.push(request.headers()['content-type'].split(';')[0]); + } + + await route.continue(); + }); + + await page.goto(astro.resolveUrl('/form-one')); + + // Submit the form + await page.click('#submit'); + + expect( + loads.length, + 'There should be only 1 page load. No additional loads for the form submission' + ).toEqual(1); + + expect( + postedEncodings, + 'There should be 1 POST, with encoding set to `multipart/form-data`' + ).toEqual(['multipart/form-data']); + }); + + test('form POST respects enctype attribute', async ({ page, astro }) => { + const loads = []; + + page.addListener('load', async (p) => { + loads.push(p); + }); + + const postedEncodings = []; + + await page.route('**/contact', async (route) => { + const request = route.request(); + + if (request.method() === 'POST') { + postedEncodings.push(request.headers()['content-type'].split(';')[0]); + } + + await route.continue(); + }); + + await page.goto( + astro.resolveUrl( + `/form-one?${new URLSearchParams({ enctype: 'application/x-www-form-urlencoded' })}` + ) + ); + + // Submit the form + await page.click('#submit'); + + expect( + loads.length, + 'There should be only 1 page load. No additional loads for the form submission' + ).toEqual(1); + + expect( + postedEncodings, + 'There should be 1 POST, with encoding set to `multipart/form-data`' + ).toEqual(['application/x-www-form-urlencoded']); + }); + test('Route announcer is invisible on page transition', async ({ page, astro }) => { await page.goto(astro.resolveUrl('/no-directive-one')); diff --git a/packages/astro/src/transitions/router.ts b/packages/astro/src/transitions/router.ts index 6588fd71f960..98cdf2066f71 100644 --- a/packages/astro/src/transitions/router.ts +++ b/packages/astro/src/transitions/router.ts @@ -463,7 +463,25 @@ async function transition( const init: RequestInit = {}; if (preparationEvent.formData) { init.method = 'POST'; - init.body = preparationEvent.formData; + const form = + preparationEvent.sourceElement instanceof HTMLFormElement + ? preparationEvent.sourceElement + : preparationEvent.sourceElement instanceof HTMLElement && + 'form' in preparationEvent.sourceElement + ? (preparationEvent.sourceElement.form as HTMLFormElement) + : preparationEvent.sourceElement?.closest('form'); + // Form elements without enctype explicitly set default to application/x-www-form-urlencoded. + // In order to maintain compatibility with Astro 4.x, we need to check the value of enctype + // on the attributes property rather than accessing .enctype directly. Astro 5.x may + // introduce defaulting to application/x-www-form-urlencoded as a breaking change, and then + // we can access .enctype directly. + // + // Note: getNamedItem can return null in real life, even if TypeScript doesn't think so, hence + // the ?. + init.body = + form?.attributes.getNamedItem('enctype')?.value === 'application/x-www-form-urlencoded' + ? new URLSearchParams(preparationEvent.formData as any) + : preparationEvent.formData; } const response = await fetchHTML(href, init); // If there is a problem fetching the new page, just do an MPA navigation to it. From f6714f677cffa2484565f51d5eb55bd34309653b Mon Sep 17 00:00:00 2001 From: Martin Trapp <94928215+martrapp@users.noreply.github.com> Date: Wed, 20 Dec 2023 14:44:48 +0100 Subject: [PATCH 08/15] view transition's form handling honors default prevention (#9486) * add missing check to honor prevented default * added changeset * Update .changeset/fresh-games-confess.md Co-authored-by: Florian Lefebvre --------- Co-authored-by: Florian Lefebvre --- .changeset/fresh-games-confess.md | 5 +++++ packages/astro/components/ViewTransitions.astro | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/fresh-games-confess.md diff --git a/.changeset/fresh-games-confess.md b/.changeset/fresh-games-confess.md new file mode 100644 index 000000000000..fa6a0fe97ca0 --- /dev/null +++ b/.changeset/fresh-games-confess.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes View Transition's form submission prevention, allowing `preventDefault` to be used. diff --git a/packages/astro/components/ViewTransitions.astro b/packages/astro/components/ViewTransitions.astro index 310f1865a92c..e8e12ce3d3c1 100644 --- a/packages/astro/components/ViewTransitions.astro +++ b/packages/astro/components/ViewTransitions.astro @@ -94,7 +94,7 @@ const { fallback = 'animate' } = Astro.props; document.addEventListener('submit', (ev) => { let el = ev.target as HTMLElement; - if (el.tagName !== 'FORM' || isReloadEl(el)) { + if (el.tagName !== 'FORM' || ev.defaultPrevented || isReloadEl(el)) { return; } const form = el as HTMLFormElement; From c384f6924edc161d3ff631e658f017a37e4207e3 Mon Sep 17 00:00:00 2001 From: Erika <3019731+Princesseuh@users.noreply.github.com> Date: Wed, 20 Dec 2023 10:25:41 -0500 Subject: [PATCH 09/15] fix(a11y): Fix some audit false positives (#9483) * fix(a11y): Fix some audit false positives * chore: changeset * Update packages/astro/src/runtime/client/dev-overlay/plugins/audit/a11y.ts Co-authored-by: Chris Swithinbank * fix: apply feedback * nit: add comment --------- Co-authored-by: Chris Swithinbank --- .changeset/thirty-panthers-repeat.md | 5 ++++ .../client/dev-overlay/plugins/audit/a11y.ts | 30 ++++++++++++------- 2 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 .changeset/thirty-panthers-repeat.md diff --git a/.changeset/thirty-panthers-repeat.md b/.changeset/thirty-panthers-repeat.md new file mode 100644 index 000000000000..58227df25978 --- /dev/null +++ b/.changeset/thirty-panthers-repeat.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix some false positive in the audit logic of the dev toolbar diff --git a/packages/astro/src/runtime/client/dev-overlay/plugins/audit/a11y.ts b/packages/astro/src/runtime/client/dev-overlay/plugins/audit/a11y.ts index a5e6e5073ad5..15432e910538 100644 --- a/packages/astro/src/runtime/client/dev-overlay/plugins/audit/a11y.ts +++ b/packages/astro/src/runtime/client/dev-overlay/plugins/audit/a11y.ts @@ -38,6 +38,8 @@ const a11y_required_attributes = { const interactiveElements = ['button', 'details', 'embed', 'iframe', 'label', 'select', 'textarea']; +const labellableElements = ['input', 'meter', 'output', 'progress', 'select', 'textarea']; + const aria_non_interactive_roles = [ 'alert', 'alertdialog', @@ -217,7 +219,7 @@ export const a11y: AuditRuleWithSelector[] = [ code: 'a11y-aria-activedescendant-has-tabindex', title: 'Elements with attribute `aria-activedescendant` must be tabbable', message: - 'This element must either have an inherent `tabindex` or declare `tabindex` as an attribute.', + 'Element with the `aria-activedescendant` attribute must either have an inherent `tabindex` or declare `tabindex` as an attribute.', selector: '[aria-activedescendant]', match(element) { if (!(element as HTMLElement).tabIndex && !element.hasAttribute('tabindex')) return true; @@ -280,14 +282,20 @@ export const a11y: AuditRuleWithSelector[] = [ selector: 'a[href]:is([href=""], [href="#"], [href^="javascript:" i])', }, { - code: 'a11y-label-has-associated-control', - title: '`label` tag should have an associated control and a text content.', + code: 'a11y-invalid-label', + title: '`label` element should have an associated control and a text content.', message: - 'The `label` tag must be associated with a control using either `for` or having a nested input. Additionally, the `label` tag must have text content.', - selector: 'label:not([for])', - match(element) { - const inputChild = element.querySelector('input'); - if (!inputChild?.textContent) return true; + 'The `label` element must be associated with a control either by using the `for` attribute or by containing a nested form element. Additionally, the `label` element must have text content.', + selector: 'label', + match(element: HTMLLabelElement) { + // Label must be associated with a control, either using `for` or having a nested valid element + const hasFor = element.hasAttribute('for'); + const nestedLabellableElement = element.querySelector(`${labellableElements.join(', ')}`); + if (!hasFor && !nestedLabellableElement) return true; + + // Label must have text content, using innerText to ignore hidden text + const innerText = element.innerText.trim(); + if (innerText === '') return true; }, }, { @@ -347,8 +355,10 @@ export const a11y: AuditRuleWithSelector[] = [ title: 'Missing content on element important for accessibility', message: 'Headings and anchors must have content to be accessible.', selector: a11y_required_content.join(','), - match(element) { - if (!element.textContent) return true; + match(element: HTMLElement) { + // innerText is used to ignore hidden text + const innerText = element.innerText.trim(); + if (innerText === '') return true; }, }, { From 19169db1f1574d36cc284fd9a0319d9b1e92b49a Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Wed, 20 Dec 2023 16:48:06 +0000 Subject: [PATCH 10/15] chore: smoother logging when building pages (#9487) * chore: smoother logging when building pages * chore: improve logging during the build * fix: put `newLine` top `LogMessage` * Update .changeset/popular-meals-yell.md Co-authored-by: Florian Lefebvre --------- Co-authored-by: Florian Lefebvre --- .changeset/popular-meals-yell.md | 5 ++++ packages/astro/src/core/build/generate.ts | 7 +++-- packages/astro/src/core/logger/core.ts | 34 ++++++++++++++--------- packages/astro/src/core/logger/node.ts | 7 +++-- 4 files changed, 34 insertions(+), 19 deletions(-) create mode 100644 .changeset/popular-meals-yell.md diff --git a/.changeset/popular-meals-yell.md b/.changeset/popular-meals-yell.md new file mode 100644 index 000000000000..772e9b82a549 --- /dev/null +++ b/.changeset/popular-meals-yell.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Improves logging of the generated pages during the build diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index 9dc80f8223f0..d26aad71e684 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -304,13 +304,14 @@ async function generatePage( for (let i = 0; i < paths.length; i++) { const path = paths[i]; pipeline.getEnvironment().logger.debug('build', `Generating: ${path}`); + const filePath = getOutputFilename(pipeline.getConfig(), path, pageData.route.type); + const lineIcon = i === paths.length - 1 ? '└─' : '├─'; + logger.info(null, ` ${blue(lineIcon)} ${dim(filePath)}`, false); await generatePath(path, pipeline, generationOptions, route); const timeEnd = performance.now(); const timeChange = getTimeStat(prevTimeEnd, timeEnd); const timeIncrease = `(+${timeChange})`; - const filePath = getOutputFilename(pipeline.getConfig(), path, pageData.route.type); - const lineIcon = i === paths.length - 1 ? '└─' : '├─'; - logger.info(null, ` ${blue(lineIcon)} ${dim(filePath)} ${dim(timeIncrease)}`); + logger.info('SKIP_FORMAT', ` ${dim(timeIncrease)}`); prevTimeEnd = timeEnd; } } diff --git a/packages/astro/src/core/logger/core.ts b/packages/astro/src/core/logger/core.ts index db571d8f14da..f2230f754296 100644 --- a/packages/astro/src/core/logger/core.ts +++ b/packages/astro/src/core/logger/core.ts @@ -56,6 +56,7 @@ export interface LogMessage { label: string | null; level: LoggerLevel; message: string; + newLine: boolean; } export const levels: Record = { @@ -67,13 +68,20 @@ export const levels: Record = { }; /** Full logging API */ -export function log(opts: LogOptions, level: LoggerLevel, label: string | null, message: string) { +export function log( + opts: LogOptions, + level: LoggerLevel, + label: string | null, + message: string, + newLine = true +) { const logLevel = opts.level; const dest = opts.dest; const event: LogMessage = { label, level, message, + newLine, }; // test if this level is enabled or not @@ -89,18 +97,18 @@ export function isLogLevelEnabled(configuredLogLevel: LoggerLevel, level: Logger } /** Emit a user-facing message. Useful for UI and other console messages. */ -export function info(opts: LogOptions, label: string | null, message: string) { - return log(opts, 'info', label, message); +export function info(opts: LogOptions, label: string | null, message: string, newLine = true) { + return log(opts, 'info', label, message, newLine); } /** Emit a warning message. Useful for high-priority messages that aren't necessarily errors. */ -export function warn(opts: LogOptions, label: string | null, message: string) { - return log(opts, 'warn', label, message); +export function warn(opts: LogOptions, label: string | null, message: string, newLine = true) { + return log(opts, 'warn', label, message, newLine); } /** Emit a error message, Useful when Astro can't recover from some error. */ -export function error(opts: LogOptions, label: string | null, message: string) { - return log(opts, 'error', label, message); +export function error(opts: LogOptions, label: string | null, message: string, newLine = true) { + return log(opts, 'error', label, message, newLine); } type LogFn = typeof info | typeof warn | typeof error; @@ -191,14 +199,14 @@ export class Logger { this.options = options; } - info(label: LoggerLabel | null, message: string) { - info(this.options, label, message); + info(label: LoggerLabel | null, message: string, newLine = true) { + info(this.options, label, message, newLine); } - warn(label: LoggerLabel | null, message: string) { - warn(this.options, label, message); + warn(label: LoggerLabel | null, message: string, newLine = true) { + warn(this.options, label, message, newLine); } - error(label: LoggerLabel | null, message: string) { - error(this.options, label, message); + error(label: LoggerLabel | null, message: string, newLine = true) { + error(this.options, label, message, newLine); } debug(label: LoggerLabel, ...messages: any[]) { debug(label, ...messages); diff --git a/packages/astro/src/core/logger/node.ts b/packages/astro/src/core/logger/node.ts index 2c75968d2f85..15f86a5b4969 100644 --- a/packages/astro/src/core/logger/node.ts +++ b/packages/astro/src/core/logger/node.ts @@ -7,15 +7,16 @@ type ConsoleStream = Writable & { }; export const nodeLogDestination: LogWritable = { - write(event: LogMessage) { + write(event: LogMessage, newLine = true) { let dest: ConsoleStream = process.stderr; if (levels[event.level] < levels['error']) { dest = process.stdout; } + let trailingLine = event.newLine ? '\n' : ''; if (event.label === 'SKIP_FORMAT') { - dest.write(event.message + '\n'); + dest.write(event.message + trailingLine); } else { - dest.write(getEventPrefix(event) + ' ' + event.message + '\n'); + dest.write(getEventPrefix(event) + ' ' + event.message + trailingLine); } return true; }, From 97342d218e0c2d616005af6f6f54308115b89ec1 Mon Sep 17 00:00:00 2001 From: "Houston (Bot)" <108291165+astrobot-houston@users.noreply.github.com> Date: Wed, 20 Dec 2023 09:39:13 -0800 Subject: [PATCH 11/15] [ci] release (#9457) Co-authored-by: github-actions[bot] --- .changeset/breezy-hairs-yell.md | 5 -- .changeset/eight-sheep-nail.md | 5 -- .changeset/eleven-hairs-peel.md | 11 --- .changeset/famous-cars-sell.md | 5 -- .changeset/fresh-games-confess.md | 5 -- .changeset/friendly-tables-worry.md | 5 -- .changeset/khaki-ducks-give.md | 5 -- .changeset/modern-humans-think.md | 5 -- .changeset/popular-meals-yell.md | 5 -- .changeset/real-bags-hope.md | 5 -- .changeset/rude-geckos-rush.md | 5 -- .changeset/selfish-rings-occur.md | 5 -- .changeset/silly-cycles-clap.md | 5 -- .changeset/thirty-panthers-repeat.md | 5 -- .changeset/warm-bats-eat.md | 5 -- .changeset/wise-wasps-sell.md | 5 -- examples/basics/package.json | 2 +- examples/blog/package.json | 4 +- examples/component/package.json | 2 +- examples/framework-alpine/package.json | 2 +- examples/framework-lit/package.json | 2 +- examples/framework-multiple/package.json | 8 +- examples/framework-preact/package.json | 2 +- examples/framework-react/package.json | 4 +- examples/framework-solid/package.json | 2 +- examples/framework-svelte/package.json | 4 +- examples/framework-vue/package.json | 4 +- examples/hackernews/package.json | 4 +- examples/integration/package.json | 2 +- examples/middleware/package.json | 4 +- examples/minimal/package.json | 2 +- examples/non-html-pages/package.json | 2 +- examples/portfolio/package.json | 2 +- examples/ssr/package.json | 6 +- examples/view-transitions/package.json | 6 +- examples/with-markdoc/package.json | 4 +- examples/with-markdown-plugins/package.json | 2 +- examples/with-markdown-shiki/package.json | 2 +- examples/with-mdx/package.json | 4 +- examples/with-nanostores/package.json | 2 +- examples/with-tailwindcss/package.json | 6 +- examples/with-vitest/package.json | 2 +- packages/astro/CHANGELOG.md | 32 ++++++++ packages/astro/package.json | 2 +- packages/integrations/markdoc/CHANGELOG.md | 6 ++ packages/integrations/markdoc/package.json | 2 +- packages/integrations/mdx/CHANGELOG.md | 6 ++ packages/integrations/mdx/package.json | 2 +- packages/integrations/node/CHANGELOG.md | 6 ++ packages/integrations/node/package.json | 2 +- packages/integrations/react/CHANGELOG.md | 8 ++ packages/integrations/react/package.json | 2 +- packages/integrations/svelte/CHANGELOG.md | 6 ++ packages/integrations/svelte/package.json | 2 +- packages/integrations/tailwind/CHANGELOG.md | 6 ++ packages/integrations/tailwind/package.json | 2 +- packages/integrations/vue/CHANGELOG.md | 6 ++ packages/integrations/vue/package.json | 2 +- pnpm-lock.yaml | 86 ++++++++++----------- 59 files changed, 170 insertions(+), 180 deletions(-) delete mode 100644 .changeset/breezy-hairs-yell.md delete mode 100644 .changeset/eight-sheep-nail.md delete mode 100644 .changeset/eleven-hairs-peel.md delete mode 100644 .changeset/famous-cars-sell.md delete mode 100644 .changeset/fresh-games-confess.md delete mode 100644 .changeset/friendly-tables-worry.md delete mode 100644 .changeset/khaki-ducks-give.md delete mode 100644 .changeset/modern-humans-think.md delete mode 100644 .changeset/popular-meals-yell.md delete mode 100644 .changeset/real-bags-hope.md delete mode 100644 .changeset/rude-geckos-rush.md delete mode 100644 .changeset/selfish-rings-occur.md delete mode 100644 .changeset/silly-cycles-clap.md delete mode 100644 .changeset/thirty-panthers-repeat.md delete mode 100644 .changeset/warm-bats-eat.md delete mode 100644 .changeset/wise-wasps-sell.md diff --git a/.changeset/breezy-hairs-yell.md b/.changeset/breezy-hairs-yell.md deleted file mode 100644 index 173d9934dbea..000000000000 --- a/.changeset/breezy-hairs-yell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/react': patch ---- - -Prevents unsupported `forwardRef` components created by Preact from being rendered by React diff --git a/.changeset/eight-sheep-nail.md b/.changeset/eight-sheep-nail.md deleted file mode 100644 index a4730e5d214c..000000000000 --- a/.changeset/eight-sheep-nail.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/node': patch ---- - -Fix typo in @astrojs/node README diff --git a/.changeset/eleven-hairs-peel.md b/.changeset/eleven-hairs-peel.md deleted file mode 100644 index a9de7ecc43aa..000000000000 --- a/.changeset/eleven-hairs-peel.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -'@astrojs/tailwind': patch -'@astrojs/markdoc': patch -'@astrojs/svelte': patch -'@astrojs/react': patch -'@astrojs/mdx': patch -'@astrojs/vue': patch -'astro': patch ---- - -Upgrades vite to latest diff --git a/.changeset/famous-cars-sell.md b/.changeset/famous-cars-sell.md deleted file mode 100644 index 983945b058eb..000000000000 --- a/.changeset/famous-cars-sell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Add a more descriptive error message when image conversion fails diff --git a/.changeset/fresh-games-confess.md b/.changeset/fresh-games-confess.md deleted file mode 100644 index fa6a0fe97ca0..000000000000 --- a/.changeset/fresh-games-confess.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes View Transition's form submission prevention, allowing `preventDefault` to be used. diff --git a/.changeset/friendly-tables-worry.md b/.changeset/friendly-tables-worry.md deleted file mode 100644 index fbcfe07b6818..000000000000 --- a/.changeset/friendly-tables-worry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -update import created for `astro create netlify` diff --git a/.changeset/khaki-ducks-give.md b/.changeset/khaki-ducks-give.md deleted file mode 100644 index 3f759891b824..000000000000 --- a/.changeset/khaki-ducks-give.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes an edge case with view transitions where some spec-compliant `Content-Type` headers would cause a valid HTML response to be ignored. diff --git a/.changeset/modern-humans-think.md b/.changeset/modern-humans-think.md deleted file mode 100644 index 71ad5e0a5b11..000000000000 --- a/.changeset/modern-humans-think.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes importing dev toolbar apps from integrations on Windows diff --git a/.changeset/popular-meals-yell.md b/.changeset/popular-meals-yell.md deleted file mode 100644 index 772e9b82a549..000000000000 --- a/.changeset/popular-meals-yell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Improves logging of the generated pages during the build diff --git a/.changeset/real-bags-hope.md b/.changeset/real-bags-hope.md deleted file mode 100644 index 86fb6678329d..000000000000 --- a/.changeset/real-bags-hope.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fix Astro failing to build on certain exotic platform that reports their CPU count incorrectly diff --git a/.changeset/rude-geckos-rush.md b/.changeset/rude-geckos-rush.md deleted file mode 100644 index 53f058151490..000000000000 --- a/.changeset/rude-geckos-rush.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Updates view transitions `form` handling with logic for the [`enctype`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/enctype) attribute diff --git a/.changeset/selfish-rings-occur.md b/.changeset/selfish-rings-occur.md deleted file mode 100644 index e5722bb95f23..000000000000 --- a/.changeset/selfish-rings-occur.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Correctly handle the error in case the middleware throws a runtime error diff --git a/.changeset/silly-cycles-clap.md b/.changeset/silly-cycles-clap.md deleted file mode 100644 index dc456728eddb..000000000000 --- a/.changeset/silly-cycles-clap.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes an issue where redirects did not replace slugs when the target of the redirect rule was not a verbatim route in the project. diff --git a/.changeset/thirty-panthers-repeat.md b/.changeset/thirty-panthers-repeat.md deleted file mode 100644 index 58227df25978..000000000000 --- a/.changeset/thirty-panthers-repeat.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fix some false positive in the audit logic of the dev toolbar diff --git a/.changeset/warm-bats-eat.md b/.changeset/warm-bats-eat.md deleted file mode 100644 index 27a059a3d79d..000000000000 --- a/.changeset/warm-bats-eat.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes incorrect hoisted script paths when custom rollup output file names are configured diff --git a/.changeset/wise-wasps-sell.md b/.changeset/wise-wasps-sell.md deleted file mode 100644 index b2d031087df0..000000000000 --- a/.changeset/wise-wasps-sell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Remove the manifest from the generated files in the `dist/` folder. diff --git a/examples/basics/package.json b/examples/basics/package.json index a2be285be58e..e6e61c6d70e5 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.6" + "astro": "^4.0.7" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index 84e8f96f69fa..32e32622640d 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -11,9 +11,9 @@ "astro": "astro" }, "dependencies": { - "@astrojs/mdx": "^2.0.1", + "@astrojs/mdx": "^2.0.2", "@astrojs/rss": "^4.0.1", "@astrojs/sitemap": "^3.0.3", - "astro": "^4.0.6" + "astro": "^4.0.7" } } diff --git a/examples/component/package.json b/examples/component/package.json index 026c05683520..6b056cff0f4b 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.0.6" + "astro": "^4.0.7" }, "peerDependencies": { "astro": "^3.0.0" diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index 85458689e772..8747cae30a6b 100644 --- a/examples/framework-alpine/package.json +++ b/examples/framework-alpine/package.json @@ -14,6 +14,6 @@ "@astrojs/alpinejs": "^0.3.1", "@types/alpinejs": "^3.13.5", "alpinejs": "^3.13.3", - "astro": "^4.0.6" + "astro": "^4.0.7" } } diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json index f60fee249301..483b3209dda0 100644 --- a/examples/framework-lit/package.json +++ b/examples/framework-lit/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/lit": "^4.0.0", "@webcomponents/template-shadowroot": "^0.2.1", - "astro": "^4.0.6", + "astro": "^4.0.7", "lit": "^2.8.0" } } diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index f5d4b433467e..725a8252b349 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -12,11 +12,11 @@ }, "dependencies": { "@astrojs/preact": "^3.0.1", - "@astrojs/react": "^3.0.7", + "@astrojs/react": "^3.0.8", "@astrojs/solid-js": "^3.0.2", - "@astrojs/svelte": "^5.0.1", - "@astrojs/vue": "^4.0.4", - "astro": "^4.0.6", + "@astrojs/svelte": "^5.0.2", + "@astrojs/vue": "^4.0.5", + "astro": "^4.0.7", "preact": "^10.19.2", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index d3a9f8e2b785..d767c0b5fdd1 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.0.1", "@preact/signals": "^1.2.1", - "astro": "^4.0.6", + "astro": "^4.0.7", "preact": "^10.19.2" } } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index e99e4e698e97..bf1e2ee34d23 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -11,10 +11,10 @@ "astro": "astro" }, "dependencies": { - "@astrojs/react": "^3.0.7", + "@astrojs/react": "^3.0.8", "@types/react": "^18.2.37", "@types/react-dom": "^18.2.15", - "astro": "^4.0.6", + "astro": "^4.0.7", "react": "^18.2.0", "react-dom": "^18.2.0" } diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index 3b6aeeceaaef..a283d3f78473 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/solid-js": "^3.0.2", - "astro": "^4.0.6", + "astro": "^4.0.7", "solid-js": "^1.8.5" } } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index 761a1330aaf4..e14692cf3a60 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -11,8 +11,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/svelte": "^5.0.1", - "astro": "^4.0.6", + "@astrojs/svelte": "^5.0.2", + "astro": "^4.0.7", "svelte": "^4.2.5" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index deadb01dea17..851ac283bc0e 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -11,8 +11,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/vue": "^4.0.4", - "astro": "^4.0.6", + "@astrojs/vue": "^4.0.5", + "astro": "^4.0.7", "vue": "^3.3.8" } } diff --git a/examples/hackernews/package.json b/examples/hackernews/package.json index a68cbee2bcb0..1a7646ac8b66 100644 --- a/examples/hackernews/package.json +++ b/examples/hackernews/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "@astrojs/node": "^7.0.1", - "astro": "^4.0.6" + "@astrojs/node": "^7.0.2", + "astro": "^4.0.7" } } diff --git a/examples/integration/package.json b/examples/integration/package.json index 9d9cb57a13a7..e59c8e1ef9d0 100644 --- a/examples/integration/package.json +++ b/examples/integration/package.json @@ -15,7 +15,7 @@ ], "scripts": {}, "devDependencies": { - "astro": "^4.0.6" + "astro": "^4.0.7" }, "peerDependencies": { "astro": "^3.0.0" diff --git a/examples/middleware/package.json b/examples/middleware/package.json index d541ea0c8c6d..fdea138649af 100644 --- a/examples/middleware/package.json +++ b/examples/middleware/package.json @@ -12,8 +12,8 @@ "server": "node dist/server/entry.mjs" }, "dependencies": { - "@astrojs/node": "^7.0.1", - "astro": "^4.0.6", + "@astrojs/node": "^7.0.2", + "astro": "^4.0.7", "html-minifier": "^4.0.0" } } diff --git a/examples/minimal/package.json b/examples/minimal/package.json index 12dcffaac511..768f60a0952e 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.6" + "astro": "^4.0.7" } } diff --git a/examples/non-html-pages/package.json b/examples/non-html-pages/package.json index cb59b347d3df..e77e7bfc319d 100644 --- a/examples/non-html-pages/package.json +++ b/examples/non-html-pages/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.6" + "astro": "^4.0.7" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index bcb75beb4edb..124a9f059baa 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.6" + "astro": "^4.0.7" } } diff --git a/examples/ssr/package.json b/examples/ssr/package.json index b0f6917d0c70..30d9218dda55 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -12,9 +12,9 @@ "server": "node dist/server/entry.mjs" }, "dependencies": { - "@astrojs/node": "^7.0.1", - "@astrojs/svelte": "^5.0.1", - "astro": "^4.0.6", + "@astrojs/node": "^7.0.2", + "@astrojs/svelte": "^5.0.2", + "astro": "^4.0.7", "svelte": "^4.2.5" } } diff --git a/examples/view-transitions/package.json b/examples/view-transitions/package.json index 6dce1e47592a..18e9dbbd0206 100644 --- a/examples/view-transitions/package.json +++ b/examples/view-transitions/package.json @@ -10,8 +10,8 @@ "astro": "astro" }, "devDependencies": { - "@astrojs/tailwind": "^5.0.3", - "@astrojs/node": "^7.0.1", - "astro": "^4.0.6" + "@astrojs/tailwind": "^5.0.4", + "@astrojs/node": "^7.0.2", + "astro": "^4.0.7" } } diff --git a/examples/with-markdoc/package.json b/examples/with-markdoc/package.json index 88efda477794..67211e723ace 100644 --- a/examples/with-markdoc/package.json +++ b/examples/with-markdoc/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "@astrojs/markdoc": "^0.8.0", - "astro": "^4.0.6" + "@astrojs/markdoc": "^0.8.1", + "astro": "^4.0.7" } } diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index 8426ee5c6af8..7cdb99e34f11 100644 --- a/examples/with-markdown-plugins/package.json +++ b/examples/with-markdown-plugins/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@astrojs/markdown-remark": "^4.0.1", - "astro": "^4.0.6", + "astro": "^4.0.7", "hast-util-select": "^6.0.2", "rehype-autolink-headings": "^7.1.0", "rehype-slug": "^6.0.0", diff --git a/examples/with-markdown-shiki/package.json b/examples/with-markdown-shiki/package.json index 8de86125d0d2..02263dcbd446 100644 --- a/examples/with-markdown-shiki/package.json +++ b/examples/with-markdown-shiki/package.json @@ -11,6 +11,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^4.0.6" + "astro": "^4.0.7" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index 807028daaf1d..11afa24841bc 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -11,9 +11,9 @@ "astro": "astro" }, "dependencies": { - "@astrojs/mdx": "^2.0.1", + "@astrojs/mdx": "^2.0.2", "@astrojs/preact": "^3.0.1", - "astro": "^4.0.6", + "astro": "^4.0.7", "preact": "^10.19.2" } } diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 9951cdc48239..1c7e196caf56 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -13,7 +13,7 @@ "dependencies": { "@astrojs/preact": "^3.0.1", "@nanostores/preact": "^0.5.0", - "astro": "^4.0.6", + "astro": "^4.0.7", "nanostores": "^0.9.5", "preact": "^10.19.2" } diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index 7d49c968c8ae..7531abebb0bb 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -11,10 +11,10 @@ "astro": "astro" }, "dependencies": { - "@astrojs/mdx": "^2.0.1", - "@astrojs/tailwind": "^5.0.3", + "@astrojs/mdx": "^2.0.2", + "@astrojs/tailwind": "^5.0.4", "@types/canvas-confetti": "^1.6.3", - "astro": "^4.0.6", + "astro": "^4.0.7", "autoprefixer": "^10.4.15", "canvas-confetti": "^1.9.1", "postcss": "^8.4.28", diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index b95d6c316888..f2dc137867ff 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^4.0.6", + "astro": "^4.0.7", "vitest": "^0.34.2" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 68aee7a1c311..ed5853be59c6 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,37 @@ # astro +## 4.0.7 + +### Patch Changes + +- [#9452](https://github.com/withastro/astro/pull/9452) [`e83b5095f`](https://github.com/withastro/astro/commit/e83b5095f164f48ba40fc715a805fc66a3e39dcf) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Upgrades vite to latest + +- [#9352](https://github.com/withastro/astro/pull/9352) [`f515b1421`](https://github.com/withastro/astro/commit/f515b1421afa335b8d6e4491fbe24419df53bfeb) Thanks [@tmcw](https://github.com/tmcw)! - Add a more descriptive error message when image conversion fails + +- [#9486](https://github.com/withastro/astro/pull/9486) [`f6714f677`](https://github.com/withastro/astro/commit/f6714f677cffa2484565f51d5eb55bd34309653b) Thanks [@martrapp](https://github.com/martrapp)! - Fixes View Transition's form submission prevention, allowing `preventDefault` to be used. + +- [#9461](https://github.com/withastro/astro/pull/9461) [`429be8cc3`](https://github.com/withastro/astro/commit/429be8cc3ed0623df4fdca76f1531265f5ba5dfc) Thanks [@Skn0tt](https://github.com/Skn0tt)! - update import created for `astro create netlify` + +- [#9464](https://github.com/withastro/astro/pull/9464) [`faf6c7e11`](https://github.com/withastro/astro/commit/faf6c7e1104ee247e847836020a3ce07a2053705) Thanks [@Fryuni](https://github.com/Fryuni)! - Fixes an edge case with view transitions where some spec-compliant `Content-Type` headers would cause a valid HTML response to be ignored. + +- [#9400](https://github.com/withastro/astro/pull/9400) [`1e984389b`](https://github.com/withastro/astro/commit/1e984389bafd87b0a631ed4aba930447669234f8) Thanks [@bluwy](https://github.com/bluwy)! - Fixes importing dev toolbar apps from integrations on Windows + +- [#9487](https://github.com/withastro/astro/pull/9487) [`19169db1f`](https://github.com/withastro/astro/commit/19169db1f1574d36cc284fd9a0319d9b1e92b49a) Thanks [@ematipico](https://github.com/ematipico)! - Improves logging of the generated pages during the build + +- [#9460](https://github.com/withastro/astro/pull/9460) [`047d285be`](https://github.com/withastro/astro/commit/047d285be1ab764bc82f88b8553b46429c37efca) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Fix Astro failing to build on certain exotic platform that reports their CPU count incorrectly + +- [#9466](https://github.com/withastro/astro/pull/9466) [`5062d27a1`](https://github.com/withastro/astro/commit/5062d27a186c5020522614b9d6f3da218f7afd96) Thanks [@knpwrs](https://github.com/knpwrs)! - Updates view transitions `form` handling with logic for the [`enctype`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/enctype) attribute + +- [#9458](https://github.com/withastro/astro/pull/9458) [`fa3078ce9`](https://github.com/withastro/astro/commit/fa3078ce9f5eda408340a78c6d275f3e0b2437dc) Thanks [@ematipico](https://github.com/ematipico)! - Correctly handle the error in case the middleware throws a runtime error + +- [#9089](https://github.com/withastro/astro/pull/9089) [`5ae657882`](https://github.com/withastro/astro/commit/5ae657882287645c967249aee91bd06497f6624d) Thanks [@lilnasy](https://github.com/lilnasy)! - Fixes an issue where redirects did not replace slugs when the target of the redirect rule was not a verbatim route in the project. + +- [#9483](https://github.com/withastro/astro/pull/9483) [`c384f6924`](https://github.com/withastro/astro/commit/c384f6924edc161d3ff631e658f017a37e4207e3) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Fix some false positive in the audit logic of the dev toolbar + +- [#9437](https://github.com/withastro/astro/pull/9437) [`354a62c86`](https://github.com/withastro/astro/commit/354a62c86e9187af5d05540ed321bdc889384d97) Thanks [@dkobierski](https://github.com/dkobierski)! - Fixes incorrect hoisted script paths when custom rollup output file names are configured + +- [#9475](https://github.com/withastro/astro/pull/9475) [`7ae4928f3`](https://github.com/withastro/astro/commit/7ae4928f303720d3b2f611474fc08d3b96c2e4af) Thanks [@ematipico](https://github.com/ematipico)! - Remove the manifest from the generated files in the `dist/` folder. + ## 4.0.6 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index c305bcc16df7..1594c67851bd 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "4.0.6", + "version": "4.0.7", "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.", "type": "module", "author": "withastro", diff --git a/packages/integrations/markdoc/CHANGELOG.md b/packages/integrations/markdoc/CHANGELOG.md index 67a9d249e5c8..f7c46e2bb4f8 100644 --- a/packages/integrations/markdoc/CHANGELOG.md +++ b/packages/integrations/markdoc/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/markdoc +## 0.8.1 + +### Patch Changes + +- [#9452](https://github.com/withastro/astro/pull/9452) [`e83b5095f`](https://github.com/withastro/astro/commit/e83b5095f164f48ba40fc715a805fc66a3e39dcf) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Upgrades vite to latest + ## 0.8.0 ### Minor Changes diff --git a/packages/integrations/markdoc/package.json b/packages/integrations/markdoc/package.json index 7bec279db6fe..f564a7dda131 100644 --- a/packages/integrations/markdoc/package.json +++ b/packages/integrations/markdoc/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/markdoc", "description": "Add support for Markdoc in your Astro site", - "version": "0.8.0", + "version": "0.8.1", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/mdx/CHANGELOG.md b/packages/integrations/mdx/CHANGELOG.md index 6161b6238d59..9a799dffd4c5 100644 --- a/packages/integrations/mdx/CHANGELOG.md +++ b/packages/integrations/mdx/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/mdx +## 2.0.2 + +### Patch Changes + +- [#9452](https://github.com/withastro/astro/pull/9452) [`e83b5095f`](https://github.com/withastro/astro/commit/e83b5095f164f48ba40fc715a805fc66a3e39dcf) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Upgrades vite to latest + ## 2.0.1 ### Patch Changes diff --git a/packages/integrations/mdx/package.json b/packages/integrations/mdx/package.json index 51fe0751d21b..05df6c4d029d 100644 --- a/packages/integrations/mdx/package.json +++ b/packages/integrations/mdx/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/mdx", "description": "Add support for MDX pages in your Astro site", - "version": "2.0.1", + "version": "2.0.2", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/node/CHANGELOG.md b/packages/integrations/node/CHANGELOG.md index 89c7a4021844..5783fc2410e4 100644 --- a/packages/integrations/node/CHANGELOG.md +++ b/packages/integrations/node/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/node +## 7.0.2 + +### Patch Changes + +- [#9471](https://github.com/withastro/astro/pull/9471) [`6bf470cfb`](https://github.com/withastro/astro/commit/6bf470cfb87e853c0a1f69bceb09246801bc8bdc) Thanks [@alexnguyennz](https://github.com/alexnguyennz)! - Fix typo in @astrojs/node README + ## 7.0.1 ### Patch Changes diff --git a/packages/integrations/node/package.json b/packages/integrations/node/package.json index 402bb6f7b966..2e05be8b30af 100644 --- a/packages/integrations/node/package.json +++ b/packages/integrations/node/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/node", "description": "Deploy your site to a Node.js server", - "version": "7.0.1", + "version": "7.0.2", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/react/CHANGELOG.md b/packages/integrations/react/CHANGELOG.md index 1ba942a77295..1d90d20b9490 100644 --- a/packages/integrations/react/CHANGELOG.md +++ b/packages/integrations/react/CHANGELOG.md @@ -1,5 +1,13 @@ # @astrojs/react +## 3.0.8 + +### Patch Changes + +- [#9403](https://github.com/withastro/astro/pull/9403) [`7eb9fe8a7`](https://github.com/withastro/astro/commit/7eb9fe8a717dd2b66b1d541e1aa4d3eb5d959ddf) Thanks [@knpwrs](https://github.com/knpwrs)! - Prevents unsupported `forwardRef` components created by Preact from being rendered by React + +- [#9452](https://github.com/withastro/astro/pull/9452) [`e83b5095f`](https://github.com/withastro/astro/commit/e83b5095f164f48ba40fc715a805fc66a3e39dcf) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Upgrades vite to latest + ## 3.0.7 ### Patch Changes diff --git a/packages/integrations/react/package.json b/packages/integrations/react/package.json index c94f9b7235bb..ce3c39fd62f8 100644 --- a/packages/integrations/react/package.json +++ b/packages/integrations/react/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/react", "description": "Use React components within Astro", - "version": "3.0.7", + "version": "3.0.8", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/svelte/CHANGELOG.md b/packages/integrations/svelte/CHANGELOG.md index cf253e29089b..6cc51bd77f7a 100644 --- a/packages/integrations/svelte/CHANGELOG.md +++ b/packages/integrations/svelte/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/svelte +## 5.0.2 + +### Patch Changes + +- [#9452](https://github.com/withastro/astro/pull/9452) [`e83b5095f`](https://github.com/withastro/astro/commit/e83b5095f164f48ba40fc715a805fc66a3e39dcf) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Upgrades vite to latest + ## 5.0.1 ### Patch Changes diff --git a/packages/integrations/svelte/package.json b/packages/integrations/svelte/package.json index 9c4fe3a757b7..7ee52b143b85 100644 --- a/packages/integrations/svelte/package.json +++ b/packages/integrations/svelte/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/svelte", - "version": "5.0.1", + "version": "5.0.2", "description": "Use Svelte components within Astro", "type": "module", "types": "./dist/index.d.ts", diff --git a/packages/integrations/tailwind/CHANGELOG.md b/packages/integrations/tailwind/CHANGELOG.md index 50e3b0786139..397ea02c179a 100644 --- a/packages/integrations/tailwind/CHANGELOG.md +++ b/packages/integrations/tailwind/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/tailwind +## 5.0.4 + +### Patch Changes + +- [#9452](https://github.com/withastro/astro/pull/9452) [`e83b5095f`](https://github.com/withastro/astro/commit/e83b5095f164f48ba40fc715a805fc66a3e39dcf) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Upgrades vite to latest + ## 5.0.3 ### Patch Changes diff --git a/packages/integrations/tailwind/package.json b/packages/integrations/tailwind/package.json index 91ac5c60b1c1..34cda3a4c63e 100644 --- a/packages/integrations/tailwind/package.json +++ b/packages/integrations/tailwind/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/tailwind", "description": "Use Tailwind CSS to style your Astro site", - "version": "5.0.3", + "version": "5.0.4", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/vue/CHANGELOG.md b/packages/integrations/vue/CHANGELOG.md index 906d57e98254..04bd2a20bd8b 100644 --- a/packages/integrations/vue/CHANGELOG.md +++ b/packages/integrations/vue/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/vue +## 4.0.5 + +### Patch Changes + +- [#9452](https://github.com/withastro/astro/pull/9452) [`e83b5095f`](https://github.com/withastro/astro/commit/e83b5095f164f48ba40fc715a805fc66a3e39dcf) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Upgrades vite to latest + ## 4.0.4 ### Patch Changes diff --git a/packages/integrations/vue/package.json b/packages/integrations/vue/package.json index 5e0c56231a31..29b42ca8befb 100644 --- a/packages/integrations/vue/package.json +++ b/packages/integrations/vue/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/vue", - "version": "4.0.4", + "version": "4.0.5", "description": "Use Vue components within Astro", "type": "module", "types": "./dist/index.d.ts", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 472861ead4ac..ac222b327493 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -125,13 +125,13 @@ importers: examples/basics: dependencies: astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro examples/blog: dependencies: '@astrojs/mdx': - specifier: ^2.0.1 + specifier: ^2.0.2 version: link:../../packages/integrations/mdx '@astrojs/rss': specifier: ^4.0.1 @@ -140,13 +140,13 @@ importers: specifier: ^3.0.3 version: link:../../packages/integrations/sitemap astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro examples/component: devDependencies: astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro examples/framework-alpine: @@ -161,7 +161,7 @@ importers: specifier: ^3.13.3 version: 3.13.3 astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro examples/framework-lit: @@ -173,7 +173,7 @@ importers: specifier: ^0.2.1 version: 0.2.1 astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro lit: specifier: ^2.8.0 @@ -185,19 +185,19 @@ importers: specifier: ^3.0.1 version: link:../../packages/integrations/preact '@astrojs/react': - specifier: ^3.0.7 + specifier: ^3.0.8 version: link:../../packages/integrations/react '@astrojs/solid-js': specifier: ^3.0.2 version: link:../../packages/integrations/solid '@astrojs/svelte': - specifier: ^5.0.1 + specifier: ^5.0.2 version: link:../../packages/integrations/svelte '@astrojs/vue': - specifier: ^4.0.4 + specifier: ^4.0.5 version: link:../../packages/integrations/vue astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro preact: specifier: ^10.19.2 @@ -227,7 +227,7 @@ importers: specifier: ^1.2.1 version: 1.2.1(preact@10.19.2) astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro preact: specifier: ^10.19.2 @@ -236,7 +236,7 @@ importers: examples/framework-react: dependencies: '@astrojs/react': - specifier: ^3.0.7 + specifier: ^3.0.8 version: link:../../packages/integrations/react '@types/react': specifier: ^18.2.37 @@ -245,7 +245,7 @@ importers: specifier: ^18.2.15 version: 18.2.15 astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro react: specifier: ^18.2.0 @@ -260,7 +260,7 @@ importers: specifier: ^3.0.2 version: link:../../packages/integrations/solid astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro solid-js: specifier: ^1.8.5 @@ -269,10 +269,10 @@ importers: examples/framework-svelte: dependencies: '@astrojs/svelte': - specifier: ^5.0.1 + specifier: ^5.0.2 version: link:../../packages/integrations/svelte astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro svelte: specifier: ^4.2.5 @@ -281,10 +281,10 @@ importers: examples/framework-vue: dependencies: '@astrojs/vue': - specifier: ^4.0.4 + specifier: ^4.0.5 version: link:../../packages/integrations/vue astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro vue: specifier: ^3.3.8 @@ -293,25 +293,25 @@ importers: examples/hackernews: dependencies: '@astrojs/node': - specifier: ^7.0.1 + specifier: ^7.0.2 version: link:../../packages/integrations/node astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro examples/integration: devDependencies: astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro examples/middleware: dependencies: '@astrojs/node': - specifier: ^7.0.1 + specifier: ^7.0.2 version: link:../../packages/integrations/node astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro html-minifier: specifier: ^4.0.0 @@ -320,31 +320,31 @@ importers: examples/minimal: dependencies: astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro examples/non-html-pages: dependencies: astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro examples/portfolio: dependencies: astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro examples/ssr: dependencies: '@astrojs/node': - specifier: ^7.0.1 + specifier: ^7.0.2 version: link:../../packages/integrations/node '@astrojs/svelte': - specifier: ^5.0.1 + specifier: ^5.0.2 version: link:../../packages/integrations/svelte astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro svelte: specifier: ^4.2.5 @@ -353,22 +353,22 @@ importers: examples/view-transitions: devDependencies: '@astrojs/node': - specifier: ^7.0.1 + specifier: ^7.0.2 version: link:../../packages/integrations/node '@astrojs/tailwind': - specifier: ^5.0.3 + specifier: ^5.0.4 version: link:../../packages/integrations/tailwind astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro examples/with-markdoc: dependencies: '@astrojs/markdoc': - specifier: ^0.8.0 + specifier: ^0.8.1 version: link:../../packages/integrations/markdoc astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro examples/with-markdown-plugins: @@ -377,7 +377,7 @@ importers: specifier: ^4.0.1 version: link:../../packages/markdown/remark astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro hast-util-select: specifier: ^6.0.2 @@ -398,19 +398,19 @@ importers: examples/with-markdown-shiki: dependencies: astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro examples/with-mdx: dependencies: '@astrojs/mdx': - specifier: ^2.0.1 + specifier: ^2.0.2 version: link:../../packages/integrations/mdx '@astrojs/preact': specifier: ^3.0.1 version: link:../../packages/integrations/preact astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro preact: specifier: ^10.19.2 @@ -425,7 +425,7 @@ importers: specifier: ^0.5.0 version: 0.5.0(nanostores@0.9.5)(preact@10.19.2) astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro nanostores: specifier: ^0.9.5 @@ -437,16 +437,16 @@ importers: examples/with-tailwindcss: dependencies: '@astrojs/mdx': - specifier: ^2.0.1 + specifier: ^2.0.2 version: link:../../packages/integrations/mdx '@astrojs/tailwind': - specifier: ^5.0.3 + specifier: ^5.0.4 version: link:../../packages/integrations/tailwind '@types/canvas-confetti': specifier: ^1.6.3 version: 1.6.3 astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro autoprefixer: specifier: ^10.4.15 @@ -464,7 +464,7 @@ importers: examples/with-vitest: dependencies: astro: - specifier: ^4.0.6 + specifier: ^4.0.7 version: link:../../packages/astro vitest: specifier: ^0.34.2 From 72b26daf694b213918f02d0fcbf90ab5b7ebc31f Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Wed, 20 Dec 2023 12:59:49 -0600 Subject: [PATCH 12/15] Skip `check` for known Qwik components (#9482) --- .changeset/eight-ears-call.md | 7 +++++++ packages/integrations/preact/src/server.ts | 1 + packages/integrations/react/server-v17.js | 1 + packages/integrations/react/server.js | 1 + packages/integrations/solid/src/server.ts | 1 + 5 files changed, 11 insertions(+) create mode 100644 .changeset/eight-ears-call.md diff --git a/.changeset/eight-ears-call.md b/.changeset/eight-ears-call.md new file mode 100644 index 000000000000..41a9140a7a24 --- /dev/null +++ b/.changeset/eight-ears-call.md @@ -0,0 +1,7 @@ +--- +'@astrojs/preact': patch +'@astrojs/react': patch +'@astrojs/solid-js': patch +--- + +Improves compatability with the [Qwik adapter](https://github.com/QwikDev/astro) diff --git a/packages/integrations/preact/src/server.ts b/packages/integrations/preact/src/server.ts index a395433c9bad..1de6d174f4c0 100644 --- a/packages/integrations/preact/src/server.ts +++ b/packages/integrations/preact/src/server.ts @@ -13,6 +13,7 @@ let consoleFilterRefs = 0; function check(this: RendererContext, Component: any, props: Record, children: any) { if (typeof Component !== 'function') return false; + if (Component.name === "QwikComponent") return false; if (Component.prototype != null && typeof Component.prototype.render === 'function') { return BaseComponent.isPrototypeOf(Component); diff --git a/packages/integrations/react/server-v17.js b/packages/integrations/react/server-v17.js index 5638c6fb776e..12e1f198e4f1 100644 --- a/packages/integrations/react/server-v17.js +++ b/packages/integrations/react/server-v17.js @@ -20,6 +20,7 @@ function check(Component, props, children) { return Component['$$typeof']?.toString().slice('Symbol('.length).startsWith('react'); } if (typeof Component !== 'function') return false; + if (Component.name === "QwikComponent") return false; if (Component.prototype != null && typeof Component.prototype.render === 'function') { return React.Component.isPrototypeOf(Component) || React.PureComponent.isPrototypeOf(Component); diff --git a/packages/integrations/react/server.js b/packages/integrations/react/server.js index 4c1aac9334d4..810c37250fcc 100644 --- a/packages/integrations/react/server.js +++ b/packages/integrations/react/server.js @@ -22,6 +22,7 @@ async function check(Component, props, children) { return Component['$$typeof'].toString().slice('Symbol('.length).startsWith('react'); } if (typeof Component !== 'function') return false; + if (Component.name === "QwikComponent") return false; // Preact forwarded-ref components can be functions, which React does not support if (typeof Component === 'function' && Component['$$typeof'] === Symbol.for('react.forward_ref')) diff --git a/packages/integrations/solid/src/server.ts b/packages/integrations/solid/src/server.ts index 6e371da517f6..eb73f0af18e3 100644 --- a/packages/integrations/solid/src/server.ts +++ b/packages/integrations/solid/src/server.ts @@ -6,6 +6,7 @@ const slotName = (str: string) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w function check(this: RendererContext, Component: any, props: Record, children: any) { if (typeof Component !== 'function') return false; + if (Component.name === "QwikComponent") return false; const { html } = renderToStaticMarkup.call(this, Component, props, children); return typeof html === 'string'; } From 60dc8da71b40fb080cd77a01ba39c92b7bbef423 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Wed, 20 Dec 2023 19:00:58 +0000 Subject: [PATCH 13/15] [ci] format --- packages/integrations/preact/src/server.ts | 2 +- packages/integrations/react/server-v17.js | 2 +- packages/integrations/react/server.js | 2 +- packages/integrations/solid/src/server.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/integrations/preact/src/server.ts b/packages/integrations/preact/src/server.ts index 1de6d174f4c0..7d017a413951 100644 --- a/packages/integrations/preact/src/server.ts +++ b/packages/integrations/preact/src/server.ts @@ -13,7 +13,7 @@ let consoleFilterRefs = 0; function check(this: RendererContext, Component: any, props: Record, children: any) { if (typeof Component !== 'function') return false; - if (Component.name === "QwikComponent") return false; + if (Component.name === 'QwikComponent') return false; if (Component.prototype != null && typeof Component.prototype.render === 'function') { return BaseComponent.isPrototypeOf(Component); diff --git a/packages/integrations/react/server-v17.js b/packages/integrations/react/server-v17.js index 12e1f198e4f1..ad0c99622b56 100644 --- a/packages/integrations/react/server-v17.js +++ b/packages/integrations/react/server-v17.js @@ -20,7 +20,7 @@ function check(Component, props, children) { return Component['$$typeof']?.toString().slice('Symbol('.length).startsWith('react'); } if (typeof Component !== 'function') return false; - if (Component.name === "QwikComponent") return false; + if (Component.name === 'QwikComponent') return false; if (Component.prototype != null && typeof Component.prototype.render === 'function') { return React.Component.isPrototypeOf(Component) || React.PureComponent.isPrototypeOf(Component); diff --git a/packages/integrations/react/server.js b/packages/integrations/react/server.js index 810c37250fcc..b3ddeb6b1d12 100644 --- a/packages/integrations/react/server.js +++ b/packages/integrations/react/server.js @@ -22,7 +22,7 @@ async function check(Component, props, children) { return Component['$$typeof'].toString().slice('Symbol('.length).startsWith('react'); } if (typeof Component !== 'function') return false; - if (Component.name === "QwikComponent") return false; + if (Component.name === 'QwikComponent') return false; // Preact forwarded-ref components can be functions, which React does not support if (typeof Component === 'function' && Component['$$typeof'] === Symbol.for('react.forward_ref')) diff --git a/packages/integrations/solid/src/server.ts b/packages/integrations/solid/src/server.ts index eb73f0af18e3..445e4605e9de 100644 --- a/packages/integrations/solid/src/server.ts +++ b/packages/integrations/solid/src/server.ts @@ -6,7 +6,7 @@ const slotName = (str: string) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w function check(this: RendererContext, Component: any, props: Record, children: any) { if (typeof Component !== 'function') return false; - if (Component.name === "QwikComponent") return false; + if (Component.name === 'QwikComponent') return false; const { html } = renderToStaticMarkup.call(this, Component, props, children); return typeof html === 'string'; } From dfef925e1fd07f3efb9fde6f4f23548f2af7dc75 Mon Sep 17 00:00:00 2001 From: Arsh <69170106+lilnasy@users.noreply.github.com> Date: Wed, 20 Dec 2023 21:13:50 +0000 Subject: [PATCH 14/15] chore: improve type fidelity for internal error class (#9478) * chore: improve type fidelity for internal error class * add changeset * simplify * fix: adjust for new error --------- Co-authored-by: Princesseuh <3019731+Princesseuh@users.noreply.github.com> --- .changeset/rare-ants-swim.md | 5 +++++ packages/astro/src/assets/build/generate.ts | 1 - packages/astro/src/core/errors/errors.ts | 14 +++++++------- .../astro/src/core/middleware/loadMiddleware.ts | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 .changeset/rare-ants-swim.md diff --git a/.changeset/rare-ants-swim.md b/.changeset/rare-ants-swim.md new file mode 100644 index 000000000000..1bde7bf14258 --- /dev/null +++ b/.changeset/rare-ants-swim.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Improves errors in certain places to also report their causes. diff --git a/packages/astro/src/assets/build/generate.ts b/packages/astro/src/assets/build/generate.ts index 4ee210ec3037..a73ef11f2768 100644 --- a/packages/astro/src/assets/build/generate.ts +++ b/packages/astro/src/assets/build/generate.ts @@ -226,7 +226,6 @@ export async function generateImagesForPath( ...AstroErrorData.CouldNotTransformImage, message: AstroErrorData.CouldNotTransformImage.message(originalFilePath), }, - undefined, { cause: e } ); diff --git a/packages/astro/src/core/errors/errors.ts b/packages/astro/src/core/errors/errors.ts index faf365686908..31e3be52026c 100644 --- a/packages/astro/src/core/errors/errors.ts +++ b/packages/astro/src/core/errors/errors.ts @@ -38,10 +38,10 @@ export class AstroError extends Error { type: ErrorTypes = 'AstroError'; - constructor(props: ErrorProperties, ...params: any) { - super(...params); - + constructor(props: ErrorProperties, options?: ErrorOptions) { const { name, title, message, stack, location, hint, frame } = props; + super(message, options); + this.title = title; this.name = name; @@ -81,8 +81,8 @@ export class AstroError extends Error { export class CompilerError extends AstroError { type: ErrorTypes = 'CompilerError'; - constructor(props: ErrorProperties, ...params: any) { - super(props, ...params); + constructor(props: ErrorProperties, options?: ErrorOptions) { + super(props, options); } static is(err: unknown): err is CompilerError { @@ -120,8 +120,8 @@ export class AggregateError extends AstroError { // Despite being a collection of errors, AggregateError still needs to have a main error attached to it // This is because Vite expects every thrown errors handled during HMR to be, well, Error and have a message - constructor(props: ErrorProperties & { errors: AstroError[] }, ...params: any) { - super(props, ...params); + constructor(props: ErrorProperties & { errors: AstroError[] }, options?: ErrorOptions) { + super(props, options); this.errors = props.errors; } diff --git a/packages/astro/src/core/middleware/loadMiddleware.ts b/packages/astro/src/core/middleware/loadMiddleware.ts index 135f7fbc479e..da6090982689 100644 --- a/packages/astro/src/core/middleware/loadMiddleware.ts +++ b/packages/astro/src/core/middleware/loadMiddleware.ts @@ -12,7 +12,7 @@ export async function loadMiddleware(moduleLoader: ModuleLoader) { try { return await moduleLoader.import(MIDDLEWARE_MODULE_ID); } catch (error: any) { - const astroError = new AstroError(MiddlewareCantBeLoaded, undefined, { cause: error }); + const astroError = new AstroError(MiddlewareCantBeLoaded, { cause: error }); throw astroError; } } From f9c4bbf200820915f5526fcd8d5c399c51b44f71 Mon Sep 17 00:00:00 2001 From: Arsh Date: Wed, 20 Dec 2023 21:15:00 +0000 Subject: [PATCH 15/15] [ci] format --- packages/astro/src/core/errors/errors.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/astro/src/core/errors/errors.ts b/packages/astro/src/core/errors/errors.ts index 31e3be52026c..37373527b03d 100644 --- a/packages/astro/src/core/errors/errors.ts +++ b/packages/astro/src/core/errors/errors.ts @@ -41,7 +41,7 @@ export class AstroError extends Error { constructor(props: ErrorProperties, options?: ErrorOptions) { const { name, title, message, stack, location, hint, frame } = props; super(message, options); - + this.title = title; this.name = name;