rolldown 1.0.0-beta.1-commit.67a0051 → 1.0.0-beta.1-commit.2fe52d4
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/dist/cjs/cli.cjs +24 -25
- package/dist/cjs/experimental-index.cjs +3 -2
- package/dist/cjs/index.cjs +2 -1
- package/dist/cjs/parallel-plugin-worker.cjs +3 -2
- package/dist/cjs/parse-ast-index.cjs +59 -0
- package/dist/esm/cli.mjs +24 -25
- package/dist/esm/experimental-index.mjs +2 -1
- package/dist/esm/index.mjs +2 -1
- package/dist/esm/parallel-plugin-worker.mjs +2 -1
- package/dist/esm/parse-ast-index.mjs +56 -0
- package/dist/shared/binding-BMSG-hw7.mjs +530 -0
- package/dist/shared/binding-Cw1COxB5.cjs +575 -0
- package/dist/shared/{consola_36c0034f-BBnpcLZ5.cjs → consola_36c0034f-7VQAd79i.cjs} +7 -7
- package/dist/shared/{consola_36c0034f-BwyQ494_.mjs → consola_36c0034f-DJFB73x3.mjs} +7 -7
- package/dist/shared/{prompt-CqEsx-3v.mjs → prompt-CwUxfcCh.mjs} +7 -7
- package/dist/shared/{prompt-BKuli-WV.cjs → prompt-sP1wES-1.cjs} +7 -7
- package/dist/shared/{src-ed8l008o.cjs → src-Dck9jWki.cjs} +405 -890
- package/dist/shared/{src-BvPrj1a4.mjs → src-genj5En-.mjs} +379 -886
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/binding.d.ts +254 -0
- package/dist/types/log/logs.d.ts +1 -0
- package/dist/types/parse-ast-index.d.ts +4 -0
- package/dist/types/plugin/plugin-context.d.ts +8 -0
- package/dist/types/plugin/plugin-driver.d.ts +2 -2
- package/package.json +20 -14
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-qZFfknuJ.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/utils/code-frame.ts
|
|
4
|
+
function spaces(index) {
|
|
5
|
+
let result = "";
|
|
6
|
+
while (index--) result += " ";
|
|
7
|
+
return result;
|
|
8
|
+
}
|
|
9
|
+
function tabsToSpaces(value) {
|
|
10
|
+
return value.replace(/^\t+/, (match) => match.split(" ").join(" "));
|
|
11
|
+
}
|
|
12
|
+
const LINE_TRUNCATE_LENGTH = 120;
|
|
13
|
+
const MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
|
|
14
|
+
const ELLIPSIS = "...";
|
|
15
|
+
function getCodeFrame(source, line, column) {
|
|
16
|
+
let lines = source.split("\n");
|
|
17
|
+
if (line > lines.length) return "";
|
|
18
|
+
const maxLineLength = Math.max(tabsToSpaces(lines[line - 1].slice(0, column)).length + MIN_CHARACTERS_SHOWN_AFTER_LOCATION + ELLIPSIS.length, LINE_TRUNCATE_LENGTH);
|
|
19
|
+
const frameStart = Math.max(0, line - 3);
|
|
20
|
+
let frameEnd = Math.min(line + 2, lines.length);
|
|
21
|
+
lines = lines.slice(frameStart, frameEnd);
|
|
22
|
+
while (!/\S/.test(lines[lines.length - 1])) {
|
|
23
|
+
lines.pop();
|
|
24
|
+
frameEnd -= 1;
|
|
25
|
+
}
|
|
26
|
+
const digits = String(frameEnd).length;
|
|
27
|
+
return lines.map((sourceLine, index) => {
|
|
28
|
+
const isErrorLine = frameStart + index + 1 === line;
|
|
29
|
+
let lineNumber = String(index + frameStart + 1);
|
|
30
|
+
while (lineNumber.length < digits) lineNumber = ` ${lineNumber}`;
|
|
31
|
+
let displayedLine = tabsToSpaces(sourceLine);
|
|
32
|
+
if (displayedLine.length > maxLineLength) displayedLine = `${displayedLine.slice(0, maxLineLength - ELLIPSIS.length)}${ELLIPSIS}`;
|
|
33
|
+
if (isErrorLine) {
|
|
34
|
+
const indicator = spaces(digits + 2 + tabsToSpaces(sourceLine.slice(0, column)).length) + "^";
|
|
35
|
+
return `${lineNumber}: ${displayedLine}\n${indicator}`;
|
|
36
|
+
}
|
|
37
|
+
return `${lineNumber}: ${displayedLine}`;
|
|
38
|
+
}).join("\n");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/log/locate-character/index.js
|
|
43
|
+
/** @typedef {import('./types').Location} Location */
|
|
44
|
+
/**
|
|
45
|
+
* @param {import('./types').Range} range
|
|
46
|
+
* @param {number} index
|
|
47
|
+
*/
|
|
48
|
+
function rangeContains(range, index) {
|
|
49
|
+
return range.start <= index && index < range.end;
|
|
50
|
+
}
|
|
51
|
+
function getLocator(source, options = {}) {
|
|
52
|
+
const { offsetLine = 0, offsetColumn = 0 } = options;
|
|
53
|
+
let start = 0;
|
|
54
|
+
const ranges = source.split("\n").map((line, i$1) => {
|
|
55
|
+
const end = start + line.length + 1;
|
|
56
|
+
/** @type {import('./types').Range} */
|
|
57
|
+
const range = {
|
|
58
|
+
start,
|
|
59
|
+
end,
|
|
60
|
+
line: i$1
|
|
61
|
+
};
|
|
62
|
+
start = end;
|
|
63
|
+
return range;
|
|
64
|
+
});
|
|
65
|
+
let i = 0;
|
|
66
|
+
/**
|
|
67
|
+
* @param {string | number} search
|
|
68
|
+
* @param {number} [index]
|
|
69
|
+
* @returns {Location | undefined}
|
|
70
|
+
*/
|
|
71
|
+
function locator(search, index) {
|
|
72
|
+
if (typeof search === "string") search = source.indexOf(search, index ?? 0);
|
|
73
|
+
if (search === -1) return undefined;
|
|
74
|
+
let range = ranges[i];
|
|
75
|
+
const d = search >= range.end ? 1 : -1;
|
|
76
|
+
while (range) {
|
|
77
|
+
if (rangeContains(range, search)) return {
|
|
78
|
+
line: offsetLine + range.line,
|
|
79
|
+
column: offsetColumn + search - range.start,
|
|
80
|
+
character: search
|
|
81
|
+
};
|
|
82
|
+
i += d;
|
|
83
|
+
range = ranges[i];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return locator;
|
|
87
|
+
}
|
|
88
|
+
function locate(source, search, options) {
|
|
89
|
+
return getLocator(source, options)(search, options && options.startIndex);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/log/logs.ts
|
|
94
|
+
const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLY_NOTIFY_OPTION = "MULTIPLY_NOTIFY_OPTION", MINIFY_WARNING = "MINIFY_WARNING", PARSE_ERROR = "PARSE_ERROR";
|
|
95
|
+
function logParseError(message) {
|
|
96
|
+
return {
|
|
97
|
+
code: PARSE_ERROR,
|
|
98
|
+
message
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function logMinifyWarning() {
|
|
102
|
+
return {
|
|
103
|
+
code: MINIFY_WARNING,
|
|
104
|
+
message: "The built-in minifier is still under development. Setting \"minify: true\" is not recommended for production use."
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function logInvalidLogPosition(pluginName) {
|
|
108
|
+
return {
|
|
109
|
+
code: INVALID_LOG_POSITION,
|
|
110
|
+
message: `Plugin "${pluginName}" tried to add a file position to a log or warning. This is only supported in the "transform" hook at the moment and will be ignored.`
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function logInputHookInOutputPlugin(pluginName, hookName) {
|
|
114
|
+
return {
|
|
115
|
+
code: INPUT_HOOK_IN_OUTPUT_PLUGIN,
|
|
116
|
+
message: `The "${hookName}" hook used by the output plugin ${pluginName} is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.`
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function logCycleLoading(pluginName, moduleId) {
|
|
120
|
+
return {
|
|
121
|
+
code: CYCLE_LOADING,
|
|
122
|
+
message: `Found the module "${moduleId}" cycle loading at ${pluginName} plugin, it maybe blocking fetching modules.`
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function logMultiplyNotifyOption() {
|
|
126
|
+
return {
|
|
127
|
+
code: MULTIPLY_NOTIFY_OPTION,
|
|
128
|
+
message: `Found multiply notify option at watch options, using first one to start notify watcher.`
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function logPluginError(error$1, plugin, { hook, id } = {}) {
|
|
132
|
+
const code = error$1.code;
|
|
133
|
+
if (!error$1.pluginCode && code != null && (typeof code !== "string" || !code.startsWith("PLUGIN_"))) error$1.pluginCode = code;
|
|
134
|
+
error$1.code = PLUGIN_ERROR;
|
|
135
|
+
error$1.plugin = plugin;
|
|
136
|
+
if (hook) error$1.hook = hook;
|
|
137
|
+
if (id) error$1.id = id;
|
|
138
|
+
return error$1;
|
|
139
|
+
}
|
|
140
|
+
function error(base) {
|
|
141
|
+
if (!(base instanceof Error)) {
|
|
142
|
+
base = Object.assign(new Error(base.message), base);
|
|
143
|
+
Object.defineProperty(base, "name", {
|
|
144
|
+
value: "RollupError",
|
|
145
|
+
writable: true
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
throw base;
|
|
149
|
+
}
|
|
150
|
+
function augmentCodeLocation(properties, pos, source, id) {
|
|
151
|
+
if (typeof pos === "object") {
|
|
152
|
+
const { line, column } = pos;
|
|
153
|
+
properties.loc = {
|
|
154
|
+
column,
|
|
155
|
+
file: id,
|
|
156
|
+
line
|
|
157
|
+
};
|
|
158
|
+
} else {
|
|
159
|
+
properties.pos = pos;
|
|
160
|
+
const location = locate(source, pos, { offsetLine: 1 });
|
|
161
|
+
if (!location) return;
|
|
162
|
+
const { line, column } = location;
|
|
163
|
+
properties.loc = {
|
|
164
|
+
column,
|
|
165
|
+
file: id,
|
|
166
|
+
line
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
if (properties.frame === undefined) {
|
|
170
|
+
const { line, column } = properties.loc;
|
|
171
|
+
properties.frame = getCodeFrame(source, line, column);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/binding.js
|
|
177
|
+
var require_binding = require_chunk.__commonJS({ "src/binding.js"(exports, module) {
|
|
178
|
+
const { createRequire } = require("node:module");
|
|
179
|
+
require = createRequire(__filename);
|
|
180
|
+
const { readFileSync } = require("node:fs");
|
|
181
|
+
let nativeBinding = null;
|
|
182
|
+
const loadErrors = [];
|
|
183
|
+
const isMusl = () => {
|
|
184
|
+
let musl = false;
|
|
185
|
+
if (process.platform === "linux") {
|
|
186
|
+
musl = isMuslFromFilesystem();
|
|
187
|
+
if (musl === null) musl = isMuslFromReport();
|
|
188
|
+
if (musl === null) musl = isMuslFromChildProcess();
|
|
189
|
+
}
|
|
190
|
+
return musl;
|
|
191
|
+
};
|
|
192
|
+
const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
|
|
193
|
+
const isMuslFromFilesystem = () => {
|
|
194
|
+
try {
|
|
195
|
+
return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
|
|
196
|
+
} catch {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
const isMuslFromReport = () => {
|
|
201
|
+
const report = typeof process.report.getReport === "function" ? process.report.getReport() : null;
|
|
202
|
+
if (!report) return null;
|
|
203
|
+
if (report.header && report.header.glibcVersionRuntime) return false;
|
|
204
|
+
if (Array.isArray(report.sharedObjects)) {
|
|
205
|
+
if (report.sharedObjects.some(isFileMusl)) return true;
|
|
206
|
+
}
|
|
207
|
+
return false;
|
|
208
|
+
};
|
|
209
|
+
const isMuslFromChildProcess = () => {
|
|
210
|
+
try {
|
|
211
|
+
return require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
|
|
212
|
+
} catch (e) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
function requireNative() {
|
|
217
|
+
if (process.platform === "android") if (process.arch === "arm64") {
|
|
218
|
+
try {
|
|
219
|
+
return require("./rolldown-binding.android-arm64.node");
|
|
220
|
+
} catch (e) {
|
|
221
|
+
loadErrors.push(e);
|
|
222
|
+
}
|
|
223
|
+
try {
|
|
224
|
+
return require("@rolldown/binding-android-arm64");
|
|
225
|
+
} catch (e) {
|
|
226
|
+
loadErrors.push(e);
|
|
227
|
+
}
|
|
228
|
+
} else if (process.arch === "arm") {
|
|
229
|
+
try {
|
|
230
|
+
return require("./rolldown-binding.android-arm-eabi.node");
|
|
231
|
+
} catch (e) {
|
|
232
|
+
loadErrors.push(e);
|
|
233
|
+
}
|
|
234
|
+
try {
|
|
235
|
+
return require("@rolldown/binding-android-arm-eabi");
|
|
236
|
+
} catch (e) {
|
|
237
|
+
loadErrors.push(e);
|
|
238
|
+
}
|
|
239
|
+
} else loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`));
|
|
240
|
+
else if (process.platform === "win32") if (process.arch === "x64") {
|
|
241
|
+
try {
|
|
242
|
+
return require("./rolldown-binding.win32-x64-msvc.node");
|
|
243
|
+
} catch (e) {
|
|
244
|
+
loadErrors.push(e);
|
|
245
|
+
}
|
|
246
|
+
try {
|
|
247
|
+
return require("@rolldown/binding-win32-x64-msvc");
|
|
248
|
+
} catch (e) {
|
|
249
|
+
loadErrors.push(e);
|
|
250
|
+
}
|
|
251
|
+
} else if (process.arch === "ia32") {
|
|
252
|
+
try {
|
|
253
|
+
return require("./rolldown-binding.win32-ia32-msvc.node");
|
|
254
|
+
} catch (e) {
|
|
255
|
+
loadErrors.push(e);
|
|
256
|
+
}
|
|
257
|
+
try {
|
|
258
|
+
return require("@rolldown/binding-win32-ia32-msvc");
|
|
259
|
+
} catch (e) {
|
|
260
|
+
loadErrors.push(e);
|
|
261
|
+
}
|
|
262
|
+
} else if (process.arch === "arm64") {
|
|
263
|
+
try {
|
|
264
|
+
return require("./rolldown-binding.win32-arm64-msvc.node");
|
|
265
|
+
} catch (e) {
|
|
266
|
+
loadErrors.push(e);
|
|
267
|
+
}
|
|
268
|
+
try {
|
|
269
|
+
return require("@rolldown/binding-win32-arm64-msvc");
|
|
270
|
+
} catch (e) {
|
|
271
|
+
loadErrors.push(e);
|
|
272
|
+
}
|
|
273
|
+
} else loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));
|
|
274
|
+
else if (process.platform === "darwin") {
|
|
275
|
+
try {
|
|
276
|
+
return require("./rolldown-binding.darwin-universal.node");
|
|
277
|
+
} catch (e) {
|
|
278
|
+
loadErrors.push(e);
|
|
279
|
+
}
|
|
280
|
+
try {
|
|
281
|
+
return require("@rolldown/binding-darwin-universal");
|
|
282
|
+
} catch (e) {
|
|
283
|
+
loadErrors.push(e);
|
|
284
|
+
}
|
|
285
|
+
if (process.arch === "x64") {
|
|
286
|
+
try {
|
|
287
|
+
return require("./rolldown-binding.darwin-x64.node");
|
|
288
|
+
} catch (e) {
|
|
289
|
+
loadErrors.push(e);
|
|
290
|
+
}
|
|
291
|
+
try {
|
|
292
|
+
return require("@rolldown/binding-darwin-x64");
|
|
293
|
+
} catch (e) {
|
|
294
|
+
loadErrors.push(e);
|
|
295
|
+
}
|
|
296
|
+
} else if (process.arch === "arm64") {
|
|
297
|
+
try {
|
|
298
|
+
return require("./rolldown-binding.darwin-arm64.node");
|
|
299
|
+
} catch (e) {
|
|
300
|
+
loadErrors.push(e);
|
|
301
|
+
}
|
|
302
|
+
try {
|
|
303
|
+
return require("@rolldown/binding-darwin-arm64");
|
|
304
|
+
} catch (e) {
|
|
305
|
+
loadErrors.push(e);
|
|
306
|
+
}
|
|
307
|
+
} else loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`));
|
|
308
|
+
} else if (process.platform === "freebsd") if (process.arch === "x64") {
|
|
309
|
+
try {
|
|
310
|
+
return require("./rolldown-binding.freebsd-x64.node");
|
|
311
|
+
} catch (e) {
|
|
312
|
+
loadErrors.push(e);
|
|
313
|
+
}
|
|
314
|
+
try {
|
|
315
|
+
return require("@rolldown/binding-freebsd-x64");
|
|
316
|
+
} catch (e) {
|
|
317
|
+
loadErrors.push(e);
|
|
318
|
+
}
|
|
319
|
+
} else if (process.arch === "arm64") {
|
|
320
|
+
try {
|
|
321
|
+
return require("./rolldown-binding.freebsd-arm64.node");
|
|
322
|
+
} catch (e) {
|
|
323
|
+
loadErrors.push(e);
|
|
324
|
+
}
|
|
325
|
+
try {
|
|
326
|
+
return require("@rolldown/binding-freebsd-arm64");
|
|
327
|
+
} catch (e) {
|
|
328
|
+
loadErrors.push(e);
|
|
329
|
+
}
|
|
330
|
+
} else loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
|
|
331
|
+
else if (process.platform === "linux") if (process.arch === "x64") if (isMusl()) {
|
|
332
|
+
try {
|
|
333
|
+
return require("./rolldown-binding.linux-x64-musl.node");
|
|
334
|
+
} catch (e) {
|
|
335
|
+
loadErrors.push(e);
|
|
336
|
+
}
|
|
337
|
+
try {
|
|
338
|
+
return require("@rolldown/binding-linux-x64-musl");
|
|
339
|
+
} catch (e) {
|
|
340
|
+
loadErrors.push(e);
|
|
341
|
+
}
|
|
342
|
+
} else {
|
|
343
|
+
try {
|
|
344
|
+
return require("./rolldown-binding.linux-x64-gnu.node");
|
|
345
|
+
} catch (e) {
|
|
346
|
+
loadErrors.push(e);
|
|
347
|
+
}
|
|
348
|
+
try {
|
|
349
|
+
return require("@rolldown/binding-linux-x64-gnu");
|
|
350
|
+
} catch (e) {
|
|
351
|
+
loadErrors.push(e);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
else if (process.arch === "arm64") if (isMusl()) {
|
|
355
|
+
try {
|
|
356
|
+
return require("./rolldown-binding.linux-arm64-musl.node");
|
|
357
|
+
} catch (e) {
|
|
358
|
+
loadErrors.push(e);
|
|
359
|
+
}
|
|
360
|
+
try {
|
|
361
|
+
return require("@rolldown/binding-linux-arm64-musl");
|
|
362
|
+
} catch (e) {
|
|
363
|
+
loadErrors.push(e);
|
|
364
|
+
}
|
|
365
|
+
} else {
|
|
366
|
+
try {
|
|
367
|
+
return require("./rolldown-binding.linux-arm64-gnu.node");
|
|
368
|
+
} catch (e) {
|
|
369
|
+
loadErrors.push(e);
|
|
370
|
+
}
|
|
371
|
+
try {
|
|
372
|
+
return require("@rolldown/binding-linux-arm64-gnu");
|
|
373
|
+
} catch (e) {
|
|
374
|
+
loadErrors.push(e);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
else if (process.arch === "arm") if (isMusl()) {
|
|
378
|
+
try {
|
|
379
|
+
return require("./rolldown-binding.linux-arm-musleabihf.node");
|
|
380
|
+
} catch (e) {
|
|
381
|
+
loadErrors.push(e);
|
|
382
|
+
}
|
|
383
|
+
try {
|
|
384
|
+
return require("@rolldown/binding-linux-arm-musleabihf");
|
|
385
|
+
} catch (e) {
|
|
386
|
+
loadErrors.push(e);
|
|
387
|
+
}
|
|
388
|
+
} else {
|
|
389
|
+
try {
|
|
390
|
+
return require("./rolldown-binding.linux-arm-gnueabihf.node");
|
|
391
|
+
} catch (e) {
|
|
392
|
+
loadErrors.push(e);
|
|
393
|
+
}
|
|
394
|
+
try {
|
|
395
|
+
return require("@rolldown/binding-linux-arm-gnueabihf");
|
|
396
|
+
} catch (e) {
|
|
397
|
+
loadErrors.push(e);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
else if (process.arch === "riscv64") if (isMusl()) {
|
|
401
|
+
try {
|
|
402
|
+
return require("./rolldown-binding.linux-riscv64-musl.node");
|
|
403
|
+
} catch (e) {
|
|
404
|
+
loadErrors.push(e);
|
|
405
|
+
}
|
|
406
|
+
try {
|
|
407
|
+
return require("@rolldown/binding-linux-riscv64-musl");
|
|
408
|
+
} catch (e) {
|
|
409
|
+
loadErrors.push(e);
|
|
410
|
+
}
|
|
411
|
+
} else {
|
|
412
|
+
try {
|
|
413
|
+
return require("./rolldown-binding.linux-riscv64-gnu.node");
|
|
414
|
+
} catch (e) {
|
|
415
|
+
loadErrors.push(e);
|
|
416
|
+
}
|
|
417
|
+
try {
|
|
418
|
+
return require("@rolldown/binding-linux-riscv64-gnu");
|
|
419
|
+
} catch (e) {
|
|
420
|
+
loadErrors.push(e);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
else if (process.arch === "ppc64") {
|
|
424
|
+
try {
|
|
425
|
+
return require("./rolldown-binding.linux-ppc64-gnu.node");
|
|
426
|
+
} catch (e) {
|
|
427
|
+
loadErrors.push(e);
|
|
428
|
+
}
|
|
429
|
+
try {
|
|
430
|
+
return require("@rolldown/binding-linux-ppc64-gnu");
|
|
431
|
+
} catch (e) {
|
|
432
|
+
loadErrors.push(e);
|
|
433
|
+
}
|
|
434
|
+
} else if (process.arch === "s390x") {
|
|
435
|
+
try {
|
|
436
|
+
return require("./rolldown-binding.linux-s390x-gnu.node");
|
|
437
|
+
} catch (e) {
|
|
438
|
+
loadErrors.push(e);
|
|
439
|
+
}
|
|
440
|
+
try {
|
|
441
|
+
return require("@rolldown/binding-linux-s390x-gnu");
|
|
442
|
+
} catch (e) {
|
|
443
|
+
loadErrors.push(e);
|
|
444
|
+
}
|
|
445
|
+
} else loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));
|
|
446
|
+
else loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
|
|
447
|
+
}
|
|
448
|
+
nativeBinding = requireNative();
|
|
449
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
450
|
+
try {
|
|
451
|
+
nativeBinding = require("./rolldown-binding.wasi.cjs");
|
|
452
|
+
} catch (err) {
|
|
453
|
+
if (process.env.NAPI_RS_FORCE_WASI) loadErrors.push(err);
|
|
454
|
+
}
|
|
455
|
+
if (!nativeBinding) try {
|
|
456
|
+
nativeBinding = require("@rolldown/binding-wasm32-wasi");
|
|
457
|
+
} catch (err) {
|
|
458
|
+
if (process.env.NAPI_RS_FORCE_WASI) loadErrors.push(err);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
if (!nativeBinding) {
|
|
462
|
+
if (loadErrors.length > 0) throw new Error("Failed to load native binding", { cause: loadErrors });
|
|
463
|
+
throw new Error(`Failed to load native binding`);
|
|
464
|
+
}
|
|
465
|
+
module.exports.BindingBundleEndEventData = nativeBinding.BindingBundleEndEventData;
|
|
466
|
+
module.exports.BindingCallableBuiltinPlugin = nativeBinding.BindingCallableBuiltinPlugin;
|
|
467
|
+
module.exports.BindingError = nativeBinding.BindingError;
|
|
468
|
+
module.exports.BindingLog = nativeBinding.BindingLog;
|
|
469
|
+
module.exports.BindingModuleInfo = nativeBinding.BindingModuleInfo;
|
|
470
|
+
module.exports.BindingNormalizedOptions = nativeBinding.BindingNormalizedOptions;
|
|
471
|
+
module.exports.BindingOutputAsset = nativeBinding.BindingOutputAsset;
|
|
472
|
+
module.exports.BindingOutputChunk = nativeBinding.BindingOutputChunk;
|
|
473
|
+
module.exports.BindingOutputs = nativeBinding.BindingOutputs;
|
|
474
|
+
module.exports.BindingPluginContext = nativeBinding.BindingPluginContext;
|
|
475
|
+
module.exports.BindingRenderedModule = nativeBinding.BindingRenderedModule;
|
|
476
|
+
module.exports.BindingTransformPluginContext = nativeBinding.BindingTransformPluginContext;
|
|
477
|
+
module.exports.BindingWatcher = nativeBinding.BindingWatcher;
|
|
478
|
+
module.exports.BindingWatcherChangeData = nativeBinding.BindingWatcherChangeData;
|
|
479
|
+
module.exports.BindingWatcherEvent = nativeBinding.BindingWatcherEvent;
|
|
480
|
+
module.exports.Bundler = nativeBinding.Bundler;
|
|
481
|
+
module.exports.MagicString = nativeBinding.MagicString;
|
|
482
|
+
module.exports.ParallelJsPluginRegistry = nativeBinding.ParallelJsPluginRegistry;
|
|
483
|
+
module.exports.ParseResult = nativeBinding.ParseResult;
|
|
484
|
+
module.exports.RenderedChunk = nativeBinding.RenderedChunk;
|
|
485
|
+
module.exports.BindingBuiltinPluginName = nativeBinding.BindingBuiltinPluginName;
|
|
486
|
+
module.exports.BindingHookSideEffects = nativeBinding.BindingHookSideEffects;
|
|
487
|
+
module.exports.BindingLogLevel = nativeBinding.BindingLogLevel;
|
|
488
|
+
module.exports.BindingPluginOrder = nativeBinding.BindingPluginOrder;
|
|
489
|
+
module.exports.ExportExportNameKind = nativeBinding.ExportExportNameKind;
|
|
490
|
+
module.exports.ExportImportNameKind = nativeBinding.ExportImportNameKind;
|
|
491
|
+
module.exports.ExportLocalNameKind = nativeBinding.ExportLocalNameKind;
|
|
492
|
+
module.exports.HelperMode = nativeBinding.HelperMode;
|
|
493
|
+
module.exports.ImportNameKind = nativeBinding.ImportNameKind;
|
|
494
|
+
module.exports.isolatedDeclaration = nativeBinding.isolatedDeclaration;
|
|
495
|
+
module.exports.parseAsync = nativeBinding.parseAsync;
|
|
496
|
+
module.exports.parseSync = nativeBinding.parseSync;
|
|
497
|
+
module.exports.parseWithoutReturn = nativeBinding.parseWithoutReturn;
|
|
498
|
+
module.exports.registerPlugins = nativeBinding.registerPlugins;
|
|
499
|
+
module.exports.Severity = nativeBinding.Severity;
|
|
500
|
+
module.exports.transform = nativeBinding.transform;
|
|
501
|
+
} });
|
|
502
|
+
|
|
503
|
+
//#endregion
|
|
504
|
+
Object.defineProperty(exports, 'augmentCodeLocation', {
|
|
505
|
+
enumerable: true,
|
|
506
|
+
get: function () {
|
|
507
|
+
return augmentCodeLocation;
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
Object.defineProperty(exports, 'error', {
|
|
511
|
+
enumerable: true,
|
|
512
|
+
get: function () {
|
|
513
|
+
return error;
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
Object.defineProperty(exports, 'getCodeFrame', {
|
|
517
|
+
enumerable: true,
|
|
518
|
+
get: function () {
|
|
519
|
+
return getCodeFrame;
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
Object.defineProperty(exports, 'locate', {
|
|
523
|
+
enumerable: true,
|
|
524
|
+
get: function () {
|
|
525
|
+
return locate;
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
Object.defineProperty(exports, 'logCycleLoading', {
|
|
529
|
+
enumerable: true,
|
|
530
|
+
get: function () {
|
|
531
|
+
return logCycleLoading;
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
Object.defineProperty(exports, 'logInputHookInOutputPlugin', {
|
|
535
|
+
enumerable: true,
|
|
536
|
+
get: function () {
|
|
537
|
+
return logInputHookInOutputPlugin;
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
Object.defineProperty(exports, 'logInvalidLogPosition', {
|
|
541
|
+
enumerable: true,
|
|
542
|
+
get: function () {
|
|
543
|
+
return logInvalidLogPosition;
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
Object.defineProperty(exports, 'logMinifyWarning', {
|
|
547
|
+
enumerable: true,
|
|
548
|
+
get: function () {
|
|
549
|
+
return logMinifyWarning;
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
Object.defineProperty(exports, 'logMultiplyNotifyOption', {
|
|
553
|
+
enumerable: true,
|
|
554
|
+
get: function () {
|
|
555
|
+
return logMultiplyNotifyOption;
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
Object.defineProperty(exports, 'logParseError', {
|
|
559
|
+
enumerable: true,
|
|
560
|
+
get: function () {
|
|
561
|
+
return logParseError;
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
Object.defineProperty(exports, 'logPluginError', {
|
|
565
|
+
enumerable: true,
|
|
566
|
+
get: function () {
|
|
567
|
+
return logPluginError;
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
Object.defineProperty(exports, 'require_binding', {
|
|
571
|
+
enumerable: true,
|
|
572
|
+
get: function () {
|
|
573
|
+
return require_binding;
|
|
574
|
+
}
|
|
575
|
+
});
|
|
@@ -50,8 +50,8 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
|
50
50
|
if (value === null || value === void 0) continue;
|
|
51
51
|
if (merger && merger(object, key, value, namespace)) continue;
|
|
52
52
|
if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
|
|
53
|
-
else if (isObject(value) && isObject(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
54
|
-
else object[key] = value;
|
|
53
|
+
else if (isObject(value) && isObject(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
54
|
+
else object[key] = value;
|
|
55
55
|
}
|
|
56
56
|
return object;
|
|
57
57
|
}
|
|
@@ -227,7 +227,7 @@ var Consola = class Consola {
|
|
|
227
227
|
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
228
228
|
};
|
|
229
229
|
if (!isRaw && args.length === 1 && isLogObj(args[0])) Object.assign(logObj, args[0]);
|
|
230
|
-
else logObj.args = [...args];
|
|
230
|
+
else logObj.args = [...args];
|
|
231
231
|
if (logObj.message) {
|
|
232
232
|
logObj.args.unshift(logObj.message);
|
|
233
233
|
delete logObj.message;
|
|
@@ -525,7 +525,7 @@ function box(text, _opts = {}) {
|
|
|
525
525
|
} else boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
|
|
526
526
|
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
527
527
|
for (let i = 0; i < height; i++) if (i < valignOffset || i >= valignOffset + textLines.length) boxLines.push(`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`);
|
|
528
|
-
else {
|
|
528
|
+
else {
|
|
529
529
|
const line = textLines[i - valignOffset];
|
|
530
530
|
const left = " ".repeat(paddingOffset);
|
|
531
531
|
const right = " ".repeat(width - stripAnsi$1(line).length);
|
|
@@ -662,7 +662,7 @@ var eastasianwidth = { exports: {} };
|
|
|
662
662
|
eaw.characterLength = function(character) {
|
|
663
663
|
var code = this.eastAsianWidth(character);
|
|
664
664
|
if (code == "F" || code == "W" || code == "A") return 2;
|
|
665
|
-
else return 1;
|
|
665
|
+
else return 1;
|
|
666
666
|
};
|
|
667
667
|
function stringToArray(string) {
|
|
668
668
|
return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
@@ -686,7 +686,7 @@ else return 1;
|
|
|
686
686
|
var char = chars[i];
|
|
687
687
|
var charLen = eaw.length(char);
|
|
688
688
|
if (eawLen >= start - (charLen == 2 ? 1 : 0)) if (eawLen + charLen <= end) result += char;
|
|
689
|
-
else break;
|
|
689
|
+
else break;
|
|
690
690
|
eawLen += charLen;
|
|
691
691
|
}
|
|
692
692
|
return result;
|
|
@@ -818,7 +818,7 @@ function createConsola(options = {}) {
|
|
|
818
818
|
stdout: process.stdout,
|
|
819
819
|
stderr: process.stderr,
|
|
820
820
|
prompt: (...args) => Promise.resolve().then(function() {
|
|
821
|
-
return require("./prompt-
|
|
821
|
+
return require("./prompt-sP1wES-1.cjs");
|
|
822
822
|
}).then((m) => m.prompt(...args)),
|
|
823
823
|
reporters: options.reporters || [options.fancy ?? !(isCI || isTest) ? new FancyReporter() : new BasicReporter()],
|
|
824
824
|
...options
|
|
@@ -48,8 +48,8 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
|
48
48
|
if (value === null || value === void 0) continue;
|
|
49
49
|
if (merger && merger(object, key, value, namespace)) continue;
|
|
50
50
|
if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
|
|
51
|
-
else if (isObject(value) && isObject(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
52
|
-
else object[key] = value;
|
|
51
|
+
else if (isObject(value) && isObject(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
52
|
+
else object[key] = value;
|
|
53
53
|
}
|
|
54
54
|
return object;
|
|
55
55
|
}
|
|
@@ -225,7 +225,7 @@ var Consola = class Consola {
|
|
|
225
225
|
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
226
226
|
};
|
|
227
227
|
if (!isRaw && args.length === 1 && isLogObj(args[0])) Object.assign(logObj, args[0]);
|
|
228
|
-
else logObj.args = [...args];
|
|
228
|
+
else logObj.args = [...args];
|
|
229
229
|
if (logObj.message) {
|
|
230
230
|
logObj.args.unshift(logObj.message);
|
|
231
231
|
delete logObj.message;
|
|
@@ -523,7 +523,7 @@ function box(text, _opts = {}) {
|
|
|
523
523
|
} else boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
|
|
524
524
|
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
525
525
|
for (let i = 0; i < height; i++) if (i < valignOffset || i >= valignOffset + textLines.length) boxLines.push(`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`);
|
|
526
|
-
else {
|
|
526
|
+
else {
|
|
527
527
|
const line = textLines[i - valignOffset];
|
|
528
528
|
const left = " ".repeat(paddingOffset);
|
|
529
529
|
const right = " ".repeat(width - stripAnsi$1(line).length);
|
|
@@ -660,7 +660,7 @@ var eastasianwidth = { exports: {} };
|
|
|
660
660
|
eaw.characterLength = function(character) {
|
|
661
661
|
var code = this.eastAsianWidth(character);
|
|
662
662
|
if (code == "F" || code == "W" || code == "A") return 2;
|
|
663
|
-
else return 1;
|
|
663
|
+
else return 1;
|
|
664
664
|
};
|
|
665
665
|
function stringToArray(string) {
|
|
666
666
|
return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
@@ -684,7 +684,7 @@ else return 1;
|
|
|
684
684
|
var char = chars[i];
|
|
685
685
|
var charLen = eaw.length(char);
|
|
686
686
|
if (eawLen >= start - (charLen == 2 ? 1 : 0)) if (eawLen + charLen <= end) result += char;
|
|
687
|
-
else break;
|
|
687
|
+
else break;
|
|
688
688
|
eawLen += charLen;
|
|
689
689
|
}
|
|
690
690
|
return result;
|
|
@@ -815,7 +815,7 @@ function createConsola(options = {}) {
|
|
|
815
815
|
defaults: { level },
|
|
816
816
|
stdout: process.stdout,
|
|
817
817
|
stderr: process.stderr,
|
|
818
|
-
prompt: (...args) => import("./prompt-
|
|
818
|
+
prompt: (...args) => import("./prompt-CwUxfcCh.mjs").then((m) => m.prompt(...args)),
|
|
819
819
|
reporters: options.reporters || [options.fancy ?? !(isCI || isTest) ? new FancyReporter() : new BasicReporter()],
|
|
820
820
|
...options
|
|
821
821
|
});
|