rolldown 0.14.0 → 0.15.0-snapshot-b2570e7-20241204003545

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 (94) hide show
  1. package/dist/cjs/cli.cjs +782 -854
  2. package/dist/cjs/experimental-index.cjs +68 -26
  3. package/dist/cjs/index.cjs +6 -8
  4. package/dist/cjs/parallel-plugin-worker.cjs +20 -14
  5. package/dist/cjs/parallel-plugin.cjs +1 -3
  6. package/dist/esm/cli.mjs +722 -796
  7. package/dist/esm/experimental-index.mjs +44 -7
  8. package/dist/esm/index.mjs +2 -4
  9. package/dist/esm/parallel-plugin-worker.mjs +15 -10
  10. package/dist/esm/parallel-plugin.mjs +1 -3
  11. package/dist/shared/{chunk-JoMxl5V2.cjs → chunk-BK2Ye-xa.cjs} +19 -6
  12. package/dist/shared/{consola.36c0034f-Xyw7SC_7.mjs → consola_36c0034f-DWsVjwtA.mjs} +218 -283
  13. package/dist/shared/{consola.36c0034f-HcmWcfPe.cjs → consola_36c0034f-_8_dG1Nr.cjs} +249 -295
  14. package/dist/shared/{prompt-hoPhcrA-.mjs → prompt-DGW8ZJmn.mjs} +125 -174
  15. package/dist/shared/{prompt-9Ij3R3TG.cjs → prompt-RFvZMmjc.cjs} +157 -204
  16. package/dist/shared/src-1jxF0vle.cjs +2917 -0
  17. package/dist/shared/src-Cm19F5A9.mjs +2789 -0
  18. package/dist/types/api/build.d.ts +16 -0
  19. package/dist/types/api/experimental.d.ts +7 -0
  20. package/dist/types/api/rolldown/index.d.ts +3 -0
  21. package/dist/types/api/rolldown/rolldown-build.d.ts +12 -0
  22. package/dist/types/api/watch/index.d.ts +3 -0
  23. package/dist/types/{watcher.d.ts → api/watch/watch-emitter.d.ts} +17 -17
  24. package/dist/types/api/watch/watcher.d.ts +13 -0
  25. package/dist/types/binding.d.ts +175 -40
  26. package/dist/types/builtin-plugin/alias-plugin.d.ts +10 -0
  27. package/dist/types/builtin-plugin/constructors.d.ts +20 -0
  28. package/dist/types/builtin-plugin/replace-plugin.d.ts +28 -0
  29. package/dist/types/{options/normalized-ecma-transform-plugin-config.d.ts → builtin-plugin/transform-plugin.d.ts} +2 -1
  30. package/dist/types/builtin-plugin/utils.d.ts +8 -0
  31. package/dist/types/cli/arguments/normalize.d.ts +2 -6
  32. package/dist/types/cli/arguments/schema.d.ts +169 -81
  33. package/dist/types/constants/plugin.d.ts +3 -1
  34. package/dist/types/experimental-index.d.ts +5 -2
  35. package/dist/types/index.d.ts +13 -10
  36. package/dist/types/log/locate-character/index.d.ts +13 -0
  37. package/dist/types/log/logger.d.ts +2 -16
  38. package/dist/types/log/logging.d.ts +6 -3
  39. package/dist/types/log/logs.d.ts +2 -0
  40. package/dist/types/options/input-options-schema.d.ts +596 -0
  41. package/dist/types/options/input-options.d.ts +74 -430
  42. package/dist/types/options/normalized-input-options.d.ts +17 -11
  43. package/dist/types/options/normalized-output-options.d.ts +57 -21
  44. package/dist/types/options/output-options-schema.d.ts +147 -0
  45. package/dist/types/options/output-options.d.ts +72 -265
  46. package/dist/types/options/watch-options.d.ts +5 -0
  47. package/dist/types/plugin/bindingify-build-hooks.d.ts +9 -11
  48. package/dist/types/plugin/bindingify-hook-filter.d.ts +5 -5
  49. package/dist/types/plugin/bindingify-output-hooks.d.ts +13 -16
  50. package/dist/types/plugin/bindingify-plugin.d.ts +12 -3
  51. package/dist/types/plugin/bindingify-watch-hooks.d.ts +3 -5
  52. package/dist/types/plugin/hook-filter.d.ts +1 -1
  53. package/dist/types/plugin/index.d.ts +21 -18
  54. package/dist/types/plugin/minimal-plugin-context.d.ts +15 -0
  55. package/dist/types/plugin/plugin-context-data.d.ts +4 -5
  56. package/dist/types/plugin/plugin-context.d.ts +9 -4
  57. package/dist/types/plugin/plugin-driver.d.ts +4 -5
  58. package/dist/types/plugin/transform-plugin-context.d.ts +4 -3
  59. package/dist/types/rollup-types.d.ts +1 -1
  60. package/dist/types/treeshake/index.d.ts +0 -12
  61. package/dist/types/treeshake/module-side-effects.d.ts +111 -11
  62. package/dist/types/types/rolldown-output.d.ts +11 -2
  63. package/dist/types/types/utils.d.ts +1 -0
  64. package/dist/types/utils/bindingify-input-options.d.ts +7 -0
  65. package/dist/types/utils/bindingify-output-options.d.ts +3 -0
  66. package/dist/types/utils/define-config.d.ts +3 -0
  67. package/dist/types/utils/error.d.ts +1 -0
  68. package/dist/types/utils/normalize-hook.d.ts +1 -1
  69. package/dist/types/utils/normalize-plugin-option.d.ts +8 -3
  70. package/dist/types/{options/utils.d.ts → utils/normalize-string-or-regex.d.ts} +1 -1
  71. package/dist/types/utils/transform-rendered-chunk.d.ts +4 -0
  72. package/dist/types/utils/transform-rendered-module.d.ts +3 -0
  73. package/dist/types/utils/transform-sourcemap.d.ts +2 -0
  74. package/dist/types/utils/transform-to-rollup-output.d.ts +1 -0
  75. package/package.json +30 -22
  76. package/dist/shared/rolldown-binding.wasi.cjs +0 -187
  77. package/dist/shared/src_index-3pqhEViJ.cjs +0 -2785
  78. package/dist/shared/src_index-ywYMd4vB.mjs +0 -2786
  79. package/dist/shared/wasi-worker-browser.mjs +0 -39
  80. package/dist/shared/wasi-worker.mjs +0 -63
  81. package/dist/shared/watcher-worker.js +0 -1
  82. package/dist/types/constants/types.d.ts +0 -1
  83. package/dist/types/options/bindingify-input-options.d.ts +0 -4
  84. package/dist/types/options/bindingify-output-options.d.ts +0 -3
  85. package/dist/types/options/normalized-alias-plugin-config.d.ts +0 -8
  86. package/dist/types/options/watch-option.d.ts +0 -5
  87. package/dist/types/plugin/builtin-plugin.d.ts +0 -81
  88. package/dist/types/rolldown-build.d.ts +0 -10
  89. package/dist/types/rolldown.d.ts +0 -12
  90. package/dist/types/types/rendered-module.d.ts +0 -2
  91. package/dist/types/utils/normalize-input-options.d.ts +0 -3
  92. package/dist/types/utils/normalize-output-options.d.ts +0 -3
  93. package/dist/types/utils/normalize-tree-shake.d.ts +0 -3
  94. /package/dist/types/{utils/type-assert.d.ts → types/assert.d.ts} +0 -0
@@ -1,22 +1,59 @@
1
- import __node_module__ from 'node:module';
2
- const require = __node_module__.createRequire(import.meta.url)
3
- import { __toESM, aliasPlugin, buildImportAnalysisPlugin, composeJsPlugins, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, replacePlugin, require_binding, transformPlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src_index-ywYMd4vB.mjs";
1
+ import { BuiltinPlugin, __toESM, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, require_binding, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-Cm19F5A9.mjs";
4
2
  import { pathToFileURL } from "node:url";
5
3
 
6
4
  //#region src/plugin/parallel-plugin.ts
7
5
  function defineParallelPlugin(pluginPath) {
8
6
  return (options) => {
9
- return {_parallel: {
10
- fileUrl: (pathToFileURL(pluginPath)).href,
7
+ return { _parallel: {
8
+ fileUrl: pathToFileURL(pluginPath).href,
11
9
  options
12
- }};
10
+ } };
13
11
  };
14
12
  }
15
13
 
14
+ //#endregion
15
+ //#region src/api/experimental.ts
16
+ const experimental_scan = async (input) => {
17
+ const { bundler, stopWorkers } = await createBundler(input, {});
18
+ const output = await bundler.scan();
19
+ handleOutputErrors(output);
20
+ await stopWorkers?.();
21
+ };
22
+
23
+ //#endregion
24
+ //#region src/builtin-plugin/transform-plugin.ts
25
+ function normalizeEcmaTransformPluginConfig(config) {
26
+ if (!config) return undefined;
27
+ let normalizedConfig = {
28
+ ...config,
29
+ exclude: normalizedStringOrRegex(config.exclude),
30
+ include: normalizedStringOrRegex(config.include)
31
+ };
32
+ return normalizedConfig;
33
+ }
34
+ function transformPlugin(config) {
35
+ return new BuiltinPlugin("builtin:transform", normalizeEcmaTransformPluginConfig(config));
36
+ }
37
+
38
+ //#endregion
39
+ //#region src/builtin-plugin/replace-plugin.ts
40
+ function replacePlugin(values = {}, options = {}) {
41
+ return new BuiltinPlugin("builtin:replace", {
42
+ ...options,
43
+ values
44
+ });
45
+ }
46
+
47
+ //#endregion
48
+ //#region src/builtin-plugin/alias-plugin.ts
49
+ function aliasPlugin(config) {
50
+ return new BuiltinPlugin("builtin:alias", config);
51
+ }
52
+
16
53
  //#endregion
17
54
  //#region src/experimental-index.ts
18
55
  var import_binding = __toESM(require_binding());
19
56
 
20
57
  //#endregion
21
58
  var transform = import_binding.transform;
22
- export { aliasPlugin, buildImportAnalysisPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, replacePlugin, experimental_scan as scan, transform, transformPlugin, wasmFallbackPlugin, wasmHelperPlugin };
59
+ export { aliasPlugin, buildImportAnalysisPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, replacePlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin };
@@ -1,5 +1,3 @@
1
- import __node_module__ from 'node:module';
2
- const require = __node_module__.createRequire(import.meta.url)
3
- import { VERSION, defineConfig, rolldown, watch } from "../shared/src_index-ywYMd4vB.mjs";
1
+ import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-Cm19F5A9.mjs";
4
2
 
5
- export { VERSION, defineConfig, rolldown, watch };
3
+ export { VERSION, build, defineConfig, rolldown, watch };
@@ -1,33 +1,38 @@
1
- import __node_module__ from 'node:module';
2
- const require = __node_module__.createRequire(import.meta.url)
3
- import { PluginContextData, __toESM, bindingifyPlugin, require_binding } from "../shared/src_index-ywYMd4vB.mjs";
1
+ import { PluginContextData, __toESM, bindingifyPlugin, require_binding } from "../shared/src-Cm19F5A9.mjs";
4
2
  import { parentPort, workerData } from "node:worker_threads";
5
3
 
6
4
  //#region src/parallel-plugin-worker.ts
7
5
  var import_binding = __toESM(require_binding());
8
- const { registryId: registryId, pluginInfos: pluginInfos, threadNumber: threadNumber } = workerData;
6
+ const { registryId, pluginInfos, threadNumber } = workerData;
9
7
  (async () => {
10
8
  try {
11
9
  const plugins = await Promise.all(pluginInfos.map(async (pluginInfo) => {
12
10
  const pluginModule = await import(pluginInfo.fileUrl);
13
11
  const definePluginImpl = pluginModule.default;
14
- const plugin = await definePluginImpl(pluginInfo.options, {threadNumber});
12
+ const plugin = await definePluginImpl(pluginInfo.options, { threadNumber });
15
13
  return {
16
14
  index: pluginInfo.index,
17
- plugin: bindingifyPlugin(plugin, {}, {}, new PluginContextData())
15
+ plugin: bindingifyPlugin(
16
+ plugin,
17
+ {},
18
+ {},
19
+ // TODO need to find a way to share pluginContextData
20
+ new PluginContextData(),
21
+ () => {},
22
+ "info"
23
+ )
18
24
  };
19
25
  }));
20
26
  (0, import_binding.registerPlugins)(registryId, plugins);
21
- parentPort.postMessage({type: "success"});
27
+ parentPort.postMessage({ type: "success" });
22
28
  } catch (error) {
23
29
  parentPort.postMessage({
24
30
  type: "error",
25
31
  error
26
32
  });
27
- }
28
- finally {
33
+ } finally {
29
34
  parentPort.unref();
30
35
  }
31
36
  })();
32
37
 
33
- //#endregion
38
+ //#endregion
@@ -1,5 +1,3 @@
1
- import __node_module__ from 'node:module';
2
- const require = __node_module__.createRequire(import.meta.url)
3
1
 
4
2
  //#region src/plugin/parallel-plugin-implementation.ts
5
3
  function defineParallelPluginImplementation(plugin) {
@@ -7,4 +5,4 @@ function defineParallelPluginImplementation(plugin) {
7
5
  }
8
6
 
9
7
  //#endregion
10
- export { defineParallelPluginImplementation };
8
+ export { defineParallelPluginImplementation };
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
-
3
2
  //#region rolldown:runtime
4
3
  var __create = Object.create;
5
4
  var __defProp = Object.defineProperty;
@@ -7,7 +6,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
7
  var __getProtoOf = Object.getPrototypeOf;
9
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = {exports: {}}).exports, mod), mod.exports);
9
+ var __commonJS = (cb, mod) => function() {
10
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
+ };
11
12
  var __export = (target, all) => {
12
13
  for (var name in all) __defProp(target, name, {
13
14
  get: all[name],
@@ -31,7 +32,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
32
 
32
33
  //#endregion
33
34
 
34
- exports.__commonJSMin = __commonJSMin;
35
- exports.__export = __export;
36
- exports.__toESM = __toESM;
37
-
35
+ Object.defineProperty(exports, '__commonJS', {
36
+ enumerable: true,
37
+ get: function () {
38
+ return __commonJS;
39
+ }
40
+ });Object.defineProperty(exports, '__export', {
41
+ enumerable: true,
42
+ get: function () {
43
+ return __export;
44
+ }
45
+ });Object.defineProperty(exports, '__toESM', {
46
+ enumerable: true,
47
+ get: function () {
48
+ return __toESM;
49
+ }
50
+ });