@module-federation/enhanced 2.2.2 → 2.2.3

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.
package/dist/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @module-federation/enhanced
2
2
 
3
+ ## 2.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - @module-federation/rspack@2.2.3
8
+ - @module-federation/webpack-bundler-runtime@2.2.3
9
+ - @module-federation/sdk@2.2.3
10
+ - @module-federation/runtime-tools@2.2.3
11
+ - @module-federation/managers@2.2.3
12
+ - @module-federation/manifest@2.2.3
13
+ - @module-federation/dts-plugin@2.2.3
14
+ - @module-federation/bridge-react-webpack-plugin@2.2.3
15
+ - @module-federation/data-prefetch@2.2.3
16
+ - @module-federation/error-codes@2.2.3
17
+ - @module-federation/inject-external-runtime-core-plugin@2.2.3
18
+ - @module-federation/cli@2.2.3
19
+
3
20
  ## 2.2.2
4
21
 
5
22
  ### Patch Changes
@@ -59,6 +59,10 @@ declare class RemoteModule extends Module$1 {
59
59
  * @returns {Set<string>} types available (do not mutate)
60
60
  */
61
61
  getSourceTypes(): Set<string>;
62
+ /**
63
+ * @returns {Set<string>} types available (do not mutate)
64
+ */
65
+ getSourceBasicTypes(): Set<string>;
62
66
  /**
63
67
  * @returns {string | null} absolute path which should be used for condition matching (usually the resource path)
64
68
  */
@@ -11,6 +11,7 @@ const { sources: webpackSources } = require((0, _module_federation_sdk_normalize
11
11
  const { Module, RuntimeGlobals } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
12
12
  const makeSerializable = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/makeSerializable"));
13
13
  const TYPES = new Set(["remote", "share-init"]);
14
+ const JAVASCRIPT_TYPES = new Set(["javascript"]);
14
15
  const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]);
15
16
  var RemoteModule = class RemoteModule extends Module {
16
17
  /**
@@ -92,6 +93,12 @@ var RemoteModule = class RemoteModule extends Module {
92
93
  return TYPES;
93
94
  }
94
95
  /**
96
+ * @returns {Set<string>} types available (do not mutate)
97
+ */
98
+ getSourceBasicTypes() {
99
+ return JAVASCRIPT_TYPES;
100
+ }
101
+ /**
95
102
  * @returns {string | null} absolute path which should be used for condition matching (usually the resource path)
96
103
  */
97
104
  nameForCondition() {
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteModule.js","names":["WEBPACK_MODULE_TYPE_REMOTE","RemoteToExternalDependency","FederationModulesPlugin","FallbackDependency"],"sources":["../../../../src/lib/container/RemoteModule.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy\n*/\nimport { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport type { Compilation, WebpackOptionsNormalized } from 'webpack';\nimport type {\n CodeGenerationContext,\n CodeGenerationResult,\n LibIdentOptions,\n NeedBuildContext,\n WebpackError,\n} from 'webpack/lib/Module';\nimport FallbackDependency from './FallbackDependency';\nimport RemoteToExternalDependency from './RemoteToExternalDependency';\nimport { WEBPACK_MODULE_TYPE_REMOTE } from '../Constants';\nimport type { ResolverWithOptions } from 'webpack/lib/ResolverFactory';\nimport type { InputFileSystem } from 'webpack/lib/FileSystemInfo';\nimport type { RequestShortener } from 'webpack/lib/RuntimeModule';\nimport type { ObjectDeserializerContext } from 'webpack/lib/serialization/ObjectMiddleware';\nimport FederationModulesPlugin from './runtime/FederationModulesPlugin';\n\nconst { sources: webpackSources } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\nconst { Module, RuntimeGlobals } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\nconst makeSerializable = require(\n normalizeWebpackPath('webpack/lib/util/makeSerializable'),\n) as typeof import('webpack/lib/util/makeSerializable');\n\nconst TYPES: Set<string> = new Set(['remote', 'share-init']);\nconst RUNTIME_REQUIREMENTS: Set<string> = new Set([RuntimeGlobals.module]);\n\nclass RemoteModule extends Module {\n private _identifier: string;\n public request: string;\n public externalRequests: string[];\n public internalRequest: string;\n public shareScope: string | string[];\n\n /**\n * @param {string} request request string\n * @param {string[]} externalRequests list of external requests to containers\n * @param {string} internalRequest name of exposed module in container\n * @param {string|string[]} shareScope scope in which modules are shared\n */\n constructor(\n request: string,\n externalRequests: string[],\n internalRequest: string,\n shareScope: string | string[],\n ) {\n super(WEBPACK_MODULE_TYPE_REMOTE);\n this.request = request;\n this.externalRequests = externalRequests;\n this.internalRequest = internalRequest;\n this.shareScope = shareScope;\n const scopeStr = Array.isArray(shareScope)\n ? shareScope.join('|')\n : shareScope;\n this._identifier = `remote (${scopeStr}) ${this.externalRequests.join(\n ' ',\n )} ${this.internalRequest}`;\n }\n\n /**\n * @returns {string} a unique identifier of the module\n */\n override identifier(): string {\n return this._identifier;\n }\n\n /**\n * @param {RequestShortener} requestShortener the request shortener\n * @returns {string} a user readable identifier of the module\n */\n override readableIdentifier(requestShortener: RequestShortener): string {\n return `remote ${this.request}`;\n }\n\n /**\n * @param {LibIdentOptions} options options\n * @returns {string | null} an identifier for library inclusion\n */\n override libIdent(options: LibIdentOptions): string | null {\n return `${this.layer ? `(${this.layer})/` : ''}webpack/container/remote/${\n this.request\n }`;\n }\n\n /**\n * @param {NeedBuildContext} context context info\n * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild\n * @returns {void}\n */\n override needBuild(\n context: NeedBuildContext,\n callback: (err: WebpackError | null, needsRebuild?: boolean) => void,\n ): void {\n callback(null, !this.buildInfo);\n }\n\n /**\n * @param {WebpackOptions} options webpack options\n * @param {Compilation} compilation the compilation\n * @param {ResolverWithOptions} resolver the resolver\n * @param {InputFileSystem} fs the file system\n * @param {function(WebpackError=): void} callback callback function\n * @returns {void}\n */\n // @ts-ignore\n override build(\n options: WebpackOptionsNormalized,\n compilation: Compilation,\n resolver: ResolverWithOptions,\n fs: InputFileSystem,\n callback: (err?: WebpackError | undefined) => void,\n ): void {\n this.buildMeta = {};\n this.buildInfo = {\n strict: true,\n };\n\n this.clearDependenciesAndBlocks();\n if (this.externalRequests.length === 1) {\n const dep = new RemoteToExternalDependency(this.externalRequests[0]);\n this.addDependency(dep);\n const hooks = FederationModulesPlugin.getCompilationHooks(compilation);\n hooks.addRemoteDependency.call(dep);\n } else {\n const dep = new FallbackDependency(this.externalRequests);\n this.addDependency(dep);\n const hooks = FederationModulesPlugin.getCompilationHooks(compilation);\n hooks.addRemoteDependency.call(dep);\n }\n\n callback();\n }\n\n /**\n * @param {string=} type the source type for which the size should be estimated\n * @returns {number} the estimated size of the module (must be non-zero)\n */\n override size(type?: string): number {\n return 6;\n }\n\n /**\n * @returns {Set<string>} types available (do not mutate)\n */\n override getSourceTypes(): Set<string> {\n return TYPES;\n }\n\n /**\n * @returns {string | null} absolute path which should be used for condition matching (usually the resource path)\n */\n override nameForCondition(): string | null {\n return this.request;\n }\n\n /**\n * @param {CodeGenerationContext} context context for code generation\n * @returns {CodeGenerationResult} result\n */\n // @ts-ignore\n override codeGeneration(\n context: CodeGenerationContext,\n ): CodeGenerationResult {\n const { moduleGraph, chunkGraph } = context;\n const module = moduleGraph.getModule(this.dependencies[0]);\n const id = module && chunkGraph.getModuleId(module);\n const sources = new Map();\n sources.set('remote', new webpackSources.RawSource(''));\n const data = new Map();\n data.set('share-init', [\n {\n shareScope: this.shareScope,\n initStage: 20,\n init: id === undefined ? '' : `initExternal(${JSON.stringify(id)});`,\n },\n ]);\n return { sources, data, runtimeRequirements: RUNTIME_REQUIREMENTS };\n }\n override serialize(context: any) {\n const { write } = context;\n write(this.request);\n write(this.externalRequests);\n write(this.internalRequest);\n write(this.shareScope);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {RemoteModule} deserialized module\n */\n static deserialize(context: ObjectDeserializerContext): RemoteModule {\n const { read } = context;\n const obj = new RemoteModule(read(), read(), read(), read());\n obj.deserialize(context);\n return obj;\n }\n}\n\nmakeSerializable(RemoteModule, 'enhanced/lib/container/RemoteModule');\n\nexport default RemoteModule;\n"],"mappings":";;;;;;;;;AAsBA,MAAM,EAAE,SAAS,mBAAmB,gFACb,UAAU,CAChC;AACD,MAAM,EAAE,QAAQ,mBAAmB,gFACZ,UAAU,CAChC;AACD,MAAM,mBAAmB,gFACF,oCAAoC,CAC1D;AAED,MAAM,QAAqB,IAAI,IAAI,CAAC,UAAU,aAAa,CAAC;AAC5D,MAAM,uBAAoC,IAAI,IAAI,CAAC,eAAe,OAAO,CAAC;AAE1E,IAAM,eAAN,MAAM,qBAAqB,OAAO;;;;;;;CAahC,YACE,SACA,kBACA,iBACA,YACA;AACA,QAAMA,iDAA2B;AACjC,OAAK,UAAU;AACf,OAAK,mBAAmB;AACxB,OAAK,kBAAkB;AACvB,OAAK,aAAa;AAIlB,OAAK,cAAc,WAHF,MAAM,QAAQ,WAAW,GACtC,WAAW,KAAK,IAAI,GACpB,WACmC,IAAI,KAAK,iBAAiB,KAC/D,IACD,CAAC,GAAG,KAAK;;;;;CAMZ,AAAS,aAAqB;AAC5B,SAAO,KAAK;;;;;;CAOd,AAAS,mBAAmB,kBAA4C;AACtE,SAAO,UAAU,KAAK;;;;;;CAOxB,AAAS,SAAS,SAAyC;AACzD,SAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,MAAM,MAAM,GAAG,2BAC7C,KAAK;;;;;;;CAST,AAAS,UACP,SACA,UACM;AACN,WAAS,MAAM,CAAC,KAAK,UAAU;;;;;;;;;;CAYjC,AAAS,MACP,SACA,aACA,UACA,IACA,UACM;AACN,OAAK,YAAY,EAAE;AACnB,OAAK,YAAY,EACf,QAAQ,MACT;AAED,OAAK,4BAA4B;AACjC,MAAI,KAAK,iBAAiB,WAAW,GAAG;GACtC,MAAM,MAAM,IAAIC,yDAA2B,KAAK,iBAAiB,GAAG;AACpE,QAAK,cAAc,IAAI;AAEvB,GADcC,8DAAwB,oBAAoB,YAAY,CACh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Dependency"],"sources":["../../../../src/lib/container/RemoteModule.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy\n*/\nimport { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport type { Compilation, WebpackOptionsNormalized } from 'webpack';\nimport type {\n CodeGenerationContext,\n CodeGenerationResult,\n LibIdentOptions,\n NeedBuildContext,\n WebpackError,\n} from 'webpack/lib/Module';\nimport FallbackDependency from './FallbackDependency';\nimport RemoteToExternalDependency from './RemoteToExternalDependency';\nimport { WEBPACK_MODULE_TYPE_REMOTE } from '../Constants';\nimport type { ResolverWithOptions } from 'webpack/lib/ResolverFactory';\nimport type { InputFileSystem } from 'webpack/lib/FileSystemInfo';\nimport type { RequestShortener } from 'webpack/lib/RuntimeModule';\nimport type { ObjectDeserializerContext } from 'webpack/lib/serialization/ObjectMiddleware';\nimport FederationModulesPlugin from './runtime/FederationModulesPlugin';\n\nconst { sources: webpackSources } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\nconst { Module, RuntimeGlobals } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\nconst makeSerializable = require(\n normalizeWebpackPath('webpack/lib/util/makeSerializable'),\n) as typeof import('webpack/lib/util/makeSerializable');\n\nconst TYPES: Set<string> = new Set(['remote', 'share-init']);\nconst JAVASCRIPT_TYPES = new Set(['javascript']);\nconst RUNTIME_REQUIREMENTS: Set<string> = new Set([RuntimeGlobals.module]);\n\nclass RemoteModule extends Module {\n private _identifier: string;\n public request: string;\n public externalRequests: string[];\n public internalRequest: string;\n public shareScope: string | string[];\n\n /**\n * @param {string} request request string\n * @param {string[]} externalRequests list of external requests to containers\n * @param {string} internalRequest name of exposed module in container\n * @param {string|string[]} shareScope scope in which modules are shared\n */\n constructor(\n request: string,\n externalRequests: string[],\n internalRequest: string,\n shareScope: string | string[],\n ) {\n super(WEBPACK_MODULE_TYPE_REMOTE);\n this.request = request;\n this.externalRequests = externalRequests;\n this.internalRequest = internalRequest;\n this.shareScope = shareScope;\n const scopeStr = Array.isArray(shareScope)\n ? shareScope.join('|')\n : shareScope;\n this._identifier = `remote (${scopeStr}) ${this.externalRequests.join(\n ' ',\n )} ${this.internalRequest}`;\n }\n\n /**\n * @returns {string} a unique identifier of the module\n */\n override identifier(): string {\n return this._identifier;\n }\n\n /**\n * @param {RequestShortener} requestShortener the request shortener\n * @returns {string} a user readable identifier of the module\n */\n override readableIdentifier(requestShortener: RequestShortener): string {\n return `remote ${this.request}`;\n }\n\n /**\n * @param {LibIdentOptions} options options\n * @returns {string | null} an identifier for library inclusion\n */\n override libIdent(options: LibIdentOptions): string | null {\n return `${this.layer ? `(${this.layer})/` : ''}webpack/container/remote/${\n this.request\n }`;\n }\n\n /**\n * @param {NeedBuildContext} context context info\n * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild\n * @returns {void}\n */\n override needBuild(\n context: NeedBuildContext,\n callback: (err: WebpackError | null, needsRebuild?: boolean) => void,\n ): void {\n callback(null, !this.buildInfo);\n }\n\n /**\n * @param {WebpackOptions} options webpack options\n * @param {Compilation} compilation the compilation\n * @param {ResolverWithOptions} resolver the resolver\n * @param {InputFileSystem} fs the file system\n * @param {function(WebpackError=): void} callback callback function\n * @returns {void}\n */\n // @ts-ignore\n override build(\n options: WebpackOptionsNormalized,\n compilation: Compilation,\n resolver: ResolverWithOptions,\n fs: InputFileSystem,\n callback: (err?: WebpackError | undefined) => void,\n ): void {\n this.buildMeta = {};\n this.buildInfo = {\n strict: true,\n };\n\n this.clearDependenciesAndBlocks();\n if (this.externalRequests.length === 1) {\n const dep = new RemoteToExternalDependency(this.externalRequests[0]);\n this.addDependency(dep);\n const hooks = FederationModulesPlugin.getCompilationHooks(compilation);\n hooks.addRemoteDependency.call(dep);\n } else {\n const dep = new FallbackDependency(this.externalRequests);\n this.addDependency(dep);\n const hooks = FederationModulesPlugin.getCompilationHooks(compilation);\n hooks.addRemoteDependency.call(dep);\n }\n\n callback();\n }\n\n /**\n * @param {string=} type the source type for which the size should be estimated\n * @returns {number} the estimated size of the module (must be non-zero)\n */\n override size(type?: string): number {\n return 6;\n }\n\n /**\n * @returns {Set<string>} types available (do not mutate)\n */\n override getSourceTypes(): Set<string> {\n return TYPES;\n }\n\n /**\n * @returns {Set<string>} types available (do not mutate)\n */\n override getSourceBasicTypes(): Set<string> {\n return JAVASCRIPT_TYPES;\n }\n\n /**\n * @returns {string | null} absolute path which should be used for condition matching (usually the resource path)\n */\n override nameForCondition(): string | null {\n return this.request;\n }\n\n /**\n * @param {CodeGenerationContext} context context for code generation\n * @returns {CodeGenerationResult} result\n */\n // @ts-ignore\n override codeGeneration(\n context: CodeGenerationContext,\n ): CodeGenerationResult {\n const { moduleGraph, chunkGraph } = context;\n const module = moduleGraph.getModule(this.dependencies[0]);\n const id = module && chunkGraph.getModuleId(module);\n const sources = new Map();\n sources.set('remote', new webpackSources.RawSource(''));\n const data = new Map();\n data.set('share-init', [\n {\n shareScope: this.shareScope,\n initStage: 20,\n init: id === undefined ? '' : `initExternal(${JSON.stringify(id)});`,\n },\n ]);\n return { sources, data, runtimeRequirements: RUNTIME_REQUIREMENTS };\n }\n override serialize(context: any) {\n const { write } = context;\n write(this.request);\n write(this.externalRequests);\n write(this.internalRequest);\n write(this.shareScope);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {RemoteModule} deserialized module\n */\n static deserialize(context: ObjectDeserializerContext): RemoteModule {\n const { read } = context;\n const obj = new RemoteModule(read(), read(), read(), read());\n obj.deserialize(context);\n return obj;\n }\n}\n\nmakeSerializable(RemoteModule, 'enhanced/lib/container/RemoteModule');\n\nexport default RemoteModule;\n"],"mappings":";;;;;;;;;AAsBA,MAAM,EAAE,SAAS,mBAAmB,gFACb,UAAU,CAChC;AACD,MAAM,EAAE,QAAQ,mBAAmB,gFACZ,UAAU,CAChC;AACD,MAAM,mBAAmB,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U;;;;;;CAOZ,AAAS,KAAK,MAAuB;AACnC,SAAO;;;;;CAMT,AAAS,iBAA8B;AACrC,SAAO;;;;;CAMT,AAAS,sBAAmC;AAC1C,SAAO;;;;;CAMT,AAAS,mBAAkC;AACzC,SAAO,KAAK;;;;;;CAQd,AAAS,eACP,SACsB;EACtB,MAAM,EAAE,aAAa,eAAe;EACpC,MAAM,SAAS,YAAY,UAAU,KAAK,aAAa,GAAG;EAC1D,MAAM,KAAK,UAAU,WAAW,YAAY,OAAO;EACnD,MAAM,0BAAU,IAAI,KAAK;AACzB,UAAQ,IAAI,UAAU,IAAI,eAAe,UAAU,GAAG,CAAC;EACvD,MAAM,uBAAO,IAAI,KAAK;AACtB,OAAK,IAAI,cAAc,CACrB;GACE,YAAY,KAAK;GACjB,WAAW;GACX,MAAM,OAAO,SAAY,KAAK,gBAAgB,KAAK,UAAU,GAAG,CAAC;GAClE,CACF,CAAC;AACF,SAAO;GAAE;GAAS;GAAM,qBAAqB;GAAsB;;CAErE,AAAS,UAAU,SAAc;EAC/B,MAAM,EAAE,UAAU;AAClB,QAAM,KAAK,QAAQ;AACnB,QAAM,KAAK,iBAAiB;AAC5B,QAAM,KAAK,gBAAgB;AAC3B,QAAM,KAAK,WAAW;AACtB,QAAM,UAAU,QAAQ;;;;;;CAO1B,OAAO,YAAY,SAAkD;EACnE,MAAM,EAAE,SAAS;EACjB,MAAM,MAAM,IAAI,aAAa,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;AAC5D,MAAI,YAAY,QAAQ;AACxB,SAAO;;;AAIX,iBAAiB,cAAc,sCAAsC"}
@@ -44,6 +44,7 @@ declare class ConsumeSharedModule extends Module$1 {
44
44
  * @returns {Set<string>} types available (do not mutate)
45
45
  */
46
46
  getSourceTypes(): Set<string>;
47
+ getSourceBasicTypes(): Set<string>;
47
48
  /**
48
49
  * @param {string=} type the source type for which the size should be estimated
49
50
  * @returns {number} the estimated size of the module (must be non-zero)
@@ -29,6 +29,7 @@ const makeSerializable = require((0, _module_federation_sdk_normalize_webpack_pa
29
29
  * @property {{ version?: string; fallbackVersion?: string }} include Options for including only certain versions
30
30
  */
31
31
  const TYPES = new Set(["consume-shared"]);
32
+ const JAVASCRIPT_TYPES = new Set(["javascript"]);
32
33
  var ConsumeSharedModule = class extends Module {
33
34
  /**
34
35
  * @param {string} context context
@@ -99,6 +100,9 @@ var ConsumeSharedModule = class extends Module {
99
100
  getSourceTypes() {
100
101
  return TYPES;
101
102
  }
103
+ getSourceBasicTypes() {
104
+ return JAVASCRIPT_TYPES;
105
+ }
102
106
  /**
103
107
  * @param {string=} type the source type for which the size should be estimated
104
108
  * @returns {number} the estimated size of the module (must be non-zero)
@@ -1 +1 @@
1
- {"version":3,"file":"ConsumeSharedModule.js","names":["WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE","ConsumeSharedFallbackDependency","normalizeConsumeShareOptions"],"sources":["../../../../src/lib/sharing/ConsumeSharedModule.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy\n*/\n\n'use strict';\nimport { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport type {\n WebpackOptions,\n Compilation,\n UpdateHashContext,\n CodeGenerationContext,\n CodeGenerationResult,\n LibIdentOptions,\n NeedBuildContext,\n RequestShortener,\n ResolverWithOptions,\n WebpackError,\n ObjectDeserializerContext,\n ObjectSerializerContext,\n Hash,\n InputFileSystem,\n} from 'webpack/lib/Module';\nimport ConsumeSharedFallbackDependency from './ConsumeSharedFallbackDependency';\nimport { normalizeConsumeShareOptions } from './utils';\nimport { WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE } from '../Constants';\nimport type { ConsumeOptions } from '@module-federation/sdk';\n\nconst { rangeToString, stringifyHoley } = require(\n normalizeWebpackPath('webpack/lib/util/semver'),\n) as typeof import('webpack/lib/util/semver');\nconst { AsyncDependenciesBlock, Module, RuntimeGlobals } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\nconst { sources: webpackSources } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\nconst makeSerializable = require(\n normalizeWebpackPath('webpack/lib/util/makeSerializable'),\n) as typeof import('webpack/lib/util/makeSerializable');\n\n/**\n * @typedef {Object} ConsumeOptions\n * @property {string=} import fallback request\n * @property {string=} importResolved resolved fallback request\n * @property {string} shareKey global share key\n * @property {string} shareScope share scope\n * @property {SemVerRange | false | undefined} requiredVersion version requirement\n * @property {string} packageName package name to determine required version automatically\n * @property {boolean} strictVersion don't use shared version even if version isn't valid\n * @property {boolean} singleton use single global version\n * @property {boolean} eager include the fallback module in a sync way\n * @property {string | null=} layer Share a specific layer of the module, if the module supports layers\n * @property {string | null=} issuerLayer Issuer layer in which the module should be resolved\n * @property {{ version?: string; fallbackVersion?: string }} exclude Options for excluding certain versions\n * @property {{ version?: string; fallbackVersion?: string }} include Options for including only certain versions\n */\n\nconst TYPES = new Set(['consume-shared']);\n\nclass ConsumeSharedModule extends Module {\n options: ConsumeOptions;\n\n /**\n * @param {string} context context\n * @param {ConsumeOptions} options consume options\n */\n constructor(context: string, options: ConsumeOptions) {\n super(\n WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE,\n context,\n options?.layer ?? null,\n );\n this.layer = options?.layer ?? null;\n this.options = options;\n }\n\n /**\n * @returns {string} a unique identifier of the module\n */\n override identifier(): string {\n const {\n shareKey,\n shareScope,\n importResolved,\n requiredVersion,\n strictVersion,\n singleton,\n eager,\n layer,\n } = this.options;\n\n // Convert shareScope array to string for the identifier\n const normalizedShareScope = Array.isArray(shareScope)\n ? shareScope.join('|')\n : shareScope;\n\n return `${WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE}|${normalizedShareScope}|${shareKey}|${\n requiredVersion && rangeToString(requiredVersion)\n }|${strictVersion}|${importResolved}|${singleton}|${eager}|${layer}`;\n }\n\n /**\n * @param {RequestShortener} requestShortener the request shortener\n * @returns {string} a user readable identifier of the module\n */\n override readableIdentifier(requestShortener: RequestShortener): string {\n const {\n shareKey,\n shareScope,\n importResolved,\n requiredVersion,\n strictVersion,\n singleton,\n eager,\n layer,\n } = this.options;\n const normalizedShareScope = Array.isArray(shareScope)\n ? shareScope.join('|')\n : shareScope;\n\n return `consume shared module (${normalizedShareScope}) ${shareKey}@${\n requiredVersion ? rangeToString(requiredVersion) : '*'\n }${strictVersion ? ' (strict)' : ''}${singleton ? ' (singleton)' : ''}${\n importResolved\n ? ` (fallback: ${requestShortener.shorten(importResolved)})`\n : ''\n }${eager ? ' (eager)' : ''}${layer ? ` (${layer})` : ''}`;\n }\n\n /**\n * @param {LibIdentOptions} options options\n * @returns {string | null} an identifier for library inclusion\n */\n override libIdent(options: LibIdentOptions): string | null {\n const { shareKey, shareScope, import: request } = this.options;\n const normalizedShareScope = Array.isArray(shareScope)\n ? shareScope.join('|')\n : shareScope;\n\n return `${\n this.layer ? `(${this.layer})/` : ''\n }webpack/sharing/consume/${normalizedShareScope}/${shareKey}${\n request ? `/${request}` : ''\n }`;\n }\n\n /**\n * @param {NeedBuildContext} context context info\n * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild\n * @returns {void}\n */\n override needBuild(\n context: NeedBuildContext,\n callback: (error?: WebpackError | null, needsRebuild?: boolean) => void,\n ): void {\n callback(null, !this.buildInfo);\n }\n\n /**\n * @param {WebpackOptions} options webpack options\n * @param {Compilation} compilation the compilation\n * @param {ResolverWithOptions} resolver the resolver\n * @param {InputFileSystem} fs the file system\n * @param {function(WebpackError=): void} callback callback function\n * @returns {void}\n */\n override build(\n options: WebpackOptions,\n compilation: Compilation,\n resolver: ResolverWithOptions,\n fs: InputFileSystem,\n callback: (error?: WebpackError) => void,\n ): void {\n this.buildMeta = {};\n this.buildInfo = {};\n if (this.options.import) {\n const dep = new ConsumeSharedFallbackDependency(\n this.options.import,\n this.options.layer,\n );\n if (this.options.eager) {\n this.addDependency(dep);\n } else {\n const block = new AsyncDependenciesBlock({});\n block.addDependency(dep);\n this.addBlock(block);\n }\n }\n callback();\n }\n\n /**\n * @returns {Set<string>} types available (do not mutate)\n */\n override getSourceTypes(): Set<string> {\n return TYPES;\n }\n\n /**\n * @param {string=} type the source type for which the size should be estimated\n * @returns {number} the estimated size of the module (must be non-zero)\n */\n override size(type?: string): number {\n return 42;\n }\n\n /**\n * @param {Hash} hash the hash used to track dependencies\n * @param {UpdateHashContext} context context\n * @returns {void}\n */\n override updateHash(hash: Hash, context: UpdateHashContext): void {\n hash.update(JSON.stringify(this.options));\n super.updateHash(hash, context);\n }\n\n /**\n * @param {CodeGenerationContext} context context for code generation\n * @returns {CodeGenerationResult} result\n */\n override codeGeneration({\n chunkGraph,\n moduleGraph,\n runtimeTemplate,\n }: CodeGenerationContext): CodeGenerationResult {\n const runtimeRequirements = new Set([RuntimeGlobals.shareScopeMap]);\n const {\n shareScope,\n shareKey,\n strictVersion,\n requiredVersion,\n import: request,\n singleton,\n eager,\n } = this.options;\n let fallbackCode;\n if (request) {\n if (eager) {\n const dep = this.dependencies[0];\n fallbackCode = runtimeTemplate.syncModuleFactory({\n dependency: dep,\n chunkGraph,\n runtimeRequirements,\n request: this.options.import,\n });\n } else {\n const block = this.blocks[0];\n fallbackCode = runtimeTemplate.asyncModuleFactory({\n block,\n chunkGraph,\n runtimeRequirements,\n request: this.options.import,\n });\n }\n }\n let fn = 'load';\n const args = [JSON.stringify(shareScope), JSON.stringify(shareKey)];\n if (requiredVersion) {\n if (strictVersion) {\n fn += 'Strict';\n }\n if (singleton) {\n fn += 'Singleton';\n }\n args.push(stringifyHoley(requiredVersion));\n fn += 'VersionCheck';\n } else {\n if (singleton) {\n fn += 'Singleton';\n }\n }\n if (fallbackCode) {\n fn += 'Fallback';\n args.push(fallbackCode);\n }\n // const code = runtimeTemplate.returningFunction(`${fn}(${args.join(', ')})`);\n const sources = new Map();\n sources.set(\n 'consume-shared',\n new webpackSources.RawSource(\n fallbackCode ||\n `()=>()=>{throw new Error(\"Can not get '${shareKey}'\")}`,\n ),\n );\n\n const data = new Map();\n data.set('consume-shared', normalizeConsumeShareOptions(this.options));\n\n return {\n runtimeRequirements,\n sources,\n data,\n };\n }\n\n /**\n * @param {ObjectSerializerContext} context context\n */\n override serialize(context: ObjectSerializerContext): void {\n const { write } = context;\n write(this.options);\n write(this.layer);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n */\n override deserialize(context: ObjectDeserializerContext): void {\n const { read } = context;\n const options = read();\n const layer = read();\n this.options = options;\n this.layer = layer;\n super.deserialize(context);\n }\n}\n\nmakeSerializable(\n ConsumeSharedModule,\n 'enhanced/lib/sharing/ConsumeSharedModule',\n);\n\nexport default ConsumeSharedModule;\n"],"mappings":";;;;;;;;;;AA4BA,MAAM,EAAE,eAAe,mBAAmB,gFACnB,0BAA0B,CAChD;AACD,MAAM,EAAE,wBAAwB,QAAQ,mBAAmB,gFACpC,UAAU,CAChC;AACD,MAAM,EAAE,SAAS,mBAAmB,gFACb,UAAU,CAChC;AACD,MAAM,mBAAmB,gFACF,oCAAoC,CAC1D;;;;;;;;;;;;;;;;;AAmBD,MAAM,QAAQ,IAAI,IAAI,CAAC,iBAAiB,CAAC;AAEzC,IAAM,sBAAN,cAAkC,OAAO;;;;;CAOvC,YAAY,SAAiB,SAAyB;AACpD,QACEA,iEACA,SACA,SAAS,SAAS,KACnB;AACD,OAAK,QAAQ,SAAS,SAAS;AAC/B,OAAK,UAAU;;;;;CAMjB,AAAS,aAAqB;EAC5B,MAAM,EACJ,UACA,YACA,gBACA,iBACA,eACA,WACA,OACA,UACE,KAAK;AAOT,SAAO,GAAGA,gEAA0C,GAJvB,MAAM,QAAQ,WAAW,GAClD,WAAW,KAAK,IAAI,GACpB,WAEwE,GAAG,SAAS,GACtF,mBAAmB,cAAc,gBAAgB,CAClD,GAAG,cAAc,GAAG,eAAe,GAAG,UAAU,GAAG,MAAM,GAAG;;;;;;CAO/D,AAAS,m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b,QAAM,YAAY,QAAQ;;;AAI9B,iBACE,qBACA,2CACD"}
1
+ {"version":3,"file":"ConsumeSharedModule.js","names":["WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE","ConsumeSharedFallbackDependency","normalizeConsumeShareOptions"],"sources":["../../../../src/lib/sharing/ConsumeSharedModule.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy\n*/\n\n'use strict';\nimport { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport type {\n WebpackOptions,\n Compilation,\n UpdateHashContext,\n CodeGenerationContext,\n CodeGenerationResult,\n LibIdentOptions,\n NeedBuildContext,\n RequestShortener,\n ResolverWithOptions,\n WebpackError,\n ObjectDeserializerContext,\n ObjectSerializerContext,\n Hash,\n InputFileSystem,\n} from 'webpack/lib/Module';\nimport ConsumeSharedFallbackDependency from './ConsumeSharedFallbackDependency';\nimport { normalizeConsumeShareOptions } from './utils';\nimport { WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE } from '../Constants';\nimport type { ConsumeOptions } from '@module-federation/sdk';\n\nconst { rangeToString, stringifyHoley } = require(\n normalizeWebpackPath('webpack/lib/util/semver'),\n) as typeof import('webpack/lib/util/semver');\nconst { AsyncDependenciesBlock, Module, RuntimeGlobals } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\nconst { sources: webpackSources } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\nconst makeSerializable = require(\n normalizeWebpackPath('webpack/lib/util/makeSerializable'),\n) as typeof import('webpack/lib/util/makeSerializable');\n\n/**\n * @typedef {Object} ConsumeOptions\n * @property {string=} import fallback request\n * @property {string=} importResolved resolved fallback request\n * @property {string} shareKey global share key\n * @property {string} shareScope share scope\n * @property {SemVerRange | false | undefined} requiredVersion version requirement\n * @property {string} packageName package name to determine required version automatically\n * @property {boolean} strictVersion don't use shared version even if version isn't valid\n * @property {boolean} singleton use single global version\n * @property {boolean} eager include the fallback module in a sync way\n * @property {string | null=} layer Share a specific layer of the module, if the module supports layers\n * @property {string | null=} issuerLayer Issuer layer in which the module should be resolved\n * @property {{ version?: string; fallbackVersion?: string }} exclude Options for excluding certain versions\n * @property {{ version?: string; fallbackVersion?: string }} include Options for including only certain versions\n */\n\nconst TYPES = new Set(['consume-shared']);\nconst JAVASCRIPT_TYPES = new Set(['javascript']);\n\nclass ConsumeSharedModule extends Module {\n options: ConsumeOptions;\n\n /**\n * @param {string} context context\n * @param {ConsumeOptions} options consume options\n */\n constructor(context: string, options: ConsumeOptions) {\n super(\n WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE,\n context,\n options?.layer ?? null,\n );\n this.layer = options?.layer ?? null;\n this.options = options;\n }\n\n /**\n * @returns {string} a unique identifier of the module\n */\n override identifier(): string {\n const {\n shareKey,\n shareScope,\n importResolved,\n requiredVersion,\n strictVersion,\n singleton,\n eager,\n layer,\n } = this.options;\n\n // Convert shareScope array to string for the identifier\n const normalizedShareScope = Array.isArray(shareScope)\n ? shareScope.join('|')\n : shareScope;\n\n return `${WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE}|${normalizedShareScope}|${shareKey}|${\n requiredVersion && rangeToString(requiredVersion)\n }|${strictVersion}|${importResolved}|${singleton}|${eager}|${layer}`;\n }\n\n /**\n * @param {RequestShortener} requestShortener the request shortener\n * @returns {string} a user readable identifier of the module\n */\n override readableIdentifier(requestShortener: RequestShortener): string {\n const {\n shareKey,\n shareScope,\n importResolved,\n requiredVersion,\n strictVersion,\n singleton,\n eager,\n layer,\n } = this.options;\n const normalizedShareScope = Array.isArray(shareScope)\n ? shareScope.join('|')\n : shareScope;\n\n return `consume shared module (${normalizedShareScope}) ${shareKey}@${\n requiredVersion ? rangeToString(requiredVersion) : '*'\n }${strictVersion ? ' (strict)' : ''}${singleton ? ' (singleton)' : ''}${\n importResolved\n ? ` (fallback: ${requestShortener.shorten(importResolved)})`\n : ''\n }${eager ? ' (eager)' : ''}${layer ? ` (${layer})` : ''}`;\n }\n\n /**\n * @param {LibIdentOptions} options options\n * @returns {string | null} an identifier for library inclusion\n */\n override libIdent(options: LibIdentOptions): string | null {\n const { shareKey, shareScope, import: request } = this.options;\n const normalizedShareScope = Array.isArray(shareScope)\n ? shareScope.join('|')\n : shareScope;\n\n return `${\n this.layer ? `(${this.layer})/` : ''\n }webpack/sharing/consume/${normalizedShareScope}/${shareKey}${\n request ? `/${request}` : ''\n }`;\n }\n\n /**\n * @param {NeedBuildContext} context context info\n * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild\n * @returns {void}\n */\n override needBuild(\n context: NeedBuildContext,\n callback: (error?: WebpackError | null, needsRebuild?: boolean) => void,\n ): void {\n callback(null, !this.buildInfo);\n }\n\n /**\n * @param {WebpackOptions} options webpack options\n * @param {Compilation} compilation the compilation\n * @param {ResolverWithOptions} resolver the resolver\n * @param {InputFileSystem} fs the file system\n * @param {function(WebpackError=): void} callback callback function\n * @returns {void}\n */\n override build(\n options: WebpackOptions,\n compilation: Compilation,\n resolver: ResolverWithOptions,\n fs: InputFileSystem,\n callback: (error?: WebpackError) => void,\n ): void {\n this.buildMeta = {};\n this.buildInfo = {};\n if (this.options.import) {\n const dep = new ConsumeSharedFallbackDependency(\n this.options.import,\n this.options.layer,\n );\n if (this.options.eager) {\n this.addDependency(dep);\n } else {\n const block = new AsyncDependenciesBlock({});\n block.addDependency(dep);\n this.addBlock(block);\n }\n }\n callback();\n }\n\n /**\n * @returns {Set<string>} types available (do not mutate)\n */\n override getSourceTypes(): Set<string> {\n return TYPES;\n }\n\n override getSourceBasicTypes(): Set<string> {\n return JAVASCRIPT_TYPES;\n }\n\n /**\n * @param {string=} type the source type for which the size should be estimated\n * @returns {number} the estimated size of the module (must be non-zero)\n */\n override size(type?: string): number {\n return 42;\n }\n\n /**\n * @param {Hash} hash the hash used to track dependencies\n * @param {UpdateHashContext} context context\n * @returns {void}\n */\n override updateHash(hash: Hash, context: UpdateHashContext): void {\n hash.update(JSON.stringify(this.options));\n super.updateHash(hash, context);\n }\n\n /**\n * @param {CodeGenerationContext} context context for code generation\n * @returns {CodeGenerationResult} result\n */\n override codeGeneration({\n chunkGraph,\n moduleGraph,\n runtimeTemplate,\n }: CodeGenerationContext): CodeGenerationResult {\n const runtimeRequirements = new Set([RuntimeGlobals.shareScopeMap]);\n const {\n shareScope,\n shareKey,\n strictVersion,\n requiredVersion,\n import: request,\n singleton,\n eager,\n } = this.options;\n let fallbackCode;\n if (request) {\n if (eager) {\n const dep = this.dependencies[0];\n fallbackCode = runtimeTemplate.syncModuleFactory({\n dependency: dep,\n chunkGraph,\n runtimeRequirements,\n request: this.options.import,\n });\n } else {\n const block = this.blocks[0];\n fallbackCode = runtimeTemplate.asyncModuleFactory({\n block,\n chunkGraph,\n runtimeRequirements,\n request: this.options.import,\n });\n }\n }\n let fn = 'load';\n const args = [JSON.stringify(shareScope), JSON.stringify(shareKey)];\n if (requiredVersion) {\n if (strictVersion) {\n fn += 'Strict';\n }\n if (singleton) {\n fn += 'Singleton';\n }\n args.push(stringifyHoley(requiredVersion));\n fn += 'VersionCheck';\n } else {\n if (singleton) {\n fn += 'Singleton';\n }\n }\n if (fallbackCode) {\n fn += 'Fallback';\n args.push(fallbackCode);\n }\n // const code = runtimeTemplate.returningFunction(`${fn}(${args.join(', ')})`);\n const sources = new Map();\n sources.set(\n 'consume-shared',\n new webpackSources.RawSource(\n fallbackCode ||\n `()=>()=>{throw new Error(\"Can not get '${shareKey}'\")}`,\n ),\n );\n\n const data = new Map();\n data.set('consume-shared', normalizeConsumeShareOptions(this.options));\n\n return {\n runtimeRequirements,\n sources,\n data,\n };\n }\n\n /**\n * @param {ObjectSerializerContext} context context\n */\n override serialize(context: ObjectSerializerContext): void {\n const { write } = context;\n write(this.options);\n write(this.layer);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n */\n override deserialize(context: ObjectDeserializerContext): void {\n const { read } = context;\n const options = read();\n const layer = read();\n this.options = options;\n this.layer = layer;\n super.deserialize(context);\n }\n}\n\nmakeSerializable(\n ConsumeSharedModule,\n 'enhanced/lib/sharing/ConsumeSharedModule',\n);\n\nexport default ConsumeSharedModule;\n"],"mappings":";;;;;;;;;;AA4BA,MAAM,EAAE,eAAe,mBAAmB,gFACnB,0BAA0B,CAChD;AACD,MAAM,EAAE,wBAAwB,QAAQ,mBAAmB,gFACpC,UAAU,CAChC;AACD,MAAM,EAAE,SAAS,mBAAmB,gFACb,UAAU,CAChC;AACD,MAAM,mBAAmB,gFACF,oCAAoC,CAC1D;;;;;;;;;;;;;;;;;AAmBD,MAAM,QAAQ,IAAI,IAAI,CAAC,iBAAiB,CAAC;AACzC,MAAM,mBAAmB,IAAI,IAAI,CAAC,aAAa,CAAC;AAEhD,IAAM,sBAAN,cAAkC,OAAO;;;;;CAOvC,YAAY,SAAiB,SAAyB;AACpD,QACEA,iEACA,SACA,SAAS,SAAS,KACnB;AACD,OAAK,QAAQ,SAAS,SAAS;AAC/B,OAAK,UAAU;;;;;CAMjB,AAAS,aAAqB;EAC5B,MAAM,EACJ,UACA,YACA,gBACA,iBACA,eACA,WACA,OACA,UACE,KAAK;AAOT,SAAO,GAAGA,gEAA0C,GAJvB,MAAM,QAAQ,WAAW,GAClD,WAAW,KAAK,IAAI,GACpB,WAEwE,GAAG,SAAS,GACtF,mBAAmB,cAAc,gBAAgB,CAClD,GAAG,cAAc,GAAG,eAAe,GAAG,UAAU,GAAG,MAAM,GAAG;;;;;;CAO/D,AAAS,mBAAmB,kBAA4C;EACtE,MAAM,EACJ,UACA,YACA,gBACA,iBACA,eACA,WACA,OACA,UACE,KAAK;AAKT,SAAO,0BAJsB,MAAM,QAAQ,WAAW,GAClD,WAAW,KAAK,IAAI,GACpB,WAEkD,IAAI,SAAS,GACjE,kBAAkB,cAAc,gBAAgB,GAAG,MAClD,gBAAgB,cAAc,KAAK,YAAY,iBAAiB,KACjE,iBACI,e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,MAAM,MAAM,KAAK,aAAa;AAC9B,kBAAe,gBAAgB,kBAAkB;IAC/C,YAAY;IACZ;IACA;IACA,SAAS,KAAK,QAAQ;IACvB,CAAC;SACG;GACL,MAAM,QAAQ,KAAK,OAAO;AAC1B,kBAAe,gBAAgB,mBAAmB;IAChD;IACA;IACA;IACA,SAAS,KAAK,QAAQ;IACvB,CAAC;;EAGN,IAAI,KAAK;EACT,MAAM,OAAO,CAAC,KAAK,UAAU,WAAW,EAAE,KAAK,UAAU,SAAS,CAAC;AACnE,MAAI,iBAAiB;AACnB,OAAI,cACF,OAAM;AAER,OAAI,UACF,OAAM;AAER,QAAK,KAAK,eAAe,gBAAgB,CAAC;AAC1C,SAAM;aAEF,UACF,OAAM;AAGV,MAAI,cAAc;AAChB,SAAM;AACN,QAAK,KAAK,aAAa;;EAGzB,MAAM,0BAAU,IAAI,KAAK;AACzB,UAAQ,IACN,kBACA,IAAI,eAAe,UACjB,gBACE,0CAA0C,SAAS,MACtD,CACF;EAED,MAAM,uBAAO,IAAI,KAAK;AACtB,OAAK,IAAI,kBAAkBC,uDAA6B,KAAK,QAAQ,CAAC;AAEtE,SAAO;GACL;GACA;GACA;GACD;;;;;CAMH,AAAS,UAAU,SAAwC;EACzD,MAAM,EAAE,UAAU;AAClB,QAAM,KAAK,QAAQ;AACnB,QAAM,KAAK,MAAM;AACjB,QAAM,UAAU,QAAQ;;;;;CAM1B,AAAS,YAAY,SAA0C;EAC7D,MAAM,EAAE,SAAS;EACjB,MAAM,UAAU,MAAM;EACtB,MAAM,QAAQ,MAAM;AACpB,OAAK,UAAU;AACf,OAAK,QAAQ;AACb,QAAM,YAAY,QAAQ;;;AAI9B,iBACE,qBACA,2CACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/enhanced",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "main": "./dist/src/index.js",
5
5
  "types": "./dist/src/index.d.ts",
6
6
  "repository": {
@@ -95,18 +95,18 @@
95
95
  "upath": "2.0.1",
96
96
  "schema-utils": "^4.3.0",
97
97
  "tapable": "2.3.0",
98
- "@module-federation/webpack-bundler-runtime": "2.2.2",
99
- "@module-federation/bridge-react-webpack-plugin": "2.2.2",
100
- "@module-federation/data-prefetch": "2.2.2",
101
- "@module-federation/dts-plugin": "2.2.2",
102
- "@module-federation/inject-external-runtime-core-plugin": "2.2.2",
103
- "@module-federation/error-codes": "2.2.2",
104
- "@module-federation/managers": "2.2.2",
105
- "@module-federation/manifest": "2.2.2",
106
- "@module-federation/rspack": "2.2.2",
107
- "@module-federation/runtime-tools": "2.2.2",
108
- "@module-federation/sdk": "2.2.2",
109
- "@module-federation/cli": "2.2.2"
98
+ "@module-federation/webpack-bundler-runtime": "2.2.3",
99
+ "@module-federation/bridge-react-webpack-plugin": "2.2.3",
100
+ "@module-federation/data-prefetch": "2.2.3",
101
+ "@module-federation/dts-plugin": "2.2.3",
102
+ "@module-federation/error-codes": "2.2.3",
103
+ "@module-federation/inject-external-runtime-core-plugin": "2.2.3",
104
+ "@module-federation/manifest": "2.2.3",
105
+ "@module-federation/sdk": "2.2.3",
106
+ "@module-federation/managers": "2.2.3",
107
+ "@module-federation/cli": "2.2.3",
108
+ "@module-federation/runtime-tools": "2.2.3",
109
+ "@module-federation/rspack": "2.2.3"
110
110
  },
111
111
  "scripts": {
112
112
  "generate:schema": "node src/scripts/compile-schema.js && node src/scripts/generate-sdk-types.js",