diff --git a/.changeset/angry-spoons-flow.md b/.changeset/angry-spoons-flow.md new file mode 100644 index 000000000000..e00f0cce2c32 --- /dev/null +++ b/.changeset/angry-spoons-flow.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Remove legacy compiler error handling diff --git a/packages/astro/package.json b/packages/astro/package.json index 91aa78c50c52..cafb9cdb78da 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -99,7 +99,7 @@ "test:e2e:match": "playwright test -g" }, "dependencies": { - "@astrojs/compiler": "^0.32.0", + "@astrojs/compiler": "^0.33.0", "@astrojs/language-server": "^0.28.3", "@astrojs/markdown-remark": "^2.0.0-beta.2", "@astrojs/telemetry": "^2.0.0-beta.0", diff --git a/packages/astro/src/core/errors/errors-data.ts b/packages/astro/src/core/errors/errors-data.ts index 957a199583ee..0fc56a06d8ea 100644 --- a/packages/astro/src/core/errors/errors-data.ts +++ b/packages/astro/src/core/errors/errors-data.ts @@ -17,6 +17,7 @@ export const AstroErrorData = defineErrors({ UnknownCompilerError: { title: 'Unknown compiler error.', code: 1000, + hint: 'This is almost always a problem with the Astro compiler, not your code. Please open an issue at https://astro.build/issues/compiler.', }, // 1xxx and 2xxx codes are reserved for compiler errors and warnings respectively /** @@ -47,7 +48,7 @@ export const AstroErrorData = defineErrors({ * - [Official integrations](https://docs.astro.build/en/guides/integrations-guide/#official-integrations) * - [Astro.clientAddress](https://docs.astro.build/en/reference/api-reference/#astroclientaddress) * @description - * The adapter you.'re using unfortunately does not support `Astro.clientAddress`. + * The adapter you're using unfortunately does not support `Astro.clientAddress`. */ ClientAddressNotAvailable: { title: '`Astro.clientAddress` is not available in current adapter.', diff --git a/packages/astro/src/core/errors/overlay.ts b/packages/astro/src/core/errors/overlay.ts index 7ed3df148411..8eb297ea008b 100644 --- a/packages/astro/src/core/errors/overlay.ts +++ b/packages/astro/src/core/errors/overlay.ts @@ -522,6 +522,15 @@ class ErrorOverlay extends HTMLElement { const el = this.root.querySelector(selector); + if (html) { + // Automatically detect links + text = text.split(' ').map(v => { + if (!v.startsWith('https://')) return v; + if (v.endsWith('.')) return `${v.slice(0, -1)}.` + return `${v}` + }).join(' '); + } + if (el) { if (!html) { el.textContent = text.trim(); diff --git a/packages/astro/src/vite-plugin-astro/compile.ts b/packages/astro/src/vite-plugin-astro/compile.ts index c42ef34b77c2..929dac2ca80a 100644 --- a/packages/astro/src/vite-plugin-astro/compile.ts +++ b/packages/astro/src/vite-plugin-astro/compile.ts @@ -124,31 +124,5 @@ async function enhanceCompileError({ } } - // improve compiler errors - if (err.stack && err.stack.includes('wasm-function')) { - const search = new URLSearchParams({ - labels: 'compiler', - title: '🐛 BUG: `@astrojs/compiler` panic', - template: '---01-bug-report.yml', - 'bug-description': `\`@astrojs/compiler\` encountered an unrecoverable error when compiling the following file. - -**${id.replace(fileURLToPath(config.root), '')}** -\`\`\`astro -${source} -\`\`\``, - }); - (err as any).url = `https://github.com/withastro/astro/issues/new?${search.toString()}`; - err.message = `Error: Uh oh, the Astro compiler encountered an unrecoverable error! - - Please open - a GitHub issue using the link below: - ${(err as any).url}`; - - if (logging.level !== 'debug') { - // TODO: remove stack replacement when compiler throws better errors - err.stack = ` at ${id}`; - } - } - throw err; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fce38d966eb4..624ee61fc2a7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -385,7 +385,7 @@ importers: packages/astro: specifiers: - '@astrojs/compiler': ^0.32.0 + '@astrojs/compiler': ^0.33.0 '@astrojs/language-server': ^0.28.3 '@astrojs/markdown-remark': ^2.0.0-beta.2 '@astrojs/telemetry': ^2.0.0-beta.0 @@ -475,7 +475,7 @@ importers: yargs-parser: ^21.0.1 zod: ^3.17.3 dependencies: - '@astrojs/compiler': 0.32.0 + '@astrojs/compiler': 0.33.0 '@astrojs/language-server': 0.28.3 '@astrojs/markdown-remark': link:../markdown/remark '@astrojs/telemetry': link:../telemetry @@ -3834,8 +3834,8 @@ packages: /@astrojs/compiler/0.31.4: resolution: {integrity: sha512-6bBFeDTtPOn4jZaiD3p0f05MEGQL9pw2Zbfj546oFETNmjJFWO3nzHz6/m+P53calknCvyVzZ5YhoBLIvzn5iw==} - /@astrojs/compiler/0.32.0: - resolution: {integrity: sha512-QL5qMGkfsC1/kDjJF4RRagz8/hACBUb19cHWrQ8AROphS42qXM6JhoO1Og5FohV3p2VfT5CdEJspn4uNsgZvmw==} + /@astrojs/compiler/0.33.0: + resolution: {integrity: sha512-REr2QpGR8+/ZccMFBcKqg5+cveuGG5C9b80XQn7ZCBkYDUJM+Yb2fC9koiWcK73ODXXDW14Ro+8+c58Q45lqRA==} dev: false /@astrojs/language-server/0.28.3: