@rolldown/browser 1.0.0-beta.23 → 1.0.0-beta.25

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 (42) hide show
  1. package/dist/cli.cjs +7 -7
  2. package/dist/cli.mjs +7 -7
  3. package/dist/config.cjs +3 -3
  4. package/dist/config.d.cts +2 -2
  5. package/dist/config.d.mts +2 -2
  6. package/dist/config.mjs +3 -3
  7. package/dist/experimental-index.browser.mjs +1 -1
  8. package/dist/experimental-index.cjs +2 -2
  9. package/dist/experimental-index.d.cts +2 -4
  10. package/dist/experimental-index.d.mts +2 -4
  11. package/dist/experimental-index.mjs +2 -2
  12. package/dist/experimental-runtime-types.d.ts +3 -2
  13. package/dist/filter-index.d.cts +2 -2
  14. package/dist/filter-index.d.mts +2 -2
  15. package/dist/index.browser.mjs +1 -1
  16. package/dist/index.cjs +2 -2
  17. package/dist/index.d.cts +3 -3
  18. package/dist/index.d.mts +3 -3
  19. package/dist/index.mjs +2 -2
  20. package/dist/parallel-plugin-worker.cjs +2 -2
  21. package/dist/parallel-plugin-worker.mjs +2 -2
  22. package/dist/parallel-plugin.d.cts +2 -2
  23. package/dist/parallel-plugin.d.mts +2 -2
  24. package/dist/parse-ast-index.cjs +1 -1
  25. package/dist/parse-ast-index.d.cts +1 -2
  26. package/dist/parse-ast-index.d.mts +1 -2
  27. package/dist/parse-ast-index.mjs +1 -1
  28. package/dist/rolldown-binding.wasi-browser.js +1 -4
  29. package/dist/rolldown-binding.wasi.cjs +24 -4
  30. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  31. package/dist/shared/{binding-CMKStSph.d.cts → binding-B9-3a5q4.d.cts} +0 -10
  32. package/dist/shared/{binding-DB58iXP8.d.mts → binding-DQYRWAqj.d.mts} +0 -10
  33. package/dist/shared/{define-config-BRkYSF9E.d.cts → define-config-BtEiHmBk.d.mts} +36 -31
  34. package/dist/shared/{define-config-CqVfqfZQ.d.mts → define-config-ZN70csxk.d.cts} +36 -31
  35. package/dist/shared/{load-config-BWbXOTbl.mjs → load-config-B_r5s5Sw.mjs} +1 -1
  36. package/dist/shared/{load-config-Bh2dNRk9.cjs → load-config-CbbGAxoK.cjs} +1 -1
  37. package/dist/shared/{parse-ast-index-CGTVCgvx.cjs → parse-ast-index-80TSV2Ni.cjs} +14 -2
  38. package/dist/shared/{parse-ast-index-BzdtcWzA.mjs → parse-ast-index-Bo5jcF9A.mjs} +9 -3
  39. package/dist/shared/{src-BA5CL--T.mjs → src-DgEwyn6q.mjs} +107 -64
  40. package/dist/shared/{src-Co_Bf7DL.cjs → src-Dtgcnc61.cjs} +106 -63
  41. package/dist/{src-C1KTaRyZ.js → src-nDvl0w95.js} +114 -65
  42. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  import { and, arraify, code, exclude, id, include, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-DvBwroyk.mjs";
2
- import { augmentCodeLocation, error, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-BzdtcWzA.mjs";
3
- import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
2
+ import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-Bo5jcF9A.mjs";
3
+ import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
4
4
  import path from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import os from "node:os";
@@ -33,9 +33,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
 
34
34
  //#endregion
35
35
  //#region package.json
36
- var version = "1.0.0-beta.23";
36
+ var version = "1.0.0-beta.25";
37
37
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
38
38
 
39
+ //#endregion
40
+ //#region src/utils/normalize-string-or-regex.ts
41
+ function normalizedStringOrRegex(pattern) {
42
+ if (!pattern) return void 0;
43
+ if (!isReadonlyArray(pattern)) return [pattern];
44
+ return pattern;
45
+ }
46
+ function isReadonlyArray(input) {
47
+ return Array.isArray(input);
48
+ }
49
+
39
50
  //#endregion
40
51
  //#region src/builtin-plugin/utils.ts
41
52
  function makeBuiltinPluginCallable(plugin) {
@@ -65,6 +76,10 @@ function modulePreloadPolyfillPlugin(config) {
65
76
  return new BuiltinPlugin("builtin:module-preload-polyfill", config);
66
77
  }
67
78
  function dynamicImportVarsPlugin(config) {
79
+ if (config) {
80
+ config.include = normalizedStringOrRegex(config.include);
81
+ config.exclude = normalizedStringOrRegex(config.exclude);
82
+ }
68
83
  return new BuiltinPlugin("builtin:dynamic-import-vars", config);
69
84
  }
70
85
  function importGlobPlugin(config) {
@@ -2119,7 +2134,8 @@ const ResolveOptionsSchema = strictObject({
2119
2134
  mainFiles: optional(array(string())),
2120
2135
  modules: optional(array(string())),
2121
2136
  symlinks: optional(boolean()),
2122
- tsconfigFilename: optional(string())
2137
+ tsconfigFilename: optional(string()),
2138
+ yarnPnp: optional(boolean())
2123
2139
  });
2124
2140
  const TreeshakingOptionsSchema = union([boolean(), looseObject({
2125
2141
  annotations: optional(boolean()),
@@ -2127,6 +2143,7 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
2127
2143
  unknownGlobalSideEffects: optional(boolean()),
2128
2144
  commonjs: optional(boolean())
2129
2145
  })]);
2146
+ const OptimizationOptionsSchema = strictObject({ inlineConst: pipe(optional(boolean()), description("Enable crossmodule constant inlining")) });
2130
2147
  const OnLogSchema = pipe(function_(), args(tuple([
2131
2148
  LogLevelSchema,
2132
2149
  RollupLogSchema,
@@ -2152,6 +2169,7 @@ const InputOptionsSchema = strictObject({
2152
2169
  ])), description(`Platform for which the code should be generated (node, ${ansis_default.underline("browser")}, neutral)`)),
2153
2170
  shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
2154
2171
  treeshake: optional(TreeshakingOptionsSchema),
2172
+ optimization: optional(OptimizationOptionsSchema),
2155
2173
  logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${ansis_default.dim("silent")}, ${ansis_default.underline(ansis_default.gray("info"))}, debug, ${ansis_default.yellow("warn")})`)),
2156
2174
  onLog: optional(OnLogSchema),
2157
2175
  onwarn: optional(OnwarnSchema),
@@ -2167,7 +2185,8 @@ const InputOptionsSchema = strictObject({
2167
2185
  literal("none"),
2168
2186
  literal("simple"),
2169
2187
  literal("full")
2170
- ]))
2188
+ ])),
2189
+ chunkModulesOrder: optional(union([literal("module-id"), literal("exec-order")]))
2171
2190
  })),
2172
2191
  define: pipe(optional(record(string(), string())), description("Define global variables")),
2173
2192
  inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
@@ -2308,7 +2327,8 @@ const OutputOptionsSchema = strictObject({
2308
2327
  }, () => `The 'true' value is not supported`)),
2309
2328
  preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
2310
2329
  preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
2311
- virtualDirname: optional(string())
2330
+ virtualDirname: optional(string()),
2331
+ minifyInternalExports: pipe(optional(boolean()), description("Minify internal exports"))
2312
2332
  });
2313
2333
  const getAddonDescription = (placement, wrapper) => {
2314
2334
  return `Code to insert the ${ansis_default.bold(placement)} of the bundled file (${ansis_default.bold(wrapper)} the wrapper function)`;
@@ -2477,19 +2497,6 @@ function transformModuleInfo(info, option) {
2477
2497
  };
2478
2498
  }
2479
2499
 
2480
- //#endregion
2481
- //#region src/utils/transform-side-effects.ts
2482
- function bindingifySideEffects(sideEffects) {
2483
- switch (sideEffects) {
2484
- case true: return BindingHookSideEffects.True;
2485
- case false: return BindingHookSideEffects.False;
2486
- case "no-treeshake": return BindingHookSideEffects.NoTreeshake;
2487
- case null:
2488
- case void 0: return void 0;
2489
- default: throw new Error(`Unexpected side effects: ${sideEffects}`);
2490
- }
2491
- }
2492
-
2493
2500
  //#endregion
2494
2501
  //#region src/utils/transform-sourcemap.ts
2495
2502
  function isEmptySourcemapFiled(array$1) {
@@ -2506,7 +2513,7 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
2506
2513
  }
2507
2514
 
2508
2515
  //#endregion
2509
- //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-D6FCK2GA.js
2516
+ //#region ../../node_modules/.pnpm/remeda@2.24.0/node_modules/remeda/dist/chunk-D6FCK2GA.js
2510
2517
  function u$1(o$1, n$1, a$2) {
2511
2518
  let t$1 = (r$1) => o$1(r$1, ...n$1);
2512
2519
  return a$2 === void 0 ? t$1 : Object.assign(t$1, {
@@ -2516,7 +2523,7 @@ function u$1(o$1, n$1, a$2) {
2516
2523
  }
2517
2524
 
2518
2525
  //#endregion
2519
- //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-WIMGWYZL.js
2526
+ //#region ../../node_modules/.pnpm/remeda@2.24.0/node_modules/remeda/dist/chunk-WIMGWYZL.js
2520
2527
  function u(r$1, n$1, o$1) {
2521
2528
  let a$2 = r$1.length - n$1.length;
2522
2529
  if (a$2 === 0) return r$1(...n$1);
@@ -2525,7 +2532,7 @@ function u(r$1, n$1, o$1) {
2525
2532
  }
2526
2533
 
2527
2534
  //#endregion
2528
- //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-3IFJP4R5.js
2535
+ //#region ../../node_modules/.pnpm/remeda@2.24.0/node_modules/remeda/dist/chunk-3IFJP4R5.js
2529
2536
  function d(...r$1) {
2530
2537
  return u(i, r$1);
2531
2538
  }
@@ -2732,7 +2739,7 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2732
2739
  });
2733
2740
  data.loadModulePromiseMap.set(id$1, promise$1);
2734
2741
  try {
2735
- await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
2742
+ await context.load(id$1, options.moduleSideEffects ?? void 0);
2736
2743
  } catch (e$1) {
2737
2744
  data.loadModulePromiseMap.delete(id$1);
2738
2745
  data.loadModulePromiseResolveFnMap.delete(id$1);
@@ -2752,6 +2759,7 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2752
2759
  }, void 0);
2753
2760
  const res = await this.context.resolve(source, importer, {
2754
2761
  custom: receipt,
2762
+ isEntry: options?.isEntry,
2755
2763
  skipSelf: options?.skipSelf,
2756
2764
  vitePluginCustom
2757
2765
  });
@@ -2761,7 +2769,8 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2761
2769
  return {
2762
2770
  ...res,
2763
2771
  external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
2764
- ...info
2772
+ ...info,
2773
+ moduleSideEffects: info.moduleSideEffects ?? res.moduleSideEffects ?? null
2765
2774
  };
2766
2775
  }
2767
2776
  emitFile = (file) => {
@@ -2885,7 +2894,7 @@ function bindingifyResolveId(args$1) {
2885
2894
  id: ret.id,
2886
2895
  external: ret.external,
2887
2896
  normalizeExternalId: false,
2888
- sideEffects: bindingifySideEffects(exist.moduleSideEffects)
2897
+ moduleSideEffects: exist.moduleSideEffects ?? void 0
2889
2898
  };
2890
2899
  },
2891
2900
  meta: bindingifyPluginHookMeta(meta),
@@ -2909,7 +2918,7 @@ function bindingifyResolveDynamicImport(args$1) {
2909
2918
  id: ret.id,
2910
2919
  external: ret.external
2911
2920
  };
2912
- if (ret.moduleSideEffects !== null) result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
2921
+ if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
2913
2922
  args$1.pluginContextData.updateModuleOption(ret.id, {
2914
2923
  meta: ret.meta || {},
2915
2924
  moduleSideEffects: ret.moduleSideEffects || null,
@@ -2937,7 +2946,7 @@ function bindingifyTransform(args$1) {
2937
2946
  return {
2938
2947
  code: ret.code,
2939
2948
  map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1, ret.map)),
2940
- sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
2949
+ moduleSideEffects: moduleOption.moduleSideEffects ?? void 0,
2941
2950
  moduleType: ret.moduleType
2942
2951
  };
2943
2952
  },
@@ -2964,7 +2973,7 @@ function bindingifyLoad(args$1) {
2964
2973
  code: ret.code,
2965
2974
  map: bindingifySourcemap$1(map),
2966
2975
  moduleType: ret.moduleType,
2967
- sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects)
2976
+ moduleSideEffects: moduleOption.moduleSideEffects ?? void 0
2968
2977
  };
2969
2978
  },
2970
2979
  meta: bindingifyPluginHookMeta(meta),
@@ -3618,7 +3627,7 @@ var ChunkingContextImpl = class {
3618
3627
  //#endregion
3619
3628
  //#region src/utils/bindingify-output-options.ts
3620
3629
  function bindingifyOutputOptions(outputOptions) {
3621
- const { dir, format, exports, hashCharacters, sourcemap, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks } = outputOptions;
3630
+ const { dir, format, exports, hashCharacters, sourcemap, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar } = outputOptions;
3622
3631
  const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
3623
3632
  return {
3624
3633
  dir,
@@ -3653,7 +3662,9 @@ function bindingifyOutputOptions(outputOptions) {
3653
3662
  preserveModules,
3654
3663
  virtualDirname,
3655
3664
  legalComments,
3656
- preserveModulesRoot
3665
+ preserveModulesRoot,
3666
+ topLevelVar,
3667
+ minifyInternalExports: outputOptions.minifyInternalExports
3657
3668
  };
3658
3669
  }
3659
3670
  function bindingifyAddon(configAddon) {
@@ -3822,6 +3833,12 @@ var NormalizedOutputOptionsImpl = class {
3822
3833
  get virtualDirname() {
3823
3834
  return this.inner.virtualDirname;
3824
3835
  }
3836
+ get topLevelVar() {
3837
+ return this.inner.topLevelVar ?? false;
3838
+ }
3839
+ get minifyInternalExports() {
3840
+ return this.inner.minifyInternalExports ?? false;
3841
+ }
3825
3842
  };
3826
3843
  function normalizeAddon(value) {
3827
3844
  if (typeof value === "function") return value;
@@ -3932,17 +3949,6 @@ var PluginContextData = class {
3932
3949
  }
3933
3950
  };
3934
3951
 
3935
- //#endregion
3936
- //#region src/utils/normalize-string-or-regex.ts
3937
- function normalizedStringOrRegex(pattern) {
3938
- if (!pattern) return void 0;
3939
- if (!isReadonlyArray(pattern)) return [pattern];
3940
- return pattern;
3941
- }
3942
- function isReadonlyArray(input) {
3943
- return Array.isArray(input);
3944
- }
3945
-
3946
3952
  //#endregion
3947
3953
  //#region src/utils/bindingify-input-options.ts
3948
3954
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
@@ -3952,8 +3958,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3952
3958
  if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
3953
3959
  return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
3954
3960
  });
3955
- const { jsx, jsxTransform } = bindingifyJsx(inputOptions.jsx);
3956
- const transform = inputOptions.transform || jsxTransform;
3961
+ const { jsx, transform } = bindingifyJsx(onLog, inputOptions.jsx, inputOptions.transform);
3957
3962
  return {
3958
3963
  input: bindingifyInput(inputOptions.input),
3959
3964
  plugins,
@@ -3968,14 +3973,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3968
3973
  moduleTypes: inputOptions.moduleTypes,
3969
3974
  define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
3970
3975
  inject: bindingifyInject(inputOptions.inject),
3971
- experimental: {
3972
- strictExecutionOrder: inputOptions.experimental?.strictExecutionOrder,
3973
- disableLiveBindings: inputOptions.experimental?.disableLiveBindings,
3974
- viteMode: inputOptions.experimental?.viteMode,
3975
- resolveNewUrlToAsset: inputOptions.experimental?.resolveNewUrlToAsset,
3976
- hmr: bindingifyHmr(inputOptions.experimental?.hmr),
3977
- attachDebugInfo: bindingifyAttachDebugInfo(inputOptions.experimental?.attachDebugInfo)
3978
- },
3976
+ experimental: bindingifyExperimental(inputOptions.experimental),
3979
3977
  profilerNames: inputOptions?.profilerNames,
3980
3978
  jsx,
3981
3979
  transform,
@@ -3988,7 +3986,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3988
3986
  pluginContextData.moduleOptionMap.forEach((value, key) => {
3989
3987
  if (value.invalidate) ret.push({
3990
3988
  id: key,
3991
- sideEffects: bindingifySideEffects(value.moduleSideEffects)
3989
+ sideEffects: value.moduleSideEffects ?? void 0
3992
3990
  });
3993
3991
  });
3994
3992
  return ret;
@@ -3997,7 +3995,8 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3997
3995
  debug: inputOptions.debug,
3998
3996
  invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData),
3999
3997
  markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData),
4000
- preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures)
3998
+ preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
3999
+ optimization: inputOptions.optimization
4001
4000
  };
4002
4001
  }
4003
4002
  function bindingifyHmr(hmr) {
@@ -4029,7 +4028,29 @@ function bindingifyExternal(external) {
4029
4028
  };
4030
4029
  }
4031
4030
  }
4031
+ function bindingifyExperimental(experimental) {
4032
+ let chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
4033
+ if (experimental?.chunkModulesOrder) switch (experimental.chunkModulesOrder) {
4034
+ case "exec-order":
4035
+ chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
4036
+ break;
4037
+ case "module-id":
4038
+ chunkModulesOrder = BindingChunkModuleOrderBy.ModuleId;
4039
+ break;
4040
+ default: throw new Error(`Unexpected chunkModulesOrder: ${experimental.chunkModulesOrder}`);
4041
+ }
4042
+ return {
4043
+ strictExecutionOrder: experimental?.strictExecutionOrder,
4044
+ disableLiveBindings: experimental?.disableLiveBindings,
4045
+ viteMode: experimental?.viteMode,
4046
+ resolveNewUrlToAsset: experimental?.resolveNewUrlToAsset,
4047
+ hmr: bindingifyHmr(experimental?.hmr),
4048
+ attachDebugInfo: bindingifyAttachDebugInfo(experimental?.attachDebugInfo),
4049
+ chunkModulesOrder
4050
+ };
4051
+ }
4032
4052
  function bindingifyResolve(resolve) {
4053
+ const yarnPnp = !!process.versions.pnp;
4033
4054
  if (resolve) {
4034
4055
  const { alias, extensionAlias,...rest } = resolve;
4035
4056
  return {
@@ -4041,9 +4062,10 @@ function bindingifyResolve(resolve) {
4041
4062
  target: name,
4042
4063
  replacements: value
4043
4064
  })) : void 0,
4065
+ yarnPnp,
4044
4066
  ...rest
4045
4067
  };
4046
- }
4068
+ } else return { yarnPnp };
4047
4069
  }
4048
4070
  function bindingifyInject(inject) {
4049
4071
  if (inject) return Object.entries(inject).map(([alias, item]) => {
@@ -4087,24 +4109,45 @@ function bindingifyInput(input) {
4087
4109
  };
4088
4110
  });
4089
4111
  }
4090
- function bindingifyJsx(input) {
4112
+ function bindingifyJsx(onLog, input, transform) {
4113
+ if (transform?.jsx) {
4114
+ if (input !== void 0) onLog(LOG_LEVEL_WARN, logDuplicateJsxConfig());
4115
+ return { transform };
4116
+ }
4091
4117
  if (typeof input === "object") {
4092
- if (input.mode === "preserve") return { jsx: BindingJsx.Preserve };
4118
+ if (input.mode === "preserve") return {
4119
+ jsx: BindingJsx.Preserve,
4120
+ transform
4121
+ };
4093
4122
  const mode = input.mode ?? "automatic";
4094
- return { jsxTransform: { jsx: {
4123
+ transform ??= {};
4124
+ transform.jsx = {
4095
4125
  runtime: mode,
4096
4126
  pragma: input.factory,
4097
4127
  pragmaFrag: input.fragment,
4098
4128
  importSource: mode === "classic" ? input.importSource : mode === "automatic" ? input.jsxImportSource : void 0
4099
- } } };
4129
+ };
4130
+ return { transform };
4100
4131
  }
4132
+ let jsx;
4101
4133
  switch (input) {
4102
- case false: return { jsx: BindingJsx.Disable };
4103
- case "react": return { jsx: BindingJsx.React };
4104
- case "react-jsx": return { jsx: BindingJsx.ReactJsx };
4105
- case "preserve": return { jsx: BindingJsx.Preserve };
4106
- default: return { jsx: void 0 };
4134
+ case false:
4135
+ jsx = BindingJsx.Disable;
4136
+ break;
4137
+ case "react":
4138
+ jsx = BindingJsx.React;
4139
+ break;
4140
+ case "react-jsx":
4141
+ jsx = BindingJsx.ReactJsx;
4142
+ break;
4143
+ case "preserve":
4144
+ jsx = BindingJsx.Preserve;
4145
+ break;
4107
4146
  }
4147
+ return {
4148
+ jsx,
4149
+ transform
4150
+ };
4108
4151
  }
4109
4152
  function bindingifyWatch(watch$1) {
4110
4153
  if (watch$1) return {
@@ -4276,7 +4319,7 @@ async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose)
4276
4319
  function transformHmrPatchOutput(output) {
4277
4320
  handleHmrPatchOutputErrors(output);
4278
4321
  const { patch } = output;
4279
- return patch;
4322
+ return patch ?? void 0;
4280
4323
  }
4281
4324
  function handleHmrPatchOutputErrors(output) {
4282
4325
  const rawErrors = output.errors;