@rolldown/browser 1.0.0-beta.54 → 1.0.0-beta.56

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 +18 -18
  2. package/dist/config.d.mts +1 -1
  3. package/dist/config.mjs +7 -7
  4. package/dist/{constructors-CPxFX1pF.js → constructors-DMeuUDyD.js} +1 -1
  5. package/dist/experimental-index.browser.mjs +39 -4
  6. package/dist/experimental-index.d.mts +38 -5
  7. package/dist/experimental-index.mjs +37 -6
  8. package/dist/filter-index.d.mts +1 -1
  9. package/dist/filter-index.mjs +2 -2
  10. package/dist/get-log-filter.d.mts +7 -0
  11. package/dist/get-log-filter.mjs +48 -0
  12. package/dist/index.browser.mjs +2 -2
  13. package/dist/index.d.mts +4 -3
  14. package/dist/index.mjs +7 -7
  15. package/dist/{normalize-string-or-regex-Crhxh-US.js → normalize-string-or-regex-B-Y4k0qo.js} +6 -4
  16. package/dist/parallel-plugin-worker.mjs +3 -3
  17. package/dist/parallel-plugin.d.mts +2 -2
  18. package/dist/parse-ast-index.d.mts +1 -1
  19. package/dist/parse-ast-index.mjs +1 -1
  20. package/dist/plugins-index.browser.mjs +2 -2
  21. package/dist/plugins-index.d.mts +3 -3
  22. package/dist/plugins-index.mjs +2 -2
  23. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  24. package/dist/{rolldown-build-BEfycLl9.js → rolldown-build-BEV6JVIl.js} +76 -29
  25. package/dist/shared/{binding-yIBVkeOE.d.mts → binding-CDyF6W3D.d.mts} +15 -10
  26. package/dist/shared/{bindingify-input-options-CxbvPG4D.mjs → bindingify-input-options-kzSFdf_-.mjs} +53 -17
  27. package/dist/shared/{constructors-D9uR3o6d.d.mts → constructors-B0L_9ar3.d.mts} +2 -2
  28. package/dist/shared/{constructors-C4qFjfHR.mjs → constructors-Dw9UOO6Z.mjs} +1 -1
  29. package/dist/shared/{define-config-DkpMlrZ3.d.mts → define-config-CrCCK_Ci.d.mts} +19 -7
  30. package/dist/shared/{load-config-BqTtlue1.mjs → load-config-vlnYfd7q.mjs} +1 -1
  31. package/dist/shared/logging-BpAvp7KV.d.mts +37 -0
  32. package/dist/shared/{logs-CPsamAuj.mjs → logs-DEfpOy5A.mjs} +4 -2
  33. package/dist/shared/{normalize-string-or-regex-B8NuOx7w.mjs → normalize-string-or-regex-CwM9ci6w.mjs} +4 -4
  34. package/dist/shared/{parse-ast-index-C0k-VwRM.mjs → parse-ast-index-DZPue_kI.mjs} +11 -8
  35. package/dist/shared/{rolldown-BeAWDsL_.mjs → rolldown-DtiFL1Ph.mjs} +1 -1
  36. package/dist/shared/{rolldown-build-yjeMNdrl.mjs → rolldown-build-B3XDwemQ.mjs} +22 -14
  37. package/dist/shared/utils-B3dcnHc8.d.mts +29 -0
  38. package/dist/shared/{watch-C7zN9oTc.mjs → watch-BHMj7YNj.mjs} +9 -9
  39. package/package.json +1 -1
  40. package/dist/shared/utils-mjPIk7Yj.d.mts +0 -64
  41. /package/dist/shared/{composable-filters-DZ5ToxRJ.mjs → composable-filters-G1eqjHFo.mjs} +0 -0
  42. /package/dist/shared/{define-config-DfeZGBEt.mjs → define-config-BF4P-Pum.mjs} +0 -0
  43. /package/dist/shared/{misc-5GYLGQ20.mjs → misc-BubmxcE3.mjs} +0 -0
  44. /package/dist/shared/{prompt-pmGBC3ws.mjs → prompt-CNt8OM9C.mjs} +0 -0
@@ -1,4 +1,4 @@
1
- import { A as augmentCodeLocation, C as LOG_LEVEL_INFO, D as unimplemented, E as arraify, F as logNoFileSystemInBrowser, I as logParseError, L as logPluginError, M as logCycleLoading, N as logInputHookInOutputPlugin, O as unreachable, R as locate, S as LOG_LEVEL_ERROR, T as logLevelPriority, _ as PlainObjectLike, a as bindingifyManifestPlugin, b as normalizeLog, c as collectChangedBundle, d as bindingifySourcemap$1, f as transformRenderedChunk, g as lazyProp, h as transformAssetSource, i as bindingifyCSSPostPlugin, j as error, k as unsupported, l as transformToOutputBundle, m as bindingAssetSource, n as BuiltinPlugin, o as bindingifyViteHtmlPlugin, p as __decorate, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex, u as transformToRollupOutput, v as MinimalPluginContextImpl, w as LOG_LEVEL_WARN, x as LOG_LEVEL_DEBUG, y as VERSION, z as getCodeFrame } from "./normalize-string-or-regex-Crhxh-US.js";
1
+ import { A as augmentCodeLocation, C as LOG_LEVEL_INFO, D as unimplemented, E as arraify, F as logNoFileSystemInBrowser, I as logParseError, L as logPluginError, M as logCycleLoading, N as logInputHookInOutputPlugin, O as unreachable, R as locate, S as LOG_LEVEL_ERROR, T as logLevelPriority, _ as PlainObjectLike, a as bindingifyManifestPlugin, b as normalizeLog, c as collectChangedBundle, d as bindingifySourcemap$1, f as transformRenderedChunk, g as lazyProp, h as transformAssetSource, i as bindingifyCSSPostPlugin, j as error, k as unsupported, l as transformToOutputBundle, m as bindingAssetSource, n as BuiltinPlugin, o as bindingifyViteHtmlPlugin, p as __decorate, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex, u as transformToRollupOutput, v as MinimalPluginContextImpl, w as LOG_LEVEL_WARN, x as LOG_LEVEL_DEBUG, y as VERSION, z as getCodeFrame } from "./normalize-string-or-regex-B-Y4k0qo.js";
2
2
  import { BindingAttachDebugInfo, BindingBundler, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, parse, parseSync, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
3
3
 
4
4
  //#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
@@ -1974,7 +1974,7 @@ const ChecksOptionsSchema = strictObject({
1974
1974
  eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
1975
1975
  missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
1976
1976
  missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
1977
- mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
1977
+ mixedExports: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed exports")),
1978
1978
  unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
1979
1979
  unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
1980
1980
  filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
@@ -2063,11 +2063,11 @@ const OnLogSchema = pipe(vFunction(), args(tuple([
2063
2063
  LogOrStringHandlerSchema
2064
2064
  ])));
2065
2065
  const OnwarnSchema = pipe(vFunction(), args(tuple([RollupLogSchema, pipe(vFunction(), args(tuple([union([RollupLogWithStringSchema, pipe(vFunction(), returns(RollupLogWithStringSchema))])])))])));
2066
- const HmrSchema = union([boolean(), strictObject({
2067
- new: optional(boolean()),
2066
+ const DevModeSchema = union([boolean(), strictObject({
2068
2067
  port: optional(number()),
2069
2068
  host: optional(string()),
2070
- implement: optional(string())
2069
+ implement: optional(string()),
2070
+ lazy: optional(boolean())
2071
2071
  })]);
2072
2072
  const InputOptionsSchema = strictObject({
2073
2073
  input: optional(InputOptionSchema),
@@ -2096,7 +2096,7 @@ const InputOptionsSchema = strictObject({
2096
2096
  strictExecutionOrder: optional(boolean()),
2097
2097
  onDemandWrapping: optional(boolean()),
2098
2098
  incrementalBuild: optional(boolean()),
2099
- hmr: optional(HmrSchema),
2099
+ devMode: optional(DevModeSchema),
2100
2100
  attachDebugInfo: optional(union([
2101
2101
  literal("none"),
2102
2102
  literal("simple"),
@@ -2219,6 +2219,8 @@ const OutputOptionsSchema = strictObject({
2219
2219
  sourcemapPathTransform: optional(custom(() => true)),
2220
2220
  banner: optional(union([string(), AddonFunctionSchema])),
2221
2221
  footer: optional(union([string(), AddonFunctionSchema])),
2222
+ postBanner: optional(union([string(), AddonFunctionSchema])),
2223
+ postFooter: optional(union([string(), AddonFunctionSchema])),
2222
2224
  intro: optional(union([string(), AddonFunctionSchema])),
2223
2225
  outro: optional(union([string(), AddonFunctionSchema])),
2224
2226
  extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
@@ -2266,6 +2268,8 @@ const OutputCliOverrideSchema = strictObject({
2266
2268
  sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
2267
2269
  banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
2268
2270
  footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
2271
+ postBanner: pipe(optional(string()), description("A string to prepend to the top of each chunk. Applied after the `renderChunk` hook and minification")),
2272
+ postFooter: pipe(optional(string()), description("A string to append to the bottom of each chunk. Applied after the `renderChunk` hook and minification")),
2269
2273
  intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
2270
2274
  outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
2271
2275
  esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
@@ -2348,7 +2352,7 @@ var RolldownOutputImpl = class extends PlainObjectLike {
2348
2352
  __decorate([lazyProp], RolldownOutputImpl.prototype, "output", null);
2349
2353
 
2350
2354
  //#endregion
2351
- //#region ../../node_modules/.pnpm/oxc-parser@0.102.0/node_modules/oxc-parser/src-js/wrap.js
2355
+ //#region ../../node_modules/.pnpm/oxc-parser@0.103.0/node_modules/oxc-parser/src-js/wrap.js
2352
2356
  function wrap$1(result) {
2353
2357
  let program, module, comments, errors;
2354
2358
  return {
@@ -2401,12 +2405,13 @@ function parseSync$1(filename, sourceText, options) {
2401
2405
 
2402
2406
  //#endregion
2403
2407
  //#region src/parse-ast-index.ts
2404
- function wrap(result, sourceText) {
2405
- if (result.errors.length > 0) return normalizeParseError(sourceText, result.errors);
2408
+ function wrap(result, filename, sourceText) {
2409
+ if (result.errors.length > 0) return normalizeParseError(filename, sourceText, result.errors);
2406
2410
  return result.program;
2407
2411
  }
2408
- function normalizeParseError(sourceText, errors) {
2412
+ function normalizeParseError(filename, sourceText, errors) {
2409
2413
  let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
2414
+ const pos = errors[0]?.labels?.[0]?.start;
2410
2415
  for (let i = 0; i < errors.length; i++) {
2411
2416
  if (i >= 5) {
2412
2417
  message += "\n...";
@@ -2419,7 +2424,9 @@ function normalizeParseError(sourceText, errors) {
2419
2424
  return getCodeFrame(sourceText, location.line, location.column);
2420
2425
  }).filter(Boolean).join("\n");
2421
2426
  }
2422
- return error(logParseError(message));
2427
+ const log = logParseError(message, filename, pos);
2428
+ if (pos !== void 0 && filename) augmentCodeLocation(log, pos, sourceText, filename);
2429
+ return error(log);
2423
2430
  }
2424
2431
  const defaultParserOptions = {
2425
2432
  lang: "js",
@@ -2429,7 +2436,7 @@ function parseAst(sourceText, options, filename) {
2429
2436
  return wrap(parseSync$1(filename ?? "file.js", sourceText, {
2430
2437
  ...defaultParserOptions,
2431
2438
  ...options
2432
- }), sourceText);
2439
+ }), filename, sourceText);
2433
2440
  }
2434
2441
 
2435
2442
  //#endregion
@@ -2634,7 +2641,7 @@ function e(e$1, t$2, n$1) {
2634
2641
 
2635
2642
  //#endregion
2636
2643
  //#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/purry-DH9cw9sy.js
2637
- function t(t$2, n$1, r) {
2644
+ function t$1(t$2, n$1, r) {
2638
2645
  let i = t$2.length - n$1.length;
2639
2646
  if (i === 0) return t$2(...n$1);
2640
2647
  if (i === 1) return e(t$2, n$1, r);
@@ -2643,8 +2650,8 @@ function t(t$2, n$1, r) {
2643
2650
 
2644
2651
  //#endregion
2645
2652
  //#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/partition-DAu403JQ.js
2646
- function t$1(...t$2) {
2647
- return t(n, t$2);
2653
+ function t(...t$2) {
2654
+ return t$1(n, t$2);
2648
2655
  }
2649
2656
  const n = (e$1, t$2) => {
2650
2657
  let n$1 = [[], []];
@@ -2674,8 +2681,8 @@ function transformFilterMatcherToFilterExprs(filterOption) {
2674
2681
  let idExcludes = [];
2675
2682
  let codeIncludes = [];
2676
2683
  let codeExcludes = [];
2677
- if (id$1) [idIncludes, idExcludes] = t$1(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m) => m.kind === "include");
2678
- if (code$1) [codeIncludes, codeExcludes] = t$1(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m) => m.kind === "include");
2684
+ if (id$1) [idIncludes, idExcludes] = t(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m) => m.kind === "include");
2685
+ if (code$1) [codeIncludes, codeExcludes] = t(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m) => m.kind === "include");
2679
2686
  ret.push(...idExcludes);
2680
2687
  ret.push(...codeExcludes);
2681
2688
  let andExprList = [];
@@ -2699,6 +2706,20 @@ function bindingifyFilterExpr(expr) {
2699
2706
  bindingifyFilterExprImpl(expr, list);
2700
2707
  return list;
2701
2708
  }
2709
+ function containsImporterId(expr) {
2710
+ switch (expr.kind) {
2711
+ case "and":
2712
+ case "or": return expr.args.some(containsImporterId);
2713
+ case "not":
2714
+ case "include":
2715
+ case "exclude": return containsImporterId(expr.expr);
2716
+ case "importerId": return true;
2717
+ default: return false;
2718
+ }
2719
+ }
2720
+ function assertNoImporterId(filterExprs, hookName) {
2721
+ if (filterExprs?.some(containsImporterId)) throw new Error(`The \`importerId\` filter can only be used with the \`resolveId\` hook, but it was used with the \`${hookName}\` hook.`);
2722
+ }
2702
2723
  function bindingifyFilterExprImpl(expr, list) {
2703
2724
  switch (expr.kind) {
2704
2725
  case "and": {
@@ -2730,6 +2751,13 @@ function bindingifyFilterExprImpl(expr, list) {
2730
2751
  });
2731
2752
  if (expr.params.cleanUrl) list.push({ kind: "CleanUrl" });
2732
2753
  break;
2754
+ case "importerId":
2755
+ list.push({
2756
+ kind: "ImporterId",
2757
+ payload: expr.pattern
2758
+ });
2759
+ if (expr.params.cleanUrl) list.push({ kind: "CleanUrl" });
2760
+ break;
2733
2761
  case "moduleType":
2734
2762
  list.push({
2735
2763
  kind: "ModuleType",
@@ -2770,19 +2798,26 @@ function bindingifyResolveIdFilter(filterOption) {
2770
2798
  }
2771
2799
  function bindingifyLoadFilter(filterOption) {
2772
2800
  if (!filterOption) return;
2773
- if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2801
+ if (Array.isArray(filterOption)) {
2802
+ assertNoImporterId(filterOption, "load");
2803
+ return { value: filterOption.map(bindingifyFilterExpr) };
2804
+ }
2774
2805
  return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2775
2806
  }
2776
2807
  function bindingifyTransformFilter(filterOption) {
2777
2808
  if (!filterOption) return;
2778
2809
  let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
2810
+ assertNoImporterId(filterExprs, "transform");
2779
2811
  let ret = [];
2780
2812
  if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
2781
2813
  return { value: ret.length > 0 ? ret : void 0 };
2782
2814
  }
2783
2815
  function bindingifyRenderChunkFilter(filterOption) {
2784
2816
  if (!filterOption) return;
2785
- if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2817
+ if (Array.isArray(filterOption)) {
2818
+ assertNoImporterId(filterOption, "renderChunk");
2819
+ return { value: filterOption.map(bindingifyFilterExpr) };
2820
+ }
2786
2821
  return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
2787
2822
  }
2788
2823
 
@@ -3613,6 +3648,12 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
3613
3648
  get footer() {
3614
3649
  return normalizeAddon(this.outputOptions.footer);
3615
3650
  }
3651
+ get postBanner() {
3652
+ return normalizeAddon(this.outputOptions.postBanner);
3653
+ }
3654
+ get postFooter() {
3655
+ return normalizeAddon(this.outputOptions.postFooter);
3656
+ }
3616
3657
  get intro() {
3617
3658
  return normalizeAddon(this.outputOptions.intro);
3618
3659
  }
@@ -3694,6 +3735,8 @@ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "inlineDynamicImpo
3694
3735
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "externalLiveBindings", null);
3695
3736
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "banner", null);
3696
3737
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "footer", null);
3738
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "postBanner", null);
3739
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "postFooter", null);
3697
3740
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "intro", null);
3698
3741
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "outro", null);
3699
3742
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "esModule", null);
@@ -3898,10 +3941,10 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3898
3941
  tsconfig: inputOptions.resolve?.tsconfigFilename ?? inputOptions.tsconfig
3899
3942
  };
3900
3943
  }
3901
- function bindingifyHmr(hmr) {
3902
- if (hmr) {
3903
- if (typeof hmr === "boolean") return hmr ? {} : void 0;
3904
- return hmr;
3944
+ function bindingifyDevMode(devMode) {
3945
+ if (devMode) {
3946
+ if (typeof devMode === "boolean") return devMode ? {} : void 0;
3947
+ return devMode;
3905
3948
  }
3906
3949
  }
3907
3950
  function bindingifyAttachDebugInfo(attachDebugInfo) {
@@ -3937,7 +3980,7 @@ function bindingifyExperimental(experimental) {
3937
3980
  disableLiveBindings: experimental?.disableLiveBindings,
3938
3981
  viteMode: experimental?.viteMode,
3939
3982
  resolveNewUrlToAsset: experimental?.resolveNewUrlToAsset,
3940
- hmr: bindingifyHmr(experimental?.hmr),
3983
+ devMode: bindingifyDevMode(experimental?.devMode),
3941
3984
  attachDebugInfo: bindingifyAttachDebugInfo(experimental?.attachDebugInfo),
3942
3985
  chunkModulesOrder,
3943
3986
  chunkImportMap: experimental?.chunkImportMap,
@@ -4092,7 +4135,10 @@ var ChunkingContextImpl = class {
4092
4135
  //#endregion
4093
4136
  //#region src/utils/bindingify-output-options.ts
4094
4137
  function bindingifyOutputOptions(outputOptions) {
4095
- const { dir, format: format$1, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar, cleanDir } = outputOptions;
4138
+ const { dir, format: format$1, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, postBanner, postFooter, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar, cleanDir } = outputOptions;
4139
+ if (outputOptions.inlineDynamicImports === true) {
4140
+ if (manualChunks != null) throw new Error("Invalid value \"true\" for option \"output.inlineDynamicImports\" - this option is not supported for \"output.manualChunks\".");
4141
+ }
4096
4142
  const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
4097
4143
  return {
4098
4144
  dir,
@@ -4107,6 +4153,8 @@ function bindingifyOutputOptions(outputOptions) {
4107
4153
  sourcemapPathTransform,
4108
4154
  banner: bindingifyAddon(banner),
4109
4155
  footer: bindingifyAddon(footer),
4156
+ postBanner: bindingifyAddon(postBanner),
4157
+ postFooter: bindingifyAddon(postFooter),
4110
4158
  intro: bindingifyAddon(intro),
4111
4159
  outro: bindingifyAddon(outro),
4112
4160
  extend: outputOptions.extend,
@@ -4137,10 +4185,9 @@ function bindingifyOutputOptions(outputOptions) {
4137
4185
  };
4138
4186
  }
4139
4187
  function bindingifyAddon(configAddon) {
4140
- return async (chunk) => {
4141
- if (typeof configAddon === "function") return configAddon(transformRenderedChunk(chunk));
4142
- return configAddon || "";
4143
- };
4188
+ if (configAddon == null || configAddon === "") return;
4189
+ if (typeof configAddon === "function") return async (chunk) => configAddon(transformRenderedChunk(chunk));
4190
+ return configAddon;
4144
4191
  }
4145
4192
  function bindingifyFormat(format$1) {
4146
4193
  switch (format$1) {
@@ -409,7 +409,11 @@ declare class ResolverFactory {
409
409
  static default(): ResolverFactory;
410
410
  /** Clone the resolver using the same underlying cache. */
411
411
  cloneWithOptions(options: NapiResolveOptions): ResolverFactory;
412
- /** Clear the underlying cache. */
412
+ /**
413
+ * Clear the underlying cache.
414
+ *
415
+ * Warning: The caller must ensure that there're no ongoing resolution operations when calling this method. Otherwise, it may cause those operations to return an incorrect result.
416
+ */
413
417
  clearCache(): void;
414
418
  /** Synchronously resolve `specifier` at an absolute path to a `directory`. */
415
419
  sync(directory: string, request: string): ResolveResult;
@@ -1303,6 +1307,8 @@ declare class BindingNormalizedOptions {
1303
1307
  get footer(): string | undefined | null | undefined;
1304
1308
  get intro(): string | undefined | null | undefined;
1305
1309
  get outro(): string | undefined | null | undefined;
1310
+ get postBanner(): string | undefined | null | undefined;
1311
+ get postFooter(): string | undefined | null | undefined;
1306
1312
  get externalLiveBindings(): boolean;
1307
1313
  get extend(): boolean;
1308
1314
  get globals(): Record<string, string> | undefined;
@@ -1448,6 +1454,13 @@ interface BindingJsonSourcemap {
1448
1454
  debugId?: string;
1449
1455
  x_google_ignoreList?: Array<number>;
1450
1456
  }
1457
+ interface BindingLogLocation {
1458
+ /** 1-based */
1459
+ line: number;
1460
+ /** 0-based position in the line in UTF-16 code units */
1461
+ column: number;
1462
+ file?: string;
1463
+ }
1451
1464
  interface BindingModulePreloadOptions {
1452
1465
  polyfill: boolean;
1453
1466
  resolveDependencies?: (filename: string, deps: string[], context: {
@@ -1694,18 +1707,10 @@ interface NativeError {
1694
1707
  /** The exporter associated with the error (for import/export errors) */
1695
1708
  exporter?: string;
1696
1709
  /** Location information (line, column, file) */
1697
- loc?: NativeErrorLocation;
1710
+ loc?: BindingLogLocation;
1698
1711
  /** Position in the source file in UTF-16 code units */
1699
1712
  pos?: number;
1700
1713
  }
1701
- /** Location information for errors */
1702
- interface NativeErrorLocation {
1703
- /** 1-based */
1704
- line: number;
1705
- /** 0-based position in the line in UTF-16 code units */
1706
- column: number;
1707
- file?: string;
1708
- }
1709
1714
  interface PreRenderedChunk {
1710
1715
  name: string;
1711
1716
  isEntry: boolean;
@@ -1,8 +1,8 @@
1
- import { c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-CPsamAuj.mjs";
2
- import { a as unreachable, o as unsupported, t as arraify } from "./misc-5GYLGQ20.mjs";
3
- import { E as LOG_LEVEL_WARN, S as normalizeLog, _ as PlainObjectLike, a as bindingifyManifestPlugin, c as collectChangedBundle, d as bindingifySourcemap, f as transformRenderedChunk, g as lazyProp, i as bindingifyCSSPostPlugin, l as transformToOutputBundle, m as bindingAssetSource, n as BuiltinPlugin, o as bindingifyViteHtmlPlugin, p as __decorate, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex, v as MinimalPluginContextImpl } from "./normalize-string-or-regex-B8NuOx7w.mjs";
4
- import { t as parseAst } from "./parse-ast-index-C0k-VwRM.mjs";
5
- import { a as include, c as or, i as id, n as code, o as moduleType, r as exclude, t as and } from "./composable-filters-DZ5ToxRJ.mjs";
1
+ import { c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-DEfpOy5A.mjs";
2
+ import { a as unreachable, o as unsupported, t as arraify } from "./misc-BubmxcE3.mjs";
3
+ import { E as LOG_LEVEL_WARN, S as normalizeLog, _ as PlainObjectLike, a as bindingifyManifestPlugin, c as collectChangedBundle, d as bindingifySourcemap, f as transformRenderedChunk, g as lazyProp, i as bindingifyCSSPostPlugin, l as transformToOutputBundle, m as bindingAssetSource, n as BuiltinPlugin, o as bindingifyViteHtmlPlugin, p as __decorate, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex, v as MinimalPluginContextImpl } from "./normalize-string-or-regex-CwM9ci6w.mjs";
4
+ import { t as parseAst } from "./parse-ast-index-DZPue_kI.mjs";
5
+ import { a as include, c as or, i as id, n as code, o as moduleType, r as exclude, t as and } from "./composable-filters-G1eqjHFo.mjs";
6
6
  import { BindingAttachDebugInfo, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects } from "../rolldown-binding.wasi.cjs";
7
7
  import path from "node:path";
8
8
  import fsp from "node:fs/promises";
@@ -143,7 +143,7 @@ function e(e$1, t$2, n$1) {
143
143
 
144
144
  //#endregion
145
145
  //#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/purry-DH9cw9sy.js
146
- function t(t$2, n$1, r) {
146
+ function t$1(t$2, n$1, r) {
147
147
  let i = t$2.length - n$1.length;
148
148
  if (i === 0) return t$2(...n$1);
149
149
  if (i === 1) return e(t$2, n$1, r);
@@ -152,8 +152,8 @@ function t(t$2, n$1, r) {
152
152
 
153
153
  //#endregion
154
154
  //#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/partition-DAu403JQ.js
155
- function t$1(...t$2) {
156
- return t(n, t$2);
155
+ function t(...t$2) {
156
+ return t$1(n, t$2);
157
157
  }
158
158
  const n = (e$1, t$2) => {
159
159
  let n$1 = [[], []];
@@ -183,8 +183,8 @@ function transformFilterMatcherToFilterExprs(filterOption) {
183
183
  let idExcludes = [];
184
184
  let codeIncludes = [];
185
185
  let codeExcludes = [];
186
- if (id$1) [idIncludes, idExcludes] = t$1(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m) => m.kind === "include");
187
- if (code$1) [codeIncludes, codeExcludes] = t$1(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m) => m.kind === "include");
186
+ if (id$1) [idIncludes, idExcludes] = t(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m) => m.kind === "include");
187
+ if (code$1) [codeIncludes, codeExcludes] = t(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m) => m.kind === "include");
188
188
  ret.push(...idExcludes);
189
189
  ret.push(...codeExcludes);
190
190
  let andExprList = [];
@@ -208,6 +208,20 @@ function bindingifyFilterExpr(expr) {
208
208
  bindingifyFilterExprImpl(expr, list);
209
209
  return list;
210
210
  }
211
+ function containsImporterId(expr) {
212
+ switch (expr.kind) {
213
+ case "and":
214
+ case "or": return expr.args.some(containsImporterId);
215
+ case "not":
216
+ case "include":
217
+ case "exclude": return containsImporterId(expr.expr);
218
+ case "importerId": return true;
219
+ default: return false;
220
+ }
221
+ }
222
+ function assertNoImporterId(filterExprs, hookName) {
223
+ if (filterExprs?.some(containsImporterId)) throw new Error(`The \`importerId\` filter can only be used with the \`resolveId\` hook, but it was used with the \`${hookName}\` hook.`);
224
+ }
211
225
  function bindingifyFilterExprImpl(expr, list) {
212
226
  switch (expr.kind) {
213
227
  case "and": {
@@ -239,6 +253,13 @@ function bindingifyFilterExprImpl(expr, list) {
239
253
  });
240
254
  if (expr.params.cleanUrl) list.push({ kind: "CleanUrl" });
241
255
  break;
256
+ case "importerId":
257
+ list.push({
258
+ kind: "ImporterId",
259
+ payload: expr.pattern
260
+ });
261
+ if (expr.params.cleanUrl) list.push({ kind: "CleanUrl" });
262
+ break;
242
263
  case "moduleType":
243
264
  list.push({
244
265
  kind: "ModuleType",
@@ -279,19 +300,26 @@ function bindingifyResolveIdFilter(filterOption) {
279
300
  }
280
301
  function bindingifyLoadFilter(filterOption) {
281
302
  if (!filterOption) return;
282
- if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
303
+ if (Array.isArray(filterOption)) {
304
+ assertNoImporterId(filterOption, "load");
305
+ return { value: filterOption.map(bindingifyFilterExpr) };
306
+ }
283
307
  return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
284
308
  }
285
309
  function bindingifyTransformFilter(filterOption) {
286
310
  if (!filterOption) return;
287
311
  let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
312
+ assertNoImporterId(filterExprs, "transform");
288
313
  let ret = [];
289
314
  if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
290
315
  return { value: ret.length > 0 ? ret : void 0 };
291
316
  }
292
317
  function bindingifyRenderChunkFilter(filterOption) {
293
318
  if (!filterOption) return;
294
- if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
319
+ if (Array.isArray(filterOption)) {
320
+ assertNoImporterId(filterOption, "renderChunk");
321
+ return { value: filterOption.map(bindingifyFilterExpr) };
322
+ }
295
323
  return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
296
324
  }
297
325
 
@@ -1117,6 +1145,12 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
1117
1145
  get footer() {
1118
1146
  return normalizeAddon(this.outputOptions.footer);
1119
1147
  }
1148
+ get postBanner() {
1149
+ return normalizeAddon(this.outputOptions.postBanner);
1150
+ }
1151
+ get postFooter() {
1152
+ return normalizeAddon(this.outputOptions.postFooter);
1153
+ }
1120
1154
  get intro() {
1121
1155
  return normalizeAddon(this.outputOptions.intro);
1122
1156
  }
@@ -1198,6 +1232,8 @@ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "inlineDynamicImpo
1198
1232
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "externalLiveBindings", null);
1199
1233
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "banner", null);
1200
1234
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "footer", null);
1235
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "postBanner", null);
1236
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "postFooter", null);
1201
1237
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "intro", null);
1202
1238
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "outro", null);
1203
1239
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "esModule", null);
@@ -1402,10 +1438,10 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
1402
1438
  tsconfig: inputOptions.resolve?.tsconfigFilename ?? inputOptions.tsconfig
1403
1439
  };
1404
1440
  }
1405
- function bindingifyHmr(hmr) {
1406
- if (hmr) {
1407
- if (typeof hmr === "boolean") return hmr ? {} : void 0;
1408
- return hmr;
1441
+ function bindingifyDevMode(devMode) {
1442
+ if (devMode) {
1443
+ if (typeof devMode === "boolean") return devMode ? {} : void 0;
1444
+ return devMode;
1409
1445
  }
1410
1446
  }
1411
1447
  function bindingifyAttachDebugInfo(attachDebugInfo) {
@@ -1441,7 +1477,7 @@ function bindingifyExperimental(experimental) {
1441
1477
  disableLiveBindings: experimental?.disableLiveBindings,
1442
1478
  viteMode: experimental?.viteMode,
1443
1479
  resolveNewUrlToAsset: experimental?.resolveNewUrlToAsset,
1444
- hmr: bindingifyHmr(experimental?.hmr),
1480
+ devMode: bindingifyDevMode(experimental?.devMode),
1445
1481
  attachDebugInfo: bindingifyAttachDebugInfo(experimental?.attachDebugInfo),
1446
1482
  chunkModulesOrder,
1447
1483
  chunkImportMap: experimental?.chunkImportMap,
@@ -1,5 +1,5 @@
1
- import { t as BuiltinPlugin, u as StringOrRegExp } from "./utils-mjPIk7Yj.mjs";
2
- import { D as BindingViteResolvePluginConfig, E as BindingViteReporterPluginConfig, S as BindingViteJsonPluginConfig, T as BindingViteReactRefreshWrapperPluginConfig, h as BindingViteBuildImportAnalysisPluginConfig, i as BindingEsmExternalRequirePluginConfig, k as BindingViteWasmHelperPluginConfig, o as BindingIsolatedDeclarationPluginConfig, p as BindingViteAssetImportMetaUrlPluginConfig, v as BindingViteDynamicImportVarsPluginConfig, w as BindingViteModulePreloadPolyfillPluginConfig, x as BindingViteImportGlobPluginConfig, y as BindingViteHtmlInlineProxyPluginConfig } from "./binding-yIBVkeOE.mjs";
1
+ import { D as BindingViteResolvePluginConfig, E as BindingViteReporterPluginConfig, S as BindingViteJsonPluginConfig, T as BindingViteReactRefreshWrapperPluginConfig, h as BindingViteBuildImportAnalysisPluginConfig, i as BindingEsmExternalRequirePluginConfig, k as BindingViteWasmHelperPluginConfig, o as BindingIsolatedDeclarationPluginConfig, p as BindingViteAssetImportMetaUrlPluginConfig, v as BindingViteDynamicImportVarsPluginConfig, w as BindingViteModulePreloadPolyfillPluginConfig, x as BindingViteImportGlobPluginConfig, y as BindingViteHtmlInlineProxyPluginConfig } from "./binding-CDyF6W3D.mjs";
2
+ import { t as BuiltinPlugin, u as StringOrRegExp } from "./utils-B3dcnHc8.mjs";
3
3
 
4
4
  //#region src/builtin-plugin/constructors.d.ts
5
5
  declare function viteModulePreloadPolyfillPlugin(config?: BindingViteModulePreloadPolyfillPluginConfig): BuiltinPlugin;
@@ -1,4 +1,4 @@
1
- import { n as BuiltinPlugin, s as makeBuiltinPluginCallable, t as normalizedStringOrRegex } from "./normalize-string-or-regex-B8NuOx7w.mjs";
1
+ import { n as BuiltinPlugin, s as makeBuiltinPluginCallable, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CwM9ci6w.mjs";
2
2
 
3
3
  //#region src/builtin-plugin/constructors.ts
4
4
  function viteModulePreloadPolyfillPlugin(config) {
@@ -1,5 +1,6 @@
1
- import { a as MakeAsync, c as NullValue, d as LogLevel, f as LogLevelOption, g as RollupLogWithString, h as RollupLog, l as PartialNull, m as RollupError, n as LoggingFunction, o as MaybeArray, p as LogOrStringHandler, r as LoggingFunctionWithPosition, s as MaybePromise, t as BuiltinPlugin, u as StringOrRegExp } from "./utils-mjPIk7Yj.mjs";
2
- import { A as BindingWatcherBundler, B as ParserOptions, F as JsxOptions, I as MinifyOptions$1, M as ExternalMemoryStatus, V as PreRenderedChunk, W as TransformOptions$1, a as BindingHookResolveIdExtraArgs, d as BindingTransformHookExtraArgs, j as BindingWatcherEvent, l as BindingRenderedChunk, s as BindingMagicString } from "./binding-yIBVkeOE.mjs";
1
+ import { a as RollupLog, i as RollupError, n as LogLevelOption, o as RollupLogWithString, r as LogOrStringHandler, t as LogLevel } from "./logging-BpAvp7KV.mjs";
2
+ import { A as BindingWatcherBundler, B as ParserOptions, F as JsxOptions, I as MinifyOptions$1, M as ExternalMemoryStatus, V as PreRenderedChunk, W as TransformOptions$1, a as BindingHookResolveIdExtraArgs, d as BindingTransformHookExtraArgs, j as BindingWatcherEvent, l as BindingRenderedChunk, s as BindingMagicString } from "./binding-CDyF6W3D.mjs";
3
+ import { a as MakeAsync, c as NullValue, l as PartialNull, n as LoggingFunction, o as MaybeArray, r as LoggingFunctionWithPosition, s as MaybePromise, t as BuiltinPlugin, u as StringOrRegExp } from "./utils-B3dcnHc8.mjs";
3
4
  import { Program } from "@oxc-project/types";
4
5
  import { TopLevelFilterExpression } from "@rolldown/pluginutils";
5
6
 
@@ -256,6 +257,14 @@ interface OutputOptions {
256
257
  sourcemapPathTransform?: SourcemapPathTransformOption;
257
258
  banner?: string | AddonFunction;
258
259
  footer?: string | AddonFunction;
260
+ /**
261
+ * Similar to `banner` option, but will run after the `renderChunk` hook and builtin minification.
262
+ */
263
+ postBanner?: string | AddonFunction;
264
+ /**
265
+ * Similar to `footer` option, but will run after the `renderChunk` hook and builtin minification.
266
+ */
267
+ postFooter?: string | AddonFunction;
259
268
  intro?: string | AddonFunction;
260
269
  outro?: string | AddonFunction;
261
270
  extend?: boolean;
@@ -695,6 +704,8 @@ interface NormalizedOutputOptions {
695
704
  externalLiveBindings: boolean;
696
705
  banner: AddonFunction;
697
706
  footer: AddonFunction;
707
+ postBanner: AddonFunction;
708
+ postFooter: AddonFunction;
698
709
  intro: AddonFunction;
699
710
  outro: AddonFunction;
700
711
  esModule: boolean | "if-default-prop";
@@ -1095,7 +1106,7 @@ type PluginHooks = { [K in keyof FunctionPluginHooks]: ObjectHook<K extends Asyn
1095
1106
  } : {})> };
1096
1107
  type AddonHookFunction = (this: PluginContext, chunk: RenderedChunk) => string | Promise<string>;
1097
1108
  type AddonHook = string | AddonHookFunction;
1098
- interface OutputPlugin extends Partial<{ [K in OutputPluginHooks]: PluginHooks[K] }>, Partial<{ [K in AddonHooks]: ObjectHook<AddonHook> }> {
1109
+ interface OutputPlugin extends Partial<{ [K in keyof PluginHooks as K & OutputPluginHooks]: PluginHooks[K] }>, Partial<{ [K in AddonHooks]: ObjectHook<AddonHook> }> {
1099
1110
  name: string;
1100
1111
  }
1101
1112
  interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
@@ -1133,10 +1144,10 @@ interface ChecksOptions {
1133
1144
  */
1134
1145
  missingNameOptionForIifeExport?: boolean;
1135
1146
  /**
1136
- * Whether to emit warning when detecting mixed export
1147
+ * Whether to emit warning when detecting mixed exports
1137
1148
  * @default true
1138
1149
  */
1139
- mixedExport?: boolean;
1150
+ mixedExports?: boolean;
1140
1151
  /**
1141
1152
  * Whether to emit warning when detecting unresolved entry
1142
1153
  * @default true
@@ -1313,10 +1324,11 @@ interface WatcherOptions {
1313
1324
  clearScreen?: boolean;
1314
1325
  }
1315
1326
  type MakeAbsoluteExternalsRelative = boolean | "ifRelativeSource";
1316
- type HmrOptions = boolean | {
1327
+ type DevModeOptions = boolean | {
1317
1328
  host?: string;
1318
1329
  port?: number;
1319
1330
  implement?: string;
1331
+ lazy?: boolean;
1320
1332
  };
1321
1333
  type OptimizationOptions = {
1322
1334
  /**
@@ -1439,7 +1451,7 @@ interface InputOptions {
1439
1451
  disableLiveBindings?: boolean;
1440
1452
  viteMode?: boolean;
1441
1453
  resolveNewUrlToAsset?: boolean;
1442
- hmr?: HmrOptions;
1454
+ devMode?: DevModeOptions;
1443
1455
  /**
1444
1456
  * Control which order should use when rendering modules in chunk
1445
1457
  *
@@ -1,4 +1,4 @@
1
- import { t as rolldown } from "./rolldown-BeAWDsL_.mjs";
1
+ import { t as rolldown } from "./rolldown-DtiFL1Ph.mjs";
2
2
  import path from "node:path";
3
3
  import { readdir } from "node:fs/promises";
4
4
  import { pathToFileURL } from "node:url";
@@ -0,0 +1,37 @@
1
+ //#region src/log/logging.d.ts
2
+ type LogLevel = "info" | "debug" | "warn";
3
+ type LogLevelOption = LogLevel | "silent";
4
+ type LogLevelWithError = LogLevel | "error";
5
+ interface RollupLog {
6
+ binding?: string;
7
+ cause?: unknown;
8
+ code?: string;
9
+ exporter?: string;
10
+ frame?: string;
11
+ hook?: string;
12
+ id?: string;
13
+ ids?: string[];
14
+ loc?: {
15
+ column: number;
16
+ file?: string;
17
+ line: number;
18
+ };
19
+ message: string;
20
+ meta?: any;
21
+ names?: string[];
22
+ plugin?: string;
23
+ pluginCode?: unknown;
24
+ pos?: number;
25
+ reexporter?: string;
26
+ stack?: string;
27
+ url?: string;
28
+ }
29
+ type RollupLogWithString = RollupLog | string;
30
+ interface RollupError extends RollupLog {
31
+ name?: string;
32
+ stack?: string;
33
+ watchFiles?: string[];
34
+ }
35
+ type LogOrStringHandler = (level: LogLevelWithError, log: RollupLogWithString) => void;
36
+ //#endregion
37
+ export { RollupLog as a, RollupError as i, LogLevelOption as n, RollupLogWithString as o, LogOrStringHandler as r, LogLevel as t };
@@ -100,10 +100,12 @@ function locate(source, search, options) {
100
100
  //#endregion
101
101
  //#region src/log/logs.ts
102
102
  const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLY_NOTIFY_OPTION = "MULTIPLY_NOTIFY_OPTION", PARSE_ERROR = "PARSE_ERROR", NO_FS_IN_BROWSER = "NO_FS_IN_BROWSER";
103
- function logParseError(message) {
103
+ function logParseError(message, id, pos) {
104
104
  return {
105
105
  code: PARSE_ERROR,
106
- message
106
+ id,
107
+ message,
108
+ pos
107
109
  };
108
110
  }
109
111
  function logInvalidLogPosition(pluginName) {