@rolldown/browser 1.0.0-rc.3 → 1.0.0-rc.5

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 (50) hide show
  1. package/dist/cli.mjs +9 -8
  2. package/dist/config.d.mts +1 -1
  3. package/dist/config.mjs +8 -7
  4. package/dist/{constructors-B8gqcrFr.js → constructors-D2wC6vT5.js} +2 -5
  5. package/dist/error-Cqi7XTjG.js +158 -0
  6. package/dist/experimental-index.browser.mjs +61 -32
  7. package/dist/experimental-index.d.mts +74 -29
  8. package/dist/experimental-index.mjs +63 -34
  9. package/dist/filter-index.d.mts +1 -1
  10. package/dist/get-log-filter.d.mts +3 -7
  11. package/dist/index.browser.mjs +3 -2
  12. package/dist/index.d.mts +4 -5
  13. package/dist/index.mjs +8 -7
  14. package/dist/{normalize-string-or-regex-CL-PJZI7.js → normalize-string-or-regex-B0X1hEA4.js} +1 -1
  15. package/dist/parallel-plugin-worker.mjs +4 -3
  16. package/dist/parallel-plugin.d.mts +2 -2
  17. package/dist/parse-ast-index.d.mts +1 -1
  18. package/dist/parse-ast-index.mjs +2 -2
  19. package/dist/plugins-index.browser.mjs +2 -2
  20. package/dist/plugins-index.d.mts +2 -2
  21. package/dist/plugins-index.mjs +2 -2
  22. package/dist/rolldown-binding.wasi-browser.js +4 -0
  23. package/dist/rolldown-binding.wasi.cjs +4 -0
  24. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  25. package/dist/{rolldown-build-D38aLTC9.js → rolldown-build-D_uxS53o.js} +39 -152
  26. package/dist/shared/{bindingify-input-options-C95V1-v7.mjs → bindingify-input-options-CntM6OGD.mjs} +19 -94
  27. package/dist/shared/{constructors-5bt5oBhE.d.mts → constructors-CtryxP-m.d.mts} +3 -4
  28. package/dist/shared/{constructors-BTW-c3jX.mjs → constructors-f9W8MQZ_.mjs} +2 -5
  29. package/dist/shared/{define-config-C3-RX4yW.d.mts → define-config-CMsxCx69.d.mts} +79 -6
  30. package/dist/shared/error-DTJQ7tjB.mjs +89 -0
  31. package/dist/shared/get-log-filter-MhZu4MML.d.mts +7 -0
  32. package/dist/shared/{load-config-By_XBxvI.mjs → load-config-DwB0RYGU.mjs} +1 -1
  33. package/dist/shared/{logs-B2CASPcx.mjs → logs-CCc_0vhs.mjs} +1 -1
  34. package/dist/shared/{normalize-string-or-regex-DIwprzLy.mjs → normalize-string-or-regex-CdT2cmt4.mjs} +1 -1
  35. package/dist/shared/{parse-Dltex8ec.mjs → parse-TCwR4L_P.mjs} +21 -4
  36. package/dist/shared/{rolldown-BMW1SW-b.mjs → rolldown-aTvfnZNF.mjs} +1 -1
  37. package/dist/shared/{rolldown-build-DS1J_xeK.mjs → rolldown-build-Bvz-G_y6.mjs} +23 -8
  38. package/dist/shared/transform-ChAcTNv3.d.mts +92 -0
  39. package/dist/shared/transform-DhHPKnL-.mjs +90 -0
  40. package/dist/shared/{types-B9-K3ZPX.d.mts → types-CMaRlYYn.d.mts} +2 -2
  41. package/dist/shared/{watch-BvXJc2Ra.mjs → watch-BWJtu1lP.mjs} +4 -3
  42. package/dist/transform-BQei0Mty.js +90 -0
  43. package/dist/utils-index.browser.mjs +2405 -0
  44. package/dist/utils-index.d.mts +350 -0
  45. package/dist/utils-index.mjs +2406 -0
  46. package/package.json +1 -1
  47. /package/dist/shared/{define-config-Dlptvz3X.mjs → define-config-BVG4QvnP.mjs} +0 -0
  48. /package/dist/shared/{logging-RB67zQ4N.d.mts → logging-C28dTP71.d.mts} +0 -0
  49. /package/dist/shared/{prompt-CYPmuhh-.mjs → prompt-BcvPElI8.mjs} +0 -0
  50. /package/dist/shared/{utils-CqMTwlsR.d.mts → utils-DOXNRW_3.d.mts} +0 -0
@@ -1,13 +1,14 @@
1
- import { a as logInvalidLogPosition, c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-B2CASPcx.mjs";
2
- import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-DIwprzLy.mjs";
1
+ import { a as logInvalidLogPosition, c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-CCc_0vhs.mjs";
2
+ import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CdT2cmt4.mjs";
3
3
  import { _ as noop, a as id, b as unsupported, f as or, h as arraify, n as code, r as exclude, s as include, t as and, u as moduleType, y as unreachable } from "./composable-filters-CIxSuZSM.mjs";
4
+ import { a as bindingifySourcemap, i as unwrapBindingResult, t as aggregateBindingErrorsIntoJsError } from "./error-DTJQ7tjB.mjs";
4
5
  import { parseAst } from "../parse-ast-index.mjs";
5
6
  import { BindingAttachDebugInfo, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects } from "../rolldown-binding.wasi.cjs";
6
7
  import path from "node:path";
7
8
  import fsp from "node:fs/promises";
8
9
 
9
10
  //#region package.json
10
- var version = "1.0.0-rc.3";
11
+ var version = "1.0.0-rc.5";
11
12
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
12
13
 
13
14
  //#endregion
@@ -226,7 +227,7 @@ function bindingAssetSource(source) {
226
227
  }
227
228
 
228
229
  //#endregion
229
- //#region \0@oxc-project+runtime@0.112.0/helpers/decorate.js
230
+ //#region \0@oxc-project+runtime@0.114.0/helpers/decorate.js
230
231
  function __decorate(decorators, target, key, desc) {
231
232
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
232
233
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -414,22 +415,6 @@ __decorate([lazyProp], OutputChunkImpl.prototype, "dynamicImports", null);
414
415
  __decorate([lazyProp], OutputChunkImpl.prototype, "moduleIds", null);
415
416
  __decorate([lazyProp], OutputChunkImpl.prototype, "map", null);
416
417
 
417
- //#endregion
418
- //#region src/types/sourcemap.ts
419
- function bindingifySourcemap(map) {
420
- if (map == null) return;
421
- return { inner: typeof map === "string" ? map : {
422
- file: map.file ?? void 0,
423
- mappings: map.mappings,
424
- sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
425
- sources: map.sources?.map((s) => s ?? void 0),
426
- sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
427
- names: map.names,
428
- x_google_ignoreList: map.x_google_ignoreList,
429
- debugId: "debugId" in map ? map.debugId : void 0
430
- } };
431
- }
432
-
433
418
  //#endregion
434
419
  //#region src/utils/transform-to-rollup-output.ts
435
420
  function transformToRollupSourceMap(map) {
@@ -590,76 +575,6 @@ function collectChangedBundle(changed, bundle) {
590
575
  };
591
576
  }
592
577
 
593
- //#endregion
594
- //#region src/utils/error.ts
595
- function unwrapBindingResult(container) {
596
- if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
597
- return container;
598
- }
599
- function normalizeBindingResult(container) {
600
- if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
601
- return container;
602
- }
603
- function normalizeBindingError(e) {
604
- return e.type === "JsError" ? e.field0 : Object.assign(/* @__PURE__ */ new Error(), {
605
- code: e.field0.kind,
606
- kind: e.field0.kind,
607
- message: e.field0.message,
608
- id: e.field0.id,
609
- exporter: e.field0.exporter,
610
- loc: e.field0.loc,
611
- pos: e.field0.pos,
612
- stack: void 0
613
- });
614
- }
615
- function aggregateBindingErrorsIntoJsError(rawErrors) {
616
- const errors = rawErrors.map(normalizeBindingError);
617
- let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
618
- for (let i = 0; i < errors.length; i++) {
619
- summary += "\n";
620
- if (i >= 5) {
621
- summary += "...";
622
- break;
623
- }
624
- summary += getErrorMessage(errors[i]);
625
- }
626
- const wrapper = new Error(summary);
627
- Object.defineProperty(wrapper, "errors", {
628
- configurable: true,
629
- enumerable: true,
630
- get: () => errors,
631
- set: (value) => Object.defineProperty(wrapper, "errors", {
632
- configurable: true,
633
- enumerable: true,
634
- value
635
- })
636
- });
637
- return wrapper;
638
- }
639
- function getErrorMessage(e) {
640
- if (Object.hasOwn(e, "kind")) return e.message;
641
- let s = "";
642
- if (e.plugin) s += `[plugin ${e.plugin}]`;
643
- const id = e.id ?? e.loc?.file;
644
- if (id) {
645
- s += " " + id;
646
- if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
647
- }
648
- if (s) s += "\n";
649
- const message = `${e.name ?? "Error"}: ${e.message}`;
650
- s += message;
651
- if (e.frame) s = joinNewLine(s, e.frame);
652
- if (e.stack) s = joinNewLine(s, e.stack.replace(message, ""));
653
- if (e.cause) {
654
- s = joinNewLine(s, "Caused by:");
655
- s = joinNewLine(s, getErrorMessage(e.cause).split("\n").map((line) => " " + line).join("\n"));
656
- }
657
- return s;
658
- }
659
- function joinNewLine(s1, s2) {
660
- return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
661
- }
662
-
663
578
  //#endregion
664
579
  //#region src/utils/transform-module-info.ts
665
580
  function transformModuleInfo(info, option) {
@@ -677,6 +592,7 @@ function transformModuleInfo(info, option) {
677
592
  dynamicallyImportedIds: info.dynamicallyImportedIds,
678
593
  exports: info.exports,
679
594
  isEntry: info.isEntry,
595
+ inputFormat: info.inputFormat,
680
596
  ...option
681
597
  };
682
598
  }
@@ -697,7 +613,7 @@ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
697
613
  }
698
614
 
699
615
  //#endregion
700
- //#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
616
+ //#region ../../node_modules/.pnpm/remeda@2.33.6/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
701
617
  function e(e, t, n) {
702
618
  let r = (n) => e(n, ...t);
703
619
  return n === void 0 ? r : Object.assign(r, {
@@ -707,7 +623,7 @@ function e(e, t, n) {
707
623
  }
708
624
 
709
625
  //#endregion
710
- //#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/purry-GjwKKIlp.js
626
+ //#region ../../node_modules/.pnpm/remeda@2.33.6/node_modules/remeda/dist/purry.js
711
627
  function t$1(t, n, r) {
712
628
  let i = t.length - n.length;
713
629
  if (i === 0) return t(...n);
@@ -716,7 +632,7 @@ function t$1(t, n, r) {
716
632
  }
717
633
 
718
634
  //#endregion
719
- //#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/partition.js
635
+ //#region ../../node_modules/.pnpm/remeda@2.33.6/node_modules/remeda/dist/partition.js
720
636
  function t(...t) {
721
637
  return t$1(n, t);
722
638
  }
@@ -1830,6 +1746,14 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
1830
1746
  get legalComments() {
1831
1747
  return this.inner.legalComments;
1832
1748
  }
1749
+ get comments() {
1750
+ const c = this.inner.comments;
1751
+ return {
1752
+ legal: c.legal ?? true,
1753
+ annotation: c.annotation ?? true,
1754
+ jsdoc: c.jsdoc ?? true
1755
+ };
1756
+ }
1833
1757
  get polyfillRequire() {
1834
1758
  return this.inner.polyfillRequire;
1835
1759
  }
@@ -1885,6 +1809,7 @@ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapIgnoreLi
1885
1809
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapPathTransform", null);
1886
1810
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "minify", null);
1887
1811
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "legalComments", null);
1812
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "comments", null);
1888
1813
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "polyfillRequire", null);
1889
1814
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "plugins", null);
1890
1815
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "preserveModules", null);
@@ -2252,4 +2177,4 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
2252
2177
  }
2253
2178
 
2254
2179
  //#endregion
2255
- export { RUNTIME_MODULE_ID as C, version as E, logLevelPriority as S, description as T, normalizeLog as _, aggregateBindingErrorsIntoJsError as a, LOG_LEVEL_INFO as b, transformToRollupOutput as c, __decorate as d, transformAssetSource as f, normalizeHook as g, MinimalPluginContextImpl as h, transformModuleInfo as i, bindingifySourcemap as l, PlainObjectLike as m, PluginContextData as n, normalizeBindingResult as o, lazyProp as p, bindingifyPlugin as r, unwrapBindingResult as s, bindingifyInputOptions as t, transformRenderedChunk as u, LOG_LEVEL_DEBUG as v, VERSION as w, LOG_LEVEL_WARN as x, LOG_LEVEL_ERROR as y };
2180
+ export { version as S, LOG_LEVEL_WARN as _, transformToRollupOutput as a, VERSION as b, transformAssetSource as c, MinimalPluginContextImpl as d, normalizeHook as f, LOG_LEVEL_INFO as g, LOG_LEVEL_ERROR as h, transformModuleInfo as i, lazyProp as l, LOG_LEVEL_DEBUG as m, PluginContextData as n, transformRenderedChunk as o, normalizeLog as p, bindingifyPlugin as r, __decorate as s, bindingifyInputOptions as t, PlainObjectLike as u, logLevelPriority as v, description as x, RUNTIME_MODULE_ID as y };
@@ -1,5 +1,5 @@
1
- import { s as StringOrRegExp, t as BuiltinPlugin } from "./utils-CqMTwlsR.mjs";
2
- import { BindingEsmExternalRequirePluginConfig, BindingIsolatedDeclarationPluginConfig, BindingViteBuildImportAnalysisPluginConfig, BindingViteDynamicImportVarsPluginConfig, BindingViteImportGlobPluginConfig, BindingViteJsonPluginConfig, BindingViteModulePreloadPolyfillPluginConfig, BindingViteReactRefreshWrapperPluginConfig, BindingViteReporterPluginConfig, BindingViteResolvePluginConfig, BindingViteWasmHelperPluginConfig } from "../binding.cjs";
1
+ import { s as StringOrRegExp, t as BuiltinPlugin } from "./utils-DOXNRW_3.mjs";
2
+ import { BindingEsmExternalRequirePluginConfig, BindingIsolatedDeclarationPluginConfig, BindingViteBuildImportAnalysisPluginConfig, BindingViteDynamicImportVarsPluginConfig, BindingViteImportGlobPluginConfig, BindingViteJsonPluginConfig, BindingViteModulePreloadPolyfillPluginConfig, BindingViteReactRefreshWrapperPluginConfig, BindingViteReporterPluginConfig, BindingViteResolvePluginConfig } from "../binding.cjs";
3
3
 
4
4
  //#region src/builtin-plugin/constructors.d.ts
5
5
  declare function viteModulePreloadPolyfillPlugin(config?: BindingViteModulePreloadPolyfillPluginConfig): BuiltinPlugin;
@@ -10,7 +10,6 @@ type DynamicImportVarsPluginConfig = Omit<BindingViteDynamicImportVarsPluginConf
10
10
  declare function viteDynamicImportVarsPlugin(config?: DynamicImportVarsPluginConfig): BuiltinPlugin;
11
11
  declare function viteImportGlobPlugin(config?: BindingViteImportGlobPluginConfig): BuiltinPlugin;
12
12
  declare function viteReporterPlugin(config: BindingViteReporterPluginConfig): BuiltinPlugin;
13
- declare function viteWasmHelperPlugin(config: BindingViteWasmHelperPluginConfig): BuiltinPlugin;
14
13
  declare function viteWasmFallbackPlugin(): BuiltinPlugin;
15
14
  declare function viteLoadFallbackPlugin(): BuiltinPlugin;
16
15
  declare function viteJsonPlugin(config: BindingViteJsonPluginConfig): BuiltinPlugin;
@@ -25,4 +24,4 @@ type ViteReactRefreshWrapperPluginConfig = Omit<BindingViteReactRefreshWrapperPl
25
24
  };
26
25
  declare function viteReactRefreshWrapperPlugin(config: ViteReactRefreshWrapperPluginConfig): BuiltinPlugin;
27
26
  //#endregion
28
- export { viteImportGlobPlugin as a, viteModulePreloadPolyfillPlugin as c, viteResolvePlugin as d, viteWasmFallbackPlugin as f, viteDynamicImportVarsPlugin as i, viteReactRefreshWrapperPlugin as l, viteWebWorkerPostPlugin as m, isolatedDeclarationPlugin as n, viteJsonPlugin as o, viteWasmHelperPlugin as p, viteBuildImportAnalysisPlugin as r, viteLoadFallbackPlugin as s, esmExternalRequirePlugin as t, viteReporterPlugin as u };
27
+ export { viteImportGlobPlugin as a, viteModulePreloadPolyfillPlugin as c, viteResolvePlugin as d, viteWasmFallbackPlugin as f, viteDynamicImportVarsPlugin as i, viteReactRefreshWrapperPlugin as l, isolatedDeclarationPlugin as n, viteJsonPlugin as o, viteWebWorkerPostPlugin as p, viteBuildImportAnalysisPlugin as r, viteLoadFallbackPlugin as s, esmExternalRequirePlugin as t, viteReporterPlugin as u };
@@ -1,4 +1,4 @@
1
- import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-DIwprzLy.mjs";
1
+ import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CdT2cmt4.mjs";
2
2
 
3
3
  //#region src/builtin-plugin/constructors.ts
4
4
  function viteModulePreloadPolyfillPlugin(config) {
@@ -17,9 +17,6 @@ function viteImportGlobPlugin(config) {
17
17
  function viteReporterPlugin(config) {
18
18
  return new BuiltinPlugin("builtin:vite-reporter", config);
19
19
  }
20
- function viteWasmHelperPlugin(config) {
21
- return new BuiltinPlugin("builtin:vite-wasm-helper", config);
22
- }
23
20
  function viteWasmFallbackPlugin() {
24
21
  return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-wasm-fallback"));
25
22
  }
@@ -58,4 +55,4 @@ function viteReactRefreshWrapperPlugin(config) {
58
55
  }
59
56
 
60
57
  //#endregion
61
- export { viteImportGlobPlugin as a, viteModulePreloadPolyfillPlugin as c, viteResolvePlugin as d, viteWasmFallbackPlugin as f, viteDynamicImportVarsPlugin as i, viteReactRefreshWrapperPlugin as l, viteWebWorkerPostPlugin as m, isolatedDeclarationPlugin as n, viteJsonPlugin as o, viteWasmHelperPlugin as p, viteBuildImportAnalysisPlugin as r, viteLoadFallbackPlugin as s, esmExternalRequirePlugin as t, viteReporterPlugin as u };
58
+ export { viteImportGlobPlugin as a, viteModulePreloadPolyfillPlugin as c, viteResolvePlugin as d, viteWasmFallbackPlugin as f, viteDynamicImportVarsPlugin as i, viteReactRefreshWrapperPlugin as l, isolatedDeclarationPlugin as n, viteJsonPlugin as o, viteWebWorkerPostPlugin as p, viteBuildImportAnalysisPlugin as r, viteLoadFallbackPlugin as s, esmExternalRequirePlugin as t, viteReporterPlugin as u };
@@ -1,8 +1,9 @@
1
- import { a as RolldownLog, i as RolldownError, n as LogLevelOption, o as RolldownLogWithString, r as LogOrStringHandler, t as LogLevel } from "./logging-RB67zQ4N.mjs";
2
- import { t as Program } from "./types-B9-K3ZPX.mjs";
3
- import { a as NullValue, i as MaybePromise, n as MakeAsync, o as PartialNull, r as MaybeArray, s as StringOrRegExp$1, t as BuiltinPlugin } from "./utils-CqMTwlsR.mjs";
1
+ import { a as RolldownLog, i as RolldownError, n as LogLevelOption, o as RolldownLogWithString, r as LogOrStringHandler, t as LogLevel } from "./logging-C28dTP71.mjs";
2
+ import { Dt as Program } from "./types-CMaRlYYn.mjs";
3
+ import { a as NullValue, i as MaybePromise, n as MakeAsync, o as PartialNull, r as MaybeArray, s as StringOrRegExp$1, t as BuiltinPlugin } from "./utils-DOXNRW_3.mjs";
4
4
  import { BindingHookResolveIdExtraArgs, BindingMagicString, BindingPluginContextResolveOptions, BindingRenderedChunk, BindingTransformHookExtraArgs, ExternalMemoryStatus, JsxOptions, MinifyOptions, ParserOptions, PreRenderedChunk, TransformOptions } from "../binding.cjs";
5
5
  import { BindingWatcherBundler } from "../../binding.cjs";
6
+ import { BindingMagicString as BindingMagicString$1, PreRenderedChunk as PreRenderedChunk$1 } from "./binding.cjs";
6
7
 
7
8
  //#region src/types/misc.d.ts
8
9
  /** @inline */
@@ -51,6 +52,16 @@ interface ModuleInfo extends ModuleOptions {
51
52
  * Whether this module is a user- or plugin-defined entry point.
52
53
  */
53
54
  isEntry: boolean;
55
+ /**
56
+ * The detected format of the module, based on both its syntax and module definition
57
+ * metadata (such as `package.json` `type` and file extensions like `.mjs`/`.cjs`/`.mts`/`.cts`).
58
+ * - "esm" for ES modules (has `import`/`export` statements or is defined as ESM by module metadata)
59
+ * - "cjs" for CommonJS modules (uses `module.exports`, `exports`, top-level `return`, or is defined as CommonJS by module metadata)
60
+ * - "unknown" when the format could not be determined from either syntax or module definition metadata
61
+ *
62
+ * @experimental
63
+ */
64
+ inputFormat: "es" | "cjs" | "unknown";
54
65
  }
55
66
  //#endregion
56
67
  //#region src/utils/asset-source.d.ts
@@ -304,6 +315,11 @@ type CodeSplittingNameFunction = (moduleId: string, ctx: ChunkingContext) => str
304
315
  /** @inline */
305
316
  type CodeSplittingTestFunction = (id: string) => boolean | undefined | void;
306
317
  type MinifyOptions$1 = Omit<MinifyOptions, "module" | "sourcemap">;
318
+ interface CommentsOptions {
319
+ legal?: boolean;
320
+ annotation?: boolean;
321
+ jsdoc?: boolean;
322
+ }
307
323
  /** @inline */
308
324
  interface ChunkingContext {
309
325
  getModuleInfo(moduleId: string): ModuleInfo | null;
@@ -351,7 +367,7 @@ interface OutputOptions {
351
367
  * - `'iife'` stands for [Immediately Invoked Function Expression](https://developer.mozilla.org/en-US/docs/Glossary/IIFE).
352
368
  * - `'umd'` stands for [Universal Module Definition](https://github.com/umdjs/umd).
353
369
  *
354
- * @default 'esm'
370
+ * @default 'es'
355
371
  *
356
372
  *
357
373
  */
@@ -802,6 +818,24 @@ interface OutputOptions {
802
818
  */
803
819
  legalComments?: "none" | "inline";
804
820
  /**
821
+ * Control which comments are preserved in the output.
822
+ *
823
+ * - `true`: Preserve legal, annotation, and JSDoc comments (default)
824
+ * - `false`: Strip all comments
825
+ * - Object: Granular control over comment categories
826
+ * - `legal`: `@license`, `@preserve`, `//!`, `/*!`
827
+ * - `annotation`: `@__PURE__`, `@__NO_SIDE_EFFECTS__`, `@vite-ignore`
828
+ * - `jsdoc`: JSDoc comments
829
+ *
830
+ * Note: Regular line and block comments without these markers
831
+ * are always removed regardless of this option.
832
+ *
833
+ * When both `legalComments` and `comments.legal` are set, `comments.legal` takes priority.
834
+ *
835
+ * @default true
836
+ */
837
+ comments?: boolean | CommentsOptions;
838
+ /**
805
839
  * The list of plugins to use only for this output.
806
840
  *
807
841
  * @see {@linkcode InputOptions.plugins | plugins}
@@ -1023,6 +1057,36 @@ type CodeSplittingGroup = {
1023
1057
  * @default 0
1024
1058
  */
1025
1059
  minModuleSize?: number;
1060
+ /**
1061
+ * When `false` (default), all matching modules are merged into a single chunk.
1062
+ * Every entry that uses any of these modules must load the entire chunk — even
1063
+ * modules it doesn't need.
1064
+ *
1065
+ * When `true`, matching modules are grouped by which entries actually import them.
1066
+ * Modules shared by the same set of entries go into the same chunk, while modules
1067
+ * shared by a different set go into a separate chunk. This way, each entry only
1068
+ * loads the code it actually uses.
1069
+ *
1070
+ * Example: entries A, B, C all match a `"vendor"` group.
1071
+ * - `moduleX` is used by A, B, C
1072
+ * - `moduleY` is used by A, B only
1073
+ *
1074
+ * With `entriesAware: false` → one `vendor.js` chunk with both modules; C loads `moduleY` unnecessarily.
1075
+ * With `entriesAware: true` → `vendor.js` (moduleX, loaded by all) + `vendor2.js` (moduleY, loaded by A and B only).
1076
+ *
1077
+ * @default false
1078
+ */
1079
+ entriesAware?: boolean;
1080
+ /**
1081
+ * Size threshold in bytes for merging small `entriesAware` subgroups into the
1082
+ * closest neighboring subgroup.
1083
+ *
1084
+ * This option only works when {@linkcode CodeSplittingGroup.entriesAware | entriesAware}
1085
+ * is `true`. Set to `0` to disable subgroup merging.
1086
+ *
1087
+ * @default 0
1088
+ */
1089
+ entriesAwareMergeThreshold?: number;
1026
1090
  };
1027
1091
  /**
1028
1092
  * Alias for {@linkcode CodeSplittingGroup}. Use this type for the `codeSplitting.groups` option.
@@ -1457,6 +1521,11 @@ interface ChecksOptions {
1457
1521
  * @default true
1458
1522
  * */
1459
1523
  unsupportedTsconfigOption?: boolean;
1524
+ /**
1525
+ * Whether to emit warnings when a module is dynamically imported but also statically imported, making the dynamic import ineffective for code splitting.
1526
+ * @default true
1527
+ * */
1528
+ ineffectiveDynamicImport?: boolean;
1460
1529
  }
1461
1530
  //#endregion
1462
1531
  //#region src/options/transform-options.d.ts
@@ -1660,6 +1729,8 @@ interface NormalizedOutputOptions {
1660
1729
  minify: false | MinifyOptions$1 | "dce-only";
1661
1730
  /** @see {@linkcode OutputOptions.legalComments | legalComments} */
1662
1731
  legalComments: "none" | "inline";
1732
+ /** @see {@linkcode OutputOptions.comments | comments} */
1733
+ comments: Required<CommentsOptions>;
1663
1734
  /** @see {@linkcode OutputOptions.polyfillRequire | polyfillRequire} */
1664
1735
  polyfillRequire: boolean;
1665
1736
  /** @see {@linkcode OutputOptions.plugins | plugins} */
@@ -2284,7 +2355,7 @@ type TreeshakingOptions = {
2284
2355
  *
2285
2356
  * See [related Oxc documentation](https://oxc.rs/docs/guide/usage/minifier/dead-code-elimination#ignoring-invalid-import-statement-side-effects) for more details.
2286
2357
  *
2287
- * @default true
2358
+ * @default false
2288
2359
  */
2289
2360
  invalidImportSideEffects?: boolean;
2290
2361
  /**
@@ -2708,6 +2779,8 @@ interface FunctionPluginHooks {
2708
2779
  *
2709
2780
  * You can use {@linkcode PluginContext.getModuleInfo | this.getModuleInfo()} to find out the previous values of `meta`, `moduleSideEffects` inside this hook.
2710
2781
  *
2782
+ *
2783
+ *
2711
2784
  * @group Build Hooks
2712
2785
  */
2713
2786
  [DEFINED_HOOK_NAMES.transform]: (this: TransformPluginContext, code: string, id: string, meta: BindingTransformHookExtraArgs & {
@@ -3686,4 +3759,4 @@ declare function defineConfig(config: RolldownOptions[]): RolldownOptions[];
3686
3759
  declare function defineConfig(config: RolldownOptionsFunction): RolldownOptionsFunction;
3687
3760
  declare function defineConfig(config: ConfigExport): ConfigExport;
3688
3761
  //#endregion
3689
- export { SourceMapInput as $, OutputChunk as $t, TransformResult as A, RolldownWatcherEvent as At, id as B, ChunkFileNamesFunction as Bt, Plugin as C, NormalizedInputOptions as Ct, RolldownPlugin as D, WarningHandlerWithDefault as Dt, ResolvedId as E, LoggingFunction as Et, TopLevelFilterExpression as F, BuildOptions as Ft, moduleType as G, GeneratedCodeOptions as Gt, include as H, CodeSplittingGroup as Ht, and as I, build as It, queries as J, MinifyOptions$1 as Jt, not as K, GeneratedCodePreset as Kt, code as L, AddonFunction as Lt, FilterExpression as M, WatchOptions as Mt, FilterExpressionKind as N, rolldown as Nt, RolldownPluginOption as O, watch as Ot, QueryFilterObject as P, RolldownBuild as Pt, ExistingRawSourceMap as Q, OutputAsset as Qt, exclude as R, AdvancedChunksGroup as Rt, PartialResolvedId as S, NormalizedOutputOptions as St, ResolveIdResult as T, ChecksOptions as Tt, interpreter as U, CodeSplittingNameFunction as Ut, importerId as V, ChunkingContext as Vt, interpreterImpl as W, CodeSplittingOptions as Wt, RUNTIME_MODULE_ID as X, OutputOptions as Xt, query as Y, ModuleFormat as Yt, VERSION as Z, PreRenderedAsset as Zt, LoadResult as _, BufferEncoding as _t, ExternalOption as a, ModuleInfo as an, EmittedFile as at, ObjectHook as b, RolldownFsModule as bt, InputOptions as c, PluginContext as ct, WatcherOptions as d, defineParallelPlugin as dt, RenderedChunk as en, OutputBundle as et, AsyncPluginHooks as f, MinimalPluginContext as ft, ImportKind as g, ModuleTypeFilter as gt, HookFilterExtension as h, HookFilter as ht, RolldownOptions as i, freeExternalMemory as in, EmittedChunk as it, withFilter as j, RolldownWatcherWatcherEventMap as jt, SourceDescription as k, RolldownWatcher as kt, ModuleTypes as l, PluginContextResolveOptions as lt, FunctionPluginHooks as m, GeneralHookFilter as mt, RolldownOptionsFunction as n, RolldownOutput as nn, TransformPluginContext as nt, ExternalOptionFunction as o, SourcemapIgnoreListOption as on, EmittedPrebuiltChunk as ot, CustomPluginOptions as p, PluginContextMeta as pt, or as q, GlobalsFunction as qt, defineConfig as r, SourceMap$1 as rn, EmittedAsset as rt, InputOption as s, GetModuleInfo as st, ConfigExport as t, RenderedModule as tn, TreeshakingOptions as tt, OptimizationOptions as u, DefineParallelPluginResult as ut, ModuleOptions as v, RolldownDirectoryEntry as vt, ResolveIdExtraOptions as w, TransformOptions$1 as wt, ParallelPluginHooks as x, InternalModuleFormat as xt, ModuleType as y, RolldownFileStats as yt, exprInterpreter as z, AdvancedChunksOptions as zt };
3762
+ export { VERSION as $, OutputOptions as $t, TransformResult as A, watch as At, id as B, AdvancedChunksGroup as Bt, Plugin as C, InternalModuleFormat as Ct, RolldownPlugin as D, ChecksOptions as Dt, ResolvedId as E, TransformOptions$1 as Et, TopLevelFilterExpression as F, rolldown as Ft, moduleType as G, CodeSplittingNameFunction as Gt, include as H, ChunkFileNamesFunction as Ht, and as I, RolldownBuild as It, queries as J, GeneratedCodeOptions as Jt, not as K, CodeSplittingOptions as Kt, code as L, BuildOptions as Lt, FilterExpression as M, RolldownWatcherEvent as Mt, FilterExpressionKind as N, RolldownWatcherWatcherEventMap as Nt, RolldownPluginOption as O, LoggingFunction as Ot, QueryFilterObject as P, WatchOptions as Pt, RUNTIME_MODULE_ID as Q, ModuleFormat as Qt, exclude as R, build as Rt, PartialResolvedId as S, RolldownFsModule as St, ResolveIdResult as T, NormalizedInputOptions as Tt, interpreter as U, ChunkingContext as Ut, importerId as V, AdvancedChunksOptions as Vt, interpreterImpl as W, CodeSplittingGroup as Wt, BindingMagicString$1 as X, GlobalsFunction as Xt, query as Y, GeneratedCodePreset as Yt, PreRenderedChunk$1 as Z, MinifyOptions$1 as Zt, LoadResult as _, HookFilter as _t, ExternalOption as a, RolldownOutput as an, EmittedAsset as at, ObjectHook as b, RolldownDirectoryEntry as bt, InputOptions as c, ModuleInfo as cn, EmittedPrebuiltChunk as ct, WatcherOptions as d, PluginContextResolveOptions as dt, PreRenderedAsset as en, ExistingRawSourceMap as et, AsyncPluginHooks as f, DefineParallelPluginResult as ft, ImportKind as g, GeneralHookFilter as gt, HookFilterExtension as h, PluginContextMeta as ht, RolldownOptions as i, RenderedModule as in, TransformPluginContext as it, withFilter as j, RolldownWatcher as jt, SourceDescription as k, WarningHandlerWithDefault as kt, ModuleTypes as l, SourcemapIgnoreListOption as ln, GetModuleInfo as lt, FunctionPluginHooks as m, MinimalPluginContext as mt, RolldownOptionsFunction as n, OutputChunk as nn, OutputBundle as nt, ExternalOptionFunction as o, SourceMap$1 as on, EmittedChunk as ot, CustomPluginOptions as p, defineParallelPlugin as pt, or as q, CommentsOptions as qt, defineConfig as r, RenderedChunk as rn, TreeshakingOptions as rt, InputOption as s, freeExternalMemory as sn, EmittedFile as st, ConfigExport as t, OutputAsset as tn, SourceMapInput as tt, OptimizationOptions as u, PluginContext as ut, ModuleOptions as v, ModuleTypeFilter as vt, ResolveIdExtraOptions as w, NormalizedOutputOptions as wt, ParallelPluginHooks as x, RolldownFileStats as xt, ModuleType as y, BufferEncoding as yt, exprInterpreter as z, AddonFunction as zt };
@@ -0,0 +1,89 @@
1
+ import "../rolldown-binding.wasi.cjs";
2
+
3
+ //#region src/types/sourcemap.ts
4
+ function bindingifySourcemap(map) {
5
+ if (map == null) return;
6
+ return { inner: typeof map === "string" ? map : {
7
+ file: map.file ?? void 0,
8
+ mappings: map.mappings,
9
+ sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
10
+ sources: map.sources?.map((s) => s ?? void 0),
11
+ sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
12
+ names: map.names,
13
+ x_google_ignoreList: map.x_google_ignoreList,
14
+ debugId: "debugId" in map ? map.debugId : void 0
15
+ } };
16
+ }
17
+
18
+ //#endregion
19
+ //#region src/utils/error.ts
20
+ function unwrapBindingResult(container) {
21
+ if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
22
+ return container;
23
+ }
24
+ function normalizeBindingResult(container) {
25
+ if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
26
+ return container;
27
+ }
28
+ function normalizeBindingError(e) {
29
+ return e.type === "JsError" ? e.field0 : Object.assign(/* @__PURE__ */ new Error(), {
30
+ code: e.field0.kind,
31
+ kind: e.field0.kind,
32
+ message: e.field0.message,
33
+ id: e.field0.id,
34
+ exporter: e.field0.exporter,
35
+ loc: e.field0.loc,
36
+ pos: e.field0.pos,
37
+ stack: void 0
38
+ });
39
+ }
40
+ function aggregateBindingErrorsIntoJsError(rawErrors) {
41
+ const errors = rawErrors.map(normalizeBindingError);
42
+ let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
43
+ for (let i = 0; i < errors.length; i++) {
44
+ summary += "\n";
45
+ if (i >= 5) {
46
+ summary += "...";
47
+ break;
48
+ }
49
+ summary += getErrorMessage(errors[i]);
50
+ }
51
+ const wrapper = new Error(summary);
52
+ Object.defineProperty(wrapper, "errors", {
53
+ configurable: true,
54
+ enumerable: true,
55
+ get: () => errors,
56
+ set: (value) => Object.defineProperty(wrapper, "errors", {
57
+ configurable: true,
58
+ enumerable: true,
59
+ value
60
+ })
61
+ });
62
+ return wrapper;
63
+ }
64
+ function getErrorMessage(e) {
65
+ if (Object.hasOwn(e, "kind")) return e.message;
66
+ let s = "";
67
+ if (e.plugin) s += `[plugin ${e.plugin}]`;
68
+ const id = e.id ?? e.loc?.file;
69
+ if (id) {
70
+ s += " " + id;
71
+ if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
72
+ }
73
+ if (s) s += "\n";
74
+ const message = `${e.name ?? "Error"}: ${e.message}`;
75
+ s += message;
76
+ if (e.frame) s = joinNewLine(s, e.frame);
77
+ if (e.stack) s = joinNewLine(s, e.stack.replace(message, ""));
78
+ if (e.cause) {
79
+ s = joinNewLine(s, "Caused by:");
80
+ s = joinNewLine(s, getErrorMessage(e.cause).split("\n").map((line) => " " + line).join("\n"));
81
+ }
82
+ return s;
83
+ }
84
+ function joinNewLine(s1, s2) {
85
+ return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
86
+ }
87
+
88
+ //#endregion
89
+ export { bindingifySourcemap as a, unwrapBindingResult as i, normalizeBindingError as n, normalizeBindingResult as r, aggregateBindingErrorsIntoJsError as t };
@@ -0,0 +1,7 @@
1
+ import { a as RolldownLog } from "./logging-C28dTP71.mjs";
2
+
3
+ //#region src/get-log-filter.d.ts
4
+ type GetLogFilter = (filters: string[]) => (log: RolldownLog) => boolean;
5
+ declare const getLogFilter: GetLogFilter;
6
+ //#endregion
7
+ export { getLogFilter as n, GetLogFilter as t };
@@ -1,4 +1,4 @@
1
- import { t as rolldown } from "./rolldown-BMW1SW-b.mjs";
1
+ import { t as rolldown } from "./rolldown-aTvfnZNF.mjs";
2
2
  import path from "node:path";
3
3
  import { readdir } from "node:fs/promises";
4
4
  import { cwd } from "node:process";
@@ -148,7 +148,7 @@ function error(base) {
148
148
  if (!(base instanceof Error)) {
149
149
  base = Object.assign(new Error(base.message), base);
150
150
  Object.defineProperty(base, "name", {
151
- value: "RollupError",
151
+ value: "RolldownError",
152
152
  writable: true
153
153
  });
154
154
  }
@@ -1,4 +1,4 @@
1
- import { c as logPluginError, n as error } from "./logs-B2CASPcx.mjs";
1
+ import { c as logPluginError, n as error } from "./logs-CCc_0vhs.mjs";
2
2
  import { BindingCallableBuiltinPlugin } from "../rolldown-binding.wasi.cjs";
3
3
 
4
4
  //#region src/builtin-plugin/utils.ts
@@ -1,6 +1,6 @@
1
1
  import { parse, parseSync } from "../rolldown-binding.wasi.cjs";
2
2
 
3
- //#region ../../node_modules/.pnpm/oxc-parser@0.112.0/node_modules/oxc-parser/src-js/wrap.js
3
+ //#region ../../node_modules/.pnpm/oxc-parser@0.114.0/node_modules/oxc-parser/src-js/wrap.js
4
4
  function wrap(result) {
5
5
  let program, module, comments, errors;
6
6
  return {
@@ -39,14 +39,31 @@ function applyFix(program, fixPath) {
39
39
  //#endregion
40
40
  //#region src/utils/parse.ts
41
41
  /**
42
- * Parse asynchronously.
42
+ * Parse JS/TS source asynchronously on a separate thread.
43
43
  *
44
- * Note: This function can be slower than `parseSync` due to the overhead of spawning a thread.
44
+ * Note that not all of the workload can happen on a separate thread.
45
+ * Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
46
+ * has to happen on current thread. This synchronous deserialization work typically outweighs
47
+ * the asynchronous parsing by a factor of between 3 and 20.
48
+ *
49
+ * i.e. the majority of the workload cannot be parallelized by using this method.
50
+ *
51
+ * Generally `parseSync` is preferable to use as it does not have the overhead of spawning a thread.
52
+ * If you need to parallelize parsing multiple files, it is recommended to use worker threads.
45
53
  */
46
54
  async function parse$1(filename, sourceText, options) {
47
55
  return wrap(await parse(filename, sourceText, options));
48
56
  }
49
- /** Parse synchronously. */
57
+ /**
58
+ * Parse JS/TS source synchronously on current thread.
59
+ *
60
+ * This is generally preferable over `parse` (async) as it does not have the overhead
61
+ * of spawning a thread, and the majority of the workload cannot be parallelized anyway
62
+ * (see `parse` documentation for details).
63
+ *
64
+ * If you need to parallelize parsing multiple files, it is recommended to use worker threads
65
+ * with `parseSync` rather than using `parse`.
66
+ */
50
67
  function parseSync$1(filename, sourceText, options) {
51
68
  return wrap(parseSync(filename, sourceText, options));
52
69
  }
@@ -1,4 +1,4 @@
1
- import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-DS1J_xeK.mjs";
1
+ import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-Bvz-G_y6.mjs";
2
2
 
3
3
  //#region src/api/rolldown/index.ts
4
4
  /**