rolldown 1.0.0-beta.1-commit.c170008 → 1.0.0-beta.1-commit.3484a68
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/cjs/cli.cjs +50 -1333
- package/dist/cjs/experimental-index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/parallel-plugin-worker.cjs +1 -1
- package/dist/esm/cli.mjs +35 -1318
- package/dist/esm/experimental-index.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/parallel-plugin-worker.mjs +1 -1
- package/dist/shared/{consola_36c0034f-C_-uQ5ge.cjs → consola_36c0034f-BBnpcLZ5.cjs} +2 -2
- package/dist/shared/{consola_36c0034f-DnM2mwLf.mjs → consola_36c0034f-BwyQ494_.mjs} +2 -2
- package/dist/shared/{prompt-BNaEjAIz.cjs → prompt-BKuli-WV.cjs} +48 -48
- package/dist/shared/{prompt-DhKXGIIR.mjs → prompt-CqEsx-3v.mjs} +1 -1
- package/dist/shared/{src-CQK3Jfvf.mjs → src-CtFcwTp3.mjs} +341 -25
- package/dist/shared/{src-CKrS_jGA.cjs → src-D_KTGKvd.cjs} +369 -59
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/cli/arguments/alias.d.ts +8 -1
- package/dist/types/cli/arguments/index.d.ts +1 -1
- package/dist/types/cli/arguments/normalize.d.ts +1 -1
- package/dist/types/cli/arguments/utils.d.ts +4 -2
- package/dist/types/log/logging.d.ts +0 -6
- package/dist/types/options/input-options.d.ts +4 -4
- package/dist/types/{treeshake → types}/module-side-effects.d.ts +0 -4
- package/dist/types/types/schema.d.ts +33 -0
- package/dist/types/utils/validator.d.ts +7 -1
- package/package.json +16 -18
- package/dist/types/cli/arguments/schema.d.ts +0 -12
- package/dist/types/options/input-options-schema.d.ts +0 -4
- package/dist/types/options/output-options-schema.d.ts +0 -3
- package/dist/types/treeshake/index.d.ts +0 -1
- package/dist/types/utils/zod-ext.d.ts +0 -16
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-qZFfknuJ.cjs');
|
|
2
2
|
const node_buffer = require_chunk.__toESM(require("node:buffer"));
|
|
3
|
-
const zod = require_chunk.__toESM(require("zod"));
|
|
4
3
|
const node_path = require_chunk.__toESM(require("node:path"));
|
|
5
4
|
const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
|
|
6
5
|
const node_os = require_chunk.__toESM(require("node:os"));
|
|
6
|
+
const valibot = require_chunk.__toESM(require("valibot"));
|
|
7
|
+
const node_process = require_chunk.__toESM(require("node:process"));
|
|
8
|
+
const tty = require_chunk.__toESM(require("tty"));
|
|
9
|
+
const __valibot_to_json_schema = require_chunk.__toESM(require("@valibot/to-json-schema"));
|
|
7
10
|
|
|
8
11
|
//#region src/utils/define-config.ts
|
|
9
12
|
function defineConfig(config) {
|
|
@@ -616,9 +619,6 @@ function noop(..._args) {}
|
|
|
616
619
|
|
|
617
620
|
//#endregion
|
|
618
621
|
//#region src/log/logging.ts
|
|
619
|
-
const LogLevelSchema = zod.z.literal("info").or(zod.z.literal("debug")).or(zod.z.literal("warn"));
|
|
620
|
-
const LogLevelOptionSchema = LogLevelSchema.or(zod.z.literal("silent"));
|
|
621
|
-
const LogLevelWithErrorSchema = LogLevelSchema.or(zod.z.literal("error"));
|
|
622
622
|
const LOG_LEVEL_SILENT = "silent";
|
|
623
623
|
const LOG_LEVEL_ERROR = "error";
|
|
624
624
|
const LOG_LEVEL_WARN = "warn";
|
|
@@ -630,8 +630,6 @@ const logLevelPriority = {
|
|
|
630
630
|
[LOG_LEVEL_WARN]: 2,
|
|
631
631
|
[LOG_LEVEL_SILENT]: 3
|
|
632
632
|
};
|
|
633
|
-
const RollupLogSchema = zod.z.any();
|
|
634
|
-
const RollupLogWithStringSchema = RollupLogSchema.or(zod.z.string());
|
|
635
633
|
|
|
636
634
|
//#endregion
|
|
637
635
|
//#region src/utils/code-frame.ts
|
|
@@ -1139,21 +1137,6 @@ function getSortedPlugins(hookName, plugins) {
|
|
|
1139
1137
|
];
|
|
1140
1138
|
}
|
|
1141
1139
|
|
|
1142
|
-
//#endregion
|
|
1143
|
-
//#region src/treeshake/module-side-effects.ts
|
|
1144
|
-
const ModuleSideEffectsRuleSchema = zod.z.object({
|
|
1145
|
-
test: zod.z.instanceof(RegExp).optional(),
|
|
1146
|
-
external: zod.z.boolean().optional(),
|
|
1147
|
-
sideEffects: zod.z.boolean()
|
|
1148
|
-
}).refine((data) => {
|
|
1149
|
-
return data.test !== undefined || data.external !== undefined;
|
|
1150
|
-
}, "Either `test` or `external` should be set.");
|
|
1151
|
-
const ModuleSideEffectsOptionSchema = zod.z.boolean().or(zod.z.array(ModuleSideEffectsRuleSchema)).or(zod.z.function().args(zod.z.string(), zod.z.boolean()).returns(zod.z.boolean().optional())).or(zod.z.literal("no-external"));
|
|
1152
|
-
const TreeshakingOptionsSchema = zod.z.object({
|
|
1153
|
-
moduleSideEffects: ModuleSideEffectsOptionSchema.optional(),
|
|
1154
|
-
annotations: zod.z.boolean().optional()
|
|
1155
|
-
}).passthrough().or(zod.z.boolean());
|
|
1156
|
-
|
|
1157
1140
|
//#endregion
|
|
1158
1141
|
//#region src/utils/transform-sourcemap.ts
|
|
1159
1142
|
function isEmptySourcemapFiled(array) {
|
|
@@ -2634,12 +2617,345 @@ else resolve();
|
|
|
2634
2617
|
}
|
|
2635
2618
|
}
|
|
2636
2619
|
|
|
2620
|
+
//#endregion
|
|
2621
|
+
//#region ../../node_modules/.pnpm/colorette@2.0.20/node_modules/colorette/index.js
|
|
2622
|
+
const { env: env$1 = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
|
|
2623
|
+
const isDisabled = "NO_COLOR" in env$1 || argv.includes("--no-color");
|
|
2624
|
+
const isForced = "FORCE_COLOR" in env$1 || argv.includes("--color");
|
|
2625
|
+
const isWindows = platform === "win32";
|
|
2626
|
+
const isDumbTerminal = env$1.TERM === "dumb";
|
|
2627
|
+
const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env$1.TERM && !isDumbTerminal;
|
|
2628
|
+
const isCI = "CI" in env$1 && ("GITHUB_ACTIONS" in env$1 || "GITLAB_CI" in env$1 || "CIRCLECI" in env$1);
|
|
2629
|
+
const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
2630
|
+
const replaceClose = (index, string, close, replace, head = string.substring(0, index) + replace, tail = string.substring(index + close.length), next = tail.indexOf(close)) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
2631
|
+
const clearBleed = (index, string, open, close, replace) => index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
2632
|
+
const filterEmpty = (open, close, replace = open, at = open.length + 1) => (string) => string || !(string === "" || string === undefined) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
|
|
2633
|
+
const init = (open, close, replace) => filterEmpty(`\x1b[${open}m`, `\x1b[${close}m`, replace);
|
|
2634
|
+
const colors$1 = {
|
|
2635
|
+
reset: init(0, 0),
|
|
2636
|
+
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
2637
|
+
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
2638
|
+
italic: init(3, 23),
|
|
2639
|
+
underline: init(4, 24),
|
|
2640
|
+
inverse: init(7, 27),
|
|
2641
|
+
hidden: init(8, 28),
|
|
2642
|
+
strikethrough: init(9, 29),
|
|
2643
|
+
black: init(30, 39),
|
|
2644
|
+
red: init(31, 39),
|
|
2645
|
+
green: init(32, 39),
|
|
2646
|
+
yellow: init(33, 39),
|
|
2647
|
+
blue: init(34, 39),
|
|
2648
|
+
magenta: init(35, 39),
|
|
2649
|
+
cyan: init(36, 39),
|
|
2650
|
+
white: init(37, 39),
|
|
2651
|
+
gray: init(90, 39),
|
|
2652
|
+
bgBlack: init(40, 49),
|
|
2653
|
+
bgRed: init(41, 49),
|
|
2654
|
+
bgGreen: init(42, 49),
|
|
2655
|
+
bgYellow: init(43, 49),
|
|
2656
|
+
bgBlue: init(44, 49),
|
|
2657
|
+
bgMagenta: init(45, 49),
|
|
2658
|
+
bgCyan: init(46, 49),
|
|
2659
|
+
bgWhite: init(47, 49),
|
|
2660
|
+
blackBright: init(90, 39),
|
|
2661
|
+
redBright: init(91, 39),
|
|
2662
|
+
greenBright: init(92, 39),
|
|
2663
|
+
yellowBright: init(93, 39),
|
|
2664
|
+
blueBright: init(94, 39),
|
|
2665
|
+
magentaBright: init(95, 39),
|
|
2666
|
+
cyanBright: init(96, 39),
|
|
2667
|
+
whiteBright: init(97, 39),
|
|
2668
|
+
bgBlackBright: init(100, 49),
|
|
2669
|
+
bgRedBright: init(101, 49),
|
|
2670
|
+
bgGreenBright: init(102, 49),
|
|
2671
|
+
bgYellowBright: init(103, 49),
|
|
2672
|
+
bgBlueBright: init(104, 49),
|
|
2673
|
+
bgMagentaBright: init(105, 49),
|
|
2674
|
+
bgCyanBright: init(106, 49),
|
|
2675
|
+
bgWhiteBright: init(107, 49)
|
|
2676
|
+
};
|
|
2677
|
+
const createColors = ({ useColor = isColorSupported } = {}) => useColor ? colors$1 : Object.keys(colors$1).reduce((colors$2, key) => ({
|
|
2678
|
+
...colors$2,
|
|
2679
|
+
[key]: String
|
|
2680
|
+
}), {});
|
|
2681
|
+
const { reset, bold: bold$1, dim: dim$1, italic, underline: underline$1, inverse, hidden, strikethrough, black, red: red$1, green: green$1, yellow: yellow$1, blue, magenta, cyan: cyan$1, white, gray: gray$1, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = createColors();
|
|
2682
|
+
|
|
2683
|
+
//#endregion
|
|
2684
|
+
//#region src/cli/colors.ts
|
|
2685
|
+
const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({ useColor: node_process.env.FORCE_COLOR !== "0" && !node_process.env.NO_COLOR });
|
|
2686
|
+
const colors = {
|
|
2687
|
+
bold,
|
|
2688
|
+
cyan,
|
|
2689
|
+
dim,
|
|
2690
|
+
gray,
|
|
2691
|
+
green,
|
|
2692
|
+
red,
|
|
2693
|
+
underline,
|
|
2694
|
+
yellow
|
|
2695
|
+
};
|
|
2696
|
+
|
|
2697
|
+
//#endregion
|
|
2698
|
+
//#region src/utils/validator.ts
|
|
2699
|
+
const StringOrRegExpSchema = valibot.union([valibot.string(), valibot.instance(RegExp)]);
|
|
2700
|
+
const LogLevelSchema = valibot.union([
|
|
2701
|
+
valibot.literal("debug"),
|
|
2702
|
+
valibot.literal("info"),
|
|
2703
|
+
valibot.literal("warn")
|
|
2704
|
+
]);
|
|
2705
|
+
const LogLevelOptionSchema = valibot.union([LogLevelSchema, valibot.literal("silent")]);
|
|
2706
|
+
const LogLevelWithErrorSchema = valibot.union([LogLevelSchema, valibot.literal("error")]);
|
|
2707
|
+
const RollupLogSchema = valibot.any();
|
|
2708
|
+
const RollupLogWithStringSchema = valibot.union([RollupLogSchema, valibot.string()]);
|
|
2709
|
+
const InputOptionSchema = valibot.union([
|
|
2710
|
+
valibot.string(),
|
|
2711
|
+
valibot.array(valibot.string()),
|
|
2712
|
+
valibot.record(valibot.string(), valibot.string())
|
|
2713
|
+
]);
|
|
2714
|
+
const ExternalSchema = valibot.union([
|
|
2715
|
+
StringOrRegExpSchema,
|
|
2716
|
+
valibot.array(StringOrRegExpSchema),
|
|
2717
|
+
valibot.pipe(valibot.function(), valibot.args(valibot.tuple([
|
|
2718
|
+
valibot.string(),
|
|
2719
|
+
valibot.optional(valibot.string()),
|
|
2720
|
+
valibot.boolean()
|
|
2721
|
+
])), valibot.returns(valibot.nullish(valibot.boolean())))
|
|
2722
|
+
]);
|
|
2723
|
+
const ModuleTypesSchema = valibot.record(valibot.string(), valibot.union([
|
|
2724
|
+
valibot.literal("base64"),
|
|
2725
|
+
valibot.literal("binary"),
|
|
2726
|
+
valibot.literal("css"),
|
|
2727
|
+
valibot.literal("dataurl"),
|
|
2728
|
+
valibot.literal("empty"),
|
|
2729
|
+
valibot.literal("js"),
|
|
2730
|
+
valibot.literal("json"),
|
|
2731
|
+
valibot.literal("jsx"),
|
|
2732
|
+
valibot.literal("text"),
|
|
2733
|
+
valibot.literal("ts"),
|
|
2734
|
+
valibot.literal("tsx")
|
|
2735
|
+
]));
|
|
2736
|
+
const JsxOptionsSchema = valibot.strictObject({
|
|
2737
|
+
development: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Development specific information")),
|
|
2738
|
+
factory: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Jsx element transformation")),
|
|
2739
|
+
fragment: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Jsx fragment transformation")),
|
|
2740
|
+
importSource: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Import the factory of element and fragment if mode is classic")),
|
|
2741
|
+
jsxImportSource: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Import the factory of element and fragment if mode is automatic")),
|
|
2742
|
+
mode: valibot.pipe(valibot.optional(valibot.union([valibot.literal("classic"), valibot.literal("automatic")])), valibot.description("Jsx transformation mode")),
|
|
2743
|
+
refresh: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("React refresh transformation"))
|
|
2744
|
+
});
|
|
2745
|
+
const WatchOptionsSchema = valibot.strictObject({
|
|
2746
|
+
chokidar: valibot.optional(valibot.any()),
|
|
2747
|
+
exclude: valibot.optional(valibot.union([StringOrRegExpSchema, valibot.array(StringOrRegExpSchema)])),
|
|
2748
|
+
include: valibot.optional(valibot.union([StringOrRegExpSchema, valibot.array(StringOrRegExpSchema)])),
|
|
2749
|
+
notify: valibot.pipe(valibot.optional(valibot.strictObject({
|
|
2750
|
+
compareContents: valibot.optional(valibot.boolean()),
|
|
2751
|
+
pollInterval: valibot.optional(valibot.number())
|
|
2752
|
+
})), valibot.description("Notify options")),
|
|
2753
|
+
skipWrite: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Skip the bundle.write() step"))
|
|
2754
|
+
});
|
|
2755
|
+
const ChecksOptionsSchema = valibot.strictObject({ circularDependency: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Wether to emit warnings when detecting circular dependencies")) });
|
|
2756
|
+
const ResolveOptionsSchema = valibot.strictObject({
|
|
2757
|
+
alias: valibot.optional(valibot.record(valibot.string(), valibot.union([valibot.string(), valibot.array(valibot.string())]))),
|
|
2758
|
+
aliasFields: valibot.optional(valibot.array(valibot.array(valibot.string()))),
|
|
2759
|
+
conditionNames: valibot.optional(valibot.array(valibot.string())),
|
|
2760
|
+
extensionAlias: valibot.optional(valibot.record(valibot.string(), valibot.array(valibot.string()))),
|
|
2761
|
+
exportsFields: valibot.optional(valibot.array(valibot.array(valibot.string()))),
|
|
2762
|
+
extensions: valibot.optional(valibot.array(valibot.string())),
|
|
2763
|
+
mainFields: valibot.optional(valibot.array(valibot.string())),
|
|
2764
|
+
mainFiles: valibot.optional(valibot.array(valibot.string())),
|
|
2765
|
+
modules: valibot.optional(valibot.array(valibot.string())),
|
|
2766
|
+
symlinks: valibot.optional(valibot.boolean()),
|
|
2767
|
+
tsconfigFilename: valibot.optional(valibot.string())
|
|
2768
|
+
});
|
|
2769
|
+
const TreeshakingOptionsSchema = valibot.union([valibot.boolean(), valibot.looseObject({ annotations: valibot.optional(valibot.boolean()) })]);
|
|
2770
|
+
const OnLogSchema = valibot.pipe(valibot.function(), valibot.args(valibot.tuple([
|
|
2771
|
+
LogLevelSchema,
|
|
2772
|
+
RollupLogSchema,
|
|
2773
|
+
valibot.pipe(valibot.function(), valibot.args(valibot.tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
|
|
2774
|
+
])));
|
|
2775
|
+
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))])])))])));
|
|
2776
|
+
const InputOptionsSchema = valibot.strictObject({
|
|
2777
|
+
input: valibot.optional(InputOptionSchema),
|
|
2778
|
+
plugins: valibot.optional(valibot.custom(() => true)),
|
|
2779
|
+
external: valibot.optional(ExternalSchema),
|
|
2780
|
+
resolve: valibot.optional(ResolveOptionsSchema),
|
|
2781
|
+
cwd: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Current working directory")),
|
|
2782
|
+
platform: valibot.pipe(valibot.optional(valibot.union([
|
|
2783
|
+
valibot.literal("browser"),
|
|
2784
|
+
valibot.literal("neutral"),
|
|
2785
|
+
valibot.literal("node")
|
|
2786
|
+
])), valibot.description(`Platform for which the code should be generated (node, ${colors.underline("browser")}, neutral)`)),
|
|
2787
|
+
shimMissingExports: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Create shim variables for missing exports")),
|
|
2788
|
+
treeshake: valibot.optional(TreeshakingOptionsSchema),
|
|
2789
|
+
logLevel: valibot.pipe(valibot.optional(LogLevelOptionSchema), valibot.description(`Log level (${colors.dim("silent")}, ${colors.underline(colors.gray("info"))}, debug, ${colors.yellow("warn")})`)),
|
|
2790
|
+
onLog: valibot.optional(OnLogSchema),
|
|
2791
|
+
onwarn: valibot.optional(OnwarnSchema),
|
|
2792
|
+
moduleTypes: valibot.pipe(valibot.optional(ModuleTypesSchema), valibot.description("Module types for customized extensions")),
|
|
2793
|
+
experimental: valibot.optional(valibot.strictObject({
|
|
2794
|
+
disableLiveBindings: valibot.optional(valibot.boolean()),
|
|
2795
|
+
enableComposingJsPlugins: valibot.optional(valibot.boolean()),
|
|
2796
|
+
resolveNewUrlToAsset: valibot.optional(valibot.boolean()),
|
|
2797
|
+
strictExecutionOrder: valibot.optional(valibot.boolean())
|
|
2798
|
+
})),
|
|
2799
|
+
define: valibot.pipe(valibot.optional(valibot.record(valibot.string(), valibot.string())), valibot.description("Define global variables")),
|
|
2800
|
+
inject: valibot.optional(valibot.record(valibot.string(), valibot.union([valibot.string(), valibot.tuple([valibot.string(), valibot.string()])]))),
|
|
2801
|
+
profilerNames: valibot.optional(valibot.boolean()),
|
|
2802
|
+
jsx: valibot.optional(JsxOptionsSchema),
|
|
2803
|
+
watch: valibot.optional(valibot.union([WatchOptionsSchema, valibot.literal(false)])),
|
|
2804
|
+
dropLabels: valibot.pipe(valibot.optional(valibot.array(valibot.string())), valibot.description("Remove labeled statements with these label names")),
|
|
2805
|
+
checks: valibot.optional(ChecksOptionsSchema)
|
|
2806
|
+
});
|
|
2807
|
+
const InputCliOverrideSchema = valibot.strictObject({
|
|
2808
|
+
external: valibot.pipe(valibot.optional(valibot.array(valibot.string())), valibot.description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
|
|
2809
|
+
inject: valibot.pipe(valibot.optional(valibot.record(valibot.string(), valibot.string())), valibot.description("Inject import statements on demand")),
|
|
2810
|
+
treeshake: valibot.pipe(valibot.optional(valibot.boolean(), true), valibot.description("enable treeshaking"))
|
|
2811
|
+
});
|
|
2812
|
+
const InputCliOptionsSchema = valibot.omit(valibot.strictObject({
|
|
2813
|
+
...InputOptionsSchema.entries,
|
|
2814
|
+
...InputCliOverrideSchema.entries
|
|
2815
|
+
}), [
|
|
2816
|
+
"input",
|
|
2817
|
+
"plugins",
|
|
2818
|
+
"onwarn",
|
|
2819
|
+
"onLog",
|
|
2820
|
+
"resolve",
|
|
2821
|
+
"experimental",
|
|
2822
|
+
"profilerNames",
|
|
2823
|
+
"watch"
|
|
2824
|
+
]);
|
|
2825
|
+
var ESTarget = function(ESTarget$1) {
|
|
2826
|
+
ESTarget$1["ES6"] = "es6";
|
|
2827
|
+
ESTarget$1["ES2015"] = "es2015";
|
|
2828
|
+
ESTarget$1["ES2016"] = "es2016";
|
|
2829
|
+
ESTarget$1["ES2017"] = "es2017";
|
|
2830
|
+
ESTarget$1["ES2018"] = "es2018";
|
|
2831
|
+
ESTarget$1["ES2019"] = "es2019";
|
|
2832
|
+
ESTarget$1["ES2020"] = "es2020";
|
|
2833
|
+
ESTarget$1["ES2021"] = "es2021";
|
|
2834
|
+
ESTarget$1["ES2022"] = "es2022";
|
|
2835
|
+
ESTarget$1["ES2023"] = "es2023";
|
|
2836
|
+
ESTarget$1["ES2024"] = "es2024";
|
|
2837
|
+
ESTarget$1["ESNext"] = "esnext";
|
|
2838
|
+
return ESTarget$1;
|
|
2839
|
+
}(ESTarget || {});
|
|
2840
|
+
const ModuleFormatSchema = valibot.union([
|
|
2841
|
+
valibot.literal("es"),
|
|
2842
|
+
valibot.literal("cjs"),
|
|
2843
|
+
valibot.literal("esm"),
|
|
2844
|
+
valibot.literal("module"),
|
|
2845
|
+
valibot.literal("commonjs"),
|
|
2846
|
+
valibot.literal("iife"),
|
|
2847
|
+
valibot.literal("umd")
|
|
2848
|
+
]);
|
|
2849
|
+
const AddonFunctionSchema = valibot.pipe(valibot.function(), valibot.args(valibot.tuple([valibot.custom(() => true)])), valibot.returnsAsync(valibot.unionAsync([valibot.string(), valibot.pipeAsync(valibot.promise(), valibot.awaitAsync(), valibot.string())])));
|
|
2850
|
+
const ChunkFileNamesSchema = valibot.union([valibot.string(), valibot.pipe(valibot.function(), valibot.args(valibot.tuple([valibot.custom(() => true)])), valibot.returns(valibot.string()))]);
|
|
2851
|
+
const GlobalsFunctionSchema = valibot.pipe(valibot.function(), valibot.args(valibot.tuple([valibot.string()])), valibot.returns(valibot.string()));
|
|
2852
|
+
const AdvancedChunksSchema = valibot.strictObject({
|
|
2853
|
+
minSize: valibot.optional(valibot.number()),
|
|
2854
|
+
minShareCount: valibot.optional(valibot.number()),
|
|
2855
|
+
groups: valibot.optional(valibot.array(valibot.strictObject({
|
|
2856
|
+
name: valibot.string(),
|
|
2857
|
+
test: valibot.optional(valibot.union([valibot.string(), valibot.instance(RegExp)])),
|
|
2858
|
+
priority: valibot.optional(valibot.number()),
|
|
2859
|
+
minSize: valibot.optional(valibot.number()),
|
|
2860
|
+
minShareCount: valibot.optional(valibot.number())
|
|
2861
|
+
})))
|
|
2862
|
+
});
|
|
2863
|
+
const OutputOptionsSchema = valibot.strictObject({
|
|
2864
|
+
dir: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Output directory, defaults to `dist` if `file` is not set")),
|
|
2865
|
+
file: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Single output file")),
|
|
2866
|
+
exports: valibot.pipe(valibot.optional(valibot.union([
|
|
2867
|
+
valibot.literal("auto"),
|
|
2868
|
+
valibot.literal("named"),
|
|
2869
|
+
valibot.literal("default"),
|
|
2870
|
+
valibot.literal("none")
|
|
2871
|
+
])), valibot.description(`Specify a export mode (${colors.underline("auto")}, named, default, none)`)),
|
|
2872
|
+
hashCharacters: valibot.pipe(valibot.optional(valibot.union([
|
|
2873
|
+
valibot.literal("base64"),
|
|
2874
|
+
valibot.literal("base36"),
|
|
2875
|
+
valibot.literal("hex")
|
|
2876
|
+
])), valibot.description("Use the specified character set for file hashes")),
|
|
2877
|
+
format: valibot.pipe(valibot.optional(ModuleFormatSchema), valibot.description(`Output format of the generated bundle (supports ${colors.underline("esm")}, cjs, and iife)`)),
|
|
2878
|
+
sourcemap: valibot.pipe(valibot.optional(valibot.union([
|
|
2879
|
+
valibot.boolean(),
|
|
2880
|
+
valibot.literal("inline"),
|
|
2881
|
+
valibot.literal("hidden")
|
|
2882
|
+
])), valibot.description(`Generate sourcemap (\`-s inline\` for inline, or ${colors.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
2883
|
+
sourcemapIgnoreList: valibot.optional(valibot.union([valibot.boolean(), valibot.custom(() => true)])),
|
|
2884
|
+
sourcemapPathTransform: valibot.optional(valibot.custom(() => true)),
|
|
2885
|
+
banner: valibot.optional(valibot.union([valibot.string(), AddonFunctionSchema])),
|
|
2886
|
+
footer: valibot.optional(valibot.union([valibot.string(), AddonFunctionSchema])),
|
|
2887
|
+
intro: valibot.optional(valibot.union([valibot.string(), AddonFunctionSchema])),
|
|
2888
|
+
outro: valibot.optional(valibot.union([valibot.string(), AddonFunctionSchema])),
|
|
2889
|
+
extend: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Extend global variable defined by name in IIFE / UMD formats")),
|
|
2890
|
+
esModule: valibot.optional(valibot.union([valibot.boolean(), valibot.literal("if-default-prop")])),
|
|
2891
|
+
assetFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for asset files")),
|
|
2892
|
+
entryFileNames: valibot.optional(ChunkFileNamesSchema),
|
|
2893
|
+
chunkFileNames: valibot.optional(ChunkFileNamesSchema),
|
|
2894
|
+
cssEntryFileNames: valibot.optional(ChunkFileNamesSchema),
|
|
2895
|
+
cssChunkFileNames: valibot.optional(ChunkFileNamesSchema),
|
|
2896
|
+
minify: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Minify the bundled file")),
|
|
2897
|
+
name: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name for UMD / IIFE format outputs")),
|
|
2898
|
+
globals: valibot.pipe(valibot.optional(valibot.union([valibot.record(valibot.string(), valibot.string()), GlobalsFunctionSchema])), valibot.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2899
|
+
externalLiveBindings: valibot.pipe(valibot.optional(valibot.boolean(), true), valibot.description("external live bindings")),
|
|
2900
|
+
inlineDynamicImports: valibot.pipe(valibot.optional(valibot.boolean(), false), valibot.description("Inline dynamic imports")),
|
|
2901
|
+
advancedChunks: valibot.optional(AdvancedChunksSchema),
|
|
2902
|
+
comments: valibot.pipe(valibot.optional(valibot.union([valibot.literal("none"), valibot.literal("preserve-legal")])), valibot.description("Control comments in the output")),
|
|
2903
|
+
target: valibot.pipe(valibot.optional(valibot.enum(ESTarget)), valibot.description("The JavaScript target environment"))
|
|
2904
|
+
});
|
|
2905
|
+
const getAddonDescription = (placement, wrapper) => {
|
|
2906
|
+
return `Code to insert the ${colors.bold(placement)} of the bundled file (${colors.bold(wrapper)} the wrapper function)`;
|
|
2907
|
+
};
|
|
2908
|
+
const OutputCliOverrideSchema = valibot.strictObject({
|
|
2909
|
+
entryFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for emitted entry chunks")),
|
|
2910
|
+
chunkFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for emitted secondary chunks")),
|
|
2911
|
+
cssEntryFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for emitted css entry chunks")),
|
|
2912
|
+
cssChunkFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for emitted css secondary chunks")),
|
|
2913
|
+
banner: valibot.pipe(valibot.optional(valibot.string()), valibot.description(getAddonDescription("top", "outside"))),
|
|
2914
|
+
footer: valibot.pipe(valibot.optional(valibot.string()), valibot.description(getAddonDescription("bottom", "outside"))),
|
|
2915
|
+
intro: valibot.pipe(valibot.optional(valibot.string()), valibot.description(getAddonDescription("top", "inside"))),
|
|
2916
|
+
outro: valibot.pipe(valibot.optional(valibot.string()), valibot.description(getAddonDescription("bottom", "inside"))),
|
|
2917
|
+
esModule: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
|
|
2918
|
+
globals: valibot.pipe(valibot.optional(valibot.record(valibot.string(), valibot.string())), valibot.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2919
|
+
advancedChunks: valibot.pipe(valibot.optional(valibot.strictObject({
|
|
2920
|
+
minSize: valibot.pipe(valibot.optional(valibot.number()), valibot.description("Minimum size of the chunk")),
|
|
2921
|
+
minShareCount: valibot.pipe(valibot.optional(valibot.number()), valibot.description("Minimum share count of the chunk"))
|
|
2922
|
+
})), valibot.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)"))
|
|
2923
|
+
});
|
|
2924
|
+
const OutputCliOptionsSchema = valibot.omit(valibot.strictObject({
|
|
2925
|
+
...OutputOptionsSchema.entries,
|
|
2926
|
+
...OutputCliOverrideSchema.entries
|
|
2927
|
+
}), ["sourcemapIgnoreList", "sourcemapPathTransform"]);
|
|
2928
|
+
const CliOptionsSchema = valibot.strictObject({
|
|
2929
|
+
config: valibot.pipe(valibot.optional(valibot.union([valibot.string(), valibot.boolean()])), valibot.description("Path to the config file (default: `rolldown.config.js`)")),
|
|
2930
|
+
help: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Show help")),
|
|
2931
|
+
version: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Show version number")),
|
|
2932
|
+
watch: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Watch files in bundle and rebuild on changes")),
|
|
2933
|
+
...InputCliOptionsSchema.entries,
|
|
2934
|
+
...OutputCliOptionsSchema.entries
|
|
2935
|
+
});
|
|
2936
|
+
function validateTreeShakingOptions(options) {
|
|
2937
|
+
valibot.parse(TreeshakingOptionsSchema, options);
|
|
2938
|
+
}
|
|
2939
|
+
function validateCliOptions(options) {
|
|
2940
|
+
let parsed = valibot.safeParse(CliOptionsSchema, options);
|
|
2941
|
+
return [parsed.output, parsed.issues?.map((issue) => issue.path?.join(", ")).filter((v) => v !== undefined)];
|
|
2942
|
+
}
|
|
2943
|
+
function getInputCliKeys() {
|
|
2944
|
+
return valibot.keyof(InputCliOptionsSchema).options;
|
|
2945
|
+
}
|
|
2946
|
+
function getOutputCliKeys() {
|
|
2947
|
+
return valibot.keyof(OutputCliOptionsSchema).options;
|
|
2948
|
+
}
|
|
2949
|
+
function getJsonSchema() {
|
|
2950
|
+
return (0, __valibot_to_json_schema.toJsonSchema)(CliOptionsSchema);
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2637
2953
|
//#endregion
|
|
2638
2954
|
//#region src/utils/create-bundler-option.ts
|
|
2639
2955
|
async function createBundlerOptions(inputOptions, outputOptions) {
|
|
2640
2956
|
const pluginDriver = new PluginDriver();
|
|
2641
2957
|
inputOptions = await pluginDriver.callOptionsHook(inputOptions);
|
|
2642
|
-
if (inputOptions.treeshake !== undefined)
|
|
2958
|
+
if (inputOptions.treeshake !== undefined) validateTreeShakingOptions(inputOptions.treeshake);
|
|
2643
2959
|
const inputPlugins = await normalizePluginOption(inputOptions.plugins);
|
|
2644
2960
|
const outputPlugins = await normalizePluginOption(outputOptions.plugins);
|
|
2645
2961
|
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
@@ -2848,7 +3164,7 @@ const watch = (input) => {
|
|
|
2848
3164
|
|
|
2849
3165
|
//#endregion
|
|
2850
3166
|
//#region package.json
|
|
2851
|
-
var version = "1.0.0-beta.1-commit.
|
|
3167
|
+
var version = "1.0.0-beta.1-commit.3484a68";
|
|
2852
3168
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
2853
3169
|
|
|
2854
3170
|
//#endregion
|
|
@@ -2878,48 +3194,12 @@ Object.defineProperty(exports, 'BuiltinPlugin', {
|
|
|
2878
3194
|
return BuiltinPlugin;
|
|
2879
3195
|
}
|
|
2880
3196
|
});
|
|
2881
|
-
Object.defineProperty(exports, 'LogLevelOptionSchema', {
|
|
2882
|
-
enumerable: true,
|
|
2883
|
-
get: function () {
|
|
2884
|
-
return LogLevelOptionSchema;
|
|
2885
|
-
}
|
|
2886
|
-
});
|
|
2887
|
-
Object.defineProperty(exports, 'LogLevelSchema', {
|
|
2888
|
-
enumerable: true,
|
|
2889
|
-
get: function () {
|
|
2890
|
-
return LogLevelSchema;
|
|
2891
|
-
}
|
|
2892
|
-
});
|
|
2893
|
-
Object.defineProperty(exports, 'LogLevelWithErrorSchema', {
|
|
2894
|
-
enumerable: true,
|
|
2895
|
-
get: function () {
|
|
2896
|
-
return LogLevelWithErrorSchema;
|
|
2897
|
-
}
|
|
2898
|
-
});
|
|
2899
3197
|
Object.defineProperty(exports, 'PluginContextData', {
|
|
2900
3198
|
enumerable: true,
|
|
2901
3199
|
get: function () {
|
|
2902
3200
|
return PluginContextData;
|
|
2903
3201
|
}
|
|
2904
3202
|
});
|
|
2905
|
-
Object.defineProperty(exports, 'RollupLogSchema', {
|
|
2906
|
-
enumerable: true,
|
|
2907
|
-
get: function () {
|
|
2908
|
-
return RollupLogSchema;
|
|
2909
|
-
}
|
|
2910
|
-
});
|
|
2911
|
-
Object.defineProperty(exports, 'RollupLogWithStringSchema', {
|
|
2912
|
-
enumerable: true,
|
|
2913
|
-
get: function () {
|
|
2914
|
-
return RollupLogWithStringSchema;
|
|
2915
|
-
}
|
|
2916
|
-
});
|
|
2917
|
-
Object.defineProperty(exports, 'TreeshakingOptionsSchema', {
|
|
2918
|
-
enumerable: true,
|
|
2919
|
-
get: function () {
|
|
2920
|
-
return TreeshakingOptionsSchema;
|
|
2921
|
-
}
|
|
2922
|
-
});
|
|
2923
3203
|
Object.defineProperty(exports, 'VERSION', {
|
|
2924
3204
|
enumerable: true,
|
|
2925
3205
|
get: function () {
|
|
@@ -2950,6 +3230,12 @@ Object.defineProperty(exports, 'buildImportAnalysisPlugin', {
|
|
|
2950
3230
|
return buildImportAnalysisPlugin;
|
|
2951
3231
|
}
|
|
2952
3232
|
});
|
|
3233
|
+
Object.defineProperty(exports, 'colors', {
|
|
3234
|
+
enumerable: true,
|
|
3235
|
+
get: function () {
|
|
3236
|
+
return colors;
|
|
3237
|
+
}
|
|
3238
|
+
});
|
|
2953
3239
|
Object.defineProperty(exports, 'composeJsPlugins', {
|
|
2954
3240
|
enumerable: true,
|
|
2955
3241
|
get: function () {
|
|
@@ -2980,6 +3266,24 @@ Object.defineProperty(exports, 'dynamicImportVarsPlugin', {
|
|
|
2980
3266
|
return dynamicImportVarsPlugin;
|
|
2981
3267
|
}
|
|
2982
3268
|
});
|
|
3269
|
+
Object.defineProperty(exports, 'getInputCliKeys', {
|
|
3270
|
+
enumerable: true,
|
|
3271
|
+
get: function () {
|
|
3272
|
+
return getInputCliKeys;
|
|
3273
|
+
}
|
|
3274
|
+
});
|
|
3275
|
+
Object.defineProperty(exports, 'getJsonSchema', {
|
|
3276
|
+
enumerable: true,
|
|
3277
|
+
get: function () {
|
|
3278
|
+
return getJsonSchema;
|
|
3279
|
+
}
|
|
3280
|
+
});
|
|
3281
|
+
Object.defineProperty(exports, 'getOutputCliKeys', {
|
|
3282
|
+
enumerable: true,
|
|
3283
|
+
get: function () {
|
|
3284
|
+
return getOutputCliKeys;
|
|
3285
|
+
}
|
|
3286
|
+
});
|
|
2983
3287
|
Object.defineProperty(exports, 'handleOutputErrors', {
|
|
2984
3288
|
enumerable: true,
|
|
2985
3289
|
get: function () {
|
|
@@ -3034,6 +3338,12 @@ Object.defineProperty(exports, 'rolldown', {
|
|
|
3034
3338
|
return rolldown;
|
|
3035
3339
|
}
|
|
3036
3340
|
});
|
|
3341
|
+
Object.defineProperty(exports, 'validateCliOptions', {
|
|
3342
|
+
enumerable: true,
|
|
3343
|
+
get: function () {
|
|
3344
|
+
return validateCliOptions;
|
|
3345
|
+
}
|
|
3346
|
+
});
|
|
3037
3347
|
Object.defineProperty(exports, 'version', {
|
|
3038
3348
|
enumerable: true,
|
|
3039
3349
|
get: function () {
|