@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,4 +1,4 @@
|
|
|
1
|
-
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, parseSync, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
|
|
1
|
+
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, parseSync, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
|
|
2
2
|
|
|
3
3
|
//#region rolldown:runtime
|
|
4
4
|
var __create = Object.create;
|
|
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region package.json
|
|
30
|
-
var version = "1.0.0-beta.
|
|
30
|
+
var version = "1.0.0-beta.36";
|
|
31
31
|
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/utils/code-frame.ts
|
|
@@ -223,12 +223,20 @@ function augmentCodeLocation(properties, pos, source, id$1) {
|
|
|
223
223
|
|
|
224
224
|
//#endregion
|
|
225
225
|
//#region src/builtin-plugin/utils.ts
|
|
226
|
+
const BuiltinClassSymbol = Symbol.for("__RolldownBuiltinPlugin__");
|
|
226
227
|
var BuiltinPlugin = class {
|
|
227
228
|
constructor(name, _options) {
|
|
228
229
|
this.name = name;
|
|
229
230
|
this._options = _options;
|
|
231
|
+
this[BuiltinClassSymbol] = true;
|
|
230
232
|
}
|
|
231
233
|
};
|
|
234
|
+
function isBuiltinPlugin(obj) {
|
|
235
|
+
return obj && obj[BuiltinClassSymbol] === true;
|
|
236
|
+
}
|
|
237
|
+
function createBuiltinPlugin(name, options) {
|
|
238
|
+
return new BuiltinPlugin(name, options);
|
|
239
|
+
}
|
|
232
240
|
function makeBuiltinPluginCallable(plugin) {
|
|
233
241
|
let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
234
242
|
const wrappedPlugin = plugin;
|
|
@@ -358,8 +366,7 @@ let _lazyMatch = () => {
|
|
|
358
366
|
return (!u$1 || e$2) && (a$2.index = t$3, a$2.output.length !== o$1 && (a$2.output.length = o$1)), u$1;
|
|
359
367
|
};
|
|
360
368
|
}, _ = (r$1, e$2) => {
|
|
361
|
-
|
|
362
|
-
return n$2;
|
|
369
|
+
return v(r$1);
|
|
363
370
|
}, g$1 = (() => {
|
|
364
371
|
let r$1 = 0;
|
|
365
372
|
return (e$2) => {
|
|
@@ -531,8 +538,7 @@ const join = function(...segments) {
|
|
|
531
538
|
if (path.length > 0) {
|
|
532
539
|
const pathTrailing = path[path.length - 1] === "/";
|
|
533
540
|
const segLeading = seg[0] === "/";
|
|
534
|
-
|
|
535
|
-
if (both) path += seg.slice(1);
|
|
541
|
+
if (pathTrailing && segLeading) path += seg.slice(1);
|
|
536
542
|
else path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
537
543
|
} else path += seg;
|
|
538
544
|
}
|
|
@@ -758,8 +764,7 @@ function getLogHandler(level, code$1, logger, pluginName, logLevel) {
|
|
|
758
764
|
function getLogger(plugins, onLog, logLevel, watchMode) {
|
|
759
765
|
const minimalPriority = logLevelPriority[logLevel];
|
|
760
766
|
const logger = (level, log, skipped = /* @__PURE__ */ new Set()) => {
|
|
761
|
-
|
|
762
|
-
if (logPriority < minimalPriority) return;
|
|
767
|
+
if (logLevelPriority[level] < minimalPriority) return;
|
|
763
768
|
for (const plugin of getSortedPlugins("onLog", plugins)) {
|
|
764
769
|
if (skipped.has(plugin)) continue;
|
|
765
770
|
const { onLog: pluginOnLog } = plugin;
|
|
@@ -768,8 +773,7 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
|
|
|
768
773
|
if (logLevelPriority[level$1] < minimalPriority) return () => {};
|
|
769
774
|
return (log$1) => logger(level$1, normalizeLog(log$1), new Set(skipped).add(plugin));
|
|
770
775
|
};
|
|
771
|
-
|
|
772
|
-
if (handler.call({
|
|
776
|
+
if (("handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog).call({
|
|
773
777
|
debug: getLogHandler$1(LOG_LEVEL_DEBUG),
|
|
774
778
|
error: (log$1) => error(normalizeLog(log$1)),
|
|
775
779
|
info: getLogHandler$1(LOG_LEVEL_INFO),
|
|
@@ -851,7 +855,7 @@ function normalizeHook(hook) {
|
|
|
851
855
|
//#endregion
|
|
852
856
|
//#region src/utils/normalize-string-or-regex.ts
|
|
853
857
|
function normalizedStringOrRegex(pattern) {
|
|
854
|
-
if (!pattern) return
|
|
858
|
+
if (!pattern) return;
|
|
855
859
|
if (!isReadonlyArray(pattern)) return [pattern];
|
|
856
860
|
return pattern;
|
|
857
861
|
}
|
|
@@ -862,56 +866,56 @@ function isReadonlyArray(input) {
|
|
|
862
866
|
//#endregion
|
|
863
867
|
//#region src/builtin-plugin/constructors.ts
|
|
864
868
|
function modulePreloadPolyfillPlugin(config) {
|
|
865
|
-
return
|
|
869
|
+
return createBuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
866
870
|
}
|
|
867
871
|
function dynamicImportVarsPlugin(config) {
|
|
868
872
|
if (config) {
|
|
869
873
|
config.include = normalizedStringOrRegex(config.include);
|
|
870
874
|
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
871
875
|
}
|
|
872
|
-
return
|
|
876
|
+
return createBuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
873
877
|
}
|
|
874
878
|
function importGlobPlugin(config) {
|
|
875
|
-
return
|
|
879
|
+
return createBuiltinPlugin("builtin:import-glob", config);
|
|
876
880
|
}
|
|
877
881
|
function reporterPlugin(config) {
|
|
878
|
-
return
|
|
882
|
+
return createBuiltinPlugin("builtin:reporter", config);
|
|
879
883
|
}
|
|
880
884
|
function manifestPlugin(config) {
|
|
881
|
-
return
|
|
885
|
+
return createBuiltinPlugin("builtin:manifest", config);
|
|
882
886
|
}
|
|
883
887
|
function wasmHelperPlugin(config) {
|
|
884
|
-
return
|
|
888
|
+
return createBuiltinPlugin("builtin:wasm-helper", config);
|
|
885
889
|
}
|
|
886
890
|
function wasmFallbackPlugin() {
|
|
887
|
-
const builtinPlugin =
|
|
891
|
+
const builtinPlugin = createBuiltinPlugin("builtin:wasm-fallback");
|
|
888
892
|
return makeBuiltinPluginCallable(builtinPlugin);
|
|
889
893
|
}
|
|
890
894
|
function loadFallbackPlugin() {
|
|
891
|
-
return
|
|
895
|
+
return createBuiltinPlugin("builtin:load-fallback");
|
|
892
896
|
}
|
|
893
897
|
function jsonPlugin(config) {
|
|
894
|
-
const builtinPlugin =
|
|
898
|
+
const builtinPlugin = createBuiltinPlugin("builtin:json", config);
|
|
895
899
|
return makeBuiltinPluginCallable(builtinPlugin);
|
|
896
900
|
}
|
|
897
901
|
function buildImportAnalysisPlugin(config) {
|
|
898
|
-
return
|
|
902
|
+
return createBuiltinPlugin("builtin:build-import-analysis", config);
|
|
899
903
|
}
|
|
900
904
|
function viteResolvePlugin(config) {
|
|
901
|
-
const builtinPlugin =
|
|
905
|
+
const builtinPlugin = createBuiltinPlugin("builtin:vite-resolve", config);
|
|
902
906
|
return makeBuiltinPluginCallable(builtinPlugin);
|
|
903
907
|
}
|
|
904
908
|
function isolatedDeclarationPlugin(config) {
|
|
905
|
-
return
|
|
909
|
+
return createBuiltinPlugin("builtin:isolated-declaration", config);
|
|
906
910
|
}
|
|
907
911
|
function assetPlugin(config) {
|
|
908
|
-
return
|
|
912
|
+
return createBuiltinPlugin("builtin:asset", config);
|
|
909
913
|
}
|
|
910
914
|
function webWorkerPostPlugin() {
|
|
911
|
-
return
|
|
915
|
+
return createBuiltinPlugin("builtin:web-worker-post");
|
|
912
916
|
}
|
|
913
917
|
function esmExternalRequirePlugin(config) {
|
|
914
|
-
return
|
|
918
|
+
return createBuiltinPlugin("builtin:esm-external-require", config);
|
|
915
919
|
}
|
|
916
920
|
|
|
917
921
|
//#endregion
|
|
@@ -1005,7 +1009,7 @@ function checkOutputPluginOption(plugins, onLog) {
|
|
|
1005
1009
|
function normalizePlugins(plugins, anonymousPrefix) {
|
|
1006
1010
|
for (const [index, plugin] of plugins.entries()) {
|
|
1007
1011
|
if ("_parallel" in plugin) continue;
|
|
1008
|
-
if (plugin
|
|
1012
|
+
if (isBuiltinPlugin(plugin)) continue;
|
|
1009
1013
|
if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
|
|
1010
1014
|
}
|
|
1011
1015
|
return plugins;
|
|
@@ -1072,9 +1076,9 @@ var PluginDriver = class {
|
|
|
1072
1076
|
};
|
|
1073
1077
|
function getObjectPlugins(plugins) {
|
|
1074
1078
|
return plugins.filter((plugin) => {
|
|
1075
|
-
if (!plugin) return
|
|
1076
|
-
if ("_parallel" in plugin) return
|
|
1077
|
-
if (plugin
|
|
1079
|
+
if (!plugin) return;
|
|
1080
|
+
if ("_parallel" in plugin) return;
|
|
1081
|
+
if (isBuiltinPlugin(plugin)) return;
|
|
1078
1082
|
return plugin;
|
|
1079
1083
|
});
|
|
1080
1084
|
}
|
|
@@ -2307,10 +2311,43 @@ const ChecksOptionsSchema = strictObject({
|
|
|
2307
2311
|
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict")),
|
|
2308
2312
|
preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
|
|
2309
2313
|
});
|
|
2314
|
+
const CompressOptionsKeepNamesSchema = strictObject({
|
|
2315
|
+
function: optional(boolean()),
|
|
2316
|
+
class: optional(boolean())
|
|
2317
|
+
});
|
|
2318
|
+
const CompressOptionsSchema = strictObject({
|
|
2319
|
+
target: optional(union([
|
|
2320
|
+
literal("esnext"),
|
|
2321
|
+
literal("es2015"),
|
|
2322
|
+
literal("es2016"),
|
|
2323
|
+
literal("es2017"),
|
|
2324
|
+
literal("es2018"),
|
|
2325
|
+
literal("es2019"),
|
|
2326
|
+
literal("es2020"),
|
|
2327
|
+
literal("es2021"),
|
|
2328
|
+
literal("es2022"),
|
|
2329
|
+
literal("es2023"),
|
|
2330
|
+
literal("es2024")
|
|
2331
|
+
])),
|
|
2332
|
+
dropConsole: optional(boolean()),
|
|
2333
|
+
dropDebugger: optional(boolean()),
|
|
2334
|
+
keepNames: optional(CompressOptionsKeepNamesSchema),
|
|
2335
|
+
unused: optional(union([boolean(), literal("keep_assign")]))
|
|
2336
|
+
});
|
|
2337
|
+
const MangleOptionsKeepNamesSchema = strictObject({
|
|
2338
|
+
function: optional(boolean()),
|
|
2339
|
+
class: optional(boolean())
|
|
2340
|
+
});
|
|
2341
|
+
const MangleOptionsSchema = strictObject({
|
|
2342
|
+
toplevel: optional(boolean()),
|
|
2343
|
+
keepNames: optional(union([boolean(), MangleOptionsKeepNamesSchema])),
|
|
2344
|
+
debug: optional(boolean())
|
|
2345
|
+
});
|
|
2346
|
+
const CodegenOptionsSchema = strictObject({ removeWhitespace: optional(boolean()) });
|
|
2310
2347
|
const MinifyOptionsSchema = strictObject({
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2348
|
+
compress: optional(union([boolean(), CompressOptionsSchema])),
|
|
2349
|
+
mangle: optional(union([boolean(), MangleOptionsSchema])),
|
|
2350
|
+
codegen: optional(union([boolean(), CodegenOptionsSchema]))
|
|
2314
2351
|
});
|
|
2315
2352
|
const ResolveOptionsSchema = strictObject({
|
|
2316
2353
|
alias: optional(record(string(), union([string(), array(string())]))),
|
|
@@ -2329,10 +2366,19 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
|
2329
2366
|
annotations: optional(boolean()),
|
|
2330
2367
|
manualPureFunctions: optional(array(string())),
|
|
2331
2368
|
unknownGlobalSideEffects: optional(boolean()),
|
|
2332
|
-
commonjs: optional(boolean())
|
|
2369
|
+
commonjs: optional(boolean()),
|
|
2370
|
+
propertyReadSideEffects: optional(union([literal(false), literal("always")])),
|
|
2371
|
+
propertyWriteSideEffects: optional(union([literal(false), literal("always")]))
|
|
2333
2372
|
})]);
|
|
2334
2373
|
const OptimizationOptionsSchema = strictObject({
|
|
2335
|
-
inlineConst: pipe(optional(
|
|
2374
|
+
inlineConst: pipe(optional(union([
|
|
2375
|
+
boolean(),
|
|
2376
|
+
literal("smart"),
|
|
2377
|
+
strictObject({
|
|
2378
|
+
mode: optional(union([literal("all"), literal("smart")])),
|
|
2379
|
+
pass: optional(number())
|
|
2380
|
+
})
|
|
2381
|
+
])), description("Enable crossmodule constant inlining")),
|
|
2336
2382
|
pifeForModuleWrappers: pipe(optional(boolean()), description("Use PIFE pattern for module wrappers"))
|
|
2337
2383
|
});
|
|
2338
2384
|
const OnLogSchema = pipe(function_(), args(tuple([
|
|
@@ -2342,6 +2388,7 @@ const OnLogSchema = pipe(function_(), args(tuple([
|
|
|
2342
2388
|
])));
|
|
2343
2389
|
const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
|
|
2344
2390
|
const HmrSchema = union([boolean(), strictObject({
|
|
2391
|
+
new: optional(boolean()),
|
|
2345
2392
|
port: optional(number()),
|
|
2346
2393
|
host: optional(string()),
|
|
2347
2394
|
implement: optional(string())
|
|
@@ -2571,15 +2618,19 @@ const CliOptionsSchema = strictObject({
|
|
|
2571
2618
|
...InputCliOptionsSchema.entries,
|
|
2572
2619
|
...OutputCliOptionsSchema.entries
|
|
2573
2620
|
});
|
|
2574
|
-
const inputHelperMsgRecord = {
|
|
2621
|
+
const inputHelperMsgRecord = {
|
|
2622
|
+
output: { ignored: true },
|
|
2623
|
+
"resolve.tsconfigFilename": { issueMsg: "It is deprecated. Please use the top-level `tsconfig` option instead." }
|
|
2624
|
+
};
|
|
2575
2625
|
const outputHelperMsgRecord = {};
|
|
2576
2626
|
function validateOption(key, options) {
|
|
2627
|
+
if (typeof options !== "object") throw new Error(`Invalid ${key} options. Expected an Object but received ${JSON.stringify(options)}.`);
|
|
2577
2628
|
if (globalThis.process?.env?.ROLLUP_TEST) return;
|
|
2578
2629
|
let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
|
|
2579
2630
|
if (!parsed.success) {
|
|
2580
2631
|
const errors = parsed.issues.map((issue) => {
|
|
2581
|
-
const issuePaths = issue.path.map((path) => path.key);
|
|
2582
2632
|
let issueMsg = issue.message;
|
|
2633
|
+
const issuePaths = issue.path.map((path) => path.key);
|
|
2583
2634
|
if (issue.type === "union") {
|
|
2584
2635
|
const subIssue = issue.issues?.find((i$1) => !(i$1.type !== issue.received && i$1.input === issue.input));
|
|
2585
2636
|
if (subIssue) {
|
|
@@ -2590,9 +2641,9 @@ function validateOption(key, options) {
|
|
|
2590
2641
|
const stringPath = issuePaths.join(".");
|
|
2591
2642
|
const helper = key === "input" ? inputHelperMsgRecord[stringPath] : outputHelperMsgRecord[stringPath];
|
|
2592
2643
|
if (helper && helper.ignored) return "";
|
|
2593
|
-
return `- For the "${stringPath}". ${issueMsg}
|
|
2644
|
+
return `- For the "${stringPath}". ${helper?.issueMsg || issueMsg + "."} ${helper?.help ? `\n Help: ${helper.help}` : ""}`;
|
|
2594
2645
|
}).filter(Boolean);
|
|
2595
|
-
if (errors.length) console.warn(
|
|
2646
|
+
if (errors.length) console.warn(`\x1b[33mWarning: Invalid ${key} options (${errors.length} issue${errors.length === 1 ? "" : "s"} found)\n${errors.join("\n")}\x1b[0m`);
|
|
2596
2647
|
}
|
|
2597
2648
|
}
|
|
2598
2649
|
|
|
@@ -2656,6 +2707,10 @@ function getErrorMessage(e$2) {
|
|
|
2656
2707
|
s$1 += message;
|
|
2657
2708
|
if (e$2.frame) s$1 = joinNewLine(s$1, e$2.frame);
|
|
2658
2709
|
if (e$2.stack) s$1 = joinNewLine(s$1, e$2.stack.replace(message, ""));
|
|
2710
|
+
if (e$2.cause) {
|
|
2711
|
+
s$1 = joinNewLine(s$1, "Caused by:");
|
|
2712
|
+
s$1 = joinNewLine(s$1, getErrorMessage(e$2.cause).split("\n").map((line) => " " + line).join("\n"));
|
|
2713
|
+
}
|
|
2659
2714
|
return s$1;
|
|
2660
2715
|
}
|
|
2661
2716
|
function joinNewLine(s1, s2) {
|
|
@@ -2699,7 +2754,7 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
|
|
|
2699
2754
|
}
|
|
2700
2755
|
|
|
2701
2756
|
//#endregion
|
|
2702
|
-
//#region ../pluginutils/dist/index.
|
|
2757
|
+
//#region ../pluginutils/dist/index.mjs
|
|
2703
2758
|
var And = class {
|
|
2704
2759
|
kind;
|
|
2705
2760
|
args;
|
|
@@ -2826,7 +2881,7 @@ function generateAtomMatcher(kind, matcher) {
|
|
|
2826
2881
|
return kind === "code" ? code(matcher) : id(matcher);
|
|
2827
2882
|
}
|
|
2828
2883
|
function transformFilterMatcherToFilterExprs(filterOption) {
|
|
2829
|
-
if (!filterOption) return
|
|
2884
|
+
if (!filterOption) return;
|
|
2830
2885
|
if (Array.isArray(filterOption)) return filterOption;
|
|
2831
2886
|
const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
|
|
2832
2887
|
let ret = [];
|
|
@@ -2924,24 +2979,24 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
2924
2979
|
}
|
|
2925
2980
|
}
|
|
2926
2981
|
function bindingifyResolveIdFilter(filterOption) {
|
|
2927
|
-
if (!filterOption) return
|
|
2982
|
+
if (!filterOption) return;
|
|
2928
2983
|
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2929
2984
|
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
|
2930
2985
|
}
|
|
2931
2986
|
function bindingifyLoadFilter(filterOption) {
|
|
2932
|
-
if (!filterOption) return
|
|
2987
|
+
if (!filterOption) return;
|
|
2933
2988
|
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2934
2989
|
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
|
2935
2990
|
}
|
|
2936
2991
|
function bindingifyTransformFilter(filterOption) {
|
|
2937
|
-
if (!filterOption) return
|
|
2992
|
+
if (!filterOption) return;
|
|
2938
2993
|
let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
|
|
2939
2994
|
let ret = [];
|
|
2940
2995
|
if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
|
|
2941
2996
|
return { value: ret.length > 0 ? ret : void 0 };
|
|
2942
2997
|
}
|
|
2943
2998
|
function bindingifyRenderChunkFilter(filterOption) {
|
|
2944
|
-
if (!filterOption) return
|
|
2999
|
+
if (!filterOption) return;
|
|
2945
3000
|
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2946
3001
|
return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
|
|
2947
3002
|
}
|
|
@@ -2956,13 +3011,13 @@ function bindingPluginOrder(order) {
|
|
|
2956
3011
|
case "post": return BindingPluginOrder.Post;
|
|
2957
3012
|
case "pre": return BindingPluginOrder.Pre;
|
|
2958
3013
|
case null:
|
|
2959
|
-
case void 0: return
|
|
3014
|
+
case void 0: return;
|
|
2960
3015
|
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
2961
3016
|
}
|
|
2962
3017
|
}
|
|
2963
3018
|
|
|
2964
3019
|
//#endregion
|
|
2965
|
-
//#region ../../node_modules/.pnpm/oxc-parser@0.
|
|
3020
|
+
//#region ../../node_modules/.pnpm/oxc-parser@0.87.0/node_modules/oxc-parser/wrap.mjs
|
|
2966
3021
|
function wrap$1(result) {
|
|
2967
3022
|
let program, module$1, comments, errors;
|
|
2968
3023
|
return {
|
|
@@ -3199,6 +3254,9 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
|
3199
3254
|
getCombinedSourcemap() {
|
|
3200
3255
|
return JSON.parse(this.inner.getCombinedSourcemap());
|
|
3201
3256
|
}
|
|
3257
|
+
addWatchFile(id$1) {
|
|
3258
|
+
this.inner.addWatchFile(id$1);
|
|
3259
|
+
}
|
|
3202
3260
|
};
|
|
3203
3261
|
|
|
3204
3262
|
//#endregion
|
|
@@ -3298,7 +3356,7 @@ function bindingifyTransform(args$1) {
|
|
|
3298
3356
|
return {
|
|
3299
3357
|
plugin: async (ctx, code$1, id$1, meta$1) => {
|
|
3300
3358
|
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);
|
|
3301
|
-
if (ret == null) return
|
|
3359
|
+
if (ret == null) return;
|
|
3302
3360
|
if (typeof ret === "string") return { code: ret };
|
|
3303
3361
|
let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
|
|
3304
3362
|
meta: ret.meta ?? {},
|
|
@@ -3432,9 +3490,8 @@ function transformChunkModules(modules) {
|
|
|
3432
3490
|
//#endregion
|
|
3433
3491
|
//#region src/utils/transform-to-rollup-output.ts
|
|
3434
3492
|
function transformToRollupSourceMap(map) {
|
|
3435
|
-
const parsed = JSON.parse(map);
|
|
3436
3493
|
const obj = {
|
|
3437
|
-
...
|
|
3494
|
+
...JSON.parse(map),
|
|
3438
3495
|
toString() {
|
|
3439
3496
|
return JSON.stringify(obj);
|
|
3440
3497
|
},
|
|
@@ -3976,13 +4033,10 @@ var ChunkingContextImpl = class {
|
|
|
3976
4033
|
}
|
|
3977
4034
|
getModuleInfo(moduleId) {
|
|
3978
4035
|
const bindingInfo = this.context.getModuleInfo(moduleId);
|
|
3979
|
-
if (bindingInfo) {
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
});
|
|
3984
|
-
return info;
|
|
3985
|
-
}
|
|
4036
|
+
if (bindingInfo) return transformModuleInfo(bindingInfo, {
|
|
4037
|
+
moduleSideEffects: null,
|
|
4038
|
+
meta: {}
|
|
4039
|
+
});
|
|
3986
4040
|
return null;
|
|
3987
4041
|
}
|
|
3988
4042
|
};
|
|
@@ -4055,7 +4109,7 @@ function bindingifySourcemap(sourcemap) {
|
|
|
4055
4109
|
case true: return "file";
|
|
4056
4110
|
case "inline": return "inline";
|
|
4057
4111
|
case false:
|
|
4058
|
-
case void 0: return
|
|
4112
|
+
case void 0: return;
|
|
4059
4113
|
case "hidden": return "hidden";
|
|
4060
4114
|
default: throw new Error(`unknown sourcemap: ${sourcemap}`);
|
|
4061
4115
|
}
|
|
@@ -4081,7 +4135,7 @@ function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
|
|
|
4081
4135
|
else if (manualChunks != null) advancedChunks = { groups: [{ name(moduleId, ctx) {
|
|
4082
4136
|
return manualChunks(moduleId, { getModuleInfo: (id$1) => ctx.getModuleInfo(id$1) });
|
|
4083
4137
|
} }] };
|
|
4084
|
-
if (advancedChunks == null) return
|
|
4138
|
+
if (advancedChunks == null) return;
|
|
4085
4139
|
const { groups,...restAdvancedChunks } = advancedChunks;
|
|
4086
4140
|
return {
|
|
4087
4141
|
...restAdvancedChunks,
|
|
@@ -4285,8 +4339,7 @@ var PluginContextData = class {
|
|
|
4285
4339
|
return info;
|
|
4286
4340
|
}
|
|
4287
4341
|
getModuleIds(context) {
|
|
4288
|
-
|
|
4289
|
-
return moduleIds.values();
|
|
4342
|
+
return context.getModuleIds().values();
|
|
4290
4343
|
}
|
|
4291
4344
|
saveResolveOptions(options) {
|
|
4292
4345
|
const index = this.resolveOptionsMap.size;
|
|
@@ -4329,8 +4382,8 @@ var PluginContextData = class {
|
|
|
4329
4382
|
function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
4330
4383
|
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
|
|
4331
4384
|
const plugins = rawPlugins.map((plugin) => {
|
|
4332
|
-
if ("_parallel" in plugin) return
|
|
4333
|
-
if (plugin
|
|
4385
|
+
if ("_parallel" in plugin) return;
|
|
4386
|
+
if (isBuiltinPlugin(plugin)) return bindingifyBuiltInPlugin(plugin);
|
|
4334
4387
|
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
4335
4388
|
});
|
|
4336
4389
|
const { jsx, transform } = bindingifyJsx(onLog, inputOptions.jsx, inputOptions.transform);
|
|
@@ -4343,7 +4396,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
4343
4396
|
platform: inputOptions.platform,
|
|
4344
4397
|
shimMissingExports: inputOptions.shimMissingExports,
|
|
4345
4398
|
logLevel: bindingifyLogLevel(logLevel),
|
|
4346
|
-
onLog,
|
|
4399
|
+
onLog: async (level, log) => onLog(level, log),
|
|
4347
4400
|
treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
|
|
4348
4401
|
moduleTypes: inputOptions.moduleTypes,
|
|
4349
4402
|
define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
|
|
@@ -4373,7 +4426,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
4373
4426
|
preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
|
|
4374
4427
|
optimization: inputOptions.optimization,
|
|
4375
4428
|
context: inputOptions.context,
|
|
4376
|
-
tsconfig: inputOptions.tsconfig
|
|
4429
|
+
tsconfig: inputOptions.resolve?.tsconfigFilename ?? inputOptions.tsconfig
|
|
4377
4430
|
};
|
|
4378
4431
|
}
|
|
4379
4432
|
function bindingifyHmr(hmr) {
|
|
@@ -4384,7 +4437,7 @@ function bindingifyHmr(hmr) {
|
|
|
4384
4437
|
}
|
|
4385
4438
|
function bindingifyAttachDebugInfo(attachDebugInfo) {
|
|
4386
4439
|
switch (attachDebugInfo) {
|
|
4387
|
-
case void 0: return
|
|
4440
|
+
case void 0: return;
|
|
4388
4441
|
case "full": return BindingAttachDebugInfo.Full;
|
|
4389
4442
|
case "simple": return BindingAttachDebugInfo.Simple;
|
|
4390
4443
|
case "none": return BindingAttachDebugInfo.None;
|
|
@@ -4539,7 +4592,7 @@ function bindingifyWatch(watch$1) {
|
|
|
4539
4592
|
};
|
|
4540
4593
|
}
|
|
4541
4594
|
function bindingifyTreeshakeOptions(config) {
|
|
4542
|
-
if (config === false) return
|
|
4595
|
+
if (config === false) return;
|
|
4543
4596
|
if (config === true || config === void 0) return { moduleSideEffects: true };
|
|
4544
4597
|
let normalizedConfig = {
|
|
4545
4598
|
moduleSideEffects: true,
|
|
@@ -4548,6 +4601,24 @@ function bindingifyTreeshakeOptions(config) {
|
|
|
4548
4601
|
unknownGlobalSideEffects: config.unknownGlobalSideEffects,
|
|
4549
4602
|
commonjs: config.commonjs
|
|
4550
4603
|
};
|
|
4604
|
+
switch (config.propertyReadSideEffects) {
|
|
4605
|
+
case "always":
|
|
4606
|
+
normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.Always;
|
|
4607
|
+
break;
|
|
4608
|
+
case false:
|
|
4609
|
+
normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.False;
|
|
4610
|
+
break;
|
|
4611
|
+
default:
|
|
4612
|
+
}
|
|
4613
|
+
switch (config.propertyWriteSideEffects) {
|
|
4614
|
+
case "always":
|
|
4615
|
+
normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.Always;
|
|
4616
|
+
break;
|
|
4617
|
+
case false:
|
|
4618
|
+
normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.False;
|
|
4619
|
+
break;
|
|
4620
|
+
default:
|
|
4621
|
+
}
|
|
4551
4622
|
if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
|
|
4552
4623
|
else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
|
|
4553
4624
|
external: true,
|
|
@@ -4567,7 +4638,7 @@ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative)
|
|
|
4567
4638
|
};
|
|
4568
4639
|
}
|
|
4569
4640
|
function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
|
|
4570
|
-
if (preserveEntrySignatures == void 0) return
|
|
4641
|
+
if (preserveEntrySignatures == void 0) return;
|
|
4571
4642
|
else if (typeof preserveEntrySignatures === "string") return {
|
|
4572
4643
|
type: "String",
|
|
4573
4644
|
field0: preserveEntrySignatures
|
|
@@ -4837,8 +4908,7 @@ async function createWatcher(emitter, input) {
|
|
|
4837
4908
|
})).flat());
|
|
4838
4909
|
const notifyOptions = getValidNotifyOption(bundlerOptions);
|
|
4839
4910
|
const bindingWatcher = new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
|
|
4840
|
-
|
|
4841
|
-
watcher.start();
|
|
4911
|
+
new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers)).start();
|
|
4842
4912
|
}
|
|
4843
4913
|
function getValidNotifyOption(bundlerOptions) {
|
|
4844
4914
|
let result;
|
|
@@ -4870,4 +4940,4 @@ function defineConfig(config) {
|
|
|
4870
4940
|
const VERSION = version;
|
|
4871
4941
|
|
|
4872
4942
|
//#endregion
|
|
4873
|
-
export {
|
|
4943
|
+
export { PluginDriver, VERSION, assetPlugin, build, buildImportAnalysisPlugin, createBuiltinPlugin, createBundlerImpl, createBundlerOptions, defineConfig, dynamicImportVarsPlugin, esmExternalRequirePlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rolldown/browser",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.36",
|
|
4
4
|
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
5
5
|
"homepage": "https://rolldown.rs/",
|
|
6
6
|
"type": "module",
|
|
@@ -26,36 +26,22 @@
|
|
|
26
26
|
"bin": {
|
|
27
27
|
"rolldown": "./bin/cli.mjs"
|
|
28
28
|
},
|
|
29
|
-
"main": "./dist/index.
|
|
29
|
+
"main": "./dist/index.mjs",
|
|
30
30
|
"module": "./dist/index.mjs",
|
|
31
|
-
"types": "./dist/index.d.
|
|
31
|
+
"types": "./dist/index.d.mts",
|
|
32
32
|
"exports": {
|
|
33
33
|
".": {
|
|
34
34
|
"browser": "./dist/index.browser.mjs",
|
|
35
|
-
"
|
|
36
|
-
"require": "./dist/index.cjs"
|
|
37
|
-
},
|
|
38
|
-
"./config": {
|
|
39
|
-
"import": "./dist/config.mjs",
|
|
40
|
-
"require": "./dist/config.cjs"
|
|
35
|
+
"default": "./dist/index.mjs"
|
|
41
36
|
},
|
|
37
|
+
"./config": "./dist/config.mjs",
|
|
42
38
|
"./experimental": {
|
|
43
39
|
"browser": "./dist/experimental-index.browser.mjs",
|
|
44
|
-
"
|
|
45
|
-
"require": "./dist/experimental-index.cjs"
|
|
46
|
-
},
|
|
47
|
-
"./filter": {
|
|
48
|
-
"import": "./dist/filter-index.mjs",
|
|
49
|
-
"require": "./dist/filter-index.cjs"
|
|
50
|
-
},
|
|
51
|
-
"./parallelPlugin": {
|
|
52
|
-
"import": "./dist/parallel-plugin.mjs",
|
|
53
|
-
"require": "./dist/parallel-plugin.cjs"
|
|
54
|
-
},
|
|
55
|
-
"./parseAst": {
|
|
56
|
-
"import": "./dist/parse-ast-index.mjs",
|
|
57
|
-
"require": "./dist/parse-ast-index.cjs"
|
|
40
|
+
"default": "./dist/experimental-index.mjs"
|
|
58
41
|
},
|
|
42
|
+
"./filter": "./dist/filter-index.mjs",
|
|
43
|
+
"./parallelPlugin": "./dist/parallel-plugin.mjs",
|
|
44
|
+
"./parseAst": "./dist/parse-ast-index.mjs",
|
|
59
45
|
"./package.json": "./package.json"
|
|
60
46
|
},
|
|
61
47
|
"publishConfig": {
|
|
@@ -64,7 +50,7 @@
|
|
|
64
50
|
},
|
|
65
51
|
"dependencies": {
|
|
66
52
|
"@napi-rs/wasm-runtime": "^1.0.0",
|
|
67
|
-
"@oxc-project/runtime": "=0.
|
|
53
|
+
"@oxc-project/runtime": "=0.87.0"
|
|
68
54
|
},
|
|
69
55
|
"scripts": {
|
|
70
56
|
"build": "pnpm run build:debug",
|