@rolldown/browser 1.0.0-beta.34 → 1.0.0-beta.36
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.mjs +219 -230
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +4 -4
- package/dist/experimental-index.browser.mjs +22 -6
- package/dist/experimental-index.d.mts +16 -4
- package/dist/experimental-index.mjs +24 -8
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +1 -1
- package/dist/index.browser.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/parallel-plugin-worker.mjs +5 -6
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/rolldown-binding.wasi-browser.js +4 -0
- package/dist/rolldown-binding.wasi.cjs +4 -0
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-9k0egz6L.d.mts → binding-wK0CRIMb.d.mts} +1 -0
- package/dist/shared/{define-config-DzIQxNqU.d.mts → define-config-BcNhk996.d.mts} +30 -3
- package/dist/shared/{dist-ByKQkexh.mjs → dist-CHTC3-kR.mjs} +1 -1
- package/dist/shared/{load-config--VYNOtUY.mjs → load-config-M8Gvqt1X.mjs} +4 -6
- package/dist/shared/{parse-ast-index-C_CZT4St.mjs → parse-ast-index-C3TkGcEQ.mjs} +1 -1
- package/dist/shared/{prompt-C5jz26Zn.mjs → prompt-DuG2i9ud.mjs} +4 -7
- package/dist/shared/{src-B4V64IkU.mjs → src-Dc4fRARy.mjs} +143 -72
- package/dist/{src-Bl12Y5ab.js → src-Cl6h35QH.js} +141 -71
- package/package.json +10 -24
- package/dist/cli.cjs +0 -1766
- package/dist/cli.d.cts +0 -1
- package/dist/config.cjs +0 -12
- package/dist/config.d.cts +0 -10
- package/dist/experimental-index.cjs +0 -160
- package/dist/experimental-index.d.cts +0 -90
- package/dist/filter-index.cjs +0 -53
- package/dist/filter-index.d.cts +0 -4
- package/dist/index.cjs +0 -9
- package/dist/index.d.cts +0 -3
- package/dist/parallel-plugin-worker.cjs +0 -33
- package/dist/parallel-plugin-worker.d.cts +0 -1
- package/dist/parallel-plugin.cjs +0 -8
- package/dist/parallel-plugin.d.cts +0 -14
- package/dist/parse-ast-index.cjs +0 -4
- package/dist/parse-ast-index.d.cts +0 -8
- package/dist/shared/binding-D13M6Llu.d.cts +0 -1425
- package/dist/shared/chunk-DDkG_k5U.cjs +0 -39
- package/dist/shared/define-config-D5AluabE.d.cts +0 -1394
- package/dist/shared/dist-CK0hotcm.cjs +0 -240
- package/dist/shared/load-config-DfHD1OI9.cjs +0 -125
- package/dist/shared/parse-ast-index-ChWj_C49.cjs +0 -326
- package/dist/shared/prompt-QNI93ne7.cjs +0 -854
- package/dist/shared/src-McCMqGpa.cjs +0 -4738
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-
|
|
2
|
-
import { and, arraify, code, exclude, id, include, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-
|
|
3
|
-
import {
|
|
1
|
+
import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-C3TkGcEQ.mjs";
|
|
2
|
+
import { and, arraify, code, exclude, id, include, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-CHTC3-kR.mjs";
|
|
3
|
+
import { Worker } from "node:worker_threads";
|
|
4
|
+
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
4
5
|
import path from "node:path";
|
|
5
6
|
import { fileURLToPath } from "node:url";
|
|
6
7
|
import fsp from "node:fs/promises";
|
|
7
8
|
import os from "node:os";
|
|
8
|
-
import { Worker } from "node:worker_threads";
|
|
9
9
|
|
|
10
10
|
//#region rolldown:runtime
|
|
11
11
|
var __create = Object.create;
|
|
@@ -34,17 +34,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
34
|
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region package.json
|
|
37
|
-
var version = "1.0.0-beta.
|
|
37
|
+
var version = "1.0.0-beta.36";
|
|
38
38
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
39
39
|
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/builtin-plugin/utils.ts
|
|
42
|
+
const BuiltinClassSymbol = Symbol.for("__RolldownBuiltinPlugin__");
|
|
42
43
|
var BuiltinPlugin = class {
|
|
43
44
|
constructor(name, _options) {
|
|
44
45
|
this.name = name;
|
|
45
46
|
this._options = _options;
|
|
47
|
+
this[BuiltinClassSymbol] = true;
|
|
46
48
|
}
|
|
47
49
|
};
|
|
50
|
+
function isBuiltinPlugin(obj) {
|
|
51
|
+
return obj && obj[BuiltinClassSymbol] === true;
|
|
52
|
+
}
|
|
53
|
+
function createBuiltinPlugin(name, options) {
|
|
54
|
+
return new BuiltinPlugin(name, options);
|
|
55
|
+
}
|
|
48
56
|
function makeBuiltinPluginCallable(plugin) {
|
|
49
57
|
let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
50
58
|
const wrappedPlugin = plugin;
|
|
@@ -102,8 +110,7 @@ function getLogHandler(level, code$1, logger, pluginName, logLevel) {
|
|
|
102
110
|
function getLogger(plugins, onLog, logLevel, watchMode) {
|
|
103
111
|
const minimalPriority = logLevelPriority[logLevel];
|
|
104
112
|
const logger = (level, log, skipped = /* @__PURE__ */ new Set()) => {
|
|
105
|
-
|
|
106
|
-
if (logPriority < minimalPriority) return;
|
|
113
|
+
if (logLevelPriority[level] < minimalPriority) return;
|
|
107
114
|
for (const plugin of getSortedPlugins("onLog", plugins)) {
|
|
108
115
|
if (skipped.has(plugin)) continue;
|
|
109
116
|
const { onLog: pluginOnLog } = plugin;
|
|
@@ -112,8 +119,7 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
|
|
|
112
119
|
if (logLevelPriority[level$1] < minimalPriority) return () => {};
|
|
113
120
|
return (log$1) => logger(level$1, normalizeLog(log$1), new Set(skipped).add(plugin));
|
|
114
121
|
};
|
|
115
|
-
|
|
116
|
-
if (handler.call({
|
|
122
|
+
if (("handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog).call({
|
|
117
123
|
debug: getLogHandler$1(LOG_LEVEL_DEBUG),
|
|
118
124
|
error: (log$1) => error(normalizeLog(log$1)),
|
|
119
125
|
info: getLogHandler$1(LOG_LEVEL_INFO),
|
|
@@ -195,7 +201,7 @@ function normalizeHook(hook) {
|
|
|
195
201
|
//#endregion
|
|
196
202
|
//#region src/utils/normalize-string-or-regex.ts
|
|
197
203
|
function normalizedStringOrRegex(pattern) {
|
|
198
|
-
if (!pattern) return
|
|
204
|
+
if (!pattern) return;
|
|
199
205
|
if (!isReadonlyArray(pattern)) return [pattern];
|
|
200
206
|
return pattern;
|
|
201
207
|
}
|
|
@@ -206,59 +212,59 @@ function isReadonlyArray(input) {
|
|
|
206
212
|
//#endregion
|
|
207
213
|
//#region src/builtin-plugin/constructors.ts
|
|
208
214
|
function modulePreloadPolyfillPlugin(config) {
|
|
209
|
-
return
|
|
215
|
+
return createBuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
210
216
|
}
|
|
211
217
|
function dynamicImportVarsPlugin(config) {
|
|
212
218
|
if (config) {
|
|
213
219
|
config.include = normalizedStringOrRegex(config.include);
|
|
214
220
|
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
215
221
|
}
|
|
216
|
-
return
|
|
222
|
+
return createBuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
217
223
|
}
|
|
218
224
|
function importGlobPlugin(config) {
|
|
219
|
-
return
|
|
225
|
+
return createBuiltinPlugin("builtin:import-glob", config);
|
|
220
226
|
}
|
|
221
227
|
function reporterPlugin(config) {
|
|
222
|
-
return
|
|
228
|
+
return createBuiltinPlugin("builtin:reporter", config);
|
|
223
229
|
}
|
|
224
230
|
function manifestPlugin(config) {
|
|
225
|
-
return
|
|
231
|
+
return createBuiltinPlugin("builtin:manifest", config);
|
|
226
232
|
}
|
|
227
233
|
function wasmHelperPlugin(config) {
|
|
228
|
-
return
|
|
234
|
+
return createBuiltinPlugin("builtin:wasm-helper", config);
|
|
229
235
|
}
|
|
230
236
|
function wasmFallbackPlugin() {
|
|
231
|
-
const builtinPlugin =
|
|
237
|
+
const builtinPlugin = createBuiltinPlugin("builtin:wasm-fallback");
|
|
232
238
|
return makeBuiltinPluginCallable(builtinPlugin);
|
|
233
239
|
}
|
|
234
240
|
function loadFallbackPlugin() {
|
|
235
|
-
return
|
|
241
|
+
return createBuiltinPlugin("builtin:load-fallback");
|
|
236
242
|
}
|
|
237
243
|
function jsonPlugin(config) {
|
|
238
|
-
const builtinPlugin =
|
|
244
|
+
const builtinPlugin = createBuiltinPlugin("builtin:json", config);
|
|
239
245
|
return makeBuiltinPluginCallable(builtinPlugin);
|
|
240
246
|
}
|
|
241
247
|
function buildImportAnalysisPlugin(config) {
|
|
242
|
-
return
|
|
248
|
+
return createBuiltinPlugin("builtin:build-import-analysis", config);
|
|
243
249
|
}
|
|
244
250
|
function viteResolvePlugin(config) {
|
|
245
|
-
const builtinPlugin =
|
|
251
|
+
const builtinPlugin = createBuiltinPlugin("builtin:vite-resolve", config);
|
|
246
252
|
return makeBuiltinPluginCallable(builtinPlugin);
|
|
247
253
|
}
|
|
248
254
|
function isolatedDeclarationPlugin(config) {
|
|
249
|
-
return
|
|
255
|
+
return createBuiltinPlugin("builtin:isolated-declaration", config);
|
|
250
256
|
}
|
|
251
257
|
function assetPlugin(config) {
|
|
252
|
-
return
|
|
258
|
+
return createBuiltinPlugin("builtin:asset", config);
|
|
253
259
|
}
|
|
254
260
|
function webWorkerPostPlugin() {
|
|
255
|
-
return
|
|
261
|
+
return createBuiltinPlugin("builtin:web-worker-post");
|
|
256
262
|
}
|
|
257
263
|
function oxcRuntimePlugin(config) {
|
|
258
|
-
return
|
|
264
|
+
return createBuiltinPlugin("builtin:oxc-runtime", config);
|
|
259
265
|
}
|
|
260
266
|
function esmExternalRequirePlugin(config) {
|
|
261
|
-
return
|
|
267
|
+
return createBuiltinPlugin("builtin:esm-external-require", config);
|
|
262
268
|
}
|
|
263
269
|
|
|
264
270
|
//#endregion
|
|
@@ -352,7 +358,7 @@ function checkOutputPluginOption(plugins, onLog) {
|
|
|
352
358
|
function normalizePlugins(plugins, anonymousPrefix) {
|
|
353
359
|
for (const [index, plugin] of plugins.entries()) {
|
|
354
360
|
if ("_parallel" in plugin) continue;
|
|
355
|
-
if (plugin
|
|
361
|
+
if (isBuiltinPlugin(plugin)) continue;
|
|
356
362
|
if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
|
|
357
363
|
}
|
|
358
364
|
return plugins;
|
|
@@ -419,9 +425,9 @@ var PluginDriver = class {
|
|
|
419
425
|
};
|
|
420
426
|
function getObjectPlugins(plugins) {
|
|
421
427
|
return plugins.filter((plugin) => {
|
|
422
|
-
if (!plugin) return
|
|
423
|
-
if ("_parallel" in plugin) return
|
|
424
|
-
if (plugin
|
|
428
|
+
if (!plugin) return;
|
|
429
|
+
if ("_parallel" in plugin) return;
|
|
430
|
+
if (isBuiltinPlugin(plugin)) return;
|
|
425
431
|
return plugin;
|
|
426
432
|
});
|
|
427
433
|
}
|
|
@@ -2070,10 +2076,43 @@ const ChecksOptionsSchema = strictObject({
|
|
|
2070
2076
|
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict")),
|
|
2071
2077
|
preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
|
|
2072
2078
|
});
|
|
2079
|
+
const CompressOptionsKeepNamesSchema = strictObject({
|
|
2080
|
+
function: optional(boolean()),
|
|
2081
|
+
class: optional(boolean())
|
|
2082
|
+
});
|
|
2083
|
+
const CompressOptionsSchema = strictObject({
|
|
2084
|
+
target: optional(union([
|
|
2085
|
+
literal("esnext"),
|
|
2086
|
+
literal("es2015"),
|
|
2087
|
+
literal("es2016"),
|
|
2088
|
+
literal("es2017"),
|
|
2089
|
+
literal("es2018"),
|
|
2090
|
+
literal("es2019"),
|
|
2091
|
+
literal("es2020"),
|
|
2092
|
+
literal("es2021"),
|
|
2093
|
+
literal("es2022"),
|
|
2094
|
+
literal("es2023"),
|
|
2095
|
+
literal("es2024")
|
|
2096
|
+
])),
|
|
2097
|
+
dropConsole: optional(boolean()),
|
|
2098
|
+
dropDebugger: optional(boolean()),
|
|
2099
|
+
keepNames: optional(CompressOptionsKeepNamesSchema),
|
|
2100
|
+
unused: optional(union([boolean(), literal("keep_assign")]))
|
|
2101
|
+
});
|
|
2102
|
+
const MangleOptionsKeepNamesSchema = strictObject({
|
|
2103
|
+
function: optional(boolean()),
|
|
2104
|
+
class: optional(boolean())
|
|
2105
|
+
});
|
|
2106
|
+
const MangleOptionsSchema = strictObject({
|
|
2107
|
+
toplevel: optional(boolean()),
|
|
2108
|
+
keepNames: optional(union([boolean(), MangleOptionsKeepNamesSchema])),
|
|
2109
|
+
debug: optional(boolean())
|
|
2110
|
+
});
|
|
2111
|
+
const CodegenOptionsSchema = strictObject({ removeWhitespace: optional(boolean()) });
|
|
2073
2112
|
const MinifyOptionsSchema = strictObject({
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2113
|
+
compress: optional(union([boolean(), CompressOptionsSchema])),
|
|
2114
|
+
mangle: optional(union([boolean(), MangleOptionsSchema])),
|
|
2115
|
+
codegen: optional(union([boolean(), CodegenOptionsSchema]))
|
|
2077
2116
|
});
|
|
2078
2117
|
const ResolveOptionsSchema = strictObject({
|
|
2079
2118
|
alias: optional(record(string(), union([string(), array(string())]))),
|
|
@@ -2092,10 +2131,19 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
|
2092
2131
|
annotations: optional(boolean()),
|
|
2093
2132
|
manualPureFunctions: optional(array(string())),
|
|
2094
2133
|
unknownGlobalSideEffects: optional(boolean()),
|
|
2095
|
-
commonjs: optional(boolean())
|
|
2134
|
+
commonjs: optional(boolean()),
|
|
2135
|
+
propertyReadSideEffects: optional(union([literal(false), literal("always")])),
|
|
2136
|
+
propertyWriteSideEffects: optional(union([literal(false), literal("always")]))
|
|
2096
2137
|
})]);
|
|
2097
2138
|
const OptimizationOptionsSchema = strictObject({
|
|
2098
|
-
inlineConst: pipe(optional(
|
|
2139
|
+
inlineConst: pipe(optional(union([
|
|
2140
|
+
boolean(),
|
|
2141
|
+
literal("smart"),
|
|
2142
|
+
strictObject({
|
|
2143
|
+
mode: optional(union([literal("all"), literal("smart")])),
|
|
2144
|
+
pass: optional(number())
|
|
2145
|
+
})
|
|
2146
|
+
])), description("Enable crossmodule constant inlining")),
|
|
2099
2147
|
pifeForModuleWrappers: pipe(optional(boolean()), description("Use PIFE pattern for module wrappers"))
|
|
2100
2148
|
});
|
|
2101
2149
|
const OnLogSchema = pipe(function_(), args(tuple([
|
|
@@ -2105,6 +2153,7 @@ const OnLogSchema = pipe(function_(), args(tuple([
|
|
|
2105
2153
|
])));
|
|
2106
2154
|
const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
|
|
2107
2155
|
const HmrSchema = union([boolean(), strictObject({
|
|
2156
|
+
new: optional(boolean()),
|
|
2108
2157
|
port: optional(number()),
|
|
2109
2158
|
host: optional(string()),
|
|
2110
2159
|
implement: optional(string())
|
|
@@ -2337,19 +2386,22 @@ const CliOptionsSchema = strictObject({
|
|
|
2337
2386
|
function validateCliOptions(options) {
|
|
2338
2387
|
let parsed = safeParse(CliOptionsSchema, options);
|
|
2339
2388
|
return [parsed.output, parsed.issues?.map((issue) => {
|
|
2340
|
-
|
|
2341
|
-
return `Invalid value for option ${option}: ${issue.message}`;
|
|
2389
|
+
return `Invalid value for option ${issue.path?.map((pathItem) => pathItem.key).join(" ")}: ${issue.message}`;
|
|
2342
2390
|
})];
|
|
2343
2391
|
}
|
|
2344
|
-
const inputHelperMsgRecord = {
|
|
2392
|
+
const inputHelperMsgRecord = {
|
|
2393
|
+
output: { ignored: true },
|
|
2394
|
+
"resolve.tsconfigFilename": { issueMsg: "It is deprecated. Please use the top-level `tsconfig` option instead." }
|
|
2395
|
+
};
|
|
2345
2396
|
const outputHelperMsgRecord = {};
|
|
2346
2397
|
function validateOption(key, options) {
|
|
2398
|
+
if (typeof options !== "object") throw new Error(`Invalid ${key} options. Expected an Object but received ${JSON.stringify(options)}.`);
|
|
2347
2399
|
if (globalThis.process?.env?.ROLLUP_TEST) return;
|
|
2348
2400
|
let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
|
|
2349
2401
|
if (!parsed.success) {
|
|
2350
2402
|
const errors = parsed.issues.map((issue) => {
|
|
2351
|
-
const issuePaths = issue.path.map((path$1) => path$1.key);
|
|
2352
2403
|
let issueMsg = issue.message;
|
|
2404
|
+
const issuePaths = issue.path.map((path$1) => path$1.key);
|
|
2353
2405
|
if (issue.type === "union") {
|
|
2354
2406
|
const subIssue = issue.issues?.find((i$1) => !(i$1.type !== issue.received && i$1.input === issue.input));
|
|
2355
2407
|
if (subIssue) {
|
|
@@ -2360,9 +2412,9 @@ function validateOption(key, options) {
|
|
|
2360
2412
|
const stringPath = issuePaths.join(".");
|
|
2361
2413
|
const helper = key === "input" ? inputHelperMsgRecord[stringPath] : outputHelperMsgRecord[stringPath];
|
|
2362
2414
|
if (helper && helper.ignored) return "";
|
|
2363
|
-
return `- For the "${stringPath}". ${issueMsg}
|
|
2415
|
+
return `- For the "${stringPath}". ${helper?.issueMsg || issueMsg + "."} ${helper?.help ? `\n Help: ${helper.help}` : ""}`;
|
|
2364
2416
|
}).filter(Boolean);
|
|
2365
|
-
if (errors.length) console.warn(
|
|
2417
|
+
if (errors.length) console.warn(`\x1b[33mWarning: Invalid ${key} options (${errors.length} issue${errors.length === 1 ? "" : "s"} found)\n${errors.join("\n")}\x1b[0m`);
|
|
2366
2418
|
}
|
|
2367
2419
|
}
|
|
2368
2420
|
function getInputCliKeys() {
|
|
@@ -2435,6 +2487,10 @@ function getErrorMessage(e$2) {
|
|
|
2435
2487
|
s$1 += message;
|
|
2436
2488
|
if (e$2.frame) s$1 = joinNewLine(s$1, e$2.frame);
|
|
2437
2489
|
if (e$2.stack) s$1 = joinNewLine(s$1, e$2.stack.replace(message, ""));
|
|
2490
|
+
if (e$2.cause) {
|
|
2491
|
+
s$1 = joinNewLine(s$1, "Caused by:");
|
|
2492
|
+
s$1 = joinNewLine(s$1, getErrorMessage(e$2.cause).split("\n").map((line) => " " + line).join("\n"));
|
|
2493
|
+
}
|
|
2438
2494
|
return s$1;
|
|
2439
2495
|
}
|
|
2440
2496
|
function joinNewLine(s1, s2) {
|
|
@@ -2521,7 +2577,7 @@ function generateAtomMatcher(kind, matcher) {
|
|
|
2521
2577
|
return kind === "code" ? code(matcher) : id(matcher);
|
|
2522
2578
|
}
|
|
2523
2579
|
function transformFilterMatcherToFilterExprs(filterOption) {
|
|
2524
|
-
if (!filterOption) return
|
|
2580
|
+
if (!filterOption) return;
|
|
2525
2581
|
if (Array.isArray(filterOption)) return filterOption;
|
|
2526
2582
|
const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
|
|
2527
2583
|
let ret = [];
|
|
@@ -2619,24 +2675,24 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
2619
2675
|
}
|
|
2620
2676
|
}
|
|
2621
2677
|
function bindingifyResolveIdFilter(filterOption) {
|
|
2622
|
-
if (!filterOption) return
|
|
2678
|
+
if (!filterOption) return;
|
|
2623
2679
|
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2624
2680
|
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
|
2625
2681
|
}
|
|
2626
2682
|
function bindingifyLoadFilter(filterOption) {
|
|
2627
|
-
if (!filterOption) return
|
|
2683
|
+
if (!filterOption) return;
|
|
2628
2684
|
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2629
2685
|
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
|
2630
2686
|
}
|
|
2631
2687
|
function bindingifyTransformFilter(filterOption) {
|
|
2632
|
-
if (!filterOption) return
|
|
2688
|
+
if (!filterOption) return;
|
|
2633
2689
|
let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
|
|
2634
2690
|
let ret = [];
|
|
2635
2691
|
if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
|
|
2636
2692
|
return { value: ret.length > 0 ? ret : void 0 };
|
|
2637
2693
|
}
|
|
2638
2694
|
function bindingifyRenderChunkFilter(filterOption) {
|
|
2639
|
-
if (!filterOption) return
|
|
2695
|
+
if (!filterOption) return;
|
|
2640
2696
|
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2641
2697
|
return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
|
|
2642
2698
|
}
|
|
@@ -2651,7 +2707,7 @@ function bindingPluginOrder(order) {
|
|
|
2651
2707
|
case "post": return BindingPluginOrder.Post;
|
|
2652
2708
|
case "pre": return BindingPluginOrder.Pre;
|
|
2653
2709
|
case null:
|
|
2654
|
-
case void 0: return
|
|
2710
|
+
case void 0: return;
|
|
2655
2711
|
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
2656
2712
|
}
|
|
2657
2713
|
}
|
|
@@ -2818,6 +2874,9 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
|
2818
2874
|
getCombinedSourcemap() {
|
|
2819
2875
|
return JSON.parse(this.inner.getCombinedSourcemap());
|
|
2820
2876
|
}
|
|
2877
|
+
addWatchFile(id$1) {
|
|
2878
|
+
this.inner.addWatchFile(id$1);
|
|
2879
|
+
}
|
|
2821
2880
|
};
|
|
2822
2881
|
|
|
2823
2882
|
//#endregion
|
|
@@ -2917,7 +2976,7 @@ function bindingifyTransform(args$1) {
|
|
|
2917
2976
|
return {
|
|
2918
2977
|
plugin: async (ctx, code$1, id$1, meta$1) => {
|
|
2919
2978
|
const ret = await handler.call(new TransformPluginContextImpl(args$1.outputOptions, ctx.inner(), args$1.plugin, args$1.pluginContextData, ctx, id$1, code$1, args$1.onLog, args$1.logLevel, args$1.watchMode), code$1, id$1, meta$1);
|
|
2920
|
-
if (ret == null) return
|
|
2979
|
+
if (ret == null) return;
|
|
2921
2980
|
if (typeof ret === "string") return { code: ret };
|
|
2922
2981
|
let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
|
|
2923
2982
|
meta: ret.meta ?? {},
|
|
@@ -3051,9 +3110,8 @@ function transformChunkModules(modules) {
|
|
|
3051
3110
|
//#endregion
|
|
3052
3111
|
//#region src/utils/transform-to-rollup-output.ts
|
|
3053
3112
|
function transformToRollupSourceMap(map) {
|
|
3054
|
-
const parsed = JSON.parse(map);
|
|
3055
3113
|
const obj = {
|
|
3056
|
-
...
|
|
3114
|
+
...JSON.parse(map),
|
|
3057
3115
|
toString() {
|
|
3058
3116
|
return JSON.stringify(obj);
|
|
3059
3117
|
},
|
|
@@ -3595,13 +3653,10 @@ var ChunkingContextImpl = class {
|
|
|
3595
3653
|
}
|
|
3596
3654
|
getModuleInfo(moduleId) {
|
|
3597
3655
|
const bindingInfo = this.context.getModuleInfo(moduleId);
|
|
3598
|
-
if (bindingInfo) {
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
});
|
|
3603
|
-
return info;
|
|
3604
|
-
}
|
|
3656
|
+
if (bindingInfo) return transformModuleInfo(bindingInfo, {
|
|
3657
|
+
moduleSideEffects: null,
|
|
3658
|
+
meta: {}
|
|
3659
|
+
});
|
|
3605
3660
|
return null;
|
|
3606
3661
|
}
|
|
3607
3662
|
};
|
|
@@ -3674,7 +3729,7 @@ function bindingifySourcemap(sourcemap) {
|
|
|
3674
3729
|
case true: return "file";
|
|
3675
3730
|
case "inline": return "inline";
|
|
3676
3731
|
case false:
|
|
3677
|
-
case void 0: return
|
|
3732
|
+
case void 0: return;
|
|
3678
3733
|
case "hidden": return "hidden";
|
|
3679
3734
|
default: throw new Error(`unknown sourcemap: ${sourcemap}`);
|
|
3680
3735
|
}
|
|
@@ -3700,7 +3755,7 @@ function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
|
|
|
3700
3755
|
else if (manualChunks != null) advancedChunks = { groups: [{ name(moduleId, ctx) {
|
|
3701
3756
|
return manualChunks(moduleId, { getModuleInfo: (id$1) => ctx.getModuleInfo(id$1) });
|
|
3702
3757
|
} }] };
|
|
3703
|
-
if (advancedChunks == null) return
|
|
3758
|
+
if (advancedChunks == null) return;
|
|
3704
3759
|
const { groups,...restAdvancedChunks } = advancedChunks;
|
|
3705
3760
|
return {
|
|
3706
3761
|
...restAdvancedChunks,
|
|
@@ -3904,8 +3959,7 @@ var PluginContextData = class {
|
|
|
3904
3959
|
return info;
|
|
3905
3960
|
}
|
|
3906
3961
|
getModuleIds(context) {
|
|
3907
|
-
|
|
3908
|
-
return moduleIds.values();
|
|
3962
|
+
return context.getModuleIds().values();
|
|
3909
3963
|
}
|
|
3910
3964
|
saveResolveOptions(options) {
|
|
3911
3965
|
const index = this.resolveOptionsMap.size;
|
|
@@ -3948,8 +4002,8 @@ var PluginContextData = class {
|
|
|
3948
4002
|
function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
3949
4003
|
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
|
|
3950
4004
|
const plugins = rawPlugins.map((plugin) => {
|
|
3951
|
-
if ("_parallel" in plugin) return
|
|
3952
|
-
if (plugin
|
|
4005
|
+
if ("_parallel" in plugin) return;
|
|
4006
|
+
if (isBuiltinPlugin(plugin)) return bindingifyBuiltInPlugin(plugin);
|
|
3953
4007
|
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
3954
4008
|
});
|
|
3955
4009
|
const { jsx, transform } = bindingifyJsx(onLog, inputOptions.jsx, inputOptions.transform);
|
|
@@ -3962,7 +4016,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3962
4016
|
platform: inputOptions.platform,
|
|
3963
4017
|
shimMissingExports: inputOptions.shimMissingExports,
|
|
3964
4018
|
logLevel: bindingifyLogLevel(logLevel),
|
|
3965
|
-
onLog,
|
|
4019
|
+
onLog: async (level, log) => onLog(level, log),
|
|
3966
4020
|
treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
|
|
3967
4021
|
moduleTypes: inputOptions.moduleTypes,
|
|
3968
4022
|
define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
|
|
@@ -3992,7 +4046,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3992
4046
|
preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
|
|
3993
4047
|
optimization: inputOptions.optimization,
|
|
3994
4048
|
context: inputOptions.context,
|
|
3995
|
-
tsconfig: inputOptions.tsconfig
|
|
4049
|
+
tsconfig: inputOptions.resolve?.tsconfigFilename ?? inputOptions.tsconfig
|
|
3996
4050
|
};
|
|
3997
4051
|
}
|
|
3998
4052
|
function bindingifyHmr(hmr) {
|
|
@@ -4003,7 +4057,7 @@ function bindingifyHmr(hmr) {
|
|
|
4003
4057
|
}
|
|
4004
4058
|
function bindingifyAttachDebugInfo(attachDebugInfo) {
|
|
4005
4059
|
switch (attachDebugInfo) {
|
|
4006
|
-
case void 0: return
|
|
4060
|
+
case void 0: return;
|
|
4007
4061
|
case "full": return BindingAttachDebugInfo.Full;
|
|
4008
4062
|
case "simple": return BindingAttachDebugInfo.Simple;
|
|
4009
4063
|
case "none": return BindingAttachDebugInfo.None;
|
|
@@ -4158,7 +4212,7 @@ function bindingifyWatch(watch$1) {
|
|
|
4158
4212
|
};
|
|
4159
4213
|
}
|
|
4160
4214
|
function bindingifyTreeshakeOptions(config) {
|
|
4161
|
-
if (config === false) return
|
|
4215
|
+
if (config === false) return;
|
|
4162
4216
|
if (config === true || config === void 0) return { moduleSideEffects: true };
|
|
4163
4217
|
let normalizedConfig = {
|
|
4164
4218
|
moduleSideEffects: true,
|
|
@@ -4167,6 +4221,24 @@ function bindingifyTreeshakeOptions(config) {
|
|
|
4167
4221
|
unknownGlobalSideEffects: config.unknownGlobalSideEffects,
|
|
4168
4222
|
commonjs: config.commonjs
|
|
4169
4223
|
};
|
|
4224
|
+
switch (config.propertyReadSideEffects) {
|
|
4225
|
+
case "always":
|
|
4226
|
+
normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.Always;
|
|
4227
|
+
break;
|
|
4228
|
+
case false:
|
|
4229
|
+
normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.False;
|
|
4230
|
+
break;
|
|
4231
|
+
default:
|
|
4232
|
+
}
|
|
4233
|
+
switch (config.propertyWriteSideEffects) {
|
|
4234
|
+
case "always":
|
|
4235
|
+
normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.Always;
|
|
4236
|
+
break;
|
|
4237
|
+
case false:
|
|
4238
|
+
normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.False;
|
|
4239
|
+
break;
|
|
4240
|
+
default:
|
|
4241
|
+
}
|
|
4170
4242
|
if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
|
|
4171
4243
|
else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
|
|
4172
4244
|
external: true,
|
|
@@ -4186,7 +4258,7 @@ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative)
|
|
|
4186
4258
|
};
|
|
4187
4259
|
}
|
|
4188
4260
|
function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
|
|
4189
|
-
if (preserveEntrySignatures == void 0) return
|
|
4261
|
+
if (preserveEntrySignatures == void 0) return;
|
|
4190
4262
|
else if (typeof preserveEntrySignatures === "string") return {
|
|
4191
4263
|
type: "String",
|
|
4192
4264
|
field0: preserveEntrySignatures
|
|
@@ -4209,7 +4281,7 @@ async function initializeParallelPlugins(plugins) {
|
|
|
4209
4281
|
options
|
|
4210
4282
|
});
|
|
4211
4283
|
}
|
|
4212
|
-
if (pluginInfos.length <= 0) return
|
|
4284
|
+
if (pluginInfos.length <= 0) return;
|
|
4213
4285
|
const count = availableParallelism();
|
|
4214
4286
|
const parallelJsPluginRegistry = new ParallelJsPluginRegistry(count);
|
|
4215
4287
|
const registryId = parallelJsPluginRegistry.id;
|
|
@@ -4518,8 +4590,7 @@ async function createWatcher(emitter, input) {
|
|
|
4518
4590
|
})).flat());
|
|
4519
4591
|
const notifyOptions = getValidNotifyOption(bundlerOptions);
|
|
4520
4592
|
const bindingWatcher = new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
|
|
4521
|
-
|
|
4522
|
-
watcher.start();
|
|
4593
|
+
new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers)).start();
|
|
4523
4594
|
}
|
|
4524
4595
|
function getValidNotifyOption(bundlerOptions) {
|
|
4525
4596
|
let result;
|
|
@@ -4551,4 +4622,4 @@ function defineConfig(config) {
|
|
|
4551
4622
|
const VERSION = version;
|
|
4552
4623
|
|
|
4553
4624
|
//#endregion
|
|
4554
|
-
export {
|
|
4625
|
+
export { PluginContextData, PluginDriver, VERSION, __commonJS, __toESM, ansis_default, assetPlugin, bindingifyPlugin, build, buildImportAnalysisPlugin, createBuiltinPlugin, createBundlerImpl, createBundlerOptions, defineConfig, description$1 as description, dynamicImportVarsPlugin, esmExternalRequirePlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
|