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
|
import { createRequire } from "module";
|
|
2
2
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
3
|
-
import { z } from "zod";
|
|
4
3
|
import path from "node:path";
|
|
5
4
|
import { Worker } from "node:worker_threads";
|
|
6
5
|
import { availableParallelism } from "node:os";
|
|
6
|
+
import * as v from "valibot";
|
|
7
|
+
import { env } from "node:process";
|
|
8
|
+
import * as tty from "tty";
|
|
9
|
+
import { toJsonSchema } from "@valibot/to-json-schema";
|
|
7
10
|
|
|
8
11
|
//#region rolldown:runtime
|
|
9
12
|
var __create = Object.create;
|
|
@@ -642,9 +645,6 @@ function noop(..._args) {}
|
|
|
642
645
|
|
|
643
646
|
//#endregion
|
|
644
647
|
//#region src/log/logging.ts
|
|
645
|
-
const LogLevelSchema = z.literal("info").or(z.literal("debug")).or(z.literal("warn"));
|
|
646
|
-
const LogLevelOptionSchema = LogLevelSchema.or(z.literal("silent"));
|
|
647
|
-
const LogLevelWithErrorSchema = LogLevelSchema.or(z.literal("error"));
|
|
648
648
|
const LOG_LEVEL_SILENT = "silent";
|
|
649
649
|
const LOG_LEVEL_ERROR = "error";
|
|
650
650
|
const LOG_LEVEL_WARN = "warn";
|
|
@@ -656,8 +656,6 @@ const logLevelPriority = {
|
|
|
656
656
|
[LOG_LEVEL_WARN]: 2,
|
|
657
657
|
[LOG_LEVEL_SILENT]: 3
|
|
658
658
|
};
|
|
659
|
-
const RollupLogSchema = z.any();
|
|
660
|
-
const RollupLogWithStringSchema = RollupLogSchema.or(z.string());
|
|
661
659
|
|
|
662
660
|
//#endregion
|
|
663
661
|
//#region src/utils/code-frame.ts
|
|
@@ -1004,7 +1002,7 @@ function viteResolvePlugin(config) {
|
|
|
1004
1002
|
async function asyncFlatten(array) {
|
|
1005
1003
|
do
|
|
1006
1004
|
array = (await Promise.all(array)).flat(Infinity);
|
|
1007
|
-
while (array.some((v) => v?.then));
|
|
1005
|
+
while (array.some((v$1) => v$1?.then));
|
|
1008
1006
|
return array;
|
|
1009
1007
|
}
|
|
1010
1008
|
|
|
@@ -1165,21 +1163,6 @@ function getSortedPlugins(hookName, plugins) {
|
|
|
1165
1163
|
];
|
|
1166
1164
|
}
|
|
1167
1165
|
|
|
1168
|
-
//#endregion
|
|
1169
|
-
//#region src/treeshake/module-side-effects.ts
|
|
1170
|
-
const ModuleSideEffectsRuleSchema = z.object({
|
|
1171
|
-
test: z.instanceof(RegExp).optional(),
|
|
1172
|
-
external: z.boolean().optional(),
|
|
1173
|
-
sideEffects: z.boolean()
|
|
1174
|
-
}).refine((data) => {
|
|
1175
|
-
return data.test !== undefined || data.external !== undefined;
|
|
1176
|
-
}, "Either `test` or `external` should be set.");
|
|
1177
|
-
const ModuleSideEffectsOptionSchema = z.boolean().or(z.array(ModuleSideEffectsRuleSchema)).or(z.function().args(z.string(), z.boolean()).returns(z.boolean().optional())).or(z.literal("no-external"));
|
|
1178
|
-
const TreeshakingOptionsSchema = z.object({
|
|
1179
|
-
moduleSideEffects: ModuleSideEffectsOptionSchema.optional(),
|
|
1180
|
-
annotations: z.boolean().optional()
|
|
1181
|
-
}).passthrough().or(z.boolean());
|
|
1182
|
-
|
|
1183
1166
|
//#endregion
|
|
1184
1167
|
//#region src/utils/transform-sourcemap.ts
|
|
1185
1168
|
function isEmptySourcemapFiled(array) {
|
|
@@ -2660,12 +2643,345 @@ else resolve();
|
|
|
2660
2643
|
}
|
|
2661
2644
|
}
|
|
2662
2645
|
|
|
2646
|
+
//#endregion
|
|
2647
|
+
//#region ../../node_modules/.pnpm/colorette@2.0.20/node_modules/colorette/index.js
|
|
2648
|
+
const { env: env$1 = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
|
|
2649
|
+
const isDisabled = "NO_COLOR" in env$1 || argv.includes("--no-color");
|
|
2650
|
+
const isForced = "FORCE_COLOR" in env$1 || argv.includes("--color");
|
|
2651
|
+
const isWindows = platform === "win32";
|
|
2652
|
+
const isDumbTerminal = env$1.TERM === "dumb";
|
|
2653
|
+
const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env$1.TERM && !isDumbTerminal;
|
|
2654
|
+
const isCI = "CI" in env$1 && ("GITHUB_ACTIONS" in env$1 || "GITLAB_CI" in env$1 || "CIRCLECI" in env$1);
|
|
2655
|
+
const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
2656
|
+
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));
|
|
2657
|
+
const clearBleed = (index, string, open, close, replace) => index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
2658
|
+
const filterEmpty = (open, close, replace = open, at = open.length + 1) => (string) => string || !(string === "" || string === undefined) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
|
|
2659
|
+
const init = (open, close, replace) => filterEmpty(`\x1b[${open}m`, `\x1b[${close}m`, replace);
|
|
2660
|
+
const colors$1 = {
|
|
2661
|
+
reset: init(0, 0),
|
|
2662
|
+
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
2663
|
+
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
2664
|
+
italic: init(3, 23),
|
|
2665
|
+
underline: init(4, 24),
|
|
2666
|
+
inverse: init(7, 27),
|
|
2667
|
+
hidden: init(8, 28),
|
|
2668
|
+
strikethrough: init(9, 29),
|
|
2669
|
+
black: init(30, 39),
|
|
2670
|
+
red: init(31, 39),
|
|
2671
|
+
green: init(32, 39),
|
|
2672
|
+
yellow: init(33, 39),
|
|
2673
|
+
blue: init(34, 39),
|
|
2674
|
+
magenta: init(35, 39),
|
|
2675
|
+
cyan: init(36, 39),
|
|
2676
|
+
white: init(37, 39),
|
|
2677
|
+
gray: init(90, 39),
|
|
2678
|
+
bgBlack: init(40, 49),
|
|
2679
|
+
bgRed: init(41, 49),
|
|
2680
|
+
bgGreen: init(42, 49),
|
|
2681
|
+
bgYellow: init(43, 49),
|
|
2682
|
+
bgBlue: init(44, 49),
|
|
2683
|
+
bgMagenta: init(45, 49),
|
|
2684
|
+
bgCyan: init(46, 49),
|
|
2685
|
+
bgWhite: init(47, 49),
|
|
2686
|
+
blackBright: init(90, 39),
|
|
2687
|
+
redBright: init(91, 39),
|
|
2688
|
+
greenBright: init(92, 39),
|
|
2689
|
+
yellowBright: init(93, 39),
|
|
2690
|
+
blueBright: init(94, 39),
|
|
2691
|
+
magentaBright: init(95, 39),
|
|
2692
|
+
cyanBright: init(96, 39),
|
|
2693
|
+
whiteBright: init(97, 39),
|
|
2694
|
+
bgBlackBright: init(100, 49),
|
|
2695
|
+
bgRedBright: init(101, 49),
|
|
2696
|
+
bgGreenBright: init(102, 49),
|
|
2697
|
+
bgYellowBright: init(103, 49),
|
|
2698
|
+
bgBlueBright: init(104, 49),
|
|
2699
|
+
bgMagentaBright: init(105, 49),
|
|
2700
|
+
bgCyanBright: init(106, 49),
|
|
2701
|
+
bgWhiteBright: init(107, 49)
|
|
2702
|
+
};
|
|
2703
|
+
const createColors = ({ useColor = isColorSupported } = {}) => useColor ? colors$1 : Object.keys(colors$1).reduce((colors$2, key) => ({
|
|
2704
|
+
...colors$2,
|
|
2705
|
+
[key]: String
|
|
2706
|
+
}), {});
|
|
2707
|
+
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();
|
|
2708
|
+
|
|
2709
|
+
//#endregion
|
|
2710
|
+
//#region src/cli/colors.ts
|
|
2711
|
+
const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({ useColor: env.FORCE_COLOR !== "0" && !env.NO_COLOR });
|
|
2712
|
+
const colors = {
|
|
2713
|
+
bold,
|
|
2714
|
+
cyan,
|
|
2715
|
+
dim,
|
|
2716
|
+
gray,
|
|
2717
|
+
green,
|
|
2718
|
+
red,
|
|
2719
|
+
underline,
|
|
2720
|
+
yellow
|
|
2721
|
+
};
|
|
2722
|
+
|
|
2723
|
+
//#endregion
|
|
2724
|
+
//#region src/utils/validator.ts
|
|
2725
|
+
const StringOrRegExpSchema = v.union([v.string(), v.instance(RegExp)]);
|
|
2726
|
+
const LogLevelSchema = v.union([
|
|
2727
|
+
v.literal("debug"),
|
|
2728
|
+
v.literal("info"),
|
|
2729
|
+
v.literal("warn")
|
|
2730
|
+
]);
|
|
2731
|
+
const LogLevelOptionSchema = v.union([LogLevelSchema, v.literal("silent")]);
|
|
2732
|
+
const LogLevelWithErrorSchema = v.union([LogLevelSchema, v.literal("error")]);
|
|
2733
|
+
const RollupLogSchema = v.any();
|
|
2734
|
+
const RollupLogWithStringSchema = v.union([RollupLogSchema, v.string()]);
|
|
2735
|
+
const InputOptionSchema = v.union([
|
|
2736
|
+
v.string(),
|
|
2737
|
+
v.array(v.string()),
|
|
2738
|
+
v.record(v.string(), v.string())
|
|
2739
|
+
]);
|
|
2740
|
+
const ExternalSchema = v.union([
|
|
2741
|
+
StringOrRegExpSchema,
|
|
2742
|
+
v.array(StringOrRegExpSchema),
|
|
2743
|
+
v.pipe(v.function(), v.args(v.tuple([
|
|
2744
|
+
v.string(),
|
|
2745
|
+
v.optional(v.string()),
|
|
2746
|
+
v.boolean()
|
|
2747
|
+
])), v.returns(v.nullish(v.boolean())))
|
|
2748
|
+
]);
|
|
2749
|
+
const ModuleTypesSchema = v.record(v.string(), v.union([
|
|
2750
|
+
v.literal("base64"),
|
|
2751
|
+
v.literal("binary"),
|
|
2752
|
+
v.literal("css"),
|
|
2753
|
+
v.literal("dataurl"),
|
|
2754
|
+
v.literal("empty"),
|
|
2755
|
+
v.literal("js"),
|
|
2756
|
+
v.literal("json"),
|
|
2757
|
+
v.literal("jsx"),
|
|
2758
|
+
v.literal("text"),
|
|
2759
|
+
v.literal("ts"),
|
|
2760
|
+
v.literal("tsx")
|
|
2761
|
+
]));
|
|
2762
|
+
const JsxOptionsSchema = v.strictObject({
|
|
2763
|
+
development: v.pipe(v.optional(v.boolean()), v.description("Development specific information")),
|
|
2764
|
+
factory: v.pipe(v.optional(v.string()), v.description("Jsx element transformation")),
|
|
2765
|
+
fragment: v.pipe(v.optional(v.string()), v.description("Jsx fragment transformation")),
|
|
2766
|
+
importSource: v.pipe(v.optional(v.string()), v.description("Import the factory of element and fragment if mode is classic")),
|
|
2767
|
+
jsxImportSource: v.pipe(v.optional(v.string()), v.description("Import the factory of element and fragment if mode is automatic")),
|
|
2768
|
+
mode: v.pipe(v.optional(v.union([v.literal("classic"), v.literal("automatic")])), v.description("Jsx transformation mode")),
|
|
2769
|
+
refresh: v.pipe(v.optional(v.boolean()), v.description("React refresh transformation"))
|
|
2770
|
+
});
|
|
2771
|
+
const WatchOptionsSchema = v.strictObject({
|
|
2772
|
+
chokidar: v.optional(v.any()),
|
|
2773
|
+
exclude: v.optional(v.union([StringOrRegExpSchema, v.array(StringOrRegExpSchema)])),
|
|
2774
|
+
include: v.optional(v.union([StringOrRegExpSchema, v.array(StringOrRegExpSchema)])),
|
|
2775
|
+
notify: v.pipe(v.optional(v.strictObject({
|
|
2776
|
+
compareContents: v.optional(v.boolean()),
|
|
2777
|
+
pollInterval: v.optional(v.number())
|
|
2778
|
+
})), v.description("Notify options")),
|
|
2779
|
+
skipWrite: v.pipe(v.optional(v.boolean()), v.description("Skip the bundle.write() step"))
|
|
2780
|
+
});
|
|
2781
|
+
const ChecksOptionsSchema = v.strictObject({ circularDependency: v.pipe(v.optional(v.boolean()), v.description("Wether to emit warnings when detecting circular dependencies")) });
|
|
2782
|
+
const ResolveOptionsSchema = v.strictObject({
|
|
2783
|
+
alias: v.optional(v.record(v.string(), v.union([v.string(), v.array(v.string())]))),
|
|
2784
|
+
aliasFields: v.optional(v.array(v.array(v.string()))),
|
|
2785
|
+
conditionNames: v.optional(v.array(v.string())),
|
|
2786
|
+
extensionAlias: v.optional(v.record(v.string(), v.array(v.string()))),
|
|
2787
|
+
exportsFields: v.optional(v.array(v.array(v.string()))),
|
|
2788
|
+
extensions: v.optional(v.array(v.string())),
|
|
2789
|
+
mainFields: v.optional(v.array(v.string())),
|
|
2790
|
+
mainFiles: v.optional(v.array(v.string())),
|
|
2791
|
+
modules: v.optional(v.array(v.string())),
|
|
2792
|
+
symlinks: v.optional(v.boolean()),
|
|
2793
|
+
tsconfigFilename: v.optional(v.string())
|
|
2794
|
+
});
|
|
2795
|
+
const TreeshakingOptionsSchema = v.union([v.boolean(), v.looseObject({ annotations: v.optional(v.boolean()) })]);
|
|
2796
|
+
const OnLogSchema = v.pipe(v.function(), v.args(v.tuple([
|
|
2797
|
+
LogLevelSchema,
|
|
2798
|
+
RollupLogSchema,
|
|
2799
|
+
v.pipe(v.function(), v.args(v.tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
|
|
2800
|
+
])));
|
|
2801
|
+
const 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))])])))])));
|
|
2802
|
+
const InputOptionsSchema = v.strictObject({
|
|
2803
|
+
input: v.optional(InputOptionSchema),
|
|
2804
|
+
plugins: v.optional(v.custom(() => true)),
|
|
2805
|
+
external: v.optional(ExternalSchema),
|
|
2806
|
+
resolve: v.optional(ResolveOptionsSchema),
|
|
2807
|
+
cwd: v.pipe(v.optional(v.string()), v.description("Current working directory")),
|
|
2808
|
+
platform: v.pipe(v.optional(v.union([
|
|
2809
|
+
v.literal("browser"),
|
|
2810
|
+
v.literal("neutral"),
|
|
2811
|
+
v.literal("node")
|
|
2812
|
+
])), v.description(`Platform for which the code should be generated (node, ${colors.underline("browser")}, neutral)`)),
|
|
2813
|
+
shimMissingExports: v.pipe(v.optional(v.boolean()), v.description("Create shim variables for missing exports")),
|
|
2814
|
+
treeshake: v.optional(TreeshakingOptionsSchema),
|
|
2815
|
+
logLevel: v.pipe(v.optional(LogLevelOptionSchema), v.description(`Log level (${colors.dim("silent")}, ${colors.underline(colors.gray("info"))}, debug, ${colors.yellow("warn")})`)),
|
|
2816
|
+
onLog: v.optional(OnLogSchema),
|
|
2817
|
+
onwarn: v.optional(OnwarnSchema),
|
|
2818
|
+
moduleTypes: v.pipe(v.optional(ModuleTypesSchema), v.description("Module types for customized extensions")),
|
|
2819
|
+
experimental: v.optional(v.strictObject({
|
|
2820
|
+
disableLiveBindings: v.optional(v.boolean()),
|
|
2821
|
+
enableComposingJsPlugins: v.optional(v.boolean()),
|
|
2822
|
+
resolveNewUrlToAsset: v.optional(v.boolean()),
|
|
2823
|
+
strictExecutionOrder: v.optional(v.boolean())
|
|
2824
|
+
})),
|
|
2825
|
+
define: v.pipe(v.optional(v.record(v.string(), v.string())), v.description("Define global variables")),
|
|
2826
|
+
inject: v.optional(v.record(v.string(), v.union([v.string(), v.tuple([v.string(), v.string()])]))),
|
|
2827
|
+
profilerNames: v.optional(v.boolean()),
|
|
2828
|
+
jsx: v.optional(JsxOptionsSchema),
|
|
2829
|
+
watch: v.optional(v.union([WatchOptionsSchema, v.literal(false)])),
|
|
2830
|
+
dropLabels: v.pipe(v.optional(v.array(v.string())), v.description("Remove labeled statements with these label names")),
|
|
2831
|
+
checks: v.optional(ChecksOptionsSchema)
|
|
2832
|
+
});
|
|
2833
|
+
const InputCliOverrideSchema = v.strictObject({
|
|
2834
|
+
external: v.pipe(v.optional(v.array(v.string())), v.description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
|
|
2835
|
+
inject: v.pipe(v.optional(v.record(v.string(), v.string())), v.description("Inject import statements on demand")),
|
|
2836
|
+
treeshake: v.pipe(v.optional(v.boolean(), true), v.description("enable treeshaking"))
|
|
2837
|
+
});
|
|
2838
|
+
const InputCliOptionsSchema = v.omit(v.strictObject({
|
|
2839
|
+
...InputOptionsSchema.entries,
|
|
2840
|
+
...InputCliOverrideSchema.entries
|
|
2841
|
+
}), [
|
|
2842
|
+
"input",
|
|
2843
|
+
"plugins",
|
|
2844
|
+
"onwarn",
|
|
2845
|
+
"onLog",
|
|
2846
|
+
"resolve",
|
|
2847
|
+
"experimental",
|
|
2848
|
+
"profilerNames",
|
|
2849
|
+
"watch"
|
|
2850
|
+
]);
|
|
2851
|
+
var ESTarget = function(ESTarget$1) {
|
|
2852
|
+
ESTarget$1["ES6"] = "es6";
|
|
2853
|
+
ESTarget$1["ES2015"] = "es2015";
|
|
2854
|
+
ESTarget$1["ES2016"] = "es2016";
|
|
2855
|
+
ESTarget$1["ES2017"] = "es2017";
|
|
2856
|
+
ESTarget$1["ES2018"] = "es2018";
|
|
2857
|
+
ESTarget$1["ES2019"] = "es2019";
|
|
2858
|
+
ESTarget$1["ES2020"] = "es2020";
|
|
2859
|
+
ESTarget$1["ES2021"] = "es2021";
|
|
2860
|
+
ESTarget$1["ES2022"] = "es2022";
|
|
2861
|
+
ESTarget$1["ES2023"] = "es2023";
|
|
2862
|
+
ESTarget$1["ES2024"] = "es2024";
|
|
2863
|
+
ESTarget$1["ESNext"] = "esnext";
|
|
2864
|
+
return ESTarget$1;
|
|
2865
|
+
}(ESTarget || {});
|
|
2866
|
+
const ModuleFormatSchema = v.union([
|
|
2867
|
+
v.literal("es"),
|
|
2868
|
+
v.literal("cjs"),
|
|
2869
|
+
v.literal("esm"),
|
|
2870
|
+
v.literal("module"),
|
|
2871
|
+
v.literal("commonjs"),
|
|
2872
|
+
v.literal("iife"),
|
|
2873
|
+
v.literal("umd")
|
|
2874
|
+
]);
|
|
2875
|
+
const AddonFunctionSchema = v.pipe(v.function(), v.args(v.tuple([v.custom(() => true)])), v.returnsAsync(v.unionAsync([v.string(), v.pipeAsync(v.promise(), v.awaitAsync(), v.string())])));
|
|
2876
|
+
const ChunkFileNamesSchema = v.union([v.string(), v.pipe(v.function(), v.args(v.tuple([v.custom(() => true)])), v.returns(v.string()))]);
|
|
2877
|
+
const GlobalsFunctionSchema = v.pipe(v.function(), v.args(v.tuple([v.string()])), v.returns(v.string()));
|
|
2878
|
+
const AdvancedChunksSchema = v.strictObject({
|
|
2879
|
+
minSize: v.optional(v.number()),
|
|
2880
|
+
minShareCount: v.optional(v.number()),
|
|
2881
|
+
groups: v.optional(v.array(v.strictObject({
|
|
2882
|
+
name: v.string(),
|
|
2883
|
+
test: v.optional(v.union([v.string(), v.instance(RegExp)])),
|
|
2884
|
+
priority: v.optional(v.number()),
|
|
2885
|
+
minSize: v.optional(v.number()),
|
|
2886
|
+
minShareCount: v.optional(v.number())
|
|
2887
|
+
})))
|
|
2888
|
+
});
|
|
2889
|
+
const OutputOptionsSchema = v.strictObject({
|
|
2890
|
+
dir: v.pipe(v.optional(v.string()), v.description("Output directory, defaults to `dist` if `file` is not set")),
|
|
2891
|
+
file: v.pipe(v.optional(v.string()), v.description("Single output file")),
|
|
2892
|
+
exports: v.pipe(v.optional(v.union([
|
|
2893
|
+
v.literal("auto"),
|
|
2894
|
+
v.literal("named"),
|
|
2895
|
+
v.literal("default"),
|
|
2896
|
+
v.literal("none")
|
|
2897
|
+
])), v.description(`Specify a export mode (${colors.underline("auto")}, named, default, none)`)),
|
|
2898
|
+
hashCharacters: v.pipe(v.optional(v.union([
|
|
2899
|
+
v.literal("base64"),
|
|
2900
|
+
v.literal("base36"),
|
|
2901
|
+
v.literal("hex")
|
|
2902
|
+
])), v.description("Use the specified character set for file hashes")),
|
|
2903
|
+
format: v.pipe(v.optional(ModuleFormatSchema), v.description(`Output format of the generated bundle (supports ${colors.underline("esm")}, cjs, and iife)`)),
|
|
2904
|
+
sourcemap: v.pipe(v.optional(v.union([
|
|
2905
|
+
v.boolean(),
|
|
2906
|
+
v.literal("inline"),
|
|
2907
|
+
v.literal("hidden")
|
|
2908
|
+
])), v.description(`Generate sourcemap (\`-s inline\` for inline, or ${colors.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
2909
|
+
sourcemapIgnoreList: v.optional(v.union([v.boolean(), v.custom(() => true)])),
|
|
2910
|
+
sourcemapPathTransform: v.optional(v.custom(() => true)),
|
|
2911
|
+
banner: v.optional(v.union([v.string(), AddonFunctionSchema])),
|
|
2912
|
+
footer: v.optional(v.union([v.string(), AddonFunctionSchema])),
|
|
2913
|
+
intro: v.optional(v.union([v.string(), AddonFunctionSchema])),
|
|
2914
|
+
outro: v.optional(v.union([v.string(), AddonFunctionSchema])),
|
|
2915
|
+
extend: v.pipe(v.optional(v.boolean()), v.description("Extend global variable defined by name in IIFE / UMD formats")),
|
|
2916
|
+
esModule: v.optional(v.union([v.boolean(), v.literal("if-default-prop")])),
|
|
2917
|
+
assetFileNames: v.pipe(v.optional(v.string()), v.description("Name pattern for asset files")),
|
|
2918
|
+
entryFileNames: v.optional(ChunkFileNamesSchema),
|
|
2919
|
+
chunkFileNames: v.optional(ChunkFileNamesSchema),
|
|
2920
|
+
cssEntryFileNames: v.optional(ChunkFileNamesSchema),
|
|
2921
|
+
cssChunkFileNames: v.optional(ChunkFileNamesSchema),
|
|
2922
|
+
minify: v.pipe(v.optional(v.boolean()), v.description("Minify the bundled file")),
|
|
2923
|
+
name: v.pipe(v.optional(v.string()), v.description("Name for UMD / IIFE format outputs")),
|
|
2924
|
+
globals: v.pipe(v.optional(v.union([v.record(v.string(), v.string()), GlobalsFunctionSchema])), v.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2925
|
+
externalLiveBindings: v.pipe(v.optional(v.boolean(), true), v.description("external live bindings")),
|
|
2926
|
+
inlineDynamicImports: v.pipe(v.optional(v.boolean(), false), v.description("Inline dynamic imports")),
|
|
2927
|
+
advancedChunks: v.optional(AdvancedChunksSchema),
|
|
2928
|
+
comments: v.pipe(v.optional(v.union([v.literal("none"), v.literal("preserve-legal")])), v.description("Control comments in the output")),
|
|
2929
|
+
target: v.pipe(v.optional(v.enum(ESTarget)), v.description("The JavaScript target environment"))
|
|
2930
|
+
});
|
|
2931
|
+
const getAddonDescription = (placement, wrapper) => {
|
|
2932
|
+
return `Code to insert the ${colors.bold(placement)} of the bundled file (${colors.bold(wrapper)} the wrapper function)`;
|
|
2933
|
+
};
|
|
2934
|
+
const OutputCliOverrideSchema = v.strictObject({
|
|
2935
|
+
entryFileNames: v.pipe(v.optional(v.string()), v.description("Name pattern for emitted entry chunks")),
|
|
2936
|
+
chunkFileNames: v.pipe(v.optional(v.string()), v.description("Name pattern for emitted secondary chunks")),
|
|
2937
|
+
cssEntryFileNames: v.pipe(v.optional(v.string()), v.description("Name pattern for emitted css entry chunks")),
|
|
2938
|
+
cssChunkFileNames: v.pipe(v.optional(v.string()), v.description("Name pattern for emitted css secondary chunks")),
|
|
2939
|
+
banner: v.pipe(v.optional(v.string()), v.description(getAddonDescription("top", "outside"))),
|
|
2940
|
+
footer: v.pipe(v.optional(v.string()), v.description(getAddonDescription("bottom", "outside"))),
|
|
2941
|
+
intro: v.pipe(v.optional(v.string()), v.description(getAddonDescription("top", "inside"))),
|
|
2942
|
+
outro: v.pipe(v.optional(v.string()), v.description(getAddonDescription("bottom", "inside"))),
|
|
2943
|
+
esModule: v.pipe(v.optional(v.boolean()), v.description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
|
|
2944
|
+
globals: v.pipe(v.optional(v.record(v.string(), v.string())), v.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2945
|
+
advancedChunks: v.pipe(v.optional(v.strictObject({
|
|
2946
|
+
minSize: v.pipe(v.optional(v.number()), v.description("Minimum size of the chunk")),
|
|
2947
|
+
minShareCount: v.pipe(v.optional(v.number()), v.description("Minimum share count of the chunk"))
|
|
2948
|
+
})), v.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)"))
|
|
2949
|
+
});
|
|
2950
|
+
const OutputCliOptionsSchema = v.omit(v.strictObject({
|
|
2951
|
+
...OutputOptionsSchema.entries,
|
|
2952
|
+
...OutputCliOverrideSchema.entries
|
|
2953
|
+
}), ["sourcemapIgnoreList", "sourcemapPathTransform"]);
|
|
2954
|
+
const CliOptionsSchema = v.strictObject({
|
|
2955
|
+
config: v.pipe(v.optional(v.union([v.string(), v.boolean()])), v.description("Path to the config file (default: `rolldown.config.js`)")),
|
|
2956
|
+
help: v.pipe(v.optional(v.boolean()), v.description("Show help")),
|
|
2957
|
+
version: v.pipe(v.optional(v.boolean()), v.description("Show version number")),
|
|
2958
|
+
watch: v.pipe(v.optional(v.boolean()), v.description("Watch files in bundle and rebuild on changes")),
|
|
2959
|
+
...InputCliOptionsSchema.entries,
|
|
2960
|
+
...OutputCliOptionsSchema.entries
|
|
2961
|
+
});
|
|
2962
|
+
function validateTreeShakingOptions(options) {
|
|
2963
|
+
v.parse(TreeshakingOptionsSchema, options);
|
|
2964
|
+
}
|
|
2965
|
+
function validateCliOptions(options) {
|
|
2966
|
+
let parsed = v.safeParse(CliOptionsSchema, options);
|
|
2967
|
+
return [parsed.output, parsed.issues?.map((issue) => issue.path?.join(", ")).filter((v$1) => v$1 !== undefined)];
|
|
2968
|
+
}
|
|
2969
|
+
function getInputCliKeys() {
|
|
2970
|
+
return v.keyof(InputCliOptionsSchema).options;
|
|
2971
|
+
}
|
|
2972
|
+
function getOutputCliKeys() {
|
|
2973
|
+
return v.keyof(OutputCliOptionsSchema).options;
|
|
2974
|
+
}
|
|
2975
|
+
function getJsonSchema() {
|
|
2976
|
+
return toJsonSchema(CliOptionsSchema);
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2663
2979
|
//#endregion
|
|
2664
2980
|
//#region src/utils/create-bundler-option.ts
|
|
2665
2981
|
async function createBundlerOptions(inputOptions, outputOptions) {
|
|
2666
2982
|
const pluginDriver = new PluginDriver();
|
|
2667
2983
|
inputOptions = await pluginDriver.callOptionsHook(inputOptions);
|
|
2668
|
-
if (inputOptions.treeshake !== undefined)
|
|
2984
|
+
if (inputOptions.treeshake !== undefined) validateTreeShakingOptions(inputOptions.treeshake);
|
|
2669
2985
|
const inputPlugins = await normalizePluginOption(inputOptions.plugins);
|
|
2670
2986
|
const outputPlugins = await normalizePluginOption(outputOptions.plugins);
|
|
2671
2987
|
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
@@ -2874,7 +3190,7 @@ const watch = (input) => {
|
|
|
2874
3190
|
|
|
2875
3191
|
//#endregion
|
|
2876
3192
|
//#region package.json
|
|
2877
|
-
var version = "1.0.0-beta.1-commit.
|
|
3193
|
+
var version = "1.0.0-beta.1-commit.3484a68";
|
|
2878
3194
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
2879
3195
|
|
|
2880
3196
|
//#endregion
|
|
@@ -2898,4 +3214,4 @@ else return await build$1.generate(output);
|
|
|
2898
3214
|
const VERSION = version;
|
|
2899
3215
|
|
|
2900
3216
|
//#endregion
|
|
2901
|
-
export { BuiltinPlugin,
|
|
3217
|
+
export { BuiltinPlugin, PluginContextData, VERSION, __toESM, arraify, bindingifyPlugin, build, buildImportAnalysisPlugin, colors, composeJsPlugins, createBundler, defineConfig, description, dynamicImportVarsPlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, require_binding, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch };
|