@rspack/browser 1.7.8 → 1.7.9

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.
@@ -8,6 +8,7 @@ export declare class WorkerPlugin extends RspackBuiltinPlugin {
8
8
  private module;
9
9
  private workerPublicPath;
10
10
  name: BuiltinPluginName;
11
+ affectedHooks: "compilation";
11
12
  constructor(chunkLoading: ChunkLoading, wasmLoading: WasmLoading, module: OutputModule, workerPublicPath: WorkerPublicPath);
12
13
  raw(compiler: Compiler): BuiltinPlugin;
13
14
  }
@@ -2,13 +2,14 @@ import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base';
3
3
  import type { Compiler } from '../Compiler';
4
4
  import type { EntryRuntime, FilenameTemplate, LibraryOptions } from '../config';
5
+ import { type ShareScope } from '../sharing/SharePlugin';
5
6
  export type ContainerPluginOptions = {
6
7
  exposes: Exposes;
7
8
  filename?: FilenameTemplate;
8
9
  library?: LibraryOptions;
9
10
  name: string;
10
11
  runtime?: EntryRuntime;
11
- shareScope?: string;
12
+ shareScope?: ShareScope;
12
13
  enhanced?: boolean;
13
14
  };
14
15
  export type Exposes = (ExposesItem | ExposesObject)[] | ExposesObject;
@@ -25,7 +26,7 @@ export declare class ContainerPlugin extends RspackBuiltinPlugin {
25
26
  name: BuiltinPluginName;
26
27
  _options: {
27
28
  name: string;
28
- shareScope: string;
29
+ shareScope: ShareScope;
29
30
  library: LibraryOptions;
30
31
  runtime: EntryRuntime | undefined;
31
32
  filename: string | undefined;
@@ -2,10 +2,11 @@ import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base';
3
3
  import type { Compiler } from '../Compiler';
4
4
  import type { ExternalsType } from '../config';
5
+ import { type ShareScope } from '../sharing/SharePlugin';
5
6
  export type ContainerReferencePluginOptions = {
6
7
  remoteType: ExternalsType;
7
8
  remotes: Remotes;
8
- shareScope?: string;
9
+ shareScope?: ShareScope;
9
10
  enhanced?: boolean;
10
11
  };
11
12
  export type Remotes = (RemotesItem | RemotesObject)[] | RemotesObject;
@@ -16,7 +17,7 @@ export type RemotesObject = {
16
17
  };
17
18
  export type RemotesConfig = {
18
19
  external: RemotesItem | RemotesItems;
19
- shareScope?: string;
20
+ shareScope?: ShareScope;
20
21
  };
21
22
  export declare class ContainerReferencePlugin extends RspackBuiltinPlugin {
22
23
  name: BuiltinPluginName;
@@ -24,7 +25,7 @@ export declare class ContainerReferencePlugin extends RspackBuiltinPlugin {
24
25
  remoteType: ExternalsType;
25
26
  remotes: [string, {
26
27
  external: string[];
27
- shareScope: string;
28
+ shareScope: ShareScope;
28
29
  }][];
29
30
  enhanced: boolean;
30
31
  };
@@ -1,6 +1,6 @@
1
1
  import type { Compiler } from '../Compiler';
2
2
  import type { EntryRuntime, ExternalsType, LibraryOptions } from '../config';
3
- import { type Shared } from '../sharing/SharePlugin';
3
+ import { type Shared, type ShareScope } from '../sharing/SharePlugin';
4
4
  import { type Exposes } from './ContainerPlugin';
5
5
  import { type Remotes } from './ContainerReferencePlugin';
6
6
  export interface ModuleFederationPluginV1Options {
@@ -11,7 +11,7 @@ export interface ModuleFederationPluginV1Options {
11
11
  remoteType?: ExternalsType;
12
12
  remotes?: Remotes;
13
13
  runtime?: EntryRuntime;
14
- shareScope?: string;
14
+ shareScope?: ShareScope;
15
15
  shared?: Shared;
16
16
  enhanced?: boolean;
17
17
  }
package/dist/index.mjs CHANGED
@@ -56968,7 +56968,7 @@ class WorkerPlugin extends RspackBuiltinPlugin {
56968
56968
  return createBuiltinPlugin(this.name, void 0);
56969
56969
  }
56970
56970
  constructor(chunkLoading, wasmLoading, module, workerPublicPath){
56971
- super(), WorkerPlugin_define_property(this, "chunkLoading", void 0), WorkerPlugin_define_property(this, "wasmLoading", void 0), WorkerPlugin_define_property(this, "module", void 0), WorkerPlugin_define_property(this, "workerPublicPath", void 0), WorkerPlugin_define_property(this, "name", void 0), this.chunkLoading = chunkLoading, this.wasmLoading = wasmLoading, this.module = module, this.workerPublicPath = workerPublicPath, this.name = external_rspack_wasi_browser_js_.BuiltinPluginName.WorkerPlugin;
56971
+ super(), WorkerPlugin_define_property(this, "chunkLoading", void 0), WorkerPlugin_define_property(this, "wasmLoading", void 0), WorkerPlugin_define_property(this, "module", void 0), WorkerPlugin_define_property(this, "workerPublicPath", void 0), WorkerPlugin_define_property(this, "name", void 0), WorkerPlugin_define_property(this, "affectedHooks", void 0), this.chunkLoading = chunkLoading, this.wasmLoading = wasmLoading, this.module = module, this.workerPublicPath = workerPublicPath, this.name = external_rspack_wasi_browser_js_.BuiltinPluginName.WorkerPlugin, this.affectedHooks = 'compilation';
56972
56972
  }
56973
56973
  }
56974
56974
  function ContextModuleFactory_define_property(obj, key, value) {
@@ -58153,7 +58153,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58153
58153
  if ('object' == typeof rspackFuture) {
58154
58154
  D(rspackFuture, 'bundlerInfo', {});
58155
58155
  if ('object' == typeof rspackFuture.bundlerInfo) {
58156
- D(rspackFuture.bundlerInfo, 'version', "1.7.8");
58156
+ D(rspackFuture.bundlerInfo, 'version', "1.7.9");
58157
58157
  D(rspackFuture.bundlerInfo, 'bundler', 'rspack');
58158
58158
  D(rspackFuture.bundlerInfo, 'force', !library);
58159
58159
  }
@@ -60423,7 +60423,7 @@ class MultiStats {
60423
60423
  return obj;
60424
60424
  });
60425
60425
  if (childOptions.version) {
60426
- obj.rspackVersion = "1.7.8";
60426
+ obj.rspackVersion = "1.7.9";
60427
60427
  obj.version = "5.75.0";
60428
60428
  }
60429
60429
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
@@ -62263,7 +62263,7 @@ const SIMPLE_EXTRACTORS = {
62263
62263
  },
62264
62264
  version: (object)=>{
62265
62265
  object.version = "5.75.0";
62266
- object.rspackVersion = "1.7.8";
62266
+ object.rspackVersion = "1.7.9";
62267
62267
  },
62268
62268
  env: (object, _compilation, _context, { _env })=>{
62269
62269
  object.env = _env;
@@ -66750,6 +66750,9 @@ function SharePlugin_define_property(obj, key, value) {
66750
66750
  else obj[key] = value;
66751
66751
  return obj;
66752
66752
  }
66753
+ function validateShareScope(shareScope, enhanced, pluginName) {
66754
+ if (Array.isArray(shareScope) && shareScope.length > 1 && !enhanced) throw new Error(`[${pluginName}] shareScope as an array with multiple entries requires enhanced=true, got: ${JSON.stringify(shareScope)}`);
66755
+ }
66753
66756
  class SharePlugin {
66754
66757
  apply(compiler) {
66755
66758
  new ConsumeSharedPlugin({
@@ -66838,9 +66841,12 @@ class ContainerPlugin extends RspackBuiltinPlugin {
66838
66841
  }
66839
66842
  constructor(options){
66840
66843
  super(), ContainerPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ContainerPlugin), ContainerPlugin_define_property(this, "_options", void 0);
66844
+ const shareScope = options.shareScope || 'default';
66845
+ const enhanced = options.enhanced ?? false;
66846
+ validateShareScope(shareScope, enhanced, 'ContainerPlugin');
66841
66847
  this._options = {
66842
66848
  name: options.name,
66843
- shareScope: options.shareScope || 'default',
66849
+ shareScope,
66844
66850
  library: options.library || {
66845
66851
  type: 'var',
66846
66852
  name: options.name
@@ -66858,7 +66864,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
66858
66864
  ],
66859
66865
  name: item.name || void 0
66860
66866
  })),
66861
- enhanced: options.enhanced ?? false
66867
+ enhanced
66862
66868
  };
66863
66869
  }
66864
66870
  }
@@ -66902,20 +66908,24 @@ class ContainerReferencePlugin extends RspackBuiltinPlugin {
66902
66908
  }
66903
66909
  constructor(options){
66904
66910
  super(), ContainerReferencePlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ContainerReferencePlugin), ContainerReferencePlugin_define_property(this, "_options", void 0);
66911
+ const enhanced = options.enhanced ?? false;
66912
+ if (options.shareScope) validateShareScope(options.shareScope, enhanced, 'ContainerReferencePlugin');
66913
+ const remotes = parseOptions(options.remotes, (item)=>({
66914
+ external: Array.isArray(item) ? item : [
66915
+ item
66916
+ ],
66917
+ shareScope: options.shareScope || 'default'
66918
+ }), (item)=>({
66919
+ external: Array.isArray(item.external) ? item.external : [
66920
+ item.external
66921
+ ],
66922
+ shareScope: item.shareScope || options.shareScope || 'default'
66923
+ }));
66924
+ for (const [, config] of remotes)validateShareScope(config.shareScope, enhanced, 'ContainerReferencePlugin');
66905
66925
  this._options = {
66906
66926
  remoteType: options.remoteType,
66907
- remotes: parseOptions(options.remotes, (item)=>({
66908
- external: Array.isArray(item) ? item : [
66909
- item
66910
- ],
66911
- shareScope: options.shareScope || 'default'
66912
- }), (item)=>({
66913
- external: Array.isArray(item.external) ? item.external : [
66914
- item.external
66915
- ],
66916
- shareScope: item.shareScope || options.shareScope || 'default'
66917
- })),
66918
- enhanced: options.enhanced ?? false
66927
+ remotes,
66928
+ enhanced
66919
66929
  };
66920
66930
  }
66921
66931
  }
@@ -66984,7 +66994,7 @@ function transformSync(source, options) {
66984
66994
  const _options = JSON.stringify(options || {});
66985
66995
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
66986
66996
  }
66987
- const exports_rspackVersion = "1.7.8";
66997
+ const exports_rspackVersion = "1.7.9";
66988
66998
  const exports_version = "5.75.0";
66989
66999
  const exports_WebpackError = Error;
66990
67000
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -1871,7 +1871,7 @@ export interface RawConsumeOptions {
1871
1871
  import?: string
1872
1872
  importResolved?: string
1873
1873
  shareKey: string
1874
- shareScope: string
1874
+ shareScope: string | Array<string>
1875
1875
  requiredVersion?: string | false | undefined
1876
1876
  packageName?: string
1877
1877
  strictVersion: boolean
@@ -1886,7 +1886,7 @@ export interface RawConsumeSharedPluginOptions {
1886
1886
 
1887
1887
  export interface RawContainerPluginOptions {
1888
1888
  name: string
1889
- shareScope: string
1889
+ shareScope: string | Array<string>
1890
1890
  library: JsLibraryOptions
1891
1891
  runtime?: false | string
1892
1892
  filename?: string
@@ -1897,7 +1897,7 @@ export interface RawContainerPluginOptions {
1897
1897
  export interface RawContainerReferencePluginOptions {
1898
1898
  remoteType: string
1899
1899
  remotes: Array<RawRemoteOptions>
1900
- shareScope?: string
1900
+ shareScope?: string | Array<string> | undefined | null
1901
1901
  enhanced: boolean
1902
1902
  }
1903
1903
 
@@ -2711,7 +2711,7 @@ export interface RawProgressPluginOptions {
2711
2711
  export interface RawProvideOptions {
2712
2712
  key: string
2713
2713
  shareKey: string
2714
- shareScope: string
2714
+ shareScope: string | Array<string>
2715
2715
  version?: string | false | undefined
2716
2716
  eager: boolean
2717
2717
  singleton?: boolean
@@ -2731,7 +2731,7 @@ export interface RawRemoteAliasTarget {
2731
2731
  export interface RawRemoteOptions {
2732
2732
  key: string
2733
2733
  external: Array<string>
2734
- shareScope: string
2734
+ shareScope: string | Array<string>
2735
2735
  }
2736
2736
 
2737
2737
  export interface RawResolveOptions {
Binary file
@@ -1,9 +1,10 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base';
3
3
  import type { Compiler } from '../Compiler';
4
+ import type { ShareScope } from './SharePlugin';
4
5
  export type ConsumeSharedPluginOptions = {
5
6
  consumes: Consumes;
6
- shareScope?: string;
7
+ shareScope?: ShareScope;
7
8
  enhanced?: boolean;
8
9
  };
9
10
  export type Consumes = (ConsumesItem | ConsumesObject)[] | ConsumesObject;
@@ -17,7 +18,7 @@ export type ConsumesConfig = {
17
18
  packageName?: string;
18
19
  requiredVersion?: false | string;
19
20
  shareKey?: string;
20
- shareScope?: string;
21
+ shareScope?: ShareScope;
21
22
  singleton?: boolean;
22
23
  strictVersion?: boolean;
23
24
  };
@@ -26,7 +27,7 @@ export declare class ConsumeSharedPlugin extends RspackBuiltinPlugin {
26
27
  _options: {
27
28
  consumes: [string, {
28
29
  import: string | undefined;
29
- shareScope: string;
30
+ shareScope: ShareScope;
30
31
  shareKey: string;
31
32
  requiredVersion: string | false | undefined;
32
33
  strictVersion: boolean;
@@ -1,9 +1,10 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName, type RawProvideOptions } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base';
3
3
  import type { Compiler } from '../Compiler';
4
+ import type { ShareScope } from './SharePlugin';
4
5
  export type ProvideSharedPluginOptions<Enhanced extends boolean = false> = {
5
6
  provides: Provides<Enhanced>;
6
- shareScope?: string;
7
+ shareScope?: ShareScope;
7
8
  enhanced?: Enhanced;
8
9
  };
9
10
  export type Provides<Enhanced extends boolean> = (ProvidesItem | ProvidesObject<Enhanced>)[] | ProvidesObject<Enhanced>;
@@ -15,7 +16,7 @@ export type ProvidesConfig<Enhanced extends boolean> = Enhanced extends true ? P
15
16
  type ProvidesV1Config = {
16
17
  eager?: boolean;
17
18
  shareKey: string;
18
- shareScope?: string;
19
+ shareScope?: ShareScope;
19
20
  version?: false | string;
20
21
  };
21
22
  type ProvidesEnhancedConfig = ProvidesV1Config & ProvidesEnhancedExtraConfig;
@@ -1,6 +1,8 @@
1
1
  import type { Compiler } from '../Compiler';
2
+ export type ShareScope = string | string[];
3
+ export declare function validateShareScope(shareScope: ShareScope, enhanced: boolean, pluginName: string): void;
2
4
  export type SharePluginOptions = {
3
- shareScope?: string;
5
+ shareScope?: ShareScope;
4
6
  shared: Shared;
5
7
  enhanced: boolean;
6
8
  };
@@ -15,18 +17,18 @@ export type SharedConfig = {
15
17
  packageName?: string;
16
18
  requiredVersion?: false | string;
17
19
  shareKey?: string;
18
- shareScope?: string;
20
+ shareScope?: ShareScope;
19
21
  singleton?: boolean;
20
22
  strictVersion?: boolean;
21
23
  version?: false | string;
22
24
  };
23
25
  export declare class SharePlugin {
24
- _shareScope: string | undefined;
26
+ _shareScope?: ShareScope;
25
27
  _consumes: {
26
28
  [x: string]: {
27
29
  import: string | false | undefined;
28
30
  shareKey: string;
29
- shareScope: string | undefined;
31
+ shareScope: ShareScope | undefined;
30
32
  requiredVersion: string | false | undefined;
31
33
  strictVersion: boolean | undefined;
32
34
  singleton: boolean | undefined;
@@ -37,7 +39,7 @@ export declare class SharePlugin {
37
39
  _provides: {
38
40
  [x: string]: {
39
41
  shareKey: string;
40
- shareScope: string | undefined;
42
+ shareScope: ShareScope | undefined;
41
43
  version: string | false | undefined;
42
44
  eager: boolean | undefined;
43
45
  singleton: boolean | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/browser",
3
- "version": "1.7.8",
3
+ "version": "1.7.9",
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.",