rolldown 0.15.1 → 1.0.0-beta.1

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 (42) hide show
  1. package/dist/cjs/cli.cjs +43 -32
  2. package/dist/cjs/experimental-index.cjs +3 -3
  3. package/dist/cjs/index.cjs +1 -1
  4. package/dist/cjs/parallel-plugin-worker.cjs +3 -3
  5. package/dist/esm/cli.mjs +50 -39
  6. package/dist/esm/experimental-index.mjs +1 -1
  7. package/dist/esm/index.mjs +1 -1
  8. package/dist/esm/parallel-plugin-worker.mjs +1 -1
  9. package/dist/shared/{chunk-BFvIen8E.cjs → chunk-qZFfknuJ.cjs} +2 -1
  10. package/dist/shared/{consola_36c0034f-B7L-radJ.cjs → consola_36c0034f-C_-uQ5ge.cjs} +8 -5
  11. package/dist/shared/{prompt-BiXtYIJ2.cjs → prompt-BNaEjAIz.cjs} +2 -2
  12. package/dist/shared/{src-BQ98i9JJ.mjs → src-Bb3zZkPW.mjs} +31 -19
  13. package/dist/shared/{src-CkH9jtTi.cjs → src-PS2X1Won.cjs} +89 -46
  14. package/dist/tsconfig.dts.tsbuildinfo +1 -1
  15. package/dist/types/api/build.d.ts +4 -2
  16. package/dist/types/binding.d.ts +7 -2
  17. package/dist/types/index.d.ts +3 -4
  18. package/dist/types/log/logHandler.d.ts +1 -1
  19. package/dist/types/log/logger.d.ts +1 -1
  20. package/dist/types/log/logs.d.ts +2 -1
  21. package/dist/types/options/input-options.d.ts +10 -2
  22. package/dist/types/options/normalized-input-options.d.ts +1 -1
  23. package/dist/types/options/normalized-output-options.d.ts +1 -1
  24. package/dist/types/options/output-options.d.ts +3 -3
  25. package/dist/types/options/watch-options.d.ts +1 -1
  26. package/dist/types/plugin/bindingify-plugin.d.ts +1 -1
  27. package/dist/types/plugin/index.d.ts +6 -6
  28. package/dist/types/plugin/minimal-plugin-context.d.ts +1 -1
  29. package/dist/types/plugin/plugin-context.d.ts +1 -1
  30. package/dist/types/plugin/transform-plugin-context.d.ts +1 -1
  31. package/dist/types/types/misc.d.ts +40 -0
  32. package/dist/types/types/output-bundle.d.ts +2 -2
  33. package/dist/types/types/rolldown-options.d.ts +1 -1
  34. package/dist/types/types/rolldown-output.d.ts +8 -11
  35. package/dist/types/utils/bindingify-input-options.d.ts +1 -1
  36. package/dist/types/utils/create-bundler-option.d.ts +1 -1
  37. package/dist/types/utils/normalize-plugin-option.d.ts +1 -1
  38. package/dist/types/utils/transform-rendered-chunk.d.ts +4 -4
  39. package/dist/types/utils/transform-rendered-module.d.ts +2 -2
  40. package/package.json +15 -15
  41. package/dist/types/rollup-types.d.ts +0 -1
  42. package/dist/types/rollup.d.ts +0 -1118
@@ -1,4 +1,4 @@
1
- const require_chunk = require('./chunk-BFvIen8E.cjs');
1
+ const require_chunk = require('./chunk-qZFfknuJ.cjs');
2
2
  const node_buffer = require_chunk.__toESM(require("node:buffer"));
3
3
  const zod = require_chunk.__toESM(require("zod"));
4
4
  const node_path = require_chunk.__toESM(require("node:path"));
@@ -695,7 +695,13 @@ function locate(source, search, options) {
695
695
 
696
696
  //#endregion
697
697
  //#region src/log/logs.ts
698
- const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLY_NOTIFY_OPTION = "MULTIPLY_NOTIFY_OPTION";
698
+ const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLY_NOTIFY_OPTION = "MULTIPLY_NOTIFY_OPTION", MINIFY_WARNING = "MINIFY_WARNING";
699
+ function logMinifyWarning() {
700
+ return {
701
+ code: MINIFY_WARNING,
702
+ message: "The built-in minifier is still under development. Setting \"minify: true\" is not recommended for production use."
703
+ };
704
+ }
699
705
  function logInvalidLogPosition(pluginName) {
700
706
  return {
701
707
  code: INVALID_LOG_POSITION,
@@ -1203,7 +1209,7 @@ var PluginContext = class extends MinimalPluginContext {
1203
1209
  }
1204
1210
  async load(options) {
1205
1211
  const id = options.id;
1206
- if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(super.pluginName, this.currentLoadingModule));
1212
+ if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
1207
1213
  const moduleInfo = this.data.getModuleInfo(id, this.context);
1208
1214
  if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
1209
1215
  const rawOptions = {
@@ -1296,7 +1302,7 @@ var TransformPluginContext = class extends PluginContext {
1296
1302
  if (pos) augmentCodeLocation(e, pos, this.moduleSource, this.moduleId);
1297
1303
  e.id = this.moduleId;
1298
1304
  e.hook = "transform";
1299
- return error(logPluginError(normalizeLog(e), super.pluginName));
1305
+ return error(logPluginError(normalizeLog(e), this.pluginName));
1300
1306
  }
1301
1307
  getCombinedSourcemap() {
1302
1308
  return JSON.parse(this.inner.getCombinedSourcemap());
@@ -2086,15 +2092,20 @@ function bindingifyInput(input) {
2086
2092
  });
2087
2093
  }
2088
2094
  function bindingifyJsx(input) {
2095
+ if (input === false) return { type: "Disable" };
2089
2096
  if (input) {
2090
- const mode = input.mode ?? "classic";
2097
+ if (input.mode === "preserve") return { type: "Preserve" };
2098
+ const mode = input.mode ?? "automatic";
2091
2099
  return {
2092
- runtime: mode,
2093
- importSource: mode === "classic" ? input.importSource : mode === "automatic" ? input.jsxImportSource : undefined,
2094
- pragma: input.factory,
2095
- pragmaFrag: input.fragment,
2096
- development: input.development,
2097
- refresh: input.refresh
2100
+ type: "Enable",
2101
+ field0: {
2102
+ runtime: mode,
2103
+ importSource: mode === "classic" ? input.importSource : mode === "automatic" ? input.jsxImportSource : undefined,
2104
+ pragma: input.factory,
2105
+ pragmaFrag: input.fragment,
2106
+ development: input.development,
2107
+ refresh: input.refresh
2108
+ }
2098
2109
  };
2099
2110
  }
2100
2111
  }
@@ -2600,9 +2611,10 @@ async function createBundlerOptions(inputOptions, outputOptions) {
2600
2611
  if (inputOptions.treeshake !== undefined) TreeshakingOptionsSchema.parse(inputOptions.treeshake);
2601
2612
  const inputPlugins = await normalizePluginOption(inputOptions.plugins);
2602
2613
  const outputPlugins = await normalizePluginOption(outputOptions.plugins);
2603
- outputOptions = pluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions);
2604
2614
  const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
2605
2615
  const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel);
2616
+ outputOptions = pluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions);
2617
+ if (outputOptions.minify === true) onLog(LOG_LEVEL_WARN, logMinifyWarning());
2606
2618
  let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(await normalizePluginOption(outputOptions.plugins), ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
2607
2619
  if (inputOptions.experimental?.enableComposingJsPlugins ?? false) plugins = composeJsPlugins(plugins);
2608
2620
  const parallelPluginInitResult = await initializeParallelPlugins(plugins);
@@ -2777,8 +2789,8 @@ var Watcher = class {
2777
2789
  }
2778
2790
  };
2779
2791
  async function createWatcher(emitter, input) {
2780
- const options = Array.isArray(input) ? input : [input];
2781
- const bundlerOptions = await Promise.all(options.map((option) => createBundlerOptions(option, option.output || {})));
2792
+ const options = arraify(input);
2793
+ const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map((output) => createBundlerOptions(option, output))).flat());
2782
2794
  const notifyOptions = getValidNotifyOption(bundlerOptions);
2783
2795
  const bindingWatcher = new import_binding.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
2784
2796
  const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
@@ -2805,7 +2817,7 @@ const watch = (input) => {
2805
2817
 
2806
2818
  //#endregion
2807
2819
  //#region package.json
2808
- var version = "0.15.1";
2820
+ var version = "1.0.0-beta.1";
2809
2821
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
2810
2822
 
2811
2823
  //#endregion
@@ -2834,157 +2846,188 @@ Object.defineProperty(exports, 'BuiltinPlugin', {
2834
2846
  get: function () {
2835
2847
  return BuiltinPlugin;
2836
2848
  }
2837
- });Object.defineProperty(exports, 'LogLevelOptionSchema', {
2849
+ });
2850
+ Object.defineProperty(exports, 'LogLevelOptionSchema', {
2838
2851
  enumerable: true,
2839
2852
  get: function () {
2840
2853
  return LogLevelOptionSchema;
2841
2854
  }
2842
- });Object.defineProperty(exports, 'LogLevelSchema', {
2855
+ });
2856
+ Object.defineProperty(exports, 'LogLevelSchema', {
2843
2857
  enumerable: true,
2844
2858
  get: function () {
2845
2859
  return LogLevelSchema;
2846
2860
  }
2847
- });Object.defineProperty(exports, 'LogLevelWithErrorSchema', {
2861
+ });
2862
+ Object.defineProperty(exports, 'LogLevelWithErrorSchema', {
2848
2863
  enumerable: true,
2849
2864
  get: function () {
2850
2865
  return LogLevelWithErrorSchema;
2851
2866
  }
2852
- });Object.defineProperty(exports, 'PluginContextData', {
2867
+ });
2868
+ Object.defineProperty(exports, 'PluginContextData', {
2853
2869
  enumerable: true,
2854
2870
  get: function () {
2855
2871
  return PluginContextData;
2856
2872
  }
2857
- });Object.defineProperty(exports, 'RollupLogSchema', {
2873
+ });
2874
+ Object.defineProperty(exports, 'RollupLogSchema', {
2858
2875
  enumerable: true,
2859
2876
  get: function () {
2860
2877
  return RollupLogSchema;
2861
2878
  }
2862
- });Object.defineProperty(exports, 'RollupLogWithStringSchema', {
2879
+ });
2880
+ Object.defineProperty(exports, 'RollupLogWithStringSchema', {
2863
2881
  enumerable: true,
2864
2882
  get: function () {
2865
2883
  return RollupLogWithStringSchema;
2866
2884
  }
2867
- });Object.defineProperty(exports, 'TreeshakingOptionsSchema', {
2885
+ });
2886
+ Object.defineProperty(exports, 'TreeshakingOptionsSchema', {
2868
2887
  enumerable: true,
2869
2888
  get: function () {
2870
2889
  return TreeshakingOptionsSchema;
2871
2890
  }
2872
- });Object.defineProperty(exports, 'VERSION', {
2891
+ });
2892
+ Object.defineProperty(exports, 'VERSION', {
2873
2893
  enumerable: true,
2874
2894
  get: function () {
2875
2895
  return VERSION;
2876
2896
  }
2877
- });Object.defineProperty(exports, 'arraify', {
2897
+ });
2898
+ Object.defineProperty(exports, 'arraify', {
2878
2899
  enumerable: true,
2879
2900
  get: function () {
2880
2901
  return arraify;
2881
2902
  }
2882
- });Object.defineProperty(exports, 'bindingifyPlugin', {
2903
+ });
2904
+ Object.defineProperty(exports, 'bindingifyPlugin', {
2883
2905
  enumerable: true,
2884
2906
  get: function () {
2885
2907
  return bindingifyPlugin;
2886
2908
  }
2887
- });Object.defineProperty(exports, 'build', {
2909
+ });
2910
+ Object.defineProperty(exports, 'build', {
2888
2911
  enumerable: true,
2889
2912
  get: function () {
2890
2913
  return build;
2891
2914
  }
2892
- });Object.defineProperty(exports, 'buildImportAnalysisPlugin', {
2915
+ });
2916
+ Object.defineProperty(exports, 'buildImportAnalysisPlugin', {
2893
2917
  enumerable: true,
2894
2918
  get: function () {
2895
2919
  return buildImportAnalysisPlugin;
2896
2920
  }
2897
- });Object.defineProperty(exports, 'composeJsPlugins', {
2921
+ });
2922
+ Object.defineProperty(exports, 'composeJsPlugins', {
2898
2923
  enumerable: true,
2899
2924
  get: function () {
2900
2925
  return composeJsPlugins;
2901
2926
  }
2902
- });Object.defineProperty(exports, 'createBundler', {
2927
+ });
2928
+ Object.defineProperty(exports, 'createBundler', {
2903
2929
  enumerable: true,
2904
2930
  get: function () {
2905
2931
  return createBundler;
2906
2932
  }
2907
- });Object.defineProperty(exports, 'defineConfig', {
2933
+ });
2934
+ Object.defineProperty(exports, 'defineConfig', {
2908
2935
  enumerable: true,
2909
2936
  get: function () {
2910
2937
  return defineConfig;
2911
2938
  }
2912
- });Object.defineProperty(exports, 'description', {
2939
+ });
2940
+ Object.defineProperty(exports, 'description', {
2913
2941
  enumerable: true,
2914
2942
  get: function () {
2915
2943
  return description;
2916
2944
  }
2917
- });Object.defineProperty(exports, 'dynamicImportVarsPlugin', {
2945
+ });
2946
+ Object.defineProperty(exports, 'dynamicImportVarsPlugin', {
2918
2947
  enumerable: true,
2919
2948
  get: function () {
2920
2949
  return dynamicImportVarsPlugin;
2921
2950
  }
2922
- });Object.defineProperty(exports, 'handleOutputErrors', {
2951
+ });
2952
+ Object.defineProperty(exports, 'handleOutputErrors', {
2923
2953
  enumerable: true,
2924
2954
  get: function () {
2925
2955
  return handleOutputErrors;
2926
2956
  }
2927
- });Object.defineProperty(exports, 'importGlobPlugin', {
2957
+ });
2958
+ Object.defineProperty(exports, 'importGlobPlugin', {
2928
2959
  enumerable: true,
2929
2960
  get: function () {
2930
2961
  return importGlobPlugin;
2931
2962
  }
2932
- });Object.defineProperty(exports, 'jsonPlugin', {
2963
+ });
2964
+ Object.defineProperty(exports, 'jsonPlugin', {
2933
2965
  enumerable: true,
2934
2966
  get: function () {
2935
2967
  return jsonPlugin;
2936
2968
  }
2937
- });Object.defineProperty(exports, 'loadFallbackPlugin', {
2969
+ });
2970
+ Object.defineProperty(exports, 'loadFallbackPlugin', {
2938
2971
  enumerable: true,
2939
2972
  get: function () {
2940
2973
  return loadFallbackPlugin;
2941
2974
  }
2942
- });Object.defineProperty(exports, 'manifestPlugin', {
2975
+ });
2976
+ Object.defineProperty(exports, 'manifestPlugin', {
2943
2977
  enumerable: true,
2944
2978
  get: function () {
2945
2979
  return manifestPlugin;
2946
2980
  }
2947
- });Object.defineProperty(exports, 'modulePreloadPolyfillPlugin', {
2981
+ });
2982
+ Object.defineProperty(exports, 'modulePreloadPolyfillPlugin', {
2948
2983
  enumerable: true,
2949
2984
  get: function () {
2950
2985
  return modulePreloadPolyfillPlugin;
2951
2986
  }
2952
- });Object.defineProperty(exports, 'normalizedStringOrRegex', {
2987
+ });
2988
+ Object.defineProperty(exports, 'normalizedStringOrRegex', {
2953
2989
  enumerable: true,
2954
2990
  get: function () {
2955
2991
  return normalizedStringOrRegex;
2956
2992
  }
2957
- });Object.defineProperty(exports, 'require_binding', {
2993
+ });
2994
+ Object.defineProperty(exports, 'require_binding', {
2958
2995
  enumerable: true,
2959
2996
  get: function () {
2960
2997
  return require_binding;
2961
2998
  }
2962
- });Object.defineProperty(exports, 'rolldown', {
2999
+ });
3000
+ Object.defineProperty(exports, 'rolldown', {
2963
3001
  enumerable: true,
2964
3002
  get: function () {
2965
3003
  return rolldown;
2966
3004
  }
2967
- });Object.defineProperty(exports, 'version', {
3005
+ });
3006
+ Object.defineProperty(exports, 'version', {
2968
3007
  enumerable: true,
2969
3008
  get: function () {
2970
3009
  return version;
2971
3010
  }
2972
- });Object.defineProperty(exports, 'viteResolvePlugin', {
3011
+ });
3012
+ Object.defineProperty(exports, 'viteResolvePlugin', {
2973
3013
  enumerable: true,
2974
3014
  get: function () {
2975
3015
  return viteResolvePlugin;
2976
3016
  }
2977
- });Object.defineProperty(exports, 'wasmFallbackPlugin', {
3017
+ });
3018
+ Object.defineProperty(exports, 'wasmFallbackPlugin', {
2978
3019
  enumerable: true,
2979
3020
  get: function () {
2980
3021
  return wasmFallbackPlugin;
2981
3022
  }
2982
- });Object.defineProperty(exports, 'wasmHelperPlugin', {
3023
+ });
3024
+ Object.defineProperty(exports, 'wasmHelperPlugin', {
2983
3025
  enumerable: true,
2984
3026
  get: function () {
2985
3027
  return wasmHelperPlugin;
2986
3028
  }
2987
- });Object.defineProperty(exports, 'watch', {
3029
+ });
3030
+ Object.defineProperty(exports, 'watch', {
2988
3031
  enumerable: true,
2989
3032
  get: function () {
2990
3033
  return watch;