fix: add empty stack to `CompileDiagnostic` to show error on build (#13942)

* fix: add empty stack to `CompileDiagnostic` to show error on build

* chore: generate types

* chore: make stack optional to make TS happy

* chore: generate types -.-"

* chore: add comment
pull/13958/head
Paolo Ricciuti 10 months ago committed by GitHub
parent da1fefcd45
commit 7be3afb3a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: add empty stack to `CompileDiagnostic` to show error on build

@ -39,6 +39,7 @@ function get_code_frame(source, line, column) {
* @typedef {{
* code: string;
* message: string;
* stack?: string;
* filename?: string;
* start?: Location;
* end?: Location;
@ -50,6 +51,8 @@ function get_code_frame(source, line, column) {
/** @implements {ICompileDiagnostic} */
export class CompileDiagnostic {
name = 'CompileDiagnostic';
// adding an empty stack so that vite will show the file and frame during build
stack = '';
/**
* @param {string} code

@ -20,6 +20,7 @@ export default test({
^`,
message: 'Unexpected end of input',
name: 'CompileError',
stack: '',
position: [30, 30],
start: {
character: 30,

@ -1458,6 +1458,7 @@ declare module 'svelte/compiler' {
type ICompileDiagnostic = {
code: string;
message: string;
stack?: string;
filename?: string;
start?: Location;
end?: Location;
@ -2286,6 +2287,7 @@ declare module 'svelte/types/compiler/interfaces' {
type ICompileDiagnostic = {
code: string;
message: string;
stack?: string;
filename?: string;
start?: Location;
end?: Location;

Loading…
Cancel
Save