rolldown 1.0.0-beta.43 → 1.0.0-beta.45

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.
@@ -1,8 +1,8 @@
1
- import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingMagicString, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, augmentCodeLocation, error, initTraceSubscriber, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst, shutdownAsyncRuntime, startAsyncRuntime } from "./parse-ast-index-DkUtf7vl.mjs";
2
- import { arraify, noop, unimplemented, unreachable, unsupported } from "./misc-CQeo-AFx.mjs";
1
+ import { C as startAsyncRuntime, S as shutdownAsyncRuntime, c as BindingPluginOrder, f as BindingWatcher, g as initTraceSubscriber, i as BindingChunkModuleOrderBy, l as BindingPropertyReadSideEffects, n as BindingBundler, o as BindingLogLevel, p as ParallelJsPluginRegistry, r as BindingCallableBuiltinPlugin, s as BindingMagicString, t as BindingAttachDebugInfo, u as BindingPropertyWriteSideEffects } from "./binding-D7oxcV7l.mjs";
2
+ import { a as logCycleLoading, c as logDeprecatedInject, d as logInputHookInOutputPlugin, f as logInvalidLogPosition, h as styleText, i as error, l as logDeprecatedKeepNames, m as logPluginError, o as logDeprecatedDefine, p as logMultiplyNotifyOption, r as augmentCodeLocation, s as logDeprecatedDropLabels, t as parseAst, u as logDeprecatedProfilerNames } from "./parse-ast-index-lp33x2Wb.mjs";
3
+ import { a as unreachable, i as unimplemented, o as unsupported, r as noop, t as arraify } from "./misc-usdOVIou.mjs";
3
4
  import { Worker, isMainThread } from "node:worker_threads";
4
5
  import path from "node:path";
5
- import colors from "ansis";
6
6
  import * as filter from "@rolldown/pluginutils";
7
7
  import fsp from "node:fs/promises";
8
8
  import os from "node:os";
@@ -218,7 +218,7 @@ if (isMainThread) {
218
218
 
219
219
  //#endregion
220
220
  //#region package.json
221
- var version = "1.0.0-beta.43";
221
+ var version = "1.0.0-beta.45";
222
222
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
223
223
 
224
224
  //#endregion
@@ -1382,6 +1382,25 @@ function tuple(items, message2) {
1382
1382
  };
1383
1383
  }
1384
1384
  /* @__NO_SIDE_EFFECTS__ */
1385
+ function undefined_(message2) {
1386
+ return {
1387
+ kind: "schema",
1388
+ type: "undefined",
1389
+ reference: undefined_,
1390
+ expects: "undefined",
1391
+ async: false,
1392
+ message: message2,
1393
+ get "~standard"() {
1394
+ return /* @__PURE__ */ _getStandardProps(this);
1395
+ },
1396
+ "~run"(dataset, config2) {
1397
+ if (dataset.value === void 0) dataset.typed = true;
1398
+ else _addIssue(this, "type", dataset, config2);
1399
+ return dataset;
1400
+ }
1401
+ };
1402
+ }
1403
+ /* @__NO_SIDE_EFFECTS__ */
1385
1404
  function _subIssues(datasets) {
1386
1405
  let issues;
1387
1406
  if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
@@ -1633,6 +1652,9 @@ function flattenValibotSchema(schema, result = {}, prefix = "") {
1633
1652
  //#endregion
1634
1653
  //#region src/utils/validator.ts
1635
1654
  const StringOrRegExpSchema = union([string(), instance(RegExp)]);
1655
+ function vFunction() {
1656
+ return function_();
1657
+ }
1636
1658
  const LogLevelSchema = union([
1637
1659
  literal("debug"),
1638
1660
  literal("info"),
@@ -1647,14 +1669,15 @@ const InputOptionSchema = union([
1647
1669
  array(string()),
1648
1670
  record(string(), string())
1649
1671
  ]);
1650
- const ExternalSchema = union([
1672
+ const ExternalOptionFunctionSchema = pipe(vFunction(), args(tuple([
1673
+ string(),
1674
+ optional(string()),
1675
+ boolean()
1676
+ ])), returns(nullish(boolean())));
1677
+ const ExternalOptionSchema = union([
1651
1678
  StringOrRegExpSchema,
1652
1679
  array(StringOrRegExpSchema),
1653
- pipe(function_(), args(tuple([
1654
- string(),
1655
- optional(string()),
1656
- boolean()
1657
- ])), returns(nullish(boolean())))
1680
+ ExternalOptionFunctionSchema
1658
1681
  ]);
1659
1682
  const ModuleTypesSchema = record(string(), union([
1660
1683
  literal("asset"),
@@ -1673,23 +1696,12 @@ const ModuleTypesSchema = record(string(), union([
1673
1696
  const JsxOptionsSchema = strictObject({
1674
1697
  runtime: pipe(optional(union([literal("classic"), literal("automatic")])), description("Which runtime to use")),
1675
1698
  development: pipe(optional(boolean()), description("Development specific information")),
1676
- throwIfNamespace: pipe(optional(string()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
1699
+ throwIfNamespace: pipe(optional(boolean()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
1677
1700
  importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
1678
1701
  pragma: pipe(optional(string()), description("Jsx element transformation")),
1679
1702
  pragmaFrag: pipe(optional(string()), description("Jsx fragment transformation")),
1680
1703
  refresh: pipe(optional(boolean()), description("Enable react fast refresh"))
1681
1704
  });
1682
- const RollupJsxOptionsSchema = strictObject({
1683
- mode: optional(union([
1684
- literal("classic"),
1685
- literal("automatic"),
1686
- literal("preserve")
1687
- ])),
1688
- factory: optional(string()),
1689
- fragment: optional(string()),
1690
- importSource: optional(string()),
1691
- jsxImportSource: optional(string())
1692
- });
1693
1705
  const HelperModeSchema = union([literal("Runtime"), literal("External")]);
1694
1706
  const DecoratorOptionSchema = object({
1695
1707
  legacy: optional(boolean()),
@@ -1725,8 +1737,17 @@ const TransformOptionsSchema = object({
1725
1737
  typescript: optional(TypescriptSchema),
1726
1738
  helpers: optional(HelpersSchema),
1727
1739
  decorators: optional(DecoratorOptionSchema),
1728
- jsx: optional(union([literal("preserve"), JsxOptionsSchema])),
1729
- target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
1740
+ jsx: optional(union([
1741
+ literal(false),
1742
+ literal("preserve"),
1743
+ literal("react"),
1744
+ literal("react-jsx"),
1745
+ JsxOptionsSchema
1746
+ ])),
1747
+ target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment")),
1748
+ define: optional(record(string(), string())),
1749
+ inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
1750
+ dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names"))
1730
1751
  });
1731
1752
  const WatchOptionsSchema = strictObject({
1732
1753
  chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
@@ -1757,8 +1778,8 @@ const ChecksOptionsSchema = strictObject({
1757
1778
  preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
1758
1779
  });
1759
1780
  const CompressOptionsKeepNamesSchema = strictObject({
1760
- function: optional(boolean()),
1761
- class: optional(boolean())
1781
+ function: boolean(),
1782
+ class: boolean()
1762
1783
  });
1763
1784
  const CompressOptionsSchema = strictObject({
1764
1785
  target: optional(union([
@@ -1780,8 +1801,8 @@ const CompressOptionsSchema = strictObject({
1780
1801
  unused: optional(union([boolean(), literal("keep_assign")]))
1781
1802
  });
1782
1803
  const MangleOptionsKeepNamesSchema = strictObject({
1783
- function: optional(boolean()),
1784
- class: optional(boolean())
1804
+ function: boolean(),
1805
+ class: boolean()
1785
1806
  });
1786
1807
  const MangleOptionsSchema = strictObject({
1787
1808
  toplevel: optional(boolean()),
@@ -1820,22 +1841,19 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
1820
1841
  propertyWriteSideEffects: optional(union([literal(false), literal("always")]))
1821
1842
  })]);
1822
1843
  const OptimizationOptionsSchema = strictObject({
1823
- inlineConst: pipe(optional(union([
1824
- boolean(),
1825
- literal("smart"),
1826
- strictObject({
1827
- mode: optional(union([literal("all"), literal("smart")])),
1828
- pass: optional(number())
1829
- })
1830
- ])), description("Enable crossmodule constant inlining")),
1844
+ inlineConst: pipe(optional(union([boolean(), strictObject({
1845
+ mode: optional(union([literal("all"), literal("smart")])),
1846
+ pass: optional(number())
1847
+ })])), description("Enable crossmodule constant inlining")),
1831
1848
  pifeForModuleWrappers: pipe(optional(boolean()), description("Use PIFE pattern for module wrappers"))
1832
1849
  });
1833
- const OnLogSchema = pipe(function_(), args(tuple([
1850
+ const LogOrStringHandlerSchema = pipe(vFunction(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])));
1851
+ const OnLogSchema = pipe(vFunction(), args(tuple([
1834
1852
  LogLevelSchema,
1835
1853
  RollupLogSchema,
1836
- pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
1854
+ LogOrStringHandlerSchema
1837
1855
  ])));
1838
- const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
1856
+ const OnwarnSchema = pipe(vFunction(), args(tuple([RollupLogSchema, pipe(vFunction(), args(tuple([union([RollupLogWithStringSchema, pipe(vFunction(), returns(RollupLogWithStringSchema))])])))])));
1839
1857
  const HmrSchema = union([boolean(), strictObject({
1840
1858
  new: optional(boolean()),
1841
1859
  port: optional(number()),
@@ -1845,7 +1863,7 @@ const HmrSchema = union([boolean(), strictObject({
1845
1863
  const InputOptionsSchema = strictObject({
1846
1864
  input: optional(InputOptionSchema),
1847
1865
  plugins: optional(custom(() => true)),
1848
- external: optional(ExternalSchema),
1866
+ external: optional(ExternalOptionSchema),
1849
1867
  makeAbsoluteExternalsRelative: optional(union([boolean(), literal("ifRelativeSource")])),
1850
1868
  resolve: optional(ResolveOptionsSchema),
1851
1869
  cwd: pipe(optional(string()), description("Current working directory")),
@@ -1853,11 +1871,11 @@ const InputOptionsSchema = strictObject({
1853
1871
  literal("browser"),
1854
1872
  literal("neutral"),
1855
1873
  literal("node")
1856
- ])), description(`Platform for which the code should be generated (node, ${colors.underline("browser")}, neutral)`)),
1874
+ ])), description(`Platform for which the code should be generated (node, ${styleText("underline", "browser")}, neutral)`)),
1857
1875
  shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
1858
1876
  treeshake: optional(TreeshakingOptionsSchema),
1859
1877
  optimization: optional(OptimizationOptionsSchema),
1860
- logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${colors.dim("silent")}, ${colors.underline(colors.gray("info"))}, debug, ${colors.yellow("warn")})`)),
1878
+ logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${styleText("dim", "silent")}, ${styleText(["underline", "gray"], "info")}, debug, ${styleText("yellow", "warn")})`)),
1861
1879
  onLog: optional(OnLogSchema),
1862
1880
  onwarn: optional(OnwarnSchema),
1863
1881
  moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
@@ -1885,13 +1903,6 @@ const InputOptionsSchema = strictObject({
1885
1903
  define: pipe(optional(record(string(), string())), description("Define global variables")),
1886
1904
  inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
1887
1905
  profilerNames: optional(boolean()),
1888
- jsx: optional(union([
1889
- literal(false),
1890
- literal("react"),
1891
- literal("react-jsx"),
1892
- literal("preserve"),
1893
- RollupJsxOptionsSchema
1894
- ])),
1895
1906
  transform: optional(TransformOptionsSchema),
1896
1907
  watch: optional(union([WatchOptionsSchema, literal(false)])),
1897
1908
  dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
@@ -1912,12 +1923,6 @@ const InputCliOverrideSchema = strictObject({
1912
1923
  inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
1913
1924
  treeshake: pipe(optional(boolean()), description("enable treeshaking")),
1914
1925
  makeAbsoluteExternalsRelative: pipe(optional(boolean()), description("Prevent normalization of external imports")),
1915
- jsx: pipe(optional(union([
1916
- literal(false),
1917
- literal("react"),
1918
- literal("react-jsx"),
1919
- literal("preserve")
1920
- ])), description("Jsx options preset")),
1921
1926
  preserveEntrySignatures: pipe(optional(literal(false)), description("Avoid facade chunks for entry points")),
1922
1927
  context: pipe(optional(string()), description("The entity top-level `this` represents."))
1923
1928
  });
@@ -1942,12 +1947,22 @@ const ModuleFormatSchema = union([
1942
1947
  literal("iife"),
1943
1948
  literal("umd")
1944
1949
  ]);
1945
- const AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
1946
- const ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
1947
- const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
1948
- const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
1949
- const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
1950
- const PathsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
1950
+ const AddonFunctionSchema = pipe(vFunction(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
1951
+ const ChunkFileNamesFunctionSchema = pipe(vFunction(), args(tuple([custom(() => true)])), returns(string()));
1952
+ const ChunkFileNamesSchema = union([string(), ChunkFileNamesFunctionSchema]);
1953
+ const AssetFileNamesFunctionSchema = pipe(vFunction(), args(tuple([custom(() => true)])), returns(string()));
1954
+ const AssetFileNamesSchema = union([string(), AssetFileNamesFunctionSchema]);
1955
+ const SanitizeFileNameFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(string()));
1956
+ const SanitizeFileNameSchema = union([boolean(), SanitizeFileNameFunctionSchema]);
1957
+ const GlobalsFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(string()));
1958
+ const PathsFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(string()));
1959
+ const ManualChunksFunctionSchema = pipe(vFunction(), args(tuple([string(), object({})])), returns(nullish(string())));
1960
+ const AdvancedChunksNameFunctionSchema = pipe(vFunction(), args(tuple([string(), object({})])), returns(nullish(string())));
1961
+ const AdvancedChunksTestFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(union([
1962
+ boolean(),
1963
+ void_(),
1964
+ undefined_()
1965
+ ])));
1951
1966
  const AdvancedChunksSchema = strictObject({
1952
1967
  includeDependenciesRecursively: optional(boolean()),
1953
1968
  minSize: optional(number()),
@@ -1956,12 +1971,8 @@ const AdvancedChunksSchema = strictObject({
1956
1971
  maxModuleSize: optional(number()),
1957
1972
  minShareCount: optional(number()),
1958
1973
  groups: optional(array(strictObject({
1959
- name: union([string(), pipe(function_(), args(tuple([string()])), returns(nullish(string())))]),
1960
- test: optional(union([
1961
- string(),
1962
- instance(RegExp),
1963
- pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
1964
- ])),
1974
+ name: union([string(), AdvancedChunksNameFunctionSchema]),
1975
+ test: optional(union([StringOrRegExpSchema, AdvancedChunksTestFunctionSchema])),
1965
1976
  priority: optional(number()),
1966
1977
  minSize: optional(number()),
1967
1978
  minShareCount: optional(number()),
@@ -1973,7 +1984,8 @@ const AdvancedChunksSchema = strictObject({
1973
1984
  const GeneratedCodePresetSchema = union([literal("es5"), literal("es2015")]);
1974
1985
  const GeneratedCodeOptionsSchema = strictObject({
1975
1986
  symbols: pipe(optional(boolean()), description("Whether to use Symbol.toStringTag for namespace objects")),
1976
- preset: GeneratedCodePresetSchema
1987
+ preset: GeneratedCodePresetSchema,
1988
+ profilerNames: pipe(optional(boolean()), description("Whether to add readable names to internal variables for profiling purposes"))
1977
1989
  });
1978
1990
  const OutputOptionsSchema = strictObject({
1979
1991
  dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
@@ -1983,18 +1995,18 @@ const OutputOptionsSchema = strictObject({
1983
1995
  literal("named"),
1984
1996
  literal("default"),
1985
1997
  literal("none")
1986
- ])), description(`Specify a export mode (${colors.underline("auto")}, named, default, none)`)),
1998
+ ])), description(`Specify a export mode (${styleText("underline", "auto")}, named, default, none)`)),
1987
1999
  hashCharacters: pipe(optional(union([
1988
2000
  literal("base64"),
1989
2001
  literal("base36"),
1990
2002
  literal("hex")
1991
2003
  ])), description("Use the specified character set for file hashes")),
1992
- format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${colors.underline("esm")}, cjs, and iife)`)),
2004
+ format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${styleText("underline", "esm")}, cjs, and iife)`)),
1993
2005
  sourcemap: pipe(optional(union([
1994
2006
  boolean(),
1995
2007
  literal("inline"),
1996
2008
  literal("hidden")
1997
- ])), description(`Generate sourcemap (\`-s inline\` for inline, or ${colors.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
2009
+ ])), description(`Generate sourcemap (\`-s inline\` for inline, or ${styleText("bold", "pass the `-s` on the last argument if you want to generate `.map` file")})`)),
1998
2010
  sourcemapBaseUrl: pipe(optional(string()), description("Base URL used to prefix sourcemap paths")),
1999
2011
  sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
2000
2012
  sourcemapIgnoreList: optional(union([
@@ -2017,7 +2029,7 @@ const OutputOptionsSchema = strictObject({
2017
2029
  sanitizeFileName: optional(SanitizeFileNameSchema),
2018
2030
  minify: pipe(optional(union([
2019
2031
  boolean(),
2020
- string("dce-only"),
2032
+ literal("dce-only"),
2021
2033
  MinifyOptionsSchema
2022
2034
  ])), description("Minify the bundled file")),
2023
2035
  name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
@@ -2026,23 +2038,22 @@ const OutputOptionsSchema = strictObject({
2026
2038
  generatedCode: pipe(optional(partial(GeneratedCodeOptionsSchema)), description("Generated code options")),
2027
2039
  externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
2028
2040
  inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
2029
- manualChunks: optional(pipe(function_(), args(tuple([string(), object({})])), returns(union([string(), nullish(string())])))),
2041
+ manualChunks: optional(ManualChunksFunctionSchema),
2030
2042
  advancedChunks: optional(AdvancedChunksSchema),
2031
2043
  legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
2032
2044
  plugins: optional(custom(() => true)),
2033
2045
  polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
2034
- hoistTransitiveImports: optional(custom((input) => {
2035
- if (input) return false;
2036
- return true;
2037
- }, () => `The 'true' value is not supported`)),
2046
+ hoistTransitiveImports: optional(literal(false)),
2038
2047
  preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
2039
2048
  preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
2040
2049
  virtualDirname: optional(string()),
2041
2050
  minifyInternalExports: pipe(optional(boolean()), description("Minify internal exports")),
2042
- topLevelVar: pipe(optional(boolean()), description("Rewrite top-level declarations to use `var`."))
2051
+ topLevelVar: pipe(optional(boolean()), description("Rewrite top-level declarations to use `var`.")),
2052
+ cleanDir: pipe(optional(boolean()), description("Clean output directory before emitting output")),
2053
+ keepNames: pipe(optional(boolean()), description("Keep function and class names after bundling"))
2043
2054
  });
2044
2055
  const getAddonDescription = (placement, wrapper) => {
2045
- return `Code to insert the ${colors.bold(placement)} of the bundled file (${colors.bold(wrapper)} the wrapper function)`;
2056
+ return `Code to insert the ${styleText("bold", placement)} of the bundled file (${styleText("bold", wrapper)} the wrapper function)`;
2046
2057
  };
2047
2058
  const OutputCliOverrideSchema = strictObject({
2048
2059
  assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
@@ -2141,6 +2152,308 @@ function bindingifySourcemap$1(map) {
2141
2152
  } };
2142
2153
  }
2143
2154
 
2155
+ //#endregion
2156
+ //#region src/utils/asset-source.ts
2157
+ function transformAssetSource(bindingAssetSource$1) {
2158
+ return bindingAssetSource$1.inner;
2159
+ }
2160
+ function bindingAssetSource(source) {
2161
+ return { inner: source };
2162
+ }
2163
+
2164
+ //#endregion
2165
+ //#region src/utils/transform-rendered-module.ts
2166
+ function transformToRenderedModule(bindingRenderedModule) {
2167
+ return {
2168
+ get code() {
2169
+ return bindingRenderedModule.code;
2170
+ },
2171
+ get renderedLength() {
2172
+ return bindingRenderedModule.code?.length || 0;
2173
+ },
2174
+ get renderedExports() {
2175
+ return bindingRenderedModule.renderedExports;
2176
+ }
2177
+ };
2178
+ }
2179
+
2180
+ //#endregion
2181
+ //#region src/utils/transform-rendered-chunk.ts
2182
+ function transformRenderedChunk(chunk) {
2183
+ let modules = null;
2184
+ return {
2185
+ type: "chunk",
2186
+ get name() {
2187
+ return chunk.name;
2188
+ },
2189
+ get isEntry() {
2190
+ return chunk.isEntry;
2191
+ },
2192
+ get isDynamicEntry() {
2193
+ return chunk.isDynamicEntry;
2194
+ },
2195
+ get facadeModuleId() {
2196
+ return chunk.facadeModuleId;
2197
+ },
2198
+ get moduleIds() {
2199
+ return chunk.moduleIds;
2200
+ },
2201
+ get exports() {
2202
+ return chunk.exports;
2203
+ },
2204
+ get fileName() {
2205
+ return chunk.fileName;
2206
+ },
2207
+ get imports() {
2208
+ return chunk.imports;
2209
+ },
2210
+ get dynamicImports() {
2211
+ return chunk.dynamicImports;
2212
+ },
2213
+ get modules() {
2214
+ if (!modules) modules = transformChunkModules(chunk.modules);
2215
+ return modules;
2216
+ }
2217
+ };
2218
+ }
2219
+ function transformChunkModules(modules) {
2220
+ const result = {};
2221
+ for (let i = 0; i < modules.values.length; i++) {
2222
+ let key = modules.keys[i];
2223
+ const mod = modules.values[i];
2224
+ result[key] = transformToRenderedModule(mod);
2225
+ }
2226
+ return result;
2227
+ }
2228
+
2229
+ //#endregion
2230
+ //#region src/utils/transform-to-rollup-output.ts
2231
+ function transformToRollupSourceMap(map) {
2232
+ const obj = {
2233
+ ...JSON.parse(map),
2234
+ toString() {
2235
+ return JSON.stringify(obj);
2236
+ },
2237
+ toUrl() {
2238
+ return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
2239
+ }
2240
+ };
2241
+ return obj;
2242
+ }
2243
+ function transformToRollupOutputChunk(bindingChunk) {
2244
+ const chunk = {
2245
+ type: "chunk",
2246
+ get code() {
2247
+ return bindingChunk.code;
2248
+ },
2249
+ fileName: bindingChunk.fileName,
2250
+ name: bindingChunk.name,
2251
+ get modules() {
2252
+ return transformChunkModules(bindingChunk.modules);
2253
+ },
2254
+ get imports() {
2255
+ return bindingChunk.imports;
2256
+ },
2257
+ get dynamicImports() {
2258
+ return bindingChunk.dynamicImports;
2259
+ },
2260
+ exports: bindingChunk.exports,
2261
+ isEntry: bindingChunk.isEntry,
2262
+ facadeModuleId: bindingChunk.facadeModuleId || null,
2263
+ isDynamicEntry: bindingChunk.isDynamicEntry,
2264
+ get moduleIds() {
2265
+ return bindingChunk.moduleIds;
2266
+ },
2267
+ get map() {
2268
+ return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
2269
+ },
2270
+ sourcemapFileName: bindingChunk.sourcemapFileName || null,
2271
+ preliminaryFileName: bindingChunk.preliminaryFileName
2272
+ };
2273
+ const cache = {};
2274
+ return new Proxy(chunk, {
2275
+ get(target, p) {
2276
+ if (p in cache) return cache[p];
2277
+ const value = target[p];
2278
+ cache[p] = value;
2279
+ return value;
2280
+ },
2281
+ has(target, p) {
2282
+ if (p in cache) return true;
2283
+ return p in target;
2284
+ }
2285
+ });
2286
+ }
2287
+ function transformToMutableRollupOutputChunk(bindingChunk, changed) {
2288
+ const chunk = {
2289
+ type: "chunk",
2290
+ get code() {
2291
+ return bindingChunk.code;
2292
+ },
2293
+ fileName: bindingChunk.fileName,
2294
+ name: bindingChunk.name,
2295
+ get modules() {
2296
+ return transformChunkModules(bindingChunk.modules);
2297
+ },
2298
+ get imports() {
2299
+ return bindingChunk.imports;
2300
+ },
2301
+ get dynamicImports() {
2302
+ return bindingChunk.dynamicImports;
2303
+ },
2304
+ exports: bindingChunk.exports,
2305
+ isEntry: bindingChunk.isEntry,
2306
+ facadeModuleId: bindingChunk.facadeModuleId || null,
2307
+ isDynamicEntry: bindingChunk.isDynamicEntry,
2308
+ get moduleIds() {
2309
+ return bindingChunk.moduleIds;
2310
+ },
2311
+ get map() {
2312
+ return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
2313
+ },
2314
+ sourcemapFileName: bindingChunk.sourcemapFileName || null,
2315
+ preliminaryFileName: bindingChunk.preliminaryFileName
2316
+ };
2317
+ const cache = {};
2318
+ return new Proxy(chunk, {
2319
+ get(target, p) {
2320
+ if (p in cache) return cache[p];
2321
+ const value = target[p];
2322
+ cache[p] = value;
2323
+ return value;
2324
+ },
2325
+ set(_target, p, newValue) {
2326
+ cache[p] = newValue;
2327
+ changed.updated.add(bindingChunk.fileName);
2328
+ return true;
2329
+ },
2330
+ has(target, p) {
2331
+ if (p in cache) return true;
2332
+ return p in target;
2333
+ }
2334
+ });
2335
+ }
2336
+ function transformToRollupOutputAsset(bindingAsset) {
2337
+ const asset = {
2338
+ type: "asset",
2339
+ fileName: bindingAsset.fileName,
2340
+ originalFileName: bindingAsset.originalFileName || null,
2341
+ originalFileNames: bindingAsset.originalFileNames,
2342
+ get source() {
2343
+ return transformAssetSource(bindingAsset.source);
2344
+ },
2345
+ name: bindingAsset.name ?? void 0,
2346
+ names: bindingAsset.names
2347
+ };
2348
+ const cache = {};
2349
+ return new Proxy(asset, { get(target, p) {
2350
+ if (p in cache) return cache[p];
2351
+ const value = target[p];
2352
+ cache[p] = value;
2353
+ return value;
2354
+ } });
2355
+ }
2356
+ function transformToMutableRollupOutputAsset(bindingAsset, changed) {
2357
+ const asset = {
2358
+ type: "asset",
2359
+ fileName: bindingAsset.fileName,
2360
+ originalFileName: bindingAsset.originalFileName || null,
2361
+ originalFileNames: bindingAsset.originalFileNames,
2362
+ get source() {
2363
+ return transformAssetSource(bindingAsset.source);
2364
+ },
2365
+ name: bindingAsset.name ?? void 0,
2366
+ names: bindingAsset.names
2367
+ };
2368
+ const cache = {};
2369
+ return new Proxy(asset, {
2370
+ get(target, p) {
2371
+ if (p in cache) return cache[p];
2372
+ const value = target[p];
2373
+ cache[p] = value;
2374
+ return value;
2375
+ },
2376
+ set(_target, p, newValue) {
2377
+ cache[p] = newValue;
2378
+ changed.updated.add(bindingAsset.fileName);
2379
+ return true;
2380
+ }
2381
+ });
2382
+ }
2383
+ function transformToRollupOutput(output) {
2384
+ const { chunks, assets } = output;
2385
+ return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk)), ...assets.map((asset) => transformToRollupOutputAsset(asset))] };
2386
+ }
2387
+ function transformToMutableRollupOutput(output, changed) {
2388
+ const { chunks, assets } = output;
2389
+ return { output: [...chunks.map((chunk) => transformToMutableRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToMutableRollupOutputAsset(asset, changed))] };
2390
+ }
2391
+ function transformToOutputBundle(context, output, changed) {
2392
+ const bundle = Object.fromEntries(transformToMutableRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
2393
+ return new Proxy(bundle, {
2394
+ set(_target, _p, _newValue, _receiver) {
2395
+ const originalStackTraceLimit = Error.stackTraceLimit;
2396
+ Error.stackTraceLimit = 2;
2397
+ const message = "This plugin assigns to bundle variable. This is discouraged by Rollup and is not supported by Rolldown. This will be ignored. https://rollupjs.org/plugin-development/#generatebundle:~:text=DANGER,this.emitFile.";
2398
+ const stack = new Error(message).stack ?? message;
2399
+ Error.stackTraceLimit = originalStackTraceLimit;
2400
+ context.warn({
2401
+ message: stack,
2402
+ code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
2403
+ });
2404
+ return true;
2405
+ },
2406
+ deleteProperty(target, property) {
2407
+ if (typeof property === "string") changed.deleted.add(property);
2408
+ return true;
2409
+ }
2410
+ });
2411
+ }
2412
+ function collectChangedBundle(changed, bundle) {
2413
+ const changes = {};
2414
+ for (const key in bundle) {
2415
+ if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
2416
+ const item = bundle[key];
2417
+ if (item.type === "asset") changes[key] = {
2418
+ filename: item.fileName,
2419
+ originalFileNames: item.originalFileNames,
2420
+ source: bindingAssetSource(item.source),
2421
+ names: item.names
2422
+ };
2423
+ else changes[key] = {
2424
+ code: item.code,
2425
+ filename: item.fileName,
2426
+ name: item.name,
2427
+ isEntry: item.isEntry,
2428
+ exports: item.exports,
2429
+ modules: {},
2430
+ imports: item.imports,
2431
+ dynamicImports: item.dynamicImports,
2432
+ facadeModuleId: item.facadeModuleId || void 0,
2433
+ isDynamicEntry: item.isDynamicEntry,
2434
+ moduleIds: item.moduleIds,
2435
+ map: bindingifySourcemap$1(item.map),
2436
+ sourcemapFilename: item.sourcemapFileName || void 0,
2437
+ preliminaryFilename: item.preliminaryFileName
2438
+ };
2439
+ }
2440
+ return {
2441
+ changes,
2442
+ deleted: changed.deleted
2443
+ };
2444
+ }
2445
+
2446
+ //#endregion
2447
+ //#region src/types/rolldown-output-impl.ts
2448
+ var RolldownOutputImpl = class {
2449
+ constructor(bindingOutputs) {
2450
+ this.bindingOutputs = bindingOutputs;
2451
+ }
2452
+ get output() {
2453
+ return transformToRollupOutput(this.bindingOutputs).output;
2454
+ }
2455
+ };
2456
+
2144
2457
  //#endregion
2145
2458
  //#region src/utils/error.ts
2146
2459
  function unwrapBindingResult(container) {
@@ -2421,15 +2734,6 @@ function bindingPluginOrder(order) {
2421
2734
  }
2422
2735
  }
2423
2736
 
2424
- //#endregion
2425
- //#region src/utils/asset-source.ts
2426
- function transformAssetSource(bindingAssetSource$1) {
2427
- return bindingAssetSource$1.inner;
2428
- }
2429
- function bindingAssetSource(source) {
2430
- return { inner: source };
2431
- }
2432
-
2433
2737
  //#endregion
2434
2738
  //#region src/plugin/fs.ts
2435
2739
  const fsModule = {
@@ -2777,220 +3081,6 @@ function bindingifyModuleParsed(args$1) {
2777
3081
  };
2778
3082
  }
2779
3083
 
2780
- //#endregion
2781
- //#region src/utils/transform-rendered-module.ts
2782
- function transformToRenderedModule(bindingRenderedModule) {
2783
- return {
2784
- get code() {
2785
- return bindingRenderedModule.code;
2786
- },
2787
- get renderedLength() {
2788
- return bindingRenderedModule.code?.length || 0;
2789
- },
2790
- get renderedExports() {
2791
- return bindingRenderedModule.renderedExports;
2792
- }
2793
- };
2794
- }
2795
-
2796
- //#endregion
2797
- //#region src/utils/transform-rendered-chunk.ts
2798
- function transformRenderedChunk(chunk) {
2799
- let modules = null;
2800
- return {
2801
- type: "chunk",
2802
- get name() {
2803
- return chunk.name;
2804
- },
2805
- get isEntry() {
2806
- return chunk.isEntry;
2807
- },
2808
- get isDynamicEntry() {
2809
- return chunk.isDynamicEntry;
2810
- },
2811
- get facadeModuleId() {
2812
- return chunk.facadeModuleId;
2813
- },
2814
- get moduleIds() {
2815
- return chunk.moduleIds;
2816
- },
2817
- get exports() {
2818
- return chunk.exports;
2819
- },
2820
- get fileName() {
2821
- return chunk.fileName;
2822
- },
2823
- get imports() {
2824
- return chunk.imports;
2825
- },
2826
- get dynamicImports() {
2827
- return chunk.dynamicImports;
2828
- },
2829
- get modules() {
2830
- if (!modules) modules = transformChunkModules(chunk.modules);
2831
- return modules;
2832
- }
2833
- };
2834
- }
2835
- function transformChunkModules(modules) {
2836
- const result = {};
2837
- for (let i = 0; i < modules.values.length; i++) {
2838
- let key = modules.keys[i];
2839
- const mod = modules.values[i];
2840
- result[key] = transformToRenderedModule(mod);
2841
- }
2842
- return result;
2843
- }
2844
-
2845
- //#endregion
2846
- //#region src/utils/transform-to-rollup-output.ts
2847
- function transformToRollupSourceMap(map) {
2848
- const obj = {
2849
- ...JSON.parse(map),
2850
- toString() {
2851
- return JSON.stringify(obj);
2852
- },
2853
- toUrl() {
2854
- return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
2855
- }
2856
- };
2857
- return obj;
2858
- }
2859
- function transformToRollupOutputChunk(bindingChunk, changed) {
2860
- const chunk = {
2861
- type: "chunk",
2862
- get code() {
2863
- return bindingChunk.code;
2864
- },
2865
- fileName: bindingChunk.fileName,
2866
- name: bindingChunk.name,
2867
- get modules() {
2868
- return transformChunkModules(bindingChunk.modules);
2869
- },
2870
- get imports() {
2871
- return bindingChunk.imports;
2872
- },
2873
- get dynamicImports() {
2874
- return bindingChunk.dynamicImports;
2875
- },
2876
- exports: bindingChunk.exports,
2877
- isEntry: bindingChunk.isEntry,
2878
- facadeModuleId: bindingChunk.facadeModuleId || null,
2879
- isDynamicEntry: bindingChunk.isDynamicEntry,
2880
- get moduleIds() {
2881
- return bindingChunk.moduleIds;
2882
- },
2883
- get map() {
2884
- return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
2885
- },
2886
- sourcemapFileName: bindingChunk.sourcemapFileName || null,
2887
- preliminaryFileName: bindingChunk.preliminaryFileName
2888
- };
2889
- const cache = {};
2890
- return new Proxy(chunk, {
2891
- get(target, p) {
2892
- if (p in cache) return cache[p];
2893
- const value = target[p];
2894
- cache[p] = value;
2895
- return value;
2896
- },
2897
- set(_target, p, newValue) {
2898
- cache[p] = newValue;
2899
- changed?.updated.add(bindingChunk.fileName);
2900
- return true;
2901
- },
2902
- has(target, p) {
2903
- if (p in cache) return true;
2904
- return p in target;
2905
- }
2906
- });
2907
- }
2908
- function transformToRollupOutputAsset(bindingAsset, changed) {
2909
- const asset = {
2910
- type: "asset",
2911
- fileName: bindingAsset.fileName,
2912
- originalFileName: bindingAsset.originalFileName || null,
2913
- originalFileNames: bindingAsset.originalFileNames,
2914
- get source() {
2915
- return transformAssetSource(bindingAsset.source);
2916
- },
2917
- name: bindingAsset.name ?? void 0,
2918
- names: bindingAsset.names
2919
- };
2920
- const cache = {};
2921
- return new Proxy(asset, {
2922
- get(target, p) {
2923
- if (p in cache) return cache[p];
2924
- const value = target[p];
2925
- cache[p] = value;
2926
- return value;
2927
- },
2928
- set(_target, p, newValue) {
2929
- cache[p] = newValue;
2930
- changed?.updated.add(bindingAsset.fileName);
2931
- return true;
2932
- }
2933
- });
2934
- }
2935
- function transformToRollupOutput(output, changed) {
2936
- const { chunks, assets } = output;
2937
- return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
2938
- }
2939
- function transformToOutputBundle(context, output, changed) {
2940
- const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
2941
- return new Proxy(bundle, {
2942
- set(_target, _p, _newValue, _receiver) {
2943
- const originalStackTraceLimit = Error.stackTraceLimit;
2944
- Error.stackTraceLimit = 2;
2945
- const message = "This plugin assigns to bundle variable. This is discouraged by Rollup and is not supported by Rolldown. This will be ignored. https://rollupjs.org/plugin-development/#generatebundle:~:text=DANGER,this.emitFile.";
2946
- const stack = new Error(message).stack ?? message;
2947
- Error.stackTraceLimit = originalStackTraceLimit;
2948
- context.warn({
2949
- message: stack,
2950
- code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
2951
- });
2952
- return true;
2953
- },
2954
- deleteProperty(target, property) {
2955
- if (typeof property === "string") changed.deleted.add(property);
2956
- return true;
2957
- }
2958
- });
2959
- }
2960
- function collectChangedBundle(changed, bundle) {
2961
- const changes = {};
2962
- for (const key in bundle) {
2963
- if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
2964
- const item = bundle[key];
2965
- if (item.type === "asset") changes[key] = {
2966
- filename: item.fileName,
2967
- originalFileNames: item.originalFileNames,
2968
- source: bindingAssetSource(item.source),
2969
- names: item.names
2970
- };
2971
- else changes[key] = {
2972
- code: item.code,
2973
- filename: item.fileName,
2974
- name: item.name,
2975
- isEntry: item.isEntry,
2976
- exports: item.exports,
2977
- modules: {},
2978
- imports: item.imports,
2979
- dynamicImports: item.dynamicImports,
2980
- facadeModuleId: item.facadeModuleId || void 0,
2981
- isDynamicEntry: item.isDynamicEntry,
2982
- moduleIds: item.moduleIds,
2983
- map: bindingifySourcemap$1(item.map),
2984
- sourcemapFilename: item.sourcemapFileName || void 0,
2985
- preliminaryFilename: item.preliminaryFileName
2986
- };
2987
- }
2988
- return {
2989
- changes,
2990
- deleted: changed.deleted
2991
- };
2992
- }
2993
-
2994
3084
  //#endregion
2995
3085
  //#region src/plugin/bindingify-output-hooks.ts
2996
3086
  function bindingifyRenderStart(args$1) {
@@ -3030,7 +3120,7 @@ function bindingifyAugmentChunkHash(args$1) {
3030
3120
  const { handler, meta } = normalizeHook(hook);
3031
3121
  return {
3032
3122
  plugin: async (ctx, chunk) => {
3033
- return await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
3123
+ return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
3034
3124
  },
3035
3125
  meta: bindingifyPluginHookMeta(meta)
3036
3126
  };
@@ -3610,6 +3700,49 @@ function isReadonlyArray(input) {
3610
3700
  return Array.isArray(input);
3611
3701
  }
3612
3702
 
3703
+ //#endregion
3704
+ //#region src/utils/normalize-transform-options.ts
3705
+ /**
3706
+ * Normalizes transform options by extracting `define`, `inject`, and `dropLabels` separately from OXC transform options.
3707
+ *
3708
+ * Prioritizes values from `transform.define`, `transform.inject`, and `transform.dropLabels` over deprecated top-level options.
3709
+ */
3710
+ function normalizeTransformOptions(inputOptions, onLog) {
3711
+ const transform = inputOptions.transform;
3712
+ let define;
3713
+ if (transform?.define) define = Object.entries(transform.define);
3714
+ else if (inputOptions.define) {
3715
+ onLog(LOG_LEVEL_WARN, logDeprecatedDefine());
3716
+ define = Object.entries(inputOptions.define);
3717
+ }
3718
+ let inject;
3719
+ if (transform?.inject) inject = transform.inject;
3720
+ else if (inputOptions.inject) {
3721
+ onLog(LOG_LEVEL_WARN, logDeprecatedInject());
3722
+ inject = inputOptions.inject;
3723
+ }
3724
+ let dropLabels;
3725
+ if (transform?.dropLabels) dropLabels = transform.dropLabels;
3726
+ else if (inputOptions.dropLabels) {
3727
+ onLog(LOG_LEVEL_WARN, logDeprecatedDropLabels());
3728
+ dropLabels = inputOptions.dropLabels;
3729
+ }
3730
+ let oxcTransformOptions;
3731
+ if (transform) {
3732
+ const { define: _define, inject: _inject, dropLabels: _dropLabels,...rest } = transform;
3733
+ if (Object.keys(rest).length > 0) {
3734
+ if (rest.jsx === false) rest.jsx = "disable";
3735
+ oxcTransformOptions = rest;
3736
+ }
3737
+ }
3738
+ return {
3739
+ define,
3740
+ inject,
3741
+ dropLabels,
3742
+ oxcTransformOptions
3743
+ };
3744
+ }
3745
+
3613
3746
  //#endregion
3614
3747
  //#region src/utils/bindingify-input-options.ts
3615
3748
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
@@ -3619,7 +3752,19 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3619
3752
  if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
3620
3753
  return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
3621
3754
  });
3622
- const { jsx, transform } = bindingifyJsx(onLog, inputOptions.jsx, inputOptions.transform);
3755
+ const normalizedTransform = normalizeTransformOptions(inputOptions, onLog);
3756
+ let profilerNames;
3757
+ if (outputOptions.generatedCode?.profilerNames !== void 0) profilerNames = outputOptions.generatedCode.profilerNames;
3758
+ else if (inputOptions.profilerNames !== void 0) {
3759
+ onLog(LOG_LEVEL_WARN, logDeprecatedProfilerNames());
3760
+ profilerNames = inputOptions.profilerNames;
3761
+ }
3762
+ let keepNames;
3763
+ if (outputOptions.keepNames !== void 0) keepNames = outputOptions.keepNames;
3764
+ else if (inputOptions.keepNames !== void 0) {
3765
+ onLog(LOG_LEVEL_WARN, logDeprecatedKeepNames());
3766
+ keepNames = inputOptions.keepNames;
3767
+ }
3623
3768
  return {
3624
3769
  input: bindingifyInput(inputOptions.input),
3625
3770
  plugins,
@@ -3632,15 +3777,14 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3632
3777
  onLog: async (level, log) => onLog(level, log),
3633
3778
  treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
3634
3779
  moduleTypes: inputOptions.moduleTypes,
3635
- define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
3636
- inject: bindingifyInject(inputOptions.inject),
3780
+ define: normalizedTransform.define,
3781
+ inject: bindingifyInject(normalizedTransform.inject),
3637
3782
  experimental: bindingifyExperimental(inputOptions.experimental),
3638
- profilerNames: inputOptions?.profilerNames,
3639
- jsx,
3640
- transform,
3783
+ profilerNames,
3784
+ transform: normalizedTransform.oxcTransformOptions,
3641
3785
  watch: bindingifyWatch(inputOptions.watch),
3642
- dropLabels: inputOptions.dropLabels,
3643
- keepNames: inputOptions.keepNames,
3786
+ dropLabels: normalizedTransform.dropLabels,
3787
+ keepNames,
3644
3788
  checks: inputOptions.checks,
3645
3789
  deferSyncScanData: () => {
3646
3790
  let ret = [];
@@ -3769,46 +3913,6 @@ function bindingifyInput(input) {
3769
3913
  };
3770
3914
  });
3771
3915
  }
3772
- function bindingifyJsx(onLog, input, transform) {
3773
- if (transform?.jsx) {
3774
- if (input !== void 0) onLog(LOG_LEVEL_WARN, logDuplicateJsxConfig());
3775
- return { transform };
3776
- }
3777
- if (typeof input === "object") {
3778
- if (input.mode === "preserve") return {
3779
- jsx: BindingJsx.Preserve,
3780
- transform
3781
- };
3782
- const mode = input.mode ?? "automatic";
3783
- transform ??= {};
3784
- transform.jsx = {
3785
- runtime: mode,
3786
- pragma: input.factory,
3787
- pragmaFrag: input.fragment,
3788
- importSource: mode === "classic" ? input.importSource : mode === "automatic" ? input.jsxImportSource : void 0
3789
- };
3790
- return { transform };
3791
- }
3792
- let jsx;
3793
- switch (input) {
3794
- case false:
3795
- jsx = BindingJsx.Disable;
3796
- break;
3797
- case "react":
3798
- jsx = BindingJsx.React;
3799
- break;
3800
- case "react-jsx":
3801
- jsx = BindingJsx.ReactJsx;
3802
- break;
3803
- case "preserve":
3804
- jsx = BindingJsx.Preserve;
3805
- break;
3806
- }
3807
- return {
3808
- jsx,
3809
- transform
3810
- };
3811
- }
3812
3916
  function bindingifyWatch(watch$1) {
3813
3917
  if (watch$1) return {
3814
3918
  buildDelay: watch$1.buildDelay,
@@ -3895,7 +3999,7 @@ var ChunkingContextImpl = class {
3895
3999
  //#endregion
3896
4000
  //#region src/utils/bindingify-output-options.ts
3897
4001
  function bindingifyOutputOptions(outputOptions) {
3898
- const { dir, format, 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 } = outputOptions;
4002
+ const { dir, format, 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;
3899
4003
  const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
3900
4004
  return {
3901
4005
  dir,
@@ -3935,7 +4039,8 @@ function bindingifyOutputOptions(outputOptions) {
3935
4039
  legalComments,
3936
4040
  preserveModulesRoot,
3937
4041
  topLevelVar,
3938
- minifyInternalExports: outputOptions.minifyInternalExports
4042
+ minifyInternalExports: outputOptions.minifyInternalExports,
4043
+ cleanDir
3939
4044
  };
3940
4045
  }
3941
4046
  function bindingifyAddon(configAddon) {
@@ -4129,12 +4234,12 @@ var RolldownBuild = class RolldownBuild {
4129
4234
  async generate(outputOptions = {}) {
4130
4235
  validateOption("output", outputOptions);
4131
4236
  const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4132
- return transformToRollupOutput(unwrapBindingResult(await impl.generate()));
4237
+ return new RolldownOutputImpl(unwrapBindingResult(await impl.generate()));
4133
4238
  }
4134
4239
  async write(outputOptions = {}) {
4135
4240
  validateOption("output", outputOptions);
4136
4241
  const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4137
- return transformToRollupOutput(unwrapBindingResult(await impl.write()));
4242
+ return new RolldownOutputImpl(unwrapBindingResult(await impl.write()));
4138
4243
  }
4139
4244
  async close() {
4140
4245
  if (this.#bundlerImpl) {
@@ -4315,4 +4420,4 @@ function defineConfig(config) {
4315
4420
  const VERSION = version;
4316
4421
 
4317
4422
  //#endregion
4318
- export { BuiltinPlugin, PluginContextData, PluginDriver, RolldownBuild, VERSION, bindingifyPlugin, build, createBundlerOptions, defineConfig, description$1 as description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, makeBuiltinPluginCallable, normalizeBindingResult, normalizedStringOrRegex, onExit, rolldown, validateCliOptions, version, watch };
4423
+ export { onExit as C, version as S, validateCliOptions as _, rolldown as a, makeBuiltinPluginCallable as b, normalizedStringOrRegex as c, normalizeBindingResult as d, transformToRollupOutput as f, getOutputCliKeys as g, getInputCliKeys as h, build as i, PluginContextData as l, getCliSchemaInfo as m, defineConfig as n, RolldownBuild as o, bindingifySourcemap$1 as p, watch as r, createBundlerOptions as s, VERSION as t, bindingifyPlugin as u, PluginDriver as v, description$1 as x, BuiltinPlugin as y };