@sveltejs/vite-plugin-svelte
Advanced tools
Comparing version 1.0.0-next.35 to 1.0.0-next.36
@@ -167,3 +167,6 @@ var __defProp = Object.defineProperty; | ||
if (w.message) { | ||
parts.push(" ", w.message); | ||
if (parts.length > 0) { | ||
parts.push(" "); | ||
} | ||
parts.push(w.message); | ||
} | ||
@@ -296,3 +299,8 @@ return parts.join(""); | ||
if (options.preprocess) { | ||
preprocessed = await preprocess(code, options.preprocess, { filename }); | ||
try { | ||
preprocessed = await preprocess(code, options.preprocess, { filename }); | ||
} catch (e) { | ||
e.message = `Error while preprocessing ${filename}${e.message ? ` - ${e.message}` : ""}`; | ||
throw e; | ||
} | ||
if (preprocessed.dependencies) | ||
@@ -696,4 +704,4 @@ dependencies.push(...preprocessed.dependencies); | ||
// src/utils/error.ts | ||
function toRollupError(error) { | ||
const { filename, frame, start, code, name } = error; | ||
function toRollupError(error, options) { | ||
const { filename, frame, start, code, name, stack } = error; | ||
const rollupError = { | ||
@@ -705,3 +713,3 @@ name, | ||
code, | ||
stack: "" | ||
stack: options.isBuild || options.isDebug || !frame ? stack : "" | ||
}; | ||
@@ -717,4 +725,4 @@ if (start) { | ||
} | ||
function toESBuildError(error) { | ||
const { filename, frame, start } = error; | ||
function toESBuildError(error, options) { | ||
const { filename, frame, start, stack } = error; | ||
const partialMessage = { | ||
@@ -731,2 +739,5 @@ text: buildExtendedLogMessage(error) | ||
} | ||
if (options.isBuild || options.isDebug || !frame) { | ||
partialMessage.detail = stack; | ||
} | ||
return partialMessage; | ||
@@ -764,3 +775,3 @@ } | ||
} catch (e) { | ||
return { errors: [toESBuildError(e)] }; | ||
return { errors: [toESBuildError(e, options)] }; | ||
} | ||
@@ -798,3 +809,8 @@ }); | ||
if (options.preprocess) { | ||
preprocessed = await preprocess2(code, options.preprocess, { filename }); | ||
try { | ||
preprocessed = await preprocess2(code, options.preprocess, { filename }); | ||
} catch (e) { | ||
e.message = `Error while preprocessing ${filename}${e.message ? ` - ${e.message}` : ""}`; | ||
throw e; | ||
} | ||
if (preprocessed.map) | ||
@@ -1084,3 +1100,4 @@ compileOptions.sourcemap = preprocessed.map; | ||
isBuild: viteEnv.command === "build", | ||
isServe: viteEnv.command === "serve" | ||
isServe: viteEnv.command === "serve", | ||
isDebug: process.env.DEBUG != null | ||
}); | ||
@@ -1593,3 +1610,3 @@ if (svelteConfig == null ? void 0 : svelteConfig.configFile) { | ||
} catch (e) { | ||
throw toRollupError(e); | ||
throw toRollupError(e, options); | ||
} | ||
@@ -1596,0 +1613,0 @@ logCompilerWarnings(compileData.compiled.warnings, options); |
{ | ||
"name": "@sveltejs/vite-plugin-svelte", | ||
"version": "1.0.0-next.35", | ||
"version": "1.0.0-next.36", | ||
"license": "MIT", | ||
@@ -63,4 +63,4 @@ "author": "dominikg", | ||
"diff-match-patch": "^1.0.5", | ||
"esbuild": "^0.14.11", | ||
"rollup": "^2.64.0", | ||
"esbuild": "^0.14.13", | ||
"rollup": "^2.66.0", | ||
"svelte": "^3.46.2", | ||
@@ -67,0 +67,0 @@ "tsup": "^5.11.11", |
@@ -173,3 +173,3 @@ import fs from 'fs'; | ||
} catch (e) { | ||
throw toRollupError(e); | ||
throw toRollupError(e, options); | ||
} | ||
@@ -176,0 +176,0 @@ logCompilerWarnings(compileData.compiled.warnings, options); |
@@ -40,3 +40,9 @@ import { CompileOptions, ResolvedOptions } from './options'; | ||
if (options.preprocess) { | ||
preprocessed = await preprocess(code, options.preprocess, { filename }); | ||
try { | ||
preprocessed = await preprocess(code, options.preprocess, { filename }); | ||
} catch (e) { | ||
e.message = `Error while preprocessing ${filename}${e.message ? ` - ${e.message}` : ''}`; | ||
throw e; | ||
} | ||
if (preprocessed.dependencies) dependencies.push(...preprocessed.dependencies); | ||
@@ -43,0 +49,0 @@ if (preprocessed.map) compileOptions.sourcemap = preprocessed.map; |
import { RollupError } from 'rollup'; | ||
import { Warning } from './options'; | ||
import { ResolvedOptions, Warning } from './options'; | ||
import { buildExtendedLogMessage } from './log'; | ||
@@ -11,4 +11,4 @@ import { PartialMessage } from 'esbuild'; | ||
*/ | ||
export function toRollupError(error: Warning & Error): RollupError { | ||
const { filename, frame, start, code, name } = error; | ||
export function toRollupError(error: Warning & Error, options: ResolvedOptions): RollupError { | ||
const { filename, frame, start, code, name, stack } = error; | ||
const rollupError: RollupError = { | ||
@@ -20,3 +20,3 @@ name, // needed otherwise sveltekit coalesce_to_error turns it into a string | ||
code, | ||
stack: '' | ||
stack: options.isBuild || options.isDebug || !frame ? stack : '' | ||
}; | ||
@@ -38,4 +38,4 @@ if (start) { | ||
*/ | ||
export function toESBuildError(error: Warning & Error): PartialMessage { | ||
const { filename, frame, start } = error; | ||
export function toESBuildError(error: Warning & Error, options: ResolvedOptions): PartialMessage { | ||
const { filename, frame, start, stack } = error; | ||
const partialMessage: PartialMessage = { | ||
@@ -52,2 +52,5 @@ text: buildExtendedLogMessage(error) | ||
} | ||
if (options.isBuild || options.isDebug || !frame) { | ||
partialMessage.detail = stack; | ||
} | ||
return partialMessage; | ||
@@ -54,0 +57,0 @@ } |
@@ -30,3 +30,3 @@ import { promises as fs } from 'fs'; | ||
} catch (e) { | ||
return { errors: [toESBuildError(e)] }; | ||
return { errors: [toESBuildError(e, options)] }; | ||
} | ||
@@ -77,3 +77,8 @@ }); | ||
if (options.preprocess) { | ||
preprocessed = await preprocess(code, options.preprocess, { filename }); | ||
try { | ||
preprocessed = await preprocess(code, options.preprocess, { filename }); | ||
} catch (e) { | ||
e.message = `Error while preprocessing ${filename}${e.message ? ` - ${e.message}` : ''}`; | ||
throw e; | ||
} | ||
if (preprocessed.map) compileOptions.sourcemap = preprocessed.map; | ||
@@ -80,0 +85,0 @@ } |
@@ -167,5 +167,8 @@ /* eslint-disable no-unused-vars,no-console */ | ||
if (w.message) { | ||
parts.push(' ', w.message); | ||
if (parts.length > 0) { | ||
parts.push(' '); | ||
} | ||
parts.push(w.message); | ||
} | ||
return parts.join(''); | ||
} |
@@ -85,3 +85,4 @@ /* eslint-disable no-unused-vars */ | ||
isBuild: viteEnv.command === 'build', | ||
isServe: viteEnv.command === 'serve' | ||
isServe: viteEnv.command === 'serve', | ||
isDebug: process.env.DEBUG != null | ||
}; | ||
@@ -495,2 +496,3 @@ // configFile of svelteConfig contains the absolute path it was loaded from, | ||
isServe: boolean; | ||
isDebug: boolean; | ||
} | ||
@@ -497,0 +499,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
431490
5739
32