@rolldown/browser 1.0.0-beta.29 → 1.0.0-beta.30

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 (41) hide show
  1. package/dist/cli.cjs +9 -9
  2. package/dist/cli.mjs +8 -8
  3. package/dist/config.cjs +3 -3
  4. package/dist/config.d.cts +2 -2
  5. package/dist/config.d.mts +2 -2
  6. package/dist/config.mjs +3 -3
  7. package/dist/experimental-index.browser.mjs +2 -2
  8. package/dist/experimental-index.cjs +2 -3
  9. package/dist/experimental-index.d.cts +3 -3
  10. package/dist/experimental-index.d.mts +3 -3
  11. package/dist/experimental-index.mjs +3 -3
  12. package/dist/filter-index.d.cts +2 -2
  13. package/dist/filter-index.d.mts +2 -2
  14. package/dist/index.browser.mjs +1 -1
  15. package/dist/index.cjs +2 -2
  16. package/dist/index.d.cts +3 -3
  17. package/dist/index.d.mts +3 -3
  18. package/dist/index.mjs +2 -2
  19. package/dist/parallel-plugin-worker.cjs +2 -2
  20. package/dist/parallel-plugin-worker.mjs +2 -2
  21. package/dist/parallel-plugin.d.cts +2 -2
  22. package/dist/parallel-plugin.d.mts +2 -2
  23. package/dist/parse-ast-index.cjs +1 -1
  24. package/dist/parse-ast-index.d.cts +1 -1
  25. package/dist/parse-ast-index.d.mts +1 -1
  26. package/dist/parse-ast-index.mjs +1 -1
  27. package/dist/rolldown-binding.wasi-browser.js +0 -1
  28. package/dist/rolldown-binding.wasi.cjs +0 -1
  29. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  30. package/dist/shared/{binding-BO7hG1pA.d.mts → binding-BAyrv67G.d.cts} +29 -45
  31. package/dist/shared/{binding-D1lW862e.d.cts → binding-DUz1Q2JW.d.mts} +29 -45
  32. package/dist/shared/{define-config-BzINvTeZ.d.mts → define-config-5ALh7WDx.d.mts} +72 -9
  33. package/dist/shared/{define-config-CbNA0bsF.d.cts → define-config-CMH1jWhX.d.cts} +72 -9
  34. package/dist/shared/{load-config-Db6nl6MU.mjs → load-config-Uk19Sezh.mjs} +2 -2
  35. package/dist/shared/{load-config-BzLcyKpK.cjs → load-config-XQT0YfAt.cjs} +2 -2
  36. package/dist/shared/{parse-ast-index-rwZvDBjW.mjs → parse-ast-index-Z-sG_A0I.mjs} +2 -2
  37. package/dist/shared/{parse-ast-index-CLjgl4c8.cjs → parse-ast-index-ZiMOspE_.cjs} +2 -2
  38. package/dist/shared/{src-CkSl8yxM.cjs → src-CXCXfLrc.cjs} +89 -136
  39. package/dist/shared/{src-BN28iHET.mjs → src-CkG0t1KT.mjs} +90 -131
  40. package/dist/{src-DynJfHII.js → src-DGzv-S-Z.js} +58 -46
  41. package/package.json +2 -2
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
 
28
28
  //#endregion
29
29
  //#region package.json
30
- var version = "1.0.0-beta.29";
30
+ var version = "1.0.0-beta.30";
31
31
 
32
32
  //#endregion
33
33
  //#region src/utils/normalize-string-or-regex.ts
@@ -105,27 +105,6 @@ function viteResolvePlugin(config) {
105
105
  const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", config);
106
106
  return makeBuiltinPluginCallable(builtinPlugin);
107
107
  }
108
- function moduleFederationPlugin(config) {
109
- return new BuiltinPlugin("builtin:module-federation", {
110
- ...config,
111
- remotes: config.remotes && Object.entries(config.remotes).map(([name, remote]) => {
112
- if (typeof remote === "string") {
113
- const [entryGlobalName] = remote.split("@");
114
- const entry = remote.replace(entryGlobalName + "@", "");
115
- return {
116
- entry,
117
- name,
118
- entryGlobalName
119
- };
120
- }
121
- return {
122
- ...remote,
123
- name: remote.name ?? name
124
- };
125
- }),
126
- manifest: config.manifest === false ? void 0 : config.manifest === true ? {} : config.manifest
127
- });
128
- }
129
108
  function isolatedDeclarationPlugin(config) {
130
109
  return new BuiltinPlugin("builtin:isolated-declaration", config);
131
110
  }
@@ -724,7 +703,7 @@ function locate(source, search, options) {
724
703
 
725
704
  //#endregion
726
705
  //#region src/log/logs.ts
727
- 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", PARSE_ERROR = "PARSE_ERROR", DUPLICATE_JSX_CONFIG = "DUPLICATE_JSX_CONFIG";
706
+ 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", PARSE_ERROR = "PARSE_ERROR", DUPLICATE_JSX_CONFIG = "DUPLICATE_JSX_CONFIG", NO_FS_IN_BROWSER = "NO_FS_IN_BROWSER";
728
707
  function logParseError(message) {
729
708
  return {
730
709
  code: PARSE_ERROR,
@@ -761,6 +740,12 @@ function logDuplicateJsxConfig() {
761
740
  message: "Both `options.jsx` and `options.transform.jsx` are set so `options.jsx` is ignored"
762
741
  };
763
742
  }
743
+ function logNoFileSystemInBrowser(method) {
744
+ return {
745
+ code: NO_FS_IN_BROWSER,
746
+ message: `Cannot access the file system (via "${method}") when using the browser build of Rolldown.`
747
+ };
748
+ }
764
749
  function logPluginError(error$1, plugin, { hook, id: id$1 } = {}) {
765
750
  try {
766
751
  const code$1 = error$1.code;
@@ -2076,7 +2061,7 @@ function safeParse(schema, input, config2) {
2076
2061
 
2077
2062
  //#endregion
2078
2063
  //#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs
2079
- var require_ansis = __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs"(exports, module) {
2064
+ var require_ansis = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs": ((exports, module) => {
2080
2065
  let e, t, r, { defineProperty: n, setPrototypeOf: l, create: o, keys: s } = Object, i$1 = "", { round: c, max: a$1 } = Math, p = (e$1) => {
2081
2066
  let t$1 = /([a-f\d]{3,6})/i.exec(e$1)?.[1], r$1 = t$1?.length, n$1 = parseInt(6 ^ r$1 ? 3 ^ r$1 ? "0" : t$1[0] + t$1[0] + t$1[1] + t$1[1] + t$1[2] + t$1[2] : t$1, 16);
2082
2067
  return [
@@ -2177,11 +2162,11 @@ var require_ansis = __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modu
2177
2162
  })), t$1.extend(M);
2178
2163
  }, y = new w();
2179
2164
  module.exports = y, y.default = y;
2180
- } });
2165
+ }) });
2181
2166
 
2182
2167
  //#endregion
2183
2168
  //#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.mjs
2184
- var import_ansis = __toESM(require_ansis(), 1);
2169
+ var import_ansis = /* @__PURE__ */ __toESM(require_ansis(), 1);
2185
2170
  var ansis_default = import_ansis.default;
2186
2171
  const { Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = import_ansis.default;
2187
2172
 
@@ -2305,6 +2290,7 @@ const ChecksOptionsSchema = strictObject({
2305
2290
  filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
2306
2291
  commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
2307
2292
  importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
2293
+ emptyImportMeta: pipe(optional(boolean()), description("Whether to emit warning when detecting empty import meta")),
2308
2294
  configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
2309
2295
  });
2310
2296
  const MinifyOptionsSchema = strictObject({
@@ -2332,7 +2318,10 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
2332
2318
  unknownGlobalSideEffects: optional(boolean()),
2333
2319
  commonjs: optional(boolean())
2334
2320
  })]);
2335
- const OptimizationOptionsSchema = strictObject({ inlineConst: pipe(optional(boolean()), description("Enable crossmodule constant inlining")) });
2321
+ const OptimizationOptionsSchema = strictObject({
2322
+ inlineConst: pipe(optional(boolean()), description("Enable crossmodule constant inlining")),
2323
+ pifeForModuleWrappers: pipe(optional(boolean()), description("Use PIFE pattern for module wrappers"))
2324
+ });
2336
2325
  const OnLogSchema = pipe(function_(), args(tuple([
2337
2326
  LogLevelSchema,
2338
2327
  RollupLogSchema,
@@ -2487,6 +2476,7 @@ const OutputOptionsSchema = strictObject({
2487
2476
  literal("inline"),
2488
2477
  literal("hidden")
2489
2478
  ])), description(`Generate sourcemap (\`-s inline\` for inline, or ${ansis_default.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
2479
+ sourcemapBaseUrl: pipe(optional(string()), description("Base URL used to prefix sourcemap paths")),
2490
2480
  sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
2491
2481
  sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
2492
2482
  sourcemapPathTransform: optional(custom(() => true)),
@@ -2872,44 +2862,38 @@ function bindingifyFilterExprImpl(expr, list) {
2872
2862
  });
2873
2863
  break;
2874
2864
  }
2875
- case "not": {
2865
+ case "not":
2876
2866
  bindingifyFilterExprImpl(expr.expr, list);
2877
2867
  list.push({ kind: "Not" });
2878
2868
  break;
2879
- }
2880
- case "id": {
2869
+ case "id":
2881
2870
  list.push({
2882
2871
  kind: "Id",
2883
2872
  payload: expr.pattern
2884
2873
  });
2885
2874
  if (expr.params.cleanUrl) list.push({ kind: "CleanUrl" });
2886
2875
  break;
2887
- }
2888
- case "moduleType": {
2876
+ case "moduleType":
2889
2877
  list.push({
2890
2878
  kind: "ModuleType",
2891
2879
  payload: expr.pattern
2892
2880
  });
2893
2881
  break;
2894
- }
2895
- case "code": {
2882
+ case "code":
2896
2883
  list.push({
2897
2884
  kind: "Code",
2898
2885
  payload: expr.pattern
2899
2886
  });
2900
2887
  break;
2901
- }
2902
- case "include": {
2888
+ case "include":
2903
2889
  bindingifyFilterExprImpl(expr.expr, list);
2904
2890
  list.push({ kind: "Include" });
2905
2891
  break;
2906
- }
2907
- case "exclude": {
2892
+ case "exclude":
2908
2893
  bindingifyFilterExprImpl(expr.expr, list);
2909
2894
  list.push({ kind: "Exclude" });
2910
2895
  break;
2911
- }
2912
- case "query": {
2896
+ case "query":
2913
2897
  list.push({
2914
2898
  kind: "QueryKey",
2915
2899
  payload: expr.key
@@ -2919,7 +2903,6 @@ function bindingifyFilterExprImpl(expr, list) {
2919
2903
  payload: expr.pattern
2920
2904
  });
2921
2905
  break;
2922
- }
2923
2906
  default: throw new Error(`Unknown filter expression: ${expr}`);
2924
2907
  }
2925
2908
  }
@@ -2962,7 +2945,7 @@ function bindingPluginOrder(order) {
2962
2945
  }
2963
2946
 
2964
2947
  //#endregion
2965
- //#region ../../node_modules/.pnpm/oxc-parser@0.77.3/node_modules/oxc-parser/wrap.mjs
2948
+ //#region ../../node_modules/.pnpm/oxc-parser@0.78.0/node_modules/oxc-parser/wrap.mjs
2966
2949
  function wrap$1(result) {
2967
2950
  let program, module$1, comments, errors;
2968
2951
  return {
@@ -3041,9 +3024,33 @@ function bindingAssetSource(source) {
3041
3024
  return { inner: source };
3042
3025
  }
3043
3026
 
3027
+ //#endregion
3028
+ //#region src/plugin/fs.ts
3029
+ const fsModule = {
3030
+ appendFile: throwNoFileSystemError("fs.appendFile"),
3031
+ copyFile: throwNoFileSystemError("fs.copyFile"),
3032
+ mkdir: throwNoFileSystemError("fs.mkdir"),
3033
+ mkdtemp: throwNoFileSystemError("fs.mkdtemp"),
3034
+ readdir: throwNoFileSystemError("fs.readdir"),
3035
+ readFile: throwNoFileSystemError("fs.readFile"),
3036
+ realpath: throwNoFileSystemError("fs.realpath"),
3037
+ rename: throwNoFileSystemError("fs.rename"),
3038
+ rmdir: throwNoFileSystemError("fs.rmdir"),
3039
+ stat: throwNoFileSystemError("fs.stat"),
3040
+ lstat: throwNoFileSystemError("fs.lstat"),
3041
+ unlink: throwNoFileSystemError("fs.unlink"),
3042
+ writeFile: throwNoFileSystemError("fs.writeFile")
3043
+ };
3044
+ function throwNoFileSystemError(method) {
3045
+ return () => {
3046
+ error(logNoFileSystemInBrowser(method));
3047
+ };
3048
+ }
3049
+
3044
3050
  //#endregion
3045
3051
  //#region src/plugin/plugin-context.ts
3046
3052
  var PluginContextImpl = class extends MinimalPluginContextImpl {
3053
+ fs = fsModule;
3047
3054
  getModuleInfo;
3048
3055
  constructor(outputOptions, context, plugin, data, onLog, logLevel, watchMode, currentLoadingModule) {
3049
3056
  super(onLog, logLevel, plugin.name, watchMode);
@@ -3961,7 +3968,7 @@ var ChunkingContextImpl = class {
3961
3968
  //#endregion
3962
3969
  //#region src/utils/bindingify-output-options.ts
3963
3970
  function bindingifyOutputOptions(outputOptions) {
3964
- const { dir, format: format$1, exports, hashCharacters, sourcemap, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar } = outputOptions;
3971
+ const { dir, format: format$1, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar } = outputOptions;
3965
3972
  const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
3966
3973
  return {
3967
3974
  dir,
@@ -3970,6 +3977,7 @@ function bindingifyOutputOptions(outputOptions) {
3970
3977
  exports,
3971
3978
  hashCharacters,
3972
3979
  sourcemap: bindingifySourcemap(sourcemap),
3980
+ sourcemapBaseUrl,
3973
3981
  sourcemapDebugIds,
3974
3982
  sourcemapIgnoreList: bindingifySourcemapIgnoreList(sourcemapIgnoreList),
3975
3983
  sourcemapPathTransform,
@@ -4642,8 +4650,12 @@ var RolldownBuild = class {
4642
4650
  await this.close();
4643
4651
  }
4644
4652
  async generateHmrPatch(changedFiles) {
4645
- const output = await this.#bundlerImpl.impl.generateHmrPatch(changedFiles);
4646
- return transformHmrPatchOutput(output);
4653
+ const ret = await this.#bundlerImpl.impl.generateHmrPatch(changedFiles);
4654
+ switch (ret.type) {
4655
+ case "Ok": return ret.field0;
4656
+ case "Error": throw normalizeErrors(ret.field0);
4657
+ default: throw new Error("Unknown error");
4658
+ }
4647
4659
  }
4648
4660
  async hmrInvalidate(file, firstInvalidatedBy) {
4649
4661
  const output = await this.#bundlerImpl.impl.hmrInvalidate(file, firstInvalidatedBy);
@@ -4821,4 +4833,4 @@ function defineConfig(config) {
4821
4833
  const VERSION = version;
4822
4834
 
4823
4835
  //#endregion
4824
- export { BuiltinPlugin, PluginDriver, VERSION, assetPlugin, build, buildImportAnalysisPlugin, createBundlerImpl, defineConfig, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
4836
+ export { BuiltinPlugin, PluginDriver, VERSION, assetPlugin, build, buildImportAnalysisPlugin, createBundlerImpl, defineConfig, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolldown/browser",
3
- "version": "1.0.0-beta.29",
3
+ "version": "1.0.0-beta.30",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "homepage": "https://rolldown.rs/",
6
6
  "type": "module",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "@napi-rs/wasm-runtime": "^1.0.0",
59
- "@oxc-project/runtime": "=0.77.3"
59
+ "@oxc-project/runtime": "=0.78.0"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "pnpm run build:debug",