@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,4 +1,4 @@
|
|
|
1
|
-
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, parseSync, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
|
|
1
|
+
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, parseSync, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
|
|
2
2
|
|
|
3
3
|
//#region rolldown:runtime
|
|
4
4
|
var __create = Object.create;
|
|
@@ -27,18 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region package.json
|
|
30
|
-
var version = "1.0.0-beta.
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/utils/normalize-string-or-regex.ts
|
|
34
|
-
function normalizedStringOrRegex(pattern) {
|
|
35
|
-
if (!pattern) return void 0;
|
|
36
|
-
if (!isReadonlyArray(pattern)) return [pattern];
|
|
37
|
-
return pattern;
|
|
38
|
-
}
|
|
39
|
-
function isReadonlyArray(input) {
|
|
40
|
-
return Array.isArray(input);
|
|
41
|
-
}
|
|
30
|
+
var version = "1.0.0-beta.35";
|
|
42
31
|
|
|
43
32
|
//#endregion
|
|
44
33
|
//#region src/utils/code-frame.ts
|
|
@@ -234,6 +223,20 @@ function augmentCodeLocation(properties, pos, source, id$1) {
|
|
|
234
223
|
|
|
235
224
|
//#endregion
|
|
236
225
|
//#region src/builtin-plugin/utils.ts
|
|
226
|
+
const BuiltinClassSymbol = Symbol.for("__RolldownBuiltinPlugin__");
|
|
227
|
+
var BuiltinPlugin = class {
|
|
228
|
+
constructor(name, _options) {
|
|
229
|
+
this.name = name;
|
|
230
|
+
this._options = _options;
|
|
231
|
+
this[BuiltinClassSymbol] = true;
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
function isBuiltinPlugin(obj) {
|
|
235
|
+
return obj && obj[BuiltinClassSymbol] === true;
|
|
236
|
+
}
|
|
237
|
+
function createBuiltinPlugin(name, options) {
|
|
238
|
+
return new BuiltinPlugin(name, options);
|
|
239
|
+
}
|
|
237
240
|
function makeBuiltinPluginCallable(plugin) {
|
|
238
241
|
let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
239
242
|
const wrappedPlugin = plugin;
|
|
@@ -257,64 +260,6 @@ function bindingifyBuiltInPlugin(plugin) {
|
|
|
257
260
|
};
|
|
258
261
|
}
|
|
259
262
|
|
|
260
|
-
//#endregion
|
|
261
|
-
//#region src/builtin-plugin/constructors.ts
|
|
262
|
-
var BuiltinPlugin = class {
|
|
263
|
-
constructor(name, _options) {
|
|
264
|
-
this.name = name;
|
|
265
|
-
this._options = _options;
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
function modulePreloadPolyfillPlugin(config) {
|
|
269
|
-
return new BuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
270
|
-
}
|
|
271
|
-
function dynamicImportVarsPlugin(config) {
|
|
272
|
-
if (config) {
|
|
273
|
-
config.include = normalizedStringOrRegex(config.include);
|
|
274
|
-
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
275
|
-
}
|
|
276
|
-
return new BuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
277
|
-
}
|
|
278
|
-
function importGlobPlugin(config) {
|
|
279
|
-
return new BuiltinPlugin("builtin:import-glob", config);
|
|
280
|
-
}
|
|
281
|
-
function reporterPlugin(config) {
|
|
282
|
-
return new BuiltinPlugin("builtin:reporter", config);
|
|
283
|
-
}
|
|
284
|
-
function manifestPlugin(config) {
|
|
285
|
-
return new BuiltinPlugin("builtin:manifest", config);
|
|
286
|
-
}
|
|
287
|
-
function wasmHelperPlugin(config) {
|
|
288
|
-
return new BuiltinPlugin("builtin:wasm-helper", config);
|
|
289
|
-
}
|
|
290
|
-
function wasmFallbackPlugin() {
|
|
291
|
-
const builtinPlugin = new BuiltinPlugin("builtin:wasm-fallback");
|
|
292
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
293
|
-
}
|
|
294
|
-
function loadFallbackPlugin() {
|
|
295
|
-
return new BuiltinPlugin("builtin:load-fallback");
|
|
296
|
-
}
|
|
297
|
-
function jsonPlugin(config) {
|
|
298
|
-
const builtinPlugin = new BuiltinPlugin("builtin:json", config);
|
|
299
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
300
|
-
}
|
|
301
|
-
function buildImportAnalysisPlugin(config) {
|
|
302
|
-
return new BuiltinPlugin("builtin:build-import-analysis", config);
|
|
303
|
-
}
|
|
304
|
-
function viteResolvePlugin(config) {
|
|
305
|
-
const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", config);
|
|
306
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
307
|
-
}
|
|
308
|
-
function isolatedDeclarationPlugin(config) {
|
|
309
|
-
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
310
|
-
}
|
|
311
|
-
function assetPlugin(config) {
|
|
312
|
-
return new BuiltinPlugin("builtin:asset", config);
|
|
313
|
-
}
|
|
314
|
-
function webWorkerPostPlugin() {
|
|
315
|
-
return new BuiltinPlugin("builtin:web-worker-post");
|
|
316
|
-
}
|
|
317
|
-
|
|
318
263
|
//#endregion
|
|
319
264
|
//#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
320
265
|
let _lazyMatch = () => {
|
|
@@ -911,6 +856,72 @@ function normalizeHook(hook) {
|
|
|
911
856
|
unreachable("Invalid hook type");
|
|
912
857
|
}
|
|
913
858
|
|
|
859
|
+
//#endregion
|
|
860
|
+
//#region src/utils/normalize-string-or-regex.ts
|
|
861
|
+
function normalizedStringOrRegex(pattern) {
|
|
862
|
+
if (!pattern) return void 0;
|
|
863
|
+
if (!isReadonlyArray(pattern)) return [pattern];
|
|
864
|
+
return pattern;
|
|
865
|
+
}
|
|
866
|
+
function isReadonlyArray(input) {
|
|
867
|
+
return Array.isArray(input);
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
//#endregion
|
|
871
|
+
//#region src/builtin-plugin/constructors.ts
|
|
872
|
+
function modulePreloadPolyfillPlugin(config) {
|
|
873
|
+
return createBuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
874
|
+
}
|
|
875
|
+
function dynamicImportVarsPlugin(config) {
|
|
876
|
+
if (config) {
|
|
877
|
+
config.include = normalizedStringOrRegex(config.include);
|
|
878
|
+
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
879
|
+
}
|
|
880
|
+
return createBuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
881
|
+
}
|
|
882
|
+
function importGlobPlugin(config) {
|
|
883
|
+
return createBuiltinPlugin("builtin:import-glob", config);
|
|
884
|
+
}
|
|
885
|
+
function reporterPlugin(config) {
|
|
886
|
+
return createBuiltinPlugin("builtin:reporter", config);
|
|
887
|
+
}
|
|
888
|
+
function manifestPlugin(config) {
|
|
889
|
+
return createBuiltinPlugin("builtin:manifest", config);
|
|
890
|
+
}
|
|
891
|
+
function wasmHelperPlugin(config) {
|
|
892
|
+
return createBuiltinPlugin("builtin:wasm-helper", config);
|
|
893
|
+
}
|
|
894
|
+
function wasmFallbackPlugin() {
|
|
895
|
+
const builtinPlugin = createBuiltinPlugin("builtin:wasm-fallback");
|
|
896
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
897
|
+
}
|
|
898
|
+
function loadFallbackPlugin() {
|
|
899
|
+
return createBuiltinPlugin("builtin:load-fallback");
|
|
900
|
+
}
|
|
901
|
+
function jsonPlugin(config) {
|
|
902
|
+
const builtinPlugin = createBuiltinPlugin("builtin:json", config);
|
|
903
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
904
|
+
}
|
|
905
|
+
function buildImportAnalysisPlugin(config) {
|
|
906
|
+
return createBuiltinPlugin("builtin:build-import-analysis", config);
|
|
907
|
+
}
|
|
908
|
+
function viteResolvePlugin(config) {
|
|
909
|
+
const builtinPlugin = createBuiltinPlugin("builtin:vite-resolve", config);
|
|
910
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
911
|
+
}
|
|
912
|
+
function isolatedDeclarationPlugin(config) {
|
|
913
|
+
return createBuiltinPlugin("builtin:isolated-declaration", config);
|
|
914
|
+
}
|
|
915
|
+
function assetPlugin(config) {
|
|
916
|
+
return createBuiltinPlugin("builtin:asset", config);
|
|
917
|
+
}
|
|
918
|
+
function webWorkerPostPlugin() {
|
|
919
|
+
return createBuiltinPlugin("builtin:web-worker-post");
|
|
920
|
+
}
|
|
921
|
+
function esmExternalRequirePlugin(config) {
|
|
922
|
+
return createBuiltinPlugin("builtin:esm-external-require", config);
|
|
923
|
+
}
|
|
924
|
+
|
|
914
925
|
//#endregion
|
|
915
926
|
//#region src/constants/plugin.ts
|
|
916
927
|
const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
|
|
@@ -1002,7 +1013,7 @@ function checkOutputPluginOption(plugins, onLog) {
|
|
|
1002
1013
|
function normalizePlugins(plugins, anonymousPrefix) {
|
|
1003
1014
|
for (const [index, plugin] of plugins.entries()) {
|
|
1004
1015
|
if ("_parallel" in plugin) continue;
|
|
1005
|
-
if (plugin
|
|
1016
|
+
if (isBuiltinPlugin(plugin)) continue;
|
|
1006
1017
|
if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
|
|
1007
1018
|
}
|
|
1008
1019
|
return plugins;
|
|
@@ -1071,7 +1082,7 @@ function getObjectPlugins(plugins) {
|
|
|
1071
1082
|
return plugins.filter((plugin) => {
|
|
1072
1083
|
if (!plugin) return void 0;
|
|
1073
1084
|
if ("_parallel" in plugin) return void 0;
|
|
1074
|
-
if (plugin
|
|
1085
|
+
if (isBuiltinPlugin(plugin)) return void 0;
|
|
1075
1086
|
return plugin;
|
|
1076
1087
|
});
|
|
1077
1088
|
}
|
|
@@ -2175,6 +2186,7 @@ var require_ansis = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ansis
|
|
|
2175
2186
|
//#endregion
|
|
2176
2187
|
//#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.mjs
|
|
2177
2188
|
var import_ansis = /* @__PURE__ */ __toESM(require_ansis(), 1);
|
|
2189
|
+
var ansis_default = import_ansis.default;
|
|
2178
2190
|
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;
|
|
2179
2191
|
|
|
2180
2192
|
//#endregion
|
|
@@ -2272,7 +2284,7 @@ const TransformOptionsSchema = object({
|
|
|
2272
2284
|
typescript: optional(TypescriptSchema),
|
|
2273
2285
|
helpers: optional(HelpersSchema),
|
|
2274
2286
|
decorators: optional(DecoratorOptionSchema),
|
|
2275
|
-
jsx: optional(JsxOptionsSchema),
|
|
2287
|
+
jsx: optional(union([literal("preserve"), JsxOptionsSchema])),
|
|
2276
2288
|
target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
|
|
2277
2289
|
});
|
|
2278
2290
|
const WatchOptionsSchema = strictObject({
|
|
@@ -2300,7 +2312,8 @@ const ChecksOptionsSchema = strictObject({
|
|
|
2300
2312
|
commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
|
|
2301
2313
|
importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
|
|
2302
2314
|
emptyImportMeta: pipe(optional(boolean()), description("Whether to emit warning when detecting empty import meta")),
|
|
2303
|
-
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
|
|
2315
|
+
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict")),
|
|
2316
|
+
preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
|
|
2304
2317
|
});
|
|
2305
2318
|
const MinifyOptionsSchema = strictObject({
|
|
2306
2319
|
mangle: optional(boolean()),
|
|
@@ -2318,17 +2331,25 @@ const ResolveOptionsSchema = strictObject({
|
|
|
2318
2331
|
mainFiles: optional(array(string())),
|
|
2319
2332
|
modules: optional(array(string())),
|
|
2320
2333
|
symlinks: optional(boolean()),
|
|
2321
|
-
tsconfigFilename: optional(string()),
|
|
2322
2334
|
yarnPnp: optional(boolean())
|
|
2323
2335
|
});
|
|
2324
2336
|
const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
2325
2337
|
annotations: optional(boolean()),
|
|
2326
2338
|
manualPureFunctions: optional(array(string())),
|
|
2327
2339
|
unknownGlobalSideEffects: optional(boolean()),
|
|
2328
|
-
commonjs: optional(boolean())
|
|
2340
|
+
commonjs: optional(boolean()),
|
|
2341
|
+
propertyReadSideEffects: optional(union([literal(false), literal("always")])),
|
|
2342
|
+
propertyWriteSideEffects: optional(union([literal(false), literal("always")]))
|
|
2329
2343
|
})]);
|
|
2330
2344
|
const OptimizationOptionsSchema = strictObject({
|
|
2331
|
-
inlineConst: pipe(optional(
|
|
2345
|
+
inlineConst: pipe(optional(union([
|
|
2346
|
+
boolean(),
|
|
2347
|
+
literal("smart"),
|
|
2348
|
+
strictObject({
|
|
2349
|
+
mode: optional(union([literal("all"), literal("smart")])),
|
|
2350
|
+
pass: optional(number())
|
|
2351
|
+
})
|
|
2352
|
+
])), description("Enable crossmodule constant inlining")),
|
|
2332
2353
|
pifeForModuleWrappers: pipe(optional(boolean()), description("Use PIFE pattern for module wrappers"))
|
|
2333
2354
|
});
|
|
2334
2355
|
const OnLogSchema = pipe(function_(), args(tuple([
|
|
@@ -2338,6 +2359,7 @@ const OnLogSchema = pipe(function_(), args(tuple([
|
|
|
2338
2359
|
])));
|
|
2339
2360
|
const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
|
|
2340
2361
|
const HmrSchema = union([boolean(), strictObject({
|
|
2362
|
+
new: optional(boolean()),
|
|
2341
2363
|
port: optional(number()),
|
|
2342
2364
|
host: optional(string()),
|
|
2343
2365
|
implement: optional(string())
|
|
@@ -2353,11 +2375,11 @@ const InputOptionsSchema = strictObject({
|
|
|
2353
2375
|
literal("browser"),
|
|
2354
2376
|
literal("neutral"),
|
|
2355
2377
|
literal("node")
|
|
2356
|
-
])), description(`Platform for which the code should be generated (node, ${
|
|
2378
|
+
])), description(`Platform for which the code should be generated (node, ${ansis_default.underline("browser")}, neutral)`)),
|
|
2357
2379
|
shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
|
|
2358
2380
|
treeshake: optional(TreeshakingOptionsSchema),
|
|
2359
2381
|
optimization: optional(OptimizationOptionsSchema),
|
|
2360
|
-
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${
|
|
2382
|
+
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${ansis_default.dim("silent")}, ${ansis_default.underline(ansis_default.gray("info"))}, debug, ${ansis_default.yellow("warn")})`)),
|
|
2361
2383
|
onLog: optional(OnLogSchema),
|
|
2362
2384
|
onwarn: optional(OnwarnSchema),
|
|
2363
2385
|
moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
|
|
@@ -2402,7 +2424,8 @@ const InputOptionsSchema = strictObject({
|
|
|
2402
2424
|
literal("allow-extension"),
|
|
2403
2425
|
literal("exports-only"),
|
|
2404
2426
|
literal(false)
|
|
2405
|
-
])))
|
|
2427
|
+
]))),
|
|
2428
|
+
tsconfig: pipe(optional(string()), description("Path to the tsconfig.json file."))
|
|
2406
2429
|
});
|
|
2407
2430
|
const InputCliOverrideSchema = strictObject({
|
|
2408
2431
|
input: pipe(optional(array(string())), description("Entry file")),
|
|
@@ -2475,18 +2498,18 @@ const OutputOptionsSchema = strictObject({
|
|
|
2475
2498
|
literal("named"),
|
|
2476
2499
|
literal("default"),
|
|
2477
2500
|
literal("none")
|
|
2478
|
-
])), description(`Specify a export mode (${
|
|
2501
|
+
])), description(`Specify a export mode (${ansis_default.underline("auto")}, named, default, none)`)),
|
|
2479
2502
|
hashCharacters: pipe(optional(union([
|
|
2480
2503
|
literal("base64"),
|
|
2481
2504
|
literal("base36"),
|
|
2482
2505
|
literal("hex")
|
|
2483
2506
|
])), description("Use the specified character set for file hashes")),
|
|
2484
|
-
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${
|
|
2507
|
+
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${ansis_default.underline("esm")}, cjs, and iife)`)),
|
|
2485
2508
|
sourcemap: pipe(optional(union([
|
|
2486
2509
|
boolean(),
|
|
2487
2510
|
literal("inline"),
|
|
2488
2511
|
literal("hidden")
|
|
2489
|
-
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${
|
|
2512
|
+
])), 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")})`)),
|
|
2490
2513
|
sourcemapBaseUrl: pipe(optional(string()), description("Base URL used to prefix sourcemap paths")),
|
|
2491
2514
|
sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
|
|
2492
2515
|
sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
|
|
@@ -2524,10 +2547,11 @@ const OutputOptionsSchema = strictObject({
|
|
|
2524
2547
|
preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
|
|
2525
2548
|
preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
|
|
2526
2549
|
virtualDirname: optional(string()),
|
|
2527
|
-
minifyInternalExports: pipe(optional(boolean()), description("Minify internal exports"))
|
|
2550
|
+
minifyInternalExports: pipe(optional(boolean()), description("Minify internal exports")),
|
|
2551
|
+
topLevelVar: pipe(optional(boolean()), description("Rewrite top-level declarations to use `var`."))
|
|
2528
2552
|
});
|
|
2529
2553
|
const getAddonDescription = (placement, wrapper) => {
|
|
2530
|
-
return `Code to insert the ${
|
|
2554
|
+
return `Code to insert the ${ansis_default.bold(placement)} of the bundled file (${ansis_default.bold(wrapper)} the wrapper function)`;
|
|
2531
2555
|
};
|
|
2532
2556
|
const OutputCliOverrideSchema = strictObject({
|
|
2533
2557
|
assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
|
|
@@ -2565,15 +2589,19 @@ const CliOptionsSchema = strictObject({
|
|
|
2565
2589
|
...InputCliOptionsSchema.entries,
|
|
2566
2590
|
...OutputCliOptionsSchema.entries
|
|
2567
2591
|
});
|
|
2568
|
-
const inputHelperMsgRecord = {
|
|
2592
|
+
const inputHelperMsgRecord = {
|
|
2593
|
+
output: { ignored: true },
|
|
2594
|
+
"resolve.tsconfigFilename": { issueMsg: "It is deprecated. Please use the top-level `tsconfig` option instead." }
|
|
2595
|
+
};
|
|
2569
2596
|
const outputHelperMsgRecord = {};
|
|
2570
2597
|
function validateOption(key, options) {
|
|
2598
|
+
if (typeof options !== "object") throw new Error(`Invalid ${key} options. Expected an Object but received ${JSON.stringify(options)}.`);
|
|
2571
2599
|
if (globalThis.process?.env?.ROLLUP_TEST) return;
|
|
2572
2600
|
let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
|
|
2573
2601
|
if (!parsed.success) {
|
|
2574
2602
|
const errors = parsed.issues.map((issue) => {
|
|
2575
|
-
const issuePaths = issue.path.map((path) => path.key);
|
|
2576
2603
|
let issueMsg = issue.message;
|
|
2604
|
+
const issuePaths = issue.path.map((path) => path.key);
|
|
2577
2605
|
if (issue.type === "union") {
|
|
2578
2606
|
const subIssue = issue.issues?.find((i$1) => !(i$1.type !== issue.received && i$1.input === issue.input));
|
|
2579
2607
|
if (subIssue) {
|
|
@@ -2584,9 +2612,9 @@ function validateOption(key, options) {
|
|
|
2584
2612
|
const stringPath = issuePaths.join(".");
|
|
2585
2613
|
const helper = key === "input" ? inputHelperMsgRecord[stringPath] : outputHelperMsgRecord[stringPath];
|
|
2586
2614
|
if (helper && helper.ignored) return "";
|
|
2587
|
-
return `- For the "${stringPath}". ${issueMsg}
|
|
2615
|
+
return `- For the "${stringPath}". ${helper?.issueMsg || issueMsg + "."} ${helper?.help ? `\n Help: ${helper.help}` : ""}`;
|
|
2588
2616
|
}).filter(Boolean);
|
|
2589
|
-
if (errors.length) console.warn(
|
|
2617
|
+
if (errors.length) console.warn(`\x1b[33mWarning: Invalid ${key} options (${errors.length} issue${errors.length === 1 ? "" : "s"} found)\n${errors.join("\n")}\x1b[0m`);
|
|
2590
2618
|
}
|
|
2591
2619
|
}
|
|
2592
2620
|
|
|
@@ -2650,6 +2678,10 @@ function getErrorMessage(e$2) {
|
|
|
2650
2678
|
s$1 += message;
|
|
2651
2679
|
if (e$2.frame) s$1 = joinNewLine(s$1, e$2.frame);
|
|
2652
2680
|
if (e$2.stack) s$1 = joinNewLine(s$1, e$2.stack.replace(message, ""));
|
|
2681
|
+
if (e$2.cause) {
|
|
2682
|
+
s$1 = joinNewLine(s$1, "Caused by:");
|
|
2683
|
+
s$1 = joinNewLine(s$1, getErrorMessage(e$2.cause).split("\n").map((line) => " " + line).join("\n"));
|
|
2684
|
+
}
|
|
2653
2685
|
return s$1;
|
|
2654
2686
|
}
|
|
2655
2687
|
function joinNewLine(s1, s2) {
|
|
@@ -2956,7 +2988,7 @@ function bindingPluginOrder(order) {
|
|
|
2956
2988
|
}
|
|
2957
2989
|
|
|
2958
2990
|
//#endregion
|
|
2959
|
-
//#region ../../node_modules/.pnpm/oxc-parser@0.82.
|
|
2991
|
+
//#region ../../node_modules/.pnpm/oxc-parser@0.82.3/node_modules/oxc-parser/wrap.mjs
|
|
2960
2992
|
function wrap$1(result) {
|
|
2961
2993
|
let program, module$1, comments, errors;
|
|
2962
2994
|
return {
|
|
@@ -3122,7 +3154,8 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
3122
3154
|
...res,
|
|
3123
3155
|
external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
3124
3156
|
...info,
|
|
3125
|
-
moduleSideEffects: info.moduleSideEffects ?? res.moduleSideEffects ?? null
|
|
3157
|
+
moduleSideEffects: info.moduleSideEffects ?? res.moduleSideEffects ?? null,
|
|
3158
|
+
packageJsonPath: res.packageJsonPath
|
|
3126
3159
|
};
|
|
3127
3160
|
}
|
|
3128
3161
|
emitFile = (file) => {
|
|
@@ -3248,7 +3281,8 @@ function bindingifyResolveId(args$1) {
|
|
|
3248
3281
|
id: ret.id,
|
|
3249
3282
|
external: ret.external,
|
|
3250
3283
|
normalizeExternalId: false,
|
|
3251
|
-
moduleSideEffects: exist.moduleSideEffects ?? void 0
|
|
3284
|
+
moduleSideEffects: exist.moduleSideEffects ?? void 0,
|
|
3285
|
+
packageJsonPath: ret.packageJsonPath
|
|
3252
3286
|
};
|
|
3253
3287
|
},
|
|
3254
3288
|
meta: bindingifyPluginHookMeta(meta),
|
|
@@ -4174,7 +4208,13 @@ var NormalizedOutputOptionsImpl = class {
|
|
|
4174
4208
|
return this.outputOptions.sourcemapPathTransform;
|
|
4175
4209
|
}
|
|
4176
4210
|
get minify() {
|
|
4177
|
-
|
|
4211
|
+
let ret = this.inner.minify;
|
|
4212
|
+
if (typeof ret === "object" && ret !== null) {
|
|
4213
|
+
delete ret["codegen"];
|
|
4214
|
+
delete ret["module"];
|
|
4215
|
+
delete ret["sourcemap"];
|
|
4216
|
+
}
|
|
4217
|
+
return ret;
|
|
4178
4218
|
}
|
|
4179
4219
|
get legalComments() {
|
|
4180
4220
|
return this.inner.legalComments;
|
|
@@ -4316,7 +4356,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
4316
4356
|
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
|
|
4317
4357
|
const plugins = rawPlugins.map((plugin) => {
|
|
4318
4358
|
if ("_parallel" in plugin) return void 0;
|
|
4319
|
-
if (plugin
|
|
4359
|
+
if (isBuiltinPlugin(plugin)) return bindingifyBuiltInPlugin(plugin);
|
|
4320
4360
|
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
4321
4361
|
});
|
|
4322
4362
|
const { jsx, transform } = bindingifyJsx(onLog, inputOptions.jsx, inputOptions.transform);
|
|
@@ -4329,7 +4369,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
4329
4369
|
platform: inputOptions.platform,
|
|
4330
4370
|
shimMissingExports: inputOptions.shimMissingExports,
|
|
4331
4371
|
logLevel: bindingifyLogLevel(logLevel),
|
|
4332
|
-
onLog,
|
|
4372
|
+
onLog: async (level, log) => onLog(level, log),
|
|
4333
4373
|
treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
|
|
4334
4374
|
moduleTypes: inputOptions.moduleTypes,
|
|
4335
4375
|
define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
|
|
@@ -4358,7 +4398,8 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
4358
4398
|
markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData),
|
|
4359
4399
|
preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
|
|
4360
4400
|
optimization: inputOptions.optimization,
|
|
4361
|
-
context: inputOptions.context
|
|
4401
|
+
context: inputOptions.context,
|
|
4402
|
+
tsconfig: inputOptions.resolve?.tsconfigFilename ?? inputOptions.tsconfig
|
|
4362
4403
|
};
|
|
4363
4404
|
}
|
|
4364
4405
|
function bindingifyHmr(hmr) {
|
|
@@ -4533,6 +4574,24 @@ function bindingifyTreeshakeOptions(config) {
|
|
|
4533
4574
|
unknownGlobalSideEffects: config.unknownGlobalSideEffects,
|
|
4534
4575
|
commonjs: config.commonjs
|
|
4535
4576
|
};
|
|
4577
|
+
switch (config.propertyReadSideEffects) {
|
|
4578
|
+
case "always":
|
|
4579
|
+
normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.Always;
|
|
4580
|
+
break;
|
|
4581
|
+
case false:
|
|
4582
|
+
normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.False;
|
|
4583
|
+
break;
|
|
4584
|
+
default:
|
|
4585
|
+
}
|
|
4586
|
+
switch (config.propertyWriteSideEffects) {
|
|
4587
|
+
case "always":
|
|
4588
|
+
normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.Always;
|
|
4589
|
+
break;
|
|
4590
|
+
case false:
|
|
4591
|
+
normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.False;
|
|
4592
|
+
break;
|
|
4593
|
+
default:
|
|
4594
|
+
}
|
|
4536
4595
|
if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
|
|
4537
4596
|
else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
|
|
4538
4597
|
external: true,
|
|
@@ -4855,4 +4914,4 @@ function defineConfig(config) {
|
|
|
4855
4914
|
const VERSION = version;
|
|
4856
4915
|
|
|
4857
4916
|
//#endregion
|
|
4858
|
-
export {
|
|
4917
|
+
export { PluginDriver, VERSION, assetPlugin, build, buildImportAnalysisPlugin, createBuiltinPlugin, createBundlerImpl, createBundlerOptions, defineConfig, dynamicImportVarsPlugin, esmExternalRequirePlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rolldown/browser",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.35",
|
|
4
4
|
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
5
5
|
"homepage": "https://rolldown.rs/",
|
|
6
6
|
"type": "module",
|
|
@@ -32,21 +32,29 @@
|
|
|
32
32
|
"exports": {
|
|
33
33
|
".": {
|
|
34
34
|
"browser": "./dist/index.browser.mjs",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
35
|
+
"import": "./dist/index.mjs",
|
|
36
|
+
"require": "./dist/index.cjs"
|
|
37
|
+
},
|
|
38
|
+
"./config": {
|
|
39
|
+
"import": "./dist/config.mjs",
|
|
40
|
+
"require": "./dist/config.cjs"
|
|
37
41
|
},
|
|
38
42
|
"./experimental": {
|
|
39
43
|
"browser": "./dist/experimental-index.browser.mjs",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
44
|
+
"import": "./dist/experimental-index.mjs",
|
|
45
|
+
"require": "./dist/experimental-index.cjs"
|
|
46
|
+
},
|
|
47
|
+
"./filter": {
|
|
48
|
+
"import": "./dist/filter-index.mjs",
|
|
49
|
+
"require": "./dist/filter-index.cjs"
|
|
42
50
|
},
|
|
43
|
-
"./
|
|
44
|
-
"
|
|
45
|
-
"
|
|
51
|
+
"./parallelPlugin": {
|
|
52
|
+
"import": "./dist/parallel-plugin.mjs",
|
|
53
|
+
"require": "./dist/parallel-plugin.cjs"
|
|
46
54
|
},
|
|
47
55
|
"./parseAst": {
|
|
48
|
-
"
|
|
49
|
-
"
|
|
56
|
+
"import": "./dist/parse-ast-index.mjs",
|
|
57
|
+
"require": "./dist/parse-ast-index.cjs"
|
|
50
58
|
},
|
|
51
59
|
"./package.json": "./package.json"
|
|
52
60
|
},
|
|
@@ -56,7 +64,7 @@
|
|
|
56
64
|
},
|
|
57
65
|
"dependencies": {
|
|
58
66
|
"@napi-rs/wasm-runtime": "^1.0.0",
|
|
59
|
-
"@oxc-project/runtime": "=0.82.
|
|
67
|
+
"@oxc-project/runtime": "=0.82.3"
|
|
60
68
|
},
|
|
61
69
|
"scripts": {
|
|
62
70
|
"build": "pnpm run build:debug",
|