@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,11 +1,11 @@
|
|
|
1
|
-
import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-
|
|
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,22 +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
|
-
//#region src/utils
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
//#region src/builtin-plugin/utils.ts
|
|
42
|
+
const BuiltinClassSymbol = Symbol.for("__RolldownBuiltinPlugin__");
|
|
43
|
+
var BuiltinPlugin = class {
|
|
44
|
+
constructor(name, _options) {
|
|
45
|
+
this.name = name;
|
|
46
|
+
this._options = _options;
|
|
47
|
+
this[BuiltinClassSymbol] = true;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
function isBuiltinPlugin(obj) {
|
|
51
|
+
return obj && obj[BuiltinClassSymbol] === true;
|
|
46
52
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
53
|
+
function createBuiltinPlugin(name, options) {
|
|
54
|
+
return new BuiltinPlugin(name, options);
|
|
49
55
|
}
|
|
50
|
-
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region src/builtin-plugin/utils.ts
|
|
53
56
|
function makeBuiltinPluginCallable(plugin) {
|
|
54
57
|
let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
55
58
|
const wrappedPlugin = plugin;
|
|
@@ -73,67 +76,6 @@ function bindingifyBuiltInPlugin(plugin) {
|
|
|
73
76
|
};
|
|
74
77
|
}
|
|
75
78
|
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region src/builtin-plugin/constructors.ts
|
|
78
|
-
var BuiltinPlugin = class {
|
|
79
|
-
constructor(name, _options) {
|
|
80
|
-
this.name = name;
|
|
81
|
-
this._options = _options;
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
function modulePreloadPolyfillPlugin(config) {
|
|
85
|
-
return new BuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
86
|
-
}
|
|
87
|
-
function dynamicImportVarsPlugin(config) {
|
|
88
|
-
if (config) {
|
|
89
|
-
config.include = normalizedStringOrRegex(config.include);
|
|
90
|
-
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
91
|
-
}
|
|
92
|
-
return new BuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
93
|
-
}
|
|
94
|
-
function importGlobPlugin(config) {
|
|
95
|
-
return new BuiltinPlugin("builtin:import-glob", config);
|
|
96
|
-
}
|
|
97
|
-
function reporterPlugin(config) {
|
|
98
|
-
return new BuiltinPlugin("builtin:reporter", config);
|
|
99
|
-
}
|
|
100
|
-
function manifestPlugin(config) {
|
|
101
|
-
return new BuiltinPlugin("builtin:manifest", config);
|
|
102
|
-
}
|
|
103
|
-
function wasmHelperPlugin(config) {
|
|
104
|
-
return new BuiltinPlugin("builtin:wasm-helper", config);
|
|
105
|
-
}
|
|
106
|
-
function wasmFallbackPlugin() {
|
|
107
|
-
const builtinPlugin = new BuiltinPlugin("builtin:wasm-fallback");
|
|
108
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
109
|
-
}
|
|
110
|
-
function loadFallbackPlugin() {
|
|
111
|
-
return new BuiltinPlugin("builtin:load-fallback");
|
|
112
|
-
}
|
|
113
|
-
function jsonPlugin(config) {
|
|
114
|
-
const builtinPlugin = new BuiltinPlugin("builtin:json", config);
|
|
115
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
116
|
-
}
|
|
117
|
-
function buildImportAnalysisPlugin(config) {
|
|
118
|
-
return new BuiltinPlugin("builtin:build-import-analysis", config);
|
|
119
|
-
}
|
|
120
|
-
function viteResolvePlugin(config) {
|
|
121
|
-
const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", config);
|
|
122
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
123
|
-
}
|
|
124
|
-
function isolatedDeclarationPlugin(config) {
|
|
125
|
-
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
126
|
-
}
|
|
127
|
-
function assetPlugin(config) {
|
|
128
|
-
return new BuiltinPlugin("builtin:asset", config);
|
|
129
|
-
}
|
|
130
|
-
function webWorkerPostPlugin() {
|
|
131
|
-
return new BuiltinPlugin("builtin:web-worker-post");
|
|
132
|
-
}
|
|
133
|
-
function oxcRuntimePlugin(config) {
|
|
134
|
-
return new BuiltinPlugin("builtin:oxc-runtime", config);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
79
|
//#endregion
|
|
138
80
|
//#region src/log/logging.ts
|
|
139
81
|
const LOG_LEVEL_SILENT = "silent";
|
|
@@ -258,6 +200,75 @@ function normalizeHook(hook) {
|
|
|
258
200
|
unreachable("Invalid hook type");
|
|
259
201
|
}
|
|
260
202
|
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/utils/normalize-string-or-regex.ts
|
|
205
|
+
function normalizedStringOrRegex(pattern) {
|
|
206
|
+
if (!pattern) return void 0;
|
|
207
|
+
if (!isReadonlyArray(pattern)) return [pattern];
|
|
208
|
+
return pattern;
|
|
209
|
+
}
|
|
210
|
+
function isReadonlyArray(input) {
|
|
211
|
+
return Array.isArray(input);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/builtin-plugin/constructors.ts
|
|
216
|
+
function modulePreloadPolyfillPlugin(config) {
|
|
217
|
+
return createBuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
218
|
+
}
|
|
219
|
+
function dynamicImportVarsPlugin(config) {
|
|
220
|
+
if (config) {
|
|
221
|
+
config.include = normalizedStringOrRegex(config.include);
|
|
222
|
+
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
223
|
+
}
|
|
224
|
+
return createBuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
225
|
+
}
|
|
226
|
+
function importGlobPlugin(config) {
|
|
227
|
+
return createBuiltinPlugin("builtin:import-glob", config);
|
|
228
|
+
}
|
|
229
|
+
function reporterPlugin(config) {
|
|
230
|
+
return createBuiltinPlugin("builtin:reporter", config);
|
|
231
|
+
}
|
|
232
|
+
function manifestPlugin(config) {
|
|
233
|
+
return createBuiltinPlugin("builtin:manifest", config);
|
|
234
|
+
}
|
|
235
|
+
function wasmHelperPlugin(config) {
|
|
236
|
+
return createBuiltinPlugin("builtin:wasm-helper", config);
|
|
237
|
+
}
|
|
238
|
+
function wasmFallbackPlugin() {
|
|
239
|
+
const builtinPlugin = createBuiltinPlugin("builtin:wasm-fallback");
|
|
240
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
241
|
+
}
|
|
242
|
+
function loadFallbackPlugin() {
|
|
243
|
+
return createBuiltinPlugin("builtin:load-fallback");
|
|
244
|
+
}
|
|
245
|
+
function jsonPlugin(config) {
|
|
246
|
+
const builtinPlugin = createBuiltinPlugin("builtin:json", config);
|
|
247
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
248
|
+
}
|
|
249
|
+
function buildImportAnalysisPlugin(config) {
|
|
250
|
+
return createBuiltinPlugin("builtin:build-import-analysis", config);
|
|
251
|
+
}
|
|
252
|
+
function viteResolvePlugin(config) {
|
|
253
|
+
const builtinPlugin = createBuiltinPlugin("builtin:vite-resolve", config);
|
|
254
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
255
|
+
}
|
|
256
|
+
function isolatedDeclarationPlugin(config) {
|
|
257
|
+
return createBuiltinPlugin("builtin:isolated-declaration", config);
|
|
258
|
+
}
|
|
259
|
+
function assetPlugin(config) {
|
|
260
|
+
return createBuiltinPlugin("builtin:asset", config);
|
|
261
|
+
}
|
|
262
|
+
function webWorkerPostPlugin() {
|
|
263
|
+
return createBuiltinPlugin("builtin:web-worker-post");
|
|
264
|
+
}
|
|
265
|
+
function oxcRuntimePlugin(config) {
|
|
266
|
+
return createBuiltinPlugin("builtin:oxc-runtime", config);
|
|
267
|
+
}
|
|
268
|
+
function esmExternalRequirePlugin(config) {
|
|
269
|
+
return createBuiltinPlugin("builtin:esm-external-require", config);
|
|
270
|
+
}
|
|
271
|
+
|
|
261
272
|
//#endregion
|
|
262
273
|
//#region src/constants/plugin.ts
|
|
263
274
|
const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
|
|
@@ -349,7 +360,7 @@ function checkOutputPluginOption(plugins, onLog) {
|
|
|
349
360
|
function normalizePlugins(plugins, anonymousPrefix) {
|
|
350
361
|
for (const [index, plugin] of plugins.entries()) {
|
|
351
362
|
if ("_parallel" in plugin) continue;
|
|
352
|
-
if (plugin
|
|
363
|
+
if (isBuiltinPlugin(plugin)) continue;
|
|
353
364
|
if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
|
|
354
365
|
}
|
|
355
366
|
return plugins;
|
|
@@ -418,7 +429,7 @@ function getObjectPlugins(plugins) {
|
|
|
418
429
|
return plugins.filter((plugin) => {
|
|
419
430
|
if (!plugin) return void 0;
|
|
420
431
|
if ("_parallel" in plugin) return void 0;
|
|
421
|
-
if (plugin
|
|
432
|
+
if (isBuiltinPlugin(plugin)) return void 0;
|
|
422
433
|
return plugin;
|
|
423
434
|
});
|
|
424
435
|
}
|
|
@@ -1938,6 +1949,7 @@ var require_ansis = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ansis
|
|
|
1938
1949
|
//#endregion
|
|
1939
1950
|
//#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.mjs
|
|
1940
1951
|
var import_ansis = /* @__PURE__ */ __toESM(require_ansis(), 1);
|
|
1952
|
+
var ansis_default = import_ansis.default;
|
|
1941
1953
|
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;
|
|
1942
1954
|
|
|
1943
1955
|
//#endregion
|
|
@@ -2035,7 +2047,7 @@ const TransformOptionsSchema = object({
|
|
|
2035
2047
|
typescript: optional(TypescriptSchema),
|
|
2036
2048
|
helpers: optional(HelpersSchema),
|
|
2037
2049
|
decorators: optional(DecoratorOptionSchema),
|
|
2038
|
-
jsx: optional(JsxOptionsSchema),
|
|
2050
|
+
jsx: optional(union([literal("preserve"), JsxOptionsSchema])),
|
|
2039
2051
|
target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
|
|
2040
2052
|
});
|
|
2041
2053
|
const WatchOptionsSchema = strictObject({
|
|
@@ -2063,7 +2075,8 @@ const ChecksOptionsSchema = strictObject({
|
|
|
2063
2075
|
commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
|
|
2064
2076
|
importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
|
|
2065
2077
|
emptyImportMeta: pipe(optional(boolean()), description("Whether to emit warning when detecting empty import meta")),
|
|
2066
|
-
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
|
|
2078
|
+
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict")),
|
|
2079
|
+
preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
|
|
2067
2080
|
});
|
|
2068
2081
|
const MinifyOptionsSchema = strictObject({
|
|
2069
2082
|
mangle: optional(boolean()),
|
|
@@ -2081,17 +2094,25 @@ const ResolveOptionsSchema = strictObject({
|
|
|
2081
2094
|
mainFiles: optional(array(string())),
|
|
2082
2095
|
modules: optional(array(string())),
|
|
2083
2096
|
symlinks: optional(boolean()),
|
|
2084
|
-
tsconfigFilename: optional(string()),
|
|
2085
2097
|
yarnPnp: optional(boolean())
|
|
2086
2098
|
});
|
|
2087
2099
|
const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
2088
2100
|
annotations: optional(boolean()),
|
|
2089
2101
|
manualPureFunctions: optional(array(string())),
|
|
2090
2102
|
unknownGlobalSideEffects: optional(boolean()),
|
|
2091
|
-
commonjs: optional(boolean())
|
|
2103
|
+
commonjs: optional(boolean()),
|
|
2104
|
+
propertyReadSideEffects: optional(union([literal(false), literal("always")])),
|
|
2105
|
+
propertyWriteSideEffects: optional(union([literal(false), literal("always")]))
|
|
2092
2106
|
})]);
|
|
2093
2107
|
const OptimizationOptionsSchema = strictObject({
|
|
2094
|
-
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")),
|
|
2095
2116
|
pifeForModuleWrappers: pipe(optional(boolean()), description("Use PIFE pattern for module wrappers"))
|
|
2096
2117
|
});
|
|
2097
2118
|
const OnLogSchema = pipe(function_(), args(tuple([
|
|
@@ -2101,6 +2122,7 @@ const OnLogSchema = pipe(function_(), args(tuple([
|
|
|
2101
2122
|
])));
|
|
2102
2123
|
const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
|
|
2103
2124
|
const HmrSchema = union([boolean(), strictObject({
|
|
2125
|
+
new: optional(boolean()),
|
|
2104
2126
|
port: optional(number()),
|
|
2105
2127
|
host: optional(string()),
|
|
2106
2128
|
implement: optional(string())
|
|
@@ -2116,11 +2138,11 @@ const InputOptionsSchema = strictObject({
|
|
|
2116
2138
|
literal("browser"),
|
|
2117
2139
|
literal("neutral"),
|
|
2118
2140
|
literal("node")
|
|
2119
|
-
])), description(`Platform for which the code should be generated (node, ${
|
|
2141
|
+
])), description(`Platform for which the code should be generated (node, ${ansis_default.underline("browser")}, neutral)`)),
|
|
2120
2142
|
shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
|
|
2121
2143
|
treeshake: optional(TreeshakingOptionsSchema),
|
|
2122
2144
|
optimization: optional(OptimizationOptionsSchema),
|
|
2123
|
-
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${
|
|
2145
|
+
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${ansis_default.dim("silent")}, ${ansis_default.underline(ansis_default.gray("info"))}, debug, ${ansis_default.yellow("warn")})`)),
|
|
2124
2146
|
onLog: optional(OnLogSchema),
|
|
2125
2147
|
onwarn: optional(OnwarnSchema),
|
|
2126
2148
|
moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
|
|
@@ -2165,7 +2187,8 @@ const InputOptionsSchema = strictObject({
|
|
|
2165
2187
|
literal("allow-extension"),
|
|
2166
2188
|
literal("exports-only"),
|
|
2167
2189
|
literal(false)
|
|
2168
|
-
])))
|
|
2190
|
+
]))),
|
|
2191
|
+
tsconfig: pipe(optional(string()), description("Path to the tsconfig.json file."))
|
|
2169
2192
|
});
|
|
2170
2193
|
const InputCliOverrideSchema = strictObject({
|
|
2171
2194
|
input: pipe(optional(array(string())), description("Entry file")),
|
|
@@ -2238,18 +2261,18 @@ const OutputOptionsSchema = strictObject({
|
|
|
2238
2261
|
literal("named"),
|
|
2239
2262
|
literal("default"),
|
|
2240
2263
|
literal("none")
|
|
2241
|
-
])), description(`Specify a export mode (${
|
|
2264
|
+
])), description(`Specify a export mode (${ansis_default.underline("auto")}, named, default, none)`)),
|
|
2242
2265
|
hashCharacters: pipe(optional(union([
|
|
2243
2266
|
literal("base64"),
|
|
2244
2267
|
literal("base36"),
|
|
2245
2268
|
literal("hex")
|
|
2246
2269
|
])), description("Use the specified character set for file hashes")),
|
|
2247
|
-
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${
|
|
2270
|
+
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${ansis_default.underline("esm")}, cjs, and iife)`)),
|
|
2248
2271
|
sourcemap: pipe(optional(union([
|
|
2249
2272
|
boolean(),
|
|
2250
2273
|
literal("inline"),
|
|
2251
2274
|
literal("hidden")
|
|
2252
|
-
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${
|
|
2275
|
+
])), 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")})`)),
|
|
2253
2276
|
sourcemapBaseUrl: pipe(optional(string()), description("Base URL used to prefix sourcemap paths")),
|
|
2254
2277
|
sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
|
|
2255
2278
|
sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
|
|
@@ -2287,10 +2310,11 @@ const OutputOptionsSchema = strictObject({
|
|
|
2287
2310
|
preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
|
|
2288
2311
|
preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
|
|
2289
2312
|
virtualDirname: optional(string()),
|
|
2290
|
-
minifyInternalExports: pipe(optional(boolean()), description("Minify internal exports"))
|
|
2313
|
+
minifyInternalExports: pipe(optional(boolean()), description("Minify internal exports")),
|
|
2314
|
+
topLevelVar: pipe(optional(boolean()), description("Rewrite top-level declarations to use `var`."))
|
|
2291
2315
|
});
|
|
2292
2316
|
const getAddonDescription = (placement, wrapper) => {
|
|
2293
|
-
return `Code to insert the ${
|
|
2317
|
+
return `Code to insert the ${ansis_default.bold(placement)} of the bundled file (${ansis_default.bold(wrapper)} the wrapper function)`;
|
|
2294
2318
|
};
|
|
2295
2319
|
const OutputCliOverrideSchema = strictObject({
|
|
2296
2320
|
assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
|
|
@@ -2335,15 +2359,19 @@ function validateCliOptions(options) {
|
|
|
2335
2359
|
return `Invalid value for option ${option}: ${issue.message}`;
|
|
2336
2360
|
})];
|
|
2337
2361
|
}
|
|
2338
|
-
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
|
+
};
|
|
2339
2366
|
const outputHelperMsgRecord = {};
|
|
2340
2367
|
function validateOption(key, options) {
|
|
2368
|
+
if (typeof options !== "object") throw new Error(`Invalid ${key} options. Expected an Object but received ${JSON.stringify(options)}.`);
|
|
2341
2369
|
if (globalThis.process?.env?.ROLLUP_TEST) return;
|
|
2342
2370
|
let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
|
|
2343
2371
|
if (!parsed.success) {
|
|
2344
2372
|
const errors = parsed.issues.map((issue) => {
|
|
2345
|
-
const issuePaths = issue.path.map((path$1) => path$1.key);
|
|
2346
2373
|
let issueMsg = issue.message;
|
|
2374
|
+
const issuePaths = issue.path.map((path$1) => path$1.key);
|
|
2347
2375
|
if (issue.type === "union") {
|
|
2348
2376
|
const subIssue = issue.issues?.find((i$1) => !(i$1.type !== issue.received && i$1.input === issue.input));
|
|
2349
2377
|
if (subIssue) {
|
|
@@ -2354,9 +2382,9 @@ function validateOption(key, options) {
|
|
|
2354
2382
|
const stringPath = issuePaths.join(".");
|
|
2355
2383
|
const helper = key === "input" ? inputHelperMsgRecord[stringPath] : outputHelperMsgRecord[stringPath];
|
|
2356
2384
|
if (helper && helper.ignored) return "";
|
|
2357
|
-
return `- For the "${stringPath}". ${issueMsg}
|
|
2385
|
+
return `- For the "${stringPath}". ${helper?.issueMsg || issueMsg + "."} ${helper?.help ? `\n Help: ${helper.help}` : ""}`;
|
|
2358
2386
|
}).filter(Boolean);
|
|
2359
|
-
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`);
|
|
2360
2388
|
}
|
|
2361
2389
|
}
|
|
2362
2390
|
function getInputCliKeys() {
|
|
@@ -2429,6 +2457,10 @@ function getErrorMessage(e$2) {
|
|
|
2429
2457
|
s$1 += message;
|
|
2430
2458
|
if (e$2.frame) s$1 = joinNewLine(s$1, e$2.frame);
|
|
2431
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
|
+
}
|
|
2432
2464
|
return s$1;
|
|
2433
2465
|
}
|
|
2434
2466
|
function joinNewLine(s1, s2) {
|
|
@@ -2741,7 +2773,8 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
2741
2773
|
...res,
|
|
2742
2774
|
external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
2743
2775
|
...info,
|
|
2744
|
-
moduleSideEffects: info.moduleSideEffects ?? res.moduleSideEffects ?? null
|
|
2776
|
+
moduleSideEffects: info.moduleSideEffects ?? res.moduleSideEffects ?? null,
|
|
2777
|
+
packageJsonPath: res.packageJsonPath
|
|
2745
2778
|
};
|
|
2746
2779
|
}
|
|
2747
2780
|
emitFile = (file) => {
|
|
@@ -2867,7 +2900,8 @@ function bindingifyResolveId(args$1) {
|
|
|
2867
2900
|
id: ret.id,
|
|
2868
2901
|
external: ret.external,
|
|
2869
2902
|
normalizeExternalId: false,
|
|
2870
|
-
moduleSideEffects: exist.moduleSideEffects ?? void 0
|
|
2903
|
+
moduleSideEffects: exist.moduleSideEffects ?? void 0,
|
|
2904
|
+
packageJsonPath: ret.packageJsonPath
|
|
2871
2905
|
};
|
|
2872
2906
|
},
|
|
2873
2907
|
meta: bindingifyPluginHookMeta(meta),
|
|
@@ -3793,7 +3827,13 @@ var NormalizedOutputOptionsImpl = class {
|
|
|
3793
3827
|
return this.outputOptions.sourcemapPathTransform;
|
|
3794
3828
|
}
|
|
3795
3829
|
get minify() {
|
|
3796
|
-
|
|
3830
|
+
let ret = this.inner.minify;
|
|
3831
|
+
if (typeof ret === "object" && ret !== null) {
|
|
3832
|
+
delete ret["codegen"];
|
|
3833
|
+
delete ret["module"];
|
|
3834
|
+
delete ret["sourcemap"];
|
|
3835
|
+
}
|
|
3836
|
+
return ret;
|
|
3797
3837
|
}
|
|
3798
3838
|
get legalComments() {
|
|
3799
3839
|
return this.inner.legalComments;
|
|
@@ -3935,7 +3975,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3935
3975
|
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
|
|
3936
3976
|
const plugins = rawPlugins.map((plugin) => {
|
|
3937
3977
|
if ("_parallel" in plugin) return void 0;
|
|
3938
|
-
if (plugin
|
|
3978
|
+
if (isBuiltinPlugin(plugin)) return bindingifyBuiltInPlugin(plugin);
|
|
3939
3979
|
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
3940
3980
|
});
|
|
3941
3981
|
const { jsx, transform } = bindingifyJsx(onLog, inputOptions.jsx, inputOptions.transform);
|
|
@@ -3948,7 +3988,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3948
3988
|
platform: inputOptions.platform,
|
|
3949
3989
|
shimMissingExports: inputOptions.shimMissingExports,
|
|
3950
3990
|
logLevel: bindingifyLogLevel(logLevel),
|
|
3951
|
-
onLog,
|
|
3991
|
+
onLog: async (level, log) => onLog(level, log),
|
|
3952
3992
|
treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
|
|
3953
3993
|
moduleTypes: inputOptions.moduleTypes,
|
|
3954
3994
|
define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
|
|
@@ -3977,7 +4017,8 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3977
4017
|
markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData),
|
|
3978
4018
|
preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
|
|
3979
4019
|
optimization: inputOptions.optimization,
|
|
3980
|
-
context: inputOptions.context
|
|
4020
|
+
context: inputOptions.context,
|
|
4021
|
+
tsconfig: inputOptions.resolve?.tsconfigFilename ?? inputOptions.tsconfig
|
|
3981
4022
|
};
|
|
3982
4023
|
}
|
|
3983
4024
|
function bindingifyHmr(hmr) {
|
|
@@ -4152,6 +4193,24 @@ function bindingifyTreeshakeOptions(config) {
|
|
|
4152
4193
|
unknownGlobalSideEffects: config.unknownGlobalSideEffects,
|
|
4153
4194
|
commonjs: config.commonjs
|
|
4154
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
|
+
}
|
|
4155
4214
|
if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
|
|
4156
4215
|
else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
|
|
4157
4216
|
external: true,
|
|
@@ -4536,4 +4595,4 @@ function defineConfig(config) {
|
|
|
4536
4595
|
const VERSION = version;
|
|
4537
4596
|
|
|
4538
4597
|
//#endregion
|
|
4539
|
-
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 };
|