@rspack/core 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.js CHANGED
@@ -4937,6 +4937,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4937
4937
  module;
4938
4938
  workerPublicPath;
4939
4939
  name = binding_.BuiltinPluginName.WorkerPlugin;
4940
+ affectedHooks = 'compilation';
4940
4941
  constructor(chunkLoading, wasmLoading, module1, workerPublicPath){
4941
4942
  super(), this.chunkLoading = chunkLoading, this.wasmLoading = wasmLoading, this.module = module1, this.workerPublicPath = workerPublicPath;
4942
4943
  }
@@ -5907,7 +5908,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
5907
5908
  }, applyExperimentsDefaults = (experiments, { development })=>{
5908
5909
  F(experiments, 'cache', ()=>development), D(experiments, 'futureDefaults', !1), D(experiments, 'lazyCompilation', !1), D(experiments, 'asyncWebAssembly', experiments.futureDefaults), D(experiments, 'css', !!experiments.futureDefaults || void 0), D(experiments, 'topLevelAwait', !0), D(experiments, 'deferImport', !1), D(experiments, 'buildHttp', void 0), experiments.buildHttp && 'object' == typeof experiments.buildHttp && D(experiments.buildHttp, 'upgrade', !1), D(experiments, 'incremental', {}), 'object' == typeof experiments.incremental && (D(experiments.incremental, 'silent', !0), D(experiments.incremental, 'make', !0), D(experiments.incremental, 'inferAsyncModules', !0), D(experiments.incremental, 'providedExports', !0), D(experiments.incremental, 'dependenciesDiagnostics', !0), D(experiments.incremental, 'sideEffects', !0), D(experiments.incremental, 'buildChunkGraph', !1), D(experiments.incremental, 'moduleIds', !0), D(experiments.incremental, 'chunkIds', !0), D(experiments.incremental, 'modulesHashes', !0), D(experiments.incremental, 'modulesCodegen', !0), D(experiments.incremental, 'modulesRuntimeRequirements', !0), D(experiments.incremental, 'chunksRuntimeRequirements', !0), D(experiments.incremental, 'chunksHashes', !0), D(experiments.incremental, 'chunksRender', !0), D(experiments.incremental, 'emitAssets', !0)), D(experiments, 'rspackFuture', {}), D(experiments, 'parallelLoader', !1), D(experiments, 'useInputFileSystem', !1), D(experiments, 'inlineConst', !0), D(experiments, 'inlineEnum', !1), D(experiments, 'typeReexportsPresence', !1), D(experiments, 'lazyBarrel', !0);
5909
5910
  }, applybundlerInfoDefaults = (rspackFuture, library)=>{
5910
- 'object' == typeof rspackFuture && (D(rspackFuture, 'bundlerInfo', {}), 'object' == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, 'version', "1.7.8"), D(rspackFuture.bundlerInfo, 'bundler', 'rspack'), D(rspackFuture.bundlerInfo, 'force', !library)));
5911
+ 'object' == typeof rspackFuture && (D(rspackFuture, 'bundlerInfo', {}), 'object' == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, 'version', "1.7.9"), D(rspackFuture.bundlerInfo, 'bundler', 'rspack'), D(rspackFuture.bundlerInfo, 'force', !library)));
5911
5912
  }, applySnapshotDefaults = (_snapshot, _env)=>{}, applyCssGeneratorOptionsDefaults = (generatorOptions, { targetProperties })=>{
5912
5913
  D(generatorOptions, 'exportsOnly', !targetProperties || !1 === targetProperties.document), D(generatorOptions, 'esModule', !0);
5913
5914
  }, applyModuleDefaults = (module1, { cache, asyncWebAssembly, css, targetProperties, mode, uniqueName, deferImport })=>{
@@ -7475,7 +7476,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7475
7476
  obj.children = this.stats.map((stat, idx)=>{
7476
7477
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
7477
7478
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
7478
- }), childOptions.version && (obj.rspackVersion = "1.7.8", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
7479
+ }), childOptions.version && (obj.rspackVersion = "1.7.9", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
7479
7480
  let mapError = (j, obj)=>({
7480
7481
  ...obj,
7481
7482
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -8737,7 +8738,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
8737
8738
  object.hash = context.getStatsCompilation(compilation).hash;
8738
8739
  },
8739
8740
  version: (object)=>{
8740
- object.version = "5.75.0", object.rspackVersion = "1.7.8";
8741
+ object.version = "5.75.0", object.rspackVersion = "1.7.9";
8741
8742
  },
8742
8743
  env: (object, _compilation, _context, { _env })=>{
8743
8744
  object.env = _env;
@@ -10462,7 +10463,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
10462
10463
  });
10463
10464
  }
10464
10465
  }
10465
- let CORE_VERSION = "1.7.8", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
10466
+ let CORE_VERSION = "1.7.9", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
10466
10467
 
10467
10468
  Help:
10468
10469
  Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
@@ -12135,6 +12136,9 @@ Help:
12135
12136
  return createBuiltinPlugin(this.name, rawOptions);
12136
12137
  }
12137
12138
  }
12139
+ function validateShareScope(shareScope, enhanced, pluginName) {
12140
+ if (Array.isArray(shareScope) && shareScope.length > 1 && !enhanced) throw Error(`[${pluginName}] shareScope as an array with multiple entries requires enhanced=true, got: ${JSON.stringify(shareScope)}`);
12141
+ }
12138
12142
  class SharePlugin {
12139
12143
  _shareScope;
12140
12144
  _consumes;
@@ -12189,9 +12193,11 @@ Help:
12189
12193
  name = binding_.BuiltinPluginName.ContainerPlugin;
12190
12194
  _options;
12191
12195
  constructor(options){
12192
- super(), this._options = {
12196
+ super();
12197
+ const shareScope = options.shareScope || 'default', enhanced = options.enhanced ?? !1;
12198
+ validateShareScope(shareScope, enhanced, 'ContainerPlugin'), this._options = {
12193
12199
  name: options.name,
12194
- shareScope: options.shareScope || 'default',
12200
+ shareScope,
12195
12201
  library: options.library || {
12196
12202
  type: 'var',
12197
12203
  name: options.name
@@ -12209,7 +12215,7 @@ Help:
12209
12215
  ],
12210
12216
  name: item.name || void 0
12211
12217
  })),
12212
- enhanced: options.enhanced ?? !1
12218
+ enhanced
12213
12219
  };
12214
12220
  }
12215
12221
  raw(compiler) {
@@ -12234,20 +12240,25 @@ Help:
12234
12240
  name = binding_.BuiltinPluginName.ContainerReferencePlugin;
12235
12241
  _options;
12236
12242
  constructor(options){
12237
- super(), this._options = {
12243
+ super();
12244
+ const enhanced = options.enhanced ?? !1;
12245
+ options.shareScope && validateShareScope(options.shareScope, enhanced, 'ContainerReferencePlugin');
12246
+ const remotes = parseOptions(options.remotes, (item)=>({
12247
+ external: Array.isArray(item) ? item : [
12248
+ item
12249
+ ],
12250
+ shareScope: options.shareScope || 'default'
12251
+ }), (item)=>({
12252
+ external: Array.isArray(item.external) ? item.external : [
12253
+ item.external
12254
+ ],
12255
+ shareScope: item.shareScope || options.shareScope || 'default'
12256
+ }));
12257
+ for (const [, config] of remotes)validateShareScope(config.shareScope, enhanced, 'ContainerReferencePlugin');
12258
+ this._options = {
12238
12259
  remoteType: options.remoteType,
12239
- remotes: parseOptions(options.remotes, (item)=>({
12240
- external: Array.isArray(item) ? item : [
12241
- item
12242
- ],
12243
- shareScope: options.shareScope || 'default'
12244
- }), (item)=>({
12245
- external: Array.isArray(item.external) ? item.external : [
12246
- item.external
12247
- ],
12248
- shareScope: item.shareScope || options.shareScope || 'default'
12249
- })),
12250
- enhanced: options.enhanced ?? !1
12260
+ remotes,
12261
+ enhanced
12251
12262
  };
12252
12263
  }
12253
12264
  raw(compiler) {
@@ -12280,7 +12291,7 @@ Help:
12280
12291
  let _options = JSON.stringify(options || {});
12281
12292
  return binding_default().transform(source, _options);
12282
12293
  }
12283
- let exports_rspackVersion = "1.7.8", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
12294
+ let exports_rspackVersion = "1.7.9", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
12284
12295
  getNormalizedRspackOptions: getNormalizedRspackOptions,
12285
12296
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
12286
12297
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -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/core",
3
- "version": "1.7.8",
3
+ "version": "1.7.9",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -58,7 +58,7 @@
58
58
  "dependencies": {
59
59
  "@module-federation/runtime-tools": "0.22.0",
60
60
  "@rspack/lite-tapable": "1.1.0",
61
- "@rspack/binding": "1.7.8"
61
+ "@rspack/binding": "1.7.9"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@swc/helpers": ">=0.5.1"