rolldown 1.0.0-beta.34 → 1.0.0-beta.36

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 (44) hide show
  1. package/dist/cli.mjs +218 -229
  2. package/dist/config.d.mts +2 -2
  3. package/dist/config.mjs +3 -3
  4. package/dist/experimental-index.d.mts +16 -4
  5. package/dist/experimental-index.mjs +23 -7
  6. package/dist/filter-index.d.mts +2 -2
  7. package/dist/index.d.mts +2 -2
  8. package/dist/index.mjs +2 -2
  9. package/dist/parallel-plugin-worker.mjs +3 -4
  10. package/dist/parallel-plugin.d.mts +2 -2
  11. package/dist/parse-ast-index.d.mts +1 -1
  12. package/dist/parse-ast-index.mjs +1 -1
  13. package/dist/shared/{binding-9k0egz6L.d.mts → binding-wK0CRIMb.d.mts} +1 -0
  14. package/dist/shared/{define-config-DVSr6Unb.d.mts → define-config-wxvILtDx.d.mts} +30 -3
  15. package/dist/shared/{load-config-CXpGBNqp.mjs → load-config-Jqw6FAJp.mjs} +4 -6
  16. package/dist/shared/parse-ast-index-CkDFQ-07.mjs +10847 -0
  17. package/dist/shared/{prompt-C5jz26Zn.mjs → prompt-DuG2i9ud.mjs} +4 -7
  18. package/dist/shared/{src-Chn1S4O2.mjs → src-WjgJWoNk.mjs} +141 -70
  19. package/package.json +33 -48
  20. package/dist/cli.cjs +0 -1767
  21. package/dist/cli.d.cts +0 -1
  22. package/dist/config.cjs +0 -12
  23. package/dist/config.d.cts +0 -10
  24. package/dist/experimental-index.cjs +0 -139
  25. package/dist/experimental-index.d.cts +0 -90
  26. package/dist/filter-index.cjs +0 -105
  27. package/dist/filter-index.d.cts +0 -4
  28. package/dist/index.cjs +0 -9
  29. package/dist/index.d.cts +0 -3
  30. package/dist/parallel-plugin-worker.cjs +0 -32
  31. package/dist/parallel-plugin-worker.d.cts +0 -1
  32. package/dist/parallel-plugin.cjs +0 -8
  33. package/dist/parallel-plugin.d.cts +0 -14
  34. package/dist/parse-ast-index.cjs +0 -4
  35. package/dist/parse-ast-index.d.cts +0 -8
  36. package/dist/shared/binding-D13M6Llu.d.cts +0 -1425
  37. package/dist/shared/chunk-DDkG_k5U.cjs +0 -39
  38. package/dist/shared/define-config-D5AluabE.d.cts +0 -1394
  39. package/dist/shared/load-config-CefxSUnT.cjs +0 -125
  40. package/dist/shared/misc-DksvspN4.cjs +0 -58
  41. package/dist/shared/parse-ast-index-BCv3Y1TT.cjs +0 -859
  42. package/dist/shared/parse-ast-index-DjojK-Vf.mjs +0 -725
  43. package/dist/shared/prompt-QNI93ne7.cjs +0 -854
  44. package/dist/shared/src-djpzntWm.cjs +0 -4622
@@ -137,8 +137,7 @@ function requirePicocolors() {
137
137
  picocolors.exports.createColors = createColors;
138
138
  return picocolors.exports;
139
139
  }
140
- var picocolorsExports = /* @__PURE__ */ requirePicocolors();
141
- const e = /* @__PURE__ */ getDefaultExportFromCjs(picocolorsExports);
140
+ const e = /* @__PURE__ */ getDefaultExportFromCjs(/* @__PURE__ */ requirePicocolors());
142
141
  function J({ onlyFirst: t = false } = {}) {
143
142
  const F$1 = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
144
143
  return new RegExp(F$1, t ? void 0 : "g");
@@ -596,12 +595,10 @@ let wD = class extends x {
596
595
  return this.options[this.cursor].value;
597
596
  }
598
597
  toggleAll() {
599
- const u$1 = this.value.length === this.options.length;
600
- this.value = u$1 ? [] : this.options.map((F$1) => F$1.value);
598
+ this.value = this.value.length === this.options.length ? [] : this.options.map((F$1) => F$1.value);
601
599
  }
602
600
  toggleValue() {
603
- const u$1 = this.value.includes(this._value);
604
- this.value = u$1 ? this.value.filter((F$1) => F$1 !== this._value) : [...this.value, this._value];
601
+ this.value = this.value.includes(this._value) ? this.value.filter((F$1) => F$1 !== this._value) : [...this.value, this._value];
605
602
  }
606
603
  };
607
604
  var SD = Object.defineProperty, $D = (t, u$1, F$1) => u$1 in t ? SD(t, u$1, {
@@ -811,7 +808,7 @@ async function prompt(message, opts = {}) {
811
808
  if (Error.captureStackTrace) Error.captureStackTrace(error, prompt);
812
809
  throw error;
813
810
  }
814
- case "undefined": return void 0;
811
+ case "undefined": return;
815
812
  case "null": return null;
816
813
  case "symbol": return kCancel;
817
814
  default:
@@ -1,25 +1,33 @@
1
- import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, ParallelJsPluginRegistry, augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst, shutdownAsyncRuntime, startAsyncRuntime } from "./parse-ast-index-DjojK-Vf.mjs";
1
+ import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst, shutdownAsyncRuntime, startAsyncRuntime } from "./parse-ast-index-CkDFQ-07.mjs";
2
2
  import { arraify, noop, unimplemented, unreachable, unsupported } from "./misc-CQeo-AFx.mjs";
3
+ import { Worker } from "node:worker_threads";
3
4
  import path from "node:path";
4
5
  import { fileURLToPath } from "node:url";
5
6
  import colors from "ansis";
6
7
  import * as filter from "@rolldown/pluginutils";
7
8
  import fsp from "node:fs/promises";
8
9
  import os from "node:os";
9
- import { Worker } from "node:worker_threads";
10
10
 
11
11
  //#region package.json
12
- var version = "1.0.0-beta.34";
12
+ var version = "1.0.0-beta.36";
13
13
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
14
14
 
15
15
  //#endregion
16
16
  //#region src/builtin-plugin/utils.ts
17
+ const BuiltinClassSymbol = Symbol.for("__RolldownBuiltinPlugin__");
17
18
  var BuiltinPlugin = class {
18
19
  constructor(name, _options) {
19
20
  this.name = name;
20
21
  this._options = _options;
22
+ this[BuiltinClassSymbol] = true;
21
23
  }
22
24
  };
25
+ function isBuiltinPlugin(obj) {
26
+ return obj && obj[BuiltinClassSymbol] === true;
27
+ }
28
+ function createBuiltinPlugin(name, options) {
29
+ return new BuiltinPlugin(name, options);
30
+ }
23
31
  function makeBuiltinPluginCallable(plugin) {
24
32
  let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
25
33
  const wrappedPlugin = plugin;
@@ -77,8 +85,7 @@ function getLogHandler(level, code, logger, pluginName, logLevel) {
77
85
  function getLogger(plugins, onLog, logLevel, watchMode) {
78
86
  const minimalPriority = logLevelPriority[logLevel];
79
87
  const logger = (level, log, skipped = /* @__PURE__ */ new Set()) => {
80
- const logPriority = logLevelPriority[level];
81
- if (logPriority < minimalPriority) return;
88
+ if (logLevelPriority[level] < minimalPriority) return;
82
89
  for (const plugin of getSortedPlugins("onLog", plugins)) {
83
90
  if (skipped.has(plugin)) continue;
84
91
  const { onLog: pluginOnLog } = plugin;
@@ -87,8 +94,7 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
87
94
  if (logLevelPriority[level$1] < minimalPriority) return () => {};
88
95
  return (log$1) => logger(level$1, normalizeLog(log$1), new Set(skipped).add(plugin));
89
96
  };
90
- const handler = "handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog;
91
- if (handler.call({
97
+ if (("handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog).call({
92
98
  debug: getLogHandler$1(LOG_LEVEL_DEBUG),
93
99
  error: (log$1) => error(normalizeLog(log$1)),
94
100
  info: getLogHandler$1(LOG_LEVEL_INFO),
@@ -170,7 +176,7 @@ function normalizeHook(hook) {
170
176
  //#endregion
171
177
  //#region src/utils/normalize-string-or-regex.ts
172
178
  function normalizedStringOrRegex(pattern) {
173
- if (!pattern) return void 0;
179
+ if (!pattern) return;
174
180
  if (!isReadonlyArray(pattern)) return [pattern];
175
181
  return pattern;
176
182
  }
@@ -181,59 +187,59 @@ function isReadonlyArray(input) {
181
187
  //#endregion
182
188
  //#region src/builtin-plugin/constructors.ts
183
189
  function modulePreloadPolyfillPlugin(config) {
184
- return new BuiltinPlugin("builtin:module-preload-polyfill", config);
190
+ return createBuiltinPlugin("builtin:module-preload-polyfill", config);
185
191
  }
186
192
  function dynamicImportVarsPlugin(config) {
187
193
  if (config) {
188
194
  config.include = normalizedStringOrRegex(config.include);
189
195
  config.exclude = normalizedStringOrRegex(config.exclude);
190
196
  }
191
- return new BuiltinPlugin("builtin:dynamic-import-vars", config);
197
+ return createBuiltinPlugin("builtin:dynamic-import-vars", config);
192
198
  }
193
199
  function importGlobPlugin(config) {
194
- return new BuiltinPlugin("builtin:import-glob", config);
200
+ return createBuiltinPlugin("builtin:import-glob", config);
195
201
  }
196
202
  function reporterPlugin(config) {
197
- return new BuiltinPlugin("builtin:reporter", config);
203
+ return createBuiltinPlugin("builtin:reporter", config);
198
204
  }
199
205
  function manifestPlugin(config) {
200
- return new BuiltinPlugin("builtin:manifest", config);
206
+ return createBuiltinPlugin("builtin:manifest", config);
201
207
  }
202
208
  function wasmHelperPlugin(config) {
203
- return new BuiltinPlugin("builtin:wasm-helper", config);
209
+ return createBuiltinPlugin("builtin:wasm-helper", config);
204
210
  }
205
211
  function wasmFallbackPlugin() {
206
- const builtinPlugin = new BuiltinPlugin("builtin:wasm-fallback");
212
+ const builtinPlugin = createBuiltinPlugin("builtin:wasm-fallback");
207
213
  return makeBuiltinPluginCallable(builtinPlugin);
208
214
  }
209
215
  function loadFallbackPlugin() {
210
- return new BuiltinPlugin("builtin:load-fallback");
216
+ return createBuiltinPlugin("builtin:load-fallback");
211
217
  }
212
218
  function jsonPlugin(config) {
213
- const builtinPlugin = new BuiltinPlugin("builtin:json", config);
219
+ const builtinPlugin = createBuiltinPlugin("builtin:json", config);
214
220
  return makeBuiltinPluginCallable(builtinPlugin);
215
221
  }
216
222
  function buildImportAnalysisPlugin(config) {
217
- return new BuiltinPlugin("builtin:build-import-analysis", config);
223
+ return createBuiltinPlugin("builtin:build-import-analysis", config);
218
224
  }
219
225
  function viteResolvePlugin(config) {
220
- const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", config);
226
+ const builtinPlugin = createBuiltinPlugin("builtin:vite-resolve", config);
221
227
  return makeBuiltinPluginCallable(builtinPlugin);
222
228
  }
223
229
  function isolatedDeclarationPlugin(config) {
224
- return new BuiltinPlugin("builtin:isolated-declaration", config);
230
+ return createBuiltinPlugin("builtin:isolated-declaration", config);
225
231
  }
226
232
  function assetPlugin(config) {
227
- return new BuiltinPlugin("builtin:asset", config);
233
+ return createBuiltinPlugin("builtin:asset", config);
228
234
  }
229
235
  function webWorkerPostPlugin() {
230
- return new BuiltinPlugin("builtin:web-worker-post");
236
+ return createBuiltinPlugin("builtin:web-worker-post");
231
237
  }
232
238
  function oxcRuntimePlugin(config) {
233
- return new BuiltinPlugin("builtin:oxc-runtime", config);
239
+ return createBuiltinPlugin("builtin:oxc-runtime", config);
234
240
  }
235
241
  function esmExternalRequirePlugin(config) {
236
- return new BuiltinPlugin("builtin:esm-external-require", config);
242
+ return createBuiltinPlugin("builtin:esm-external-require", config);
237
243
  }
238
244
 
239
245
  //#endregion
@@ -327,7 +333,7 @@ function checkOutputPluginOption(plugins, onLog) {
327
333
  function normalizePlugins(plugins, anonymousPrefix) {
328
334
  for (const [index, plugin] of plugins.entries()) {
329
335
  if ("_parallel" in plugin) continue;
330
- if (plugin instanceof BuiltinPlugin) continue;
336
+ if (isBuiltinPlugin(plugin)) continue;
331
337
  if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
332
338
  }
333
339
  return plugins;
@@ -394,9 +400,9 @@ var PluginDriver = class {
394
400
  };
395
401
  function getObjectPlugins(plugins) {
396
402
  return plugins.filter((plugin) => {
397
- if (!plugin) return void 0;
398
- if ("_parallel" in plugin) return void 0;
399
- if (plugin instanceof BuiltinPlugin) return void 0;
403
+ if (!plugin) return;
404
+ if ("_parallel" in plugin) return;
405
+ if (isBuiltinPlugin(plugin)) return;
400
406
  return plugin;
401
407
  });
402
408
  }
@@ -1934,10 +1940,43 @@ const ChecksOptionsSchema = strictObject({
1934
1940
  configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict")),
1935
1941
  preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
1936
1942
  });
1943
+ const CompressOptionsKeepNamesSchema = strictObject({
1944
+ function: optional(boolean()),
1945
+ class: optional(boolean())
1946
+ });
1947
+ const CompressOptionsSchema = strictObject({
1948
+ target: optional(union([
1949
+ literal("esnext"),
1950
+ literal("es2015"),
1951
+ literal("es2016"),
1952
+ literal("es2017"),
1953
+ literal("es2018"),
1954
+ literal("es2019"),
1955
+ literal("es2020"),
1956
+ literal("es2021"),
1957
+ literal("es2022"),
1958
+ literal("es2023"),
1959
+ literal("es2024")
1960
+ ])),
1961
+ dropConsole: optional(boolean()),
1962
+ dropDebugger: optional(boolean()),
1963
+ keepNames: optional(CompressOptionsKeepNamesSchema),
1964
+ unused: optional(union([boolean(), literal("keep_assign")]))
1965
+ });
1966
+ const MangleOptionsKeepNamesSchema = strictObject({
1967
+ function: optional(boolean()),
1968
+ class: optional(boolean())
1969
+ });
1970
+ const MangleOptionsSchema = strictObject({
1971
+ toplevel: optional(boolean()),
1972
+ keepNames: optional(union([boolean(), MangleOptionsKeepNamesSchema])),
1973
+ debug: optional(boolean())
1974
+ });
1975
+ const CodegenOptionsSchema = strictObject({ removeWhitespace: optional(boolean()) });
1937
1976
  const MinifyOptionsSchema = strictObject({
1938
- mangle: optional(boolean()),
1939
- compress: optional(boolean()),
1940
- removeWhitespace: optional(boolean())
1977
+ compress: optional(union([boolean(), CompressOptionsSchema])),
1978
+ mangle: optional(union([boolean(), MangleOptionsSchema])),
1979
+ codegen: optional(union([boolean(), CodegenOptionsSchema]))
1941
1980
  });
1942
1981
  const ResolveOptionsSchema = strictObject({
1943
1982
  alias: optional(record(string(), union([string(), array(string())]))),
@@ -1956,10 +1995,19 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
1956
1995
  annotations: optional(boolean()),
1957
1996
  manualPureFunctions: optional(array(string())),
1958
1997
  unknownGlobalSideEffects: optional(boolean()),
1959
- commonjs: optional(boolean())
1998
+ commonjs: optional(boolean()),
1999
+ propertyReadSideEffects: optional(union([literal(false), literal("always")])),
2000
+ propertyWriteSideEffects: optional(union([literal(false), literal("always")]))
1960
2001
  })]);
1961
2002
  const OptimizationOptionsSchema = strictObject({
1962
- inlineConst: pipe(optional(boolean()), description("Enable crossmodule constant inlining")),
2003
+ inlineConst: pipe(optional(union([
2004
+ boolean(),
2005
+ literal("smart"),
2006
+ strictObject({
2007
+ mode: optional(union([literal("all"), literal("smart")])),
2008
+ pass: optional(number())
2009
+ })
2010
+ ])), description("Enable crossmodule constant inlining")),
1963
2011
  pifeForModuleWrappers: pipe(optional(boolean()), description("Use PIFE pattern for module wrappers"))
1964
2012
  });
1965
2013
  const OnLogSchema = pipe(function_(), args(tuple([
@@ -1969,6 +2017,7 @@ const OnLogSchema = pipe(function_(), args(tuple([
1969
2017
  ])));
1970
2018
  const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
1971
2019
  const HmrSchema = union([boolean(), strictObject({
2020
+ new: optional(boolean()),
1972
2021
  port: optional(number()),
1973
2022
  host: optional(string()),
1974
2023
  implement: optional(string())
@@ -2201,19 +2250,22 @@ const CliOptionsSchema = strictObject({
2201
2250
  function validateCliOptions(options) {
2202
2251
  let parsed = safeParse(CliOptionsSchema, options);
2203
2252
  return [parsed.output, parsed.issues?.map((issue) => {
2204
- const option = issue.path?.map((pathItem) => pathItem.key).join(" ");
2205
- return `Invalid value for option ${option}: ${issue.message}`;
2253
+ return `Invalid value for option ${issue.path?.map((pathItem) => pathItem.key).join(" ")}: ${issue.message}`;
2206
2254
  })];
2207
2255
  }
2208
- const inputHelperMsgRecord = { output: { ignored: true } };
2256
+ const inputHelperMsgRecord = {
2257
+ output: { ignored: true },
2258
+ "resolve.tsconfigFilename": { issueMsg: "It is deprecated. Please use the top-level `tsconfig` option instead." }
2259
+ };
2209
2260
  const outputHelperMsgRecord = {};
2210
2261
  function validateOption(key, options) {
2262
+ if (typeof options !== "object") throw new Error(`Invalid ${key} options. Expected an Object but received ${JSON.stringify(options)}.`);
2211
2263
  if (globalThis.process?.env?.ROLLUP_TEST) return;
2212
2264
  let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
2213
2265
  if (!parsed.success) {
2214
2266
  const errors = parsed.issues.map((issue) => {
2215
- const issuePaths = issue.path.map((path$1) => path$1.key);
2216
2267
  let issueMsg = issue.message;
2268
+ const issuePaths = issue.path.map((path$1) => path$1.key);
2217
2269
  if (issue.type === "union") {
2218
2270
  const subIssue = issue.issues?.find((i) => !(i.type !== issue.received && i.input === issue.input));
2219
2271
  if (subIssue) {
@@ -2224,9 +2276,9 @@ function validateOption(key, options) {
2224
2276
  const stringPath = issuePaths.join(".");
2225
2277
  const helper = key === "input" ? inputHelperMsgRecord[stringPath] : outputHelperMsgRecord[stringPath];
2226
2278
  if (helper && helper.ignored) return "";
2227
- return `- For the "${stringPath}". ${issueMsg}. ${helper ? helper.msg : ""}`;
2279
+ return `- For the "${stringPath}". ${helper?.issueMsg || issueMsg + "."} ${helper?.help ? `\n Help: ${helper.help}` : ""}`;
2228
2280
  }).filter(Boolean);
2229
- if (errors.length) console.warn(`Warning validate ${key} options.\n` + errors.join("\n"));
2281
+ if (errors.length) console.warn(`\x1b[33mWarning: Invalid ${key} options (${errors.length} issue${errors.length === 1 ? "" : "s"} found)\n${errors.join("\n")}\x1b[0m`);
2230
2282
  }
2231
2283
  }
2232
2284
  function getInputCliKeys() {
@@ -2299,6 +2351,10 @@ function getErrorMessage(e$1) {
2299
2351
  s += message;
2300
2352
  if (e$1.frame) s = joinNewLine(s, e$1.frame);
2301
2353
  if (e$1.stack) s = joinNewLine(s, e$1.stack.replace(message, ""));
2354
+ if (e$1.cause) {
2355
+ s = joinNewLine(s, "Caused by:");
2356
+ s = joinNewLine(s, getErrorMessage(e$1.cause).split("\n").map((line) => " " + line).join("\n"));
2357
+ }
2302
2358
  return s;
2303
2359
  }
2304
2360
  function joinNewLine(s1, s2) {
@@ -2385,7 +2441,7 @@ function generateAtomMatcher(kind, matcher) {
2385
2441
  return kind === "code" ? filter.code(matcher) : filter.id(matcher);
2386
2442
  }
2387
2443
  function transformFilterMatcherToFilterExprs(filterOption) {
2388
- if (!filterOption) return void 0;
2444
+ if (!filterOption) return;
2389
2445
  if (Array.isArray(filterOption)) return filterOption;
2390
2446
  const { id, code, moduleType } = filterOption;
2391
2447
  let ret = [];
@@ -2483,24 +2539,24 @@ function bindingifyFilterExprImpl(expr, list) {
2483
2539
  }
2484
2540
  }
2485
2541
  function bindingifyResolveIdFilter(filterOption) {
2486
- if (!filterOption) return void 0;
2542
+ if (!filterOption) return;
2487
2543
  if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2488
2544
  return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2489
2545
  }
2490
2546
  function bindingifyLoadFilter(filterOption) {
2491
- if (!filterOption) return void 0;
2547
+ if (!filterOption) return;
2492
2548
  if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2493
2549
  return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2494
2550
  }
2495
2551
  function bindingifyTransformFilter(filterOption) {
2496
- if (!filterOption) return void 0;
2552
+ if (!filterOption) return;
2497
2553
  let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
2498
2554
  let ret = [];
2499
2555
  if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
2500
2556
  return { value: ret.length > 0 ? ret : void 0 };
2501
2557
  }
2502
2558
  function bindingifyRenderChunkFilter(filterOption) {
2503
- if (!filterOption) return void 0;
2559
+ if (!filterOption) return;
2504
2560
  if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2505
2561
  return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
2506
2562
  }
@@ -2515,7 +2571,7 @@ function bindingPluginOrder(order) {
2515
2571
  case "post": return BindingPluginOrder.Post;
2516
2572
  case "pre": return BindingPluginOrder.Pre;
2517
2573
  case null:
2518
- case void 0: return void 0;
2574
+ case void 0: return;
2519
2575
  default: throw new Error(`Unknown plugin order: ${order}`);
2520
2576
  }
2521
2577
  }
@@ -2682,6 +2738,9 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
2682
2738
  getCombinedSourcemap() {
2683
2739
  return JSON.parse(this.inner.getCombinedSourcemap());
2684
2740
  }
2741
+ addWatchFile(id) {
2742
+ this.inner.addWatchFile(id);
2743
+ }
2685
2744
  };
2686
2745
 
2687
2746
  //#endregion
@@ -2781,7 +2840,7 @@ function bindingifyTransform(args$1) {
2781
2840
  return {
2782
2841
  plugin: async (ctx, code, id, meta$1) => {
2783
2842
  const ret = await handler.call(new TransformPluginContextImpl(args$1.outputOptions, ctx.inner(), args$1.plugin, args$1.pluginContextData, ctx, id, code, args$1.onLog, args$1.logLevel, args$1.watchMode), code, id, meta$1);
2784
- if (ret == null) return void 0;
2843
+ if (ret == null) return;
2785
2844
  if (typeof ret === "string") return { code: ret };
2786
2845
  let moduleOption = args$1.pluginContextData.updateModuleOption(id, {
2787
2846
  meta: ret.meta ?? {},
@@ -2915,9 +2974,8 @@ function transformChunkModules(modules) {
2915
2974
  //#endregion
2916
2975
  //#region src/utils/transform-to-rollup-output.ts
2917
2976
  function transformToRollupSourceMap(map) {
2918
- const parsed = JSON.parse(map);
2919
2977
  const obj = {
2920
- ...parsed,
2978
+ ...JSON.parse(map),
2921
2979
  toString() {
2922
2980
  return JSON.stringify(obj);
2923
2981
  },
@@ -3459,13 +3517,10 @@ var ChunkingContextImpl = class {
3459
3517
  }
3460
3518
  getModuleInfo(moduleId) {
3461
3519
  const bindingInfo = this.context.getModuleInfo(moduleId);
3462
- if (bindingInfo) {
3463
- const info = transformModuleInfo(bindingInfo, {
3464
- moduleSideEffects: null,
3465
- meta: {}
3466
- });
3467
- return info;
3468
- }
3520
+ if (bindingInfo) return transformModuleInfo(bindingInfo, {
3521
+ moduleSideEffects: null,
3522
+ meta: {}
3523
+ });
3469
3524
  return null;
3470
3525
  }
3471
3526
  };
@@ -3538,7 +3593,7 @@ function bindingifySourcemap(sourcemap) {
3538
3593
  case true: return "file";
3539
3594
  case "inline": return "inline";
3540
3595
  case false:
3541
- case void 0: return void 0;
3596
+ case void 0: return;
3542
3597
  case "hidden": return "hidden";
3543
3598
  default: throw new Error(`unknown sourcemap: ${sourcemap}`);
3544
3599
  }
@@ -3564,7 +3619,7 @@ function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
3564
3619
  else if (manualChunks != null) advancedChunks = { groups: [{ name(moduleId, ctx) {
3565
3620
  return manualChunks(moduleId, { getModuleInfo: (id) => ctx.getModuleInfo(id) });
3566
3621
  } }] };
3567
- if (advancedChunks == null) return void 0;
3622
+ if (advancedChunks == null) return;
3568
3623
  const { groups,...restAdvancedChunks } = advancedChunks;
3569
3624
  return {
3570
3625
  ...restAdvancedChunks,
@@ -3768,8 +3823,7 @@ var PluginContextData = class {
3768
3823
  return info;
3769
3824
  }
3770
3825
  getModuleIds(context) {
3771
- const moduleIds = context.getModuleIds();
3772
- return moduleIds.values();
3826
+ return context.getModuleIds().values();
3773
3827
  }
3774
3828
  saveResolveOptions(options) {
3775
3829
  const index = this.resolveOptionsMap.size;
@@ -3812,8 +3866,8 @@ var PluginContextData = class {
3812
3866
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
3813
3867
  const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
3814
3868
  const plugins = rawPlugins.map((plugin) => {
3815
- if ("_parallel" in plugin) return void 0;
3816
- if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
3869
+ if ("_parallel" in plugin) return;
3870
+ if (isBuiltinPlugin(plugin)) return bindingifyBuiltInPlugin(plugin);
3817
3871
  return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
3818
3872
  });
3819
3873
  const { jsx, transform } = bindingifyJsx(onLog, inputOptions.jsx, inputOptions.transform);
@@ -3826,7 +3880,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3826
3880
  platform: inputOptions.platform,
3827
3881
  shimMissingExports: inputOptions.shimMissingExports,
3828
3882
  logLevel: bindingifyLogLevel(logLevel),
3829
- onLog,
3883
+ onLog: async (level, log) => onLog(level, log),
3830
3884
  treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
3831
3885
  moduleTypes: inputOptions.moduleTypes,
3832
3886
  define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
@@ -3856,7 +3910,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3856
3910
  preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
3857
3911
  optimization: inputOptions.optimization,
3858
3912
  context: inputOptions.context,
3859
- tsconfig: inputOptions.tsconfig
3913
+ tsconfig: inputOptions.resolve?.tsconfigFilename ?? inputOptions.tsconfig
3860
3914
  };
3861
3915
  }
3862
3916
  function bindingifyHmr(hmr) {
@@ -3867,7 +3921,7 @@ function bindingifyHmr(hmr) {
3867
3921
  }
3868
3922
  function bindingifyAttachDebugInfo(attachDebugInfo) {
3869
3923
  switch (attachDebugInfo) {
3870
- case void 0: return void 0;
3924
+ case void 0: return;
3871
3925
  case "full": return BindingAttachDebugInfo.Full;
3872
3926
  case "simple": return BindingAttachDebugInfo.Simple;
3873
3927
  case "none": return BindingAttachDebugInfo.None;
@@ -4022,7 +4076,7 @@ function bindingifyWatch(watch$1) {
4022
4076
  };
4023
4077
  }
4024
4078
  function bindingifyTreeshakeOptions(config) {
4025
- if (config === false) return void 0;
4079
+ if (config === false) return;
4026
4080
  if (config === true || config === void 0) return { moduleSideEffects: true };
4027
4081
  let normalizedConfig = {
4028
4082
  moduleSideEffects: true,
@@ -4031,6 +4085,24 @@ function bindingifyTreeshakeOptions(config) {
4031
4085
  unknownGlobalSideEffects: config.unknownGlobalSideEffects,
4032
4086
  commonjs: config.commonjs
4033
4087
  };
4088
+ switch (config.propertyReadSideEffects) {
4089
+ case "always":
4090
+ normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.Always;
4091
+ break;
4092
+ case false:
4093
+ normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.False;
4094
+ break;
4095
+ default:
4096
+ }
4097
+ switch (config.propertyWriteSideEffects) {
4098
+ case "always":
4099
+ normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.Always;
4100
+ break;
4101
+ case false:
4102
+ normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.False;
4103
+ break;
4104
+ default:
4105
+ }
4034
4106
  if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
4035
4107
  else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
4036
4108
  external: true,
@@ -4050,7 +4122,7 @@ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative)
4050
4122
  };
4051
4123
  }
4052
4124
  function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
4053
- if (preserveEntrySignatures == void 0) return void 0;
4125
+ if (preserveEntrySignatures == void 0) return;
4054
4126
  else if (typeof preserveEntrySignatures === "string") return {
4055
4127
  type: "String",
4056
4128
  field0: preserveEntrySignatures
@@ -4073,7 +4145,7 @@ async function initializeParallelPlugins(plugins) {
4073
4145
  options
4074
4146
  });
4075
4147
  }
4076
- if (pluginInfos.length <= 0) return void 0;
4148
+ if (pluginInfos.length <= 0) return;
4077
4149
  const count = availableParallelism();
4078
4150
  const parallelJsPluginRegistry = new ParallelJsPluginRegistry(count);
4079
4151
  const registryId = parallelJsPluginRegistry.id;
@@ -4382,8 +4454,7 @@ async function createWatcher(emitter, input) {
4382
4454
  })).flat());
4383
4455
  const notifyOptions = getValidNotifyOption(bundlerOptions);
4384
4456
  const bindingWatcher = new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
4385
- const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
4386
- watcher.start();
4457
+ new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers)).start();
4387
4458
  }
4388
4459
  function getValidNotifyOption(bundlerOptions) {
4389
4460
  let result;
@@ -4415,4 +4486,4 @@ function defineConfig(config) {
4415
4486
  const VERSION = version;
4416
4487
 
4417
4488
  //#endregion
4418
- export { BuiltinPlugin, PluginContextData, PluginDriver, VERSION, assetPlugin, bindingifyPlugin, build, buildImportAnalysisPlugin, createBundlerImpl, createBundlerOptions, defineConfig, description$1 as description, dynamicImportVarsPlugin, esmExternalRequirePlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
4489
+ export { PluginContextData, PluginDriver, VERSION, assetPlugin, bindingifyPlugin, build, buildImportAnalysisPlugin, createBuiltinPlugin, createBundlerImpl, createBundlerOptions, defineConfig, description$1 as description, dynamicImportVarsPlugin, esmExternalRequirePlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown",
3
- "version": "1.0.0-beta.34",
3
+ "version": "1.0.0-beta.36",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "type": "module",
6
6
  "homepage": "https://rolldown.rs/",
@@ -27,33 +27,16 @@
27
27
  "bin": {
28
28
  "rolldown": "./bin/cli.mjs"
29
29
  },
30
- "main": "./dist/index.cjs",
31
- "types": "./dist/index.d.cts",
30
+ "main": "./dist/index.mjs",
31
+ "module": "./dist/index.mjs",
32
+ "types": "./dist/index.d.mts",
32
33
  "exports": {
33
- ".": {
34
- "import": "./dist/index.mjs",
35
- "require": "./dist/index.cjs"
36
- },
37
- "./config": {
38
- "import": "./dist/config.mjs",
39
- "require": "./dist/config.cjs"
40
- },
41
- "./experimental": {
42
- "import": "./dist/experimental-index.mjs",
43
- "require": "./dist/experimental-index.cjs"
44
- },
45
- "./filter": {
46
- "import": "./dist/filter-index.mjs",
47
- "require": "./dist/filter-index.cjs"
48
- },
49
- "./parallelPlugin": {
50
- "import": "./dist/parallel-plugin.mjs",
51
- "require": "./dist/parallel-plugin.cjs"
52
- },
53
- "./parseAst": {
54
- "import": "./dist/parse-ast-index.mjs",
55
- "require": "./dist/parse-ast-index.cjs"
56
- },
34
+ ".": "./dist/index.mjs",
35
+ "./config": "./dist/config.mjs",
36
+ "./experimental": "./dist/experimental-index.mjs",
37
+ "./filter": "./dist/filter-index.mjs",
38
+ "./parallelPlugin": "./dist/parallel-plugin.mjs",
39
+ "./parseAst": "./dist/parse-ast-index.mjs",
57
40
  "./package.json": "./package.json"
58
41
  },
59
42
  "imports": {
@@ -92,10 +75,10 @@
92
75
  "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"
93
76
  },
94
77
  "dependencies": {
95
- "@oxc-project/runtime": "=0.82.3",
96
- "@oxc-project/types": "=0.82.3",
78
+ "@oxc-project/runtime": "=0.87.0",
79
+ "@oxc-project/types": "=0.87.0",
97
80
  "ansis": "^4.0.0",
98
- "@rolldown/pluginutils": "1.0.0-beta.34"
81
+ "@rolldown/pluginutils": "1.0.0-beta.36"
99
82
  },
100
83
  "devDependencies": {
101
84
  "@napi-rs/cli": "^3.1.2",
@@ -108,10 +91,10 @@
108
91
  "emnapi": "^1.2.0",
109
92
  "execa": "^9.2.0",
110
93
  "glob": "^11.0.0",
111
- "oxc-parser": "=0.82.3",
94
+ "oxc-parser": "=0.87.0",
112
95
  "pathe": "^2.0.3",
113
96
  "remeda": "^2.10.0",
114
- "rolldown-plugin-dts": "^0.15.0",
97
+ "rolldown-plugin-dts": "^0.16.0",
115
98
  "rollup": "^4.18.0",
116
99
  "signal-exit": "4.1.0",
117
100
  "source-map": "^0.7.4",
@@ -119,24 +102,26 @@
119
102
  "typedoc": "^0.28.0",
120
103
  "typescript": "^5.7.3",
121
104
  "valibot": "1.1.0",
122
- "rolldown": "1.0.0-beta.34",
123
- "@rolldown/testing": "0.0.1"
105
+ "rolldown": "1.0.0-beta.36"
106
+ },
107
+ "engines": {
108
+ "node": "^20.19.0 || >=22.12.0"
124
109
  },
125
110
  "optionalDependencies": {
126
- "@rolldown/binding-darwin-x64": "1.0.0-beta.34",
127
- "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.34",
128
- "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.34",
129
- "@rolldown/binding-linux-x64-musl": "1.0.0-beta.34",
130
- "@rolldown/binding-freebsd-x64": "1.0.0-beta.34",
131
- "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.34",
132
- "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.34",
133
- "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.34",
134
- "@rolldown/binding-darwin-arm64": "1.0.0-beta.34",
135
- "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.34",
136
- "@rolldown/binding-openharmony-arm64": "1.0.0-beta.34",
137
- "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.34",
138
- "@rolldown/binding-android-arm64": "1.0.0-beta.34",
139
- "@rolldown/binding-wasm32-wasi": "1.0.0-beta.34"
111
+ "@rolldown/binding-darwin-x64": "1.0.0-beta.36",
112
+ "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.36",
113
+ "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.36",
114
+ "@rolldown/binding-linux-x64-musl": "1.0.0-beta.36",
115
+ "@rolldown/binding-freebsd-x64": "1.0.0-beta.36",
116
+ "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.36",
117
+ "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.36",
118
+ "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.36",
119
+ "@rolldown/binding-darwin-arm64": "1.0.0-beta.36",
120
+ "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.36",
121
+ "@rolldown/binding-openharmony-arm64": "1.0.0-beta.36",
122
+ "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.36",
123
+ "@rolldown/binding-android-arm64": "1.0.0-beta.36",
124
+ "@rolldown/binding-wasm32-wasi": "1.0.0-beta.36"
140
125
  },
141
126
  "scripts": {
142
127
  "# Scrips for binding #": "_",