@rolldown/browser 1.0.0-beta.34 → 1.0.0-beta.35
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 +215 -210
- package/dist/cli.mjs +203 -203
- package/dist/config.cjs +3 -3
- package/dist/config.d.cts +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +2 -2
- package/dist/experimental-index.browser.mjs +20 -6
- package/dist/experimental-index.cjs +25 -9
- package/dist/experimental-index.d.cts +13 -4
- package/dist/experimental-index.d.mts +13 -4
- package/dist/experimental-index.mjs +20 -6
- package/dist/filter-index.d.cts +1 -1
- package/dist/filter-index.d.mts +1 -1
- package/dist/index.browser.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/parallel-plugin-worker.cjs +6 -4
- package/dist/parallel-plugin-worker.mjs +2 -2
- package/dist/parallel-plugin.d.cts +1 -1
- package/dist/parallel-plugin.d.mts +1 -1
- package/dist/parse-ast-index.cjs +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/{define-config-DzIQxNqU.d.mts → define-config-DJXaSinS.d.mts} +29 -2
- package/dist/shared/{define-config-D5AluabE.d.cts → define-config-DhrkZ_o7.d.cts} +29 -2
- package/dist/shared/{load-config--VYNOtUY.mjs → load-config-BCjD-AGJ.mjs} +1 -1
- package/dist/shared/{load-config-DfHD1OI9.cjs → load-config-BJKhRKZL.cjs} +11 -6
- package/dist/shared/{parse-ast-index-ChWj_C49.cjs → parse-ast-index-J0xVKZRe.cjs} +2 -1
- package/dist/shared/{prompt-QNI93ne7.cjs → prompt-Q05EYrFb.cjs} +8 -4
- package/dist/shared/{src-B4V64IkU.mjs → src-B0RCtUy7.mjs} +75 -31
- package/dist/shared/{src-McCMqGpa.cjs → src-Bd4BGX4v.cjs} +91 -41
- package/dist/{src-Bl12Y5ab.js → src-C8U06Im1.js} +73 -29
- package/package.json +1 -1
|
@@ -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.35";
|
|
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;
|
|
@@ -862,56 +870,56 @@ function isReadonlyArray(input) {
|
|
|
862
870
|
//#endregion
|
|
863
871
|
//#region src/builtin-plugin/constructors.ts
|
|
864
872
|
function modulePreloadPolyfillPlugin(config) {
|
|
865
|
-
return
|
|
873
|
+
return createBuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
866
874
|
}
|
|
867
875
|
function dynamicImportVarsPlugin(config) {
|
|
868
876
|
if (config) {
|
|
869
877
|
config.include = normalizedStringOrRegex(config.include);
|
|
870
878
|
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
871
879
|
}
|
|
872
|
-
return
|
|
880
|
+
return createBuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
873
881
|
}
|
|
874
882
|
function importGlobPlugin(config) {
|
|
875
|
-
return
|
|
883
|
+
return createBuiltinPlugin("builtin:import-glob", config);
|
|
876
884
|
}
|
|
877
885
|
function reporterPlugin(config) {
|
|
878
|
-
return
|
|
886
|
+
return createBuiltinPlugin("builtin:reporter", config);
|
|
879
887
|
}
|
|
880
888
|
function manifestPlugin(config) {
|
|
881
|
-
return
|
|
889
|
+
return createBuiltinPlugin("builtin:manifest", config);
|
|
882
890
|
}
|
|
883
891
|
function wasmHelperPlugin(config) {
|
|
884
|
-
return
|
|
892
|
+
return createBuiltinPlugin("builtin:wasm-helper", config);
|
|
885
893
|
}
|
|
886
894
|
function wasmFallbackPlugin() {
|
|
887
|
-
const builtinPlugin =
|
|
895
|
+
const builtinPlugin = createBuiltinPlugin("builtin:wasm-fallback");
|
|
888
896
|
return makeBuiltinPluginCallable(builtinPlugin);
|
|
889
897
|
}
|
|
890
898
|
function loadFallbackPlugin() {
|
|
891
|
-
return
|
|
899
|
+
return createBuiltinPlugin("builtin:load-fallback");
|
|
892
900
|
}
|
|
893
901
|
function jsonPlugin(config) {
|
|
894
|
-
const builtinPlugin =
|
|
902
|
+
const builtinPlugin = createBuiltinPlugin("builtin:json", config);
|
|
895
903
|
return makeBuiltinPluginCallable(builtinPlugin);
|
|
896
904
|
}
|
|
897
905
|
function buildImportAnalysisPlugin(config) {
|
|
898
|
-
return
|
|
906
|
+
return createBuiltinPlugin("builtin:build-import-analysis", config);
|
|
899
907
|
}
|
|
900
908
|
function viteResolvePlugin(config) {
|
|
901
|
-
const builtinPlugin =
|
|
909
|
+
const builtinPlugin = createBuiltinPlugin("builtin:vite-resolve", config);
|
|
902
910
|
return makeBuiltinPluginCallable(builtinPlugin);
|
|
903
911
|
}
|
|
904
912
|
function isolatedDeclarationPlugin(config) {
|
|
905
|
-
return
|
|
913
|
+
return createBuiltinPlugin("builtin:isolated-declaration", config);
|
|
906
914
|
}
|
|
907
915
|
function assetPlugin(config) {
|
|
908
|
-
return
|
|
916
|
+
return createBuiltinPlugin("builtin:asset", config);
|
|
909
917
|
}
|
|
910
918
|
function webWorkerPostPlugin() {
|
|
911
|
-
return
|
|
919
|
+
return createBuiltinPlugin("builtin:web-worker-post");
|
|
912
920
|
}
|
|
913
921
|
function esmExternalRequirePlugin(config) {
|
|
914
|
-
return
|
|
922
|
+
return createBuiltinPlugin("builtin:esm-external-require", config);
|
|
915
923
|
}
|
|
916
924
|
|
|
917
925
|
//#endregion
|
|
@@ -1005,7 +1013,7 @@ function checkOutputPluginOption(plugins, onLog) {
|
|
|
1005
1013
|
function normalizePlugins(plugins, anonymousPrefix) {
|
|
1006
1014
|
for (const [index, plugin] of plugins.entries()) {
|
|
1007
1015
|
if ("_parallel" in plugin) continue;
|
|
1008
|
-
if (plugin
|
|
1016
|
+
if (isBuiltinPlugin(plugin)) continue;
|
|
1009
1017
|
if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
|
|
1010
1018
|
}
|
|
1011
1019
|
return plugins;
|
|
@@ -1074,7 +1082,7 @@ function getObjectPlugins(plugins) {
|
|
|
1074
1082
|
return plugins.filter((plugin) => {
|
|
1075
1083
|
if (!plugin) return void 0;
|
|
1076
1084
|
if ("_parallel" in plugin) return void 0;
|
|
1077
|
-
if (plugin
|
|
1085
|
+
if (isBuiltinPlugin(plugin)) return void 0;
|
|
1078
1086
|
return plugin;
|
|
1079
1087
|
});
|
|
1080
1088
|
}
|
|
@@ -2329,10 +2337,19 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
|
2329
2337
|
annotations: optional(boolean()),
|
|
2330
2338
|
manualPureFunctions: optional(array(string())),
|
|
2331
2339
|
unknownGlobalSideEffects: optional(boolean()),
|
|
2332
|
-
commonjs: optional(boolean())
|
|
2340
|
+
commonjs: optional(boolean()),
|
|
2341
|
+
propertyReadSideEffects: optional(union([literal(false), literal("always")])),
|
|
2342
|
+
propertyWriteSideEffects: optional(union([literal(false), literal("always")]))
|
|
2333
2343
|
})]);
|
|
2334
2344
|
const OptimizationOptionsSchema = strictObject({
|
|
2335
|
-
inlineConst: pipe(optional(
|
|
2345
|
+
inlineConst: pipe(optional(union([
|
|
2346
|
+
boolean(),
|
|
2347
|
+
literal("smart"),
|
|
2348
|
+
strictObject({
|
|
2349
|
+
mode: optional(union([literal("all"), literal("smart")])),
|
|
2350
|
+
pass: optional(number())
|
|
2351
|
+
})
|
|
2352
|
+
])), description("Enable crossmodule constant inlining")),
|
|
2336
2353
|
pifeForModuleWrappers: pipe(optional(boolean()), description("Use PIFE pattern for module wrappers"))
|
|
2337
2354
|
});
|
|
2338
2355
|
const OnLogSchema = pipe(function_(), args(tuple([
|
|
@@ -2342,6 +2359,7 @@ const OnLogSchema = pipe(function_(), args(tuple([
|
|
|
2342
2359
|
])));
|
|
2343
2360
|
const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
|
|
2344
2361
|
const HmrSchema = union([boolean(), strictObject({
|
|
2362
|
+
new: optional(boolean()),
|
|
2345
2363
|
port: optional(number()),
|
|
2346
2364
|
host: optional(string()),
|
|
2347
2365
|
implement: optional(string())
|
|
@@ -2571,15 +2589,19 @@ const CliOptionsSchema = strictObject({
|
|
|
2571
2589
|
...InputCliOptionsSchema.entries,
|
|
2572
2590
|
...OutputCliOptionsSchema.entries
|
|
2573
2591
|
});
|
|
2574
|
-
const inputHelperMsgRecord = {
|
|
2592
|
+
const inputHelperMsgRecord = {
|
|
2593
|
+
output: { ignored: true },
|
|
2594
|
+
"resolve.tsconfigFilename": { issueMsg: "It is deprecated. Please use the top-level `tsconfig` option instead." }
|
|
2595
|
+
};
|
|
2575
2596
|
const outputHelperMsgRecord = {};
|
|
2576
2597
|
function validateOption(key, options) {
|
|
2598
|
+
if (typeof options !== "object") throw new Error(`Invalid ${key} options. Expected an Object but received ${JSON.stringify(options)}.`);
|
|
2577
2599
|
if (globalThis.process?.env?.ROLLUP_TEST) return;
|
|
2578
2600
|
let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
|
|
2579
2601
|
if (!parsed.success) {
|
|
2580
2602
|
const errors = parsed.issues.map((issue) => {
|
|
2581
|
-
const issuePaths = issue.path.map((path) => path.key);
|
|
2582
2603
|
let issueMsg = issue.message;
|
|
2604
|
+
const issuePaths = issue.path.map((path) => path.key);
|
|
2583
2605
|
if (issue.type === "union") {
|
|
2584
2606
|
const subIssue = issue.issues?.find((i$1) => !(i$1.type !== issue.received && i$1.input === issue.input));
|
|
2585
2607
|
if (subIssue) {
|
|
@@ -2590,9 +2612,9 @@ function validateOption(key, options) {
|
|
|
2590
2612
|
const stringPath = issuePaths.join(".");
|
|
2591
2613
|
const helper = key === "input" ? inputHelperMsgRecord[stringPath] : outputHelperMsgRecord[stringPath];
|
|
2592
2614
|
if (helper && helper.ignored) return "";
|
|
2593
|
-
return `- For the "${stringPath}". ${issueMsg}
|
|
2615
|
+
return `- For the "${stringPath}". ${helper?.issueMsg || issueMsg + "."} ${helper?.help ? `\n Help: ${helper.help}` : ""}`;
|
|
2594
2616
|
}).filter(Boolean);
|
|
2595
|
-
if (errors.length) console.warn(
|
|
2617
|
+
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
2618
|
}
|
|
2597
2619
|
}
|
|
2598
2620
|
|
|
@@ -2656,6 +2678,10 @@ function getErrorMessage(e$2) {
|
|
|
2656
2678
|
s$1 += message;
|
|
2657
2679
|
if (e$2.frame) s$1 = joinNewLine(s$1, e$2.frame);
|
|
2658
2680
|
if (e$2.stack) s$1 = joinNewLine(s$1, e$2.stack.replace(message, ""));
|
|
2681
|
+
if (e$2.cause) {
|
|
2682
|
+
s$1 = joinNewLine(s$1, "Caused by:");
|
|
2683
|
+
s$1 = joinNewLine(s$1, getErrorMessage(e$2.cause).split("\n").map((line) => " " + line).join("\n"));
|
|
2684
|
+
}
|
|
2659
2685
|
return s$1;
|
|
2660
2686
|
}
|
|
2661
2687
|
function joinNewLine(s1, s2) {
|
|
@@ -4330,7 +4356,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
4330
4356
|
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
|
|
4331
4357
|
const plugins = rawPlugins.map((plugin) => {
|
|
4332
4358
|
if ("_parallel" in plugin) return void 0;
|
|
4333
|
-
if (plugin
|
|
4359
|
+
if (isBuiltinPlugin(plugin)) return bindingifyBuiltInPlugin(plugin);
|
|
4334
4360
|
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
4335
4361
|
});
|
|
4336
4362
|
const { jsx, transform } = bindingifyJsx(onLog, inputOptions.jsx, inputOptions.transform);
|
|
@@ -4343,7 +4369,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
4343
4369
|
platform: inputOptions.platform,
|
|
4344
4370
|
shimMissingExports: inputOptions.shimMissingExports,
|
|
4345
4371
|
logLevel: bindingifyLogLevel(logLevel),
|
|
4346
|
-
onLog,
|
|
4372
|
+
onLog: async (level, log) => onLog(level, log),
|
|
4347
4373
|
treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
|
|
4348
4374
|
moduleTypes: inputOptions.moduleTypes,
|
|
4349
4375
|
define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
|
|
@@ -4373,7 +4399,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
4373
4399
|
preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
|
|
4374
4400
|
optimization: inputOptions.optimization,
|
|
4375
4401
|
context: inputOptions.context,
|
|
4376
|
-
tsconfig: inputOptions.tsconfig
|
|
4402
|
+
tsconfig: inputOptions.resolve?.tsconfigFilename ?? inputOptions.tsconfig
|
|
4377
4403
|
};
|
|
4378
4404
|
}
|
|
4379
4405
|
function bindingifyHmr(hmr) {
|
|
@@ -4548,6 +4574,24 @@ function bindingifyTreeshakeOptions(config) {
|
|
|
4548
4574
|
unknownGlobalSideEffects: config.unknownGlobalSideEffects,
|
|
4549
4575
|
commonjs: config.commonjs
|
|
4550
4576
|
};
|
|
4577
|
+
switch (config.propertyReadSideEffects) {
|
|
4578
|
+
case "always":
|
|
4579
|
+
normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.Always;
|
|
4580
|
+
break;
|
|
4581
|
+
case false:
|
|
4582
|
+
normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.False;
|
|
4583
|
+
break;
|
|
4584
|
+
default:
|
|
4585
|
+
}
|
|
4586
|
+
switch (config.propertyWriteSideEffects) {
|
|
4587
|
+
case "always":
|
|
4588
|
+
normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.Always;
|
|
4589
|
+
break;
|
|
4590
|
+
case false:
|
|
4591
|
+
normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.False;
|
|
4592
|
+
break;
|
|
4593
|
+
default:
|
|
4594
|
+
}
|
|
4551
4595
|
if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
|
|
4552
4596
|
else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
|
|
4553
4597
|
external: true,
|
|
@@ -4870,4 +4914,4 @@ function defineConfig(config) {
|
|
|
4870
4914
|
const VERSION = version;
|
|
4871
4915
|
|
|
4872
4916
|
//#endregion
|
|
4873
|
-
export {
|
|
4917
|
+
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