rolldown 1.0.0-beta.7-commit.46fbc61 → 1.0.0-beta.7-commit.a684277

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 (124) hide show
  1. package/dist/cli.cjs +124 -17
  2. package/dist/cli.d.cts +1 -0
  3. package/dist/cli.d.mts +1 -0
  4. package/dist/cli.mjs +80 -15
  5. package/dist/experimental-index.cjs +31 -2
  6. package/dist/experimental-index.d.cts +94 -0
  7. package/dist/experimental-index.d.mts +94 -0
  8. package/dist/experimental-index.mjs +31 -2
  9. package/dist/index.cjs +2 -2
  10. package/dist/index.d.cts +4 -0
  11. package/dist/index.d.mts +4 -0
  12. package/dist/index.mjs +2 -2
  13. package/dist/parallel-plugin-worker.cjs +2 -2
  14. package/dist/parallel-plugin-worker.d.cts +1 -0
  15. package/dist/parallel-plugin-worker.d.mts +1 -0
  16. package/dist/parallel-plugin-worker.mjs +2 -2
  17. package/dist/parallel-plugin.d.cts +15 -0
  18. package/dist/parallel-plugin.d.mts +15 -0
  19. package/dist/parse-ast-index.cjs +1 -1
  20. package/dist/parse-ast-index.d.cts +9 -0
  21. package/dist/parse-ast-index.d.mts +9 -0
  22. package/dist/parse-ast-index.mjs +1 -1
  23. package/dist/shared/binding.d-BRtxlpZ6.d.mts +824 -0
  24. package/dist/shared/binding.d-CzSMPsR_.d.cts +824 -0
  25. package/dist/shared/input-options.d-Bc_A4cnr.d.cts +1072 -0
  26. package/dist/shared/input-options.d-Bk53WsIe.d.mts +1072 -0
  27. package/dist/shared/{parse-ast-index-CLx_7WML.cjs → parse-ast-index-3MkelEDZ.cjs} +10 -0
  28. package/dist/shared/{parse-ast-index-lybCSSSh.mjs → parse-ast-index-C93JXze5.mjs} +10 -0
  29. package/dist/shared/{src-CbcfNaXm.cjs → src--wu12-kY.cjs} +83 -4
  30. package/dist/shared/{src-Ca98NyM6.mjs → src-BBUt-xgm.mjs} +71 -4
  31. package/package.json +17 -21
  32. package/dist/tsconfig.tsbuildinfo +0 -1
  33. package/dist/types/api/build.d.ts +0 -18
  34. package/dist/types/api/experimental.d.ts +0 -7
  35. package/dist/types/api/rolldown/index.d.ts +0 -3
  36. package/dist/types/api/rolldown/rolldown-build.d.ts +0 -15
  37. package/dist/types/api/watch/index.d.ts +0 -3
  38. package/dist/types/api/watch/watch-emitter.d.ts +0 -31
  39. package/dist/types/api/watch/watcher.d.ts +0 -13
  40. package/dist/types/binding.d.ts +0 -1507
  41. package/dist/types/builtin-plugin/alias-plugin.d.ts +0 -10
  42. package/dist/types/builtin-plugin/constructors.d.ts +0 -23
  43. package/dist/types/builtin-plugin/replace-plugin.d.ts +0 -27
  44. package/dist/types/builtin-plugin/transform-plugin.d.ts +0 -9
  45. package/dist/types/builtin-plugin/utils.d.ts +0 -8
  46. package/dist/types/cli/arguments/alias.d.ts +0 -16
  47. package/dist/types/cli/arguments/index.d.ts +0 -15
  48. package/dist/types/cli/arguments/normalize.d.ts +0 -16
  49. package/dist/types/cli/arguments/utils.d.ts +0 -8
  50. package/dist/types/cli/commands/bundle.d.ts +0 -3
  51. package/dist/types/cli/commands/help.d.ts +0 -1
  52. package/dist/types/cli/index.d.ts +0 -1
  53. package/dist/types/cli/load-config.d.ts +0 -5
  54. package/dist/types/cli/logger.d.ts +0 -5
  55. package/dist/types/constants/plugin-context.d.ts +0 -7
  56. package/dist/types/constants/plugin.d.ts +0 -45
  57. package/dist/types/experimental-index.d.ts +0 -9
  58. package/dist/types/index.d.ts +0 -31
  59. package/dist/types/log/log-handler.d.ts +0 -4
  60. package/dist/types/log/logger.d.ts +0 -6
  61. package/dist/types/log/logging.d.ts +0 -12
  62. package/dist/types/log/logs.d.ts +0 -18
  63. package/dist/types/options/generated/checks-options.d.ts +0 -57
  64. package/dist/types/options/input-options.d.ts +0 -185
  65. package/dist/types/options/normalized-input-options.d.ts +0 -18
  66. package/dist/types/options/normalized-output-options.d.ts +0 -70
  67. package/dist/types/options/output-options.d.ts +0 -182
  68. package/dist/types/options/watch-options.d.ts +0 -5
  69. package/dist/types/parallel-plugin-worker.d.ts +0 -1
  70. package/dist/types/parallel-plugin.d.ts +0 -1
  71. package/dist/types/parse-ast-index.d.ts +0 -5
  72. package/dist/types/plugin/bindingify-build-hooks.d.ts +0 -10
  73. package/dist/types/plugin/bindingify-hook-filter.d.ts +0 -7
  74. package/dist/types/plugin/bindingify-output-hooks.d.ts +0 -14
  75. package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +0 -8
  76. package/dist/types/plugin/bindingify-plugin.d.ts +0 -17
  77. package/dist/types/plugin/bindingify-watch-hooks.d.ts +0 -5
  78. package/dist/types/plugin/generated/hook-usage.d.ts +0 -29
  79. package/dist/types/plugin/hook-filter.d.ts +0 -49
  80. package/dist/types/plugin/index.d.ts +0 -141
  81. package/dist/types/plugin/minimal-plugin-context.d.ts +0 -24
  82. package/dist/types/plugin/parallel-plugin-implementation.d.ts +0 -10
  83. package/dist/types/plugin/parallel-plugin.d.ts +0 -9
  84. package/dist/types/plugin/plugin-context-data.d.ts +0 -22
  85. package/dist/types/plugin/plugin-context.d.ts +0 -67
  86. package/dist/types/plugin/plugin-driver.d.ts +0 -10
  87. package/dist/types/plugin/transform-plugin-context.d.ts +0 -28
  88. package/dist/types/plugin/with-filter.d.ts +0 -10
  89. package/dist/types/types/assert.d.ts +0 -14
  90. package/dist/types/types/config-export.d.ts +0 -5
  91. package/dist/types/types/misc.d.ts +0 -40
  92. package/dist/types/types/module-info.d.ts +0 -15
  93. package/dist/types/types/module-side-effects.d.ts +0 -12
  94. package/dist/types/types/output-bundle.d.ts +0 -4
  95. package/dist/types/types/rolldown-options.d.ts +0 -5
  96. package/dist/types/types/rolldown-output.d.ts +0 -66
  97. package/dist/types/types/schema.d.ts +0 -33
  98. package/dist/types/types/sourcemap.d.ts +0 -14
  99. package/dist/types/types/utils.d.ts +0 -13
  100. package/dist/types/types.d.ts +0 -7
  101. package/dist/types/utils/asset-source.d.ts +0 -4
  102. package/dist/types/utils/async-flatten.d.ts +0 -1
  103. package/dist/types/utils/bindingify-input-options.d.ts +0 -7
  104. package/dist/types/utils/bindingify-output-options.d.ts +0 -5
  105. package/dist/types/utils/code-frame.d.ts +0 -1
  106. package/dist/types/utils/compose-js-plugins.d.ts +0 -2
  107. package/dist/types/utils/create-bundler-option.d.ts +0 -11
  108. package/dist/types/utils/create-bundler.d.ts +0 -9
  109. package/dist/types/utils/define-config.d.ts +0 -5
  110. package/dist/types/utils/error.d.ts +0 -2
  111. package/dist/types/utils/initialize-parallel-plugins.d.ts +0 -17
  112. package/dist/types/utils/misc.d.ts +0 -7
  113. package/dist/types/utils/normalize-hook.d.ts +0 -7
  114. package/dist/types/utils/normalize-plugin-option.d.ts +0 -13
  115. package/dist/types/utils/normalize-string-or-regex.d.ts +0 -2
  116. package/dist/types/utils/plugin/index.d.ts +0 -2
  117. package/dist/types/utils/resolved-external.d.ts +0 -4
  118. package/dist/types/utils/transform-module-info.d.ts +0 -4
  119. package/dist/types/utils/transform-rendered-chunk.d.ts +0 -4
  120. package/dist/types/utils/transform-rendered-module.d.ts +0 -3
  121. package/dist/types/utils/transform-side-effects.d.ts +0 -3
  122. package/dist/types/utils/transform-sourcemap.d.ts +0 -3
  123. package/dist/types/utils/transform-to-rollup-output.d.ts +0 -11
  124. package/dist/types/utils/validator.d.ts +0 -6
package/dist/cli.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require('./shared/chunk-qZFfknuJ.cjs');
2
- const require_src = require('./shared/src-CbcfNaXm.cjs');
3
- require('./shared/parse-ast-index-CLx_7WML.cjs');
2
+ const require_src = require('./shared/src--wu12-kY.cjs');
3
+ require('./shared/parse-ast-index-3MkelEDZ.cjs');
4
4
  const node_fs = require_chunk.__toESM(require("node:fs"));
5
5
  const node_path = require_chunk.__toESM(require("node:path"));
6
6
  const ansis = require_chunk.__toESM(require("ansis"));
@@ -957,9 +957,22 @@ function createConsola(options$1 = {}) {
957
957
  defaults: { level },
958
958
  stdout: process.stdout,
959
959
  stderr: process.stderr,
960
- prompt: (...args) => Promise.resolve().then(function() {
961
- return require("./shared/prompt-_yrURmmm.cjs");
962
- }).then((m) => m.prompt(...args)),
960
+ prompt: (...args) => Promise.resolve().then(
961
+ // Zero-width space, non-joiner, joiner, left-to-right mark, right-to-left mark
962
+ // Zero-width no-break space
963
+ // Combining diacritical marks
964
+ // Combining diacritical marks extended
965
+ // Combining diacritical marks supplement
966
+ // Combining diacritical marks for symbols
967
+ // Combining half marks
968
+ // Linux console (kernel)
969
+ // Windows Terminal
970
+ // Terminus (<0.2.27)
971
+ // ConEmu and cmder
972
+ function() {
973
+ return require("./shared/prompt-_yrURmmm.cjs");
974
+ }
975
+ ).then((m) => m.prompt(...args)),
963
976
  reporters: options$1.reporters || [options$1.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
964
977
  ...options$1
965
978
  });
@@ -974,6 +987,9 @@ const consola = createConsola();
974
987
 
975
988
  //#endregion
976
989
  //#region src/cli/logger.ts
990
+ /**
991
+ * Console logger
992
+ */
977
993
  const logger = process.env.ROLLDOWN_TEST ? createTestingLogger() : createConsola({ formatOptions: { date: false } });
978
994
  function createTestingLogger() {
979
995
  const types = [
@@ -1121,7 +1137,8 @@ function normalizeCliOptions(cliOptions, positionals) {
1121
1137
  process.exit(1);
1122
1138
  }
1123
1139
  }
1124
- if (!result.config && positionals.length > 0) result.input.input = positionals;
1140
+ if (!result.config && positionals.length > 0) if (Array.isArray(result.input.input)) result.input.input.push(...positionals);
1141
+ else result.input.input = positionals;
1125
1142
  return result;
1126
1143
  }
1127
1144
 
@@ -1217,6 +1234,32 @@ function parseCliArguments() {
1217
1234
 
1218
1235
  //#endregion
1219
1236
  //#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
1237
+ /**
1238
+ * This is not the set of all possible signals.
1239
+ *
1240
+ * It IS, however, the set of all signals that trigger
1241
+ * an exit on either Linux or BSD systems. Linux is a
1242
+ * superset of the signal names supported on BSD, and
1243
+ * the unknown signals just fail to register, so we can
1244
+ * catch that easily enough.
1245
+ *
1246
+ * Windows signals are a different set, since there are
1247
+ * signals that terminate Windows processes, but don't
1248
+ * terminate (or don't even exist) on Posix systems.
1249
+ *
1250
+ * Don't bother with SIGKILL. It's uncatchable, which
1251
+ * means that we can't fire any callbacks anyway.
1252
+ *
1253
+ * If a user does happen to register a handler on a non-
1254
+ * fatal signal like SIGWINCH or something, and then
1255
+ * exit, it'll end up firing `process.emit('exit')`, so
1256
+ * the handler will be fired anyway.
1257
+ *
1258
+ * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
1259
+ * artificially, inherently leave the process in a
1260
+ * state from which it is not safe to try and enter JS
1261
+ * listeners.
1262
+ */
1220
1263
  const signals = [];
1221
1264
  signals.push("SIGHUP", "SIGINT", "SIGTERM");
1222
1265
  if (process.platform !== "win32") signals.push(
@@ -1515,6 +1558,67 @@ async function loadConfig(configPath) {
1515
1558
  }
1516
1559
  }
1517
1560
 
1561
+ //#endregion
1562
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.64.0/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js
1563
+ var require_usingCtx = require_chunk.__commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.64.0/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(exports, module) {
1564
+ function _usingCtx() {
1565
+ var r$1 = "function" == typeof SuppressedError ? SuppressedError : function(r$2, e$1) {
1566
+ var n$2 = Error();
1567
+ return n$2.name = "SuppressedError", n$2.error = r$2, n$2.suppressed = e$1, n$2;
1568
+ }, e = {}, n$1 = [];
1569
+ function using(r$2, e$1) {
1570
+ if (null != e$1) {
1571
+ if (Object(e$1) !== e$1) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
1572
+ if (r$2) var o$1 = e$1[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")];
1573
+ if (void 0 === o$1 && (o$1 = e$1[Symbol.dispose || Symbol["for"]("Symbol.dispose")], r$2)) var t$1 = o$1;
1574
+ if ("function" != typeof o$1) throw new TypeError("Object is not disposable.");
1575
+ t$1 && (o$1 = function o$2() {
1576
+ try {
1577
+ t$1.call(e$1);
1578
+ } catch (r$3) {
1579
+ return Promise.reject(r$3);
1580
+ }
1581
+ }), n$1.push({
1582
+ v: e$1,
1583
+ d: o$1,
1584
+ a: r$2
1585
+ });
1586
+ } else r$2 && n$1.push({
1587
+ d: e$1,
1588
+ a: r$2
1589
+ });
1590
+ return e$1;
1591
+ }
1592
+ return {
1593
+ e,
1594
+ u: using.bind(null, !1),
1595
+ a: using.bind(null, !0),
1596
+ d: function d() {
1597
+ var o$1, t$1 = this.e, s$1 = 0;
1598
+ function next() {
1599
+ for (; o$1 = n$1.pop();) try {
1600
+ if (!o$1.a && 1 === s$1) return s$1 = 0, n$1.push(o$1), Promise.resolve().then(next);
1601
+ if (o$1.d) {
1602
+ var r$2 = o$1.d.call(o$1.v);
1603
+ if (o$1.a) return s$1 |= 2, Promise.resolve(r$2).then(next, err);
1604
+ } else s$1 |= 1;
1605
+ } catch (r$3) {
1606
+ return err(r$3);
1607
+ }
1608
+ if (1 === s$1) return t$1 !== e ? Promise.reject(t$1) : Promise.resolve();
1609
+ if (t$1 !== e) throw t$1;
1610
+ }
1611
+ function err(n$2) {
1612
+ return t$1 = t$1 !== e ? new r$1(n$2, t$1) : n$2, next();
1613
+ }
1614
+ return next();
1615
+ }
1616
+ };
1617
+ }
1618
+ module.exports = _usingCtx, module.exports.__esModule = true, module.exports["default"] = module.exports;
1619
+ } });
1620
+ var import_usingCtx = require_chunk.__toESM(require_usingCtx());
1621
+
1518
1622
  //#endregion
1519
1623
  //#region src/cli/commands/bundle.ts
1520
1624
  async function bundleWithConfig(configPath, cliOptions) {
@@ -1527,17 +1631,18 @@ async function bundleWithConfig(configPath, cliOptions) {
1527
1631
  else await bundleInner(config, cliOptions);
1528
1632
  }
1529
1633
  async function bundleWithCliOptions(cliOptions) {
1530
- if (cliOptions.output.dir || cliOptions.output.file) {
1531
- const operation = cliOptions.watch ? watchInner : bundleInner;
1532
- await operation({}, cliOptions);
1533
- return;
1534
- }
1535
- if (cliOptions.watch) {
1536
- logger.error("You must specify `output.dir` to use watch mode");
1537
- process.exit(1);
1538
- }
1539
- const build = await require_src.rolldown(cliOptions.input);
1540
1634
  try {
1635
+ var _usingCtx$1 = (0, import_usingCtx.default)();
1636
+ if (cliOptions.output.dir || cliOptions.output.file) {
1637
+ const operation = cliOptions.watch ? watchInner : bundleInner;
1638
+ await operation({}, cliOptions);
1639
+ return;
1640
+ }
1641
+ if (cliOptions.watch) {
1642
+ logger.error("You must specify `output.dir` to use watch mode");
1643
+ process.exit(1);
1644
+ }
1645
+ const build = _usingCtx$1.a(await require_src.rolldown(cliOptions.input));
1541
1646
  const { output: outputs } = await build.generate(cliOptions.output);
1542
1647
  if (outputs.length === 0) {
1543
1648
  logger.error("No output generated");
@@ -1547,8 +1652,10 @@ async function bundleWithCliOptions(cliOptions) {
1547
1652
  if (outputs.length > 1) logger.log(`\n${ansis.default.cyan(ansis.default.bold(`|→ ${file.fileName}:`))}\n`);
1548
1653
  console.log(file.type === "asset" ? file.source : file.code);
1549
1654
  }
1655
+ } catch (_$1) {
1656
+ _usingCtx$1.e = _$1;
1550
1657
  } finally {
1551
- await build.close();
1658
+ await _usingCtx$1.d();
1552
1659
  }
1553
1660
  }
1554
1661
  async function watchInner(config, cliOptions) {
package/dist/cli.d.cts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/dist/cli.d.mts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { __commonJS, __esm } from "./shared/chunk-DUYDk_2O.mjs";
2
- import { arraify, description, getInputCliKeys, getJsonSchema, getOutputCliKeys, init_misc, init_rolldown, init_validator, init_watch, rolldown, validateCliOptions, version, watch } from "./shared/src-Ca98NyM6.mjs";
3
- import "./shared/parse-ast-index-lybCSSSh.mjs";
1
+ import { __commonJS, __esm, __toESM } from "./shared/chunk-DUYDk_2O.mjs";
2
+ import { arraify, description, getInputCliKeys, getJsonSchema, getOutputCliKeys, init_misc, init_rolldown, init_validator, init_watch, rolldown, validateCliOptions, version, watch } from "./shared/src-BBUt-xgm.mjs";
3
+ import "./shared/parse-ast-index-C93JXze5.mjs";
4
4
  import fs from "node:fs";
5
5
  import path, { sep } from "node:path";
6
6
  import colors from "ansis";
@@ -1144,7 +1144,8 @@ function normalizeCliOptions(cliOptions, positionals) {
1144
1144
  process.exit(1);
1145
1145
  }
1146
1146
  }
1147
- if (!result.config && positionals.length > 0) result.input.input = positionals;
1147
+ if (!result.config && positionals.length > 0) if (Array.isArray(result.input.input)) result.input.input.push(...positionals);
1148
+ else result.input.input = positionals;
1148
1149
  return result;
1149
1150
  }
1150
1151
  var init_normalize = __esm({ "src/cli/arguments/normalize.ts"() {
@@ -1562,6 +1563,67 @@ var init_load_config = __esm({ "src/cli/load-config.ts"() {
1562
1563
  DEFAULT_CONFIG_BASE = "rolldown.config";
1563
1564
  } });
1564
1565
 
1566
+ //#endregion
1567
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.64.0/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js
1568
+ var require_usingCtx = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.64.0/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(exports, module) {
1569
+ function _usingCtx() {
1570
+ var r$1 = "function" == typeof SuppressedError ? SuppressedError : function(r$2, e$1) {
1571
+ var n$2 = Error();
1572
+ return n$2.name = "SuppressedError", n$2.error = r$2, n$2.suppressed = e$1, n$2;
1573
+ }, e = {}, n$1 = [];
1574
+ function using(r$2, e$1) {
1575
+ if (null != e$1) {
1576
+ if (Object(e$1) !== e$1) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
1577
+ if (r$2) var o$1 = e$1[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")];
1578
+ if (void 0 === o$1 && (o$1 = e$1[Symbol.dispose || Symbol["for"]("Symbol.dispose")], r$2)) var t$1 = o$1;
1579
+ if ("function" != typeof o$1) throw new TypeError("Object is not disposable.");
1580
+ t$1 && (o$1 = function o$2() {
1581
+ try {
1582
+ t$1.call(e$1);
1583
+ } catch (r$3) {
1584
+ return Promise.reject(r$3);
1585
+ }
1586
+ }), n$1.push({
1587
+ v: e$1,
1588
+ d: o$1,
1589
+ a: r$2
1590
+ });
1591
+ } else r$2 && n$1.push({
1592
+ d: e$1,
1593
+ a: r$2
1594
+ });
1595
+ return e$1;
1596
+ }
1597
+ return {
1598
+ e,
1599
+ u: using.bind(null, !1),
1600
+ a: using.bind(null, !0),
1601
+ d: function d() {
1602
+ var o$1, t$1 = this.e, s$1 = 0;
1603
+ function next() {
1604
+ for (; o$1 = n$1.pop();) try {
1605
+ if (!o$1.a && 1 === s$1) return s$1 = 0, n$1.push(o$1), Promise.resolve().then(next);
1606
+ if (o$1.d) {
1607
+ var r$2 = o$1.d.call(o$1.v);
1608
+ if (o$1.a) return s$1 |= 2, Promise.resolve(r$2).then(next, err);
1609
+ } else s$1 |= 1;
1610
+ } catch (r$3) {
1611
+ return err(r$3);
1612
+ }
1613
+ if (1 === s$1) return t$1 !== e ? Promise.reject(t$1) : Promise.resolve();
1614
+ if (t$1 !== e) throw t$1;
1615
+ }
1616
+ function err(n$2) {
1617
+ return t$1 = t$1 !== e ? new r$1(n$2, t$1) : n$2, next();
1618
+ }
1619
+ return next();
1620
+ }
1621
+ };
1622
+ }
1623
+ module.exports = _usingCtx, module.exports.__esModule = true, module.exports["default"] = module.exports;
1624
+ } });
1625
+ var import_usingCtx = __toESM(require_usingCtx());
1626
+
1565
1627
  //#endregion
1566
1628
  //#region src/cli/commands/bundle.ts
1567
1629
  async function bundleWithConfig(configPath, cliOptions) {
@@ -1574,17 +1636,18 @@ async function bundleWithConfig(configPath, cliOptions) {
1574
1636
  else await bundleInner(config, cliOptions);
1575
1637
  }
1576
1638
  async function bundleWithCliOptions(cliOptions) {
1577
- if (cliOptions.output.dir || cliOptions.output.file) {
1578
- const operation = cliOptions.watch ? watchInner : bundleInner;
1579
- await operation({}, cliOptions);
1580
- return;
1581
- }
1582
- if (cliOptions.watch) {
1583
- logger.error("You must specify `output.dir` to use watch mode");
1584
- process.exit(1);
1585
- }
1586
- const build = await rolldown(cliOptions.input);
1587
1639
  try {
1640
+ var _usingCtx$1 = (0, import_usingCtx.default)();
1641
+ if (cliOptions.output.dir || cliOptions.output.file) {
1642
+ const operation = cliOptions.watch ? watchInner : bundleInner;
1643
+ await operation({}, cliOptions);
1644
+ return;
1645
+ }
1646
+ if (cliOptions.watch) {
1647
+ logger.error("You must specify `output.dir` to use watch mode");
1648
+ process.exit(1);
1649
+ }
1650
+ const build = _usingCtx$1.a(await rolldown(cliOptions.input));
1588
1651
  const { output: outputs } = await build.generate(cliOptions.output);
1589
1652
  if (outputs.length === 0) {
1590
1653
  logger.error("No output generated");
@@ -1594,8 +1657,10 @@ async function bundleWithCliOptions(cliOptions) {
1594
1657
  if (outputs.length > 1) logger.log(`\n${colors.cyan(colors.bold(`|→ ${file.fileName}:`))}\n`);
1595
1658
  console.log(file.type === "asset" ? file.source : file.code);
1596
1659
  }
1660
+ } catch (_$1) {
1661
+ _usingCtx$1.e = _$1;
1597
1662
  } finally {
1598
- await build.close();
1663
+ await _usingCtx$1.d();
1599
1664
  }
1600
1665
  }
1601
1666
  async function watchInner(config, cliOptions) {
@@ -1,10 +1,15 @@
1
1
  "use strict";
2
2
  const require_chunk = require('./shared/chunk-qZFfknuJ.cjs');
3
- const require_src = require('./shared/src-CbcfNaXm.cjs');
4
- const require_parse_ast_index = require('./shared/parse-ast-index-CLx_7WML.cjs');
3
+ const require_src = require('./shared/src--wu12-kY.cjs');
4
+ const require_parse_ast_index = require('./shared/parse-ast-index-3MkelEDZ.cjs');
5
5
  const node_url = require_chunk.__toESM(require("node:url"));
6
6
 
7
7
  //#region src/api/experimental.ts
8
+ /**
9
+ * This is an experimental API. It's behavior may change in the future.
10
+ *
11
+ * Calling this API will only execute the scan stage of rolldown.
12
+ */
8
13
  const experimental_scan = async (input) => {
9
14
  const { bundler, stopWorkers } = await require_src.createBundler(input, {});
10
15
  const output = await bundler.scan();
@@ -31,6 +36,30 @@ function aliasPlugin(config) {
31
36
 
32
37
  //#endregion
33
38
  //#region src/builtin-plugin/replace-plugin.ts
39
+ /**
40
+ * Replaces targeted strings in files while bundling.
41
+ *
42
+ * @example
43
+ * // Basic usage
44
+ * ```js
45
+ * replacePlugin({
46
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
47
+ * __buildDate__: () => JSON.stringify(new Date()),
48
+ * __buildVersion: 15
49
+ * })
50
+ * ```
51
+ * @example
52
+ * // With options
53
+ * ```js
54
+ * replacePlugin({
55
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
56
+ * __buildDate__: () => JSON.stringify(new Date()),
57
+ * __buildVersion: 15
58
+ * }, {
59
+ * preventAssignment: false,
60
+ * })
61
+ * ```
62
+ */
34
63
  function replacePlugin(values = {}, options = {}) {
35
64
  return new require_src.BuiltinPlugin("builtin:replace", {
36
65
  ...options,
@@ -0,0 +1,94 @@
1
+ import { BindingReplacePluginConfig, BindingTransformPluginConfig, TransformOptions, TransformResult$1 as TransformResult, moduleRunnerTransform, transform } from "./shared/binding.d-CzSMPsR_.cjs";
2
+ import { BuiltinPlugin, InputOptions, RolldownPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, reportPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "./shared/input-options.d-Bc_A4cnr.cjs";
3
+
4
+ //#region src/api/experimental.d.ts
5
+ /**
6
+ * This is an experimental API. It's behavior may change in the future.
7
+ *
8
+ * Calling this API will only execute the scan stage of rolldown.
9
+ */
10
+ /**
11
+ * This is an experimental API. It's behavior may change in the future.
12
+ *
13
+ * Calling this API will only execute the scan stage of rolldown.
14
+ */
15
+ declare const experimental_scan: (input: InputOptions) => Promise<void>;
16
+
17
+ //#endregion
18
+ //#region src/utils/compose-js-plugins.d.ts
19
+ declare function composeJsPlugins(plugins: RolldownPlugin[]): RolldownPlugin[];
20
+
21
+ //#endregion
22
+ //#region src/builtin-plugin/alias-plugin.d.ts
23
+ type AliasPluginAlias = {
24
+ find: string | RegExp
25
+ replacement: string
26
+ };
27
+ type AliasPluginConfig = {
28
+ entries: AliasPluginAlias[]
29
+ };
30
+ declare function aliasPlugin(config: AliasPluginConfig): BuiltinPlugin;
31
+
32
+ //#endregion
33
+ //#region src/builtin-plugin/replace-plugin.d.ts
34
+ /**
35
+ * Replaces targeted strings in files while bundling.
36
+ *
37
+ * @example
38
+ * // Basic usage
39
+ * ```js
40
+ * replacePlugin({
41
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
42
+ * __buildDate__: () => JSON.stringify(new Date()),
43
+ * __buildVersion: 15
44
+ * })
45
+ * ```
46
+ * @example
47
+ * // With options
48
+ * ```js
49
+ * replacePlugin({
50
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
51
+ * __buildDate__: () => JSON.stringify(new Date()),
52
+ * __buildVersion: 15
53
+ * }, {
54
+ * preventAssignment: false,
55
+ * })
56
+ * ```
57
+ */
58
+ /**
59
+ * Replaces targeted strings in files while bundling.
60
+ *
61
+ * @example
62
+ * // Basic usage
63
+ * ```js
64
+ * replacePlugin({
65
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
66
+ * __buildDate__: () => JSON.stringify(new Date()),
67
+ * __buildVersion: 15
68
+ * })
69
+ * ```
70
+ * @example
71
+ * // With options
72
+ * ```js
73
+ * replacePlugin({
74
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
75
+ * __buildDate__: () => JSON.stringify(new Date()),
76
+ * __buildVersion: 15
77
+ * }, {
78
+ * preventAssignment: false,
79
+ * })
80
+ * ```
81
+ */
82
+ declare function replacePlugin(values?: BindingReplacePluginConfig["values"], options?: Omit<BindingReplacePluginConfig, "values">): BuiltinPlugin;
83
+
84
+ //#endregion
85
+ //#region src/builtin-plugin/transform-plugin.d.ts
86
+ type TransformPattern = string | RegExp | (RegExp | string)[];
87
+ type TransformPluginConfig = Omit<BindingTransformPluginConfig, "include" | "exclude"> & {
88
+ include?: TransformPattern
89
+ exclude?: TransformPattern
90
+ };
91
+ declare function transformPlugin(config?: TransformPluginConfig): BuiltinPlugin;
92
+
93
+ //#endregion
94
+ export { TransformOptions, TransformResult, aliasPlugin, buildImportAnalysisPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, replacePlugin, reportPlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin };
@@ -0,0 +1,94 @@
1
+ import { BindingReplacePluginConfig, BindingTransformPluginConfig, TransformOptions, TransformResult$1 as TransformResult, moduleRunnerTransform, transform } from "./shared/binding.d-BRtxlpZ6.mjs";
2
+ import { BuiltinPlugin$1 as BuiltinPlugin, InputOptions, RolldownPlugin, buildImportAnalysisPlugin$1 as buildImportAnalysisPlugin, defineParallelPlugin, dynamicImportVarsPlugin$1 as dynamicImportVarsPlugin, importGlobPlugin$1 as importGlobPlugin, isolatedDeclarationPlugin$1 as isolatedDeclarationPlugin, jsonPlugin$1 as jsonPlugin, loadFallbackPlugin$1 as loadFallbackPlugin, manifestPlugin$1 as manifestPlugin, moduleFederationPlugin$1 as moduleFederationPlugin, modulePreloadPolyfillPlugin$1 as modulePreloadPolyfillPlugin, reportPlugin$1 as reportPlugin, viteResolvePlugin$1 as viteResolvePlugin, wasmFallbackPlugin$1 as wasmFallbackPlugin, wasmHelperPlugin$1 as wasmHelperPlugin } from "./shared/input-options.d-Bk53WsIe.mjs";
3
+
4
+ //#region src/api/experimental.d.ts
5
+ /**
6
+ * This is an experimental API. It's behavior may change in the future.
7
+ *
8
+ * Calling this API will only execute the scan stage of rolldown.
9
+ */
10
+ /**
11
+ * This is an experimental API. It's behavior may change in the future.
12
+ *
13
+ * Calling this API will only execute the scan stage of rolldown.
14
+ */
15
+ declare const experimental_scan: (input: InputOptions) => Promise<void>;
16
+
17
+ //#endregion
18
+ //#region src/utils/compose-js-plugins.d.ts
19
+ declare function composeJsPlugins(plugins: RolldownPlugin[]): RolldownPlugin[];
20
+
21
+ //#endregion
22
+ //#region src/builtin-plugin/alias-plugin.d.ts
23
+ type AliasPluginAlias = {
24
+ find: string | RegExp
25
+ replacement: string
26
+ };
27
+ type AliasPluginConfig = {
28
+ entries: AliasPluginAlias[]
29
+ };
30
+ declare function aliasPlugin(config: AliasPluginConfig): BuiltinPlugin;
31
+
32
+ //#endregion
33
+ //#region src/builtin-plugin/replace-plugin.d.ts
34
+ /**
35
+ * Replaces targeted strings in files while bundling.
36
+ *
37
+ * @example
38
+ * // Basic usage
39
+ * ```js
40
+ * replacePlugin({
41
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
42
+ * __buildDate__: () => JSON.stringify(new Date()),
43
+ * __buildVersion: 15
44
+ * })
45
+ * ```
46
+ * @example
47
+ * // With options
48
+ * ```js
49
+ * replacePlugin({
50
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
51
+ * __buildDate__: () => JSON.stringify(new Date()),
52
+ * __buildVersion: 15
53
+ * }, {
54
+ * preventAssignment: false,
55
+ * })
56
+ * ```
57
+ */
58
+ /**
59
+ * Replaces targeted strings in files while bundling.
60
+ *
61
+ * @example
62
+ * // Basic usage
63
+ * ```js
64
+ * replacePlugin({
65
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
66
+ * __buildDate__: () => JSON.stringify(new Date()),
67
+ * __buildVersion: 15
68
+ * })
69
+ * ```
70
+ * @example
71
+ * // With options
72
+ * ```js
73
+ * replacePlugin({
74
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
75
+ * __buildDate__: () => JSON.stringify(new Date()),
76
+ * __buildVersion: 15
77
+ * }, {
78
+ * preventAssignment: false,
79
+ * })
80
+ * ```
81
+ */
82
+ declare function replacePlugin(values?: BindingReplacePluginConfig["values"], options?: Omit<BindingReplacePluginConfig, "values">): BuiltinPlugin;
83
+
84
+ //#endregion
85
+ //#region src/builtin-plugin/transform-plugin.d.ts
86
+ type TransformPattern = string | RegExp | (RegExp | string)[];
87
+ type TransformPluginConfig = Omit<BindingTransformPluginConfig, "include" | "exclude"> & {
88
+ include?: TransformPattern
89
+ exclude?: TransformPattern
90
+ };
91
+ declare function transformPlugin(config?: TransformPluginConfig): BuiltinPlugin;
92
+
93
+ //#endregion
94
+ export { TransformOptions, TransformResult, aliasPlugin, buildImportAnalysisPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, replacePlugin, reportPlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin };
@@ -1,10 +1,15 @@
1
- import { BuiltinPlugin, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, init_compose_js_plugins, init_constructors, init_create_bundler, init_normalize_string_or_regex, init_transform_to_rollup_output, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reportPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "./shared/src-Ca98NyM6.mjs";
2
- import { import_binding } from "./shared/parse-ast-index-lybCSSSh.mjs";
1
+ import { BuiltinPlugin, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, init_compose_js_plugins, init_constructors, init_create_bundler, init_normalize_string_or_regex, init_transform_to_rollup_output, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reportPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "./shared/src-BBUt-xgm.mjs";
2
+ import { import_binding } from "./shared/parse-ast-index-C93JXze5.mjs";
3
3
  import { pathToFileURL } from "node:url";
4
4
 
5
5
  //#region src/api/experimental.ts
6
6
  init_create_bundler();
7
7
  init_transform_to_rollup_output();
8
+ /**
9
+ * This is an experimental API. It's behavior may change in the future.
10
+ *
11
+ * Calling this API will only execute the scan stage of rolldown.
12
+ */
8
13
  const experimental_scan = async (input) => {
9
14
  const { bundler, stopWorkers } = await createBundler(input, {});
10
15
  const output = await bundler.scan();
@@ -33,6 +38,30 @@ function aliasPlugin(config) {
33
38
  //#endregion
34
39
  //#region src/builtin-plugin/replace-plugin.ts
35
40
  init_constructors();
41
+ /**
42
+ * Replaces targeted strings in files while bundling.
43
+ *
44
+ * @example
45
+ * // Basic usage
46
+ * ```js
47
+ * replacePlugin({
48
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
49
+ * __buildDate__: () => JSON.stringify(new Date()),
50
+ * __buildVersion: 15
51
+ * })
52
+ * ```
53
+ * @example
54
+ * // With options
55
+ * ```js
56
+ * replacePlugin({
57
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
58
+ * __buildDate__: () => JSON.stringify(new Date()),
59
+ * __buildVersion: 15
60
+ * }, {
61
+ * preventAssignment: false,
62
+ * })
63
+ * ```
64
+ */
36
65
  function replacePlugin(values = {}, options = {}) {
37
66
  return new BuiltinPlugin("builtin:replace", {
38
67
  ...options,
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
- const require_src = require('./shared/src-CbcfNaXm.cjs');
2
- require('./shared/parse-ast-index-CLx_7WML.cjs');
1
+ const require_src = require('./shared/src--wu12-kY.cjs');
2
+ require('./shared/parse-ast-index-3MkelEDZ.cjs');
3
3
 
4
4
  exports.VERSION = require_src.VERSION
5
5
  exports.build = require_src.build
@@ -0,0 +1,4 @@
1
+ import { PreRenderedChunk } from "./shared/binding.d-CzSMPsR_.cjs";
2
+ import { AsyncPluginHooks, BuildOptions, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GetModuleInfo, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, JsxOptions, LoadResult, LogLevel, LogOrStringHandler, LoggingFunction, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RollupError, RollupLog, SourceDescription, SourceMap, SourceMapInput, StringFilter, TransformPluginContext, TransformResult, VERSION, WarningHandlerWithDefault, WatchOptions, build, defineConfig, rolldown, watch, withFilter } from "./shared/input-options.d-Bc_A4cnr.cjs";
3
+
4
+ export { AsyncPluginHooks, BuildOptions, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GetModuleInfo, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, JsxOptions, LoadResult, LogLevel, LogOrStringHandler, LoggingFunction, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RollupError, RollupLog, SourceDescription, SourceMap, SourceMapInput, StringFilter, TransformPluginContext, TransformResult, VERSION, WarningHandlerWithDefault, WatchOptions, build, defineConfig, rolldown, watch, withFilter };
@@ -0,0 +1,4 @@
1
+ import { PreRenderedChunk } from "./shared/binding.d-BRtxlpZ6.mjs";
2
+ import { AsyncPluginHooks, BuildOptions, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GetModuleInfo, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, JsxOptions, LoadResult, LogLevel, LogOrStringHandler, LoggingFunction, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RollupError, RollupLog, SourceDescription, SourceMap, SourceMapInput, StringFilter, TransformPluginContext, TransformResult, VERSION$1 as VERSION, WarningHandlerWithDefault, WatchOptions, build$1 as build, defineConfig$1 as defineConfig, rolldown$1 as rolldown, watch$1 as watch, withFilter$1 as withFilter } from "./shared/input-options.d-Bk53WsIe.mjs";
3
+
4
+ export { AsyncPluginHooks, BuildOptions, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GetModuleInfo, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, JsxOptions, LoadResult, LogLevel, LogOrStringHandler, LoggingFunction, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RollupError, RollupLog, SourceDescription, SourceMap, SourceMapInput, StringFilter, TransformPluginContext, TransformResult, VERSION, WarningHandlerWithDefault, WatchOptions, build, defineConfig, rolldown, watch, withFilter };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { VERSION, build, defineConfig, init_src, rolldown, watch, withFilter } from "./shared/src-Ca98NyM6.mjs";
2
- import "./shared/parse-ast-index-lybCSSSh.mjs";
1
+ import { VERSION, build, defineConfig, init_src, rolldown, watch, withFilter } from "./shared/src-BBUt-xgm.mjs";
2
+ import "./shared/parse-ast-index-C93JXze5.mjs";
3
3
 
4
4
  init_src();
5
5
  export { VERSION, build, defineConfig, rolldown, watch, withFilter };
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require('./shared/chunk-qZFfknuJ.cjs');
2
- const require_src = require('./shared/src-CbcfNaXm.cjs');
3
- const require_parse_ast_index = require('./shared/parse-ast-index-CLx_7WML.cjs');
2
+ const require_src = require('./shared/src--wu12-kY.cjs');
3
+ const require_parse_ast_index = require('./shared/parse-ast-index-3MkelEDZ.cjs');
4
4
  const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
5
5
 
6
6
  //#region src/parallel-plugin-worker.ts
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };