@storm-software/esbuild 0.52.19 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/bin/esbuild.cjs +1 -1
- package/dist/assets.cjs +3 -6
- package/dist/assets.js +2 -5
- package/dist/build.cjs +9 -12
- package/dist/build.js +8 -11
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/{chunk-FPIJK3XG.cjs → chunk-BXCOVK3I.cjs} +4 -9
- package/dist/{chunk-QHLRM4V5.cjs → chunk-CRFWMPZN.cjs} +13 -20
- package/dist/{chunk-QIPHFRC4.js → chunk-CZC4I6SL.js} +5 -12
- package/dist/{chunk-7RE7ZACR.js → chunk-D4DSKI5N.js} +9 -17
- package/dist/{chunk-AFDZZITE.cjs → chunk-DJNFLJSO.cjs} +6 -13
- package/dist/chunk-GGNOJ77I.js +0 -0
- package/dist/{chunk-GOWYVZG4.js → chunk-MTZGYTJP.js} +3 -10
- package/dist/{chunk-5RUFZI6I.cjs → chunk-MYIRPP4C.cjs} +4 -11
- package/dist/chunk-OBGZSXTJ.cjs +10 -0
- package/dist/{chunk-HYW4BAFZ.cjs → chunk-P3PATQE5.cjs} +19 -27
- package/dist/chunk-SFZRYJZ2.cjs +1 -0
- package/dist/{chunk-WPDQA5FY.js → chunk-SJ6BFZTX.js} +8 -12
- package/dist/{chunk-DUKUFYDF.js → chunk-TTW7MNRE.js} +1 -8
- package/dist/chunk-V7AFF6GW.cjs +25 -0
- package/dist/{chunk-2OWGB57Y.cjs → chunk-XAUXKCOD.cjs} +21 -25
- package/dist/{chunk-E6AGXX4I.js → chunk-XKSMSRQZ.js} +2 -7
- package/dist/chunk-ZH5YCT67.js +25 -0
- package/dist/clean.cjs +3 -4
- package/dist/clean.js +2 -3
- package/dist/config.cjs +3 -6
- package/dist/config.js +2 -5
- package/dist/context.cjs +4 -7
- package/dist/context.js +3 -6
- package/dist/index.cjs +10 -18
- package/dist/index.js +9 -17
- package/dist/package-json.cjs +3 -6
- package/dist/package-json.js +2 -5
- package/dist/plugins/deps-check.cjs +6 -8
- package/dist/plugins/deps-check.js +6 -8
- package/dist/plugins/resolve-paths.cjs +12 -38
- package/dist/plugins/resolve-paths.js +4 -30
- package/dist/tsup.cjs +3 -5
- package/dist/tsup.js +2 -4
- package/dist/types.cjs +1 -2
- package/dist/types.js +1 -2
- package/dist/watch.cjs +5 -9
- package/dist/watch.js +4 -8
- package/package.json +7 -7
- package/assets/cjs_shims.js +0 -11
- package/assets/esm_shims.js +0 -9
- package/dist/chunk-3F47E3CC.js +0 -2718
- package/dist/chunk-3K6UVBCV.js +0 -135
- package/dist/chunk-4ZXSQJXL.cjs +0 -2687
- package/dist/chunk-AU3V4AYC.cjs +0 -135
- package/dist/chunk-BM3ARHU6.cjs +0 -325
- package/dist/chunk-BYH4XDRH.cjs +0 -6
- package/dist/chunk-E327PFHD.js +0 -54
- package/dist/chunk-GZSSIGNC.cjs +0 -153
- package/dist/chunk-ICZAYSVN.js +0 -325
- package/dist/chunk-JZ25TPTY.cjs +0 -42
- package/dist/chunk-O53NX6NM.cjs +0 -6
- package/dist/chunk-TWFEYLU4.cjs +0 -352
- package/dist/chunk-UFQVX6NZ.js +0 -1906
- package/dist/chunk-UIKQCOC2.cjs +0 -1906
- package/dist/chunk-UIWBVEQL.js +0 -6
- package/dist/chunk-VGC3FXLU.cjs +0 -203
- package/dist/chunk-WWBRFML4.cjs +0 -47
- package/dist/rollup.cjs +0 -6906
package/dist/chunk-ICZAYSVN.js
DELETED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_esm_shims
|
|
3
|
-
} from "./chunk-E327PFHD.js";
|
|
4
|
-
|
|
5
|
-
// ../config-tools/src/logger/console.ts
|
|
6
|
-
init_esm_shims();
|
|
7
|
-
|
|
8
|
-
// ../config-tools/src/types.ts
|
|
9
|
-
init_esm_shims();
|
|
10
|
-
var LogLevel = {
|
|
11
|
-
SILENT: 0,
|
|
12
|
-
FATAL: 10,
|
|
13
|
-
ERROR: 20,
|
|
14
|
-
WARN: 30,
|
|
15
|
-
SUCCESS: 35,
|
|
16
|
-
INFO: 40,
|
|
17
|
-
DEBUG: 60,
|
|
18
|
-
TRACE: 70,
|
|
19
|
-
ALL: 100
|
|
20
|
-
};
|
|
21
|
-
var LogLevelLabel = {
|
|
22
|
-
SILENT: "silent",
|
|
23
|
-
FATAL: "fatal",
|
|
24
|
-
ERROR: "error",
|
|
25
|
-
WARN: "warn",
|
|
26
|
-
SUCCESS: "success",
|
|
27
|
-
INFO: "info",
|
|
28
|
-
DEBUG: "debug",
|
|
29
|
-
TRACE: "trace",
|
|
30
|
-
ALL: "all"
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// ../config-tools/src/utilities/colors.ts
|
|
34
|
-
init_esm_shims();
|
|
35
|
-
var DEFAULT_COLOR_CONFIG = {
|
|
36
|
-
light: {
|
|
37
|
-
background: "#fafafa",
|
|
38
|
-
foreground: "#1d1e22",
|
|
39
|
-
brand: "#1fb2a6",
|
|
40
|
-
alternate: "#db2777",
|
|
41
|
-
help: "#5C4EE5",
|
|
42
|
-
success: "#087f5b",
|
|
43
|
-
info: "#0550ae",
|
|
44
|
-
warning: "#e3b341",
|
|
45
|
-
danger: "#D8314A",
|
|
46
|
-
fatal: "#51070f",
|
|
47
|
-
link: "#3fa6ff",
|
|
48
|
-
positive: "#22c55e",
|
|
49
|
-
negative: "#dc2626",
|
|
50
|
-
gradient: ["#1fb2a6", "#db2777", "#5C4EE5"]
|
|
51
|
-
},
|
|
52
|
-
dark: {
|
|
53
|
-
background: "#1d1e22",
|
|
54
|
-
foreground: "#cbd5e1",
|
|
55
|
-
brand: "#2dd4bf",
|
|
56
|
-
alternate: "#db2777",
|
|
57
|
-
help: "#818cf8",
|
|
58
|
-
success: "#10b981",
|
|
59
|
-
info: "#58a6ff",
|
|
60
|
-
warning: "#f3d371",
|
|
61
|
-
danger: "#D8314A",
|
|
62
|
-
fatal: "#a40e26",
|
|
63
|
-
link: "#3fa6ff",
|
|
64
|
-
positive: "#22c55e",
|
|
65
|
-
negative: "#dc2626",
|
|
66
|
-
gradient: ["#1fb2a6", "#db2777", "#818cf8"]
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
// ../config-tools/src/logger/chalk.ts
|
|
71
|
-
init_esm_shims();
|
|
72
|
-
import chalk from "chalk";
|
|
73
|
-
var chalkDefault = {
|
|
74
|
-
hex: (_) => (message) => message,
|
|
75
|
-
bgHex: (_) => ({
|
|
76
|
-
whiteBright: (message) => message,
|
|
77
|
-
white: (message) => message
|
|
78
|
-
}),
|
|
79
|
-
white: (message) => message,
|
|
80
|
-
whiteBright: (message) => message,
|
|
81
|
-
gray: (message) => message,
|
|
82
|
-
bold: {
|
|
83
|
-
hex: (_) => (message) => message,
|
|
84
|
-
bgHex: (_) => ({
|
|
85
|
-
whiteBright: (message) => message,
|
|
86
|
-
white: (message) => message
|
|
87
|
-
}),
|
|
88
|
-
whiteBright: (message) => message,
|
|
89
|
-
white: (message) => message
|
|
90
|
-
},
|
|
91
|
-
dim: {
|
|
92
|
-
hex: (_) => (message) => message,
|
|
93
|
-
gray: (message) => message
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
var getChalk = () => {
|
|
97
|
-
let _chalk = chalk;
|
|
98
|
-
if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
|
|
99
|
-
_chalk = chalkDefault;
|
|
100
|
-
}
|
|
101
|
-
return _chalk;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
// ../config-tools/src/logger/console-icons.ts
|
|
105
|
-
init_esm_shims();
|
|
106
|
-
|
|
107
|
-
// ../config-tools/src/logger/is-unicode-supported.ts
|
|
108
|
-
init_esm_shims();
|
|
109
|
-
function isUnicodeSupported() {
|
|
110
|
-
if (process.platform !== "win32") {
|
|
111
|
-
return process.env.TERM !== "linux";
|
|
112
|
-
}
|
|
113
|
-
return Boolean(process.env.WT_SESSION) || // Windows Terminal
|
|
114
|
-
Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
|
|
115
|
-
process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
|
|
116
|
-
process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// ../config-tools/src/logger/console-icons.ts
|
|
120
|
-
var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
|
|
121
|
-
var CONSOLE_ICONS = {
|
|
122
|
-
[LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
|
|
123
|
-
[LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
|
|
124
|
-
[LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
|
|
125
|
-
[LogLevelLabel.INFO]: useIcon("\u2139", "i"),
|
|
126
|
-
[LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
|
|
127
|
-
[LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
|
|
128
|
-
[LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
|
|
129
|
-
[LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
// ../config-tools/src/logger/format-timestamp.ts
|
|
133
|
-
init_esm_shims();
|
|
134
|
-
var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
|
|
135
|
-
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// ../config-tools/src/logger/get-log-level.ts
|
|
139
|
-
init_esm_shims();
|
|
140
|
-
var getLogLevel = (label) => {
|
|
141
|
-
switch (label) {
|
|
142
|
-
case "all":
|
|
143
|
-
return LogLevel.ALL;
|
|
144
|
-
case "trace":
|
|
145
|
-
return LogLevel.TRACE;
|
|
146
|
-
case "debug":
|
|
147
|
-
return LogLevel.DEBUG;
|
|
148
|
-
case "info":
|
|
149
|
-
return LogLevel.INFO;
|
|
150
|
-
case "warn":
|
|
151
|
-
return LogLevel.WARN;
|
|
152
|
-
case "error":
|
|
153
|
-
return LogLevel.ERROR;
|
|
154
|
-
case "fatal":
|
|
155
|
-
return LogLevel.FATAL;
|
|
156
|
-
case "silent":
|
|
157
|
-
return LogLevel.SILENT;
|
|
158
|
-
default:
|
|
159
|
-
return LogLevel.INFO;
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
|
|
163
|
-
if (logLevel >= LogLevel.ALL) {
|
|
164
|
-
return LogLevelLabel.ALL;
|
|
165
|
-
}
|
|
166
|
-
if (logLevel >= LogLevel.TRACE) {
|
|
167
|
-
return LogLevelLabel.TRACE;
|
|
168
|
-
}
|
|
169
|
-
if (logLevel >= LogLevel.DEBUG) {
|
|
170
|
-
return LogLevelLabel.DEBUG;
|
|
171
|
-
}
|
|
172
|
-
if (logLevel >= LogLevel.INFO) {
|
|
173
|
-
return LogLevelLabel.INFO;
|
|
174
|
-
}
|
|
175
|
-
if (logLevel >= LogLevel.WARN) {
|
|
176
|
-
return LogLevelLabel.WARN;
|
|
177
|
-
}
|
|
178
|
-
if (logLevel >= LogLevel.ERROR) {
|
|
179
|
-
return LogLevelLabel.ERROR;
|
|
180
|
-
}
|
|
181
|
-
if (logLevel >= LogLevel.FATAL) {
|
|
182
|
-
return LogLevelLabel.FATAL;
|
|
183
|
-
}
|
|
184
|
-
if (logLevel <= LogLevel.SILENT) {
|
|
185
|
-
return LogLevelLabel.SILENT;
|
|
186
|
-
}
|
|
187
|
-
return LogLevelLabel.INFO;
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
// ../config-tools/src/logger/console.ts
|
|
191
|
-
var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
|
|
192
|
-
const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
|
|
193
|
-
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|
|
194
|
-
if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
|
|
195
|
-
return (_) => {
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
|
|
199
|
-
return (message) => {
|
|
200
|
-
console.error(
|
|
201
|
-
`
|
|
202
|
-
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal)(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
203
|
-
`
|
|
204
|
-
);
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
|
|
208
|
-
return (message) => {
|
|
209
|
-
console.error(
|
|
210
|
-
`
|
|
211
|
-
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger)(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
212
|
-
`
|
|
213
|
-
);
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
|
|
217
|
-
return (message) => {
|
|
218
|
-
console.warn(
|
|
219
|
-
`
|
|
220
|
-
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning)(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
221
|
-
`
|
|
222
|
-
);
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
|
|
226
|
-
return (message) => {
|
|
227
|
-
console.info(
|
|
228
|
-
`
|
|
229
|
-
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? DEFAULT_COLOR_CONFIG.dark.success)(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
230
|
-
`
|
|
231
|
-
);
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
|
|
235
|
-
return (message) => {
|
|
236
|
-
console.info(
|
|
237
|
-
`
|
|
238
|
-
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
239
|
-
`
|
|
240
|
-
);
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
|
|
244
|
-
return (message) => {
|
|
245
|
-
console.debug(
|
|
246
|
-
`
|
|
247
|
-
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
248
|
-
`
|
|
249
|
-
);
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
|
|
253
|
-
return (message) => {
|
|
254
|
-
console.debug(
|
|
255
|
-
`
|
|
256
|
-
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
257
|
-
`
|
|
258
|
-
);
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
return (message) => {
|
|
262
|
-
console.log(
|
|
263
|
-
`
|
|
264
|
-
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand)(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
265
|
-
`
|
|
266
|
-
);
|
|
267
|
-
};
|
|
268
|
-
};
|
|
269
|
-
var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
|
|
270
|
-
var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
|
|
271
|
-
var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
|
|
272
|
-
var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
|
|
273
|
-
var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
|
|
274
|
-
var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
|
|
275
|
-
var getStopwatch = (name) => {
|
|
276
|
-
const start = process.hrtime();
|
|
277
|
-
return () => {
|
|
278
|
-
const end = process.hrtime(start);
|
|
279
|
-
console.info(
|
|
280
|
-
`
|
|
281
|
-
> \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(
|
|
282
|
-
end[0] * 1e3 + end[1] / 1e6
|
|
283
|
-
)}ms to complete
|
|
284
|
-
`
|
|
285
|
-
);
|
|
286
|
-
};
|
|
287
|
-
};
|
|
288
|
-
var MAX_DEPTH = 4;
|
|
289
|
-
var formatLogMessage = (message, options = {}, depth = 0) => {
|
|
290
|
-
if (depth > MAX_DEPTH) {
|
|
291
|
-
return "<max depth>";
|
|
292
|
-
}
|
|
293
|
-
const prefix = options.prefix ?? "-";
|
|
294
|
-
const skip = options.skip ?? [];
|
|
295
|
-
return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
|
|
296
|
-
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
|
|
297
|
-
${Object.keys(message).filter((key) => !skip.includes(key)).map(
|
|
298
|
-
(key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
|
|
299
|
-
message[key],
|
|
300
|
-
{ prefix: `${prefix}-`, skip },
|
|
301
|
-
depth + 1
|
|
302
|
-
) : message[key]}`
|
|
303
|
-
).join("\n")}` : message;
|
|
304
|
-
};
|
|
305
|
-
var _isFunction = (value) => {
|
|
306
|
-
try {
|
|
307
|
-
return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
|
|
308
|
-
} catch {
|
|
309
|
-
return false;
|
|
310
|
-
}
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
export {
|
|
314
|
-
LogLevel,
|
|
315
|
-
getLogLevel,
|
|
316
|
-
getLogLevelLabel,
|
|
317
|
-
writeFatal,
|
|
318
|
-
writeError,
|
|
319
|
-
writeWarning,
|
|
320
|
-
writeSuccess,
|
|
321
|
-
writeDebug,
|
|
322
|
-
writeTrace,
|
|
323
|
-
getStopwatch,
|
|
324
|
-
formatLogMessage
|
|
325
|
-
};
|
package/dist/chunk-JZ25TPTY.cjs
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/errors.ts
|
|
2
|
-
var _worker_threads = require('worker_threads');
|
|
3
|
-
var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
|
|
4
|
-
var PrettyError = class extends Error {
|
|
5
|
-
constructor(message) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.name = this.constructor.name;
|
|
8
|
-
if (typeof Error.captureStackTrace === "function") {
|
|
9
|
-
Error.captureStackTrace(this, this.constructor);
|
|
10
|
-
} else {
|
|
11
|
-
this.stack = new Error(message).stack;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
function handleError(error) {
|
|
16
|
-
if (error.loc) {
|
|
17
|
-
console.error(
|
|
18
|
-
_picocolors2.default.bold(
|
|
19
|
-
_picocolors2.default.red(
|
|
20
|
-
`Error parsing: ${error.loc.file}:${error.loc.line}:${error.loc.column}`
|
|
21
|
-
)
|
|
22
|
-
)
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
if (error.frame) {
|
|
26
|
-
console.error(_picocolors2.default.red(error.message));
|
|
27
|
-
console.error(_picocolors2.default.dim(error.frame));
|
|
28
|
-
} else if (error instanceof PrettyError) {
|
|
29
|
-
console.error(_picocolors2.default.red(error.message));
|
|
30
|
-
} else {
|
|
31
|
-
console.error(_picocolors2.default.red(error.stack));
|
|
32
|
-
}
|
|
33
|
-
process.exitCode = 1;
|
|
34
|
-
if (!_worker_threads.isMainThread && _worker_threads.parentPort) {
|
|
35
|
-
_worker_threads.parentPort.postMessage("error");
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
exports.PrettyError = PrettyError; exports.handleError = handleError;
|