@rspack/browser 1.7.7 → 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.
@@ -162,6 +162,7 @@ export declare class Compilation {
162
162
  Iterable<Chunk>,
163
163
  Iterable<Module>
164
164
  ], void>;
165
+ beforeModuleIds: liteTapable.SyncHook<[Iterable<Module>]>;
165
166
  finishModules: liteTapable.AsyncSeriesHook<[Iterable<Module>], void>;
166
167
  chunkHash: liteTapable.SyncHook<[Chunk, Hash]>;
167
168
  chunkAsset: liteTapable.SyncHook<[Chunk, string]>;
@@ -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
@@ -52665,6 +52665,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
52665
52665
  'chunks',
52666
52666
  'modules'
52667
52667
  ]),
52668
+ beforeModuleIds: new SyncHook([
52669
+ 'modules'
52670
+ ]),
52668
52671
  finishModules: new AsyncSeriesHook([
52669
52672
  'modules'
52670
52673
  ]),
@@ -56965,7 +56968,7 @@ class WorkerPlugin extends RspackBuiltinPlugin {
56965
56968
  return createBuiltinPlugin(this.name, void 0);
56966
56969
  }
56967
56970
  constructor(chunkLoading, wasmLoading, module, workerPublicPath){
56968
- 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';
56969
56972
  }
56970
56973
  }
56971
56974
  function ContextModuleFactory_define_property(obj, key, value) {
@@ -58150,7 +58153,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58150
58153
  if ('object' == typeof rspackFuture) {
58151
58154
  D(rspackFuture, 'bundlerInfo', {});
58152
58155
  if ('object' == typeof rspackFuture.bundlerInfo) {
58153
- D(rspackFuture.bundlerInfo, 'version', "1.7.7");
58156
+ D(rspackFuture.bundlerInfo, 'version', "1.7.9");
58154
58157
  D(rspackFuture.bundlerInfo, 'bundler', 'rspack');
58155
58158
  D(rspackFuture.bundlerInfo, 'force', !library);
58156
58159
  }
@@ -60420,7 +60423,7 @@ class MultiStats {
60420
60423
  return obj;
60421
60424
  });
60422
60425
  if (childOptions.version) {
60423
- obj.rspackVersion = "1.7.7";
60426
+ obj.rspackVersion = "1.7.9";
60424
60427
  obj.version = "5.75.0";
60425
60428
  }
60426
60429
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
@@ -62260,7 +62263,7 @@ const SIMPLE_EXTRACTORS = {
62260
62263
  },
62261
62264
  version: (object)=>{
62262
62265
  object.version = "5.75.0";
62263
- object.rspackVersion = "1.7.7";
62266
+ object.rspackVersion = "1.7.9";
62264
62267
  },
62265
62268
  env: (object, _compilation, _context, { _env })=>{
62266
62269
  object.env = _env;
@@ -64399,6 +64402,38 @@ const createCompilationHooksRegisters = (getCompiler, createTap, createMapTap)=>
64399
64402
  return queried.promise(getCompiler().__internal__get_compilation().chunks, getCompiler().__internal__get_compilation().modules);
64400
64403
  };
64401
64404
  }),
64405
+ registerCompilationBeforeModuleIdsTaps: createTap(external_rspack_wasi_browser_js_["default"].RegisterJsTapKind.CompilationBeforeModuleIds, function() {
64406
+ return getCompiler().__internal__get_compilation().hooks.beforeModuleIds;
64407
+ }, function(queried) {
64408
+ return function(arg) {
64409
+ const compilation = getCompiler().__internal__get_compilation();
64410
+ const assignments = new Map();
64411
+ const modulesByIdentifier = new Map();
64412
+ for (const module of compilation.modules)modulesByIdentifier.set(module.identifier(), module);
64413
+ const proxiedModules = arg.modules.map((m)=>{
64414
+ const realModule = modulesByIdentifier.get(m.identifier);
64415
+ return new Proxy(realModule, {
64416
+ get (target, prop) {
64417
+ if ('id' === prop) return assignments.get(m.identifier) ?? null;
64418
+ if ('identifier' === prop) return m.identifier;
64419
+ const value = Reflect.get(target, prop);
64420
+ return 'function' == typeof value ? value.bind(target) : value;
64421
+ },
64422
+ set (_target, prop, value) {
64423
+ if ('id' === prop && ('string' == typeof value || 'number' == typeof value)) {
64424
+ assignments.set(m.identifier, value);
64425
+ return true;
64426
+ }
64427
+ return false;
64428
+ }
64429
+ });
64430
+ });
64431
+ queried.call(proxiedModules);
64432
+ return {
64433
+ assignments: Object.fromEntries(assignments.entries())
64434
+ };
64435
+ };
64436
+ }),
64402
64437
  registerCompilationChunkHashTaps: createTap(external_rspack_wasi_browser_js_["default"].RegisterJsTapKind.CompilationChunkHash, function() {
64403
64438
  return getCompiler().__internal__get_compilation().hooks.chunkHash;
64404
64439
  }, function(queried) {
@@ -66715,6 +66750,9 @@ function SharePlugin_define_property(obj, key, value) {
66715
66750
  else obj[key] = value;
66716
66751
  return obj;
66717
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
+ }
66718
66756
  class SharePlugin {
66719
66757
  apply(compiler) {
66720
66758
  new ConsumeSharedPlugin({
@@ -66803,9 +66841,12 @@ class ContainerPlugin extends RspackBuiltinPlugin {
66803
66841
  }
66804
66842
  constructor(options){
66805
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');
66806
66847
  this._options = {
66807
66848
  name: options.name,
66808
- shareScope: options.shareScope || 'default',
66849
+ shareScope,
66809
66850
  library: options.library || {
66810
66851
  type: 'var',
66811
66852
  name: options.name
@@ -66823,7 +66864,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
66823
66864
  ],
66824
66865
  name: item.name || void 0
66825
66866
  })),
66826
- enhanced: options.enhanced ?? false
66867
+ enhanced
66827
66868
  };
66828
66869
  }
66829
66870
  }
@@ -66867,20 +66908,24 @@ class ContainerReferencePlugin extends RspackBuiltinPlugin {
66867
66908
  }
66868
66909
  constructor(options){
66869
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');
66870
66925
  this._options = {
66871
66926
  remoteType: options.remoteType,
66872
- remotes: parseOptions(options.remotes, (item)=>({
66873
- external: Array.isArray(item) ? item : [
66874
- item
66875
- ],
66876
- shareScope: options.shareScope || 'default'
66877
- }), (item)=>({
66878
- external: Array.isArray(item.external) ? item.external : [
66879
- item.external
66880
- ],
66881
- shareScope: item.shareScope || options.shareScope || 'default'
66882
- })),
66883
- enhanced: options.enhanced ?? false
66927
+ remotes,
66928
+ enhanced
66884
66929
  };
66885
66930
  }
66886
66931
  }
@@ -66949,7 +66994,7 @@ function transformSync(source, options) {
66949
66994
  const _options = JSON.stringify(options || {});
66950
66995
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
66951
66996
  }
66952
- const exports_rspackVersion = "1.7.7";
66997
+ const exports_rspackVersion = "1.7.9";
66953
66998
  const exports_version = "5.75.0";
66954
66999
  const exports_WebpackError = Error;
66955
67000
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -707,6 +707,14 @@ export interface JsBeforeEmitData {
707
707
  uid?: number
708
708
  }
709
709
 
710
+ export interface JsBeforeModuleIdsArg {
711
+ modules: Array<JsModuleForIds>
712
+ }
713
+
714
+ export interface JsBeforeModuleIdsResult {
715
+ assignments: Record<string, string | number>
716
+ }
717
+
710
718
  export interface JsBuildMeta {
711
719
  strictEsmModule?: boolean
712
720
  hasTopLevelAwait?: boolean
@@ -970,6 +978,10 @@ export interface JsModuleDescriptor {
970
978
  id?: string | number | null
971
979
  }
972
980
 
981
+ export interface JsModuleForIds {
982
+ identifier: string
983
+ }
984
+
973
985
  export interface JsNormalModuleFactoryCreateModuleArgs {
974
986
  dependencyType: string
975
987
  rawRequest: string
@@ -1093,6 +1105,11 @@ export interface JsRsdoctorExportInfo {
1093
1105
  sideEffects: Array<number>
1094
1106
  }
1095
1107
 
1108
+ export interface JsRsdoctorJsonModuleSize {
1109
+ identifier: string
1110
+ size: number
1111
+ }
1112
+
1096
1113
  export interface JsRsdoctorModule {
1097
1114
  ukey: number
1098
1115
  identifier: string
@@ -1141,6 +1158,7 @@ export interface JsRsdoctorModuleOriginalSource {
1141
1158
 
1142
1159
  export interface JsRsdoctorModuleSourcesPatch {
1143
1160
  moduleOriginalSources: Array<JsRsdoctorModuleOriginalSource>
1161
+ jsonModuleSizes: Array<JsRsdoctorJsonModuleSize>
1144
1162
  }
1145
1163
 
1146
1164
  export interface JsRsdoctorSideEffect {
@@ -1853,7 +1871,7 @@ export interface RawConsumeOptions {
1853
1871
  import?: string
1854
1872
  importResolved?: string
1855
1873
  shareKey: string
1856
- shareScope: string
1874
+ shareScope: string | Array<string>
1857
1875
  requiredVersion?: string | false | undefined
1858
1876
  packageName?: string
1859
1877
  strictVersion: boolean
@@ -1868,7 +1886,7 @@ export interface RawConsumeSharedPluginOptions {
1868
1886
 
1869
1887
  export interface RawContainerPluginOptions {
1870
1888
  name: string
1871
- shareScope: string
1889
+ shareScope: string | Array<string>
1872
1890
  library: JsLibraryOptions
1873
1891
  runtime?: false | string
1874
1892
  filename?: string
@@ -1879,7 +1897,7 @@ export interface RawContainerPluginOptions {
1879
1897
  export interface RawContainerReferencePluginOptions {
1880
1898
  remoteType: string
1881
1899
  remotes: Array<RawRemoteOptions>
1882
- shareScope?: string
1900
+ shareScope?: string | Array<string> | undefined | null
1883
1901
  enhanced: boolean
1884
1902
  }
1885
1903
 
@@ -2693,7 +2711,7 @@ export interface RawProgressPluginOptions {
2693
2711
  export interface RawProvideOptions {
2694
2712
  key: string
2695
2713
  shareKey: string
2696
- shareScope: string
2714
+ shareScope: string | Array<string>
2697
2715
  version?: string | false | undefined
2698
2716
  eager: boolean
2699
2717
  singleton?: boolean
@@ -2713,7 +2731,7 @@ export interface RawRemoteAliasTarget {
2713
2731
  export interface RawRemoteOptions {
2714
2732
  key: string
2715
2733
  external: Array<string>
2716
- shareScope: string
2734
+ shareScope: string | Array<string>
2717
2735
  }
2718
2736
 
2719
2737
  export interface RawResolveOptions {
@@ -2962,39 +2980,40 @@ export declare enum RegisterJsTapKind {
2962
2980
  CompilationAfterOptimizeModules = 14,
2963
2981
  CompilationOptimizeTree = 15,
2964
2982
  CompilationOptimizeChunkModules = 16,
2965
- CompilationAdditionalTreeRuntimeRequirements = 17,
2966
- CompilationRuntimeRequirementInTree = 18,
2967
- CompilationRuntimeModule = 19,
2968
- CompilationChunkHash = 20,
2969
- CompilationChunkAsset = 21,
2970
- CompilationProcessAssets = 22,
2971
- CompilationAfterProcessAssets = 23,
2972
- CompilationSeal = 24,
2973
- CompilationAfterSeal = 25,
2974
- NormalModuleFactoryBeforeResolve = 26,
2975
- NormalModuleFactoryFactorize = 27,
2976
- NormalModuleFactoryResolve = 28,
2977
- NormalModuleFactoryAfterResolve = 29,
2978
- NormalModuleFactoryCreateModule = 30,
2979
- NormalModuleFactoryResolveForScheme = 31,
2980
- ContextModuleFactoryBeforeResolve = 32,
2981
- ContextModuleFactoryAfterResolve = 33,
2982
- JavascriptModulesChunkHash = 34,
2983
- HtmlPluginBeforeAssetTagGeneration = 35,
2984
- HtmlPluginAlterAssetTags = 36,
2985
- HtmlPluginAlterAssetTagGroups = 37,
2986
- HtmlPluginAfterTemplateExecution = 38,
2987
- HtmlPluginBeforeEmit = 39,
2988
- HtmlPluginAfterEmit = 40,
2989
- RuntimePluginCreateScript = 41,
2990
- RuntimePluginCreateLink = 42,
2991
- RuntimePluginLinkPreload = 43,
2992
- RuntimePluginLinkPrefetch = 44,
2993
- RsdoctorPluginModuleGraph = 45,
2994
- RsdoctorPluginChunkGraph = 46,
2995
- RsdoctorPluginModuleIds = 47,
2996
- RsdoctorPluginModuleSources = 48,
2997
- RsdoctorPluginAssets = 49
2983
+ CompilationBeforeModuleIds = 17,
2984
+ CompilationAdditionalTreeRuntimeRequirements = 18,
2985
+ CompilationRuntimeRequirementInTree = 19,
2986
+ CompilationRuntimeModule = 20,
2987
+ CompilationChunkHash = 21,
2988
+ CompilationChunkAsset = 22,
2989
+ CompilationProcessAssets = 23,
2990
+ CompilationAfterProcessAssets = 24,
2991
+ CompilationSeal = 25,
2992
+ CompilationAfterSeal = 26,
2993
+ NormalModuleFactoryBeforeResolve = 27,
2994
+ NormalModuleFactoryFactorize = 28,
2995
+ NormalModuleFactoryResolve = 29,
2996
+ NormalModuleFactoryAfterResolve = 30,
2997
+ NormalModuleFactoryCreateModule = 31,
2998
+ NormalModuleFactoryResolveForScheme = 32,
2999
+ ContextModuleFactoryBeforeResolve = 33,
3000
+ ContextModuleFactoryAfterResolve = 34,
3001
+ JavascriptModulesChunkHash = 35,
3002
+ HtmlPluginBeforeAssetTagGeneration = 36,
3003
+ HtmlPluginAlterAssetTags = 37,
3004
+ HtmlPluginAlterAssetTagGroups = 38,
3005
+ HtmlPluginAfterTemplateExecution = 39,
3006
+ HtmlPluginBeforeEmit = 40,
3007
+ HtmlPluginAfterEmit = 41,
3008
+ RuntimePluginCreateScript = 42,
3009
+ RuntimePluginCreateLink = 43,
3010
+ RuntimePluginLinkPreload = 44,
3011
+ RuntimePluginLinkPrefetch = 45,
3012
+ RsdoctorPluginModuleGraph = 46,
3013
+ RsdoctorPluginChunkGraph = 47,
3014
+ RsdoctorPluginModuleIds = 48,
3015
+ RsdoctorPluginModuleSources = 49,
3016
+ RsdoctorPluginAssets = 50
2998
3017
  }
2999
3018
 
3000
3019
  export interface RegisterJsTaps {
@@ -3018,6 +3037,7 @@ export interface RegisterJsTaps {
3018
3037
  registerCompilationAfterOptimizeModulesTaps: (stages: Array<number>) => Array<{ function: (() => void); stage: number; }>
3019
3038
  registerCompilationOptimizeTreeTaps: (stages: Array<number>) => Array<{ function: (() => Promise<void>); stage: number; }>
3020
3039
  registerCompilationOptimizeChunkModulesTaps: (stages: Array<number>) => Array<{ function: (() => Promise<boolean | undefined>); stage: number; }>
3040
+ registerCompilationBeforeModuleIdsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsBeforeModuleIdsArg) => JsBeforeModuleIdsResult); stage: number; }>
3021
3041
  registerCompilationChunkHashTaps: (stages: Array<number>) => Array<{ function: ((arg: Chunk) => Buffer); stage: number; }>
3022
3042
  registerCompilationChunkAssetTaps: (stages: Array<number>) => Array<{ function: ((arg: JsChunkAssetArgs) => void); stage: number; }>
3023
3043
  registerCompilationProcessAssetsTaps: (stages: Array<number>) => Array<{ function: ((arg: JsCompilation) => Promise<void>); stage: number; }>
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.7",
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.",