rolldown 1.0.0-beta.31 → 1.0.0-beta.32
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/cli.cjs +5 -5
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +7 -6
- package/dist/config.cjs +3 -3
- package/dist/config.d.cts +2 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/experimental-index.cjs +2 -2
- package/dist/experimental-index.d.cts +2 -2
- package/dist/experimental-index.d.mts +2 -2
- package/dist/experimental-index.mjs +2 -2
- package/dist/experimental-runtime-types.d.ts +7 -4
- package/dist/filter-index.d.cts +2 -2
- package/dist/filter-index.d.mts +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/parallel-plugin-worker.cjs +2 -2
- package/dist/parallel-plugin-worker.d.cts +1 -1
- package/dist/parallel-plugin-worker.d.mts +1 -1
- package/dist/parallel-plugin-worker.mjs +4 -3
- package/dist/parallel-plugin.d.cts +2 -2
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.cjs +1 -1
- package/dist/parse-ast-index.d.cts +1 -1
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/shared/{binding-B2f_h9DF.d.mts → binding-BEeJNtY4.d.mts} +2 -0
- package/dist/shared/{binding-CCkTRaSB.d.cts → binding-CRMJJtol.d.cts} +2 -0
- package/dist/shared/{define-config-BSYGonXk.d.mts → define-config-Cf8iQFTl.d.mts} +18 -4
- package/dist/shared/{define-config-BzVT47Bj.d.cts → define-config-Dw9PP95x.d.cts} +18 -4
- package/dist/shared/{load-config-DL286H4s.mjs → load-config-BF8LOHEy.mjs} +1 -1
- package/dist/shared/{load-config-BpWL-vMP.cjs → load-config-Dl9pIpnr.cjs} +1 -1
- package/dist/shared/{parse-ast-index-B-b57oWx.mjs → parse-ast-index-Ch2Zs4Nn.mjs} +96 -27
- package/dist/shared/{parse-ast-index-CKLoWOY8.cjs → parse-ast-index-Cn-35Vbp.cjs} +96 -27
- package/dist/shared/{src-D5CeiA1y.cjs → src-CsEb-TS_.cjs} +78 -67
- package/dist/shared/{src-Cs-HV-Wp.mjs → src-p50l1OMU.mjs} +78 -67
- package/package.json +26 -25
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-DDkG_k5U.cjs');
|
|
2
|
-
const require_parse_ast_index = require('./parse-ast-index-
|
|
2
|
+
const require_parse_ast_index = require('./parse-ast-index-Cn-35Vbp.cjs');
|
|
3
3
|
const require_misc = require('./misc-DksvspN4.cjs');
|
|
4
4
|
const node_path = require_chunk.__toESM(require("node:path"));
|
|
5
5
|
const node_url = require_chunk.__toESM(require("node:url"));
|
|
@@ -10,7 +10,7 @@ const node_os = require_chunk.__toESM(require("node:os"));
|
|
|
10
10
|
const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
|
|
11
11
|
|
|
12
12
|
//#region package.json
|
|
13
|
-
var version = "1.0.0-beta.
|
|
13
|
+
var version = "1.0.0-beta.32";
|
|
14
14
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
@@ -29,8 +29,16 @@ function isReadonlyArray(input) {
|
|
|
29
29
|
function makeBuiltinPluginCallable(plugin) {
|
|
30
30
|
let callablePlugin = new require_parse_ast_index.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
31
31
|
const wrappedPlugin = plugin;
|
|
32
|
-
for (const key in callablePlugin) wrappedPlugin[key] = function(...args$1) {
|
|
33
|
-
|
|
32
|
+
for (const key in callablePlugin) wrappedPlugin[key] = async function(...args$1) {
|
|
33
|
+
try {
|
|
34
|
+
return await callablePlugin[key](...args$1);
|
|
35
|
+
} catch (e$1) {
|
|
36
|
+
if (e$1 instanceof Error && !e$1.stack?.includes("at ")) Error.captureStackTrace(e$1, wrappedPlugin[key]);
|
|
37
|
+
return require_parse_ast_index.error(require_parse_ast_index.logPluginError(e$1, plugin.name, {
|
|
38
|
+
hook: key,
|
|
39
|
+
id: key === "transform" ? args$1[2] : void 0
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
34
42
|
};
|
|
35
43
|
return wrappedPlugin;
|
|
36
44
|
}
|
|
@@ -345,8 +353,8 @@ var MinimalPluginContextImpl = class {
|
|
|
345
353
|
watchMode
|
|
346
354
|
};
|
|
347
355
|
}
|
|
348
|
-
error(e) {
|
|
349
|
-
return require_parse_ast_index.error(require_parse_ast_index.logPluginError(normalizeLog(e), this.pluginName, { hook: this.hookName }));
|
|
356
|
+
error(e$1) {
|
|
357
|
+
return require_parse_ast_index.error(require_parse_ast_index.logPluginError(normalizeLog(e$1), this.pluginName, { hook: this.hookName }));
|
|
350
358
|
}
|
|
351
359
|
};
|
|
352
360
|
|
|
@@ -2037,7 +2045,8 @@ const InputCliOverrideSchema = strictObject({
|
|
|
2037
2045
|
literal("react-jsx"),
|
|
2038
2046
|
literal("preserve")
|
|
2039
2047
|
])), description("Jsx options preset")),
|
|
2040
|
-
preserveEntrySignatures: pipe(optional(union([literal(false)])), description("Avoid facade chunks for entry points"))
|
|
2048
|
+
preserveEntrySignatures: pipe(optional(union([literal(false)])), description("Avoid facade chunks for entry points")),
|
|
2049
|
+
context: pipe(optional(string()), description("The entity top-level `this` represents."))
|
|
2041
2050
|
});
|
|
2042
2051
|
const InputCliOptionsSchema = omit(strictObject({
|
|
2043
2052
|
...InputOptionsSchema.entries,
|
|
@@ -2066,6 +2075,7 @@ const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([cust
|
|
|
2066
2075
|
const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
|
|
2067
2076
|
const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
2068
2077
|
const AdvancedChunksSchema = strictObject({
|
|
2078
|
+
includeDependenciesRecursively: optional(boolean()),
|
|
2069
2079
|
minSize: optional(number()),
|
|
2070
2080
|
maxSize: optional(number()),
|
|
2071
2081
|
minModuleSize: optional(number()),
|
|
@@ -2201,7 +2211,7 @@ function validateOption(key, options) {
|
|
|
2201
2211
|
const issuePaths = issue.path.map((path$2) => path$2.key);
|
|
2202
2212
|
let issueMsg = issue.message;
|
|
2203
2213
|
if (issue.type === "union") {
|
|
2204
|
-
const subIssue = issue.issues?.find((i
|
|
2214
|
+
const subIssue = issue.issues?.find((i) => !(i.type !== issue.received && i.input === issue.input));
|
|
2205
2215
|
if (subIssue) {
|
|
2206
2216
|
if (subIssue.path) issuePaths.push(subIssue.path.map((path$2) => path$2.key));
|
|
2207
2217
|
issueMsg = subIssue.message;
|
|
@@ -2244,19 +2254,19 @@ function bindingifySourcemap$1(map) {
|
|
|
2244
2254
|
//#endregion
|
|
2245
2255
|
//#region src/utils/error.ts
|
|
2246
2256
|
function normalizeErrors(rawErrors) {
|
|
2247
|
-
const errors = rawErrors.map((e) => e instanceof Error ? e : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2248
|
-
kind: e.kind,
|
|
2249
|
-
message: e.message,
|
|
2257
|
+
const errors = rawErrors.map((e$1) => e$1 instanceof Error ? e$1 : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2258
|
+
kind: e$1.kind,
|
|
2259
|
+
message: e$1.message,
|
|
2250
2260
|
stack: void 0
|
|
2251
2261
|
}));
|
|
2252
2262
|
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
2253
|
-
for (let i
|
|
2263
|
+
for (let i = 0; i < errors.length; i++) {
|
|
2254
2264
|
summary += "\n";
|
|
2255
|
-
if (i
|
|
2265
|
+
if (i >= 5) {
|
|
2256
2266
|
summary += "...";
|
|
2257
2267
|
break;
|
|
2258
2268
|
}
|
|
2259
|
-
summary += getErrorMessage(errors[i
|
|
2269
|
+
summary += getErrorMessage(errors[i]);
|
|
2260
2270
|
}
|
|
2261
2271
|
const wrapper = new Error(summary);
|
|
2262
2272
|
Object.defineProperty(wrapper, "errors", {
|
|
@@ -2271,20 +2281,20 @@ function normalizeErrors(rawErrors) {
|
|
|
2271
2281
|
});
|
|
2272
2282
|
return wrapper;
|
|
2273
2283
|
}
|
|
2274
|
-
function getErrorMessage(e) {
|
|
2275
|
-
if (Object.hasOwn(e, "kind")) return e.message;
|
|
2284
|
+
function getErrorMessage(e$1) {
|
|
2285
|
+
if (Object.hasOwn(e$1, "kind")) return e$1.message;
|
|
2276
2286
|
let s = "";
|
|
2277
|
-
if (e.plugin) s += `[plugin ${e.plugin}]`;
|
|
2278
|
-
const id = e.id ?? e.loc?.file;
|
|
2287
|
+
if (e$1.plugin) s += `[plugin ${e$1.plugin}]`;
|
|
2288
|
+
const id = e$1.id ?? e$1.loc?.file;
|
|
2279
2289
|
if (id) {
|
|
2280
2290
|
s += " " + id;
|
|
2281
|
-
if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
|
|
2291
|
+
if (e$1.loc) s += `:${e$1.loc.line}:${e$1.loc.column}`;
|
|
2282
2292
|
}
|
|
2283
2293
|
if (s) s += "\n";
|
|
2284
|
-
const message = `${e.name ?? "Error"}: ${e.message}`;
|
|
2294
|
+
const message = `${e$1.name ?? "Error"}: ${e$1.message}`;
|
|
2285
2295
|
s += message;
|
|
2286
|
-
if (e.frame) s = joinNewLine(s, e.frame);
|
|
2287
|
-
if (e.stack) s = joinNewLine(s, e.stack.replace(message, ""));
|
|
2296
|
+
if (e$1.frame) s = joinNewLine(s, e$1.frame);
|
|
2297
|
+
if (e$1.stack) s = joinNewLine(s, e$1.stack.replace(message, ""));
|
|
2288
2298
|
return s;
|
|
2289
2299
|
}
|
|
2290
2300
|
function joinNewLine(s1, s2) {
|
|
@@ -2328,33 +2338,33 @@ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
|
|
|
2328
2338
|
}
|
|
2329
2339
|
|
|
2330
2340
|
//#endregion
|
|
2331
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2332
|
-
function
|
|
2333
|
-
let
|
|
2334
|
-
return
|
|
2335
|
-
lazy:
|
|
2336
|
-
lazyArgs:
|
|
2341
|
+
//#region ../../node_modules/.pnpm/remeda@2.30.0/node_modules/remeda/dist/lazyDataLastImpl-BDhrIOwR.js
|
|
2342
|
+
function e(e$1, t$2, n$1) {
|
|
2343
|
+
let r = (n$2) => e$1(n$2, ...t$2);
|
|
2344
|
+
return n$1 === void 0 ? r : Object.assign(r, {
|
|
2345
|
+
lazy: n$1,
|
|
2346
|
+
lazyArgs: t$2
|
|
2337
2347
|
});
|
|
2338
2348
|
}
|
|
2339
2349
|
|
|
2340
2350
|
//#endregion
|
|
2341
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2342
|
-
function
|
|
2343
|
-
let
|
|
2344
|
-
if (
|
|
2345
|
-
if (
|
|
2346
|
-
throw
|
|
2351
|
+
//#region ../../node_modules/.pnpm/remeda@2.30.0/node_modules/remeda/dist/purry-DH9cw9sy.js
|
|
2352
|
+
function t(t$2, n$1, r) {
|
|
2353
|
+
let i = t$2.length - n$1.length;
|
|
2354
|
+
if (i === 0) return t$2(...n$1);
|
|
2355
|
+
if (i === 1) return e(t$2, n$1, r);
|
|
2356
|
+
throw Error(`Wrong number of arguments`);
|
|
2347
2357
|
}
|
|
2348
2358
|
|
|
2349
2359
|
//#endregion
|
|
2350
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2351
|
-
function
|
|
2352
|
-
return
|
|
2353
|
-
}
|
|
2354
|
-
|
|
2355
|
-
let
|
|
2356
|
-
for (let [
|
|
2357
|
-
return
|
|
2360
|
+
//#region ../../node_modules/.pnpm/remeda@2.30.0/node_modules/remeda/dist/partition-BJYkp-a7.js
|
|
2361
|
+
function t$1(...t$2) {
|
|
2362
|
+
return t(n, t$2);
|
|
2363
|
+
}
|
|
2364
|
+
const n = (e$1, t$2) => {
|
|
2365
|
+
let n$1 = [[], []];
|
|
2366
|
+
for (let [r, i] of e$1.entries()) t$2(i, r, e$1) ? n$1[0].push(i) : n$1[1].push(i);
|
|
2367
|
+
return n$1;
|
|
2358
2368
|
};
|
|
2359
2369
|
|
|
2360
2370
|
//#endregion
|
|
@@ -2379,8 +2389,8 @@ function transformFilterMatcherToFilterExprs(filterOption) {
|
|
|
2379
2389
|
let idExcludes = [];
|
|
2380
2390
|
let codeIncludes = [];
|
|
2381
2391
|
let codeExcludes = [];
|
|
2382
|
-
if (id) [idIncludes, idExcludes] =
|
|
2383
|
-
if (code) [codeIncludes, codeExcludes] =
|
|
2392
|
+
if (id) [idIncludes, idExcludes] = t$1(generalHookFilterMatcherToFilterExprs(id, "id") ?? [], (m) => m.kind === "include");
|
|
2393
|
+
if (code) [codeIncludes, codeExcludes] = t$1(generalHookFilterMatcherToFilterExprs(code, "code") ?? [], (m) => m.kind === "include");
|
|
2384
2394
|
ret.push(...idExcludes);
|
|
2385
2395
|
ret.push(...codeExcludes);
|
|
2386
2396
|
let andExprList = [];
|
|
@@ -2408,7 +2418,7 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
2408
2418
|
switch (expr.kind) {
|
|
2409
2419
|
case "and": {
|
|
2410
2420
|
let args$1 = expr.args;
|
|
2411
|
-
for (let i
|
|
2421
|
+
for (let i = args$1.length - 1; i >= 0; i--) bindingifyFilterExprImpl(args$1[i], list);
|
|
2412
2422
|
list.push({
|
|
2413
2423
|
kind: "And",
|
|
2414
2424
|
payload: args$1.length
|
|
@@ -2417,7 +2427,7 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
2417
2427
|
}
|
|
2418
2428
|
case "or": {
|
|
2419
2429
|
let args$1 = expr.args;
|
|
2420
|
-
for (let i
|
|
2430
|
+
for (let i = args$1.length - 1; i >= 0; i--) bindingifyFilterExprImpl(args$1[i], list);
|
|
2421
2431
|
list.push({
|
|
2422
2432
|
kind: "Or",
|
|
2423
2433
|
payload: args$1.length
|
|
@@ -2567,10 +2577,10 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
2567
2577
|
data.loadModulePromiseMap.set(id, promise$1);
|
|
2568
2578
|
try {
|
|
2569
2579
|
await context.load(id, options.moduleSideEffects ?? void 0);
|
|
2570
|
-
} catch (e) {
|
|
2580
|
+
} catch (e$1) {
|
|
2571
2581
|
data.loadModulePromiseMap.delete(id);
|
|
2572
2582
|
data.loadModulePromiseResolveFnMap.delete(id);
|
|
2573
|
-
throw e;
|
|
2583
|
+
throw e$1;
|
|
2574
2584
|
}
|
|
2575
2585
|
return promise$1;
|
|
2576
2586
|
}
|
|
@@ -2657,12 +2667,12 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
|
2657
2667
|
this.warn = getLogHandler$1(this.warn);
|
|
2658
2668
|
this.info = getLogHandler$1(this.info);
|
|
2659
2669
|
}
|
|
2660
|
-
error(e, pos) {
|
|
2661
|
-
if (typeof e === "string") e = { message: e };
|
|
2662
|
-
if (pos) require_parse_ast_index.augmentCodeLocation(e, pos, this.moduleSource, this.moduleId);
|
|
2663
|
-
e.id = this.moduleId;
|
|
2664
|
-
e.hook = "transform";
|
|
2665
|
-
return require_parse_ast_index.error(require_parse_ast_index.logPluginError(normalizeLog(e), this.pluginName));
|
|
2670
|
+
error(e$1, pos) {
|
|
2671
|
+
if (typeof e$1 === "string") e$1 = { message: e$1 };
|
|
2672
|
+
if (pos) require_parse_ast_index.augmentCodeLocation(e$1, pos, this.moduleSource, this.moduleId);
|
|
2673
|
+
e$1.id = this.moduleId;
|
|
2674
|
+
e$1.hook = "transform";
|
|
2675
|
+
return require_parse_ast_index.error(require_parse_ast_index.logPluginError(normalizeLog(e$1), this.pluginName));
|
|
2666
2676
|
}
|
|
2667
2677
|
getCombinedSourcemap() {
|
|
2668
2678
|
return JSON.parse(this.inner.getCombinedSourcemap());
|
|
@@ -2888,9 +2898,9 @@ function transformRenderedChunk(chunk) {
|
|
|
2888
2898
|
}
|
|
2889
2899
|
function transformChunkModules(modules) {
|
|
2890
2900
|
const result = {};
|
|
2891
|
-
for (let i
|
|
2892
|
-
let key = modules.keys[i
|
|
2893
|
-
const mod = modules.values[i
|
|
2901
|
+
for (let i = 0; i < modules.values.length; i++) {
|
|
2902
|
+
let key = modules.keys[i];
|
|
2903
|
+
const mod = modules.values[i];
|
|
2894
2904
|
result[key] = transformToRenderedModule(mod);
|
|
2895
2905
|
}
|
|
2896
2906
|
return result;
|
|
@@ -3399,8 +3409,8 @@ function wrapHandlers(plugin) {
|
|
|
3399
3409
|
if (handler) plugin[hookName] = async (...args$1) => {
|
|
3400
3410
|
try {
|
|
3401
3411
|
return await handler(...args$1);
|
|
3402
|
-
} catch (e) {
|
|
3403
|
-
return require_parse_ast_index.error(require_parse_ast_index.logPluginError(e, plugin.name, {
|
|
3412
|
+
} catch (e$1) {
|
|
3413
|
+
return require_parse_ast_index.error(require_parse_ast_index.logPluginError(e$1, plugin.name, {
|
|
3404
3414
|
hook: hookName,
|
|
3405
3415
|
id: hookName === "transform" ? args$1[2] : void 0
|
|
3406
3416
|
}));
|
|
@@ -3829,7 +3839,8 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3829
3839
|
invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData),
|
|
3830
3840
|
markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData),
|
|
3831
3841
|
preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
|
|
3832
|
-
optimization: inputOptions.optimization
|
|
3842
|
+
optimization: inputOptions.optimization,
|
|
3843
|
+
context: inputOptions.context
|
|
3833
3844
|
};
|
|
3834
3845
|
}
|
|
3835
3846
|
function bindingifyHmr(hmr) {
|
|
@@ -4060,7 +4071,7 @@ async function initializeParallelPlugins(plugins) {
|
|
|
4060
4071
|
};
|
|
4061
4072
|
}
|
|
4062
4073
|
function initializeWorkers(registryId, count, pluginInfos) {
|
|
4063
|
-
return Promise.all(Array.from({ length: count }, (_, i
|
|
4074
|
+
return Promise.all(Array.from({ length: count }, (_, i) => initializeWorker(registryId, pluginInfos, i)));
|
|
4064
4075
|
}
|
|
4065
4076
|
async function initializeWorker(registryId, pluginInfos, threadNumber) {
|
|
4066
4077
|
const urlString = (void 0)("#parallel-plugin-worker");
|
|
@@ -4080,9 +4091,9 @@ async function initializeWorker(registryId, pluginInfos, threadNumber) {
|
|
|
4080
4091
|
});
|
|
4081
4092
|
});
|
|
4082
4093
|
return worker;
|
|
4083
|
-
} catch (e) {
|
|
4094
|
+
} catch (e$1) {
|
|
4084
4095
|
worker?.terminate();
|
|
4085
|
-
throw e;
|
|
4096
|
+
throw e$1;
|
|
4086
4097
|
}
|
|
4087
4098
|
}
|
|
4088
4099
|
const availableParallelism = () => {
|
|
@@ -4124,9 +4135,9 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
|
|
|
4124
4135
|
onLog,
|
|
4125
4136
|
stopWorkers: parallelPluginInitResult?.stopWorkers
|
|
4126
4137
|
};
|
|
4127
|
-
} catch (e) {
|
|
4138
|
+
} catch (e$1) {
|
|
4128
4139
|
await parallelPluginInitResult?.stopWorkers();
|
|
4129
|
-
throw e;
|
|
4140
|
+
throw e$1;
|
|
4130
4141
|
}
|
|
4131
4142
|
}
|
|
4132
4143
|
|
|
@@ -4145,9 +4156,9 @@ async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose)
|
|
|
4145
4156
|
asyncRuntimeShutdown = true;
|
|
4146
4157
|
}
|
|
4147
4158
|
};
|
|
4148
|
-
} catch (e) {
|
|
4159
|
+
} catch (e$1) {
|
|
4149
4160
|
await option.stopWorkers?.();
|
|
4150
|
-
throw e;
|
|
4161
|
+
throw e$1;
|
|
4151
4162
|
}
|
|
4152
4163
|
}
|
|
4153
4164
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, ParallelJsPluginRegistry, augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst, shutdownAsyncRuntime, startAsyncRuntime } from "./parse-ast-index-
|
|
1
|
+
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, ParallelJsPluginRegistry, augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst, shutdownAsyncRuntime, startAsyncRuntime } from "./parse-ast-index-Ch2Zs4Nn.mjs";
|
|
2
2
|
import { arraify, noop, unimplemented, unreachable, unsupported } from "./misc-CQeo-AFx.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
@@ -9,7 +9,7 @@ import os from "node:os";
|
|
|
9
9
|
import { Worker } from "node:worker_threads";
|
|
10
10
|
|
|
11
11
|
//#region package.json
|
|
12
|
-
var version = "1.0.0-beta.
|
|
12
|
+
var version = "1.0.0-beta.32";
|
|
13
13
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
14
14
|
|
|
15
15
|
//#endregion
|
|
@@ -28,8 +28,16 @@ function isReadonlyArray(input) {
|
|
|
28
28
|
function makeBuiltinPluginCallable(plugin) {
|
|
29
29
|
let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
30
30
|
const wrappedPlugin = plugin;
|
|
31
|
-
for (const key in callablePlugin) wrappedPlugin[key] = function(...args$1) {
|
|
32
|
-
|
|
31
|
+
for (const key in callablePlugin) wrappedPlugin[key] = async function(...args$1) {
|
|
32
|
+
try {
|
|
33
|
+
return await callablePlugin[key](...args$1);
|
|
34
|
+
} catch (e$1) {
|
|
35
|
+
if (e$1 instanceof Error && !e$1.stack?.includes("at ")) Error.captureStackTrace(e$1, wrappedPlugin[key]);
|
|
36
|
+
return error(logPluginError(e$1, plugin.name, {
|
|
37
|
+
hook: key,
|
|
38
|
+
id: key === "transform" ? args$1[2] : void 0
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
33
41
|
};
|
|
34
42
|
return wrappedPlugin;
|
|
35
43
|
}
|
|
@@ -344,8 +352,8 @@ var MinimalPluginContextImpl = class {
|
|
|
344
352
|
watchMode
|
|
345
353
|
};
|
|
346
354
|
}
|
|
347
|
-
error(e) {
|
|
348
|
-
return error(logPluginError(normalizeLog(e), this.pluginName, { hook: this.hookName }));
|
|
355
|
+
error(e$1) {
|
|
356
|
+
return error(logPluginError(normalizeLog(e$1), this.pluginName, { hook: this.hookName }));
|
|
349
357
|
}
|
|
350
358
|
};
|
|
351
359
|
|
|
@@ -2036,7 +2044,8 @@ const InputCliOverrideSchema = strictObject({
|
|
|
2036
2044
|
literal("react-jsx"),
|
|
2037
2045
|
literal("preserve")
|
|
2038
2046
|
])), description("Jsx options preset")),
|
|
2039
|
-
preserveEntrySignatures: pipe(optional(union([literal(false)])), description("Avoid facade chunks for entry points"))
|
|
2047
|
+
preserveEntrySignatures: pipe(optional(union([literal(false)])), description("Avoid facade chunks for entry points")),
|
|
2048
|
+
context: pipe(optional(string()), description("The entity top-level `this` represents."))
|
|
2040
2049
|
});
|
|
2041
2050
|
const InputCliOptionsSchema = omit(strictObject({
|
|
2042
2051
|
...InputOptionsSchema.entries,
|
|
@@ -2065,6 +2074,7 @@ const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([cust
|
|
|
2065
2074
|
const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
|
|
2066
2075
|
const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
2067
2076
|
const AdvancedChunksSchema = strictObject({
|
|
2077
|
+
includeDependenciesRecursively: optional(boolean()),
|
|
2068
2078
|
minSize: optional(number()),
|
|
2069
2079
|
maxSize: optional(number()),
|
|
2070
2080
|
minModuleSize: optional(number()),
|
|
@@ -2200,7 +2210,7 @@ function validateOption(key, options) {
|
|
|
2200
2210
|
const issuePaths = issue.path.map((path$1) => path$1.key);
|
|
2201
2211
|
let issueMsg = issue.message;
|
|
2202
2212
|
if (issue.type === "union") {
|
|
2203
|
-
const subIssue = issue.issues?.find((i
|
|
2213
|
+
const subIssue = issue.issues?.find((i) => !(i.type !== issue.received && i.input === issue.input));
|
|
2204
2214
|
if (subIssue) {
|
|
2205
2215
|
if (subIssue.path) issuePaths.push(subIssue.path.map((path$1) => path$1.key));
|
|
2206
2216
|
issueMsg = subIssue.message;
|
|
@@ -2243,19 +2253,19 @@ function bindingifySourcemap$1(map) {
|
|
|
2243
2253
|
//#endregion
|
|
2244
2254
|
//#region src/utils/error.ts
|
|
2245
2255
|
function normalizeErrors(rawErrors) {
|
|
2246
|
-
const errors = rawErrors.map((e) => e instanceof Error ? e : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2247
|
-
kind: e.kind,
|
|
2248
|
-
message: e.message,
|
|
2256
|
+
const errors = rawErrors.map((e$1) => e$1 instanceof Error ? e$1 : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2257
|
+
kind: e$1.kind,
|
|
2258
|
+
message: e$1.message,
|
|
2249
2259
|
stack: void 0
|
|
2250
2260
|
}));
|
|
2251
2261
|
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
2252
|
-
for (let i
|
|
2262
|
+
for (let i = 0; i < errors.length; i++) {
|
|
2253
2263
|
summary += "\n";
|
|
2254
|
-
if (i
|
|
2264
|
+
if (i >= 5) {
|
|
2255
2265
|
summary += "...";
|
|
2256
2266
|
break;
|
|
2257
2267
|
}
|
|
2258
|
-
summary += getErrorMessage(errors[i
|
|
2268
|
+
summary += getErrorMessage(errors[i]);
|
|
2259
2269
|
}
|
|
2260
2270
|
const wrapper = new Error(summary);
|
|
2261
2271
|
Object.defineProperty(wrapper, "errors", {
|
|
@@ -2270,20 +2280,20 @@ function normalizeErrors(rawErrors) {
|
|
|
2270
2280
|
});
|
|
2271
2281
|
return wrapper;
|
|
2272
2282
|
}
|
|
2273
|
-
function getErrorMessage(e) {
|
|
2274
|
-
if (Object.hasOwn(e, "kind")) return e.message;
|
|
2283
|
+
function getErrorMessage(e$1) {
|
|
2284
|
+
if (Object.hasOwn(e$1, "kind")) return e$1.message;
|
|
2275
2285
|
let s = "";
|
|
2276
|
-
if (e.plugin) s += `[plugin ${e.plugin}]`;
|
|
2277
|
-
const id = e.id ?? e.loc?.file;
|
|
2286
|
+
if (e$1.plugin) s += `[plugin ${e$1.plugin}]`;
|
|
2287
|
+
const id = e$1.id ?? e$1.loc?.file;
|
|
2278
2288
|
if (id) {
|
|
2279
2289
|
s += " " + id;
|
|
2280
|
-
if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
|
|
2290
|
+
if (e$1.loc) s += `:${e$1.loc.line}:${e$1.loc.column}`;
|
|
2281
2291
|
}
|
|
2282
2292
|
if (s) s += "\n";
|
|
2283
|
-
const message = `${e.name ?? "Error"}: ${e.message}`;
|
|
2293
|
+
const message = `${e$1.name ?? "Error"}: ${e$1.message}`;
|
|
2284
2294
|
s += message;
|
|
2285
|
-
if (e.frame) s = joinNewLine(s, e.frame);
|
|
2286
|
-
if (e.stack) s = joinNewLine(s, e.stack.replace(message, ""));
|
|
2295
|
+
if (e$1.frame) s = joinNewLine(s, e$1.frame);
|
|
2296
|
+
if (e$1.stack) s = joinNewLine(s, e$1.stack.replace(message, ""));
|
|
2287
2297
|
return s;
|
|
2288
2298
|
}
|
|
2289
2299
|
function joinNewLine(s1, s2) {
|
|
@@ -2327,33 +2337,33 @@ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
|
|
|
2327
2337
|
}
|
|
2328
2338
|
|
|
2329
2339
|
//#endregion
|
|
2330
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2331
|
-
function
|
|
2332
|
-
let
|
|
2333
|
-
return
|
|
2334
|
-
lazy:
|
|
2335
|
-
lazyArgs:
|
|
2340
|
+
//#region ../../node_modules/.pnpm/remeda@2.30.0/node_modules/remeda/dist/lazyDataLastImpl-BDhrIOwR.js
|
|
2341
|
+
function e(e$1, t$2, n$1) {
|
|
2342
|
+
let r = (n$2) => e$1(n$2, ...t$2);
|
|
2343
|
+
return n$1 === void 0 ? r : Object.assign(r, {
|
|
2344
|
+
lazy: n$1,
|
|
2345
|
+
lazyArgs: t$2
|
|
2336
2346
|
});
|
|
2337
2347
|
}
|
|
2338
2348
|
|
|
2339
2349
|
//#endregion
|
|
2340
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2341
|
-
function
|
|
2342
|
-
let
|
|
2343
|
-
if (
|
|
2344
|
-
if (
|
|
2345
|
-
throw
|
|
2350
|
+
//#region ../../node_modules/.pnpm/remeda@2.30.0/node_modules/remeda/dist/purry-DH9cw9sy.js
|
|
2351
|
+
function t(t$2, n$1, r) {
|
|
2352
|
+
let i = t$2.length - n$1.length;
|
|
2353
|
+
if (i === 0) return t$2(...n$1);
|
|
2354
|
+
if (i === 1) return e(t$2, n$1, r);
|
|
2355
|
+
throw Error(`Wrong number of arguments`);
|
|
2346
2356
|
}
|
|
2347
2357
|
|
|
2348
2358
|
//#endregion
|
|
2349
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2350
|
-
function
|
|
2351
|
-
return
|
|
2352
|
-
}
|
|
2353
|
-
|
|
2354
|
-
let
|
|
2355
|
-
for (let [
|
|
2356
|
-
return
|
|
2359
|
+
//#region ../../node_modules/.pnpm/remeda@2.30.0/node_modules/remeda/dist/partition-BJYkp-a7.js
|
|
2360
|
+
function t$1(...t$2) {
|
|
2361
|
+
return t(n, t$2);
|
|
2362
|
+
}
|
|
2363
|
+
const n = (e$1, t$2) => {
|
|
2364
|
+
let n$1 = [[], []];
|
|
2365
|
+
for (let [r, i] of e$1.entries()) t$2(i, r, e$1) ? n$1[0].push(i) : n$1[1].push(i);
|
|
2366
|
+
return n$1;
|
|
2357
2367
|
};
|
|
2358
2368
|
|
|
2359
2369
|
//#endregion
|
|
@@ -2378,8 +2388,8 @@ function transformFilterMatcherToFilterExprs(filterOption) {
|
|
|
2378
2388
|
let idExcludes = [];
|
|
2379
2389
|
let codeIncludes = [];
|
|
2380
2390
|
let codeExcludes = [];
|
|
2381
|
-
if (id) [idIncludes, idExcludes] =
|
|
2382
|
-
if (code) [codeIncludes, codeExcludes] =
|
|
2391
|
+
if (id) [idIncludes, idExcludes] = t$1(generalHookFilterMatcherToFilterExprs(id, "id") ?? [], (m) => m.kind === "include");
|
|
2392
|
+
if (code) [codeIncludes, codeExcludes] = t$1(generalHookFilterMatcherToFilterExprs(code, "code") ?? [], (m) => m.kind === "include");
|
|
2383
2393
|
ret.push(...idExcludes);
|
|
2384
2394
|
ret.push(...codeExcludes);
|
|
2385
2395
|
let andExprList = [];
|
|
@@ -2407,7 +2417,7 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
2407
2417
|
switch (expr.kind) {
|
|
2408
2418
|
case "and": {
|
|
2409
2419
|
let args$1 = expr.args;
|
|
2410
|
-
for (let i
|
|
2420
|
+
for (let i = args$1.length - 1; i >= 0; i--) bindingifyFilterExprImpl(args$1[i], list);
|
|
2411
2421
|
list.push({
|
|
2412
2422
|
kind: "And",
|
|
2413
2423
|
payload: args$1.length
|
|
@@ -2416,7 +2426,7 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
2416
2426
|
}
|
|
2417
2427
|
case "or": {
|
|
2418
2428
|
let args$1 = expr.args;
|
|
2419
|
-
for (let i
|
|
2429
|
+
for (let i = args$1.length - 1; i >= 0; i--) bindingifyFilterExprImpl(args$1[i], list);
|
|
2420
2430
|
list.push({
|
|
2421
2431
|
kind: "Or",
|
|
2422
2432
|
payload: args$1.length
|
|
@@ -2566,10 +2576,10 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
2566
2576
|
data.loadModulePromiseMap.set(id, promise$1);
|
|
2567
2577
|
try {
|
|
2568
2578
|
await context.load(id, options.moduleSideEffects ?? void 0);
|
|
2569
|
-
} catch (e) {
|
|
2579
|
+
} catch (e$1) {
|
|
2570
2580
|
data.loadModulePromiseMap.delete(id);
|
|
2571
2581
|
data.loadModulePromiseResolveFnMap.delete(id);
|
|
2572
|
-
throw e;
|
|
2582
|
+
throw e$1;
|
|
2573
2583
|
}
|
|
2574
2584
|
return promise$1;
|
|
2575
2585
|
}
|
|
@@ -2656,12 +2666,12 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
|
2656
2666
|
this.warn = getLogHandler$1(this.warn);
|
|
2657
2667
|
this.info = getLogHandler$1(this.info);
|
|
2658
2668
|
}
|
|
2659
|
-
error(e, pos) {
|
|
2660
|
-
if (typeof e === "string") e = { message: e };
|
|
2661
|
-
if (pos) augmentCodeLocation(e, pos, this.moduleSource, this.moduleId);
|
|
2662
|
-
e.id = this.moduleId;
|
|
2663
|
-
e.hook = "transform";
|
|
2664
|
-
return error(logPluginError(normalizeLog(e), this.pluginName));
|
|
2669
|
+
error(e$1, pos) {
|
|
2670
|
+
if (typeof e$1 === "string") e$1 = { message: e$1 };
|
|
2671
|
+
if (pos) augmentCodeLocation(e$1, pos, this.moduleSource, this.moduleId);
|
|
2672
|
+
e$1.id = this.moduleId;
|
|
2673
|
+
e$1.hook = "transform";
|
|
2674
|
+
return error(logPluginError(normalizeLog(e$1), this.pluginName));
|
|
2665
2675
|
}
|
|
2666
2676
|
getCombinedSourcemap() {
|
|
2667
2677
|
return JSON.parse(this.inner.getCombinedSourcemap());
|
|
@@ -2887,9 +2897,9 @@ function transformRenderedChunk(chunk) {
|
|
|
2887
2897
|
}
|
|
2888
2898
|
function transformChunkModules(modules) {
|
|
2889
2899
|
const result = {};
|
|
2890
|
-
for (let i
|
|
2891
|
-
let key = modules.keys[i
|
|
2892
|
-
const mod = modules.values[i
|
|
2900
|
+
for (let i = 0; i < modules.values.length; i++) {
|
|
2901
|
+
let key = modules.keys[i];
|
|
2902
|
+
const mod = modules.values[i];
|
|
2893
2903
|
result[key] = transformToRenderedModule(mod);
|
|
2894
2904
|
}
|
|
2895
2905
|
return result;
|
|
@@ -3398,8 +3408,8 @@ function wrapHandlers(plugin) {
|
|
|
3398
3408
|
if (handler) plugin[hookName] = async (...args$1) => {
|
|
3399
3409
|
try {
|
|
3400
3410
|
return await handler(...args$1);
|
|
3401
|
-
} catch (e) {
|
|
3402
|
-
return error(logPluginError(e, plugin.name, {
|
|
3411
|
+
} catch (e$1) {
|
|
3412
|
+
return error(logPluginError(e$1, plugin.name, {
|
|
3403
3413
|
hook: hookName,
|
|
3404
3414
|
id: hookName === "transform" ? args$1[2] : void 0
|
|
3405
3415
|
}));
|
|
@@ -3828,7 +3838,8 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3828
3838
|
invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData),
|
|
3829
3839
|
markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData),
|
|
3830
3840
|
preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
|
|
3831
|
-
optimization: inputOptions.optimization
|
|
3841
|
+
optimization: inputOptions.optimization,
|
|
3842
|
+
context: inputOptions.context
|
|
3832
3843
|
};
|
|
3833
3844
|
}
|
|
3834
3845
|
function bindingifyHmr(hmr) {
|
|
@@ -4059,7 +4070,7 @@ async function initializeParallelPlugins(plugins) {
|
|
|
4059
4070
|
};
|
|
4060
4071
|
}
|
|
4061
4072
|
function initializeWorkers(registryId, count, pluginInfos) {
|
|
4062
|
-
return Promise.all(Array.from({ length: count }, (_, i
|
|
4073
|
+
return Promise.all(Array.from({ length: count }, (_, i) => initializeWorker(registryId, pluginInfos, i)));
|
|
4063
4074
|
}
|
|
4064
4075
|
async function initializeWorker(registryId, pluginInfos, threadNumber) {
|
|
4065
4076
|
const urlString = import.meta.resolve("#parallel-plugin-worker");
|
|
@@ -4079,9 +4090,9 @@ async function initializeWorker(registryId, pluginInfos, threadNumber) {
|
|
|
4079
4090
|
});
|
|
4080
4091
|
});
|
|
4081
4092
|
return worker;
|
|
4082
|
-
} catch (e) {
|
|
4093
|
+
} catch (e$1) {
|
|
4083
4094
|
worker?.terminate();
|
|
4084
|
-
throw e;
|
|
4095
|
+
throw e$1;
|
|
4085
4096
|
}
|
|
4086
4097
|
}
|
|
4087
4098
|
const availableParallelism = () => {
|
|
@@ -4123,9 +4134,9 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
|
|
|
4123
4134
|
onLog,
|
|
4124
4135
|
stopWorkers: parallelPluginInitResult?.stopWorkers
|
|
4125
4136
|
};
|
|
4126
|
-
} catch (e) {
|
|
4137
|
+
} catch (e$1) {
|
|
4127
4138
|
await parallelPluginInitResult?.stopWorkers();
|
|
4128
|
-
throw e;
|
|
4139
|
+
throw e$1;
|
|
4129
4140
|
}
|
|
4130
4141
|
}
|
|
4131
4142
|
|
|
@@ -4144,9 +4155,9 @@ async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose)
|
|
|
4144
4155
|
asyncRuntimeShutdown = true;
|
|
4145
4156
|
}
|
|
4146
4157
|
};
|
|
4147
|
-
} catch (e) {
|
|
4158
|
+
} catch (e$1) {
|
|
4148
4159
|
await option.stopWorkers?.();
|
|
4149
|
-
throw e;
|
|
4160
|
+
throw e$1;
|
|
4150
4161
|
}
|
|
4151
4162
|
}
|
|
4152
4163
|
|