mirror of
https://github.com/withastro/astro.git
synced 2025-01-27 22:19:04 -05:00
Don't overwrite the stack when using verbose logging (#2290)
* Don't overwrite the stack when using verbose logging This makes it so that if the compiler panics and `--verbose` logging is on (debug level), we don't replace the stack trace. * Adds a changeset
This commit is contained in:
parent
ae5255dd25
commit
c77cf52e16
3 changed files with 14 additions and 4 deletions
5
.changeset/soft-frogs-tap.md
Normal file
5
.changeset/soft-frogs-tap.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Preserve wasm stack trace when verbose logging is enabled
|
|
@ -50,7 +50,7 @@ export async function createVite(inlineConfig: ViteConfigWithSSR, { astroConfig,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
configAliasVitePlugin({ config: astroConfig }),
|
configAliasVitePlugin({ config: astroConfig }),
|
||||||
astroVitePlugin({ config: astroConfig, devServer }),
|
astroVitePlugin({ config: astroConfig, devServer, logging }),
|
||||||
markdownVitePlugin({ config: astroConfig, devServer }),
|
markdownVitePlugin({ config: astroConfig, devServer }),
|
||||||
jsxVitePlugin({ config: astroConfig, logging }),
|
jsxVitePlugin({ config: astroConfig, logging }),
|
||||||
astroPostprocessVitePlugin({ config: astroConfig, devServer }),
|
astroPostprocessVitePlugin({ config: astroConfig, devServer }),
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import type vite from '../core/vite';
|
import type vite from '../core/vite';
|
||||||
import type { AstroConfig } from '../@types/astro';
|
import type { AstroConfig } from '../@types/astro';
|
||||||
|
import type { LogOptions } from '../core/logger';
|
||||||
|
|
||||||
import esbuild from 'esbuild';
|
import esbuild from 'esbuild';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
|
@ -11,11 +12,12 @@ import { cachedCompilation, invalidateCompilation } from './compile.js';
|
||||||
const FRONTMATTER_PARSE_REGEXP = /^\-\-\-(.*)^\-\-\-/ms;
|
const FRONTMATTER_PARSE_REGEXP = /^\-\-\-(.*)^\-\-\-/ms;
|
||||||
interface AstroPluginOptions {
|
interface AstroPluginOptions {
|
||||||
config: AstroConfig;
|
config: AstroConfig;
|
||||||
|
logging: LogOptions;
|
||||||
devServer?: AstroDevServer;
|
devServer?: AstroDevServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Transform .astro files for Vite */
|
/** Transform .astro files for Vite */
|
||||||
export default function astro({ config }: AstroPluginOptions): vite.Plugin {
|
export default function astro({ config, logging }: AstroPluginOptions): vite.Plugin {
|
||||||
let viteTransform: TransformHook;
|
let viteTransform: TransformHook;
|
||||||
return {
|
return {
|
||||||
name: '@astrojs/vite-plugin-astro',
|
name: '@astrojs/vite-plugin-astro',
|
||||||
|
@ -118,8 +120,11 @@ export default function astro({ config }: AstroPluginOptions): vite.Plugin {
|
||||||
Please open
|
Please open
|
||||||
a GitHub issue using the link below:
|
a GitHub issue using the link below:
|
||||||
${err.url}`;
|
${err.url}`;
|
||||||
// TODO: remove stack replacement when compiler throws better errors
|
|
||||||
err.stack = ` at ${id}`;
|
if(logging.level !== 'debug') {
|
||||||
|
// TODO: remove stack replacement when compiler throws better errors
|
||||||
|
err.stack = ` at ${id}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw err;
|
throw err;
|
||||||
|
|
Loading…
Add table
Reference in a new issue