rolldown 1.0.0-beta.7-commit.169739a → 1.0.0-beta.7-commit.5436742
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 +29 -28
- package/dist/cli.mjs +14 -15
- package/dist/experimental-index.cjs +2 -2
- package/dist/experimental-index.mjs +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/parallel-plugin-worker.cjs +2 -2
- package/dist/parallel-plugin-worker.mjs +2 -2
- package/dist/parse-ast-index.cjs +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/shared/{parse-ast-index-BfKb9n4T.cjs → parse-ast-index-BYnHVW-r.cjs} +7 -87
- package/dist/shared/{parse-ast-index-5U4JtZBO.mjs → parse-ast-index-DIgNCrdQ.mjs} +7 -89
- package/dist/shared/{prompt-W5YHe0v6.mjs → prompt-V-Wm9PcC.mjs} +2 -2
- package/dist/shared/{src-BrFHFloa.mjs → src-5S10TbU1.mjs} +34 -11
- package/dist/shared/{src-l7SNPOyJ.cjs → src-BIFT4wDd.cjs} +38 -16
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/api/rolldown/rolldown-build.d.ts +2 -1
- package/dist/types/binding.d.ts +12 -1
- package/dist/types/options/input-options.d.ts +1 -0
- package/dist/types/plugin/with-filter.d.ts +4 -2
- package/dist/types/types.d.ts +7 -0
- package/dist/types/utils/initialize-parallel-plugins.d.ts +0 -2
- package/dist/types/utils/misc.d.ts +1 -0
- package/package.json +22 -20
- package/dist/types/cli/colors.d.ts +0 -11
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { __esm } from "./chunk-DUYDk_2O.mjs";
|
|
2
|
-
import { augmentCodeLocation,
|
|
2
|
+
import { augmentCodeLocation, error, import_binding, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMinifyWarning, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-DIgNCrdQ.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import colors from "ansis";
|
|
4
5
|
import { toJsonSchema } from "@valibot/to-json-schema";
|
|
5
6
|
import * as v from "valibot";
|
|
6
|
-
import { Buffer } from "node:buffer";
|
|
7
7
|
import { availableParallelism } from "node:os";
|
|
8
8
|
import { Worker } from "node:worker_threads";
|
|
9
9
|
|
|
10
10
|
//#region package.json
|
|
11
|
-
var version = "1.0.0-beta.7-commit.
|
|
11
|
+
var version = "1.0.0-beta.7-commit.5436742";
|
|
12
12
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
@@ -108,6 +108,9 @@ function arraify(value) {
|
|
|
108
108
|
function isNullish(value) {
|
|
109
109
|
return value === null || value === void 0;
|
|
110
110
|
}
|
|
111
|
+
function isPromiseLike(value) {
|
|
112
|
+
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
113
|
+
}
|
|
111
114
|
function unimplemented(info) {
|
|
112
115
|
if (info) throw new Error(`unimplemented: ${info}`);
|
|
113
116
|
throw new Error("unimplemented");
|
|
@@ -484,7 +487,7 @@ function validateCliOptions(options) {
|
|
|
484
487
|
})];
|
|
485
488
|
}
|
|
486
489
|
function validateOption(key, options) {
|
|
487
|
-
if (process
|
|
490
|
+
if (globalThis.process?.env?.ROLLDOWN_OPTIONS_VALIDATION === "loose") return;
|
|
488
491
|
let parsed = v.safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
|
|
489
492
|
if (!parsed.success) {
|
|
490
493
|
const errors = parsed.issues.map((issue) => {
|
|
@@ -516,7 +519,6 @@ function getJsonSchema() {
|
|
|
516
519
|
}
|
|
517
520
|
var StringOrRegExpSchema, LogLevelSchema, LogLevelOptionSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, InputOptionSchema, ExternalSchema, ModuleTypesSchema, JsxOptionsSchema, HelperModeSchema, DecoratorOptionSchema, HelpersSchema, RewriteImportExtensionsSchema, TypescriptSchema, AssumptionsSchema, TransformOptionsSchema, WatchOptionsSchema, ChecksOptionsSchema, MinifyOptionsSchema, ResolveOptionsSchema, TreeshakingOptionsSchema, OnLogSchema, OnwarnSchema, HmrSchema, InputOptionsSchema, InputCliOverrideSchema, InputCliOptionsSchema, ESTarget, ModuleFormatSchema, AddonFunctionSchema, ChunkFileNamesSchema, AssetFileNamesSchema, SanitizeFileNameSchema, GlobalsFunctionSchema, AdvancedChunksSchema, OutputOptionsSchema, getAddonDescription, OutputCliOverrideSchema, OutputCliOptionsSchema, CliOptionsSchema, inputHelperMsgRecord, outputHelperMsgRecord;
|
|
518
521
|
var init_validator = __esm({ "src/utils/validator.ts"() {
|
|
519
|
-
init_colors();
|
|
520
522
|
StringOrRegExpSchema = v.union([v.string(), v.instance(RegExp)]);
|
|
521
523
|
LogLevelSchema = v.union([
|
|
522
524
|
v.literal("debug"),
|
|
@@ -659,7 +661,8 @@ var init_validator = __esm({ "src/utils/validator.ts"() {
|
|
|
659
661
|
OnwarnSchema = v.pipe(v.function(), v.args(v.tuple([RollupLogSchema, v.pipe(v.function(), v.args(v.tuple([v.union([RollupLogWithStringSchema, v.pipe(v.function(), v.returns(RollupLogWithStringSchema))])])))])));
|
|
660
662
|
HmrSchema = v.union([v.boolean(), v.strictObject({
|
|
661
663
|
port: v.optional(v.number()),
|
|
662
|
-
host: v.optional(v.string())
|
|
664
|
+
host: v.optional(v.string()),
|
|
665
|
+
implement: v.optional(v.string())
|
|
663
666
|
})]);
|
|
664
667
|
InputOptionsSchema = v.strictObject({
|
|
665
668
|
input: v.optional(InputOptionSchema),
|
|
@@ -4301,18 +4304,24 @@ var init_watch = __esm({ "src/api/watch/index.ts"() {
|
|
|
4301
4304
|
|
|
4302
4305
|
//#endregion
|
|
4303
4306
|
//#region src/plugin/with-filter.ts
|
|
4304
|
-
function
|
|
4305
|
-
|
|
4307
|
+
function withFilterImpl(pluginOption, filterObjectList) {
|
|
4308
|
+
if (isPromiseLike(pluginOption)) return pluginOption.then((p$3) => withFilter(p$3, filterObjectList));
|
|
4309
|
+
if (pluginOption == false || pluginOption == null) return pluginOption;
|
|
4310
|
+
if (Array.isArray(pluginOption)) return pluginOption.map((p$3) => withFilter(p$3, filterObjectList));
|
|
4311
|
+
let plugin = pluginOption;
|
|
4312
|
+
let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
|
|
4313
|
+
if (filterObjectIndex === -1) return plugin;
|
|
4314
|
+
let filterObject = filterObjectList[filterObjectIndex];
|
|
4306
4315
|
Object.keys(plugin).forEach((key) => {
|
|
4307
4316
|
switch (key) {
|
|
4308
4317
|
case "transform":
|
|
4309
4318
|
case "resolveId":
|
|
4310
4319
|
case "load":
|
|
4311
4320
|
if (!plugin[key]) return;
|
|
4312
|
-
if (typeof plugin[key] === "object") plugin[key].filter =
|
|
4321
|
+
if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
|
|
4313
4322
|
else plugin[key] = {
|
|
4314
4323
|
handler: plugin[key],
|
|
4315
|
-
filter:
|
|
4324
|
+
filter: filterObject[key]
|
|
4316
4325
|
};
|
|
4317
4326
|
break;
|
|
4318
4327
|
default: break;
|
|
@@ -4320,7 +4329,21 @@ function withFilter(plugin, filter_obj) {
|
|
|
4320
4329
|
});
|
|
4321
4330
|
return plugin;
|
|
4322
4331
|
}
|
|
4323
|
-
|
|
4332
|
+
function withFilter(pluginOption, filterObject) {
|
|
4333
|
+
return withFilterImpl(pluginOption, arraify(filterObject));
|
|
4334
|
+
}
|
|
4335
|
+
function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
|
|
4336
|
+
if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
|
|
4337
|
+
for (let i$21 = 0; i$21 < overrideFilterObjectList.length; i$21++) for (let j$1 = 0; j$1 < (overrideFilterObjectList[i$21].pluginNamePattern ?? []).length; j$1++) {
|
|
4338
|
+
let pattern = overrideFilterObjectList[i$21].pluginNamePattern[j$1];
|
|
4339
|
+
if (typeof pattern === "string" && pattern === pluginName) return i$21;
|
|
4340
|
+
else if (pattern instanceof RegExp && pattern.test(pluginName)) return i$21;
|
|
4341
|
+
}
|
|
4342
|
+
return -1;
|
|
4343
|
+
}
|
|
4344
|
+
var init_with_filter = __esm({ "src/plugin/with-filter.ts"() {
|
|
4345
|
+
init_misc();
|
|
4346
|
+
} });
|
|
4324
4347
|
|
|
4325
4348
|
//#endregion
|
|
4326
4349
|
//#region src/plugin/index.ts
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const require_chunk = require('./chunk-qZFfknuJ.cjs');
|
|
3
|
-
const require_parse_ast_index = require('./parse-ast-index-
|
|
3
|
+
const require_parse_ast_index = require('./parse-ast-index-BYnHVW-r.cjs');
|
|
4
4
|
const node_path = require_chunk.__toESM(require("node:path"));
|
|
5
|
+
const ansis = require_chunk.__toESM(require("ansis"));
|
|
5
6
|
const __valibot_to_json_schema = require_chunk.__toESM(require("@valibot/to-json-schema"));
|
|
6
7
|
const valibot = require_chunk.__toESM(require("valibot"));
|
|
7
|
-
const node_buffer = require_chunk.__toESM(require("node:buffer"));
|
|
8
8
|
const node_os = require_chunk.__toESM(require("node:os"));
|
|
9
9
|
const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
|
|
10
10
|
|
|
11
11
|
//#region package.json
|
|
12
|
-
var version = "1.0.0-beta.7-commit.
|
|
12
|
+
var version = "1.0.0-beta.7-commit.5436742";
|
|
13
13
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
14
14
|
|
|
15
15
|
//#endregion
|
|
@@ -104,6 +104,9 @@ function arraify(value) {
|
|
|
104
104
|
function isNullish(value) {
|
|
105
105
|
return value === null || value === void 0;
|
|
106
106
|
}
|
|
107
|
+
function isPromiseLike(value) {
|
|
108
|
+
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
109
|
+
}
|
|
107
110
|
function unimplemented(info) {
|
|
108
111
|
if (info) throw new Error(`unimplemented: ${info}`);
|
|
109
112
|
throw new Error("unimplemented");
|
|
@@ -565,7 +568,8 @@ const OnLogSchema = valibot.pipe(valibot.function(), valibot.args(valibot.tuple(
|
|
|
565
568
|
const OnwarnSchema = valibot.pipe(valibot.function(), valibot.args(valibot.tuple([RollupLogSchema, valibot.pipe(valibot.function(), valibot.args(valibot.tuple([valibot.union([RollupLogWithStringSchema, valibot.pipe(valibot.function(), valibot.returns(RollupLogWithStringSchema))])])))])));
|
|
566
569
|
const HmrSchema = valibot.union([valibot.boolean(), valibot.strictObject({
|
|
567
570
|
port: valibot.optional(valibot.number()),
|
|
568
|
-
host: valibot.optional(valibot.string())
|
|
571
|
+
host: valibot.optional(valibot.string()),
|
|
572
|
+
implement: valibot.optional(valibot.string())
|
|
569
573
|
})]);
|
|
570
574
|
const InputOptionsSchema = valibot.strictObject({
|
|
571
575
|
input: valibot.optional(InputOptionSchema),
|
|
@@ -577,10 +581,10 @@ const InputOptionsSchema = valibot.strictObject({
|
|
|
577
581
|
valibot.literal("browser"),
|
|
578
582
|
valibot.literal("neutral"),
|
|
579
583
|
valibot.literal("node")
|
|
580
|
-
])), valibot.description(`Platform for which the code should be generated (node, ${
|
|
584
|
+
])), valibot.description(`Platform for which the code should be generated (node, ${ansis.default.underline("browser")}, neutral)`)),
|
|
581
585
|
shimMissingExports: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Create shim variables for missing exports")),
|
|
582
586
|
treeshake: valibot.optional(TreeshakingOptionsSchema),
|
|
583
|
-
logLevel: valibot.pipe(valibot.optional(LogLevelOptionSchema), valibot.description(`Log level (${
|
|
587
|
+
logLevel: valibot.pipe(valibot.optional(LogLevelOptionSchema), valibot.description(`Log level (${ansis.default.dim("silent")}, ${ansis.default.underline(ansis.default.gray("info"))}, debug, ${ansis.default.yellow("warn")})`)),
|
|
584
588
|
onLog: valibot.optional(OnLogSchema),
|
|
585
589
|
onwarn: valibot.optional(OnwarnSchema),
|
|
586
590
|
moduleTypes: valibot.pipe(valibot.optional(ModuleTypesSchema), valibot.description("Module types for customized extensions")),
|
|
@@ -681,18 +685,18 @@ const OutputOptionsSchema = valibot.strictObject({
|
|
|
681
685
|
valibot.literal("named"),
|
|
682
686
|
valibot.literal("default"),
|
|
683
687
|
valibot.literal("none")
|
|
684
|
-
])), valibot.description(`Specify a export mode (${
|
|
688
|
+
])), valibot.description(`Specify a export mode (${ansis.default.underline("auto")}, named, default, none)`)),
|
|
685
689
|
hashCharacters: valibot.pipe(valibot.optional(valibot.union([
|
|
686
690
|
valibot.literal("base64"),
|
|
687
691
|
valibot.literal("base36"),
|
|
688
692
|
valibot.literal("hex")
|
|
689
693
|
])), valibot.description("Use the specified character set for file hashes")),
|
|
690
|
-
format: valibot.pipe(valibot.optional(ModuleFormatSchema), valibot.description(`Output format of the generated bundle (supports ${
|
|
694
|
+
format: valibot.pipe(valibot.optional(ModuleFormatSchema), valibot.description(`Output format of the generated bundle (supports ${ansis.default.underline("esm")}, cjs, and iife)`)),
|
|
691
695
|
sourcemap: valibot.pipe(valibot.optional(valibot.union([
|
|
692
696
|
valibot.boolean(),
|
|
693
697
|
valibot.literal("inline"),
|
|
694
698
|
valibot.literal("hidden")
|
|
695
|
-
])), valibot.description(`Generate sourcemap (\`-s inline\` for inline, or ${
|
|
699
|
+
])), valibot.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")})`)),
|
|
696
700
|
sourcemapDebugIds: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Inject sourcemap debug IDs")),
|
|
697
701
|
sourcemapIgnoreList: valibot.optional(valibot.union([valibot.boolean(), valibot.custom(() => true)])),
|
|
698
702
|
sourcemapPathTransform: valibot.optional(valibot.custom(() => true)),
|
|
@@ -723,7 +727,7 @@ const OutputOptionsSchema = valibot.strictObject({
|
|
|
723
727
|
plugins: valibot.optional(valibot.custom(() => true))
|
|
724
728
|
});
|
|
725
729
|
const getAddonDescription = (placement, wrapper) => {
|
|
726
|
-
return `Code to insert the ${
|
|
730
|
+
return `Code to insert the ${ansis.default.bold(placement)} of the bundled file (${ansis.default.bold(wrapper)} the wrapper function)`;
|
|
727
731
|
};
|
|
728
732
|
const OutputCliOverrideSchema = valibot.strictObject({
|
|
729
733
|
assetFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for asset files")),
|
|
@@ -770,7 +774,7 @@ function validateCliOptions(options) {
|
|
|
770
774
|
const inputHelperMsgRecord = { output: { ignored: true } };
|
|
771
775
|
const outputHelperMsgRecord = {};
|
|
772
776
|
function validateOption(key, options) {
|
|
773
|
-
if (process
|
|
777
|
+
if (globalThis.process?.env?.ROLLDOWN_OPTIONS_VALIDATION === "loose") return;
|
|
774
778
|
let parsed = valibot.safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
|
|
775
779
|
if (!parsed.success) {
|
|
776
780
|
const errors = parsed.issues.map((issue) => {
|
|
@@ -1558,7 +1562,7 @@ function transformToRollupSourceMap(map) {
|
|
|
1558
1562
|
return JSON.stringify(obj);
|
|
1559
1563
|
},
|
|
1560
1564
|
toUrl() {
|
|
1561
|
-
return `data:application/json;charset=utf-8;base64,${
|
|
1565
|
+
return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
|
|
1562
1566
|
}
|
|
1563
1567
|
};
|
|
1564
1568
|
return obj;
|
|
@@ -2899,18 +2903,24 @@ const watch = (input) => {
|
|
|
2899
2903
|
|
|
2900
2904
|
//#endregion
|
|
2901
2905
|
//#region src/plugin/with-filter.ts
|
|
2902
|
-
function
|
|
2903
|
-
|
|
2906
|
+
function withFilterImpl(pluginOption, filterObjectList) {
|
|
2907
|
+
if (isPromiseLike(pluginOption)) return pluginOption.then((p) => withFilter(p, filterObjectList));
|
|
2908
|
+
if (pluginOption == false || pluginOption == null) return pluginOption;
|
|
2909
|
+
if (Array.isArray(pluginOption)) return pluginOption.map((p) => withFilter(p, filterObjectList));
|
|
2910
|
+
let plugin = pluginOption;
|
|
2911
|
+
let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
|
|
2912
|
+
if (filterObjectIndex === -1) return plugin;
|
|
2913
|
+
let filterObject = filterObjectList[filterObjectIndex];
|
|
2904
2914
|
Object.keys(plugin).forEach((key) => {
|
|
2905
2915
|
switch (key) {
|
|
2906
2916
|
case "transform":
|
|
2907
2917
|
case "resolveId":
|
|
2908
2918
|
case "load":
|
|
2909
2919
|
if (!plugin[key]) return;
|
|
2910
|
-
if (typeof plugin[key] === "object") plugin[key].filter =
|
|
2920
|
+
if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
|
|
2911
2921
|
else plugin[key] = {
|
|
2912
2922
|
handler: plugin[key],
|
|
2913
|
-
filter:
|
|
2923
|
+
filter: filterObject[key]
|
|
2914
2924
|
};
|
|
2915
2925
|
break;
|
|
2916
2926
|
default: break;
|
|
@@ -2918,6 +2928,18 @@ function withFilter(plugin, filter_obj) {
|
|
|
2918
2928
|
});
|
|
2919
2929
|
return plugin;
|
|
2920
2930
|
}
|
|
2931
|
+
function withFilter(pluginOption, filterObject) {
|
|
2932
|
+
return withFilterImpl(pluginOption, arraify(filterObject));
|
|
2933
|
+
}
|
|
2934
|
+
function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
|
|
2935
|
+
if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
|
|
2936
|
+
for (let i = 0; i < overrideFilterObjectList.length; i++) for (let j = 0; j < (overrideFilterObjectList[i].pluginNamePattern ?? []).length; j++) {
|
|
2937
|
+
let pattern = overrideFilterObjectList[i].pluginNamePattern[j];
|
|
2938
|
+
if (typeof pattern === "string" && pattern === pluginName) return i;
|
|
2939
|
+
else if (pattern instanceof RegExp && pattern.test(pluginName)) return i;
|
|
2940
|
+
}
|
|
2941
|
+
return -1;
|
|
2942
|
+
}
|
|
2921
2943
|
|
|
2922
2944
|
//#endregion
|
|
2923
2945
|
//#region src/utils/define-config.ts
|