@rolldown/browser 1.0.0-beta.33 → 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 +243 -238
- package/dist/cli.mjs +232 -232
- package/dist/config.cjs +3 -3
- package/dist/config.d.cts +2 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/experimental-index.browser.mjs +51 -6
- package/dist/experimental-index.cjs +57 -7
- package/dist/experimental-index.d.cts +45 -4
- package/dist/experimental-index.d.mts +45 -4
- package/dist/experimental-index.mjs +52 -7
- package/dist/filter-index.d.cts +2 -2
- package/dist/filter-index.d.mts +2 -2
- package/dist/index.browser.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/parallel-plugin-worker.cjs +6 -4
- package/dist/parallel-plugin-worker.mjs +3 -3
- package/dist/parallel-plugin.d.cts +2 -2
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.cjs +1 -1
- package/dist/parse-ast-index.d.cts +1 -1
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/rolldown-binding.wasi-browser.js +7 -0
- package/dist/rolldown-binding.wasi.cjs +7 -0
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-CFhvYkVn.d.mts → binding-9k0egz6L.d.mts} +107 -7
- package/dist/shared/{binding-DQk9TN_A.d.cts → binding-D13M6Llu.d.cts} +107 -7
- package/dist/shared/{define-config-B3QOs3Kt.d.cts → define-config-DJXaSinS.d.mts} +90 -24
- package/dist/shared/{define-config-DyjJkNqG.d.mts → define-config-DhrkZ_o7.d.cts} +90 -24
- package/dist/shared/{load-config-CLPLfZVe.mjs → load-config-BCjD-AGJ.mjs} +1 -1
- package/dist/shared/{load-config-xKQFLlGV.cjs → load-config-BJKhRKZL.cjs} +11 -6
- package/dist/shared/{parse-ast-index-BGzB5Bo-.mjs → parse-ast-index-C_CZT4St.mjs} +1 -1
- package/dist/shared/{parse-ast-index-BZfwAN9P.cjs → parse-ast-index-J0xVKZRe.cjs} +3 -2
- package/dist/shared/{prompt-QNI93ne7.cjs → prompt-Q05EYrFb.cjs} +8 -4
- package/dist/shared/{src-CZgQg1yE.mjs → src-B0RCtUy7.mjs} +160 -101
- package/dist/shared/{src-CGziNJPr.cjs → src-Bd4BGX4v.cjs} +193 -116
- package/dist/{src-D_htlJ_o.js → src-C8U06Im1.js} +157 -98
- package/package.json +19 -11
|
@@ -1,30 +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
|
-
//#region src/utils
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
//#region src/builtin-plugin/utils.ts
|
|
23
|
+
const BuiltinClassSymbol = Symbol.for("__RolldownBuiltinPlugin__");
|
|
24
|
+
var BuiltinPlugin = class {
|
|
25
|
+
constructor(name, _options) {
|
|
26
|
+
this.name = name;
|
|
27
|
+
this._options = _options;
|
|
28
|
+
this[BuiltinClassSymbol] = true;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
function isBuiltinPlugin(obj) {
|
|
32
|
+
return obj && obj[BuiltinClassSymbol] === true;
|
|
21
33
|
}
|
|
22
|
-
function
|
|
23
|
-
return
|
|
34
|
+
function createBuiltinPlugin(name, options) {
|
|
35
|
+
return new BuiltinPlugin(name, options);
|
|
24
36
|
}
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/builtin-plugin/utils.ts
|
|
28
37
|
function makeBuiltinPluginCallable(plugin) {
|
|
29
38
|
let callablePlugin = new src_rolldown_binding_wasi_cjs.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
30
39
|
const wrappedPlugin = plugin;
|
|
@@ -48,67 +57,6 @@ function bindingifyBuiltInPlugin(plugin) {
|
|
|
48
57
|
};
|
|
49
58
|
}
|
|
50
59
|
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region src/builtin-plugin/constructors.ts
|
|
53
|
-
var BuiltinPlugin = class {
|
|
54
|
-
constructor(name, _options) {
|
|
55
|
-
this.name = name;
|
|
56
|
-
this._options = _options;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
function modulePreloadPolyfillPlugin(config) {
|
|
60
|
-
return new BuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
61
|
-
}
|
|
62
|
-
function dynamicImportVarsPlugin(config) {
|
|
63
|
-
if (config) {
|
|
64
|
-
config.include = normalizedStringOrRegex(config.include);
|
|
65
|
-
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
66
|
-
}
|
|
67
|
-
return new BuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
68
|
-
}
|
|
69
|
-
function importGlobPlugin(config) {
|
|
70
|
-
return new BuiltinPlugin("builtin:import-glob", config);
|
|
71
|
-
}
|
|
72
|
-
function reporterPlugin(config) {
|
|
73
|
-
return new BuiltinPlugin("builtin:reporter", config);
|
|
74
|
-
}
|
|
75
|
-
function manifestPlugin(config) {
|
|
76
|
-
return new BuiltinPlugin("builtin:manifest", config);
|
|
77
|
-
}
|
|
78
|
-
function wasmHelperPlugin(config) {
|
|
79
|
-
return new BuiltinPlugin("builtin:wasm-helper", config);
|
|
80
|
-
}
|
|
81
|
-
function wasmFallbackPlugin() {
|
|
82
|
-
const builtinPlugin = new BuiltinPlugin("builtin:wasm-fallback");
|
|
83
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
84
|
-
}
|
|
85
|
-
function loadFallbackPlugin() {
|
|
86
|
-
return new BuiltinPlugin("builtin:load-fallback");
|
|
87
|
-
}
|
|
88
|
-
function jsonPlugin(config) {
|
|
89
|
-
const builtinPlugin = new BuiltinPlugin("builtin:json", config);
|
|
90
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
91
|
-
}
|
|
92
|
-
function buildImportAnalysisPlugin(config) {
|
|
93
|
-
return new BuiltinPlugin("builtin:build-import-analysis", config);
|
|
94
|
-
}
|
|
95
|
-
function viteResolvePlugin(config) {
|
|
96
|
-
const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", config);
|
|
97
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
98
|
-
}
|
|
99
|
-
function isolatedDeclarationPlugin(config) {
|
|
100
|
-
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
101
|
-
}
|
|
102
|
-
function assetPlugin(config) {
|
|
103
|
-
return new BuiltinPlugin("builtin:asset", config);
|
|
104
|
-
}
|
|
105
|
-
function webWorkerPostPlugin() {
|
|
106
|
-
return new BuiltinPlugin("builtin:web-worker-post");
|
|
107
|
-
}
|
|
108
|
-
function oxcRuntimePlugin(config) {
|
|
109
|
-
return new BuiltinPlugin("builtin:oxc-runtime", config);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
60
|
//#endregion
|
|
113
61
|
//#region src/log/logging.ts
|
|
114
62
|
const LOG_LEVEL_SILENT = "silent";
|
|
@@ -233,6 +181,75 @@ function normalizeHook(hook) {
|
|
|
233
181
|
require_dist.unreachable("Invalid hook type");
|
|
234
182
|
}
|
|
235
183
|
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/utils/normalize-string-or-regex.ts
|
|
186
|
+
function normalizedStringOrRegex(pattern) {
|
|
187
|
+
if (!pattern) return void 0;
|
|
188
|
+
if (!isReadonlyArray(pattern)) return [pattern];
|
|
189
|
+
return pattern;
|
|
190
|
+
}
|
|
191
|
+
function isReadonlyArray(input) {
|
|
192
|
+
return Array.isArray(input);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/builtin-plugin/constructors.ts
|
|
197
|
+
function modulePreloadPolyfillPlugin(config) {
|
|
198
|
+
return createBuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
199
|
+
}
|
|
200
|
+
function dynamicImportVarsPlugin(config) {
|
|
201
|
+
if (config) {
|
|
202
|
+
config.include = normalizedStringOrRegex(config.include);
|
|
203
|
+
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
204
|
+
}
|
|
205
|
+
return createBuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
206
|
+
}
|
|
207
|
+
function importGlobPlugin(config) {
|
|
208
|
+
return createBuiltinPlugin("builtin:import-glob", config);
|
|
209
|
+
}
|
|
210
|
+
function reporterPlugin(config) {
|
|
211
|
+
return createBuiltinPlugin("builtin:reporter", config);
|
|
212
|
+
}
|
|
213
|
+
function manifestPlugin(config) {
|
|
214
|
+
return createBuiltinPlugin("builtin:manifest", config);
|
|
215
|
+
}
|
|
216
|
+
function wasmHelperPlugin(config) {
|
|
217
|
+
return createBuiltinPlugin("builtin:wasm-helper", config);
|
|
218
|
+
}
|
|
219
|
+
function wasmFallbackPlugin() {
|
|
220
|
+
const builtinPlugin = createBuiltinPlugin("builtin:wasm-fallback");
|
|
221
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
222
|
+
}
|
|
223
|
+
function loadFallbackPlugin() {
|
|
224
|
+
return createBuiltinPlugin("builtin:load-fallback");
|
|
225
|
+
}
|
|
226
|
+
function jsonPlugin(config) {
|
|
227
|
+
const builtinPlugin = createBuiltinPlugin("builtin:json", config);
|
|
228
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
229
|
+
}
|
|
230
|
+
function buildImportAnalysisPlugin(config) {
|
|
231
|
+
return createBuiltinPlugin("builtin:build-import-analysis", config);
|
|
232
|
+
}
|
|
233
|
+
function viteResolvePlugin(config) {
|
|
234
|
+
const builtinPlugin = createBuiltinPlugin("builtin:vite-resolve", config);
|
|
235
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
236
|
+
}
|
|
237
|
+
function isolatedDeclarationPlugin(config) {
|
|
238
|
+
return createBuiltinPlugin("builtin:isolated-declaration", config);
|
|
239
|
+
}
|
|
240
|
+
function assetPlugin(config) {
|
|
241
|
+
return createBuiltinPlugin("builtin:asset", config);
|
|
242
|
+
}
|
|
243
|
+
function webWorkerPostPlugin() {
|
|
244
|
+
return createBuiltinPlugin("builtin:web-worker-post");
|
|
245
|
+
}
|
|
246
|
+
function oxcRuntimePlugin(config) {
|
|
247
|
+
return createBuiltinPlugin("builtin:oxc-runtime", config);
|
|
248
|
+
}
|
|
249
|
+
function esmExternalRequirePlugin(config) {
|
|
250
|
+
return createBuiltinPlugin("builtin:esm-external-require", config);
|
|
251
|
+
}
|
|
252
|
+
|
|
236
253
|
//#endregion
|
|
237
254
|
//#region src/constants/plugin.ts
|
|
238
255
|
const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
|
|
@@ -324,7 +341,7 @@ function checkOutputPluginOption(plugins, onLog) {
|
|
|
324
341
|
function normalizePlugins(plugins, anonymousPrefix) {
|
|
325
342
|
for (const [index, plugin] of plugins.entries()) {
|
|
326
343
|
if ("_parallel" in plugin) continue;
|
|
327
|
-
if (plugin
|
|
344
|
+
if (isBuiltinPlugin(plugin)) continue;
|
|
328
345
|
if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
|
|
329
346
|
}
|
|
330
347
|
return plugins;
|
|
@@ -393,7 +410,7 @@ function getObjectPlugins(plugins) {
|
|
|
393
410
|
return plugins.filter((plugin) => {
|
|
394
411
|
if (!plugin) return void 0;
|
|
395
412
|
if ("_parallel" in plugin) return void 0;
|
|
396
|
-
if (plugin
|
|
413
|
+
if (isBuiltinPlugin(plugin)) return void 0;
|
|
397
414
|
return plugin;
|
|
398
415
|
});
|
|
399
416
|
}
|
|
@@ -1913,6 +1930,7 @@ var require_ansis = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_modul
|
|
|
1913
1930
|
//#endregion
|
|
1914
1931
|
//#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.mjs
|
|
1915
1932
|
var import_ansis = /* @__PURE__ */ require_chunk.__toESM(require_ansis(), 1);
|
|
1933
|
+
var ansis_default = import_ansis.default;
|
|
1916
1934
|
const { Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = import_ansis.default;
|
|
1917
1935
|
|
|
1918
1936
|
//#endregion
|
|
@@ -2010,7 +2028,7 @@ const TransformOptionsSchema = object({
|
|
|
2010
2028
|
typescript: optional(TypescriptSchema),
|
|
2011
2029
|
helpers: optional(HelpersSchema),
|
|
2012
2030
|
decorators: optional(DecoratorOptionSchema),
|
|
2013
|
-
jsx: optional(JsxOptionsSchema),
|
|
2031
|
+
jsx: optional(union([literal("preserve"), JsxOptionsSchema])),
|
|
2014
2032
|
target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
|
|
2015
2033
|
});
|
|
2016
2034
|
const WatchOptionsSchema = strictObject({
|
|
@@ -2038,7 +2056,8 @@ const ChecksOptionsSchema = strictObject({
|
|
|
2038
2056
|
commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
|
|
2039
2057
|
importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
|
|
2040
2058
|
emptyImportMeta: pipe(optional(boolean()), description("Whether to emit warning when detecting empty import meta")),
|
|
2041
|
-
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
|
|
2059
|
+
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict")),
|
|
2060
|
+
preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
|
|
2042
2061
|
});
|
|
2043
2062
|
const MinifyOptionsSchema = strictObject({
|
|
2044
2063
|
mangle: optional(boolean()),
|
|
@@ -2056,17 +2075,25 @@ const ResolveOptionsSchema = strictObject({
|
|
|
2056
2075
|
mainFiles: optional(array(string())),
|
|
2057
2076
|
modules: optional(array(string())),
|
|
2058
2077
|
symlinks: optional(boolean()),
|
|
2059
|
-
tsconfigFilename: optional(string()),
|
|
2060
2078
|
yarnPnp: optional(boolean())
|
|
2061
2079
|
});
|
|
2062
2080
|
const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
2063
2081
|
annotations: optional(boolean()),
|
|
2064
2082
|
manualPureFunctions: optional(array(string())),
|
|
2065
2083
|
unknownGlobalSideEffects: optional(boolean()),
|
|
2066
|
-
commonjs: optional(boolean())
|
|
2084
|
+
commonjs: optional(boolean()),
|
|
2085
|
+
propertyReadSideEffects: optional(union([literal(false), literal("always")])),
|
|
2086
|
+
propertyWriteSideEffects: optional(union([literal(false), literal("always")]))
|
|
2067
2087
|
})]);
|
|
2068
2088
|
const OptimizationOptionsSchema = strictObject({
|
|
2069
|
-
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")),
|
|
2070
2097
|
pifeForModuleWrappers: pipe(optional(boolean()), description("Use PIFE pattern for module wrappers"))
|
|
2071
2098
|
});
|
|
2072
2099
|
const OnLogSchema = pipe(function_(), args(tuple([
|
|
@@ -2076,6 +2103,7 @@ const OnLogSchema = pipe(function_(), args(tuple([
|
|
|
2076
2103
|
])));
|
|
2077
2104
|
const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
|
|
2078
2105
|
const HmrSchema = union([boolean(), strictObject({
|
|
2106
|
+
new: optional(boolean()),
|
|
2079
2107
|
port: optional(number()),
|
|
2080
2108
|
host: optional(string()),
|
|
2081
2109
|
implement: optional(string())
|
|
@@ -2091,11 +2119,11 @@ const InputOptionsSchema = strictObject({
|
|
|
2091
2119
|
literal("browser"),
|
|
2092
2120
|
literal("neutral"),
|
|
2093
2121
|
literal("node")
|
|
2094
|
-
])), description(`Platform for which the code should be generated (node, ${
|
|
2122
|
+
])), description(`Platform for which the code should be generated (node, ${ansis_default.underline("browser")}, neutral)`)),
|
|
2095
2123
|
shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
|
|
2096
2124
|
treeshake: optional(TreeshakingOptionsSchema),
|
|
2097
2125
|
optimization: optional(OptimizationOptionsSchema),
|
|
2098
|
-
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${
|
|
2126
|
+
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${ansis_default.dim("silent")}, ${ansis_default.underline(ansis_default.gray("info"))}, debug, ${ansis_default.yellow("warn")})`)),
|
|
2099
2127
|
onLog: optional(OnLogSchema),
|
|
2100
2128
|
onwarn: optional(OnwarnSchema),
|
|
2101
2129
|
moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
|
|
@@ -2140,7 +2168,8 @@ const InputOptionsSchema = strictObject({
|
|
|
2140
2168
|
literal("allow-extension"),
|
|
2141
2169
|
literal("exports-only"),
|
|
2142
2170
|
literal(false)
|
|
2143
|
-
])))
|
|
2171
|
+
]))),
|
|
2172
|
+
tsconfig: pipe(optional(string()), description("Path to the tsconfig.json file."))
|
|
2144
2173
|
});
|
|
2145
2174
|
const InputCliOverrideSchema = strictObject({
|
|
2146
2175
|
input: pipe(optional(array(string())), description("Entry file")),
|
|
@@ -2213,18 +2242,18 @@ const OutputOptionsSchema = strictObject({
|
|
|
2213
2242
|
literal("named"),
|
|
2214
2243
|
literal("default"),
|
|
2215
2244
|
literal("none")
|
|
2216
|
-
])), description(`Specify a export mode (${
|
|
2245
|
+
])), description(`Specify a export mode (${ansis_default.underline("auto")}, named, default, none)`)),
|
|
2217
2246
|
hashCharacters: pipe(optional(union([
|
|
2218
2247
|
literal("base64"),
|
|
2219
2248
|
literal("base36"),
|
|
2220
2249
|
literal("hex")
|
|
2221
2250
|
])), description("Use the specified character set for file hashes")),
|
|
2222
|
-
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${
|
|
2251
|
+
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${ansis_default.underline("esm")}, cjs, and iife)`)),
|
|
2223
2252
|
sourcemap: pipe(optional(union([
|
|
2224
2253
|
boolean(),
|
|
2225
2254
|
literal("inline"),
|
|
2226
2255
|
literal("hidden")
|
|
2227
|
-
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${
|
|
2256
|
+
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${ansis_default.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
2228
2257
|
sourcemapBaseUrl: pipe(optional(string()), description("Base URL used to prefix sourcemap paths")),
|
|
2229
2258
|
sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
|
|
2230
2259
|
sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
|
|
@@ -2262,10 +2291,11 @@ const OutputOptionsSchema = strictObject({
|
|
|
2262
2291
|
preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
|
|
2263
2292
|
preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
|
|
2264
2293
|
virtualDirname: optional(string()),
|
|
2265
|
-
minifyInternalExports: pipe(optional(boolean()), description("Minify internal exports"))
|
|
2294
|
+
minifyInternalExports: pipe(optional(boolean()), description("Minify internal exports")),
|
|
2295
|
+
topLevelVar: pipe(optional(boolean()), description("Rewrite top-level declarations to use `var`."))
|
|
2266
2296
|
});
|
|
2267
2297
|
const getAddonDescription = (placement, wrapper) => {
|
|
2268
|
-
return `Code to insert the ${
|
|
2298
|
+
return `Code to insert the ${ansis_default.bold(placement)} of the bundled file (${ansis_default.bold(wrapper)} the wrapper function)`;
|
|
2269
2299
|
};
|
|
2270
2300
|
const OutputCliOverrideSchema = strictObject({
|
|
2271
2301
|
assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
|
|
@@ -2310,15 +2340,19 @@ function validateCliOptions(options) {
|
|
|
2310
2340
|
return `Invalid value for option ${option}: ${issue.message}`;
|
|
2311
2341
|
})];
|
|
2312
2342
|
}
|
|
2313
|
-
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
|
+
};
|
|
2314
2347
|
const outputHelperMsgRecord = {};
|
|
2315
2348
|
function validateOption(key, options) {
|
|
2349
|
+
if (typeof options !== "object") throw new Error(`Invalid ${key} options. Expected an Object but received ${JSON.stringify(options)}.`);
|
|
2316
2350
|
if (globalThis.process?.env?.ROLLUP_TEST) return;
|
|
2317
2351
|
let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
|
|
2318
2352
|
if (!parsed.success) {
|
|
2319
2353
|
const errors = parsed.issues.map((issue) => {
|
|
2320
|
-
const issuePaths = issue.path.map((path$2) => path$2.key);
|
|
2321
2354
|
let issueMsg = issue.message;
|
|
2355
|
+
const issuePaths = issue.path.map((path$2) => path$2.key);
|
|
2322
2356
|
if (issue.type === "union") {
|
|
2323
2357
|
const subIssue = issue.issues?.find((i$1) => !(i$1.type !== issue.received && i$1.input === issue.input));
|
|
2324
2358
|
if (subIssue) {
|
|
@@ -2329,9 +2363,9 @@ function validateOption(key, options) {
|
|
|
2329
2363
|
const stringPath = issuePaths.join(".");
|
|
2330
2364
|
const helper = key === "input" ? inputHelperMsgRecord[stringPath] : outputHelperMsgRecord[stringPath];
|
|
2331
2365
|
if (helper && helper.ignored) return "";
|
|
2332
|
-
return `- For the "${stringPath}". ${issueMsg}
|
|
2366
|
+
return `- For the "${stringPath}". ${helper?.issueMsg || issueMsg + "."} ${helper?.help ? `\n Help: ${helper.help}` : ""}`;
|
|
2333
2367
|
}).filter(Boolean);
|
|
2334
|
-
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`);
|
|
2335
2369
|
}
|
|
2336
2370
|
}
|
|
2337
2371
|
function getInputCliKeys() {
|
|
@@ -2404,6 +2438,10 @@ function getErrorMessage(e$2) {
|
|
|
2404
2438
|
s$1 += message;
|
|
2405
2439
|
if (e$2.frame) s$1 = joinNewLine(s$1, e$2.frame);
|
|
2406
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
|
+
}
|
|
2407
2445
|
return s$1;
|
|
2408
2446
|
}
|
|
2409
2447
|
function joinNewLine(s1, s2) {
|
|
@@ -2716,7 +2754,8 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
2716
2754
|
...res,
|
|
2717
2755
|
external: res.external === "relative" ? require_dist.unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
2718
2756
|
...info,
|
|
2719
|
-
moduleSideEffects: info.moduleSideEffects ?? res.moduleSideEffects ?? null
|
|
2757
|
+
moduleSideEffects: info.moduleSideEffects ?? res.moduleSideEffects ?? null,
|
|
2758
|
+
packageJsonPath: res.packageJsonPath
|
|
2720
2759
|
};
|
|
2721
2760
|
}
|
|
2722
2761
|
emitFile = (file) => {
|
|
@@ -2842,7 +2881,8 @@ function bindingifyResolveId(args$1) {
|
|
|
2842
2881
|
id: ret.id,
|
|
2843
2882
|
external: ret.external,
|
|
2844
2883
|
normalizeExternalId: false,
|
|
2845
|
-
moduleSideEffects: exist.moduleSideEffects ?? void 0
|
|
2884
|
+
moduleSideEffects: exist.moduleSideEffects ?? void 0,
|
|
2885
|
+
packageJsonPath: ret.packageJsonPath
|
|
2846
2886
|
};
|
|
2847
2887
|
},
|
|
2848
2888
|
meta: bindingifyPluginHookMeta(meta),
|
|
@@ -3768,7 +3808,13 @@ var NormalizedOutputOptionsImpl = class {
|
|
|
3768
3808
|
return this.outputOptions.sourcemapPathTransform;
|
|
3769
3809
|
}
|
|
3770
3810
|
get minify() {
|
|
3771
|
-
|
|
3811
|
+
let ret = this.inner.minify;
|
|
3812
|
+
if (typeof ret === "object" && ret !== null) {
|
|
3813
|
+
delete ret["codegen"];
|
|
3814
|
+
delete ret["module"];
|
|
3815
|
+
delete ret["sourcemap"];
|
|
3816
|
+
}
|
|
3817
|
+
return ret;
|
|
3772
3818
|
}
|
|
3773
3819
|
get legalComments() {
|
|
3774
3820
|
return this.inner.legalComments;
|
|
@@ -3910,7 +3956,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3910
3956
|
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
|
|
3911
3957
|
const plugins = rawPlugins.map((plugin) => {
|
|
3912
3958
|
if ("_parallel" in plugin) return void 0;
|
|
3913
|
-
if (plugin
|
|
3959
|
+
if (isBuiltinPlugin(plugin)) return bindingifyBuiltInPlugin(plugin);
|
|
3914
3960
|
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
3915
3961
|
});
|
|
3916
3962
|
const { jsx, transform } = bindingifyJsx(onLog, inputOptions.jsx, inputOptions.transform);
|
|
@@ -3923,7 +3969,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3923
3969
|
platform: inputOptions.platform,
|
|
3924
3970
|
shimMissingExports: inputOptions.shimMissingExports,
|
|
3925
3971
|
logLevel: bindingifyLogLevel(logLevel),
|
|
3926
|
-
onLog,
|
|
3972
|
+
onLog: async (level, log) => onLog(level, log),
|
|
3927
3973
|
treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
|
|
3928
3974
|
moduleTypes: inputOptions.moduleTypes,
|
|
3929
3975
|
define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
|
|
@@ -3952,7 +3998,8 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3952
3998
|
markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData),
|
|
3953
3999
|
preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
|
|
3954
4000
|
optimization: inputOptions.optimization,
|
|
3955
|
-
context: inputOptions.context
|
|
4001
|
+
context: inputOptions.context,
|
|
4002
|
+
tsconfig: inputOptions.resolve?.tsconfigFilename ?? inputOptions.tsconfig
|
|
3956
4003
|
};
|
|
3957
4004
|
}
|
|
3958
4005
|
function bindingifyHmr(hmr) {
|
|
@@ -4127,6 +4174,24 @@ function bindingifyTreeshakeOptions(config) {
|
|
|
4127
4174
|
unknownGlobalSideEffects: config.unknownGlobalSideEffects,
|
|
4128
4175
|
commonjs: config.commonjs
|
|
4129
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
|
+
}
|
|
4130
4195
|
if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
|
|
4131
4196
|
else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
|
|
4132
4197
|
external: true,
|
|
@@ -4511,12 +4576,6 @@ function defineConfig(config) {
|
|
|
4511
4576
|
const VERSION = version;
|
|
4512
4577
|
|
|
4513
4578
|
//#endregion
|
|
4514
|
-
Object.defineProperty(exports, 'BuiltinPlugin', {
|
|
4515
|
-
enumerable: true,
|
|
4516
|
-
get: function () {
|
|
4517
|
-
return BuiltinPlugin;
|
|
4518
|
-
}
|
|
4519
|
-
});
|
|
4520
4579
|
Object.defineProperty(exports, 'PluginContextData', {
|
|
4521
4580
|
enumerable: true,
|
|
4522
4581
|
get: function () {
|
|
@@ -4535,6 +4594,12 @@ Object.defineProperty(exports, 'VERSION', {
|
|
|
4535
4594
|
return VERSION;
|
|
4536
4595
|
}
|
|
4537
4596
|
});
|
|
4597
|
+
Object.defineProperty(exports, 'ansis_default', {
|
|
4598
|
+
enumerable: true,
|
|
4599
|
+
get: function () {
|
|
4600
|
+
return ansis_default;
|
|
4601
|
+
}
|
|
4602
|
+
});
|
|
4538
4603
|
Object.defineProperty(exports, 'assetPlugin', {
|
|
4539
4604
|
enumerable: true,
|
|
4540
4605
|
get: function () {
|
|
@@ -4559,12 +4624,24 @@ Object.defineProperty(exports, 'buildImportAnalysisPlugin', {
|
|
|
4559
4624
|
return buildImportAnalysisPlugin;
|
|
4560
4625
|
}
|
|
4561
4626
|
});
|
|
4627
|
+
Object.defineProperty(exports, 'createBuiltinPlugin', {
|
|
4628
|
+
enumerable: true,
|
|
4629
|
+
get: function () {
|
|
4630
|
+
return createBuiltinPlugin;
|
|
4631
|
+
}
|
|
4632
|
+
});
|
|
4562
4633
|
Object.defineProperty(exports, 'createBundlerImpl', {
|
|
4563
4634
|
enumerable: true,
|
|
4564
4635
|
get: function () {
|
|
4565
4636
|
return createBundlerImpl;
|
|
4566
4637
|
}
|
|
4567
4638
|
});
|
|
4639
|
+
Object.defineProperty(exports, 'createBundlerOptions', {
|
|
4640
|
+
enumerable: true,
|
|
4641
|
+
get: function () {
|
|
4642
|
+
return createBundlerOptions;
|
|
4643
|
+
}
|
|
4644
|
+
});
|
|
4568
4645
|
Object.defineProperty(exports, 'defineConfig', {
|
|
4569
4646
|
enumerable: true,
|
|
4570
4647
|
get: function () {
|
|
@@ -4583,6 +4660,12 @@ Object.defineProperty(exports, 'dynamicImportVarsPlugin', {
|
|
|
4583
4660
|
return dynamicImportVarsPlugin;
|
|
4584
4661
|
}
|
|
4585
4662
|
});
|
|
4663
|
+
Object.defineProperty(exports, 'esmExternalRequirePlugin', {
|
|
4664
|
+
enumerable: true,
|
|
4665
|
+
get: function () {
|
|
4666
|
+
return esmExternalRequirePlugin;
|
|
4667
|
+
}
|
|
4668
|
+
});
|
|
4586
4669
|
Object.defineProperty(exports, 'getInputCliKeys', {
|
|
4587
4670
|
enumerable: true,
|
|
4588
4671
|
get: function () {
|
|
@@ -4613,12 +4696,6 @@ Object.defineProperty(exports, 'importGlobPlugin', {
|
|
|
4613
4696
|
return importGlobPlugin;
|
|
4614
4697
|
}
|
|
4615
4698
|
});
|
|
4616
|
-
Object.defineProperty(exports, 'import_ansis', {
|
|
4617
|
-
enumerable: true,
|
|
4618
|
-
get: function () {
|
|
4619
|
-
return import_ansis;
|
|
4620
|
-
}
|
|
4621
|
-
});
|
|
4622
4699
|
Object.defineProperty(exports, 'isolatedDeclarationPlugin', {
|
|
4623
4700
|
enumerable: true,
|
|
4624
4701
|
get: function () {
|