@rspack/browser 1.6.0 → 1.6.2

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,6 +1,16 @@
1
1
  import type binding from "./binding";
2
2
  import type { ResolveCallback } from "./config/adapterRuleUse";
3
- type ResolveContext = {};
3
+ export type ResolveContext = {
4
+ contextDependencies?: {
5
+ add: (context: string) => void;
6
+ };
7
+ missingDependencies?: {
8
+ add: (dependency: string) => void;
9
+ };
10
+ fileDependencies?: {
11
+ add: (dependency: string) => void;
12
+ };
13
+ };
4
14
  export type ResourceData = binding.JsResourceData;
5
15
  export interface ResolveRequest {
6
16
  path: string;
@@ -8,6 +18,9 @@ export interface ResolveRequest {
8
18
  fragment: string;
9
19
  descriptionFileData?: string;
10
20
  descriptionFilePath?: string;
21
+ fileDependencies?: string[];
22
+ missingDependencies?: string[];
23
+ contextDependencies?: string[];
11
24
  }
12
25
  export declare class Resolver {
13
26
  #private;
@@ -15,4 +28,3 @@ export declare class Resolver {
15
28
  resolveSync(context: object, path: string, request: string): string | false;
16
29
  resolve(context: object, path: string, request: string, resolveContext: ResolveContext, callback: ResolveCallback): void;
17
30
  }
18
- export {};
@@ -33,7 +33,6 @@ type Headers = {
33
33
  value: string;
34
34
  }[] | Record<string, string | string[]>;
35
35
  type OutputFileSystem = import("..").OutputFileSystem & {
36
- createReadStream?: typeof import("fs").createReadStream;
37
36
  statSync: import("fs").StatSyncFn;
38
37
  readFileSync: typeof import("fs").readFileSync;
39
38
  };
@@ -111,6 +111,9 @@ export interface ExperimentsNormalized {
111
111
  */
112
112
  layers?: boolean;
113
113
  incremental?: false | Incremental;
114
+ /**
115
+ * @deprecated This option is deprecated, as it has a huge regression in some edge cases where the chunk graph has lots of cycles. We will improve performance of build_chunk_graph.
116
+ */
114
117
  parallelCodeSplitting?: boolean;
115
118
  futureDefaults?: boolean;
116
119
  rspackFuture?: RspackFutureOptions;
@@ -2100,6 +2100,7 @@ export type Experiments = {
2100
2100
  incremental?: IncrementalPresets | Incremental;
2101
2101
  /**
2102
2102
  * Enable multi-threaded code splitting algorithm.
2103
+ * @deprecated This option is deprecated, it has a huge regression in some edge cases where the chunk graph has lots of cycles. We'll improve the performance of build_chunk_graph in the future instead
2103
2104
  */
2104
2105
  parallelCodeSplitting?: boolean;
2105
2106
  /**
@@ -0,0 +1,37 @@
1
+ import { type BuiltinPlugin, BuiltinPluginName } from "../binding";
2
+ import { RspackBuiltinPlugin } from "../builtin-plugin/base";
3
+ import type { Compiler } from "../Compiler";
4
+ export type RemoteAliasMap = Record<string, {
5
+ name: string;
6
+ entry?: string;
7
+ }>;
8
+ export type ManifestExposeOption = {
9
+ path: string;
10
+ name: string;
11
+ };
12
+ export type ManifestSharedOption = {
13
+ name: string;
14
+ version?: string;
15
+ requiredVersion?: string;
16
+ singleton?: boolean;
17
+ };
18
+ export type ModuleFederationManifestPluginOptions = {
19
+ name?: string;
20
+ globalName?: string;
21
+ filePath?: string;
22
+ disableAssetsAnalyze?: boolean;
23
+ fileName?: string;
24
+ remoteAliasMap?: RemoteAliasMap;
25
+ exposes?: ManifestExposeOption[];
26
+ shared?: ManifestSharedOption[];
27
+ };
28
+ /**
29
+ * JS-side post-processing plugin: reads mf-manifest.json and mf-stats.json, executes additionalData callback and merges/overwrites manifest.
30
+ * To avoid cross-NAPI callback complexity, this plugin runs at the afterProcessAssets stage to ensure Rust-side MfManifestPlugin has already output its artifacts.
31
+ */
32
+ export declare class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
33
+ name: BuiltinPluginName;
34
+ private opts;
35
+ constructor(opts: ModuleFederationManifestPluginOptions);
36
+ raw(compiler: Compiler): BuiltinPlugin;
37
+ }
@@ -1,9 +1,11 @@
1
1
  import type { Compiler } from "../Compiler";
2
+ import { type ModuleFederationManifestPluginOptions } from "./ModuleFederationManifestPlugin";
2
3
  import type { ModuleFederationPluginV1Options } from "./ModuleFederationPluginV1";
3
4
  export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPluginV1Options, "enhanced"> {
4
5
  runtimePlugins?: RuntimePlugins;
5
6
  implementation?: string;
6
7
  shareStrategy?: "version-first" | "loaded-first";
8
+ manifest?: boolean | Omit<ModuleFederationManifestPluginOptions, "remoteAliasMap" | "globalName" | "name" | "exposes" | "shared">;
7
9
  }
8
10
  export type RuntimePlugins = string[] | [string, Record<string, unknown>][];
9
11
  export declare class ModuleFederationPlugin {
package/dist/index.mjs CHANGED
@@ -53396,16 +53396,16 @@ function applyLimits(options, logger) {
53396
53396
  }
53397
53397
  if (void 0 === options.output.chunkLoading) options.output.chunkLoading = "import";
53398
53398
  if (options.output.library) options.output.library = void 0;
53399
- const { splitChunks } = options.optimization;
53400
- if (splitChunks) {
53399
+ let { splitChunks } = options.optimization;
53400
+ if (void 0 === splitChunks) splitChunks = options.optimization.splitChunks = {};
53401
+ if (false !== splitChunks) {
53401
53402
  splitChunks.chunks = "all";
53402
53403
  splitChunks.minSize = 0;
53403
53404
  splitChunks.maxAsyncRequests = 1 / 0;
53404
53405
  splitChunks.maxInitialRequests = 1 / 0;
53405
- if (splitChunks.cacheGroups) {
53406
- splitChunks.cacheGroups.default = false;
53407
- splitChunks.cacheGroups.defaultVendors = false;
53408
- }
53406
+ splitChunks.cacheGroups ??= {};
53407
+ splitChunks.cacheGroups.default = false;
53408
+ splitChunks.cacheGroups.defaultVendors = false;
53409
53409
  }
53410
53410
  }
53411
53411
  class EsmLibraryPlugin {
@@ -58126,7 +58126,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58126
58126
  if ("object" == typeof rspackFuture) {
58127
58127
  D(rspackFuture, "bundlerInfo", {});
58128
58128
  if ("object" == typeof rspackFuture.bundlerInfo) {
58129
- D(rspackFuture.bundlerInfo, "version", "1.6.0");
58129
+ D(rspackFuture.bundlerInfo, "version", "1.6.2");
58130
58130
  D(rspackFuture.bundlerInfo, "bundler", "rspack");
58131
58131
  D(rspackFuture.bundlerInfo, "force", !library);
58132
58132
  }
@@ -58986,6 +58986,7 @@ const getNormalizedRspackOptions = (config)=>({
58986
58986
  experiments: nestedConfig(config.experiments, (experiments)=>{
58987
58987
  if (experiments.layers) util_default().deprecate(()=>{}, "`experiments.layers` config has been deprecated and will be removed in Rspack v2.0. Feature layers will be always enabled. Please remove this option from your Rspack configuration.")();
58988
58988
  if (false === experiments.topLevelAwait) util_default().deprecate(()=>{}, "`experiments.topLevelAwait` config has been deprecated and will be removed in Rspack v2.0. Top-level await will be always enabled. Please remove this option from your Rspack configuration.")();
58989
+ if (experiments.parallelCodeSplitting) util_default().deprecate(()=>{}, "`experiments.parallelCodeSplitting` config has been deprecated and will be removed in next minor. It has huge regression in some edge cases where the chunk graph has lots of cycles, we'll improve the performance of build_chunk_graph in the future instead")();
58989
58990
  return {
58990
58991
  ...experiments,
58991
58992
  cache: optionalNestedConfig(experiments.cache, (cache)=>{
@@ -59670,7 +59671,7 @@ class MergedEtag {
59670
59671
  }
59671
59672
  const dualObjectMap = new WeakMap();
59672
59673
  const objectStringMap = new WeakMap();
59673
- const mergeEtags_mergeEtags = (first, second)=>{
59674
+ const mergeEtags = (first, second)=>{
59674
59675
  let a = first;
59675
59676
  let b = second;
59676
59677
  if ("string" == typeof a) {
@@ -59761,9 +59762,9 @@ class ItemCacheFacade {
59761
59762
  this._etag = etag;
59762
59763
  }
59763
59764
  }
59764
- class CacheFacade_CacheFacade {
59765
+ class CacheFacade {
59765
59766
  getChildCache(name) {
59766
- return new CacheFacade_CacheFacade(this._cache, `${this._name}|${name}`, this._hashFunction);
59767
+ return new CacheFacade(this._cache, `${this._name}|${name}`, this._hashFunction);
59767
59768
  }
59768
59769
  getItemCache(identifier, etag) {
59769
59770
  return new ItemCacheFacade(this._cache, `${this._name}|${identifier}`, etag);
@@ -59772,7 +59773,7 @@ class CacheFacade_CacheFacade {
59772
59773
  return getLazyHashedEtag_getter(obj, this._hashFunction);
59773
59774
  }
59774
59775
  mergeEtags(a, b) {
59775
- return mergeEtags_mergeEtags(a, b);
59776
+ return mergeEtags(a, b);
59776
59777
  }
59777
59778
  get(identifier, etag, callback) {
59778
59779
  this._cache.get(`${this._name}|${identifier}`, etag, callback);
@@ -59825,7 +59826,7 @@ class CacheFacade_CacheFacade {
59825
59826
  this._hashFunction = hashFunction;
59826
59827
  }
59827
59828
  }
59828
- const CacheFacade = CacheFacade_CacheFacade;
59829
+ const lib_CacheFacade = CacheFacade;
59829
59830
  function NormalModuleFactory_define_property(obj, key, value) {
59830
59831
  if (key in obj) Object.defineProperty(obj, key, {
59831
59832
  value: value,
@@ -59907,6 +59908,12 @@ class Resolver {
59907
59908
  Resolver_class_private_field_get(this, _binding).resolve(path, request, (error, text)=>{
59908
59909
  if (error) return void callback(error);
59909
59910
  const req = text ? JSON.parse(text) : void 0;
59911
+ if (req?.fileDependencies) req.fileDependencies.forEach((file)=>{
59912
+ resolveContext.fileDependencies?.add(file);
59913
+ });
59914
+ if (req?.missingDependencies) req.missingDependencies.forEach((missing)=>{
59915
+ resolveContext.missingDependencies?.add(missing);
59916
+ });
59910
59917
  callback(error, req ? `${req.path.replace(/#/g, "\u200b#")}${req.query.replace(/#/g, "\u200b#")}${req.fragment}` : false, req);
59911
59918
  });
59912
59919
  }
@@ -60528,7 +60535,9 @@ const createCompilerHooksRegisters = (getCompiler, createTap)=>({
60528
60535
  targetPath,
60529
60536
  outputPath,
60530
60537
  get source () {
60531
- return getCompiler().__internal__get_compilation().getAsset(filename)?.source;
60538
+ const source = getCompiler().__internal__get_compilation().getAsset(filename)?.source;
60539
+ if (!source) throw new Error(`Asset ${filename} not found`);
60540
+ return source;
60532
60541
  },
60533
60542
  get content () {
60534
60543
  return this.source?.buffer();
@@ -61431,7 +61440,7 @@ class Compiler {
61431
61440
  return Compiler_class_private_field_get(this, _ruleSet);
61432
61441
  }
61433
61442
  getCache(name) {
61434
- return new CacheFacade(this.cache, `${this.compilerPath}${name}`, this.options.output.hashFunction);
61443
+ return new lib_CacheFacade(this.cache, `${this.compilerPath}${name}`, this.options.output.hashFunction);
61435
61444
  }
61436
61445
  getInfrastructureLogger(name) {
61437
61446
  if (!name) throw new TypeError("Compiler.getInfrastructureLogger(name) called without a name");
@@ -61843,8 +61852,8 @@ class Compiler {
61843
61852
  ]),
61844
61853
  additionalPass: new AsyncSeriesHook([])
61845
61854
  };
61846
- this.webpack = src_rspack;
61847
- this.rspack = src_rspack;
61855
+ this.webpack = src_rspack_0;
61856
+ this.rspack = src_rspack_0;
61848
61857
  this.root = this;
61849
61858
  this.outputPath = "";
61850
61859
  this.inputFileSystem = null;
@@ -62066,7 +62075,7 @@ class MultiStats {
62066
62075
  return obj;
62067
62076
  });
62068
62077
  if (childOptions.version) {
62069
- obj.rspackVersion = "1.6.0";
62078
+ obj.rspackVersion = "1.6.2";
62070
62079
  obj.version = "5.75.0";
62071
62080
  }
62072
62081
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
@@ -62233,7 +62242,7 @@ function ArrayQueue_define_property(obj, key, value) {
62233
62242
  var ArrayQueue_computedKey;
62234
62243
  ArrayQueue_computedKey = Symbol.iterator;
62235
62244
  let ArrayQueue_computedKey1 = ArrayQueue_computedKey;
62236
- class ArrayQueue_ArrayQueue {
62245
+ class ArrayQueue {
62237
62246
  get length() {
62238
62247
  return this._list.length + this._listReversed.length;
62239
62248
  }
@@ -62275,7 +62284,7 @@ class ArrayQueue_ArrayQueue {
62275
62284
  this._listReversed = [];
62276
62285
  }
62277
62286
  }
62278
- const ArrayQueue = ArrayQueue_ArrayQueue;
62287
+ const util_ArrayQueue = ArrayQueue;
62279
62288
  var MultiCompiler_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
62280
62289
  function MultiCompiler_check_private_redeclaration(obj, privateCollection) {
62281
62290
  if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
@@ -62494,7 +62503,7 @@ function runGraph(setup, run, callback) {
62494
62503
  parent.children.push(node);
62495
62504
  }
62496
62505
  }
62497
- const queue = new ArrayQueue();
62506
+ const queue = new util_ArrayQueue();
62498
62507
  for (const node of nodes)if (0 === node.parents.length) {
62499
62508
  node.state = "queued";
62500
62509
  queue.enqueue(node);
@@ -63371,7 +63380,7 @@ const SIMPLE_EXTRACTORS = {
63371
63380
  },
63372
63381
  version: (object)=>{
63373
63382
  object.version = "5.75.0";
63374
- object.rspackVersion = "1.6.0";
63383
+ object.rspackVersion = "1.6.2";
63375
63384
  },
63376
63385
  env: (object, _compilation, _context, { _env })=>{
63377
63386
  object.env = _env;
@@ -65800,6 +65809,100 @@ class NodeTemplatePlugin {
65800
65809
  this._options = _options;
65801
65810
  }
65802
65811
  }
65812
+ const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
65813
+ function isRequiredVersion(str) {
65814
+ return VERSION_PATTERN_REGEXP.test(str);
65815
+ }
65816
+ var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
65817
+ function ModuleFederationManifestPlugin_define_property(obj, key, value) {
65818
+ if (key in obj) Object.defineProperty(obj, key, {
65819
+ value: value,
65820
+ enumerable: true,
65821
+ configurable: true,
65822
+ writable: true
65823
+ });
65824
+ else obj[key] = value;
65825
+ return obj;
65826
+ }
65827
+ const MANIFEST_FILE_NAME = "mf-manifest.json";
65828
+ const STATS_FILE_NAME = "mf-stats.json";
65829
+ const LOCAL_BUILD_VERSION = "local";
65830
+ const JSON_EXT = ".json";
65831
+ function isPlainObject(value) {
65832
+ return Boolean(value) && "object" == typeof value && !Array.isArray(value);
65833
+ }
65834
+ function parseJSON(input, guard) {
65835
+ try {
65836
+ const parsed = JSON.parse(input);
65837
+ if (guard(parsed)) return parsed;
65838
+ } catch {}
65839
+ }
65840
+ function readPKGJson(root) {
65841
+ const base = root ? (0, path_browserify.resolve)(root) : ModuleFederationManifestPlugin_process.cwd();
65842
+ const pkgPath = (0, path_browserify.join)(base, "package.json");
65843
+ try {
65844
+ const content = (0, browser_fs.readFileSync)(pkgPath, "utf-8");
65845
+ const parsed = parseJSON(content, isPlainObject);
65846
+ if (parsed) {
65847
+ const filtered = {};
65848
+ for (const [key, value] of Object.entries(parsed))if ("string" == typeof value) filtered[key] = value;
65849
+ if (Object.keys(filtered).length > 0) return filtered;
65850
+ }
65851
+ } catch {}
65852
+ return {};
65853
+ }
65854
+ function getBuildInfo(isDev, root) {
65855
+ const rootPath = root || ModuleFederationManifestPlugin_process.cwd();
65856
+ const pkg = readPKGJson(rootPath);
65857
+ const buildVersion = isDev ? LOCAL_BUILD_VERSION : pkg?.version;
65858
+ return {
65859
+ buildVersion: ModuleFederationManifestPlugin_process.env.MF_BUILD_VERSION || buildVersion || "UNKNOWN",
65860
+ buildName: ModuleFederationManifestPlugin_process.env.MF_BUILD_NAME || pkg?.name || "UNKNOWN"
65861
+ };
65862
+ }
65863
+ function getFileName(manifestOptions) {
65864
+ if (!manifestOptions) return {
65865
+ statsFileName: STATS_FILE_NAME,
65866
+ manifestFileName: MANIFEST_FILE_NAME
65867
+ };
65868
+ const filePath = "boolean" == typeof manifestOptions ? "" : manifestOptions.filePath || "";
65869
+ const fileName = "boolean" == typeof manifestOptions ? "" : manifestOptions.fileName || "";
65870
+ const addExt = (name)=>{
65871
+ if (name.endsWith(JSON_EXT)) return name;
65872
+ return `${name}${JSON_EXT}`;
65873
+ };
65874
+ const insertSuffix = (name, suffix)=>name.replace(JSON_EXT, `${suffix}${JSON_EXT}`);
65875
+ const manifestFileName = fileName ? addExt(fileName) : MANIFEST_FILE_NAME;
65876
+ const statsFileName = fileName ? insertSuffix(manifestFileName, "-stats") : STATS_FILE_NAME;
65877
+ return {
65878
+ statsFileName: (0, path_browserify.join)(filePath, statsFileName),
65879
+ manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
65880
+ };
65881
+ }
65882
+ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
65883
+ raw(compiler) {
65884
+ const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
65885
+ const { statsFileName, manifestFileName } = getFileName(this.opts);
65886
+ const rawOptions = {
65887
+ name: this.opts.name,
65888
+ globalName: this.opts.globalName,
65889
+ fileName,
65890
+ filePath,
65891
+ manifestFileName,
65892
+ statsFileName,
65893
+ disableAssetsAnalyze,
65894
+ remoteAliasMap,
65895
+ exposes,
65896
+ shared,
65897
+ buildInfo: getBuildInfo("development" === compiler.options.mode, compiler.context)
65898
+ };
65899
+ return createBuiltinPlugin(this.name, rawOptions);
65900
+ }
65901
+ constructor(opts){
65902
+ super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
65903
+ this.opts = opts;
65904
+ }
65905
+ }
65803
65906
  const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
65804
65907
  const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
65805
65908
  const array = (items)=>{
@@ -65852,12 +65955,93 @@ class ModuleFederationPlugin {
65852
65955
  ...this._options,
65853
65956
  enhanced: true
65854
65957
  }).apply(compiler);
65958
+ if (this._options.manifest) {
65959
+ const manifestOptions = true === this._options.manifest ? {} : {
65960
+ ...this._options.manifest
65961
+ };
65962
+ const containerName = manifestOptions.name ?? this._options.name;
65963
+ const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
65964
+ const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
65965
+ if (cur[1].length > 1) return sum;
65966
+ const remoteInfo = cur[1][0];
65967
+ const { entry, alias, name } = remoteInfo;
65968
+ if (entry && name) sum[alias] = {
65969
+ name,
65970
+ entry
65971
+ };
65972
+ return sum;
65973
+ }, {});
65974
+ const manifestExposes = collectManifestExposes(this._options.exposes);
65975
+ if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
65976
+ const manifestShared = collectManifestShared(this._options.shared);
65977
+ if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
65978
+ new ModuleFederationManifestPlugin({
65979
+ ...manifestOptions,
65980
+ name: containerName,
65981
+ globalName,
65982
+ remoteAliasMap
65983
+ }).apply(compiler);
65984
+ }
65855
65985
  }
65856
65986
  constructor(_options){
65857
65987
  ModuleFederationPlugin_define_property(this, "_options", void 0);
65858
65988
  this._options = _options;
65859
65989
  }
65860
65990
  }
65991
+ function collectManifestExposes(exposes) {
65992
+ if (!exposes) return;
65993
+ const parsed = parseOptions(exposes, (value, key)=>({
65994
+ import: Array.isArray(value) ? value : [
65995
+ value
65996
+ ],
65997
+ name: void 0
65998
+ }), (value)=>({
65999
+ import: Array.isArray(value.import) ? value.import : [
66000
+ value.import
66001
+ ],
66002
+ name: value.name ?? void 0
66003
+ }));
66004
+ const result = parsed.map(([exposeKey, info])=>{
66005
+ const exposeName = info.name ?? exposeKey.replace(/^\.\//, "");
66006
+ return {
66007
+ path: exposeKey,
66008
+ name: exposeName
66009
+ };
66010
+ });
66011
+ return result.length > 0 ? result : void 0;
66012
+ }
66013
+ function collectManifestShared(shared) {
66014
+ if (!shared) return;
66015
+ const parsed = parseOptions(shared, (item, key)=>{
66016
+ if ("string" != typeof item) throw new Error("Unexpected array in shared");
66017
+ return item !== key && isRequiredVersion(item) ? {
66018
+ import: key,
66019
+ requiredVersion: item
66020
+ } : {
66021
+ import: item
66022
+ };
66023
+ }, (item)=>item);
66024
+ const result = parsed.map(([key, config])=>{
66025
+ const name = config.shareKey || key;
66026
+ const version = "string" == typeof config.version ? config.version : void 0;
66027
+ const requiredVersion = "string" == typeof config.requiredVersion ? config.requiredVersion : void 0;
66028
+ return {
66029
+ name,
66030
+ version,
66031
+ requiredVersion,
66032
+ singleton: config.singleton
66033
+ };
66034
+ });
66035
+ return result.length > 0 ? result : void 0;
66036
+ }
66037
+ function resolveLibraryGlobalName(library) {
66038
+ if (!library) return;
66039
+ const libName = library.name;
66040
+ if (!libName) return;
66041
+ if ("string" == typeof libName) return libName;
66042
+ if (Array.isArray(libName)) return libName[0];
66043
+ if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66044
+ }
65861
66045
  function getRemoteInfos(options) {
65862
66046
  if (!options.remotes) return {};
65863
66047
  function extractUrlAndGlobal(urlAndGlobal) {
@@ -65983,10 +66167,6 @@ class ShareRuntimePlugin extends RspackBuiltinPlugin {
65983
66167
  super(), ShareRuntimePlugin_define_property(this, "enhanced", void 0), ShareRuntimePlugin_define_property(this, "name", void 0), this.enhanced = enhanced, this.name = external_rspack_wasi_browser_js_.BuiltinPluginName.ShareRuntimePlugin;
65984
66168
  }
65985
66169
  }
65986
- const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
65987
- function isRequiredVersion(str) {
65988
- return VERSION_PATTERN_REGEXP.test(str);
65989
- }
65990
66170
  function ConsumeSharedPlugin_define_property(obj, key, value) {
65991
66171
  if (key in obj) Object.defineProperty(obj, key, {
65992
66172
  value: value,
@@ -66337,7 +66517,7 @@ function transformSync(source, options) {
66337
66517
  const _options = JSON.stringify(options || {});
66338
66518
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
66339
66519
  }
66340
- const exports_rspackVersion = "1.6.0";
66520
+ const exports_rspackVersion = "1.6.2";
66341
66521
  const exports_version = "5.75.0";
66342
66522
  const exports_WebpackError = Error;
66343
66523
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -66431,6 +66611,9 @@ const ERROR_PREFIX = "Invalid Rspack configuration:";
66431
66611
  const validateContext = ({ context })=>{
66432
66612
  if (context && !(0, path_browserify.isAbsolute)(context)) throw new Error(`${ERROR_PREFIX} "context" must be an absolute path, get "${context}".`);
66433
66613
  };
66614
+ const validateOutputPath = ({ output })=>{
66615
+ if (output?.path && !(0, path_browserify.isAbsolute)(output.path)) throw new Error(`${ERROR_PREFIX} "output.path" must be an absolute path, get "${output.path}".`);
66616
+ };
66434
66617
  const validateSplitChunks = ({ optimization })=>{
66435
66618
  if (optimization?.splitChunks) {
66436
66619
  const { minChunks } = optimization.splitChunks;
@@ -66460,6 +66643,7 @@ const validateExternalUmd = ({ output, externals, externalsType })=>{
66460
66643
  };
66461
66644
  function validateRspackConfig(config) {
66462
66645
  validateContext(config);
66646
+ validateOutputPath(config);
66463
66647
  validateSplitChunks(config);
66464
66648
  validateExternalUmd(config);
66465
66649
  }
@@ -66492,7 +66676,7 @@ function createCompiler(userOptions) {
66492
66676
  function isMultiRspackOptions(o) {
66493
66677
  return Array.isArray(o);
66494
66678
  }
66495
- function rspack_rspack(options, callback) {
66679
+ function rspack(options, callback) {
66496
66680
  try {
66497
66681
  if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
66498
66682
  else validateRspackConfig(options);
@@ -66542,11 +66726,11 @@ function rspack_rspack(options, callback) {
66542
66726
  return compiler;
66543
66727
  }
66544
66728
  }
66545
- const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
66729
+ const src_fn = Object.assign(rspack, exports_namespaceObject);
66546
66730
  src_fn.rspack = src_fn;
66547
66731
  src_fn.webpack = src_fn;
66548
- const src_rspack = src_fn;
66549
- const src_0 = src_rspack;
66732
+ const src_rspack_0 = src_fn;
66733
+ const src_0 = src_rspack_0;
66550
66734
  function BrowserHttpImportEsmPlugin_define_property(obj, key, value) {
66551
66735
  if (key in obj) Object.defineProperty(obj, key, {
66552
66736
  value: value,
@@ -66744,4 +66928,4 @@ var __webpack_exports__EntryDependency = external_rspack_wasi_browser_js_.EntryD
66744
66928
  var __webpack_exports__ExternalModule = external_rspack_wasi_browser_js_.ExternalModule;
66745
66929
  var __webpack_exports__Module = external_rspack_wasi_browser_js_.Module;
66746
66930
  var __webpack_exports__NormalModule = external_rspack_wasi_browser_js_.NormalModule;
66747
- export { BannerPlugin, BrowserHttpImportEsmPlugin, BrowserRequirePlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefinePlugin, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, lib_EntryOptionPlugin as EntryOptionPlugin, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, RuntimeGlobals, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, statsFactoryUtils_StatsErrorCode as StatsErrorCode, SwcJsMinimizerRspackPlugin, Template, ValidationError, WarnCaseSensitiveModulesPlugin, exports_WebpackError as WebpackError, RspackOptionsApply as WebpackOptionsApply, builtinMemFs, exports_config as config, container, electron, exports_experiments as experiments, javascript, exports_library as library, exports_node as node, optimize, src_rspack as rspack, exports_rspackVersion as rspackVersion, sharing, sources, exports_util as util, exports_version as version, exports_wasm as wasm, web, webworker, __webpack_exports__AsyncDependenciesBlock as AsyncDependenciesBlock, __webpack_exports__ConcatenatedModule as ConcatenatedModule, __webpack_exports__ContextModule as ContextModule, __webpack_exports__Dependency as Dependency, __webpack_exports__EntryDependency as EntryDependency, __webpack_exports__ExternalModule as ExternalModule, __webpack_exports__Module as Module, __webpack_exports__NormalModule as NormalModule };
66931
+ export { BannerPlugin, BrowserHttpImportEsmPlugin, BrowserRequirePlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefinePlugin, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, lib_EntryOptionPlugin as EntryOptionPlugin, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, RuntimeGlobals, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, statsFactoryUtils_StatsErrorCode as StatsErrorCode, SwcJsMinimizerRspackPlugin, Template, ValidationError, WarnCaseSensitiveModulesPlugin, exports_WebpackError as WebpackError, RspackOptionsApply as WebpackOptionsApply, builtinMemFs, exports_config as config, container, electron, exports_experiments as experiments, javascript, exports_library as library, exports_node as node, optimize, src_rspack_0 as rspack, exports_rspackVersion as rspackVersion, sharing, sources, exports_util as util, exports_version as version, exports_wasm as wasm, web, webworker, __webpack_exports__AsyncDependenciesBlock as AsyncDependenciesBlock, __webpack_exports__ConcatenatedModule as ConcatenatedModule, __webpack_exports__ContextModule as ContextModule, __webpack_exports__Dependency as Dependency, __webpack_exports__EntryDependency as EntryDependency, __webpack_exports__ExternalModule as ExternalModule, __webpack_exports__Module as Module, __webpack_exports__NormalModule as NormalModule };
@@ -545,6 +545,7 @@ export declare enum BuiltinPluginName {
545
545
  ProvideSharedPlugin = 'ProvideSharedPlugin',
546
546
  ConsumeSharedPlugin = 'ConsumeSharedPlugin',
547
547
  ModuleFederationRuntimePlugin = 'ModuleFederationRuntimePlugin',
548
+ ModuleFederationManifestPlugin = 'ModuleFederationManifestPlugin',
548
549
  NamedModuleIdsPlugin = 'NamedModuleIdsPlugin',
549
550
  NaturalModuleIdsPlugin = 'NaturalModuleIdsPlugin',
550
551
  DeterministicModuleIdsPlugin = 'DeterministicModuleIdsPlugin',
@@ -707,11 +708,11 @@ export interface JsBeforeEmitData {
707
708
  }
708
709
 
709
710
  export interface JsBuildMeta {
710
- strictEsmModule: boolean
711
- hasTopLevelAwait: boolean
712
- esm: boolean
713
- exportsType: 'unset' | 'default' | 'namespace' | 'flagged' | 'dynamic'
714
- defaultObject: 'false' | 'redirect' | JsBuildMetaDefaultObjectRedirectWarn
711
+ strictEsmModule?: boolean
712
+ hasTopLevelAwait?: boolean
713
+ esm?: boolean
714
+ exportsType?: undefined | 'unset' | 'default' | 'namespace' | 'flagged' | 'dynamic'
715
+ defaultObject?: undefined | 'false' | 'redirect' | JsBuildMetaDefaultObjectRedirectWarn
715
716
  sideEffectFree?: boolean
716
717
  exportsFinalName?: Array<[string, string]> | undefined
717
718
  }
@@ -2434,6 +2435,32 @@ export interface RawLimitChunkCountPluginOptions {
2434
2435
  maxChunks: number
2435
2436
  }
2436
2437
 
2438
+ export interface RawManifestExposeOption {
2439
+ path: string
2440
+ name: string
2441
+ }
2442
+
2443
+ export interface RawManifestSharedOption {
2444
+ name: string
2445
+ version?: string
2446
+ requiredVersion?: string
2447
+ singleton?: boolean
2448
+ }
2449
+
2450
+ export interface RawModuleFederationManifestPluginOptions {
2451
+ name?: string
2452
+ globalName?: string
2453
+ fileName?: string
2454
+ filePath?: string
2455
+ statsFileName?: string
2456
+ manifestFileName?: string
2457
+ disableAssetsAnalyze?: boolean
2458
+ remoteAliasMap?: Record<string, RawRemoteAliasTarget>
2459
+ exposes?: Array<RawManifestExposeOption>
2460
+ shared?: Array<RawManifestSharedOption>
2461
+ buildInfo?: RawStatsBuildInfo
2462
+ }
2463
+
2437
2464
  export interface RawModuleFederationRuntimePluginOptions {
2438
2465
  entryRuntime?: string | undefined
2439
2466
  }
@@ -2656,6 +2683,11 @@ export interface RawRelated {
2656
2683
  sourceMap?: string
2657
2684
  }
2658
2685
 
2686
+ export interface RawRemoteAliasTarget {
2687
+ name: string
2688
+ entry?: string
2689
+ }
2690
+
2659
2691
  export interface RawRemoteOptions {
2660
2692
  key: string
2661
2693
  external: Array<string>
@@ -2732,12 +2764,6 @@ export interface RawRslibPluginOptions {
2732
2764
  * @default `false`
2733
2765
  */
2734
2766
  interceptApiPlugin?: boolean
2735
- /**
2736
- * Use the compact runtime for dynamic import from `modern-module`, commonly used in CommonJS output.
2737
- * This field should not be set to `true` when using `modern-module` with ESM output, as it is already in use.
2738
- * @default `false`
2739
- */
2740
- compactExternalModuleDynamicImport?: boolean
2741
2767
  /**
2742
2768
  * Add shims for javascript/esm modules
2743
2769
  * @default `false`
@@ -2821,6 +2847,11 @@ export interface RawSplitChunksOptions {
2821
2847
  maxInitialSize?: number | RawSplitChunkSizes
2822
2848
  }
2823
2849
 
2850
+ export interface RawStatsBuildInfo {
2851
+ buildVersion: string
2852
+ buildName?: string
2853
+ }
2854
+
2824
2855
  export interface RawStatsOptions {
2825
2856
  colors: boolean
2826
2857
  }
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/browser",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "Rspack for running in the browser. This is still in early stage and may not follow the semver.",