rolldown 1.0.0-beta.1-commit.7c52c94 → 1.0.0-beta.2-commit.afd0727

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.
Files changed (114) hide show
  1. package/dist/cjs/cli.cjs +981 -25
  2. package/dist/cjs/experimental-index.cjs +2 -2
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/parallel-plugin-worker.cjs +2 -2
  5. package/dist/cjs/parse-ast-index.cjs +1 -1
  6. package/dist/esm/cli.mjs +981 -26
  7. package/dist/esm/experimental-index.mjs +2 -2
  8. package/dist/esm/index.mjs +2 -2
  9. package/dist/esm/parallel-plugin-worker.mjs +2 -2
  10. package/dist/esm/parse-ast-index.mjs +1 -1
  11. package/dist/shared/{binding-Bl7VQy7c.mjs → binding-l7VLSKnB.mjs} +3 -3
  12. package/dist/shared/{binding-fhgdIkpS.cjs → binding-orkvONpS.cjs} +3 -3
  13. package/dist/shared/prompt-B7tq3GL9.cjs +854 -0
  14. package/dist/shared/prompt-Nfm4Xz36.mjs +851 -0
  15. package/dist/shared/{src-lBcHSsjm.cjs → src-Db20iysW.cjs} +12 -6
  16. package/dist/shared/{src-CPCP99Z9.mjs → src-mclDryX0.mjs} +12 -6
  17. package/dist/types/api/build.js +22 -0
  18. package/dist/types/api/experimental.js +13 -0
  19. package/dist/types/api/rolldown/index.js +7 -0
  20. package/dist/types/api/rolldown/rolldown-build.js +43 -0
  21. package/dist/types/api/watch/index.js +8 -0
  22. package/dist/types/api/watch/watch-emitter.js +69 -0
  23. package/dist/types/api/watch/watcher.js +66 -0
  24. package/dist/types/binding.d.ts +40 -2
  25. package/dist/types/builtin-plugin/alias-plugin.js +4 -0
  26. package/dist/types/builtin-plugin/constructors.d.ts +2 -2
  27. package/dist/types/builtin-plugin/constructors.js +68 -0
  28. package/dist/types/builtin-plugin/replace-plugin.js +29 -0
  29. package/dist/types/builtin-plugin/transform-plugin.js +16 -0
  30. package/dist/types/builtin-plugin/utils.js +19 -0
  31. package/dist/types/cli/arguments/alias.js +63 -0
  32. package/dist/types/cli/arguments/index.js +127 -0
  33. package/dist/types/cli/arguments/normalize.js +48 -0
  34. package/dist/types/cli/arguments/utils.js +67 -0
  35. package/dist/types/cli/colors.js +17 -0
  36. package/dist/types/cli/commands/bundle.js +203 -0
  37. package/dist/types/cli/commands/help.js +88 -0
  38. package/dist/types/cli/index.js +27 -0
  39. package/dist/types/cli/load-config.js +95 -0
  40. package/dist/types/cli/logger.js +35 -0
  41. package/dist/types/constants/plugin-context.js +7 -0
  42. package/dist/types/constants/plugin.js +69 -0
  43. package/dist/types/experimental-index.js +9 -0
  44. package/dist/types/index.d.ts +2 -2
  45. package/dist/types/index.js +7 -0
  46. package/dist/types/log/logHandler.js +25 -0
  47. package/dist/types/log/logger.js +107 -0
  48. package/dist/types/log/logging.js +11 -0
  49. package/dist/types/log/logs.js +86 -0
  50. package/dist/types/options/input-options.d.ts +47 -2
  51. package/dist/types/options/input-options.js +1 -0
  52. package/dist/types/options/normalized-input-options.js +21 -0
  53. package/dist/types/options/normalized-output-options.js +99 -0
  54. package/dist/types/options/output-options.d.ts +6 -0
  55. package/dist/types/options/output-options.js +1 -0
  56. package/dist/types/options/watch-options.js +1 -0
  57. package/dist/types/parallel-plugin-worker.js +31 -0
  58. package/dist/types/parallel-plugin.js +1 -0
  59. package/dist/types/parse-ast-index.js +73 -0
  60. package/dist/types/plugin/bindingify-build-hooks.js +213 -0
  61. package/dist/types/plugin/bindingify-hook-filter.js +39 -0
  62. package/dist/types/plugin/bindingify-output-hooks.js +189 -0
  63. package/dist/types/plugin/bindingify-plugin-hook-meta.js +19 -0
  64. package/dist/types/plugin/bindingify-plugin.js +124 -0
  65. package/dist/types/plugin/bindingify-watch-hooks.js +29 -0
  66. package/dist/types/plugin/hook-filter.js +1 -0
  67. package/dist/types/plugin/index.js +1 -0
  68. package/dist/types/plugin/minimal-plugin-context.js +25 -0
  69. package/dist/types/plugin/parallel-plugin-implementation.js +3 -0
  70. package/dist/types/plugin/parallel-plugin.js +6 -0
  71. package/dist/types/plugin/plugin-context-data.js +55 -0
  72. package/dist/types/plugin/plugin-context.js +108 -0
  73. package/dist/types/plugin/plugin-driver.js +88 -0
  74. package/dist/types/plugin/transform-plugin-context.js +37 -0
  75. package/dist/types/types/assert.js +1 -0
  76. package/dist/types/types/config-export.js +1 -0
  77. package/dist/types/types/misc.js +1 -0
  78. package/dist/types/types/module-info.js +1 -0
  79. package/dist/types/types/module-side-effects.js +1 -0
  80. package/dist/types/types/output-bundle.js +1 -0
  81. package/dist/types/types/rolldown-options.js +1 -0
  82. package/dist/types/types/rolldown-output.js +1 -0
  83. package/dist/types/types/schema.js +1 -0
  84. package/dist/types/types/sourcemap.js +16 -0
  85. package/dist/types/types/utils.js +1 -0
  86. package/dist/types/utils/asset-source.js +8 -0
  87. package/dist/types/utils/async-flatten.js +7 -0
  88. package/dist/types/utils/bindingify-input-options.js +225 -0
  89. package/dist/types/utils/bindingify-output-options.js +92 -0
  90. package/dist/types/utils/code-frame.js +46 -0
  91. package/dist/types/utils/compose-js-plugins.js +400 -0
  92. package/dist/types/utils/create-bundler-option.js +53 -0
  93. package/dist/types/utils/create-bundler.js +15 -0
  94. package/dist/types/utils/define-config.js +3 -0
  95. package/dist/types/utils/error.js +65 -0
  96. package/dist/types/utils/initialize-parallel-plugins.js +54 -0
  97. package/dist/types/utils/misc.js +22 -0
  98. package/dist/types/utils/normalize-hook.js +21 -0
  99. package/dist/types/utils/normalize-plugin-option.js +35 -0
  100. package/dist/types/utils/normalize-string-or-regex.js +14 -0
  101. package/dist/types/utils/plugin/index.js +7 -0
  102. package/dist/types/utils/transform-module-info.js +19 -0
  103. package/dist/types/utils/transform-rendered-chunk.js +43 -0
  104. package/dist/types/utils/transform-rendered-module.js +10 -0
  105. package/dist/types/utils/transform-side-effects.js +16 -0
  106. package/dist/types/utils/transform-sourcemap.js +29 -0
  107. package/dist/types/utils/transform-to-rollup-output.js +165 -0
  108. package/dist/types/utils/validator.js +275 -0
  109. package/package.json +28 -25
  110. package/dist/shared/consola_36c0034f-Cx52UqEq.mjs +0 -832
  111. package/dist/shared/consola_36c0034f-CynBWXXO.cjs +0 -859
  112. package/dist/shared/prompt-B58MxVuU.cjs +0 -762
  113. package/dist/shared/prompt-DjjlOckE.mjs +0 -758
  114. package/dist/tsconfig.dts.tsbuildinfo +0 -1
@@ -0,0 +1,275 @@
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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown",
3
- "version": "1.0.0-beta.1-commit.7c52c94",
3
+ "version": "1.0.0-beta.2-commit.afd0727",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "homepage": "https://rolldown.rs/",
6
6
  "repository": {
@@ -26,6 +26,7 @@
26
26
  "bin": {
27
27
  "rolldown": "./bin/cli.js"
28
28
  },
29
+ "type": "module",
29
30
  "main": "./dist/cjs/index.cjs",
30
31
  "types": "./dist/types/index.d.ts",
31
32
  "exports": {
@@ -84,9 +85,9 @@
84
85
  "dtsHeader": "type MaybePromise<T> = T | Promise<T>\ntype Nullable<T> = T | null | undefined\ntype VoidNullable<T = void> = T | null | undefined | void\nexport type BindingStringOrRegex = string | RegExp\n\n"
85
86
  },
86
87
  "dependencies": {
87
- "@oxc-project/types": "0.45.0",
88
- "@valibot/to-json-schema": "1.0.0-beta.3",
89
- "valibot": "1.0.0-beta.9"
88
+ "@oxc-project/types": "0.46.0",
89
+ "@valibot/to-json-schema": "1.0.0-beta.4",
90
+ "valibot": "1.0.0-beta.12"
90
91
  },
91
92
  "peerDependencies": {
92
93
  "@babel/runtime": ">=7"
@@ -100,6 +101,7 @@
100
101
  "@jridgewell/sourcemap-codec": "^1.5.0",
101
102
  "@napi-rs/cli": "^3.0.0-alpha.65",
102
103
  "@napi-rs/wasm-runtime": "^0.2.4",
104
+ "@oxc-node/core": "^0.0.17",
103
105
  "@types/fs-extra": "^11.0.4",
104
106
  "@types/lodash-es": "^4.17.12",
105
107
  "colorette": "^2.0.20",
@@ -116,42 +118,43 @@
116
118
  "source-map": "^0.7.4",
117
119
  "tsx": "^4.19.2",
118
120
  "type-fest": "^4.20.0",
121
+ "typedoc": "^0.27.6",
122
+ "typescript": "^5.7.3",
119
123
  "unbuild": "^3.0.0",
120
124
  "why-is-node-running": "^3.0.0",
121
125
  "@rolldown/testing": "0.0.1",
122
- "rolldown": "1.0.0-beta.1-commit.7c52c94"
126
+ "rolldown": "1.0.0-beta.2-commit.afd0727"
123
127
  },
124
128
  "optionalDependencies": {
125
- "@rolldown/binding-darwin-arm64": "1.0.0-beta.1-commit.7c52c94",
126
- "@rolldown/binding-darwin-x64": "1.0.0-beta.1-commit.7c52c94",
127
- "@rolldown/binding-freebsd-x64": "1.0.0-beta.1-commit.7c52c94",
128
- "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.1-commit.7c52c94",
129
- "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.1-commit.7c52c94",
130
- "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.1-commit.7c52c94",
131
- "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.1-commit.7c52c94",
132
- "@rolldown/binding-linux-x64-musl": "1.0.0-beta.1-commit.7c52c94",
133
- "@rolldown/binding-wasm32-wasi": "1.0.0-beta.1-commit.7c52c94",
134
- "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.1-commit.7c52c94",
135
- "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.1-commit.7c52c94",
136
- "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.1-commit.7c52c94"
129
+ "@rolldown/binding-darwin-arm64": "1.0.0-beta.2-commit.afd0727",
130
+ "@rolldown/binding-darwin-x64": "1.0.0-beta.2-commit.afd0727",
131
+ "@rolldown/binding-freebsd-x64": "1.0.0-beta.2-commit.afd0727",
132
+ "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.2-commit.afd0727",
133
+ "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.2-commit.afd0727",
134
+ "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.2-commit.afd0727",
135
+ "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.2-commit.afd0727",
136
+ "@rolldown/binding-linux-x64-musl": "1.0.0-beta.2-commit.afd0727",
137
+ "@rolldown/binding-wasm32-wasi": "1.0.0-beta.2-commit.afd0727",
138
+ "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.2-commit.afd0727",
139
+ "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.2-commit.afd0727",
140
+ "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.2-commit.afd0727"
137
141
  },
138
142
  "scripts": {
139
143
  "# Scrips for binding #": "_",
140
144
  "artifacts": "napi artifacts --cwd ./src --package-json-path ../package.json -o=../artifacts --npm-dir ../npm",
141
- "build-binding": "napi build -o=./src --manifest-path ../../crates/rolldown_binding/Cargo.toml --platform -p rolldown_binding --js binding.js --dts binding.d.ts --no-const-enum",
145
+ "build-binding": "napi build -o=./src --manifest-path ../../crates/rolldown_binding/Cargo.toml --platform -p rolldown_binding --js binding.cjs --dts binding.d.ts --no-const-enum",
142
146
  "build-binding:release": "pnpm build-binding --release",
143
147
  "build-binding:wasi": "pnpm build-binding --target wasm32-wasip1-threads",
144
148
  "build-binding:wasi:release": "pnpm build-binding --profile release-wasi --target wasm32-wasip1-threads",
145
149
  "# Scrips for node #": "_",
146
150
  "bak_build-node": "unbuild",
147
- "build-node": "tsx ./build.ts",
148
- "build-types": "tsc -p ./tsconfig.dts.json",
149
- "build-types-check": "tsc -p ./tsconfig.check.json",
150
- "build-native:debug": "run-s build-binding build-types build-node build-types-check",
151
- "build-native:release": "run-s build-binding:release build-types build-node build-types-check",
151
+ "build-node": "node --import @oxc-node/core/register ./build.ts",
152
+ "build-types": "tsc -p ./tsconfig.json",
153
+ "build-native:debug": "run-s build-binding build-types build-node",
154
+ "build-native:release": "run-s build-binding:release build-types build-node",
152
155
  "build-wasi:debug": "run-s build-binding build-binding:wasi build-node",
153
156
  "build-wasi:release": "run-s build-binding build-binding:wasi:release build-node",
154
- "# Scrips for checking #": "_",
155
- "type-check": "tsc --noEmit"
157
+ "# Scrips for docs #": "_",
158
+ "extract-options-doc": "typedoc"
156
159
  }
157
160
  }