@module-federation/enhanced 0.0.7 → 0.0.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.
- package/README.md +164 -6
- package/dist/package.json +9 -4
- package/dist/src/declarations/plugins/container/AsyncDependenciesBlock.d.ts +57 -0
- package/dist/src/declarations/plugins/container/ContainerPlugin.d.ts +187 -0
- package/dist/src/declarations/plugins/container/ContainerReferencePlugin.d.ts +80 -0
- package/dist/src/declarations/plugins/container/Dependency.d.ts +285 -0
- package/dist/src/declarations/plugins/container/Module.d.ts +138 -0
- package/dist/src/declarations/plugins/container/ModuleFactory.d.ts +33 -0
- package/dist/src/declarations/plugins/container/ModuleFederationPlugin.d.ts +320 -0
- package/dist/src/declarations/plugins/container/ObjectDeserializerContext.d.ts +4 -0
- package/dist/src/declarations/plugins/container/StaticExportsDependency.d.ts +28 -0
- package/dist/src/declarations/plugins/container/Template.d.ts +198 -0
- package/dist/src/declarations/plugins/container/WebpackError.d.ts +32 -0
- package/dist/src/declarations/plugins/container/WebpackOptions.d.ts +140 -0
- package/dist/src/declarations/plugins/sharing/ConsumeSharedPlugin.d.ts +74 -0
- package/dist/src/declarations/plugins/sharing/ProvideSharedPlugin.d.ts +67 -0
- package/dist/src/declarations/plugins/sharing/SharePlugin.d.ts +78 -0
- package/dist/src/index.d.ts +12 -9
- package/dist/src/index.js +19 -14
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib/container/AsyncBoundaryPlugin.d.ts +1 -1
- package/dist/src/lib/container/AsyncBoundaryPlugin.js +3 -2
- package/dist/src/lib/container/AsyncBoundaryPlugin.js.map +1 -1
- package/dist/src/lib/container/ContainerEntryDependency.d.ts +22 -18
- package/dist/src/lib/container/ContainerEntryDependency.js +3 -1
- package/dist/src/lib/container/ContainerEntryDependency.js.map +1 -1
- package/dist/src/lib/container/ContainerEntryModule.d.ts +70 -80
- package/dist/src/lib/container/ContainerEntryModule.js +32 -12
- package/dist/src/lib/container/ContainerEntryModule.js.map +1 -1
- package/dist/src/lib/container/ContainerEntryModuleFactory.d.ts +14 -10
- package/dist/src/lib/container/ContainerEntryModuleFactory.js +2 -2
- package/dist/src/lib/container/ContainerEntryModuleFactory.js.map +1 -1
- package/dist/src/lib/container/ContainerExposedDependency.d.ts +18 -25
- package/dist/src/lib/container/ContainerPlugin.d.ts +32 -9
- package/dist/src/lib/container/ContainerPlugin.js +110 -10
- package/dist/src/lib/container/ContainerPlugin.js.map +1 -1
- package/dist/src/lib/container/ContainerReferencePlugin.d.ts +27 -12
- package/dist/src/lib/container/ContainerReferencePlugin.js +5 -3
- package/dist/src/lib/container/ContainerReferencePlugin.js.map +1 -1
- package/dist/src/lib/container/FallbackDependency.d.ts +14 -20
- package/dist/src/lib/container/FallbackItemDependency.d.ts +3 -10
- package/dist/src/lib/container/FallbackModule.d.ts +52 -70
- package/dist/src/lib/container/FallbackModule.js +2 -2
- package/dist/src/lib/container/FallbackModule.js.map +1 -1
- package/dist/src/lib/container/FallbackModuleFactory.d.ts +10 -10
- package/dist/src/lib/container/HoistContainerReferencesPlugin.d.ts +3 -4
- package/dist/src/lib/container/HoistContainerReferencesPlugin.js +33 -50
- package/dist/src/lib/container/HoistContainerReferencesPlugin.js.map +1 -1
- package/dist/src/lib/container/ModuleFederationPlugin.d.ts +21 -14
- package/dist/src/lib/container/ModuleFederationPlugin.js +19 -10
- package/dist/src/lib/container/ModuleFederationPlugin.js.map +1 -1
- package/dist/src/lib/container/ModuleFederationPluginTypes.d.ts +271 -0
- package/dist/src/lib/container/ModuleFederationPluginTypes.js +8 -0
- package/dist/src/lib/container/ModuleFederationPluginTypes.js.map +1 -0
- package/dist/src/lib/container/RemoteModule.d.ts +88 -73
- package/dist/src/lib/container/RemoteModule.js +2 -2
- package/dist/src/lib/container/RemoteModule.js.map +1 -1
- package/dist/src/lib/container/RemoteRuntimeModule.d.ts +10 -7
- package/dist/src/lib/container/RemoteRuntimeModule.js +44 -46
- package/dist/src/lib/container/RemoteRuntimeModule.js.map +1 -1
- package/dist/src/lib/container/RemoteToExternalDependency.d.ts +3 -9
- package/dist/src/lib/container/constant.d.ts +3 -0
- package/dist/src/lib/container/constant.js +12 -0
- package/dist/src/lib/container/constant.js.map +1 -0
- package/dist/src/lib/container/options.d.ts +12 -4
- package/dist/src/lib/container/runtime/FederationRuntimeModule.d.ts +13 -0
- package/dist/src/lib/container/runtime/FederationRuntimeModule.js +27 -0
- package/dist/src/lib/container/runtime/FederationRuntimeModule.js.map +1 -0
- package/dist/src/lib/container/runtime/FederationRuntimePlugin.d.ts +17 -0
- package/dist/src/lib/container/runtime/FederationRuntimePlugin.js +199 -0
- package/dist/src/lib/container/runtime/FederationRuntimePlugin.js.map +1 -0
- package/dist/src/lib/container/runtime/getFederationGlobal.d.ts +5 -0
- package/dist/src/lib/container/runtime/getFederationGlobal.js +24 -0
- package/dist/src/lib/container/runtime/getFederationGlobal.js.map +1 -0
- package/dist/src/lib/container/runtime/utils.d.ts +15 -0
- package/dist/src/lib/container/runtime/utils.js +79 -0
- package/dist/src/lib/container/runtime/utils.js.map +1 -0
- package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.d.ts +3 -10
- package/dist/src/lib/sharing/ConsumeSharedModule.d.ts +97 -104
- package/dist/src/lib/sharing/ConsumeSharedModule.js +10 -5
- package/dist/src/lib/sharing/ConsumeSharedModule.js.map +1 -1
- package/dist/src/lib/sharing/ConsumeSharedPlugin.d.ts +28 -6
- package/dist/src/lib/sharing/ConsumeSharedPlugin.js +13 -6
- package/dist/src/lib/sharing/ConsumeSharedPlugin.js.map +1 -1
- package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.d.ts +29 -11
- package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.js +26 -166
- package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.js.map +1 -1
- package/dist/src/lib/sharing/ProvideForSharedDependency.d.ts +3 -11
- package/dist/src/lib/sharing/ProvideSharedDependency.d.ts +35 -31
- package/dist/src/lib/sharing/ProvideSharedDependency.js +11 -2
- package/dist/src/lib/sharing/ProvideSharedDependency.js.map +1 -1
- package/dist/src/lib/sharing/ProvideSharedModule.d.ts +65 -77
- package/dist/src/lib/sharing/ProvideSharedModule.js +31 -8
- package/dist/src/lib/sharing/ProvideSharedModule.js.map +1 -1
- package/dist/src/lib/sharing/ProvideSharedModuleFactory.d.ts +17 -10
- package/dist/src/lib/sharing/ProvideSharedModuleFactory.js +1 -1
- package/dist/src/lib/sharing/ProvideSharedModuleFactory.js.map +1 -1
- package/dist/src/lib/sharing/ProvideSharedPlugin.d.ts +37 -24
- package/dist/src/lib/sharing/ProvideSharedPlugin.js +12 -2
- package/dist/src/lib/sharing/ProvideSharedPlugin.js.map +1 -1
- package/dist/src/lib/sharing/SharePlugin.d.ts +39 -13
- package/dist/src/lib/sharing/SharePlugin.js +3 -0
- package/dist/src/lib/sharing/SharePlugin.js.map +1 -1
- package/dist/src/lib/sharing/ShareRuntimeModule.d.ts +12 -7
- package/dist/src/lib/sharing/ShareRuntimeModule.js +24 -51
- package/dist/src/lib/sharing/ShareRuntimeModule.js.map +1 -1
- package/dist/src/lib/sharing/resolveMatchedConfigs.d.ts +12 -8
- package/dist/src/lib/sharing/utils.d.ts +21 -17
- package/dist/src/lib/sharing/utils.js +17 -2
- package/dist/src/lib/sharing/utils.js.map +1 -1
- package/dist/src/schemas/container/ContainerPlugin.check.d.ts +7 -0
- package/dist/src/schemas/container/ContainerPlugin.check.js +2297 -0
- package/dist/src/schemas/container/ContainerPlugin.check.js.map +1 -0
- package/dist/src/schemas/container/ContainerPlugin.d.ts +268 -0
- package/dist/src/schemas/container/ContainerPlugin.js +306 -0
- package/dist/src/schemas/container/ContainerPlugin.js.map +1 -0
- package/dist/src/schemas/container/ContainerReferencePlugin.check.d.ts +7 -0
- package/dist/src/schemas/container/ContainerReferencePlugin.check.js +939 -0
- package/dist/src/schemas/container/ContainerReferencePlugin.check.js.map +1 -0
- package/dist/src/schemas/container/ContainerReferencePlugin.d.ts +87 -0
- package/dist/src/schemas/container/ContainerReferencePlugin.js +132 -0
- package/dist/src/schemas/container/ContainerReferencePlugin.js.map +1 -0
- package/dist/src/schemas/container/ModuleFederationPlugin.check.d.ts +9 -7
- package/dist/src/schemas/container/ModuleFederationPlugin.check.js +3653 -1341
- package/dist/src/schemas/container/ModuleFederationPlugin.check.js.map +1 -1
- package/dist/src/schemas/container/ModuleFederationPlugin.d.ts +13 -4
- package/dist/src/schemas/container/ModuleFederationPlugin.js +13 -4
- package/dist/src/schemas/container/ModuleFederationPlugin.js.map +1 -1
- package/dist/src/schemas/sharing/ProviderSharedPlugin.check.d.ts +7 -0
- package/dist/src/schemas/sharing/ProviderSharedPlugin.check.js +434 -0
- package/dist/src/schemas/sharing/ProviderSharedPlugin.check.js.map +1 -0
- package/dist/src/schemas/sharing/ProviderSharedPlugin.d.ts +104 -0
- package/dist/src/schemas/sharing/ProviderSharedPlugin.js +119 -0
- package/dist/src/schemas/sharing/ProviderSharedPlugin.js.map +1 -0
- package/dist/src/types/runtime.d.ts +7 -0
- package/dist/src/types/runtime.js +3 -0
- package/dist/src/types/runtime.js.map +1 -0
- package/dist/src/wrapper/AsyncBoundaryPlugin.d.ts +8 -0
- package/dist/src/wrapper/AsyncBoundaryPlugin.js +19 -0
- package/dist/src/wrapper/AsyncBoundaryPlugin.js.map +1 -0
- package/dist/src/wrapper/ConsumeSharedPlugin.d.ts +8 -0
- package/dist/src/wrapper/ConsumeSharedPlugin.js +19 -0
- package/dist/src/wrapper/ConsumeSharedPlugin.js.map +1 -0
- package/dist/src/wrapper/ContainerPlugin.d.ts +8 -0
- package/dist/src/wrapper/ContainerPlugin.js +19 -0
- package/dist/src/wrapper/ContainerPlugin.js.map +1 -0
- package/dist/src/wrapper/ContainerReferencePlugin.d.ts +8 -0
- package/dist/src/wrapper/ContainerReferencePlugin.js +19 -0
- package/dist/src/wrapper/ContainerReferencePlugin.js.map +1 -0
- package/dist/src/wrapper/FederationRuntimePlugin.d.ts +9 -0
- package/dist/src/wrapper/FederationRuntimePlugin.js +22 -0
- package/dist/src/wrapper/FederationRuntimePlugin.js.map +1 -0
- package/dist/src/wrapper/HoistContainerReferencesPlugin.d.ts +6 -0
- package/dist/src/wrapper/HoistContainerReferencesPlugin.js +18 -0
- package/dist/src/wrapper/HoistContainerReferencesPlugin.js.map +1 -0
- package/dist/src/wrapper/ModuleFederationPlugin.d.ts +8 -0
- package/dist/src/wrapper/ModuleFederationPlugin.js +24 -0
- package/dist/src/wrapper/ModuleFederationPlugin.js.map +1 -0
- package/dist/src/wrapper/ProvideSharedPlugin.d.ts +8 -0
- package/dist/src/wrapper/ProvideSharedPlugin.js +19 -0
- package/dist/src/wrapper/ProvideSharedPlugin.js.map +1 -0
- package/dist/src/wrapper/SharePlugin.d.ts +8 -0
- package/dist/src/wrapper/SharePlugin.js +19 -0
- package/dist/src/wrapper/SharePlugin.js.map +1 -0
- package/package.json +7 -3
- package/dist/src/runtime/ModuleInfoRuntimeModule.d.ts +0 -17
- package/dist/src/runtime/ModuleInfoRuntimeModule.js +0 -80
- package/dist/src/runtime/ModuleInfoRuntimeModule.js.map +0 -1
- package/dist/src/runtime/ModuleInfoRuntimePlugin.d.ts +0 -5
- package/dist/src/runtime/ModuleInfoRuntimePlugin.js +0 -24
- package/dist/src/runtime/ModuleInfoRuntimePlugin.js.map +0 -1
|
@@ -1,14 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
import { ContainerReferencePluginOptions } from '../../declarations/plugins/container/ContainerReferencePlugin';
|
|
1
|
+
export = ContainerReferencePlugin;
|
|
3
2
|
declare class ContainerReferencePlugin {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @param {ContainerReferencePluginOptions} options options
|
|
5
|
+
*/
|
|
6
|
+
constructor(options: ContainerReferencePluginOptions);
|
|
7
|
+
_remoteType: import('../../declarations/plugins/container/ContainerReferencePlugin').ExternalsType;
|
|
8
|
+
_remotes: [
|
|
9
|
+
string,
|
|
10
|
+
{
|
|
11
|
+
external: string[];
|
|
12
|
+
shareScope: string;
|
|
13
|
+
},
|
|
14
|
+
][];
|
|
15
|
+
/**
|
|
16
|
+
* Apply the plugin
|
|
17
|
+
* @param {Compiler} compiler the compiler instance
|
|
18
|
+
* @returns {void}
|
|
19
|
+
*/
|
|
20
|
+
apply(compiler: Compiler): void;
|
|
13
21
|
}
|
|
14
|
-
|
|
22
|
+
declare namespace ContainerReferencePlugin {
|
|
23
|
+
export { ContainerReferencePluginOptions, RemotesConfig, Compiler };
|
|
24
|
+
}
|
|
25
|
+
type Compiler = import('webpack/lib/Compiler');
|
|
26
|
+
type ContainerReferencePluginOptions =
|
|
27
|
+
import('../../declarations/plugins/container/ContainerReferencePlugin').ContainerReferencePluginOptions;
|
|
28
|
+
type RemotesConfig =
|
|
29
|
+
import('../../declarations/plugins/container/ContainerReferencePlugin').RemotesConfig;
|
|
@@ -12,11 +12,14 @@ const RemoteModule_1 = __importDefault(require("./RemoteModule"));
|
|
|
12
12
|
const RemoteRuntimeModule_1 = __importDefault(require("./RemoteRuntimeModule"));
|
|
13
13
|
const RemoteToExternalDependency_1 = __importDefault(require("./RemoteToExternalDependency"));
|
|
14
14
|
const options_1 = require("./options");
|
|
15
|
+
const FederationRuntimePlugin_1 = __importDefault(require("./runtime/FederationRuntimePlugin"));
|
|
16
|
+
const ContainerReferencePlugin_1 = __importDefault(require("../../schemas/container/ContainerReferencePlugin"));
|
|
17
|
+
const ContainerReferencePlugin_check_1 = __importDefault(require("../../schemas/container/ContainerReferencePlugin.check"));
|
|
15
18
|
const { ExternalsPlugin } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
|
|
16
19
|
const createSchemaValidation = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/create-schema-validation'));
|
|
17
20
|
const validate = createSchemaValidation(
|
|
18
21
|
//eslint-disable-next-line
|
|
19
|
-
|
|
22
|
+
ContainerReferencePlugin_check_1.default, () => ContainerReferencePlugin_1.default, {
|
|
20
23
|
name: 'Container Reference Plugin',
|
|
21
24
|
baseDataPath: 'options',
|
|
22
25
|
});
|
|
@@ -41,9 +44,8 @@ class ContainerReferencePlugin {
|
|
|
41
44
|
* @returns {void}
|
|
42
45
|
*/
|
|
43
46
|
apply(compiler) {
|
|
44
|
-
process.env['FEDERATION_WEBPACK_PATH'] =
|
|
45
|
-
process.env['FEDERATION_WEBPACK_PATH'] || (0, normalize_webpack_path_1.getWebpackPath)(compiler);
|
|
46
47
|
const { _remotes: remotes, _remoteType: remoteType } = this;
|
|
48
|
+
new FederationRuntimePlugin_1.default().apply(compiler);
|
|
47
49
|
/** @type {Record<string, string>} */
|
|
48
50
|
const remoteExternals = {};
|
|
49
51
|
for (const [key, config] of remotes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContainerReferencePlugin.js","sourceRoot":"","sources":["../../../../src/lib/container/ContainerReferencePlugin.ts"],"names":[],"mappings":";;;;;AAKA,0FAGuD;AAEvD,gEAAgE;AAChE,8EAAsD;AACtD,sFAA8D;AAC9D,oFAA4D;AAC5D,kEAA0C;AAC1C,gFAAwD;AACxD,8FAAsE;AACtE,uCAAyC;
|
|
1
|
+
{"version":3,"file":"ContainerReferencePlugin.js","sourceRoot":"","sources":["../../../../src/lib/container/ContainerReferencePlugin.ts"],"names":[],"mappings":";;;;;AAKA,0FAGuD;AAEvD,gEAAgE;AAChE,8EAAsD;AACtD,sFAA8D;AAC9D,oFAA4D;AAC5D,kEAA0C;AAC1C,gFAAwD;AACxD,8FAAsE;AACtE,uCAAyC;AAMzC,gGAAwE;AACxE,gHAAsE;AACtE,4HAAkF;AAElF,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CACjC,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAE9B,MAAM,sBAAsB,GAAG,OAAO,CACpC,IAAA,6CA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AAC,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;gBACxD,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;gBAC3D,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;gBACvD,WAAW,CAAC,gBAAgB,CAAC,KAAK,EAAE,IAAI,6BAAmB,EAAE,CAAC,CAAC;YACjE,CAAC,CAAC,CAAC;QACP,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAED,kBAAe,wBAAwB,CAAC"}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @param {ObjectSerializerContext} context context
|
|
17
|
-
*/
|
|
18
|
-
serialize(context: ObjectSerializerContext): void;
|
|
19
|
-
static deserialize(context: ObjectDeserializerContext): FallbackDependency;
|
|
1
|
+
export class FallbackDependency extends Dependency {
|
|
2
|
+
/**
|
|
3
|
+
* @param {ObjectDeserializerContext} context context
|
|
4
|
+
* @returns {FallbackDependency} deserialize fallback dependency
|
|
5
|
+
*/
|
|
6
|
+
static deserialize(context: ObjectDeserializerContext): FallbackDependency;
|
|
7
|
+
/**
|
|
8
|
+
* @param {string[]} requests requests
|
|
9
|
+
*/
|
|
10
|
+
constructor(requests: string[]);
|
|
11
|
+
requests: string[];
|
|
12
|
+
}
|
|
13
|
+
declare namespace FallbackDependency {
|
|
14
|
+
export { ObjectDeserializerContext, ObjectSerializerContext };
|
|
20
15
|
}
|
|
21
|
-
export default FallbackDependency;
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare class FallbackItemDependency extends
|
|
3
|
-
|
|
4
|
-
* @param {string} request request
|
|
5
|
-
*/
|
|
6
|
-
constructor(request: string);
|
|
7
|
-
get type(): string;
|
|
8
|
-
get category(): string;
|
|
9
|
-
}
|
|
10
|
-
export default FallbackItemDependency;
|
|
1
|
+
export = FallbackItemDependency;
|
|
2
|
+
declare class FallbackItemDependency extends ModuleDependency {}
|
|
3
|
+
import ModuleDependency = require('webpack/lib/dependencies/ModuleDependency');
|
|
@@ -1,72 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
import type { RequestShortener, LibIdentOptions, CodeGenerationContext, CodeGenerationResult, NeedBuildContext, WebpackError, ResolverWithOptions, InputFileSystem, Compilation, WebpackOptions, ObjectDeserializerContext, ObjectSerializerContext } from 'webpack/lib/Module';
|
|
3
|
-
declare const Module: typeof import("webpack").Module;
|
|
1
|
+
export = FallbackModule;
|
|
4
2
|
declare class FallbackModule extends Module {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* @param {RequestShortener} requestShortener the request shortener
|
|
17
|
-
* @returns {string} a user readable identifier of the module
|
|
18
|
-
*/
|
|
19
|
-
readableIdentifier(requestShortener: RequestShortener): string;
|
|
20
|
-
/**
|
|
21
|
-
* @param {LibIdentOptions} options options
|
|
22
|
-
* @returns {string | null} an identifier for library inclusion
|
|
23
|
-
*/
|
|
24
|
-
libIdent(options: LibIdentOptions): string | null;
|
|
25
|
-
/**
|
|
26
|
-
* @param {Chunk} chunk the chunk which condition should be checked
|
|
27
|
-
* @param {Compilation} compilation the compilation
|
|
28
|
-
* @returns {boolean} true, if the chunk is ok for the module
|
|
29
|
-
*/
|
|
30
|
-
chunkCondition(chunk: Chunk, { chunkGraph }: {
|
|
31
|
-
chunkGraph: ChunkGraph;
|
|
32
|
-
}): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* @param {NeedBuildContext} context context info
|
|
35
|
-
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
|
36
|
-
* @returns {void}
|
|
37
|
-
*/
|
|
38
|
-
needBuild(context: NeedBuildContext, callback: (error: WebpackError | null, result?: boolean) => void): void;
|
|
39
|
-
/**
|
|
40
|
-
* @param {WebpackOptions} options webpack options
|
|
41
|
-
* @param {Compilation} compilation the compilation
|
|
42
|
-
* @param {ResolverWithOptions} resolver the resolver
|
|
43
|
-
* @param {InputFileSystem} fs the file system
|
|
44
|
-
* @param {function(WebpackError=): void} callback callback function
|
|
45
|
-
* @returns {void}
|
|
46
|
-
*/
|
|
47
|
-
build(options: WebpackOptions, compilation: Compilation, resolver: ResolverWithOptions, fs: InputFileSystem, callback: (error?: WebpackError) => void): void;
|
|
48
|
-
/**
|
|
49
|
-
* @param {string=} type the source type for which the size should be estimated
|
|
50
|
-
* @returns {number} the estimated size of the module (must be non-zero)
|
|
51
|
-
*/
|
|
52
|
-
size(type?: string): number;
|
|
53
|
-
/**
|
|
54
|
-
* @returns {Set<string>} types available (do not mutate)
|
|
55
|
-
*/
|
|
56
|
-
getSourceTypes(): Set<string>;
|
|
57
|
-
/**
|
|
58
|
-
* @param {CodeGenerationContext} context context for code generation
|
|
59
|
-
* @returns {CodeGenerationResult} result
|
|
60
|
-
*/
|
|
61
|
-
codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph, }: CodeGenerationContext): CodeGenerationResult;
|
|
62
|
-
/**
|
|
63
|
-
* @param {ObjectSerializerContext} context context
|
|
64
|
-
*/
|
|
65
|
-
serialize(context: ObjectSerializerContext): void;
|
|
66
|
-
/**
|
|
67
|
-
* @param {ObjectDeserializerContext} context context
|
|
68
|
-
* @returns {FallbackModule} deserialized fallback module
|
|
69
|
-
*/
|
|
70
|
-
static deserialize(context: ObjectDeserializerContext): FallbackModule;
|
|
3
|
+
/**
|
|
4
|
+
* @param {ObjectDeserializerContext} context context
|
|
5
|
+
* @returns {FallbackModule} deserialized fallback module
|
|
6
|
+
*/
|
|
7
|
+
static deserialize(context: ObjectDeserializerContext): FallbackModule;
|
|
8
|
+
/**
|
|
9
|
+
* @param {string[]} requests list of requests to choose one
|
|
10
|
+
*/
|
|
11
|
+
constructor(requests: string[]);
|
|
12
|
+
requests: string[];
|
|
13
|
+
_identifier: string;
|
|
71
14
|
}
|
|
72
|
-
|
|
15
|
+
declare namespace FallbackModule {
|
|
16
|
+
export {
|
|
17
|
+
WebpackOptions,
|
|
18
|
+
Chunk,
|
|
19
|
+
ChunkGraph,
|
|
20
|
+
ChunkGroup,
|
|
21
|
+
Compilation,
|
|
22
|
+
CodeGenerationContext,
|
|
23
|
+
CodeGenerationResult,
|
|
24
|
+
LibIdentOptions,
|
|
25
|
+
NeedBuildContext,
|
|
26
|
+
RequestShortener,
|
|
27
|
+
ResolverWithOptions,
|
|
28
|
+
WebpackError,
|
|
29
|
+
ObjectDeserializerContext,
|
|
30
|
+
ObjectSerializerContext,
|
|
31
|
+
Hash,
|
|
32
|
+
InputFileSystem,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
import Module = require('webpack/lib/Module');
|
|
36
|
+
type ObjectDeserializerContext =
|
|
37
|
+
import('webpack/lib/serialization/ObjectMiddleware').ObjectDeserializerContext;
|
|
38
|
+
type WebpackOptions = any;
|
|
39
|
+
type Chunk = import('webpack/lib/Chunk');
|
|
40
|
+
type ChunkGraph = import('webpack/lib/ChunkGraph');
|
|
41
|
+
type ChunkGroup = import('webpack/lib/ChunkGroup');
|
|
42
|
+
type Compilation = import('webpack/lib/Compilation');
|
|
43
|
+
type CodeGenerationContext = import('webpack/lib/Module').CodeGenerationContext;
|
|
44
|
+
type CodeGenerationResult = import('webpack/lib/Module').CodeGenerationResult;
|
|
45
|
+
type LibIdentOptions = import('webpack/lib/Module').LibIdentOptions;
|
|
46
|
+
type NeedBuildContext = import('webpack/lib/Module').NeedBuildContext;
|
|
47
|
+
type RequestShortener = import('webpack/lib/RequestShortener');
|
|
48
|
+
type ResolverWithOptions =
|
|
49
|
+
import('webpack/lib/ResolverFactory').ResolverWithOptions;
|
|
50
|
+
type WebpackError = import('webpack/lib/WebpackError');
|
|
51
|
+
type ObjectSerializerContext =
|
|
52
|
+
import('webpack/lib/serialization/ObjectMiddleware').ObjectSerializerContext;
|
|
53
|
+
type Hash = import('webpack/lib/util/Hash');
|
|
54
|
+
type InputFileSystem = import('webpack/lib/util/fs').InputFileSystem;
|
|
@@ -9,10 +9,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
|
|
11
11
|
const FallbackItemDependency_1 = __importDefault(require("./FallbackItemDependency"));
|
|
12
|
+
const Constants_1 = require("../Constants");
|
|
12
13
|
const { sources: webpackSources } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
|
|
13
14
|
const { Template, Module, RuntimeGlobals } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
|
|
14
15
|
const makeSerializable = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/makeSerializable'));
|
|
15
|
-
const { WEBPACK_MODULE_TYPE_FALLBACK } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/ModuleTypeConstants'));
|
|
16
16
|
const TYPES = new Set(['javascript']);
|
|
17
17
|
const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]);
|
|
18
18
|
class FallbackModule extends Module {
|
|
@@ -20,7 +20,7 @@ class FallbackModule extends Module {
|
|
|
20
20
|
* @param {string[]} requests list of requests to choose one
|
|
21
21
|
*/
|
|
22
22
|
constructor(requests) {
|
|
23
|
-
super(WEBPACK_MODULE_TYPE_FALLBACK);
|
|
23
|
+
super(Constants_1.WEBPACK_MODULE_TYPE_FALLBACK);
|
|
24
24
|
this.requests = requests;
|
|
25
25
|
this._identifier = `fallback ${this.requests.join(' ')}`;
|
|
26
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FallbackModule.js","sourceRoot":"","sources":["../../../../src/lib/container/FallbackModule.ts"],"names":[],"mappings":"AAAA;;;EAGE;AAEF,YAAY,CAAC;;;;;AAEb,0FAAqF;AAgBrF,sFAA8D;
|
|
1
|
+
{"version":3,"file":"FallbackModule.js","sourceRoot":"","sources":["../../../../src/lib/container/FallbackModule.ts"],"names":[],"mappings":"AAAA;;;EAGE;AAEF,YAAY,CAAC;;;;;AAEb,0FAAqF;AAgBrF,sFAA8D;AAC9D,4CAA4D;AAE5D,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CACzC,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAC9B,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAClD,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAC9B,MAAM,gBAAgB,GAAG,OAAO,CAC9B,IAAA,6CAAoB,EAAC,mCAAmC,CAAC,CACJ,CAAC;AAExD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;AACtC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AAE9D,MAAM,cAAe,SAAQ,MAAM;IAIjC;;OAEG;IACH,YAAY,QAAkB;QAC5B,KAAK,CAAC,wCAA4B,CAAC,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,YAAY,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IAC3D,CAAC;IAED;;OAEG;IACM,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACM,kBAAkB,CAAC,gBAAkC;QAC5D,OAAO,I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,CAAC,OAAkC;QACnD,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QACzB,MAAM,GAAG,GAAG,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC;QACvC,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACzB,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED,gBAAgB,CAAC,cAAc,EAAE,uCAAuC,CAAC,CAAC;AAE1E,kBAAe,cAAc,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @param {ModuleFactoryCreateData} data data object
|
|
6
|
-
* @param {function((Error | null)=, ModuleFactoryResult=): void} callback callback
|
|
7
|
-
* @returns {void}
|
|
8
|
-
*/
|
|
9
|
-
create(data: ModuleFactoryCreateData, callback: (error: Error | null, result?: ModuleFactoryResult) => void): void;
|
|
1
|
+
export = FallbackModuleFactory;
|
|
2
|
+
declare class FallbackModuleFactory extends ModuleFactory {}
|
|
3
|
+
declare namespace FallbackModuleFactory {
|
|
4
|
+
export { ModuleFactoryCreateData, ModuleFactoryResult, FallbackDependency };
|
|
10
5
|
}
|
|
11
|
-
|
|
6
|
+
import ModuleFactory = require('webpack/lib/ModuleFactory');
|
|
7
|
+
type ModuleFactoryCreateData =
|
|
8
|
+
import('webpack/lib/ModuleFactory').ModuleFactoryCreateData;
|
|
9
|
+
type ModuleFactoryResult =
|
|
10
|
+
import('webpack/lib/ModuleFactory').ModuleFactoryResult;
|
|
11
|
+
type FallbackDependency = import('./FallbackDependency');
|
|
@@ -4,10 +4,9 @@ import type { Compiler, WebpackPluginInstance } from 'webpack';
|
|
|
4
4
|
* @constructor
|
|
5
5
|
*/
|
|
6
6
|
export declare class HoistContainerReferences implements WebpackPluginInstance {
|
|
7
|
-
/**
|
|
8
|
-
* @function apply
|
|
9
|
-
* @param {Compiler} compiler The webpack compiler object
|
|
10
|
-
*/
|
|
11
7
|
apply(compiler: Compiler): void;
|
|
8
|
+
private chunkContainsContainerEntryModule;
|
|
9
|
+
private hoistModulesInChunk;
|
|
10
|
+
private getRuntimeChunks;
|
|
12
11
|
}
|
|
13
12
|
export default HoistContainerReferences;
|
|
@@ -1,69 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.HoistContainerReferences = void 0;
|
|
7
|
+
const ContainerEntryModule_1 = __importDefault(require("./ContainerEntryModule"));
|
|
4
8
|
/**
|
|
5
9
|
* This class is used to hoist container references in the code.
|
|
6
10
|
* @constructor
|
|
7
11
|
*/
|
|
8
12
|
class HoistContainerReferences {
|
|
9
|
-
/**
|
|
10
|
-
* @function apply
|
|
11
|
-
* @param {Compiler} compiler The webpack compiler object
|
|
12
|
-
*/
|
|
13
13
|
apply(compiler) {
|
|
14
|
-
// Hook into the compilation process
|
|
15
14
|
compiler.hooks.thisCompilation.tap('HoistContainerReferences', (compilation) => {
|
|
16
|
-
|
|
17
|
-
compilation.hooks.afterOptimizeChunks.tap('HoistContainerReferences', (chunks, chunkGroups) => {
|
|
18
|
-
// Create a map to store chunks by their id or name
|
|
19
|
-
/** @type {Map<(string|number), Chunk>} */
|
|
20
|
-
const chunkSet = new Map();
|
|
21
|
-
// Create a set to store external module requests
|
|
22
|
-
/** @type {Set<Module>} */
|
|
23
|
-
const externalRequests = new Set();
|
|
24
|
-
// Populate the chunkSet with chunks
|
|
15
|
+
compilation.hooks.afterOptimizeChunks.tap('HoistContainerReferences', (chunks) => {
|
|
25
16
|
for (const chunk of chunks) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
chunkSet.set(ident, chunk);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
// Iterate over chunks again to handle remote modules
|
|
32
|
-
for (const chunk of chunks) {
|
|
33
|
-
// Get iterable of remote modules for the chunk
|
|
34
|
-
const remoteModules = compilation.chunkGraph.getChunkModulesIterableBySourceType(chunk, 'remote');
|
|
35
|
-
if (!remoteModules)
|
|
36
|
-
continue;
|
|
37
|
-
// Iterate over remote modules
|
|
38
|
-
for (const remoteModule of remoteModules) {
|
|
39
|
-
// Iterate over dependencies of the remote module
|
|
40
|
-
for (const dep of remoteModule.dependencies) {
|
|
41
|
-
// Get the module associated with the dependency
|
|
42
|
-
const mod = compilation.moduleGraph.getModule(dep);
|
|
43
|
-
// If the module exists and the chunk has a runtime, add the module to externalRequests
|
|
44
|
-
if (mod !== null && chunk.runtime) {
|
|
45
|
-
externalRequests.add(mod);
|
|
46
|
-
// Get the runtime chunk(s) associated with the chunk
|
|
47
|
-
const runtimeChunk = typeof chunk.runtime === 'string' ||
|
|
48
|
-
typeof chunk.runtime === 'number'
|
|
49
|
-
? [chunk.runtime]
|
|
50
|
-
: [...chunk.runtime];
|
|
51
|
-
// Iterate over runtime chunks
|
|
52
|
-
for (const runtimeChunkId of runtimeChunk) {
|
|
53
|
-
// Get the runtime chunk from the chunkSet
|
|
54
|
-
const runtimeChunk = chunkSet.get(runtimeChunkId);
|
|
55
|
-
// If the runtime chunk exists, connect it with the module in the chunk graph
|
|
56
|
-
if (runtimeChunk) {
|
|
57
|
-
compilation.chunkGraph.connectChunkAndModule(runtimeChunk, mod);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
17
|
+
if (this.chunkContainsContainerEntryModule(chunk, compilation)) {
|
|
18
|
+
this.hoistModulesInChunk(chunk, compilation);
|
|
62
19
|
}
|
|
63
20
|
}
|
|
64
21
|
});
|
|
65
22
|
});
|
|
66
23
|
}
|
|
24
|
+
chunkContainsContainerEntryModule(chunk, compilation) {
|
|
25
|
+
for (const module of compilation.chunkGraph.getChunkModulesIterable(chunk)) {
|
|
26
|
+
if (module instanceof ContainerEntryModule_1.default) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
hoistModulesInChunk(chunk, compilation) {
|
|
33
|
+
const chunkGraph = compilation.chunkGraph;
|
|
34
|
+
const runtimeChunks = this.getRuntimeChunks(chunk, compilation);
|
|
35
|
+
for (const module of chunkGraph.getChunkModulesIterable(chunk)) {
|
|
36
|
+
for (const runtimeChunk of runtimeChunks) {
|
|
37
|
+
chunkGraph.connectChunkAndModule(runtimeChunk, module);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
getRuntimeChunks(chunk, compilation) {
|
|
42
|
+
const runtimeChunks = [];
|
|
43
|
+
for (const c of compilation.chunks) {
|
|
44
|
+
if (c.hasRuntime() && c !== chunk) {
|
|
45
|
+
runtimeChunks.push(c);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return runtimeChunks;
|
|
49
|
+
}
|
|
67
50
|
}
|
|
68
51
|
exports.HoistContainerReferences = HoistContainerReferences;
|
|
69
52
|
exports.default = HoistContainerReferences;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HoistContainerReferencesPlugin.js","sourceRoot":"","sources":["../../../../src/lib/container/HoistContainerReferencesPlugin.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"HoistContainerReferencesPlugin.js","sourceRoot":"","sources":["../../../../src/lib/container/HoistContainerReferencesPlugin.ts"],"names":[],"mappings":";;;;;;AAMA,kFAA0D;AAE1D;;;GAGG;AACH,MAAa,wBAAwB;IACnC,KAAK,CAAC,QAAkB;QACtB,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAChC,0BAA0B,EAC1B,CAAC,WAAwB,EAAE,EAAE;YAC3B,WAAW,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CACvC,0BAA0B,EAC1B,CAAC,MAAuB,EAAE,EAAE;gBAC1B,KAAK,MAAM,KAAK,IAAI,MAA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ED,kBAAe,wBAAwB,CAAC"}
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ModuleFederationPluginOptions } from './ModuleFederationPluginTypes';
|
|
1
|
+
export = ModuleFederationPlugin;
|
|
3
2
|
declare class ModuleFederationPlugin {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @param {ModuleFederationPluginOptions} options options
|
|
5
|
+
*/
|
|
6
|
+
constructor(options: any);
|
|
7
|
+
name: string;
|
|
8
|
+
_options: any;
|
|
9
|
+
/**
|
|
10
|
+
* Apply the plugin
|
|
11
|
+
* @param {Compiler} compiler the compiler instance
|
|
12
|
+
* @returns {void}
|
|
13
|
+
*/
|
|
14
|
+
apply(compiler: Compiler): void;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
declare namespace ModuleFederationPlugin {
|
|
17
|
+
export { ExternalsType, ModuleFederationPluginOptions, Shared, Compiler };
|
|
18
|
+
}
|
|
19
|
+
type Compiler = import('webpack/lib/Compiler');
|
|
20
|
+
type ExternalsType = any;
|
|
21
|
+
type ModuleFederationPluginOptions =
|
|
22
|
+
import('../../declarations/plugins/container/ModuleFederationPlugin').ModuleFederationPluginOptions;
|
|
23
|
+
type Shared = any;
|
|
@@ -8,16 +8,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
|
|
11
|
-
const ExternalsType_check_js_1 = __importDefault(require("webpack/schemas/plugins/container/ExternalsType.check.js"));
|
|
12
11
|
const SharePlugin_1 = __importDefault(require("../sharing/SharePlugin"));
|
|
13
12
|
const ContainerPlugin_1 = __importDefault(require("./ContainerPlugin"));
|
|
14
13
|
const ContainerReferencePlugin_1 = __importDefault(require("./ContainerReferencePlugin"));
|
|
15
|
-
const
|
|
14
|
+
const ModuleFederationPlugin_check_1 = __importDefault(require("../../schemas/container/ModuleFederationPlugin.check"));
|
|
16
15
|
const ModuleFederationPlugin_1 = __importDefault(require("../../schemas/container/ModuleFederationPlugin"));
|
|
16
|
+
const FederationRuntimePlugin_1 = __importDefault(require("./runtime/FederationRuntimePlugin"));
|
|
17
|
+
const isValidExternalsType = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/schemas/plugins/container/ExternalsType.check.js'));
|
|
17
18
|
const createSchemaValidation = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/create-schema-validation'));
|
|
18
19
|
const validate = createSchemaValidation(
|
|
19
20
|
//eslint-disable-next-line
|
|
20
|
-
|
|
21
|
+
ModuleFederationPlugin_check_1.default, () => ModuleFederationPlugin_1.default, {
|
|
21
22
|
name: 'Module Federation Plugin',
|
|
22
23
|
baseDataPath: 'options',
|
|
23
24
|
});
|
|
@@ -35,23 +36,28 @@ class ModuleFederationPlugin {
|
|
|
35
36
|
* @returns {void}
|
|
36
37
|
*/
|
|
37
38
|
apply(compiler) {
|
|
38
|
-
process.env['FEDERATION_WEBPACK_PATH'] =
|
|
39
|
-
process.env['FEDERATION_WEBPACK_PATH'] || (0, normalize_webpack_path_1.getWebpackPath)(compiler);
|
|
40
39
|
const { _options: options } = this;
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
new FederationRuntimePlugin_1.default(options).apply(compiler);
|
|
41
42
|
const library = options.library || { type: 'var', name: options.name };
|
|
42
43
|
const remoteType = options.remoteType ||
|
|
43
|
-
(options.library && (
|
|
44
|
+
(options.library && isValidExternalsType(options.library.type)
|
|
44
45
|
? options.library.type
|
|
45
46
|
: 'script');
|
|
47
|
+
const useContainerPlugin = options.exposes &&
|
|
48
|
+
(Array.isArray(options.exposes)
|
|
49
|
+
? options.exposes.length > 0
|
|
50
|
+
: Object.keys(options.exposes).length > 0);
|
|
51
|
+
if (useContainerPlugin) {
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
ContainerPlugin_1.default.patchChunkSplit(compiler, this._options.name);
|
|
54
|
+
}
|
|
46
55
|
if (library &&
|
|
47
56
|
!compiler.options.output.enabledLibraryTypes?.includes(library.type)) {
|
|
48
57
|
compiler.options.output.enabledLibraryTypes?.push(library.type);
|
|
49
58
|
}
|
|
50
59
|
compiler.hooks.afterPlugins.tap('ModuleFederationPlugin', () => {
|
|
51
|
-
if (
|
|
52
|
-
(Array.isArray(options.exposes)
|
|
53
|
-
? options.exposes.length > 0
|
|
54
|
-
: Object.keys(options.exposes).length > 0)) {
|
|
60
|
+
if (useContainerPlugin) {
|
|
55
61
|
new ContainerPlugin_1.default({
|
|
56
62
|
//@ts-ignore
|
|
57
63
|
name: options.name,
|
|
@@ -59,7 +65,10 @@ class ModuleFederationPlugin {
|
|
|
59
65
|
filename: options.filename,
|
|
60
66
|
runtime: options.runtime,
|
|
61
67
|
shareScope: options.shareScope,
|
|
68
|
+
//@ts-ignore
|
|
62
69
|
exposes: options.exposes,
|
|
70
|
+
runtimePlugins: options.runtimePlugins,
|
|
71
|
+
//@ts-ignore
|
|
63
72
|
}).apply(compiler);
|
|
64
73
|
}
|
|
65
74
|
if (options.remotes &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleFederationPlugin.js","sourceRoot":"","sources":["../../../../src/lib/container/ModuleFederationPlugin.ts"],"names":[],"mappings":"AAAA;;;EAGE;AAEF,YAAY,CAAC;;;;;AAGb,
|
|
1
|
+
{"version":3,"file":"ModuleFederationPlugin.js","sourceRoot":"","sources":["../../../../src/lib/container/ModuleFederationPlugin.ts"],"names":[],"mappings":"AAAA;;;EAGE;AAEF,YAAY,CAAC;;;;;AAGb,0FAAqF;AAErF,yEAAiD;AACjD,wEAAgD;AAChD,0FAAkE;AAClE,wHAAgF;AAChF,4GAAoE;AACpE,gGAAwE;AAExE,MAAM,oB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