rolldown 1.0.0-beta.1-commit.2fe52d4 → 1.0.0-beta.1-commit.35fb1f8

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.
@@ -1,11 +1,9 @@
1
- import { __toESM, augmentCodeLocation, error, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMinifyWarning, logMultiplyNotifyOption, logPluginError, require_binding } from "./binding-BMSG-hw7.mjs";
1
+ import { augmentCodeLocation, colors, error, import_binding, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMinifyWarning, logMultiplyNotifyOption, logPluginError } from "./binding-Bl7VQy7c.mjs";
2
2
  import path from "node:path";
3
3
  import { Buffer } from "node:buffer";
4
4
  import { Worker } from "node:worker_threads";
5
5
  import { availableParallelism } from "node:os";
6
6
  import * as v from "valibot";
7
- import { env } from "node:process";
8
- import * as tty from "tty";
9
7
  import { toJsonSchema } from "@valibot/to-json-schema";
10
8
 
11
9
  //#region src/utils/define-config.ts
@@ -160,9 +158,8 @@ function relativeId(id) {
160
158
 
161
159
  //#endregion
162
160
  //#region src/builtin-plugin/utils.ts
163
- var import_binding$6 = __toESM(require_binding());
164
161
  function makeBuiltinPluginCallable(plugin) {
165
- let callablePlugin = new import_binding$6.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
162
+ let callablePlugin = new import_binding.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
166
163
  const wrappedPlugin = plugin;
167
164
  for (const key in callablePlugin) wrappedPlugin[key] = function(...args) {
168
165
  return callablePlugin[key](...args);
@@ -220,6 +217,15 @@ function viteResolvePlugin(config) {
220
217
  });
221
218
  return makeBuiltinPluginCallable(builtinPlugin);
222
219
  }
220
+ function moduleFederationPlugin(config) {
221
+ return new BuiltinPlugin("builtin:module-federation", {
222
+ ...config,
223
+ remotes: config.remotes && Object.values(config.remotes).map((entry) => {
224
+ if (typeof entry === "string") return { entry };
225
+ return entry;
226
+ })
227
+ });
228
+ }
223
229
 
224
230
  //#endregion
225
231
  //#region src/utils/async-flatten.ts
@@ -712,12 +718,11 @@ var MinimalPluginContext = class {
712
718
 
713
719
  //#endregion
714
720
  //#region src/utils/transform-side-effects.ts
715
- var import_binding$5 = __toESM(require_binding());
716
721
  function bindingifySideEffects(sideEffects) {
717
722
  switch (sideEffects) {
718
- case true: return import_binding$5.BindingHookSideEffects.True;
719
- case false: return import_binding$5.BindingHookSideEffects.False;
720
- case "no-treeshake": return import_binding$5.BindingHookSideEffects.NoTreeshake;
723
+ case true: return import_binding.BindingHookSideEffects.True;
724
+ case false: return import_binding.BindingHookSideEffects.False;
725
+ case "no-treeshake": return import_binding.BindingHookSideEffects.NoTreeshake;
721
726
  case null:
722
727
  case undefined: return undefined;
723
728
  default: throw new Error(`Unexpected side effects: ${sideEffects}`);
@@ -778,16 +783,14 @@ var PluginContext = class extends MinimalPluginContext {
778
783
  };
779
784
  }
780
785
  emitFile(file) {
781
- if (file.type !== "asset") return unimplemented("PluginContext.emitFile: only asset type is supported");
786
+ if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
787
+ if (file.type === "chunk") return this.context.emitChunk(file);
782
788
  return this.context.emitFile({
783
789
  ...file,
784
790
  originalFileName: file.originalFileName || undefined,
785
791
  source: bindingAssetSource(file.source)
786
792
  });
787
793
  }
788
- async emitChunk(chunk) {
789
- return this.context.emitChunk(chunk);
790
- }
791
794
  getFileName(referenceId) {
792
795
  return this.context.getFileName(referenceId);
793
796
  }
@@ -841,14 +844,13 @@ var TransformPluginContext = class extends PluginContext {
841
844
 
842
845
  //#endregion
843
846
  //#region src/plugin/bindingify-plugin-hook-meta.ts
844
- var import_binding$4 = __toESM(require_binding());
845
847
  function bindingifyPluginHookMeta(options) {
846
848
  return { order: bindingPluginOrder(options.order) };
847
849
  }
848
850
  function bindingPluginOrder(order) {
849
851
  switch (order) {
850
- case "post": return import_binding$4.BindingPluginOrder.Post;
851
- case "pre": return import_binding$4.BindingPluginOrder.Pre;
852
+ case "post": return import_binding.BindingPluginOrder.Post;
853
+ case "pre": return import_binding.BindingPluginOrder.Pre;
852
854
  case null:
853
855
  case undefined: return undefined;
854
856
  default: throw new Error(`Unknown plugin order: ${order}`);
@@ -1512,7 +1514,6 @@ function normalizedStringOrRegex(pattern) {
1512
1514
 
1513
1515
  //#endregion
1514
1516
  //#region src/utils/bindingify-input-options.ts
1515
- var import_binding$3 = __toESM(require_binding());
1516
1517
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, onLog, logLevel) {
1517
1518
  const pluginContextData = new PluginContextData();
1518
1519
  const plugins = rawPlugins.map((plugin) => {
@@ -1603,10 +1604,10 @@ function bindingifyInject(inject) {
1603
1604
  }
1604
1605
  function bindingifyLogLevel(logLevel) {
1605
1606
  switch (logLevel) {
1606
- case "silent": return import_binding$3.BindingLogLevel.Silent;
1607
- case "debug": return import_binding$3.BindingLogLevel.Debug;
1608
- case "warn": return import_binding$3.BindingLogLevel.Warn;
1609
- case "info": return import_binding$3.BindingLogLevel.Info;
1607
+ case "silent": return import_binding.BindingLogLevel.Silent;
1608
+ case "debug": return import_binding.BindingLogLevel.Debug;
1609
+ case "warn": return import_binding.BindingLogLevel.Warn;
1610
+ case "info": return import_binding.BindingLogLevel.Info;
1610
1611
  default: throw new Error(`Unexpected log level: ${logLevel}`);
1611
1612
  }
1612
1613
  }
@@ -2083,7 +2084,6 @@ function composeJsPlugins(plugins) {
2083
2084
 
2084
2085
  //#endregion
2085
2086
  //#region src/utils/initialize-parallel-plugins.ts
2086
- var import_binding$2 = __toESM(require_binding());
2087
2087
  async function initializeParallelPlugins(plugins) {
2088
2088
  const pluginInfos = [];
2089
2089
  for (const [index, plugin] of plugins.entries()) if ("_parallel" in plugin) {
@@ -2096,7 +2096,7 @@ async function initializeParallelPlugins(plugins) {
2096
2096
  }
2097
2097
  if (pluginInfos.length <= 0) return undefined;
2098
2098
  const count = Math.min(availableParallelism(), 8);
2099
- const parallelJsPluginRegistry = new import_binding$2.ParallelJsPluginRegistry(count);
2099
+ const parallelJsPluginRegistry = new import_binding.ParallelJsPluginRegistry(count);
2100
2100
  const registryId = parallelJsPluginRegistry.id;
2101
2101
  const workers = await initializeWorkers(registryId, count, pluginInfos);
2102
2102
  const stopWorkers = async () => {
@@ -2134,83 +2134,6 @@ async function initializeWorker(registryId, pluginInfos, threadNumber) {
2134
2134
  }
2135
2135
  }
2136
2136
 
2137
- //#endregion
2138
- //#region ../../node_modules/.pnpm/colorette@2.0.20/node_modules/colorette/index.js
2139
- const { env: env$1 = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
2140
- const isDisabled = "NO_COLOR" in env$1 || argv.includes("--no-color");
2141
- const isForced = "FORCE_COLOR" in env$1 || argv.includes("--color");
2142
- const isWindows = platform === "win32";
2143
- const isDumbTerminal = env$1.TERM === "dumb";
2144
- const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env$1.TERM && !isDumbTerminal;
2145
- const isCI = "CI" in env$1 && ("GITHUB_ACTIONS" in env$1 || "GITLAB_CI" in env$1 || "CIRCLECI" in env$1);
2146
- const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
2147
- const replaceClose = (index, string, close, replace, head = string.substring(0, index) + replace, tail = string.substring(index + close.length), next = tail.indexOf(close)) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
2148
- const clearBleed = (index, string, open, close, replace) => index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
2149
- const filterEmpty = (open, close, replace = open, at = open.length + 1) => (string) => string || !(string === "" || string === undefined) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
2150
- const init = (open, close, replace) => filterEmpty(`\x1b[${open}m`, `\x1b[${close}m`, replace);
2151
- const colors$1 = {
2152
- reset: init(0, 0),
2153
- bold: init(1, 22, "\x1B[22m\x1B[1m"),
2154
- dim: init(2, 22, "\x1B[22m\x1B[2m"),
2155
- italic: init(3, 23),
2156
- underline: init(4, 24),
2157
- inverse: init(7, 27),
2158
- hidden: init(8, 28),
2159
- strikethrough: init(9, 29),
2160
- black: init(30, 39),
2161
- red: init(31, 39),
2162
- green: init(32, 39),
2163
- yellow: init(33, 39),
2164
- blue: init(34, 39),
2165
- magenta: init(35, 39),
2166
- cyan: init(36, 39),
2167
- white: init(37, 39),
2168
- gray: init(90, 39),
2169
- bgBlack: init(40, 49),
2170
- bgRed: init(41, 49),
2171
- bgGreen: init(42, 49),
2172
- bgYellow: init(43, 49),
2173
- bgBlue: init(44, 49),
2174
- bgMagenta: init(45, 49),
2175
- bgCyan: init(46, 49),
2176
- bgWhite: init(47, 49),
2177
- blackBright: init(90, 39),
2178
- redBright: init(91, 39),
2179
- greenBright: init(92, 39),
2180
- yellowBright: init(93, 39),
2181
- blueBright: init(94, 39),
2182
- magentaBright: init(95, 39),
2183
- cyanBright: init(96, 39),
2184
- whiteBright: init(97, 39),
2185
- bgBlackBright: init(100, 49),
2186
- bgRedBright: init(101, 49),
2187
- bgGreenBright: init(102, 49),
2188
- bgYellowBright: init(103, 49),
2189
- bgBlueBright: init(104, 49),
2190
- bgMagentaBright: init(105, 49),
2191
- bgCyanBright: init(106, 49),
2192
- bgWhiteBright: init(107, 49)
2193
- };
2194
- const createColors = ({ useColor = isColorSupported } = {}) => useColor ? colors$1 : Object.keys(colors$1).reduce((colors$2, key) => ({
2195
- ...colors$2,
2196
- [key]: String
2197
- }), {});
2198
- const { reset, bold: bold$1, dim: dim$1, italic, underline: underline$1, inverse, hidden, strikethrough, black, red: red$1, green: green$1, yellow: yellow$1, blue, magenta, cyan: cyan$1, white, gray: gray$1, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = createColors();
2199
-
2200
- //#endregion
2201
- //#region src/cli/colors.ts
2202
- const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({ useColor: env.FORCE_COLOR !== "0" && !env.NO_COLOR });
2203
- const colors = {
2204
- bold,
2205
- cyan,
2206
- dim,
2207
- gray,
2208
- green,
2209
- red,
2210
- underline,
2211
- yellow
2212
- };
2213
-
2214
2137
  //#endregion
2215
2138
  //#region src/utils/validator.ts
2216
2139
  const StringOrRegExpSchema = v.union([v.string(), v.instance(RegExp)]);
@@ -2501,12 +2424,11 @@ async function createBundlerOptions(inputOptions, outputOptions) {
2501
2424
 
2502
2425
  //#endregion
2503
2426
  //#region src/utils/create-bundler.ts
2504
- var import_binding$1 = __toESM(require_binding());
2505
2427
  async function createBundler(inputOptions, outputOptions) {
2506
2428
  const option = await createBundlerOptions(inputOptions, outputOptions);
2507
2429
  try {
2508
2430
  return {
2509
- bundler: new import_binding$1.Bundler(option.bundlerOptions),
2431
+ bundler: new import_binding.Bundler(option.bundlerOptions),
2510
2432
  stopWorkers: option.stopWorkers
2511
2433
  };
2512
2434
  } catch (e) {
@@ -2624,7 +2546,6 @@ var WatcherEmitter = class {
2624
2546
 
2625
2547
  //#endregion
2626
2548
  //#region src/api/watch/watcher.ts
2627
- var import_binding = __toESM(require_binding());
2628
2549
  var Watcher = class {
2629
2550
  closed;
2630
2551
  inner;
@@ -2683,7 +2604,7 @@ const watch = (input) => {
2683
2604
 
2684
2605
  //#endregion
2685
2606
  //#region package.json
2686
- var version = "1.0.0-beta.1-commit.2fe52d4";
2607
+ var version = "1.0.0-beta.1-commit.35fb1f8";
2687
2608
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
2688
2609
 
2689
2610
  //#endregion
@@ -2707,4 +2628,4 @@ async function build(options) {
2707
2628
  const VERSION = version;
2708
2629
 
2709
2630
  //#endregion
2710
- export { BuiltinPlugin, PluginContextData, VERSION, arraify, bindingifyPlugin, build, buildImportAnalysisPlugin, colors, composeJsPlugins, createBundler, defineConfig, description, dynamicImportVarsPlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch };
2631
+ export { BuiltinPlugin, PluginContextData, VERSION, arraify, bindingifyPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundler, defineConfig, description, dynamicImportVarsPlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch };