rolldown 1.0.0-beta.2-commit.2666b23 → 1.0.0-beta.20
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/bin/cli.mjs +2 -0
- package/dist/{cjs/cli.cjs → cli.cjs} +630 -603
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/{esm/cli.mjs → cli.mjs} +605 -575
- package/dist/config.cjs +12 -0
- package/dist/config.d.cts +10 -0
- package/dist/config.d.mts +10 -0
- package/dist/config.mjs +10 -0
- package/dist/experimental-index.cjs +107 -0
- package/dist/experimental-index.d.cts +63 -0
- package/dist/experimental-index.d.mts +63 -0
- package/dist/experimental-index.mjs +82 -0
- package/dist/experimental-runtime-types.d.ts +52 -0
- package/dist/filter-index.cjs +105 -0
- package/dist/filter-index.d.cts +4 -0
- package/dist/filter-index.d.mts +4 -0
- package/dist/filter-index.mjs +44 -0
- package/dist/index.cjs +9 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +5 -0
- package/dist/{cjs/parallel-plugin-worker.cjs → parallel-plugin-worker.cjs} +6 -14
- package/dist/parallel-plugin-worker.d.cts +1 -0
- package/dist/parallel-plugin-worker.d.mts +1 -0
- package/dist/{esm/parallel-plugin-worker.mjs → parallel-plugin-worker.mjs} +5 -12
- package/dist/{cjs/parallel-plugin.cjs → parallel-plugin.cjs} +1 -2
- package/dist/parallel-plugin.d.cts +14 -0
- package/dist/parallel-plugin.d.mts +14 -0
- package/dist/{esm/parallel-plugin.mjs → parallel-plugin.mjs} +0 -1
- package/dist/parse-ast-index.cjs +4 -0
- package/dist/parse-ast-index.d.cts +9 -0
- package/dist/parse-ast-index.d.mts +9 -0
- package/dist/parse-ast-index.mjs +3 -0
- package/dist/shared/binding-5O9lFYtz.d.mts +1215 -0
- package/dist/shared/binding-BvKFOCZr.d.cts +1215 -0
- package/dist/shared/{chunk-qZFfknuJ.cjs → chunk-DDkG_k5U.cjs} +0 -1
- package/dist/shared/define-config-BOD4oRSZ.d.cts +1204 -0
- package/dist/shared/define-config-DdVYel_V.d.mts +1204 -0
- package/dist/shared/load-config-B_hPIyxu.mjs +119 -0
- package/dist/shared/load-config-BdY850xq.cjs +125 -0
- package/dist/shared/misc-BKp5iIef.cjs +67 -0
- package/dist/shared/misc-BN0nse6C.mjs +25 -0
- package/dist/shared/parse-ast-index-CVVmsBjK.cjs +738 -0
- package/dist/shared/parse-ast-index-DW8kbzjr.mjs +616 -0
- package/dist/shared/{prompt-Nfm4Xz36.mjs → prompt-C5jz26Zn.mjs} +247 -246
- package/dist/shared/{prompt-B7tq3GL9.cjs → prompt-QNI93ne7.cjs} +250 -250
- package/dist/shared/src-CZ0tgOug.cjs +4851 -0
- package/dist/shared/src-DHXNdTPA.mjs +4647 -0
- package/package.json +63 -67
- package/bin/cli.js +0 -2
- package/dist/cjs/experimental-index.cjs +0 -79
- package/dist/cjs/index.cjs +0 -8
- package/dist/cjs/parse-ast-index.cjs +0 -57
- package/dist/esm/experimental-index.mjs +0 -56
- package/dist/esm/index.mjs +0 -4
- package/dist/esm/parse-ast-index.mjs +0 -55
- package/dist/shared/binding-l7VLSKnB.mjs +0 -610
- package/dist/shared/binding-orkvONpS.cjs +0 -661
- package/dist/shared/src-BC6S-BmL.cjs +0 -2828
- package/dist/shared/src-mupmacNC.mjs +0 -2647
- package/dist/types/api/build.d.ts +0 -18
- package/dist/types/api/build.js +0 -22
- package/dist/types/api/experimental.d.ts +0 -7
- package/dist/types/api/experimental.js +0 -13
- package/dist/types/api/rolldown/index.d.ts +0 -3
- package/dist/types/api/rolldown/index.js +0 -7
- package/dist/types/api/rolldown/rolldown-build.d.ts +0 -12
- package/dist/types/api/rolldown/rolldown-build.js +0 -43
- package/dist/types/api/watch/index.d.ts +0 -3
- package/dist/types/api/watch/index.js +0 -8
- package/dist/types/api/watch/watch-emitter.d.ts +0 -31
- package/dist/types/api/watch/watch-emitter.js +0 -69
- package/dist/types/api/watch/watcher.d.ts +0 -13
- package/dist/types/api/watch/watcher.js +0 -66
- package/dist/types/binding.d.ts +0 -1327
- package/dist/types/builtin-plugin/alias-plugin.d.ts +0 -10
- package/dist/types/builtin-plugin/alias-plugin.js +0 -4
- package/dist/types/builtin-plugin/constructors.d.ts +0 -20
- package/dist/types/builtin-plugin/constructors.js +0 -68
- package/dist/types/builtin-plugin/replace-plugin.d.ts +0 -28
- package/dist/types/builtin-plugin/replace-plugin.js +0 -29
- package/dist/types/builtin-plugin/transform-plugin.d.ts +0 -9
- package/dist/types/builtin-plugin/transform-plugin.js +0 -16
- package/dist/types/builtin-plugin/utils.d.ts +0 -8
- package/dist/types/builtin-plugin/utils.js +0 -19
- package/dist/types/cli/arguments/alias.d.ts +0 -16
- package/dist/types/cli/arguments/alias.js +0 -63
- package/dist/types/cli/arguments/index.d.ts +0 -15
- package/dist/types/cli/arguments/index.js +0 -127
- package/dist/types/cli/arguments/normalize.d.ts +0 -12
- package/dist/types/cli/arguments/normalize.js +0 -48
- package/dist/types/cli/arguments/utils.d.ts +0 -8
- package/dist/types/cli/arguments/utils.js +0 -67
- package/dist/types/cli/colors.d.ts +0 -11
- package/dist/types/cli/colors.js +0 -17
- package/dist/types/cli/commands/bundle.d.ts +0 -3
- package/dist/types/cli/commands/bundle.js +0 -203
- package/dist/types/cli/commands/help.d.ts +0 -1
- package/dist/types/cli/commands/help.js +0 -88
- package/dist/types/cli/index.d.ts +0 -1
- package/dist/types/cli/index.js +0 -27
- package/dist/types/cli/load-config.d.ts +0 -3
- package/dist/types/cli/load-config.js +0 -95
- package/dist/types/cli/logger.d.ts +0 -5
- package/dist/types/cli/logger.js +0 -35
- package/dist/types/constants/plugin-context.d.ts +0 -7
- package/dist/types/constants/plugin-context.js +0 -7
- package/dist/types/constants/plugin.d.ts +0 -45
- package/dist/types/constants/plugin.js +0 -69
- package/dist/types/experimental-index.d.ts +0 -9
- package/dist/types/experimental-index.js +0 -9
- package/dist/types/index.d.ts +0 -28
- package/dist/types/index.js +0 -7
- package/dist/types/log/logHandler.d.ts +0 -4
- package/dist/types/log/logHandler.js +0 -25
- package/dist/types/log/logger.d.ts +0 -6
- package/dist/types/log/logger.js +0 -107
- package/dist/types/log/logging.d.ts +0 -11
- package/dist/types/log/logging.js +0 -11
- package/dist/types/log/logs.d.ts +0 -18
- package/dist/types/log/logs.js +0 -86
- package/dist/types/options/input-options.d.ts +0 -170
- package/dist/types/options/input-options.js +0 -1
- package/dist/types/options/normalized-input-options.d.ts +0 -18
- package/dist/types/options/normalized-input-options.js +0 -21
- package/dist/types/options/normalized-output-options.d.ts +0 -67
- package/dist/types/options/normalized-output-options.js +0 -99
- package/dist/types/options/output-options.d.ts +0 -86
- package/dist/types/options/output-options.js +0 -1
- package/dist/types/options/watch-options.d.ts +0 -5
- package/dist/types/options/watch-options.js +0 -1
- package/dist/types/parallel-plugin-worker.d.ts +0 -1
- package/dist/types/parallel-plugin-worker.js +0 -31
- package/dist/types/parallel-plugin.d.ts +0 -1
- package/dist/types/parallel-plugin.js +0 -1
- package/dist/types/parse-ast-index.d.ts +0 -4
- package/dist/types/parse-ast-index.js +0 -73
- package/dist/types/plugin/bindingify-build-hooks.d.ts +0 -10
- package/dist/types/plugin/bindingify-build-hooks.js +0 -213
- package/dist/types/plugin/bindingify-hook-filter.d.ts +0 -7
- package/dist/types/plugin/bindingify-hook-filter.js +0 -39
- package/dist/types/plugin/bindingify-output-hooks.d.ts +0 -14
- package/dist/types/plugin/bindingify-output-hooks.js +0 -189
- package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +0 -8
- package/dist/types/plugin/bindingify-plugin-hook-meta.js +0 -19
- package/dist/types/plugin/bindingify-plugin.d.ts +0 -15
- package/dist/types/plugin/bindingify-plugin.js +0 -124
- package/dist/types/plugin/bindingify-watch-hooks.d.ts +0 -5
- package/dist/types/plugin/bindingify-watch-hooks.js +0 -29
- package/dist/types/plugin/hook-filter.d.ts +0 -48
- package/dist/types/plugin/hook-filter.js +0 -1
- package/dist/types/plugin/index.d.ts +0 -126
- package/dist/types/plugin/index.js +0 -1
- package/dist/types/plugin/minimal-plugin-context.d.ts +0 -15
- package/dist/types/plugin/minimal-plugin-context.js +0 -25
- package/dist/types/plugin/parallel-plugin-implementation.d.ts +0 -10
- package/dist/types/plugin/parallel-plugin-implementation.js +0 -3
- package/dist/types/plugin/parallel-plugin.d.ts +0 -9
- package/dist/types/plugin/parallel-plugin.js +0 -6
- package/dist/types/plugin/plugin-context-data.d.ts +0 -16
- package/dist/types/plugin/plugin-context-data.js +0 -55
- package/dist/types/plugin/plugin-context.d.ts +0 -52
- package/dist/types/plugin/plugin-context.js +0 -108
- package/dist/types/plugin/plugin-driver.d.ts +0 -8
- package/dist/types/plugin/plugin-driver.js +0 -88
- package/dist/types/plugin/transform-plugin-context.d.ts +0 -17
- package/dist/types/plugin/transform-plugin-context.js +0 -37
- package/dist/types/types/assert.d.ts +0 -13
- package/dist/types/types/assert.js +0 -1
- package/dist/types/types/config-export.d.ts +0 -5
- package/dist/types/types/config-export.js +0 -1
- package/dist/types/types/misc.d.ts +0 -40
- package/dist/types/types/misc.js +0 -1
- package/dist/types/types/module-info.d.ts +0 -15
- package/dist/types/types/module-info.js +0 -1
- package/dist/types/types/module-side-effects.d.ts +0 -10
- package/dist/types/types/module-side-effects.js +0 -1
- package/dist/types/types/output-bundle.d.ts +0 -4
- package/dist/types/types/output-bundle.js +0 -1
- package/dist/types/types/rolldown-options.d.ts +0 -5
- package/dist/types/types/rolldown-options.js +0 -1
- package/dist/types/types/rolldown-output.d.ts +0 -63
- package/dist/types/types/rolldown-output.js +0 -1
- package/dist/types/types/schema.d.ts +0 -33
- package/dist/types/types/schema.js +0 -1
- package/dist/types/types/sourcemap.d.ts +0 -13
- package/dist/types/types/sourcemap.js +0 -16
- package/dist/types/types/utils.d.ts +0 -13
- package/dist/types/types/utils.js +0 -1
- package/dist/types/utils/asset-source.d.ts +0 -4
- package/dist/types/utils/asset-source.js +0 -8
- package/dist/types/utils/async-flatten.d.ts +0 -1
- package/dist/types/utils/async-flatten.js +0 -7
- package/dist/types/utils/bindingify-input-options.d.ts +0 -7
- package/dist/types/utils/bindingify-input-options.js +0 -225
- package/dist/types/utils/bindingify-output-options.d.ts +0 -3
- package/dist/types/utils/bindingify-output-options.js +0 -92
- package/dist/types/utils/code-frame.d.ts +0 -1
- package/dist/types/utils/code-frame.js +0 -46
- package/dist/types/utils/compose-js-plugins.d.ts +0 -2
- package/dist/types/utils/compose-js-plugins.js +0 -400
- package/dist/types/utils/create-bundler-option.d.ts +0 -11
- package/dist/types/utils/create-bundler-option.js +0 -53
- package/dist/types/utils/create-bundler.d.ts +0 -8
- package/dist/types/utils/create-bundler.js +0 -15
- package/dist/types/utils/define-config.d.ts +0 -5
- package/dist/types/utils/define-config.js +0 -3
- package/dist/types/utils/error.d.ts +0 -2
- package/dist/types/utils/error.js +0 -65
- package/dist/types/utils/initialize-parallel-plugins.d.ts +0 -19
- package/dist/types/utils/initialize-parallel-plugins.js +0 -54
- package/dist/types/utils/misc.d.ts +0 -6
- package/dist/types/utils/misc.js +0 -22
- package/dist/types/utils/normalize-hook.d.ts +0 -7
- package/dist/types/utils/normalize-hook.js +0 -21
- package/dist/types/utils/normalize-plugin-option.d.ts +0 -13
- package/dist/types/utils/normalize-plugin-option.js +0 -35
- package/dist/types/utils/normalize-string-or-regex.d.ts +0 -2
- package/dist/types/utils/normalize-string-or-regex.js +0 -14
- package/dist/types/utils/plugin/index.d.ts +0 -2
- package/dist/types/utils/plugin/index.js +0 -7
- package/dist/types/utils/transform-module-info.d.ts +0 -4
- package/dist/types/utils/transform-module-info.js +0 -19
- package/dist/types/utils/transform-rendered-chunk.d.ts +0 -4
- package/dist/types/utils/transform-rendered-chunk.js +0 -43
- package/dist/types/utils/transform-rendered-module.d.ts +0 -3
- package/dist/types/utils/transform-rendered-module.js +0 -10
- package/dist/types/utils/transform-side-effects.d.ts +0 -3
- package/dist/types/utils/transform-side-effects.js +0 -16
- package/dist/types/utils/transform-sourcemap.d.ts +0 -3
- package/dist/types/utils/transform-sourcemap.js +0 -29
- package/dist/types/utils/transform-to-rollup-output.d.ts +0 -11
- package/dist/types/utils/transform-to-rollup-output.js +0 -165
- package/dist/types/utils/validator.d.ts +0 -7
- package/dist/types/utils/validator.js +0 -275
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
import * as v from 'valibot';
|
|
2
|
-
import { colors } from '../cli/colors';
|
|
3
|
-
import { toJsonSchema } from '@valibot/to-json-schema';
|
|
4
|
-
const StringOrRegExpSchema = v.union([v.string(), v.instance(RegExp)]);
|
|
5
|
-
const LogLevelSchema = v.union([
|
|
6
|
-
v.literal('debug'),
|
|
7
|
-
v.literal('info'),
|
|
8
|
-
v.literal('warn'),
|
|
9
|
-
]);
|
|
10
|
-
const LogLevelOptionSchema = v.union([LogLevelSchema, v.literal('silent')]);
|
|
11
|
-
const LogLevelWithErrorSchema = v.union([LogLevelSchema, v.literal('error')]);
|
|
12
|
-
const RollupLogSchema = v.any();
|
|
13
|
-
const RollupLogWithStringSchema = v.union([RollupLogSchema, v.string()]);
|
|
14
|
-
/// --- InputSchema ---
|
|
15
|
-
const InputOptionSchema = v.union([
|
|
16
|
-
v.string(),
|
|
17
|
-
v.array(v.string()),
|
|
18
|
-
v.record(v.string(), v.string()),
|
|
19
|
-
]);
|
|
20
|
-
const ExternalSchema = v.union([
|
|
21
|
-
StringOrRegExpSchema,
|
|
22
|
-
v.array(StringOrRegExpSchema),
|
|
23
|
-
v.pipe(v.function(), v.args(v.tuple([v.string(), v.optional(v.string()), v.boolean()])), v.returns(v.nullish(v.boolean()))),
|
|
24
|
-
]);
|
|
25
|
-
const ModuleTypesSchema = v.record(v.string(), v.union([
|
|
26
|
-
v.literal('base64'),
|
|
27
|
-
v.literal('binary'),
|
|
28
|
-
v.literal('css'),
|
|
29
|
-
v.literal('dataurl'),
|
|
30
|
-
v.literal('empty'),
|
|
31
|
-
v.literal('js'),
|
|
32
|
-
v.literal('json'),
|
|
33
|
-
v.literal('jsx'),
|
|
34
|
-
v.literal('text'),
|
|
35
|
-
v.literal('ts'),
|
|
36
|
-
v.literal('tsx'),
|
|
37
|
-
]));
|
|
38
|
-
const JsxOptionsSchema = v.strictObject({
|
|
39
|
-
development: v.pipe(v.optional(v.boolean()), v.description('Development specific information')),
|
|
40
|
-
factory: v.pipe(v.optional(v.string()), v.description('Jsx element transformation')),
|
|
41
|
-
fragment: v.pipe(v.optional(v.string()), v.description('Jsx fragment transformation')),
|
|
42
|
-
importSource: v.pipe(v.optional(v.string()), v.description('Import the factory of element and fragment if mode is classic')),
|
|
43
|
-
jsxImportSource: v.pipe(v.optional(v.string()), v.description('Import the factory of element and fragment if mode is automatic')),
|
|
44
|
-
mode: v.pipe(v.optional(v.union([v.literal('classic'), v.literal('automatic')])), v.description('Jsx transformation mode')),
|
|
45
|
-
refresh: v.pipe(v.optional(v.boolean()), v.description('React refresh transformation')),
|
|
46
|
-
});
|
|
47
|
-
const WatchOptionsSchema = v.strictObject({
|
|
48
|
-
chokidar: v.optional(v.any()),
|
|
49
|
-
exclude: v.optional(v.union([StringOrRegExpSchema, v.array(StringOrRegExpSchema)])),
|
|
50
|
-
include: v.optional(v.union([StringOrRegExpSchema, v.array(StringOrRegExpSchema)])),
|
|
51
|
-
notify: v.pipe(v.optional(v.strictObject({
|
|
52
|
-
compareContents: v.optional(v.boolean()),
|
|
53
|
-
pollInterval: v.optional(v.number()),
|
|
54
|
-
})), v.description('Notify options')),
|
|
55
|
-
skipWrite: v.pipe(v.optional(v.boolean()), v.description('Skip the bundle.write() step')),
|
|
56
|
-
});
|
|
57
|
-
const ChecksOptionsSchema = v.strictObject({
|
|
58
|
-
circularDependency: v.pipe(v.optional(v.boolean()), v.description('Wether to emit warnings when detecting circular dependencies')),
|
|
59
|
-
});
|
|
60
|
-
const ResolveOptionsSchema = v.strictObject({
|
|
61
|
-
alias: v.optional(v.record(v.string(), v.union([v.string(), v.array(v.string())]))),
|
|
62
|
-
aliasFields: v.optional(v.array(v.array(v.string()))),
|
|
63
|
-
conditionNames: v.optional(v.array(v.string())),
|
|
64
|
-
extensionAlias: v.optional(v.record(v.string(), v.array(v.string()))),
|
|
65
|
-
exportsFields: v.optional(v.array(v.array(v.string()))),
|
|
66
|
-
extensions: v.optional(v.array(v.string())),
|
|
67
|
-
mainFields: v.optional(v.array(v.string())),
|
|
68
|
-
mainFiles: v.optional(v.array(v.string())),
|
|
69
|
-
modules: v.optional(v.array(v.string())),
|
|
70
|
-
symlinks: v.optional(v.boolean()),
|
|
71
|
-
tsconfigFilename: v.optional(v.string()),
|
|
72
|
-
});
|
|
73
|
-
const TreeshakingOptionsSchema = v.union([
|
|
74
|
-
v.boolean(),
|
|
75
|
-
v.looseObject({ annotations: v.optional(v.boolean()) }),
|
|
76
|
-
]);
|
|
77
|
-
const OnLogSchema = v.pipe(v.function(), v.args(v.tuple([
|
|
78
|
-
LogLevelSchema,
|
|
79
|
-
RollupLogSchema,
|
|
80
|
-
v.pipe(v.function(), v.args(v.tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema]))),
|
|
81
|
-
])));
|
|
82
|
-
const OnwarnSchema = v.pipe(v.function(), v.args(v.tuple([
|
|
83
|
-
RollupLogSchema,
|
|
84
|
-
v.pipe(v.function(), v.args(v.tuple([
|
|
85
|
-
v.union([
|
|
86
|
-
RollupLogWithStringSchema,
|
|
87
|
-
v.pipe(v.function(), v.returns(RollupLogWithStringSchema)),
|
|
88
|
-
]),
|
|
89
|
-
]))),
|
|
90
|
-
])));
|
|
91
|
-
const InputOptionsSchema = v.strictObject({
|
|
92
|
-
input: v.optional(InputOptionSchema),
|
|
93
|
-
plugins: v.optional(v.custom(() => true)),
|
|
94
|
-
external: v.optional(ExternalSchema),
|
|
95
|
-
resolve: v.optional(ResolveOptionsSchema),
|
|
96
|
-
cwd: v.pipe(v.optional(v.string()), v.description('Current working directory')),
|
|
97
|
-
platform: v.pipe(v.optional(v.union([v.literal('browser'), v.literal('neutral'), v.literal('node')])), v.description(`Platform for which the code should be generated (node, ${colors.underline('browser')}, neutral)`)),
|
|
98
|
-
shimMissingExports: v.pipe(v.optional(v.boolean()), v.description('Create shim variables for missing exports')),
|
|
99
|
-
treeshake: v.optional(TreeshakingOptionsSchema),
|
|
100
|
-
logLevel: v.pipe(v.optional(LogLevelOptionSchema), v.description(`Log level (${colors.dim('silent')}, ${colors.underline(colors.gray('info'))}, debug, ${colors.yellow('warn')})`)),
|
|
101
|
-
onLog: v.optional(OnLogSchema),
|
|
102
|
-
onwarn: v.optional(OnwarnSchema),
|
|
103
|
-
moduleTypes: v.pipe(v.optional(ModuleTypesSchema), v.description('Module types for customized extensions')),
|
|
104
|
-
experimental: v.optional(v.strictObject({
|
|
105
|
-
disableLiveBindings: v.optional(v.boolean()),
|
|
106
|
-
enableComposingJsPlugins: v.optional(v.boolean()),
|
|
107
|
-
resolveNewUrlToAsset: v.optional(v.boolean()),
|
|
108
|
-
strictExecutionOrder: v.optional(v.boolean()),
|
|
109
|
-
})),
|
|
110
|
-
define: v.pipe(v.optional(v.record(v.string(), v.string())), v.description('Define global variables')),
|
|
111
|
-
inject: v.optional(v.record(v.string(), v.union([v.string(), v.tuple([v.string(), v.string()])]))),
|
|
112
|
-
profilerNames: v.optional(v.boolean()),
|
|
113
|
-
jsx: v.optional(JsxOptionsSchema),
|
|
114
|
-
watch: v.optional(v.union([WatchOptionsSchema, v.literal(false)])),
|
|
115
|
-
dropLabels: v.pipe(v.optional(v.array(v.string())), v.description('Remove labeled statements with these label names')),
|
|
116
|
-
checks: v.optional(ChecksOptionsSchema),
|
|
117
|
-
});
|
|
118
|
-
const InputCliOverrideSchema = v.strictObject({
|
|
119
|
-
external: v.pipe(v.optional(v.array(v.string())), v.description('Comma-separated list of module ids to exclude from the bundle `<module-id>,...`')),
|
|
120
|
-
inject: v.pipe(v.optional(v.record(v.string(), v.string())), v.description('Inject import statements on demand')),
|
|
121
|
-
treeshake: v.pipe(v.optional(v.boolean(), true), v.description('enable treeshaking')),
|
|
122
|
-
});
|
|
123
|
-
const InputCliOptionsSchema = v.omit(v.strictObject({
|
|
124
|
-
...InputOptionsSchema.entries,
|
|
125
|
-
...InputCliOverrideSchema.entries,
|
|
126
|
-
}), [
|
|
127
|
-
'input',
|
|
128
|
-
'plugins',
|
|
129
|
-
'onwarn',
|
|
130
|
-
'onLog',
|
|
131
|
-
'resolve',
|
|
132
|
-
'experimental',
|
|
133
|
-
'profilerNames',
|
|
134
|
-
'watch',
|
|
135
|
-
]);
|
|
136
|
-
/// --- OutputSchema ---
|
|
137
|
-
var ESTarget;
|
|
138
|
-
(function (ESTarget) {
|
|
139
|
-
ESTarget["ES6"] = "es6";
|
|
140
|
-
ESTarget["ES2015"] = "es2015";
|
|
141
|
-
ESTarget["ES2016"] = "es2016";
|
|
142
|
-
ESTarget["ES2017"] = "es2017";
|
|
143
|
-
ESTarget["ES2018"] = "es2018";
|
|
144
|
-
ESTarget["ES2019"] = "es2019";
|
|
145
|
-
ESTarget["ES2020"] = "es2020";
|
|
146
|
-
ESTarget["ES2021"] = "es2021";
|
|
147
|
-
ESTarget["ES2022"] = "es2022";
|
|
148
|
-
ESTarget["ES2023"] = "es2023";
|
|
149
|
-
ESTarget["ES2024"] = "es2024";
|
|
150
|
-
ESTarget["ESNext"] = "esnext";
|
|
151
|
-
})(ESTarget || (ESTarget = {}));
|
|
152
|
-
const ModuleFormatSchema = v.union([
|
|
153
|
-
v.literal('es'),
|
|
154
|
-
v.literal('cjs'),
|
|
155
|
-
v.literal('esm'),
|
|
156
|
-
v.literal('module'),
|
|
157
|
-
v.literal('commonjs'),
|
|
158
|
-
v.literal('iife'),
|
|
159
|
-
v.literal('umd'),
|
|
160
|
-
]);
|
|
161
|
-
const AddonFunctionSchema = v.pipe(v.function(), v.args(v.tuple([v.custom(() => true)])), v.returnsAsync(v.unionAsync([
|
|
162
|
-
v.string(),
|
|
163
|
-
v.pipeAsync(v.promise(), v.awaitAsync(), v.string()),
|
|
164
|
-
])));
|
|
165
|
-
const ChunkFileNamesSchema = v.union([
|
|
166
|
-
v.string(),
|
|
167
|
-
v.pipe(v.function(), v.args(v.tuple([v.custom(() => true)])), v.returns(v.string())),
|
|
168
|
-
]);
|
|
169
|
-
const GlobalsFunctionSchema = v.pipe(v.function(), v.args(v.tuple([v.string()])), v.returns(v.string()));
|
|
170
|
-
const AdvancedChunksSchema = v.strictObject({
|
|
171
|
-
minSize: v.optional(v.number()),
|
|
172
|
-
maxSize: v.optional(v.number()),
|
|
173
|
-
minModuleSize: v.optional(v.number()),
|
|
174
|
-
maxModuleSize: v.optional(v.number()),
|
|
175
|
-
minShareCount: v.optional(v.number()),
|
|
176
|
-
groups: v.optional(v.array(v.strictObject({
|
|
177
|
-
name: v.string(),
|
|
178
|
-
test: v.optional(v.union([v.string(), v.instance(RegExp)])),
|
|
179
|
-
priority: v.optional(v.number()),
|
|
180
|
-
minSize: v.optional(v.number()),
|
|
181
|
-
minShareCount: v.optional(v.number()),
|
|
182
|
-
maxSize: v.optional(v.number()),
|
|
183
|
-
minModuleSize: v.optional(v.number()),
|
|
184
|
-
maxModuleSize: v.optional(v.number()),
|
|
185
|
-
}))),
|
|
186
|
-
});
|
|
187
|
-
const OutputOptionsSchema = v.strictObject({
|
|
188
|
-
dir: v.pipe(v.optional(v.string()), v.description('Output directory, defaults to `dist` if `file` is not set')),
|
|
189
|
-
file: v.pipe(v.optional(v.string()), v.description('Single output file')),
|
|
190
|
-
exports: v.pipe(v.optional(v.union([
|
|
191
|
-
v.literal('auto'),
|
|
192
|
-
v.literal('named'),
|
|
193
|
-
v.literal('default'),
|
|
194
|
-
v.literal('none'),
|
|
195
|
-
])), v.description(`Specify a export mode (${colors.underline('auto')}, named, default, none)`)),
|
|
196
|
-
hashCharacters: v.pipe(v.optional(v.union([v.literal('base64'), v.literal('base36'), v.literal('hex')])), v.description('Use the specified character set for file hashes')),
|
|
197
|
-
format: v.pipe(v.optional(ModuleFormatSchema), v.description(`Output format of the generated bundle (supports ${colors.underline('esm')}, cjs, and iife)`)),
|
|
198
|
-
sourcemap: v.pipe(v.optional(v.union([v.boolean(), v.literal('inline'), v.literal('hidden')])), 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')})`)),
|
|
199
|
-
sourcemapIgnoreList: v.optional(v.union([v.boolean(), v.custom(() => true)])),
|
|
200
|
-
sourcemapPathTransform: v.optional(v.custom(() => true)),
|
|
201
|
-
banner: v.optional(v.union([v.string(), AddonFunctionSchema])),
|
|
202
|
-
footer: v.optional(v.union([v.string(), AddonFunctionSchema])),
|
|
203
|
-
intro: v.optional(v.union([v.string(), AddonFunctionSchema])),
|
|
204
|
-
outro: v.optional(v.union([v.string(), AddonFunctionSchema])),
|
|
205
|
-
extend: v.pipe(v.optional(v.boolean()), v.description('Extend global variable defined by name in IIFE / UMD formats')),
|
|
206
|
-
esModule: v.optional(v.union([v.boolean(), v.literal('if-default-prop')])),
|
|
207
|
-
assetFileNames: v.pipe(v.optional(v.string()), v.description('Name pattern for asset files')),
|
|
208
|
-
entryFileNames: v.optional(ChunkFileNamesSchema),
|
|
209
|
-
chunkFileNames: v.optional(ChunkFileNamesSchema),
|
|
210
|
-
cssEntryFileNames: v.optional(ChunkFileNamesSchema),
|
|
211
|
-
cssChunkFileNames: v.optional(ChunkFileNamesSchema),
|
|
212
|
-
minify: v.pipe(v.optional(v.boolean()), v.description('Minify the bundled file')),
|
|
213
|
-
name: v.pipe(v.optional(v.string()), v.description('Name for UMD / IIFE format outputs')),
|
|
214
|
-
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`)')),
|
|
215
|
-
externalLiveBindings: v.pipe(v.optional(v.boolean(), true), v.description('external live bindings')),
|
|
216
|
-
inlineDynamicImports: v.pipe(v.optional(v.boolean(), false), v.description('Inline dynamic imports')),
|
|
217
|
-
advancedChunks: v.optional(AdvancedChunksSchema),
|
|
218
|
-
comments: v.pipe(v.optional(v.union([v.literal('none'), v.literal('preserve-legal')])), v.description('Control comments in the output')),
|
|
219
|
-
target: v.pipe(v.optional(v.enum(ESTarget)), v.description('The JavaScript target environment')),
|
|
220
|
-
});
|
|
221
|
-
const getAddonDescription = (placement, wrapper) => {
|
|
222
|
-
return `Code to insert the ${colors.bold(placement)} of the bundled file (${colors.bold(wrapper)} the wrapper function)`;
|
|
223
|
-
};
|
|
224
|
-
const OutputCliOverrideSchema = v.strictObject({
|
|
225
|
-
// Reject all functions in CLI
|
|
226
|
-
entryFileNames: v.pipe(v.optional(v.string()), v.description('Name pattern for emitted entry chunks')),
|
|
227
|
-
chunkFileNames: v.pipe(v.optional(v.string()), v.description('Name pattern for emitted secondary chunks')),
|
|
228
|
-
cssEntryFileNames: v.pipe(v.optional(v.string()), v.description('Name pattern for emitted css entry chunks')),
|
|
229
|
-
cssChunkFileNames: v.pipe(v.optional(v.string()), v.description('Name pattern for emitted css secondary chunks')),
|
|
230
|
-
banner: v.pipe(v.optional(v.string()), v.description(getAddonDescription('top', 'outside'))),
|
|
231
|
-
footer: v.pipe(v.optional(v.string()), v.description(getAddonDescription('bottom', 'outside'))),
|
|
232
|
-
intro: v.pipe(v.optional(v.string()), v.description(getAddonDescription('top', 'inside'))),
|
|
233
|
-
outro: v.pipe(v.optional(v.string()), v.description(getAddonDescription('bottom', 'inside'))),
|
|
234
|
-
// It is hard to handle the union type in json schema, so use this first.
|
|
235
|
-
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)')),
|
|
236
|
-
globals: v.pipe(v.optional(v.record(v.string(), v.string())), v.description('Global variable of UMD / IIFE dependencies (syntax: `key=value`)')),
|
|
237
|
-
advancedChunks: v.pipe(v.optional(v.strictObject({
|
|
238
|
-
minSize: v.pipe(v.optional(v.number()), v.description('Minimum size of the chunk')),
|
|
239
|
-
minShareCount: v.pipe(v.optional(v.number()), v.description('Minimum share count of the chunk')),
|
|
240
|
-
})), v.description('Global variable of UMD / IIFE dependencies (syntax: `key=value`)')),
|
|
241
|
-
});
|
|
242
|
-
const OutputCliOptionsSchema = v.omit(v.strictObject({
|
|
243
|
-
...OutputOptionsSchema.entries,
|
|
244
|
-
...OutputCliOverrideSchema.entries,
|
|
245
|
-
}), ['sourcemapIgnoreList', 'sourcemapPathTransform']);
|
|
246
|
-
/// --- CliSchema ---
|
|
247
|
-
const CliOptionsSchema = v.strictObject({
|
|
248
|
-
config: v.pipe(v.optional(v.union([v.string(), v.boolean()])), v.description('Path to the config file (default: `rolldown.config.js`)')),
|
|
249
|
-
help: v.pipe(v.optional(v.boolean()), v.description('Show help')),
|
|
250
|
-
version: v.pipe(v.optional(v.boolean()), v.description('Show version number')),
|
|
251
|
-
watch: v.pipe(v.optional(v.boolean()), v.description('Watch files in bundle and rebuild on changes')),
|
|
252
|
-
...InputCliOptionsSchema.entries,
|
|
253
|
-
...OutputCliOptionsSchema.entries,
|
|
254
|
-
});
|
|
255
|
-
export function validateTreeShakingOptions(options) {
|
|
256
|
-
v.parse(TreeshakingOptionsSchema, options);
|
|
257
|
-
}
|
|
258
|
-
export function validateCliOptions(options) {
|
|
259
|
-
let parsed = v.safeParse(CliOptionsSchema, options);
|
|
260
|
-
return [
|
|
261
|
-
parsed.output,
|
|
262
|
-
parsed.issues
|
|
263
|
-
?.map((issue) => issue.path?.join(', '))
|
|
264
|
-
.filter((v) => v !== undefined),
|
|
265
|
-
];
|
|
266
|
-
}
|
|
267
|
-
export function getInputCliKeys() {
|
|
268
|
-
return v.keyof(InputCliOptionsSchema).options;
|
|
269
|
-
}
|
|
270
|
-
export function getOutputCliKeys() {
|
|
271
|
-
return v.keyof(OutputCliOptionsSchema).options;
|
|
272
|
-
}
|
|
273
|
-
export function getJsonSchema() {
|
|
274
|
-
return toJsonSchema(CliOptionsSchema);
|
|
275
|
-
}
|