@rolldown/browser 1.0.0-beta.29-commit.fe1bea3 → 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 +8 -8
  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-CKxZwWu_.d.mts → define-config-5ALh7WDx.d.mts} +67 -9
  33. package/dist/shared/{define-config-O6TCZLYU.d.cts → define-config-CMH1jWhX.d.cts} +67 -9
  34. package/dist/shared/{load-config-C2Df0pqb.mjs → load-config-Uk19Sezh.mjs} +2 -2
  35. package/dist/shared/{load-config-CPJ15pW3.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-BLxfrK6S.cjs → src-CXCXfLrc.cjs} +88 -136
  39. package/dist/shared/{src-BWVOVy_u.mjs → src-CkG0t1KT.mjs} +89 -131
  40. package/dist/{src-CVDDqNxL.js → src-DGzv-S-Z.js} +57 -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-commit.fe1bea3";
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
 
@@ -2333,7 +2318,10 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
2333
2318
  unknownGlobalSideEffects: optional(boolean()),
2334
2319
  commonjs: optional(boolean())
2335
2320
  })]);
2336
- 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
+ });
2337
2325
  const OnLogSchema = pipe(function_(), args(tuple([
2338
2326
  LogLevelSchema,
2339
2327
  RollupLogSchema,
@@ -2488,6 +2476,7 @@ const OutputOptionsSchema = strictObject({
2488
2476
  literal("inline"),
2489
2477
  literal("hidden")
2490
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")),
2491
2480
  sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
2492
2481
  sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
2493
2482
  sourcemapPathTransform: optional(custom(() => true)),
@@ -2873,44 +2862,38 @@ function bindingifyFilterExprImpl(expr, list) {
2873
2862
  });
2874
2863
  break;
2875
2864
  }
2876
- case "not": {
2865
+ case "not":
2877
2866
  bindingifyFilterExprImpl(expr.expr, list);
2878
2867
  list.push({ kind: "Not" });
2879
2868
  break;
2880
- }
2881
- case "id": {
2869
+ case "id":
2882
2870
  list.push({
2883
2871
  kind: "Id",
2884
2872
  payload: expr.pattern
2885
2873
  });
2886
2874
  if (expr.params.cleanUrl) list.push({ kind: "CleanUrl" });
2887
2875
  break;
2888
- }
2889
- case "moduleType": {
2876
+ case "moduleType":
2890
2877
  list.push({
2891
2878
  kind: "ModuleType",
2892
2879
  payload: expr.pattern
2893
2880
  });
2894
2881
  break;
2895
- }
2896
- case "code": {
2882
+ case "code":
2897
2883
  list.push({
2898
2884
  kind: "Code",
2899
2885
  payload: expr.pattern
2900
2886
  });
2901
2887
  break;
2902
- }
2903
- case "include": {
2888
+ case "include":
2904
2889
  bindingifyFilterExprImpl(expr.expr, list);
2905
2890
  list.push({ kind: "Include" });
2906
2891
  break;
2907
- }
2908
- case "exclude": {
2892
+ case "exclude":
2909
2893
  bindingifyFilterExprImpl(expr.expr, list);
2910
2894
  list.push({ kind: "Exclude" });
2911
2895
  break;
2912
- }
2913
- case "query": {
2896
+ case "query":
2914
2897
  list.push({
2915
2898
  kind: "QueryKey",
2916
2899
  payload: expr.key
@@ -2920,7 +2903,6 @@ function bindingifyFilterExprImpl(expr, list) {
2920
2903
  payload: expr.pattern
2921
2904
  });
2922
2905
  break;
2923
- }
2924
2906
  default: throw new Error(`Unknown filter expression: ${expr}`);
2925
2907
  }
2926
2908
  }
@@ -2963,7 +2945,7 @@ function bindingPluginOrder(order) {
2963
2945
  }
2964
2946
 
2965
2947
  //#endregion
2966
- //#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
2967
2949
  function wrap$1(result) {
2968
2950
  let program, module$1, comments, errors;
2969
2951
  return {
@@ -3042,9 +3024,33 @@ function bindingAssetSource(source) {
3042
3024
  return { inner: source };
3043
3025
  }
3044
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
+
3045
3050
  //#endregion
3046
3051
  //#region src/plugin/plugin-context.ts
3047
3052
  var PluginContextImpl = class extends MinimalPluginContextImpl {
3053
+ fs = fsModule;
3048
3054
  getModuleInfo;
3049
3055
  constructor(outputOptions, context, plugin, data, onLog, logLevel, watchMode, currentLoadingModule) {
3050
3056
  super(onLog, logLevel, plugin.name, watchMode);
@@ -3962,7 +3968,7 @@ var ChunkingContextImpl = class {
3962
3968
  //#endregion
3963
3969
  //#region src/utils/bindingify-output-options.ts
3964
3970
  function bindingifyOutputOptions(outputOptions) {
3965
- 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;
3966
3972
  const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
3967
3973
  return {
3968
3974
  dir,
@@ -3971,6 +3977,7 @@ function bindingifyOutputOptions(outputOptions) {
3971
3977
  exports,
3972
3978
  hashCharacters,
3973
3979
  sourcemap: bindingifySourcemap(sourcemap),
3980
+ sourcemapBaseUrl,
3974
3981
  sourcemapDebugIds,
3975
3982
  sourcemapIgnoreList: bindingifySourcemapIgnoreList(sourcemapIgnoreList),
3976
3983
  sourcemapPathTransform,
@@ -4643,8 +4650,12 @@ var RolldownBuild = class {
4643
4650
  await this.close();
4644
4651
  }
4645
4652
  async generateHmrPatch(changedFiles) {
4646
- const output = await this.#bundlerImpl.impl.generateHmrPatch(changedFiles);
4647
- 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
+ }
4648
4659
  }
4649
4660
  async hmrInvalidate(file, firstInvalidatedBy) {
4650
4661
  const output = await this.#bundlerImpl.impl.hmrInvalidate(file, firstInvalidatedBy);
@@ -4822,4 +4833,4 @@ function defineConfig(config) {
4822
4833
  const VERSION = version;
4823
4834
 
4824
4835
  //#endregion
4825
- 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-commit.fe1bea3",
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",