@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,11 +1,11 @@
|
|
|
1
1
|
import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-C_CZT4St.mjs";
|
|
2
2
|
import { and, arraify, code, exclude, id, include, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-ByKQkexh.mjs";
|
|
3
|
-
import {
|
|
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.35";
|
|
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;
|
|
@@ -206,59 +214,59 @@ function isReadonlyArray(input) {
|
|
|
206
214
|
//#endregion
|
|
207
215
|
//#region src/builtin-plugin/constructors.ts
|
|
208
216
|
function modulePreloadPolyfillPlugin(config) {
|
|
209
|
-
return
|
|
217
|
+
return createBuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
210
218
|
}
|
|
211
219
|
function dynamicImportVarsPlugin(config) {
|
|
212
220
|
if (config) {
|
|
213
221
|
config.include = normalizedStringOrRegex(config.include);
|
|
214
222
|
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
215
223
|
}
|
|
216
|
-
return
|
|
224
|
+
return createBuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
217
225
|
}
|
|
218
226
|
function importGlobPlugin(config) {
|
|
219
|
-
return
|
|
227
|
+
return createBuiltinPlugin("builtin:import-glob", config);
|
|
220
228
|
}
|
|
221
229
|
function reporterPlugin(config) {
|
|
222
|
-
return
|
|
230
|
+
return createBuiltinPlugin("builtin:reporter", config);
|
|
223
231
|
}
|
|
224
232
|
function manifestPlugin(config) {
|
|
225
|
-
return
|
|
233
|
+
return createBuiltinPlugin("builtin:manifest", config);
|
|
226
234
|
}
|
|
227
235
|
function wasmHelperPlugin(config) {
|
|
228
|
-
return
|
|
236
|
+
return createBuiltinPlugin("builtin:wasm-helper", config);
|
|
229
237
|
}
|
|
230
238
|
function wasmFallbackPlugin() {
|
|
231
|
-
const builtinPlugin =
|
|
239
|
+
const builtinPlugin = createBuiltinPlugin("builtin:wasm-fallback");
|
|
232
240
|
return makeBuiltinPluginCallable(builtinPlugin);
|
|
233
241
|
}
|
|
234
242
|
function loadFallbackPlugin() {
|
|
235
|
-
return
|
|
243
|
+
return createBuiltinPlugin("builtin:load-fallback");
|
|
236
244
|
}
|
|
237
245
|
function jsonPlugin(config) {
|
|
238
|
-
const builtinPlugin =
|
|
246
|
+
const builtinPlugin = createBuiltinPlugin("builtin:json", config);
|
|
239
247
|
return makeBuiltinPluginCallable(builtinPlugin);
|
|
240
248
|
}
|
|
241
249
|
function buildImportAnalysisPlugin(config) {
|
|
242
|
-
return
|
|
250
|
+
return createBuiltinPlugin("builtin:build-import-analysis", config);
|
|
243
251
|
}
|
|
244
252
|
function viteResolvePlugin(config) {
|
|
245
|
-
const builtinPlugin =
|
|
253
|
+
const builtinPlugin = createBuiltinPlugin("builtin:vite-resolve", config);
|
|
246
254
|
return makeBuiltinPluginCallable(builtinPlugin);
|
|
247
255
|
}
|
|
248
256
|
function isolatedDeclarationPlugin(config) {
|
|
249
|
-
return
|
|
257
|
+
return createBuiltinPlugin("builtin:isolated-declaration", config);
|
|
250
258
|
}
|
|
251
259
|
function assetPlugin(config) {
|
|
252
|
-
return
|
|
260
|
+
return createBuiltinPlugin("builtin:asset", config);
|
|
253
261
|
}
|
|
254
262
|
function webWorkerPostPlugin() {
|
|
255
|
-
return
|
|
263
|
+
return createBuiltinPlugin("builtin:web-worker-post");
|
|
256
264
|
}
|
|
257
265
|
function oxcRuntimePlugin(config) {
|
|
258
|
-
return
|
|
266
|
+
return createBuiltinPlugin("builtin:oxc-runtime", config);
|
|
259
267
|
}
|
|
260
268
|
function esmExternalRequirePlugin(config) {
|
|
261
|
-
return
|
|
269
|
+
return createBuiltinPlugin("builtin:esm-external-require", config);
|
|
262
270
|
}
|
|
263
271
|
|
|
264
272
|
//#endregion
|
|
@@ -352,7 +360,7 @@ function checkOutputPluginOption(plugins, onLog) {
|
|
|
352
360
|
function normalizePlugins(plugins, anonymousPrefix) {
|
|
353
361
|
for (const [index, plugin] of plugins.entries()) {
|
|
354
362
|
if ("_parallel" in plugin) continue;
|
|
355
|
-
if (plugin
|
|
363
|
+
if (isBuiltinPlugin(plugin)) continue;
|
|
356
364
|
if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
|
|
357
365
|
}
|
|
358
366
|
return plugins;
|
|
@@ -421,7 +429,7 @@ function getObjectPlugins(plugins) {
|
|
|
421
429
|
return plugins.filter((plugin) => {
|
|
422
430
|
if (!plugin) return void 0;
|
|
423
431
|
if ("_parallel" in plugin) return void 0;
|
|
424
|
-
if (plugin
|
|
432
|
+
if (isBuiltinPlugin(plugin)) return void 0;
|
|
425
433
|
return plugin;
|
|
426
434
|
});
|
|
427
435
|
}
|
|
@@ -2092,10 +2100,19 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
|
2092
2100
|
annotations: optional(boolean()),
|
|
2093
2101
|
manualPureFunctions: optional(array(string())),
|
|
2094
2102
|
unknownGlobalSideEffects: optional(boolean()),
|
|
2095
|
-
commonjs: optional(boolean())
|
|
2103
|
+
commonjs: optional(boolean()),
|
|
2104
|
+
propertyReadSideEffects: optional(union([literal(false), literal("always")])),
|
|
2105
|
+
propertyWriteSideEffects: optional(union([literal(false), literal("always")]))
|
|
2096
2106
|
})]);
|
|
2097
2107
|
const OptimizationOptionsSchema = strictObject({
|
|
2098
|
-
inlineConst: pipe(optional(
|
|
2108
|
+
inlineConst: pipe(optional(union([
|
|
2109
|
+
boolean(),
|
|
2110
|
+
literal("smart"),
|
|
2111
|
+
strictObject({
|
|
2112
|
+
mode: optional(union([literal("all"), literal("smart")])),
|
|
2113
|
+
pass: optional(number())
|
|
2114
|
+
})
|
|
2115
|
+
])), description("Enable crossmodule constant inlining")),
|
|
2099
2116
|
pifeForModuleWrappers: pipe(optional(boolean()), description("Use PIFE pattern for module wrappers"))
|
|
2100
2117
|
});
|
|
2101
2118
|
const OnLogSchema = pipe(function_(), args(tuple([
|
|
@@ -2105,6 +2122,7 @@ const OnLogSchema = pipe(function_(), args(tuple([
|
|
|
2105
2122
|
])));
|
|
2106
2123
|
const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
|
|
2107
2124
|
const HmrSchema = union([boolean(), strictObject({
|
|
2125
|
+
new: optional(boolean()),
|
|
2108
2126
|
port: optional(number()),
|
|
2109
2127
|
host: optional(string()),
|
|
2110
2128
|
implement: optional(string())
|
|
@@ -2341,15 +2359,19 @@ function validateCliOptions(options) {
|
|
|
2341
2359
|
return `Invalid value for option ${option}: ${issue.message}`;
|
|
2342
2360
|
})];
|
|
2343
2361
|
}
|
|
2344
|
-
const inputHelperMsgRecord = {
|
|
2362
|
+
const inputHelperMsgRecord = {
|
|
2363
|
+
output: { ignored: true },
|
|
2364
|
+
"resolve.tsconfigFilename": { issueMsg: "It is deprecated. Please use the top-level `tsconfig` option instead." }
|
|
2365
|
+
};
|
|
2345
2366
|
const outputHelperMsgRecord = {};
|
|
2346
2367
|
function validateOption(key, options) {
|
|
2368
|
+
if (typeof options !== "object") throw new Error(`Invalid ${key} options. Expected an Object but received ${JSON.stringify(options)}.`);
|
|
2347
2369
|
if (globalThis.process?.env?.ROLLUP_TEST) return;
|
|
2348
2370
|
let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
|
|
2349
2371
|
if (!parsed.success) {
|
|
2350
2372
|
const errors = parsed.issues.map((issue) => {
|
|
2351
|
-
const issuePaths = issue.path.map((path$1) => path$1.key);
|
|
2352
2373
|
let issueMsg = issue.message;
|
|
2374
|
+
const issuePaths = issue.path.map((path$1) => path$1.key);
|
|
2353
2375
|
if (issue.type === "union") {
|
|
2354
2376
|
const subIssue = issue.issues?.find((i$1) => !(i$1.type !== issue.received && i$1.input === issue.input));
|
|
2355
2377
|
if (subIssue) {
|
|
@@ -2360,9 +2382,9 @@ function validateOption(key, options) {
|
|
|
2360
2382
|
const stringPath = issuePaths.join(".");
|
|
2361
2383
|
const helper = key === "input" ? inputHelperMsgRecord[stringPath] : outputHelperMsgRecord[stringPath];
|
|
2362
2384
|
if (helper && helper.ignored) return "";
|
|
2363
|
-
return `- For the "${stringPath}". ${issueMsg}
|
|
2385
|
+
return `- For the "${stringPath}". ${helper?.issueMsg || issueMsg + "."} ${helper?.help ? `\n Help: ${helper.help}` : ""}`;
|
|
2364
2386
|
}).filter(Boolean);
|
|
2365
|
-
if (errors.length) console.warn(
|
|
2387
|
+
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
2388
|
}
|
|
2367
2389
|
}
|
|
2368
2390
|
function getInputCliKeys() {
|
|
@@ -2435,6 +2457,10 @@ function getErrorMessage(e$2) {
|
|
|
2435
2457
|
s$1 += message;
|
|
2436
2458
|
if (e$2.frame) s$1 = joinNewLine(s$1, e$2.frame);
|
|
2437
2459
|
if (e$2.stack) s$1 = joinNewLine(s$1, e$2.stack.replace(message, ""));
|
|
2460
|
+
if (e$2.cause) {
|
|
2461
|
+
s$1 = joinNewLine(s$1, "Caused by:");
|
|
2462
|
+
s$1 = joinNewLine(s$1, getErrorMessage(e$2.cause).split("\n").map((line) => " " + line).join("\n"));
|
|
2463
|
+
}
|
|
2438
2464
|
return s$1;
|
|
2439
2465
|
}
|
|
2440
2466
|
function joinNewLine(s1, s2) {
|
|
@@ -3949,7 +3975,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3949
3975
|
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
|
|
3950
3976
|
const plugins = rawPlugins.map((plugin) => {
|
|
3951
3977
|
if ("_parallel" in plugin) return void 0;
|
|
3952
|
-
if (plugin
|
|
3978
|
+
if (isBuiltinPlugin(plugin)) return bindingifyBuiltInPlugin(plugin);
|
|
3953
3979
|
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
3954
3980
|
});
|
|
3955
3981
|
const { jsx, transform } = bindingifyJsx(onLog, inputOptions.jsx, inputOptions.transform);
|
|
@@ -3962,7 +3988,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3962
3988
|
platform: inputOptions.platform,
|
|
3963
3989
|
shimMissingExports: inputOptions.shimMissingExports,
|
|
3964
3990
|
logLevel: bindingifyLogLevel(logLevel),
|
|
3965
|
-
onLog,
|
|
3991
|
+
onLog: async (level, log) => onLog(level, log),
|
|
3966
3992
|
treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
|
|
3967
3993
|
moduleTypes: inputOptions.moduleTypes,
|
|
3968
3994
|
define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
|
|
@@ -3992,7 +4018,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3992
4018
|
preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
|
|
3993
4019
|
optimization: inputOptions.optimization,
|
|
3994
4020
|
context: inputOptions.context,
|
|
3995
|
-
tsconfig: inputOptions.tsconfig
|
|
4021
|
+
tsconfig: inputOptions.resolve?.tsconfigFilename ?? inputOptions.tsconfig
|
|
3996
4022
|
};
|
|
3997
4023
|
}
|
|
3998
4024
|
function bindingifyHmr(hmr) {
|
|
@@ -4167,6 +4193,24 @@ function bindingifyTreeshakeOptions(config) {
|
|
|
4167
4193
|
unknownGlobalSideEffects: config.unknownGlobalSideEffects,
|
|
4168
4194
|
commonjs: config.commonjs
|
|
4169
4195
|
};
|
|
4196
|
+
switch (config.propertyReadSideEffects) {
|
|
4197
|
+
case "always":
|
|
4198
|
+
normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.Always;
|
|
4199
|
+
break;
|
|
4200
|
+
case false:
|
|
4201
|
+
normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.False;
|
|
4202
|
+
break;
|
|
4203
|
+
default:
|
|
4204
|
+
}
|
|
4205
|
+
switch (config.propertyWriteSideEffects) {
|
|
4206
|
+
case "always":
|
|
4207
|
+
normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.Always;
|
|
4208
|
+
break;
|
|
4209
|
+
case false:
|
|
4210
|
+
normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.False;
|
|
4211
|
+
break;
|
|
4212
|
+
default:
|
|
4213
|
+
}
|
|
4170
4214
|
if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
|
|
4171
4215
|
else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
|
|
4172
4216
|
external: true,
|
|
@@ -4551,4 +4595,4 @@ function defineConfig(config) {
|
|
|
4551
4595
|
const VERSION = version;
|
|
4552
4596
|
|
|
4553
4597
|
//#endregion
|
|
4554
|
-
export {
|
|
4598
|
+
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 };
|
|
@@ -1,25 +1,39 @@
|
|
|
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-J0xVKZRe.cjs');
|
|
3
3
|
const require_dist = require('./dist-CK0hotcm.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
let node_worker_threads = require("node:worker_threads");
|
|
5
|
+
node_worker_threads = require_chunk.__toESM(node_worker_threads);
|
|
6
|
+
let src_rolldown_binding_wasi_cjs = require("../rolldown-binding.wasi.cjs");
|
|
7
|
+
src_rolldown_binding_wasi_cjs = require_chunk.__toESM(src_rolldown_binding_wasi_cjs);
|
|
8
|
+
let node_path = require("node:path");
|
|
9
|
+
node_path = require_chunk.__toESM(node_path);
|
|
10
|
+
let node_url = require("node:url");
|
|
11
|
+
node_url = require_chunk.__toESM(node_url);
|
|
12
|
+
let node_fs_promises = require("node:fs/promises");
|
|
13
|
+
node_fs_promises = require_chunk.__toESM(node_fs_promises);
|
|
14
|
+
let node_os = require("node:os");
|
|
15
|
+
node_os = require_chunk.__toESM(node_os);
|
|
10
16
|
|
|
11
17
|
//#region package.json
|
|
12
|
-
var version = "1.0.0-beta.
|
|
18
|
+
var version = "1.0.0-beta.35";
|
|
13
19
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
14
20
|
|
|
15
21
|
//#endregion
|
|
16
22
|
//#region src/builtin-plugin/utils.ts
|
|
23
|
+
const BuiltinClassSymbol = Symbol.for("__RolldownBuiltinPlugin__");
|
|
17
24
|
var BuiltinPlugin = class {
|
|
18
25
|
constructor(name, _options) {
|
|
19
26
|
this.name = name;
|
|
20
27
|
this._options = _options;
|
|
28
|
+
this[BuiltinClassSymbol] = true;
|
|
21
29
|
}
|
|
22
30
|
};
|
|
31
|
+
function isBuiltinPlugin(obj) {
|
|
32
|
+
return obj && obj[BuiltinClassSymbol] === true;
|
|
33
|
+
}
|
|
34
|
+
function createBuiltinPlugin(name, options) {
|
|
35
|
+
return new BuiltinPlugin(name, options);
|
|
36
|
+
}
|
|
23
37
|
function makeBuiltinPluginCallable(plugin) {
|
|
24
38
|
let callablePlugin = new src_rolldown_binding_wasi_cjs.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
25
39
|
const wrappedPlugin = plugin;
|
|
@@ -181,59 +195,59 @@ function isReadonlyArray(input) {
|
|
|
181
195
|
//#endregion
|
|
182
196
|
//#region src/builtin-plugin/constructors.ts
|
|
183
197
|
function modulePreloadPolyfillPlugin(config) {
|
|
184
|
-
return
|
|
198
|
+
return createBuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
185
199
|
}
|
|
186
200
|
function dynamicImportVarsPlugin(config) {
|
|
187
201
|
if (config) {
|
|
188
202
|
config.include = normalizedStringOrRegex(config.include);
|
|
189
203
|
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
190
204
|
}
|
|
191
|
-
return
|
|
205
|
+
return createBuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
192
206
|
}
|
|
193
207
|
function importGlobPlugin(config) {
|
|
194
|
-
return
|
|
208
|
+
return createBuiltinPlugin("builtin:import-glob", config);
|
|
195
209
|
}
|
|
196
210
|
function reporterPlugin(config) {
|
|
197
|
-
return
|
|
211
|
+
return createBuiltinPlugin("builtin:reporter", config);
|
|
198
212
|
}
|
|
199
213
|
function manifestPlugin(config) {
|
|
200
|
-
return
|
|
214
|
+
return createBuiltinPlugin("builtin:manifest", config);
|
|
201
215
|
}
|
|
202
216
|
function wasmHelperPlugin(config) {
|
|
203
|
-
return
|
|
217
|
+
return createBuiltinPlugin("builtin:wasm-helper", config);
|
|
204
218
|
}
|
|
205
219
|
function wasmFallbackPlugin() {
|
|
206
|
-
const builtinPlugin =
|
|
220
|
+
const builtinPlugin = createBuiltinPlugin("builtin:wasm-fallback");
|
|
207
221
|
return makeBuiltinPluginCallable(builtinPlugin);
|
|
208
222
|
}
|
|
209
223
|
function loadFallbackPlugin() {
|
|
210
|
-
return
|
|
224
|
+
return createBuiltinPlugin("builtin:load-fallback");
|
|
211
225
|
}
|
|
212
226
|
function jsonPlugin(config) {
|
|
213
|
-
const builtinPlugin =
|
|
227
|
+
const builtinPlugin = createBuiltinPlugin("builtin:json", config);
|
|
214
228
|
return makeBuiltinPluginCallable(builtinPlugin);
|
|
215
229
|
}
|
|
216
230
|
function buildImportAnalysisPlugin(config) {
|
|
217
|
-
return
|
|
231
|
+
return createBuiltinPlugin("builtin:build-import-analysis", config);
|
|
218
232
|
}
|
|
219
233
|
function viteResolvePlugin(config) {
|
|
220
|
-
const builtinPlugin =
|
|
234
|
+
const builtinPlugin = createBuiltinPlugin("builtin:vite-resolve", config);
|
|
221
235
|
return makeBuiltinPluginCallable(builtinPlugin);
|
|
222
236
|
}
|
|
223
237
|
function isolatedDeclarationPlugin(config) {
|
|
224
|
-
return
|
|
238
|
+
return createBuiltinPlugin("builtin:isolated-declaration", config);
|
|
225
239
|
}
|
|
226
240
|
function assetPlugin(config) {
|
|
227
|
-
return
|
|
241
|
+
return createBuiltinPlugin("builtin:asset", config);
|
|
228
242
|
}
|
|
229
243
|
function webWorkerPostPlugin() {
|
|
230
|
-
return
|
|
244
|
+
return createBuiltinPlugin("builtin:web-worker-post");
|
|
231
245
|
}
|
|
232
246
|
function oxcRuntimePlugin(config) {
|
|
233
|
-
return
|
|
247
|
+
return createBuiltinPlugin("builtin:oxc-runtime", config);
|
|
234
248
|
}
|
|
235
249
|
function esmExternalRequirePlugin(config) {
|
|
236
|
-
return
|
|
250
|
+
return createBuiltinPlugin("builtin:esm-external-require", config);
|
|
237
251
|
}
|
|
238
252
|
|
|
239
253
|
//#endregion
|
|
@@ -327,7 +341,7 @@ function checkOutputPluginOption(plugins, onLog) {
|
|
|
327
341
|
function normalizePlugins(plugins, anonymousPrefix) {
|
|
328
342
|
for (const [index, plugin] of plugins.entries()) {
|
|
329
343
|
if ("_parallel" in plugin) continue;
|
|
330
|
-
if (plugin
|
|
344
|
+
if (isBuiltinPlugin(plugin)) continue;
|
|
331
345
|
if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
|
|
332
346
|
}
|
|
333
347
|
return plugins;
|
|
@@ -396,7 +410,7 @@ function getObjectPlugins(plugins) {
|
|
|
396
410
|
return plugins.filter((plugin) => {
|
|
397
411
|
if (!plugin) return void 0;
|
|
398
412
|
if ("_parallel" in plugin) return void 0;
|
|
399
|
-
if (plugin
|
|
413
|
+
if (isBuiltinPlugin(plugin)) return void 0;
|
|
400
414
|
return plugin;
|
|
401
415
|
});
|
|
402
416
|
}
|
|
@@ -2067,10 +2081,19 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
|
2067
2081
|
annotations: optional(boolean()),
|
|
2068
2082
|
manualPureFunctions: optional(array(string())),
|
|
2069
2083
|
unknownGlobalSideEffects: optional(boolean()),
|
|
2070
|
-
commonjs: optional(boolean())
|
|
2084
|
+
commonjs: optional(boolean()),
|
|
2085
|
+
propertyReadSideEffects: optional(union([literal(false), literal("always")])),
|
|
2086
|
+
propertyWriteSideEffects: optional(union([literal(false), literal("always")]))
|
|
2071
2087
|
})]);
|
|
2072
2088
|
const OptimizationOptionsSchema = strictObject({
|
|
2073
|
-
inlineConst: pipe(optional(
|
|
2089
|
+
inlineConst: pipe(optional(union([
|
|
2090
|
+
boolean(),
|
|
2091
|
+
literal("smart"),
|
|
2092
|
+
strictObject({
|
|
2093
|
+
mode: optional(union([literal("all"), literal("smart")])),
|
|
2094
|
+
pass: optional(number())
|
|
2095
|
+
})
|
|
2096
|
+
])), description("Enable crossmodule constant inlining")),
|
|
2074
2097
|
pifeForModuleWrappers: pipe(optional(boolean()), description("Use PIFE pattern for module wrappers"))
|
|
2075
2098
|
});
|
|
2076
2099
|
const OnLogSchema = pipe(function_(), args(tuple([
|
|
@@ -2080,6 +2103,7 @@ const OnLogSchema = pipe(function_(), args(tuple([
|
|
|
2080
2103
|
])));
|
|
2081
2104
|
const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
|
|
2082
2105
|
const HmrSchema = union([boolean(), strictObject({
|
|
2106
|
+
new: optional(boolean()),
|
|
2083
2107
|
port: optional(number()),
|
|
2084
2108
|
host: optional(string()),
|
|
2085
2109
|
implement: optional(string())
|
|
@@ -2316,15 +2340,19 @@ function validateCliOptions(options) {
|
|
|
2316
2340
|
return `Invalid value for option ${option}: ${issue.message}`;
|
|
2317
2341
|
})];
|
|
2318
2342
|
}
|
|
2319
|
-
const inputHelperMsgRecord = {
|
|
2343
|
+
const inputHelperMsgRecord = {
|
|
2344
|
+
output: { ignored: true },
|
|
2345
|
+
"resolve.tsconfigFilename": { issueMsg: "It is deprecated. Please use the top-level `tsconfig` option instead." }
|
|
2346
|
+
};
|
|
2320
2347
|
const outputHelperMsgRecord = {};
|
|
2321
2348
|
function validateOption(key, options) {
|
|
2349
|
+
if (typeof options !== "object") throw new Error(`Invalid ${key} options. Expected an Object but received ${JSON.stringify(options)}.`);
|
|
2322
2350
|
if (globalThis.process?.env?.ROLLUP_TEST) return;
|
|
2323
2351
|
let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
|
|
2324
2352
|
if (!parsed.success) {
|
|
2325
2353
|
const errors = parsed.issues.map((issue) => {
|
|
2326
|
-
const issuePaths = issue.path.map((path$2) => path$2.key);
|
|
2327
2354
|
let issueMsg = issue.message;
|
|
2355
|
+
const issuePaths = issue.path.map((path$2) => path$2.key);
|
|
2328
2356
|
if (issue.type === "union") {
|
|
2329
2357
|
const subIssue = issue.issues?.find((i$1) => !(i$1.type !== issue.received && i$1.input === issue.input));
|
|
2330
2358
|
if (subIssue) {
|
|
@@ -2335,9 +2363,9 @@ function validateOption(key, options) {
|
|
|
2335
2363
|
const stringPath = issuePaths.join(".");
|
|
2336
2364
|
const helper = key === "input" ? inputHelperMsgRecord[stringPath] : outputHelperMsgRecord[stringPath];
|
|
2337
2365
|
if (helper && helper.ignored) return "";
|
|
2338
|
-
return `- For the "${stringPath}". ${issueMsg}
|
|
2366
|
+
return `- For the "${stringPath}". ${helper?.issueMsg || issueMsg + "."} ${helper?.help ? `\n Help: ${helper.help}` : ""}`;
|
|
2339
2367
|
}).filter(Boolean);
|
|
2340
|
-
if (errors.length) console.warn(
|
|
2368
|
+
if (errors.length) console.warn(`\x1b[33mWarning: Invalid ${key} options (${errors.length} issue${errors.length === 1 ? "" : "s"} found)\n${errors.join("\n")}\x1b[0m`);
|
|
2341
2369
|
}
|
|
2342
2370
|
}
|
|
2343
2371
|
function getInputCliKeys() {
|
|
@@ -2410,6 +2438,10 @@ function getErrorMessage(e$2) {
|
|
|
2410
2438
|
s$1 += message;
|
|
2411
2439
|
if (e$2.frame) s$1 = joinNewLine(s$1, e$2.frame);
|
|
2412
2440
|
if (e$2.stack) s$1 = joinNewLine(s$1, e$2.stack.replace(message, ""));
|
|
2441
|
+
if (e$2.cause) {
|
|
2442
|
+
s$1 = joinNewLine(s$1, "Caused by:");
|
|
2443
|
+
s$1 = joinNewLine(s$1, getErrorMessage(e$2.cause).split("\n").map((line) => " " + line).join("\n"));
|
|
2444
|
+
}
|
|
2413
2445
|
return s$1;
|
|
2414
2446
|
}
|
|
2415
2447
|
function joinNewLine(s1, s2) {
|
|
@@ -3924,7 +3956,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3924
3956
|
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
|
|
3925
3957
|
const plugins = rawPlugins.map((plugin) => {
|
|
3926
3958
|
if ("_parallel" in plugin) return void 0;
|
|
3927
|
-
if (plugin
|
|
3959
|
+
if (isBuiltinPlugin(plugin)) return bindingifyBuiltInPlugin(plugin);
|
|
3928
3960
|
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
3929
3961
|
});
|
|
3930
3962
|
const { jsx, transform } = bindingifyJsx(onLog, inputOptions.jsx, inputOptions.transform);
|
|
@@ -3937,7 +3969,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3937
3969
|
platform: inputOptions.platform,
|
|
3938
3970
|
shimMissingExports: inputOptions.shimMissingExports,
|
|
3939
3971
|
logLevel: bindingifyLogLevel(logLevel),
|
|
3940
|
-
onLog,
|
|
3972
|
+
onLog: async (level, log) => onLog(level, log),
|
|
3941
3973
|
treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
|
|
3942
3974
|
moduleTypes: inputOptions.moduleTypes,
|
|
3943
3975
|
define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
|
|
@@ -3967,7 +3999,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3967
3999
|
preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
|
|
3968
4000
|
optimization: inputOptions.optimization,
|
|
3969
4001
|
context: inputOptions.context,
|
|
3970
|
-
tsconfig: inputOptions.tsconfig
|
|
4002
|
+
tsconfig: inputOptions.resolve?.tsconfigFilename ?? inputOptions.tsconfig
|
|
3971
4003
|
};
|
|
3972
4004
|
}
|
|
3973
4005
|
function bindingifyHmr(hmr) {
|
|
@@ -4142,6 +4174,24 @@ function bindingifyTreeshakeOptions(config) {
|
|
|
4142
4174
|
unknownGlobalSideEffects: config.unknownGlobalSideEffects,
|
|
4143
4175
|
commonjs: config.commonjs
|
|
4144
4176
|
};
|
|
4177
|
+
switch (config.propertyReadSideEffects) {
|
|
4178
|
+
case "always":
|
|
4179
|
+
normalizedConfig.propertyReadSideEffects = src_rolldown_binding_wasi_cjs.BindingPropertyReadSideEffects.Always;
|
|
4180
|
+
break;
|
|
4181
|
+
case false:
|
|
4182
|
+
normalizedConfig.propertyReadSideEffects = src_rolldown_binding_wasi_cjs.BindingPropertyReadSideEffects.False;
|
|
4183
|
+
break;
|
|
4184
|
+
default:
|
|
4185
|
+
}
|
|
4186
|
+
switch (config.propertyWriteSideEffects) {
|
|
4187
|
+
case "always":
|
|
4188
|
+
normalizedConfig.propertyWriteSideEffects = src_rolldown_binding_wasi_cjs.BindingPropertyWriteSideEffects.Always;
|
|
4189
|
+
break;
|
|
4190
|
+
case false:
|
|
4191
|
+
normalizedConfig.propertyWriteSideEffects = src_rolldown_binding_wasi_cjs.BindingPropertyWriteSideEffects.False;
|
|
4192
|
+
break;
|
|
4193
|
+
default:
|
|
4194
|
+
}
|
|
4145
4195
|
if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
|
|
4146
4196
|
else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
|
|
4147
4197
|
external: true,
|
|
@@ -4526,12 +4576,6 @@ function defineConfig(config) {
|
|
|
4526
4576
|
const VERSION = version;
|
|
4527
4577
|
|
|
4528
4578
|
//#endregion
|
|
4529
|
-
Object.defineProperty(exports, 'BuiltinPlugin', {
|
|
4530
|
-
enumerable: true,
|
|
4531
|
-
get: function () {
|
|
4532
|
-
return BuiltinPlugin;
|
|
4533
|
-
}
|
|
4534
|
-
});
|
|
4535
4579
|
Object.defineProperty(exports, 'PluginContextData', {
|
|
4536
4580
|
enumerable: true,
|
|
4537
4581
|
get: function () {
|
|
@@ -4580,6 +4624,12 @@ Object.defineProperty(exports, 'buildImportAnalysisPlugin', {
|
|
|
4580
4624
|
return buildImportAnalysisPlugin;
|
|
4581
4625
|
}
|
|
4582
4626
|
});
|
|
4627
|
+
Object.defineProperty(exports, 'createBuiltinPlugin', {
|
|
4628
|
+
enumerable: true,
|
|
4629
|
+
get: function () {
|
|
4630
|
+
return createBuiltinPlugin;
|
|
4631
|
+
}
|
|
4632
|
+
});
|
|
4583
4633
|
Object.defineProperty(exports, 'createBundlerImpl', {
|
|
4584
4634
|
enumerable: true,
|
|
4585
4635
|
get: function () {
|