@rollipop/rolldown 1.0.26 → 1.0.28

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-ifF5pKXl.mjs +679 -0
  17. package/dist/shared/{bindingify-input-options-BXQG8xz-.mjs → bindingify-input-options-CK5aV8zx.mjs} +246 -27
  18. package/dist/shared/{constructors-CNB5XL7Q.mjs → constructors-D-nFqBpo.mjs} +1 -1
  19. package/dist/shared/{constructors-BIHQ8UmW.d.mts → constructors-ZoBQ0vUm.d.mts} +1 -1
  20. package/dist/shared/{create-bundler-option-Be4KJzGL.mjs → create-bundler-option-BCSGycof.mjs} +36 -26
  21. package/dist/shared/{define-config-thpMQ05a.d.mts → define-config-B4s318Ge.d.mts} +3 -6
  22. package/dist/shared/{error-bm-jLrD1.mjs → error-C9I-OQs1.mjs} +1 -1
  23. package/dist/shared/{load-config-Bu7-JwX4.mjs → load-config-CE9Pt71R.mjs} +1 -1
  24. package/dist/shared/{normalize-string-or-regex-CiPu-0L6.mjs → normalize-string-or-regex-D58FhCur.mjs} +1 -1
  25. package/dist/shared/{parse-DFZrcERz.mjs → parse-BySe_25L.mjs} +2 -2
  26. package/dist/shared/{resolve-tsconfig-CsDgQmsO.mjs → resolve-tsconfig-DJFsWuhV.mjs} +2 -2
  27. package/dist/shared/{rolldown-CnVo3ESi.mjs → rolldown-DU5IqqRG.mjs} +5 -5
  28. package/dist/shared/{watch-WV6bq5kw.mjs → watch-BwY0As4l.mjs} +5 -5
  29. package/dist/utils-index.d.mts +1 -1
  30. package/dist/utils-index.mjs +15 -13
  31. package/package.json +18 -16
  32. package/dist/shared/binding-D_XVvOPT.mjs +0 -668
@@ -1,8 +1,8 @@
1
- import { n as __toESM, t as require_binding } from "./binding-D_XVvOPT.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-ifF5pKXl.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-CiPu-0L6.mjs";
3
+ import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-D58FhCur.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-bm-jLrD1.mjs";
5
+ import { a as bindingifySourcemap, i as unwrapBindingResult, t as aggregateBindingErrorsIntoJsError } from "./error-C9I-OQs1.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.0.26";
13
+ var version = "1.0.28";
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);
@@ -1793,8 +1793,221 @@ function extractHookUsage(plugin) {
1793
1793
  return hookUsage;
1794
1794
  }
1795
1795
  //#endregion
1796
+ //#region src/utils/plugin-timings.ts
1797
+ /**
1798
+ * Measure what plugin hooks cost, from inside the JavaScript callback.
1799
+ *
1800
+ * Internal to Rolldown. Nothing here is on a public entry point, and the measurement is not
1801
+ * offered as an API — the only consumer is the core, which pulls it while the build closes.
1802
+ *
1803
+ * The bundler core can only bracket *dispatch* and *completion*. For a hook it invokes
1804
+ * concurrently those two points are separated mostly by the queue the call waited in on
1805
+ * JavaScript's single thread, and the queue is deepest behind whichever callback is doing
1806
+ * the most work — so the hook blocking the thread dilutes its own credit while cheap hooks
1807
+ * collect credit for waiting. Ranking from those numbers reliably puts the *cheapest* hook
1808
+ * first.
1809
+ *
1810
+ * The missing quantity is when the callback began running, and that is known here. Starting
1811
+ * the clock inside the callback removes the dispatch queue by construction.
1812
+ *
1813
+ * ## `maxInFlight` decides whether a total means anything
1814
+ *
1815
+ * Entry-to-exit spans may be summed only if they never overlap. A synchronous callback
1816
+ * cannot overlap: it holds the thread until it returns. An `async` one can — it may suspend
1817
+ * at an `await` and let another call of the same hook begin, and then both spans cover the
1818
+ * same wall clock and the sum counts it twice.
1819
+ *
1820
+ * Overlap also changes what the span is measuring. A hook that awaits the bundler (say
1821
+ * `this.resolve`) spends most of its span waiting for Rust, so the number describes the
1822
+ * bundler rather than the plugin. Observed on a real build: one `resolveId` accumulated
1823
+ * ~47,000s of span inside a 44s module-loading window.
1824
+ *
1825
+ * So overlap is measured rather than assumed, per hook: `overlapMs` is the wall time
1826
+ * double counted in `ms` because two or more calls were in flight together. A hook is
1827
+ * reported with a number when that is a negligible share of its span, and named without one
1828
+ * when it is not.
1829
+ *
1830
+ * The test is deliberately a tolerance rather than "did this ever happen". A peak in-flight
1831
+ * count of 2 can mean one incidental overlap in twenty thousand calls, and discarding a
1832
+ * twelve-second measurement over that both throws away good data and makes the report
1833
+ * depend on scheduling luck — the same hook would appear in one run and vanish in the next.
1834
+ *
1835
+ * This keeps the rule the core followed — never present a number that cannot be defended —
1836
+ * while narrowing "cannot measure" from a property of the *call site* to a property of the
1837
+ * *callback*, which is where it actually lives. A hook dispatched concurrently but whose
1838
+ * body barely overlaps is measured to within the tolerance.
1839
+ *
1840
+ * A measured row is still wall time for that callback rather than CPU: a hook that awaits
1841
+ * I/O without overlapping another call of itself is charged for the wait. Excluding the
1842
+ * dispatch queue is what this buys; it does not distinguish running from awaiting.
1843
+ */
1844
+ /**
1845
+ * How much of a hook's span may be double counted before its total stops being reportable,
1846
+ * as a fraction of that span.
1847
+ */
1848
+ const OVERLAP_TOLERANCE = .01;
1849
+ /**
1850
+ * One recorder per build, keyed on the object that identifies it.
1851
+ *
1852
+ * Counters cannot be module-global. A plugin is free to run a nested `rolldown()` build of
1853
+ * its own, which finishes first; shared counters would let it flush the outer build's
1854
+ * half-accumulated totals and report a window belonging to neither.
1855
+ */
1856
+ const recorders = /* @__PURE__ */ new WeakMap();
1857
+ /** The recorder for one build, created on first use. */
1858
+ function pluginTimingsRecorderFor(key) {
1859
+ let recorder = recorders.get(key);
1860
+ if (recorder === void 0) {
1861
+ recorder = {
1862
+ costs: /* @__PURE__ */ new Map(),
1863
+ busyMs: 0,
1864
+ inFlight: 0,
1865
+ busyStart: 0
1866
+ };
1867
+ recorders.set(key, recorder);
1868
+ }
1869
+ return recorder;
1870
+ }
1871
+ function costFor(recorder, owner, hookName) {
1872
+ let byHook = recorder.costs.get(owner.key);
1873
+ if (byHook === void 0) {
1874
+ byHook = /* @__PURE__ */ new Map();
1875
+ recorder.costs.set(owner.key, byHook);
1876
+ }
1877
+ let cost = byHook.get(hookName);
1878
+ if (cost === void 0) {
1879
+ cost = {
1880
+ owner: owner.name,
1881
+ kind: owner.kind,
1882
+ hookName,
1883
+ calls: 0,
1884
+ ms: 0,
1885
+ inFlight: 0,
1886
+ maxInFlight: 0,
1887
+ overlapMs: 0,
1888
+ lastChange: 0
1889
+ };
1890
+ byHook.set(hookName, cost);
1891
+ }
1892
+ return cost;
1893
+ }
1894
+ /**
1895
+ * Fold the interval since the last in-flight change into `overlapMs`, then move the mark.
1896
+ * Call immediately before every increment and decrement of `cost.inFlight`.
1897
+ */
1898
+ function markInFlightChange(cost, at) {
1899
+ if (cost.inFlight > 1) cost.overlapMs += (cost.inFlight - 1) * (at - cost.lastChange);
1900
+ cost.lastChange = at;
1901
+ }
1902
+ /**
1903
+ * Close out one call. A module-level function rather than a closure per invocation: hooks
1904
+ * run hundreds of thousands of times in a large build, and the synchronous path would
1905
+ * otherwise allocate one closure per call only to invoke it immediately.
1906
+ */
1907
+ function settle(recorder, cost, started) {
1908
+ const ended = performance.now();
1909
+ markInFlightChange(cost, ended);
1910
+ cost.inFlight -= 1;
1911
+ cost.ms += ended - started;
1912
+ recorder.inFlight -= 1;
1913
+ if (recorder.inFlight === 0) recorder.busyMs += ended - recorder.busyStart;
1914
+ }
1915
+ /**
1916
+ * Wrap one callback so its execution time is recorded.
1917
+ *
1918
+ * Returns the callback untouched when there is no recorder, so a build that is not
1919
+ * measuring pays nothing beyond one branch at setup.
1920
+ */
1921
+ function measureHookCost(recorder, owner, hookName, handler) {
1922
+ if (recorder === void 0) return handler;
1923
+ const cost = costFor(recorder, owner, hookName);
1924
+ return function(...args) {
1925
+ const started = performance.now();
1926
+ markInFlightChange(cost, started);
1927
+ cost.calls += 1;
1928
+ cost.inFlight += 1;
1929
+ if (cost.inFlight > cost.maxInFlight) cost.maxInFlight = cost.inFlight;
1930
+ if (recorder.inFlight === 0) recorder.busyStart = started;
1931
+ recorder.inFlight += 1;
1932
+ let result;
1933
+ try {
1934
+ result = handler.apply(this, args);
1935
+ } catch (error) {
1936
+ settle(recorder, cost, started);
1937
+ throw error;
1938
+ }
1939
+ if (typeof result?.then === "function") return result.then((value) => {
1940
+ settle(recorder, cost, started);
1941
+ return value;
1942
+ }, (error) => {
1943
+ settle(recorder, cost, started);
1944
+ throw error;
1945
+ });
1946
+ settle(recorder, cost, started);
1947
+ return result;
1948
+ };
1949
+ }
1950
+ /**
1951
+ * The owner shown for user callbacks the core invokes directly rather than through a
1952
+ * plugin. One shared identity: they are all configured on the same options object.
1953
+ */
1954
+ const OUTPUT_OPTIONS_OWNER = {
1955
+ key: Symbol("output options"),
1956
+ name: "output options",
1957
+ kind: "outputOption"
1958
+ };
1959
+ /** As {@link OUTPUT_OPTIONS_OWNER}, for callbacks configured on the input options. */
1960
+ const INPUT_OPTIONS_OWNER = {
1961
+ key: Symbol("input options"),
1962
+ name: "input options",
1963
+ kind: "inputOption"
1964
+ };
1965
+ /**
1966
+ * Wrap `value` when the user supplied a function, and leave every other form alone.
1967
+ *
1968
+ * Most option callbacks are declared as `string | RegExp | Function | ...`, so this keeps
1969
+ * the one cast the wrapping needs in a single place.
1970
+ */
1971
+ function measureIfFunction(recorder, owner, hookName, value) {
1972
+ if (typeof value !== "function") return value;
1973
+ return measureHookCost(recorder, owner, hookName, value);
1974
+ }
1975
+ /**
1976
+ * What the build's callbacks have cost so far, leaving the recorder in place.
1977
+ *
1978
+ * Ungated on purpose: whether a build is worth reporting on is decided from the clocks Rust
1979
+ * holds, so the question is not this side's to ask.
1980
+ *
1981
+ * Rust calls this while the build is closing, so what it gets includes `closeBundle`.
1982
+ */
1983
+ function summarizePluginTimings(key) {
1984
+ const recorder = recorders.get(key);
1985
+ if (recorder === void 0) return {
1986
+ busyMs: 0,
1987
+ rows: []
1988
+ };
1989
+ const rows = [];
1990
+ for (const byHook of recorder.costs.values()) for (const cost of byHook.values()) {
1991
+ if (cost.calls === 0) continue;
1992
+ rows.push({
1993
+ owner: cost.owner,
1994
+ kind: cost.kind,
1995
+ hook: cost.hookName,
1996
+ calls: cost.calls,
1997
+ ms: cost.ms,
1998
+ maxInFlight: cost.maxInFlight,
1999
+ overlapMs: cost.overlapMs,
2000
+ rankable: cost.overlapMs <= cost.ms * OVERLAP_TOLERANCE
2001
+ });
2002
+ }
2003
+ return {
2004
+ busyMs: recorder.busyMs,
2005
+ rows
2006
+ };
2007
+ }
2008
+ //#endregion
1796
2009
  //#region src/plugin/bindingify-plugin.ts
1797
- function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
2010
+ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings) {
1798
2011
  const args = {
1799
2012
  plugin,
1800
2013
  options,
@@ -1829,7 +2042,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
1829
2042
  const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
1830
2043
  const { plugin: transformCacheHit, meta: transformCacheHitMeta } = bindingifyTransformCacheHit(args);
1831
2044
  let hookUsage = extractHookUsage(plugin).inner();
1832
- return wrapHandlers({
2045
+ const result = {
1833
2046
  name: plugin.name,
1834
2047
  buildStart,
1835
2048
  buildStartMeta,
@@ -1882,9 +2095,14 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
1882
2095
  transformCacheHit,
1883
2096
  transformCacheHitMeta,
1884
2097
  hookUsage
1885
- });
2098
+ };
2099
+ return wrapHandlers(result, {
2100
+ key: plugin,
2101
+ name: result.name,
2102
+ kind: "plugin"
2103
+ }, timings);
1886
2104
  }
1887
- function wrapHandlers(plugin) {
2105
+ function wrapHandlers(plugin, owner, timings) {
1888
2106
  for (const hookName of [
1889
2107
  "buildStart",
1890
2108
  "resolveId",
@@ -1910,7 +2128,8 @@ function wrapHandlers(plugin) {
1910
2128
  "closeWatcher",
1911
2129
  "transformCacheHit"
1912
2130
  ]) {
1913
- const handler = plugin[hookName];
2131
+ const raw = plugin[hookName];
2132
+ const handler = raw && measureHookCost(timings, owner, hookName, raw);
1914
2133
  if (handler) plugin[hookName] = async (...args) => {
1915
2134
  try {
1916
2135
  return await handler(...args);
@@ -1980,27 +2199,27 @@ function getDefaultDevRuntime(host = "localhost", port = 3e3) {
1980
2199
  }
1981
2200
  //#endregion
1982
2201
  //#region src/utils/bindingify-input-options.ts
1983
- function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
2202
+ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings) {
1984
2203
  const plugins = rawPlugins.map((plugin) => {
1985
2204
  if (getParallelPluginInfo(plugin)) return;
1986
2205
  if (plugin instanceof BuiltinPlugin) switch (plugin.name) {
1987
2206
  case "builtin:vite-manifest": return bindingifyManifestPlugin(plugin, pluginContextData);
1988
2207
  default: return bindingifyBuiltInPlugin(plugin);
1989
2208
  }
1990
- return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
2209
+ return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings);
1991
2210
  });
1992
2211
  const normalizedTransform = normalizeTransformOptions(inputOptions);
1993
2212
  return {
1994
2213
  input: bindingifyInput(inputOptions.input),
1995
2214
  plugins,
1996
2215
  cwd: inputOptions.cwd ?? process.cwd(),
1997
- external: bindingifyExternal(inputOptions.external),
2216
+ external: bindingifyExternal(inputOptions.external, timings),
1998
2217
  resolve: bindingifyResolve(inputOptions.resolve),
1999
2218
  platform: inputOptions.platform,
2000
2219
  shimMissingExports: inputOptions.shimMissingExports,
2001
2220
  logLevel: bindingifyLogLevel(logLevel),
2002
2221
  onLog,
2003
- treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
2222
+ treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake, timings),
2004
2223
  moduleTypes: inputOptions.moduleTypes,
2005
2224
  define: normalizedTransform.define,
2006
2225
  inject: bindingifyInject(normalizedTransform.inject),
@@ -2011,6 +2230,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginC
2011
2230
  dropLabels: normalizedTransform.dropLabels,
2012
2231
  keepNames: outputOptions.keepNames,
2013
2232
  checks: inputOptions.checks,
2233
+ pluginTimings: timings ? () => summarizePluginTimings(inputOptions) : void 0,
2014
2234
  deferSyncScanData: () => {
2015
2235
  let ret = [];
2016
2236
  pluginContextData.moduleOptionMap.forEach((value, key) => {
@@ -2053,12 +2273,15 @@ function bindingifyAttachDebugInfo(attachDebugInfo) {
2053
2273
  case "none": return import_binding.BindingAttachDebugInfo.None;
2054
2274
  }
2055
2275
  }
2056
- function bindingifyExternal(external) {
2276
+ function bindingifyExternal(external, timings) {
2057
2277
  if (external) {
2058
- if (typeof external === "function") return (id, importer, isResolved) => {
2059
- if (id.startsWith("\0")) return false;
2060
- return external(id, importer, isResolved) ?? false;
2061
- };
2278
+ if (typeof external === "function") {
2279
+ const measured = measureHookCost(timings, INPUT_OPTIONS_OWNER, "external", external);
2280
+ return (id, importer, isResolved) => {
2281
+ if (id.startsWith("\0")) return false;
2282
+ return measured(id, importer, isResolved) ?? false;
2283
+ };
2284
+ }
2062
2285
  return arraify(external);
2063
2286
  }
2064
2287
  }
@@ -2149,11 +2372,7 @@ function bindingifyInput(input) {
2149
2372
  }
2150
2373
  function bindingifyWatch(watch) {
2151
2374
  if (watch) {
2152
- if (watch.notify) console.warn("The \"watch.notify\" option is deprecated. Please use \"watch.watcher\" instead.");
2153
- const watcher = {
2154
- ...watch.notify,
2155
- ...watch.watcher
2156
- };
2375
+ const watcher = watch.watcher ?? {};
2157
2376
  return {
2158
2377
  buildDelay: watch.buildDelay,
2159
2378
  skipWrite: watch.skipWrite,
@@ -2169,7 +2388,7 @@ function bindingifyWatch(watch) {
2169
2388
  };
2170
2389
  }
2171
2390
  }
2172
- function bindingifyTreeshakeOptions(config) {
2391
+ function bindingifyTreeshakeOptions(config, timings) {
2173
2392
  if (config === false) return;
2174
2393
  if (config === true || config === void 0) return { moduleSideEffects: true };
2175
2394
  let normalizedConfig = {
@@ -2200,7 +2419,7 @@ function bindingifyTreeshakeOptions(config) {
2200
2419
  external: false,
2201
2420
  sideEffects: true
2202
2421
  }];
2203
- else normalizedConfig.moduleSideEffects = config.moduleSideEffects;
2422
+ else normalizedConfig.moduleSideEffects = measureIfFunction(timings, INPUT_OPTIONS_OWNER, "treeshake.moduleSideEffects", config.moduleSideEffects);
2204
2423
  return normalizedConfig;
2205
2424
  }
2206
2425
  function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative) {
@@ -2222,4 +2441,4 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
2222
2441
  };
2223
2442
  }
2224
2443
  //#endregion
2225
- 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 };
2444
+ 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-CiPu-0L6.mjs";
1
+ import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-D58FhCur.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 { A as BindingViteResolvePluginConfig, C as BindingViteDynamicImportVarsPluginConfig, D as BindingViteModulePreloadPolyfillPluginConfig, O as BindingViteReactRefreshWrapperPluginConfig, S as BindingViteBuildImportAnalysisPluginConfig, T as BindingViteJsonPluginConfig, k as BindingViteReporterPluginConfig, l as BindingIsolatedDeclarationPluginConfig, s as BindingEsmExternalRequirePluginConfig, w as BindingViteImportGlobPluginConfig } from "./binding-We_IfeZk.mjs";
2
- import { Gt as StringOrRegExp, I as BuiltinPlugin } from "./define-config-thpMQ05a.mjs";
2
+ import { Gt as StringOrRegExp, I as BuiltinPlugin } from "./define-config-B4s318Ge.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-D_XVvOPT.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-ifF5pKXl.mjs";
2
2
  import { a as logInputHookInOutputPlugin, n as error } from "./logs-DmYCAKcW.mjs";
3
- import { n as BuiltinPlugin } from "./normalize-string-or-regex-CiPu-0L6.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-BXQG8xz-.mjs";
3
+ import { n as BuiltinPlugin } from "./normalize-string-or-regex-D58FhCur.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-CK5aV8zx.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";
@@ -2924,10 +2924,10 @@ function createTestingLogger() {
2924
2924
  }
2925
2925
  //#endregion
2926
2926
  //#region src/utils/bindingify-output-options.ts
2927
- function bindingifyOutputOptions(outputOptions, pluginContextData) {
2927
+ function bindingifyOutputOptions(outputOptions, pluginContextData, timings) {
2928
2928
  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;
2929
2929
  if (legalComments != null) logger.warn("`legalComments` option is deprecated, please use `comments.legal` instead.");
2930
- const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData);
2930
+ const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData, timings);
2931
2931
  return {
2932
2932
  dir,
2933
2933
  file: file == null ? void 0 : file,
@@ -2937,25 +2937,25 @@ function bindingifyOutputOptions(outputOptions, pluginContextData) {
2937
2937
  sourcemap: bindingifySourcemap(sourcemap),
2938
2938
  sourcemapBaseUrl,
2939
2939
  sourcemapDebugIds,
2940
- sourcemapFileNames,
2940
+ sourcemapFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapFileNames", sourcemapFileNames),
2941
2941
  sourcemapExcludeSources,
2942
- sourcemapIgnoreList: sourcemapIgnoreList ?? /node_modules/,
2943
- sourcemapPathTransform,
2944
- banner: bindingifyAddon(banner),
2945
- footer: bindingifyAddon(footer),
2946
- postBanner: bindingifyAddon(postBanner),
2947
- postFooter: bindingifyAddon(postFooter),
2948
- intro: bindingifyAddon(intro),
2949
- outro: bindingifyAddon(outro),
2942
+ sourcemapIgnoreList: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapIgnoreList", sourcemapIgnoreList ?? /node_modules/),
2943
+ sourcemapPathTransform: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapPathTransform", sourcemapPathTransform),
2944
+ banner: bindingifyAddon(banner, "banner", timings),
2945
+ footer: bindingifyAddon(footer, "footer", timings),
2946
+ postBanner: bindingifyAddon(postBanner, "postBanner", timings),
2947
+ postFooter: bindingifyAddon(postFooter, "postFooter", timings),
2948
+ intro: bindingifyAddon(intro, "intro", timings),
2949
+ outro: bindingifyAddon(outro, "outro", timings),
2950
2950
  extend: outputOptions.extend,
2951
- globals,
2952
- paths,
2951
+ globals: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "globals", globals),
2952
+ paths: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "paths", paths),
2953
2953
  generatedCode,
2954
2954
  esModule,
2955
2955
  name,
2956
2956
  assetFileNames: bindingifyAssetFilenames(assetFileNames),
2957
- entryFileNames,
2958
- chunkFileNames,
2957
+ entryFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "entryFileNames", entryFileNames),
2958
+ chunkFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "chunkFileNames", chunkFileNames),
2959
2959
  plugins: [],
2960
2960
  minify: outputOptions.minify,
2961
2961
  externalLiveBindings: outputOptions.externalLiveBindings,
@@ -2977,9 +2977,12 @@ function bindingifyOutputOptions(outputOptions, pluginContextData) {
2977
2977
  persistentCache: outputOptions.persistentCache
2978
2978
  };
2979
2979
  }
2980
- function bindingifyAddon(configAddon) {
2980
+ function bindingifyAddon(configAddon, name, timings) {
2981
2981
  if (configAddon == null || configAddon === "") return;
2982
- if (typeof configAddon === "function") return async (chunk) => configAddon(transformRenderedChunk(chunk));
2982
+ if (typeof configAddon === "function") {
2983
+ const measured = measureHookCost(timings, OUTPUT_OPTIONS_OWNER, name, configAddon);
2984
+ return async (chunk) => measured(transformRenderedChunk(chunk));
2985
+ }
2983
2986
  return configAddon;
2984
2987
  }
2985
2988
  function bindingifyFormat(format) {
@@ -3024,7 +3027,7 @@ function bindingifyComments(comments) {
3024
3027
  if (typeof comments === "boolean") return comments;
3025
3028
  return comments;
3026
3029
  }
3027
- function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks, pluginContextData) {
3030
+ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks, pluginContextData, timings) {
3028
3031
  let inlineDynamicImports;
3029
3032
  let effectiveChunksOption;
3030
3033
  if (codeSplitting === false) {
@@ -3067,10 +3070,11 @@ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, adva
3067
3070
  advancedChunksResult = {
3068
3071
  ...restOptions,
3069
3072
  groups: groups?.map((group) => {
3070
- const { name, ...restGroup } = group;
3073
+ const { name, test, ...restGroup } = group;
3071
3074
  return {
3072
3075
  ...restGroup,
3073
- name: typeof name === "function" ? (id, ctx) => name(id, new ChunkingContextImpl(ctx, pluginContextData)) : name
3076
+ test: typeof test === "function" ? measureHookCost(timings, OUTPUT_OPTIONS_OWNER, "codeSplitting groups[].test", test) : test,
3077
+ name: typeof name === "function" ? measureHookCost(timings, OUTPUT_OPTIONS_OWNER, "codeSplitting groups[].name", (id, ctx) => name(id, new ChunkingContextImpl(ctx, pluginContextData))) : name
3074
3078
  };
3075
3079
  })
3076
3080
  };
@@ -3147,7 +3151,7 @@ const availableParallelism = () => {
3147
3151
  };
3148
3152
  //#endregion
3149
3153
  //#region src/utils/create-bundler-option.ts
3150
- async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
3154
+ async function createBundlerOptions(inputOptions, outputOptions, watchMode, measureTimings = false) {
3151
3155
  const inputPlugins = await normalizePluginOption(inputOptions.plugins);
3152
3156
  const outputPlugins = await normalizePluginOption(outputOptions.plugins);
3153
3157
  const logLevel = inputOptions.logLevel || "info";
@@ -3157,14 +3161,20 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
3157
3161
  const normalizedInputPlugins = normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX);
3158
3162
  const normalizedOutputPlugins = normalizePlugins(hookOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX);
3159
3163
  let plugins = [...normalizedInputPlugins, ...checkOutputPluginOption(normalizedOutputPlugins, onLog)];
3164
+ const timings = measureTimings && inputOptions.checks?.pluginTimings !== false ? pluginTimingsRecorderFor(inputOptions) : void 0;
3165
+ if (timings) outputOptions = {
3166
+ ...outputOptions,
3167
+ assetFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "assetFileNames", outputOptions.assetFileNames),
3168
+ sanitizeFileName: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sanitizeFileName", outputOptions.sanitizeFileName)
3169
+ };
3160
3170
  const parallelPluginInitResult = await initializeParallelPlugins(plugins);
3161
3171
  if (inputOptions.experimental?.strictExecutionOrder !== void 0) console.warn("`experimental.strictExecutionOrder` has been stabilized and moved to `output.strictExecutionOrder`. Please update your configuration.");
3162
3172
  try {
3163
3173
  const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins);
3164
3174
  return {
3165
3175
  bundlerOptions: {
3166
- inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode),
3167
- outputOptions: bindingifyOutputOptions(outputOptions, pluginContextData),
3176
+ inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings),
3177
+ outputOptions: bindingifyOutputOptions(outputOptions, pluginContextData, timings),
3168
3178
  parallelPluginsRegistry: parallelPluginInitResult?.registry
3169
3179
  },
3170
3180
  inputOptions,
@@ -3402,10 +3402,6 @@ interface WatcherOptions {
3402
3402
  * File watcher options for configuring how file changes are detected.
3403
3403
  */
3404
3404
  watcher?: WatcherFileWatcherOptions;
3405
- /**
3406
- * @deprecated Use {@linkcode watcher} instead.
3407
- */
3408
- notify?: WatcherFileWatcherOptions;
3409
3405
  /**
3410
3406
  * Filter to limit the file-watching to certain files.
3411
3407
  *
@@ -4009,8 +4005,9 @@ interface InputOptions {
4009
4005
  * Devtools integration options.
4010
4006
  *
4011
4007
  * When enabled, Rolldown writes JSON-lines devtools output under
4012
- * `node_modules/.rolldown/{session_id}/`. Consumers can parse the output with
4013
- * `@rollipop/rolldown-debug` after `await bundle.close()` resolves.
4008
+ * `node_modules/.rolldown/{session_id}/`, resolved against {@linkcode cwd}.
4009
+ * Consumers can parse the output with `@rollipop/rolldown-debug` after
4010
+ * `await bundle.close()` resolves.
4014
4011
  *
4015
4012
  * @experimental
4016
4013
  */
@@ -1,4 +1,4 @@
1
- import { t as require_binding } from "./binding-D_XVvOPT.mjs";
1
+ import { t as require_binding } from "./binding-ifF5pKXl.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-CnVo3ESi.mjs";
1
+ import { t as rolldown } from "./rolldown-DU5IqqRG.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-D_XVvOPT.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-ifF5pKXl.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-D_XVvOPT.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-ifF5pKXl.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-D_XVvOPT.mjs";
2
- import { a as bindingifySourcemap, n as normalizeBindingError } from "./error-bm-jLrD1.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-ifF5pKXl.mjs";
2
+ import { a as bindingifySourcemap, n as normalizeBindingError } from "./error-C9I-OQs1.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-D_XVvOPT.mjs";
2
- import { c as __decorate, d as PlainObjectLike, o as transformToRollupOutput, u as lazyProp } from "./bindingify-input-options-BXQG8xz-.mjs";
3
- import { l as PluginDriver, s as validateOption, t as createBundlerOptions } from "./create-bundler-option-Be4KJzGL.mjs";
4
- import { i as unwrapBindingResult } from "./error-bm-jLrD1.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-ifF5pKXl.mjs";
2
+ import { f as __decorate, h as PlainObjectLike, m as lazyProp, u as transformToRollupOutput } from "./bindingify-input-options-CK5aV8zx.mjs";
3
+ import { l as PluginDriver, s as validateOption, t as createBundlerOptions } from "./create-bundler-option-BCSGycof.mjs";
4
+ import { i as unwrapBindingResult } from "./error-C9I-OQs1.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-D_XVvOPT.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-ifF5pKXl.mjs";
2
2
  import { s as logMultipleWatcherOption } from "./logs-DmYCAKcW.mjs";
3
- import { y as LOG_LEVEL_WARN } from "./bindingify-input-options-BXQG8xz-.mjs";
3
+ import { C as LOG_LEVEL_WARN } from "./bindingify-input-options-CK5aV8zx.mjs";
4
4
  import { t as arraify } from "./misc-DOSKtd97.mjs";
5
- import { l as PluginDriver, t as createBundlerOptions } from "./create-bundler-option-Be4KJzGL.mjs";
6
- import { t as aggregateBindingErrorsIntoJsError } from "./error-bm-jLrD1.mjs";
5
+ import { l as PluginDriver, t as createBundlerOptions } from "./create-bundler-option-BCSGycof.mjs";
6
+ import { t as aggregateBindingErrorsIntoJsError } from "./error-C9I-OQs1.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 { b as BindingTsconfigRawOptions, y as BindingTsconfigCompilerOptions } 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-CsZGbS4Q.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;