rolldown 1.2.1 → 1.2.3

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 (32) hide show
  1. package/dist/cli.d.mts +1 -1
  2. package/dist/cli.mjs +14 -10
  3. package/dist/config.d.mts +1 -1
  4. package/dist/config.mjs +2 -2
  5. package/dist/experimental-index.d.mts +2 -2
  6. package/dist/experimental-index.mjs +8 -8
  7. package/dist/filter-index.d.mts +1 -1
  8. package/dist/index.d.mts +1 -1
  9. package/dist/index.mjs +4 -4
  10. package/dist/parallel-plugin-worker.d.mts +1 -1
  11. package/dist/parallel-plugin-worker.mjs +3 -3
  12. package/dist/parallel-plugin.d.mts +1 -1
  13. package/dist/parse-ast-index.mjs +1 -1
  14. package/dist/plugins-index.d.mts +2 -2
  15. package/dist/plugins-index.mjs +2 -2
  16. package/dist/shared/binding-CKyeQZen.mjs +673 -0
  17. package/dist/shared/{bindingify-input-options-EnUlEF0T.mjs → bindingify-input-options-CMab5gbt.mjs} +247 -28
  18. package/dist/shared/{constructors-CuqzPFxJ.mjs → constructors-6Zc-JFd7.mjs} +1 -1
  19. package/dist/shared/{constructors-ALilxAii.d.mts → constructors-XaIbWpwJ.d.mts} +1 -1
  20. package/dist/shared/{create-bundler-option-4QtiLLuz.mjs → create-bundler-option-BZD-ER-Z.mjs} +36 -26
  21. package/dist/shared/{define-config-DSMNXceb.d.mts → define-config-DVsXPNaU.d.mts} +0 -4
  22. package/dist/shared/{error-BgfXq0Tb.mjs → error-BzLGqhSQ.mjs} +1 -1
  23. package/dist/shared/{load-config-DsMzOVzu.mjs → load-config-ChaLPL3M.mjs} +1 -1
  24. package/dist/shared/{normalize-string-or-regex-BVNGzRe4.mjs → normalize-string-or-regex-DYjJ67tj.mjs} +1 -1
  25. package/dist/shared/{parse-DQIYJwT4.mjs → parse-CWXBoSKb.mjs} +2 -2
  26. package/dist/shared/{resolve-tsconfig-CQndqeLj.mjs → resolve-tsconfig-Bcd82vVT.mjs} +2 -2
  27. package/dist/shared/{rolldown-DP_p9pd3.mjs → rolldown-I5b6h5Km.mjs} +5 -5
  28. package/dist/shared/{watch-Cwq-cFUy.mjs → watch-BW4p8Vif.mjs} +5 -5
  29. package/dist/utils-index.d.mts +1 -1
  30. package/dist/utils-index.mjs +15 -13
  31. package/package.json +22 -22
  32. package/dist/shared/binding-Cv62mM1i.mjs +0 -662
@@ -1,8 +1,8 @@
1
- import { n as __toESM, t as require_binding } from "./binding-Cv62mM1i.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-CKyeQZen.mjs";
2
2
  import { i as logFailedValidation, l as logPluginError, n as error, o as logInvalidLogPosition, r as logCycleLoading, t as augmentCodeLocation } from "./logs-DmYCAKcW.mjs";
3
- import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-BVNGzRe4.mjs";
3
+ import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-DYjJ67tj.mjs";
4
4
  import { i as noop, n as isPathFragment, o as unreachable, s as unsupported, t as arraify } from "./misc-DOSKtd97.mjs";
5
- import { a as bindingifySourcemap, i as unwrapBindingResult, t as aggregateBindingErrorsIntoJsError } from "./error-BgfXq0Tb.mjs";
5
+ import { a as bindingifySourcemap, i as unwrapBindingResult, t as aggregateBindingErrorsIntoJsError } from "./error-BzLGqhSQ.mjs";
6
6
  import { parseAst } from "../parse-ast-index.mjs";
7
7
  import fs from "node:fs";
8
8
  import path from "node:path";
@@ -10,7 +10,7 @@ import * as filter from "@rolldown/pluginutils";
10
10
  import fsp from "node:fs/promises";
11
11
  import { fileURLToPath } from "node:url";
12
12
  //#region package.json
13
- var version = "1.2.1";
13
+ var version = "1.2.3";
14
14
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
15
15
  //#endregion
16
16
  //#region src/constants/version.ts
@@ -236,7 +236,7 @@ function bindingAssetSource(source) {
236
236
  return { inner: source };
237
237
  }
238
238
  //#endregion
239
- //#region \0@oxc-project+runtime@0.142.0/helpers/esm/decorate.js
239
+ //#region \0@oxc-project+runtime@0.143.0/helpers/esm/decorate.js
240
240
  function __decorate(decorators, target, key, desc) {
241
241
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
242
242
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1787,8 +1787,221 @@ function extractHookUsage(plugin) {
1787
1787
  return hookUsage;
1788
1788
  }
1789
1789
  //#endregion
1790
+ //#region src/utils/plugin-timings.ts
1791
+ /**
1792
+ * Measure what plugin hooks cost, from inside the JavaScript callback.
1793
+ *
1794
+ * Internal to Rolldown. Nothing here is on a public entry point, and the measurement is not
1795
+ * offered as an API — the only consumer is the core, which pulls it while the build closes.
1796
+ *
1797
+ * The bundler core can only bracket *dispatch* and *completion*. For a hook it invokes
1798
+ * concurrently those two points are separated mostly by the queue the call waited in on
1799
+ * JavaScript's single thread, and the queue is deepest behind whichever callback is doing
1800
+ * the most work — so the hook blocking the thread dilutes its own credit while cheap hooks
1801
+ * collect credit for waiting. Ranking from those numbers reliably puts the *cheapest* hook
1802
+ * first.
1803
+ *
1804
+ * The missing quantity is when the callback began running, and that is known here. Starting
1805
+ * the clock inside the callback removes the dispatch queue by construction.
1806
+ *
1807
+ * ## `maxInFlight` decides whether a total means anything
1808
+ *
1809
+ * Entry-to-exit spans may be summed only if they never overlap. A synchronous callback
1810
+ * cannot overlap: it holds the thread until it returns. An `async` one can — it may suspend
1811
+ * at an `await` and let another call of the same hook begin, and then both spans cover the
1812
+ * same wall clock and the sum counts it twice.
1813
+ *
1814
+ * Overlap also changes what the span is measuring. A hook that awaits the bundler (say
1815
+ * `this.resolve`) spends most of its span waiting for Rust, so the number describes the
1816
+ * bundler rather than the plugin. Observed on a real build: one `resolveId` accumulated
1817
+ * ~47,000s of span inside a 44s module-loading window.
1818
+ *
1819
+ * So overlap is measured rather than assumed, per hook: `overlapMs` is the wall time
1820
+ * double counted in `ms` because two or more calls were in flight together. A hook is
1821
+ * reported with a number when that is a negligible share of its span, and named without one
1822
+ * when it is not.
1823
+ *
1824
+ * The test is deliberately a tolerance rather than "did this ever happen". A peak in-flight
1825
+ * count of 2 can mean one incidental overlap in twenty thousand calls, and discarding a
1826
+ * twelve-second measurement over that both throws away good data and makes the report
1827
+ * depend on scheduling luck — the same hook would appear in one run and vanish in the next.
1828
+ *
1829
+ * This keeps the rule the core followed — never present a number that cannot be defended —
1830
+ * while narrowing "cannot measure" from a property of the *call site* to a property of the
1831
+ * *callback*, which is where it actually lives. A hook dispatched concurrently but whose
1832
+ * body barely overlaps is measured to within the tolerance.
1833
+ *
1834
+ * A measured row is still wall time for that callback rather than CPU: a hook that awaits
1835
+ * I/O without overlapping another call of itself is charged for the wait. Excluding the
1836
+ * dispatch queue is what this buys; it does not distinguish running from awaiting.
1837
+ */
1838
+ /**
1839
+ * How much of a hook's span may be double counted before its total stops being reportable,
1840
+ * as a fraction of that span.
1841
+ */
1842
+ const OVERLAP_TOLERANCE = .01;
1843
+ /**
1844
+ * One recorder per build, keyed on the object that identifies it.
1845
+ *
1846
+ * Counters cannot be module-global. A plugin is free to run a nested `rolldown()` build of
1847
+ * its own, which finishes first; shared counters would let it flush the outer build's
1848
+ * half-accumulated totals and report a window belonging to neither.
1849
+ */
1850
+ const recorders = /* @__PURE__ */ new WeakMap();
1851
+ /** The recorder for one build, created on first use. */
1852
+ function pluginTimingsRecorderFor(key) {
1853
+ let recorder = recorders.get(key);
1854
+ if (recorder === void 0) {
1855
+ recorder = {
1856
+ costs: /* @__PURE__ */ new Map(),
1857
+ busyMs: 0,
1858
+ inFlight: 0,
1859
+ busyStart: 0
1860
+ };
1861
+ recorders.set(key, recorder);
1862
+ }
1863
+ return recorder;
1864
+ }
1865
+ function costFor(recorder, owner, hookName) {
1866
+ let byHook = recorder.costs.get(owner.key);
1867
+ if (byHook === void 0) {
1868
+ byHook = /* @__PURE__ */ new Map();
1869
+ recorder.costs.set(owner.key, byHook);
1870
+ }
1871
+ let cost = byHook.get(hookName);
1872
+ if (cost === void 0) {
1873
+ cost = {
1874
+ owner: owner.name,
1875
+ kind: owner.kind,
1876
+ hookName,
1877
+ calls: 0,
1878
+ ms: 0,
1879
+ inFlight: 0,
1880
+ maxInFlight: 0,
1881
+ overlapMs: 0,
1882
+ lastChange: 0
1883
+ };
1884
+ byHook.set(hookName, cost);
1885
+ }
1886
+ return cost;
1887
+ }
1888
+ /**
1889
+ * Fold the interval since the last in-flight change into `overlapMs`, then move the mark.
1890
+ * Call immediately before every increment and decrement of `cost.inFlight`.
1891
+ */
1892
+ function markInFlightChange(cost, at) {
1893
+ if (cost.inFlight > 1) cost.overlapMs += (cost.inFlight - 1) * (at - cost.lastChange);
1894
+ cost.lastChange = at;
1895
+ }
1896
+ /**
1897
+ * Close out one call. A module-level function rather than a closure per invocation: hooks
1898
+ * run hundreds of thousands of times in a large build, and the synchronous path would
1899
+ * otherwise allocate one closure per call only to invoke it immediately.
1900
+ */
1901
+ function settle(recorder, cost, started) {
1902
+ const ended = performance.now();
1903
+ markInFlightChange(cost, ended);
1904
+ cost.inFlight -= 1;
1905
+ cost.ms += ended - started;
1906
+ recorder.inFlight -= 1;
1907
+ if (recorder.inFlight === 0) recorder.busyMs += ended - recorder.busyStart;
1908
+ }
1909
+ /**
1910
+ * Wrap one callback so its execution time is recorded.
1911
+ *
1912
+ * Returns the callback untouched when there is no recorder, so a build that is not
1913
+ * measuring pays nothing beyond one branch at setup.
1914
+ */
1915
+ function measureHookCost(recorder, owner, hookName, handler) {
1916
+ if (recorder === void 0) return handler;
1917
+ const cost = costFor(recorder, owner, hookName);
1918
+ return function(...args) {
1919
+ const started = performance.now();
1920
+ markInFlightChange(cost, started);
1921
+ cost.calls += 1;
1922
+ cost.inFlight += 1;
1923
+ if (cost.inFlight > cost.maxInFlight) cost.maxInFlight = cost.inFlight;
1924
+ if (recorder.inFlight === 0) recorder.busyStart = started;
1925
+ recorder.inFlight += 1;
1926
+ let result;
1927
+ try {
1928
+ result = handler.apply(this, args);
1929
+ } catch (error) {
1930
+ settle(recorder, cost, started);
1931
+ throw error;
1932
+ }
1933
+ if (typeof result?.then === "function") return result.then((value) => {
1934
+ settle(recorder, cost, started);
1935
+ return value;
1936
+ }, (error) => {
1937
+ settle(recorder, cost, started);
1938
+ throw error;
1939
+ });
1940
+ settle(recorder, cost, started);
1941
+ return result;
1942
+ };
1943
+ }
1944
+ /**
1945
+ * The owner shown for user callbacks the core invokes directly rather than through a
1946
+ * plugin. One shared identity: they are all configured on the same options object.
1947
+ */
1948
+ const OUTPUT_OPTIONS_OWNER = {
1949
+ key: Symbol("output options"),
1950
+ name: "output options",
1951
+ kind: "outputOption"
1952
+ };
1953
+ /** As {@link OUTPUT_OPTIONS_OWNER}, for callbacks configured on the input options. */
1954
+ const INPUT_OPTIONS_OWNER = {
1955
+ key: Symbol("input options"),
1956
+ name: "input options",
1957
+ kind: "inputOption"
1958
+ };
1959
+ /**
1960
+ * Wrap `value` when the user supplied a function, and leave every other form alone.
1961
+ *
1962
+ * Most option callbacks are declared as `string | RegExp | Function | ...`, so this keeps
1963
+ * the one cast the wrapping needs in a single place.
1964
+ */
1965
+ function measureIfFunction(recorder, owner, hookName, value) {
1966
+ if (typeof value !== "function") return value;
1967
+ return measureHookCost(recorder, owner, hookName, value);
1968
+ }
1969
+ /**
1970
+ * What the build's callbacks have cost so far, leaving the recorder in place.
1971
+ *
1972
+ * Ungated on purpose: whether a build is worth reporting on is decided from the clocks Rust
1973
+ * holds, so the question is not this side's to ask.
1974
+ *
1975
+ * Rust calls this while the build is closing, so what it gets includes `closeBundle`.
1976
+ */
1977
+ function summarizePluginTimings(key) {
1978
+ const recorder = recorders.get(key);
1979
+ if (recorder === void 0) return {
1980
+ busyMs: 0,
1981
+ rows: []
1982
+ };
1983
+ const rows = [];
1984
+ for (const byHook of recorder.costs.values()) for (const cost of byHook.values()) {
1985
+ if (cost.calls === 0) continue;
1986
+ rows.push({
1987
+ owner: cost.owner,
1988
+ kind: cost.kind,
1989
+ hook: cost.hookName,
1990
+ calls: cost.calls,
1991
+ ms: cost.ms,
1992
+ maxInFlight: cost.maxInFlight,
1993
+ overlapMs: cost.overlapMs,
1994
+ rankable: cost.overlapMs <= cost.ms * OVERLAP_TOLERANCE
1995
+ });
1996
+ }
1997
+ return {
1998
+ busyMs: recorder.busyMs,
1999
+ rows
2000
+ };
2001
+ }
2002
+ //#endregion
1790
2003
  //#region src/plugin/bindingify-plugin.ts
1791
- function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
2004
+ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings) {
1792
2005
  const args = {
1793
2006
  plugin,
1794
2007
  options,
@@ -1822,7 +2035,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
1822
2035
  const { plugin: hotUpdate, meta: hotUpdateMeta } = bindingifyHotUpdate(args);
1823
2036
  const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
1824
2037
  let hookUsage = extractHookUsage(plugin).inner();
1825
- return wrapHandlers({
2038
+ const result = {
1826
2039
  name: plugin.name,
1827
2040
  buildStart,
1828
2041
  buildStartMeta,
@@ -1873,9 +2086,14 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
1873
2086
  closeWatcher,
1874
2087
  closeWatcherMeta,
1875
2088
  hookUsage
1876
- });
2089
+ };
2090
+ return wrapHandlers(result, {
2091
+ key: plugin,
2092
+ name: result.name,
2093
+ kind: "plugin"
2094
+ }, timings);
1877
2095
  }
1878
- function wrapHandlers(plugin) {
2096
+ function wrapHandlers(plugin, owner, timings) {
1879
2097
  for (const hookName of [
1880
2098
  "buildStart",
1881
2099
  "resolveId",
@@ -1900,7 +2118,8 @@ function wrapHandlers(plugin) {
1900
2118
  "hotUpdate",
1901
2119
  "closeWatcher"
1902
2120
  ]) {
1903
- const handler = plugin[hookName];
2121
+ const raw = plugin[hookName];
2122
+ const handler = raw && measureHookCost(timings, owner, hookName, raw);
1904
2123
  if (handler) plugin[hookName] = async (...args) => {
1905
2124
  try {
1906
2125
  return await handler(...args);
@@ -1944,34 +2163,34 @@ function normalizeTransformOptions(inputOptions) {
1944
2163
  //#endregion
1945
2164
  //#region src/utils/default-dev-runtime.ts
1946
2165
  function getDefaultDevRuntime(host = "localhost", port = 3e3) {
1947
- const runtimeEntry = fs.readFileSync(fileURLToPath(import.meta.resolve("rolldown/experimental/runtime")), "utf8");
2166
+ const runtimeEntry = fs.readFileSync(fileURLToPath(import.meta.resolve("#runtime")), "utf8");
1948
2167
  const runtimeHelperImportEnd = runtimeEntry.indexOf("\n");
1949
2168
  if (!runtimeEntry.startsWith("import ") || runtimeHelperImportEnd === -1) throw new Error("Expected the standalone runtime to start with a helper import");
1950
2169
  return `${runtimeEntry.slice(runtimeHelperImportEnd + 1)}\n${fs.readFileSync(fileURLToPath(import.meta.resolve("#default-runtime")), "utf8").replaceAll("$ADDR", `${host}:${port}`)}`;
1951
2170
  }
1952
2171
  //#endregion
1953
2172
  //#region src/utils/bindingify-input-options.ts
1954
- function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
2173
+ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings) {
1955
2174
  const plugins = rawPlugins.map((plugin) => {
1956
2175
  if (getParallelPluginInfo(plugin)) return;
1957
2176
  if (plugin instanceof BuiltinPlugin) switch (plugin.name) {
1958
2177
  case "builtin:vite-manifest": return bindingifyManifestPlugin(plugin, pluginContextData);
1959
2178
  default: return bindingifyBuiltInPlugin(plugin);
1960
2179
  }
1961
- return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
2180
+ return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings);
1962
2181
  });
1963
2182
  const normalizedTransform = normalizeTransformOptions(inputOptions);
1964
2183
  return {
1965
2184
  input: bindingifyInput(inputOptions.input),
1966
2185
  plugins,
1967
2186
  cwd: inputOptions.cwd ?? process.cwd(),
1968
- external: bindingifyExternal(inputOptions.external),
2187
+ external: bindingifyExternal(inputOptions.external, timings),
1969
2188
  resolve: bindingifyResolve(inputOptions.resolve),
1970
2189
  platform: inputOptions.platform,
1971
2190
  shimMissingExports: inputOptions.shimMissingExports,
1972
2191
  logLevel: bindingifyLogLevel(logLevel),
1973
2192
  onLog,
1974
- treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
2193
+ treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake, timings),
1975
2194
  moduleTypes: inputOptions.moduleTypes,
1976
2195
  define: normalizedTransform.define,
1977
2196
  inject: bindingifyInject(normalizedTransform.inject),
@@ -1982,6 +2201,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginC
1982
2201
  dropLabels: normalizedTransform.dropLabels,
1983
2202
  keepNames: outputOptions.keepNames,
1984
2203
  checks: inputOptions.checks,
2204
+ pluginTimings: timings ? () => summarizePluginTimings(inputOptions) : void 0,
1985
2205
  deferSyncScanData: () => {
1986
2206
  let ret = [];
1987
2207
  pluginContextData.moduleOptionMap.forEach((value, key) => {
@@ -2023,12 +2243,15 @@ function bindingifyAttachDebugInfo(attachDebugInfo) {
2023
2243
  case "none": return import_binding.BindingAttachDebugInfo.None;
2024
2244
  }
2025
2245
  }
2026
- function bindingifyExternal(external) {
2246
+ function bindingifyExternal(external, timings) {
2027
2247
  if (external) {
2028
- if (typeof external === "function") return (id, importer, isResolved) => {
2029
- if (id.startsWith("\0")) return false;
2030
- return external(id, importer, isResolved) ?? false;
2031
- };
2248
+ if (typeof external === "function") {
2249
+ const measured = measureHookCost(timings, INPUT_OPTIONS_OWNER, "external", external);
2250
+ return (id, importer, isResolved) => {
2251
+ if (id.startsWith("\0")) return false;
2252
+ return measured(id, importer, isResolved) ?? false;
2253
+ };
2254
+ }
2032
2255
  return arraify(external);
2033
2256
  }
2034
2257
  }
@@ -2119,11 +2342,7 @@ function bindingifyInput(input) {
2119
2342
  }
2120
2343
  function bindingifyWatch(watch) {
2121
2344
  if (watch) {
2122
- if (watch.notify) console.warn("The \"watch.notify\" option is deprecated. Please use \"watch.watcher\" instead.");
2123
- const watcher = {
2124
- ...watch.notify,
2125
- ...watch.watcher
2126
- };
2345
+ const watcher = watch.watcher ?? {};
2127
2346
  return {
2128
2347
  buildDelay: watch.buildDelay,
2129
2348
  skipWrite: watch.skipWrite,
@@ -2139,7 +2358,7 @@ function bindingifyWatch(watch) {
2139
2358
  };
2140
2359
  }
2141
2360
  }
2142
- function bindingifyTreeshakeOptions(config) {
2361
+ function bindingifyTreeshakeOptions(config, timings) {
2143
2362
  if (config === false) return;
2144
2363
  if (config === true || config === void 0) return { moduleSideEffects: true };
2145
2364
  let normalizedConfig = {
@@ -2170,7 +2389,7 @@ function bindingifyTreeshakeOptions(config) {
2170
2389
  external: false,
2171
2390
  sideEffects: true
2172
2391
  }];
2173
- else normalizedConfig.moduleSideEffects = config.moduleSideEffects;
2392
+ else normalizedConfig.moduleSideEffects = measureIfFunction(timings, INPUT_OPTIONS_OWNER, "treeshake.moduleSideEffects", config.moduleSideEffects);
2174
2393
  return normalizedConfig;
2175
2394
  }
2176
2395
  function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative) {
@@ -2192,4 +2411,4 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
2192
2411
  };
2193
2412
  }
2194
2413
  //#endregion
2195
- export { version as C, description as S, LOG_LEVEL_ERROR as _, transformModuleInfo as a, logLevelPriority as b, __decorate as c, PlainObjectLike as d, MinimalPluginContextImpl as f, LOG_LEVEL_DEBUG as g, normalizeLog as h, PluginContextData as i, transformAssetSource as l, normalizeHook as m, bindingifyPlugin as n, transformToRollupOutput as o, getParallelPluginInfo as p, RolldownMagicString as r, transformRenderedChunk as s, bindingifyInputOptions as t, lazyProp as u, LOG_LEVEL_INFO as v, VERSION as x, LOG_LEVEL_WARN as y };
2414
+ export { LOG_LEVEL_WARN as C, version as D, description as E, LOG_LEVEL_INFO as S, VERSION as T, getParallelPluginInfo as _, measureIfFunction as a, LOG_LEVEL_DEBUG as b, PluginContextData as c, transformRenderedChunk as d, __decorate as f, MinimalPluginContextImpl as g, PlainObjectLike as h, measureHookCost as i, transformModuleInfo as l, lazyProp as m, bindingifyPlugin as n, pluginTimingsRecorderFor as o, transformAssetSource as p, OUTPUT_OPTIONS_OWNER as r, RolldownMagicString as s, bindingifyInputOptions as t, transformToRollupOutput as u, normalizeHook as v, logLevelPriority as w, LOG_LEVEL_ERROR as x, normalizeLog as y };
@@ -1,4 +1,4 @@
1
- import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-BVNGzRe4.mjs";
1
+ import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-DYjJ67tj.mjs";
2
2
  //#region src/builtin-plugin/constructors.ts
3
3
  function viteModulePreloadPolyfillPlugin(config) {
4
4
  return new BuiltinPlugin("builtin:vite-module-preload-polyfill", config);
@@ -1,5 +1,5 @@
1
1
  import { C as BindingViteJsonPluginConfig, D as BindingViteReporterPluginConfig, E as BindingViteReactRefreshWrapperPluginConfig, O as BindingViteResolvePluginConfig, S as BindingViteImportGlobPluginConfig, T as BindingViteModulePreloadPolyfillPluginConfig, b as BindingViteBuildImportAnalysisPluginConfig, l as BindingIsolatedDeclarationPluginConfig, s as BindingEsmExternalRequirePluginConfig, x as BindingViteDynamicImportVarsPluginConfig } from "./binding-CVtkJvyl.mjs";
2
- import { Gt as StringOrRegExp, I as BuiltinPlugin } from "./define-config-DSMNXceb.mjs";
2
+ import { Gt as StringOrRegExp, I as BuiltinPlugin } from "./define-config-DVsXPNaU.mjs";
3
3
  //#region src/builtin-plugin/constructors.d.ts
4
4
  declare function viteModulePreloadPolyfillPlugin(config?: BindingViteModulePreloadPolyfillPluginConfig): BuiltinPlugin;
5
5
  type DynamicImportVarsPluginConfig = Omit<BindingViteDynamicImportVarsPluginConfig, "include" | "exclude"> & {
@@ -1,7 +1,7 @@
1
- import { n as __toESM, t as require_binding } from "./binding-Cv62mM1i.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-CKyeQZen.mjs";
2
2
  import { a as logInputHookInOutputPlugin, n as error } from "./logs-DmYCAKcW.mjs";
3
- import { n as BuiltinPlugin } from "./normalize-string-or-regex-BVNGzRe4.mjs";
4
- import { a as transformModuleInfo, b as logLevelPriority, f as MinimalPluginContextImpl, g as LOG_LEVEL_DEBUG, h as normalizeLog, i as PluginContextData, l as transformAssetSource, m as normalizeHook, p as getParallelPluginInfo, s as transformRenderedChunk, t as bindingifyInputOptions, x as VERSION, y as LOG_LEVEL_WARN } from "./bindingify-input-options-EnUlEF0T.mjs";
3
+ import { n as BuiltinPlugin } from "./normalize-string-or-regex-DYjJ67tj.mjs";
4
+ import { C as LOG_LEVEL_WARN, T as VERSION, _ as getParallelPluginInfo, a as measureIfFunction, b as LOG_LEVEL_DEBUG, c as PluginContextData, d as transformRenderedChunk, g as MinimalPluginContextImpl, i as measureHookCost, l as transformModuleInfo, o as pluginTimingsRecorderFor, p as transformAssetSource, r as OUTPUT_OPTIONS_OWNER, t as bindingifyInputOptions, v as normalizeHook, w as logLevelPriority, y as normalizeLog } from "./bindingify-input-options-CMab5gbt.mjs";
5
5
  import { a as unimplemented } from "./misc-DOSKtd97.mjs";
6
6
  import { Worker } from "node:worker_threads";
7
7
  import path, { sep } from "node:path";
@@ -2913,10 +2913,10 @@ function createTestingLogger() {
2913
2913
  }
2914
2914
  //#endregion
2915
2915
  //#region src/utils/bindingify-output-options.ts
2916
- function bindingifyOutputOptions(outputOptions, pluginContextData) {
2916
+ function bindingifyOutputOptions(outputOptions, pluginContextData, timings) {
2917
2917
  const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapFileNames, sourcemapExcludeSources, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, banner, footer, postBanner, postFooter, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, comments, preserveModulesRoot, manualChunks, topLevelVar, cleanDir, strictExecutionOrder } = outputOptions;
2918
2918
  if (legalComments != null) logger.warn("`legalComments` option is deprecated, please use `comments.legal` instead.");
2919
- const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData);
2919
+ const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData, timings);
2920
2920
  return {
2921
2921
  dir,
2922
2922
  file: file == null ? void 0 : file,
@@ -2926,25 +2926,25 @@ function bindingifyOutputOptions(outputOptions, pluginContextData) {
2926
2926
  sourcemap: bindingifySourcemap(sourcemap),
2927
2927
  sourcemapBaseUrl,
2928
2928
  sourcemapDebugIds,
2929
- sourcemapFileNames,
2929
+ sourcemapFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapFileNames", sourcemapFileNames),
2930
2930
  sourcemapExcludeSources,
2931
- sourcemapIgnoreList: sourcemapIgnoreList ?? /node_modules/,
2932
- sourcemapPathTransform,
2933
- banner: bindingifyAddon(banner),
2934
- footer: bindingifyAddon(footer),
2935
- postBanner: bindingifyAddon(postBanner),
2936
- postFooter: bindingifyAddon(postFooter),
2937
- intro: bindingifyAddon(intro),
2938
- outro: bindingifyAddon(outro),
2931
+ sourcemapIgnoreList: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapIgnoreList", sourcemapIgnoreList ?? /node_modules/),
2932
+ sourcemapPathTransform: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapPathTransform", sourcemapPathTransform),
2933
+ banner: bindingifyAddon(banner, "banner", timings),
2934
+ footer: bindingifyAddon(footer, "footer", timings),
2935
+ postBanner: bindingifyAddon(postBanner, "postBanner", timings),
2936
+ postFooter: bindingifyAddon(postFooter, "postFooter", timings),
2937
+ intro: bindingifyAddon(intro, "intro", timings),
2938
+ outro: bindingifyAddon(outro, "outro", timings),
2939
2939
  extend: outputOptions.extend,
2940
- globals,
2941
- paths,
2940
+ globals: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "globals", globals),
2941
+ paths: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "paths", paths),
2942
2942
  generatedCode,
2943
2943
  esModule,
2944
2944
  name,
2945
2945
  assetFileNames: bindingifyAssetFilenames(assetFileNames),
2946
- entryFileNames,
2947
- chunkFileNames,
2946
+ entryFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "entryFileNames", entryFileNames),
2947
+ chunkFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "chunkFileNames", chunkFileNames),
2948
2948
  plugins: [],
2949
2949
  minify: outputOptions.minify,
2950
2950
  externalLiveBindings: outputOptions.externalLiveBindings,
@@ -2965,9 +2965,12 @@ function bindingifyOutputOptions(outputOptions, pluginContextData) {
2965
2965
  strict: outputOptions.strict
2966
2966
  };
2967
2967
  }
2968
- function bindingifyAddon(configAddon) {
2968
+ function bindingifyAddon(configAddon, name, timings) {
2969
2969
  if (configAddon == null || configAddon === "") return;
2970
- if (typeof configAddon === "function") return async (chunk) => configAddon(transformRenderedChunk(chunk));
2970
+ if (typeof configAddon === "function") {
2971
+ const measured = measureHookCost(timings, OUTPUT_OPTIONS_OWNER, name, configAddon);
2972
+ return async (chunk) => measured(transformRenderedChunk(chunk));
2973
+ }
2971
2974
  return configAddon;
2972
2975
  }
2973
2976
  function bindingifyFormat(format) {
@@ -3011,7 +3014,7 @@ function bindingifyComments(comments) {
3011
3014
  if (typeof comments === "boolean") return comments;
3012
3015
  return comments;
3013
3016
  }
3014
- function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks, pluginContextData) {
3017
+ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks, pluginContextData, timings) {
3015
3018
  let inlineDynamicImports;
3016
3019
  let effectiveChunksOption;
3017
3020
  if (codeSplitting === false) {
@@ -3054,10 +3057,11 @@ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, adva
3054
3057
  advancedChunksResult = {
3055
3058
  ...restOptions,
3056
3059
  groups: groups?.map((group) => {
3057
- const { name, ...restGroup } = group;
3060
+ const { name, test, ...restGroup } = group;
3058
3061
  return {
3059
3062
  ...restGroup,
3060
- name: typeof name === "function" ? (id, ctx) => name(id, new ChunkingContextImpl(ctx, pluginContextData)) : name
3063
+ test: typeof test === "function" ? measureHookCost(timings, OUTPUT_OPTIONS_OWNER, "codeSplitting groups[].test", test) : test,
3064
+ name: typeof name === "function" ? measureHookCost(timings, OUTPUT_OPTIONS_OWNER, "codeSplitting groups[].name", (id, ctx) => name(id, new ChunkingContextImpl(ctx, pluginContextData))) : name
3061
3065
  };
3062
3066
  })
3063
3067
  };
@@ -3134,7 +3138,7 @@ const availableParallelism = () => {
3134
3138
  };
3135
3139
  //#endregion
3136
3140
  //#region src/utils/create-bundler-option.ts
3137
- async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
3141
+ async function createBundlerOptions(inputOptions, outputOptions, watchMode, measureTimings = false) {
3138
3142
  const inputPlugins = await normalizePluginOption(inputOptions.plugins);
3139
3143
  const outputPlugins = await normalizePluginOption(outputOptions.plugins);
3140
3144
  const logLevel = inputOptions.logLevel || "info";
@@ -3144,14 +3148,20 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
3144
3148
  const normalizedInputPlugins = normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX);
3145
3149
  const normalizedOutputPlugins = normalizePlugins(hookOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX);
3146
3150
  let plugins = [...normalizedInputPlugins, ...checkOutputPluginOption(normalizedOutputPlugins, onLog)];
3151
+ const timings = measureTimings && inputOptions.checks?.pluginTimings !== false ? pluginTimingsRecorderFor(inputOptions) : void 0;
3152
+ if (timings) outputOptions = {
3153
+ ...outputOptions,
3154
+ assetFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "assetFileNames", outputOptions.assetFileNames),
3155
+ sanitizeFileName: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sanitizeFileName", outputOptions.sanitizeFileName)
3156
+ };
3147
3157
  const parallelPluginInitResult = await initializeParallelPlugins(plugins);
3148
3158
  if (inputOptions.experimental?.strictExecutionOrder !== void 0) console.warn("`experimental.strictExecutionOrder` has been stabilized and moved to `output.strictExecutionOrder`. Please update your configuration.");
3149
3159
  try {
3150
3160
  const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins);
3151
3161
  return {
3152
3162
  bundlerOptions: {
3153
- inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode),
3154
- outputOptions: bindingifyOutputOptions(outputOptions, pluginContextData),
3163
+ inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings),
3164
+ outputOptions: bindingifyOutputOptions(outputOptions, pluginContextData, timings),
3155
3165
  parallelPluginsRegistry: parallelPluginInitResult?.registry
3156
3166
  },
3157
3167
  inputOptions,
@@ -3376,10 +3376,6 @@ interface WatcherOptions {
3376
3376
  * File watcher options for configuring how file changes are detected.
3377
3377
  */
3378
3378
  watcher?: WatcherFileWatcherOptions;
3379
- /**
3380
- * @deprecated Use {@linkcode watcher} instead.
3381
- */
3382
- notify?: WatcherFileWatcherOptions;
3383
3379
  /**
3384
3380
  * Filter to limit the file-watching to certain files.
3385
3381
  *
@@ -1,4 +1,4 @@
1
- import { t as require_binding } from "./binding-Cv62mM1i.mjs";
1
+ import { t as require_binding } from "./binding-CKyeQZen.mjs";
2
2
  //#region src/types/sourcemap.ts
3
3
  function bindingifySourcemap(map) {
4
4
  if (map == null) return;
@@ -1,4 +1,4 @@
1
- import { t as rolldown } from "./rolldown-DP_p9pd3.mjs";
1
+ import { t as rolldown } from "./rolldown-I5b6h5Km.mjs";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { readdir } from "node:fs/promises";
@@ -1,4 +1,4 @@
1
- import { n as __toESM, t as require_binding } from "./binding-Cv62mM1i.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-CKyeQZen.mjs";
2
2
  import { l as logPluginError, n as error } from "./logs-DmYCAKcW.mjs";
3
3
  //#region src/builtin-plugin/utils.ts
4
4
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
@@ -1,5 +1,5 @@
1
- import { n as __toESM, t as require_binding } from "./binding-Cv62mM1i.mjs";
2
- //#region ../../node_modules/.pnpm/oxc-parser@0.142.0/node_modules/oxc-parser/src-js/wrap.js
1
+ import { n as __toESM, t as require_binding } from "./binding-CKyeQZen.mjs";
2
+ //#region ../../node_modules/.pnpm/oxc-parser@0.143.0/node_modules/oxc-parser/src-js/wrap.js
3
3
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
4
4
  function wrap(result) {
5
5
  let program, module, comments, errors;
@@ -1,5 +1,5 @@
1
- import { n as __toESM, t as require_binding } from "./binding-Cv62mM1i.mjs";
2
- import { a as bindingifySourcemap, n as normalizeBindingError } from "./error-BgfXq0Tb.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-CKyeQZen.mjs";
2
+ import { a as bindingifySourcemap, n as normalizeBindingError } from "./error-BzLGqhSQ.mjs";
3
3
  //#region src/utils/minify.ts
4
4
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
5
5
  /**
@@ -1,7 +1,7 @@
1
- import { n as __toESM, t as require_binding } from "./binding-Cv62mM1i.mjs";
2
- import { c as __decorate, d as PlainObjectLike, o as transformToRollupOutput, u as lazyProp } from "./bindingify-input-options-EnUlEF0T.mjs";
3
- import { l as PluginDriver, s as validateOption, t as createBundlerOptions } from "./create-bundler-option-4QtiLLuz.mjs";
4
- import { i as unwrapBindingResult } from "./error-BgfXq0Tb.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-CKyeQZen.mjs";
2
+ import { f as __decorate, h as PlainObjectLike, m as lazyProp, u as transformToRollupOutput } from "./bindingify-input-options-CMab5gbt.mjs";
3
+ import { l as PluginDriver, s as validateOption, t as createBundlerOptions } from "./create-bundler-option-BZD-ER-Z.mjs";
4
+ import { i as unwrapBindingResult } from "./error-BzLGqhSQ.mjs";
5
5
  //#region src/types/rolldown-output-impl.ts
6
6
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
7
7
  var RolldownOutputImpl = class extends PlainObjectLike {
@@ -123,7 +123,7 @@ var RolldownBuild = class {
123
123
  async #build(isWrite, outputOptions) {
124
124
  validateOption("output", outputOptions);
125
125
  await this.#stopWorkers?.();
126
- const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
126
+ const option = await createBundlerOptions(this.#inputOptions, outputOptions, false, true);
127
127
  try {
128
128
  this.#stopWorkers = option.stopWorkers;
129
129
  let output;
@@ -1,9 +1,9 @@
1
- import { n as __toESM, t as require_binding } from "./binding-Cv62mM1i.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-CKyeQZen.mjs";
2
2
  import { s as logMultipleWatcherOption } from "./logs-DmYCAKcW.mjs";
3
- import { y as LOG_LEVEL_WARN } from "./bindingify-input-options-EnUlEF0T.mjs";
3
+ import { C as LOG_LEVEL_WARN } from "./bindingify-input-options-CMab5gbt.mjs";
4
4
  import { t as arraify } from "./misc-DOSKtd97.mjs";
5
- import { l as PluginDriver, t as createBundlerOptions } from "./create-bundler-option-4QtiLLuz.mjs";
6
- import { t as aggregateBindingErrorsIntoJsError } from "./error-BgfXq0Tb.mjs";
5
+ import { l as PluginDriver, t as createBundlerOptions } from "./create-bundler-option-BZD-ER-Z.mjs";
6
+ import { t as aggregateBindingErrorsIntoJsError } from "./error-BzLGqhSQ.mjs";
7
7
  //#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
8
8
  /**
9
9
  * This is not the set of all possible signals.
@@ -327,7 +327,7 @@ function warnMultiplePollingOptions(bundlerOptions) {
327
327
  let found = false;
328
328
  for (const option of bundlerOptions) {
329
329
  const watch = option.inputOptions.watch;
330
- const watcher = watch && typeof watch === "object" ? watch.watcher ?? watch.notify : void 0;
330
+ const watcher = watch && typeof watch === "object" ? watch.watcher : void 0;
331
331
  if (watcher && (watcher.usePolling != null || watcher.pollInterval != null)) {
332
332
  if (found) {
333
333
  option.onLog(LOG_LEVEL_WARN, logMultipleWatcherOption());
@@ -2,7 +2,7 @@ import { _ as BindingTsconfigCompilerOptions, v as BindingTsconfigRawOptions } f
2
2
  import { a as MinifyOptions, c as minifySync, d as parse, f as parseSync, i as transformSync, l as ParseResult, n as TransformResult, o as MinifyResult, p as TsconfigCache, r as transform, s as minify, t as TransformOptions, u as ParserOptions } from "./shared/transform-WmU_cI8e.mjs";
3
3
  import * as ESTree from "@oxc-project/types";
4
4
  import { Program } from "@oxc-project/types";
5
- //#region ../../node_modules/.pnpm/oxc-parser@0.142.0/node_modules/oxc-parser/src-js/generated/visit/visitor.d.ts
5
+ //#region ../../node_modules/.pnpm/oxc-parser@0.143.0/node_modules/oxc-parser/src-js/generated/visit/visitor.d.ts
6
6
  interface VisitorObject$1 {
7
7
  DebuggerStatement?: (node: ESTree.DebuggerStatement) => void;
8
8
  "DebuggerStatement:exit"?: (node: ESTree.DebuggerStatement) => void;