@module-federation/enhanced 0.0.0-canary-1701764602388
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/global.d.js +14 -0
- package/global.d.js.map +1 -0
- package/package.json +19 -0
- package/src/declarations/plugins/container/AsyncDependenciesBlock.d.js +14 -0
- package/src/declarations/plugins/container/AsyncDependenciesBlock.d.js.map +1 -0
- package/src/declarations/plugins/container/ContainerPlugin.d.js +12 -0
- package/src/declarations/plugins/container/ContainerPlugin.d.js.map +1 -0
- package/src/declarations/plugins/container/ContainerReferencePlugin.d.js +12 -0
- package/src/declarations/plugins/container/ContainerReferencePlugin.d.js.map +1 -0
- package/src/declarations/plugins/container/Dependency.d.js +14 -0
- package/src/declarations/plugins/container/Dependency.d.js.map +1 -0
- package/src/declarations/plugins/container/Module.d.js +3 -0
- package/src/declarations/plugins/container/Module.d.js.map +1 -0
- package/src/declarations/plugins/container/ModuleFactory.d.js +3 -0
- package/src/declarations/plugins/container/ModuleFactory.d.js.map +1 -0
- package/src/declarations/plugins/container/ModuleFederationPlugin.d.js +12 -0
- package/src/declarations/plugins/container/ModuleFederationPlugin.d.js.map +1 -0
- package/src/declarations/plugins/container/ObjectDeserializerContext.d.js +6 -0
- package/src/declarations/plugins/container/ObjectDeserializerContext.d.js.map +1 -0
- package/src/declarations/plugins/container/StaticExportsDependency.d.js +14 -0
- package/src/declarations/plugins/container/StaticExportsDependency.d.js.map +1 -0
- package/src/declarations/plugins/container/Template.d.js +4 -0
- package/src/declarations/plugins/container/Template.d.js.map +1 -0
- package/src/declarations/plugins/container/WebpackError.d.js +3 -0
- package/src/declarations/plugins/container/WebpackError.d.js.map +1 -0
- package/src/declarations/plugins/container/WebpackOptions.d.js +6 -0
- package/src/declarations/plugins/container/WebpackOptions.d.js.map +1 -0
- package/src/declarations/plugins/sharing/ConsumeSharedPlugin.d.js +12 -0
- package/src/declarations/plugins/sharing/ConsumeSharedPlugin.d.js.map +1 -0
- package/src/declarations/plugins/sharing/ProvideSharedPlugin.d.js +12 -0
- package/src/declarations/plugins/sharing/ProvideSharedPlugin.d.js.map +1 -0
- package/src/declarations/plugins/sharing/SharePlugin.d.js +12 -0
- package/src/declarations/plugins/sharing/SharePlugin.d.js.map +1 -0
- package/src/index.d.ts +7 -0
- package/src/index.js +43 -0
- package/src/index.js.map +1 -0
- package/src/lib/Constants.d.ts +117 -0
- package/src/lib/Constants.js +103 -0
- package/src/lib/Constants.js.map +1 -0
- package/src/lib/RuntimeGlobals.d.ts +0 -0
- package/src/lib/RuntimeGlobals.js +246 -0
- package/src/lib/RuntimeGlobals.js.map +1 -0
- package/src/lib/container/AsyncBoundaryPlugin.d.ts +21 -0
- package/src/lib/container/AsyncBoundaryPlugin.js +180 -0
- package/src/lib/container/AsyncBoundaryPlugin.js.map +1 -0
- package/src/lib/container/ContainerEntryDependency.d.js +4 -0
- package/src/lib/container/ContainerEntryDependency.d.js.map +1 -0
- package/src/lib/container/ContainerEntryDependency.d.ts +22 -0
- package/src/lib/container/ContainerEntryDependency.js +45 -0
- package/src/lib/container/ContainerEntryDependency.js.map +1 -0
- package/src/lib/container/ContainerEntryModule.d.js +14 -0
- package/src/lib/container/ContainerEntryModule.d.js.map +1 -0
- package/src/lib/container/ContainerEntryModule.d.ts +86 -0
- package/src/lib/container/ContainerEntryModule.js +260 -0
- package/src/lib/container/ContainerEntryModule.js.map +1 -0
- package/src/lib/container/ContainerEntryModuleFactory.d.js +4 -0
- package/src/lib/container/ContainerEntryModuleFactory.d.js.map +1 -0
- package/src/lib/container/ContainerEntryModuleFactory.d.ts +10 -0
- package/src/lib/container/ContainerEntryModuleFactory.js +32 -0
- package/src/lib/container/ContainerEntryModuleFactory.js.map +1 -0
- package/src/lib/container/ContainerExposedDependency.d.js +4 -0
- package/src/lib/container/ContainerExposedDependency.d.js.map +1 -0
- package/src/lib/container/ContainerExposedDependency.d.ts +26 -0
- package/src/lib/container/ContainerExposedDependency.js +53 -0
- package/src/lib/container/ContainerExposedDependency.js.map +1 -0
- package/src/lib/container/ContainerPlugin.d.js +4 -0
- package/src/lib/container/ContainerPlugin.d.js.map +1 -0
- package/src/lib/container/ContainerPlugin.d.ts +13 -0
- package/src/lib/container/ContainerPlugin.js +167 -0
- package/src/lib/container/ContainerPlugin.js.map +1 -0
- package/src/lib/container/ContainerReferencePlugin.d.js +4 -0
- package/src/lib/container/ContainerReferencePlugin.d.js.map +1 -0
- package/src/lib/container/ContainerReferencePlugin.d.ts +14 -0
- package/src/lib/container/ContainerReferencePlugin.js +102 -0
- package/src/lib/container/ContainerReferencePlugin.js.map +1 -0
- package/src/lib/container/FallbackDependency.d.js +14 -0
- package/src/lib/container/FallbackDependency.d.js.map +1 -0
- package/src/lib/container/FallbackDependency.d.ts +25 -0
- package/src/lib/container/FallbackDependency.js +55 -0
- package/src/lib/container/FallbackDependency.js.map +1 -0
- package/src/lib/container/FallbackItemDependency.d.js +4 -0
- package/src/lib/container/FallbackItemDependency.d.js.map +1 -0
- package/src/lib/container/FallbackItemDependency.d.ts +10 -0
- package/src/lib/container/FallbackItemDependency.js +33 -0
- package/src/lib/container/FallbackItemDependency.js.map +1 -0
- package/src/lib/container/FallbackModule.d.js +4 -0
- package/src/lib/container/FallbackModule.d.js.map +1 -0
- package/src/lib/container/FallbackModule.d.ts +73 -0
- package/src/lib/container/FallbackModule.js +149 -0
- package/src/lib/container/FallbackModule.js.map +1 -0
- package/src/lib/container/FallbackModuleFactory.d.js +4 -0
- package/src/lib/container/FallbackModuleFactory.d.js.map +1 -0
- package/src/lib/container/FallbackModuleFactory.d.ts +10 -0
- package/src/lib/container/FallbackModuleFactory.js +30 -0
- package/src/lib/container/FallbackModuleFactory.js.map +1 -0
- package/src/lib/container/HoistContainerReferencesPlugin.d.ts +19 -0
- package/src/lib/container/HoistContainerReferencesPlugin.js +78 -0
- package/src/lib/container/HoistContainerReferencesPlugin.js.map +1 -0
- package/src/lib/container/ModuleFederationPlugin.d.js +4 -0
- package/src/lib/container/ModuleFederationPlugin.d.js.map +1 -0
- package/src/lib/container/ModuleFederationPlugin.d.ts +17 -0
- package/src/lib/container/ModuleFederationPlugin.js +93 -0
- package/src/lib/container/ModuleFederationPlugin.js.map +1 -0
- package/src/lib/container/ModuleFederationPluginTypes.d.js +12 -0
- package/src/lib/container/ModuleFederationPluginTypes.d.js.map +1 -0
- package/src/lib/container/RemoteModule.d.js +13 -0
- package/src/lib/container/RemoteModule.d.js.map +1 -0
- package/src/lib/container/RemoteModule.d.ts +78 -0
- package/src/lib/container/RemoteModule.js +150 -0
- package/src/lib/container/RemoteModule.js.map +1 -0
- package/src/lib/container/RemoteRuntimeModule.d.js +13 -0
- package/src/lib/container/RemoteRuntimeModule.d.js.map +1 -0
- package/src/lib/container/RemoteRuntimeModule.d.ts +9 -0
- package/src/lib/container/RemoteRuntimeModule.js +98 -0
- package/src/lib/container/RemoteRuntimeModule.js.map +1 -0
- package/src/lib/container/RemoteToExternalDependency.d.js +15 -0
- package/src/lib/container/RemoteToExternalDependency.d.js.map +1 -0
- package/src/lib/container/RemoteToExternalDependency.d.ts +10 -0
- package/src/lib/container/RemoteToExternalDependency.js +33 -0
- package/src/lib/container/RemoteToExternalDependency.js.map +1 -0
- package/src/lib/container/constant.d.ts +3 -0
- package/src/lib/container/constant.js +26 -0
- package/src/lib/container/constant.js.map +1 -0
- package/src/lib/container/options.d.js +6 -0
- package/src/lib/container/options.d.js.map +1 -0
- package/src/lib/container/options.d.ts +18 -0
- package/src/lib/container/options.js +91 -0
- package/src/lib/container/options.js.map +1 -0
- package/src/lib/container/runtime/FederationRuntimeEntryDependency.d.ts +7 -0
- package/src/lib/container/runtime/FederationRuntimeEntryDependency.js +37 -0
- package/src/lib/container/runtime/FederationRuntimeEntryDependency.js.map +1 -0
- package/src/lib/container/runtime/FederationRuntimeModule.d.ts +13 -0
- package/src/lib/container/runtime/FederationRuntimeModule.js +31 -0
- package/src/lib/container/runtime/FederationRuntimeModule.js.map +1 -0
- package/src/lib/container/runtime/FederationRuntimePlugin.d.ts +17 -0
- package/src/lib/container/runtime/FederationRuntimePlugin.js +223 -0
- package/src/lib/container/runtime/FederationRuntimePlugin.js.map +1 -0
- package/src/lib/container/runtime/InitializeRemoteEntryRuntimePlugin.d.ts +6 -0
- package/src/lib/container/runtime/InitializeRemoteEntryRuntimePlugin.js +26 -0
- package/src/lib/container/runtime/InitializeRemoteEntryRuntimePlugin.js.map +1 -0
- package/src/lib/container/runtime/getFederationGlobal.d.ts +5 -0
- package/src/lib/container/runtime/getFederationGlobal.js +42 -0
- package/src/lib/container/runtime/getFederationGlobal.js.map +1 -0
- package/src/lib/container/runtime/utils.d.ts +15 -0
- package/src/lib/container/runtime/utils.js +95 -0
- package/src/lib/container/runtime/utils.js.map +1 -0
- package/src/lib/sharing/ConsumeSharedFallbackDependency.d.js +4 -0
- package/src/lib/sharing/ConsumeSharedFallbackDependency.d.js.map +1 -0
- package/src/lib/sharing/ConsumeSharedFallbackDependency.d.ts +10 -0
- package/src/lib/sharing/ConsumeSharedFallbackDependency.js +33 -0
- package/src/lib/sharing/ConsumeSharedFallbackDependency.js.map +1 -0
- package/src/lib/sharing/ConsumeSharedModule.d.js +4 -0
- package/src/lib/sharing/ConsumeSharedModule.d.js.map +1 -0
- package/src/lib/sharing/ConsumeSharedModule.d.ts +106 -0
- package/src/lib/sharing/ConsumeSharedModule.js +195 -0
- package/src/lib/sharing/ConsumeSharedModule.js.map +1 -0
- package/src/lib/sharing/ConsumeSharedPlugin.d.js +4 -0
- package/src/lib/sharing/ConsumeSharedPlugin.d.js.map +1 -0
- package/src/lib/sharing/ConsumeSharedPlugin.d.ts +8 -0
- package/src/lib/sharing/ConsumeSharedPlugin.js +225 -0
- package/src/lib/sharing/ConsumeSharedPlugin.js.map +1 -0
- package/src/lib/sharing/ConsumeSharedRuntimeModule.d.js +4 -0
- package/src/lib/sharing/ConsumeSharedRuntimeModule.d.js.map +1 -0
- package/src/lib/sharing/ConsumeSharedRuntimeModule.d.ts +13 -0
- package/src/lib/sharing/ConsumeSharedRuntimeModule.js +310 -0
- package/src/lib/sharing/ConsumeSharedRuntimeModule.js.map +1 -0
- package/src/lib/sharing/ProvideForSharedDependency.d.js +4 -0
- package/src/lib/sharing/ProvideForSharedDependency.d.js.map +1 -0
- package/src/lib/sharing/ProvideForSharedDependency.d.ts +11 -0
- package/src/lib/sharing/ProvideForSharedDependency.js +34 -0
- package/src/lib/sharing/ProvideForSharedDependency.js.map +1 -0
- package/src/lib/sharing/ProvideSharedDependency.d.js +14 -0
- package/src/lib/sharing/ProvideSharedDependency.d.js.map +1 -0
- package/src/lib/sharing/ProvideSharedDependency.d.ts +32 -0
- package/src/lib/sharing/ProvideSharedDependency.js +65 -0
- package/src/lib/sharing/ProvideSharedDependency.js.map +1 -0
- package/src/lib/sharing/ProvideSharedModule.d.js +4 -0
- package/src/lib/sharing/ProvideSharedModule.d.js.map +1 -0
- package/src/lib/sharing/ProvideSharedModule.d.ts +79 -0
- package/src/lib/sharing/ProvideSharedModule.js +169 -0
- package/src/lib/sharing/ProvideSharedModule.js.map +1 -0
- package/src/lib/sharing/ProvideSharedModuleFactory.d.js +4 -0
- package/src/lib/sharing/ProvideSharedModuleFactory.d.js.map +1 -0
- package/src/lib/sharing/ProvideSharedModuleFactory.d.ts +11 -0
- package/src/lib/sharing/ProvideSharedModuleFactory.js +32 -0
- package/src/lib/sharing/ProvideSharedModuleFactory.js.map +1 -0
- package/src/lib/sharing/ProvideSharedPlugin.d.js +4 -0
- package/src/lib/sharing/ProvideSharedPlugin.d.js.map +1 -0
- package/src/lib/sharing/ProvideSharedPlugin.d.ts +34 -0
- package/src/lib/sharing/ProvideSharedPlugin.js +168 -0
- package/src/lib/sharing/ProvideSharedPlugin.js.map +1 -0
- package/src/lib/sharing/SharePlugin.d.js +4 -0
- package/src/lib/sharing/SharePlugin.d.js.map +1 -0
- package/src/lib/sharing/SharePlugin.d.ts +15 -0
- package/src/lib/sharing/SharePlugin.js +73 -0
- package/src/lib/sharing/SharePlugin.js.map +1 -0
- package/src/lib/sharing/ShareRuntimeModule.d.js +4 -0
- package/src/lib/sharing/ShareRuntimeModule.d.js.map +1 -0
- package/src/lib/sharing/ShareRuntimeModule.d.ts +9 -0
- package/src/lib/sharing/ShareRuntimeModule.js +95 -0
- package/src/lib/sharing/ShareRuntimeModule.js.map +1 -0
- package/src/lib/sharing/resolveMatchedConfigs.d.js +6 -0
- package/src/lib/sharing/resolveMatchedConfigs.d.js.map +1 -0
- package/src/lib/sharing/resolveMatchedConfigs.d.ts +8 -0
- package/src/lib/sharing/resolveMatchedConfigs.js +69 -0
- package/src/lib/sharing/resolveMatchedConfigs.js.map +1 -0
- package/src/lib/sharing/utils.d.js +6 -0
- package/src/lib/sharing/utils.d.js.map +1 -0
- package/src/lib/sharing/utils.d.ts +45 -0
- package/src/lib/sharing/utils.js +348 -0
- package/src/lib/sharing/utils.js.map +1 -0
- package/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +5 -0
- package/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js +34 -0
- package/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js.map +1 -0
- package/src/runtime/ModuleInfoRuntimeModule.d.ts +16 -0
- package/src/runtime/ModuleInfoRuntimeModule.js +88 -0
- package/src/runtime/ModuleInfoRuntimeModule.js.map +1 -0
- package/src/runtime/ModuleInfoRuntimePlugin.d.ts +5 -0
- package/src/runtime/ModuleInfoRuntimePlugin.js +29 -0
- package/src/runtime/ModuleInfoRuntimePlugin.js.map +1 -0
- package/src/schemas/container/ContainerPlugin.check.d.ts +7 -0
- package/src/schemas/container/ContainerPlugin.check.js +2229 -0
- package/src/schemas/container/ContainerPlugin.check.js.map +1 -0
- package/src/schemas/container/ContainerPlugin.d.ts +268 -0
- package/src/schemas/container/ContainerPlugin.js +324 -0
- package/src/schemas/container/ContainerPlugin.js.map +1 -0
- package/src/schemas/container/ModuleFederationPlugin.check.d.ts +7 -0
- package/src/schemas/container/ModuleFederationPlugin.check.js +3818 -0
- package/src/schemas/container/ModuleFederationPlugin.check.js.map +1 -0
- package/src/schemas/container/ModuleFederationPlugin.d.ts +441 -0
- package/src/schemas/container/ModuleFederationPlugin.js +556 -0
- package/src/schemas/container/ModuleFederationPlugin.js.map +1 -0
- package/src/types/runtime.d.ts +7 -0
- package/src/types/runtime.js +6 -0
- package/src/types/runtime.js.map +1 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr
|
|
4
|
+
*/ "use strict";
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "default", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function() {
|
|
11
|
+
return _default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
15
|
+
const _ModuleDependency = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/dependencies/ModuleDependency"));
|
|
16
|
+
const _makeSerializable = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/util/makeSerializable"));
|
|
17
|
+
let ContainerExposedDependency = class ContainerExposedDependency extends _ModuleDependency.default {
|
|
18
|
+
get type() {
|
|
19
|
+
return 'container exposed';
|
|
20
|
+
}
|
|
21
|
+
get category() {
|
|
22
|
+
return 'esm';
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @returns {string | null} an identifier to merge equal requests
|
|
26
|
+
*/ getResourceIdentifier() {
|
|
27
|
+
return `exposed dependency ${this.exposedName}=${this.request}`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @param {ObjectSerializerContext} context context
|
|
31
|
+
*/ serialize(context) {
|
|
32
|
+
context.write(this.exposedName);
|
|
33
|
+
super.serialize(context);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @param {ObjectDeserializerContext} context context
|
|
37
|
+
*/ deserialize(context) {
|
|
38
|
+
this.exposedName = context.read();
|
|
39
|
+
super.deserialize(context);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @param {string} exposedName public name
|
|
43
|
+
* @param {string} request request to module
|
|
44
|
+
*/ constructor(exposedName, request){
|
|
45
|
+
super(request);
|
|
46
|
+
this.exposedName = exposedName;
|
|
47
|
+
this.request = request;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
(0, _makeSerializable.default)(ContainerExposedDependency, 'enhanced/lib/container/ContainerExposedDependency');
|
|
51
|
+
const _default = ContainerExposedDependency;
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=ContainerExposedDependency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerExposedDependency.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr\n*/\n\nimport type {\n ObjectDeserializerContext,\n ObjectSerializerContext,\n} from 'webpack/lib/dependencies/ModuleDependency';\nimport ModuleDependency from 'webpack/lib/dependencies/ModuleDependency';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\n\nclass ContainerExposedDependency extends ModuleDependency {\n exposedName: string;\n override request: string;\n\n /**\n * @param {string} exposedName public name\n * @param {string} request request to module\n */\n constructor(exposedName: string, request: string) {\n super(request);\n this.exposedName = exposedName;\n this.request = request;\n }\n\n override get type(): string {\n return 'container exposed';\n }\n\n override get category(): string {\n return 'esm';\n }\n\n /**\n * @returns {string | null} an identifier to merge equal requests\n */\n override getResourceIdentifier(): string | null {\n return `exposed dependency ${this.exposedName}=${this.request}`;\n }\n\n /**\n * @param {ObjectSerializerContext} context context\n */\n override serialize(context: ObjectSerializerContext): void {\n context.write(this.exposedName);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n */\n override deserialize(context: ObjectDeserializerContext): void {\n this.exposedName = context.read();\n super.deserialize(context);\n }\n}\n\nmakeSerializable(\n ContainerExposedDependency,\n 'enhanced/lib/container/ContainerExposedDependency',\n);\n\nexport default ContainerExposedDependency;\n"],"names":["ContainerExposedDependency","ModuleDependency","type","category","getResourceIdentifier","exposedName","request","serialize","context","write","deserialize","read","constructor","makeSerializable"],"mappings":"AAAA;;;AAGA;;;;+BA4DA;;;eAAA;;;;2EAtD6B;2EACA;AAE7B,IAAA,AAAMA,6BAAN,MAAMA,mCAAmCC,yBAAgB;IAcvD,IAAaC,OAAe;QAC1B,OAAO;IACT;IAEA,IAAaC,WAAmB;QAC9B,OAAO;IACT;IAEA;;GAEC,GACD,AAASC,wBAAuC;QAC9C,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAACC,WAAW,CAAC,CAAC,EAAE,IAAI,CAACC,OAAO,CAAC,CAAC;IACjE;IAEA;;GAEC,GACD,AAASC,UAAUC,OAAgC,EAAQ;QACzDA,QAAQC,KAAK,CAAC,IAAI,CAACJ,WAAW;QAC9B,KAAK,CAACE,UAAUC;IAClB;IAEA;;GAEC,GACD,AAASE,YAAYF,OAAkC,EAAQ;QAC7D,IAAI,CAACH,WAAW,GAAGG,QAAQG,IAAI;QAC/B,KAAK,CAACD,YAAYF;IACpB;IAvCA;;;GAGC,GACDI,YAAYP,WAAmB,EAAEC,OAAe,CAAE;QAChD,KAAK,CAACA;QACN,IAAI,CAACD,WAAW,GAAGA;QACnB,IAAI,CAACC,OAAO,GAAGA;IACjB;AAgCF;AAEAO,IAAAA,yBAAgB,EACdb,4BACA;MAGF,WAAeA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerPlugin.d.ts"],"sourcesContent":["export = ContainerPlugin;\ndeclare class ContainerPlugin {\n /**\n * @param {ContainerPluginOptions} options options\n */\n constructor(options: ContainerPluginOptions);\n name: string;\n _options: {\n name: string;\n shareScope: string;\n library: import('../../declarations/plugins/container/ContainerPlugin').LibraryOptions;\n runtime: import('../../declarations/plugins/container/ContainerPlugin').EntryRuntime;\n filename: string;\n exposes: [\n string,\n {\n import: string[];\n name: any;\n },\n ][];\n };\n /**\n * Apply the plugin\n * @param {Compiler} compiler the compiler instance\n * @returns {void}\n */\n apply(compiler: Compiler): void;\n}\ndeclare namespace ContainerPlugin {\n export { ContainerPluginOptions, Compiler };\n}\ntype Compiler = import('webpack/lib/Compiler');\ntype ContainerPluginOptions =\n import('../../declarations/plugins/container/ContainerPlugin').ContainerPluginOptions;\n"],"names":["ContainerPlugin"],"mappings":";iBAASA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Compiler } from 'webpack';
|
|
2
|
+
import type { ContainerPluginOptions } from '../../declarations/plugins/container/ContainerPlugin';
|
|
3
|
+
declare class ContainerPlugin {
|
|
4
|
+
_options: ContainerPluginOptions;
|
|
5
|
+
name: string;
|
|
6
|
+
/**
|
|
7
|
+
* @param {ContainerPluginOptions} options options
|
|
8
|
+
*/
|
|
9
|
+
constructor(options: ContainerPluginOptions);
|
|
10
|
+
static patchChunkSplit(compiler: Compiler, name: string): void;
|
|
11
|
+
apply(compiler: Compiler): void;
|
|
12
|
+
}
|
|
13
|
+
export default ContainerPlugin;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr
|
|
4
|
+
*/ //@ts-ignore
|
|
5
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
Object.defineProperty(exports, "default", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return _default;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
16
|
+
const _createschemavalidation = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/util/create-schema-validation"));
|
|
17
|
+
const _ContainerEntryDependency = /*#__PURE__*/ _interop_require_default._(require("./ContainerEntryDependency"));
|
|
18
|
+
const _ContainerEntryModuleFactory = /*#__PURE__*/ _interop_require_default._(require("./ContainerEntryModuleFactory"));
|
|
19
|
+
const _ContainerExposedDependency = /*#__PURE__*/ _interop_require_default._(require("./ContainerExposedDependency"));
|
|
20
|
+
const _options = require("./options");
|
|
21
|
+
const _FederationRuntimePlugin = /*#__PURE__*/ _interop_require_default._(require("./runtime/FederationRuntimePlugin"));
|
|
22
|
+
const _ContainerPlugincheck = /*#__PURE__*/ _interop_require_default._(require("../../schemas/container/ContainerPlugin.check"));
|
|
23
|
+
const _ContainerPlugin = /*#__PURE__*/ _interop_require_default._(require("../../schemas/container/ContainerPlugin"));
|
|
24
|
+
const validate = (0, _createschemavalidation.default)(_ContainerPlugincheck.default, ()=>_ContainerPlugin.default, {
|
|
25
|
+
name: 'Container Plugin',
|
|
26
|
+
baseDataPath: 'options'
|
|
27
|
+
});
|
|
28
|
+
const PLUGIN_NAME = 'ContainerPlugin';
|
|
29
|
+
let ContainerPlugin = class ContainerPlugin {
|
|
30
|
+
// container should not be affected by splitChunks
|
|
31
|
+
static patchChunkSplit(compiler, name) {
|
|
32
|
+
const { splitChunks } = compiler.options.optimization;
|
|
33
|
+
const patchChunkSplit = (cacheGroup)=>{
|
|
34
|
+
switch(typeof cacheGroup){
|
|
35
|
+
case 'boolean':
|
|
36
|
+
case 'string':
|
|
37
|
+
case 'function':
|
|
38
|
+
break;
|
|
39
|
+
// cacheGroup.chunks 会继承 splitChunks.chunks ,因此只需要对单独设置了 chunks 的 做修改
|
|
40
|
+
case 'object':
|
|
41
|
+
{
|
|
42
|
+
if (cacheGroup instanceof RegExp) {
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
if (!cacheGroup.chunks) {
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
if (typeof cacheGroup.chunks === 'function') {
|
|
49
|
+
const prevChunks = cacheGroup.chunks;
|
|
50
|
+
cacheGroup.chunks = (chunk)=>{
|
|
51
|
+
if (chunk.name && chunk.name === name) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return prevChunks(chunk);
|
|
55
|
+
};
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
if (cacheGroup.chunks === 'all') {
|
|
59
|
+
cacheGroup.chunks = (chunk)=>{
|
|
60
|
+
if (chunk.name && chunk.name === name) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
};
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
if (cacheGroup.chunks === 'initial') {
|
|
68
|
+
cacheGroup.chunks = (chunk)=>{
|
|
69
|
+
if (chunk.name && chunk.name === name) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return chunk.isOnlyInitial();
|
|
73
|
+
};
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
if (!splitChunks) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
// 修改 splitChunk.chunks
|
|
84
|
+
patchChunkSplit(splitChunks);
|
|
85
|
+
const cacheGroups = splitChunks.cacheGroups;
|
|
86
|
+
if (!cacheGroups) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
// 修改 splitChunk.cacheGroups[key].chunks
|
|
90
|
+
Object.keys(cacheGroups).forEach((cacheGroupKey)=>{
|
|
91
|
+
patchChunkSplit(cacheGroups[cacheGroupKey]);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
apply(compiler) {
|
|
95
|
+
const useModuleFederationPlugin = compiler.options.plugins.find((p)=>{
|
|
96
|
+
if (typeof p !== 'object' || !p) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
return p['name'] === 'ModuleFederationPlugin';
|
|
100
|
+
});
|
|
101
|
+
if (!useModuleFederationPlugin) {
|
|
102
|
+
ContainerPlugin.patchChunkSplit(compiler, this._options.name);
|
|
103
|
+
}
|
|
104
|
+
new _FederationRuntimePlugin.default().apply(compiler);
|
|
105
|
+
const { name, exposes, shareScope, filename, library, runtime, runtimePlugins } = this._options;
|
|
106
|
+
if (library && compiler.options.output && compiler.options.output.enabledLibraryTypes && !compiler.options.output.enabledLibraryTypes.includes(library.type)) {
|
|
107
|
+
compiler.options.output.enabledLibraryTypes.push(library.type);
|
|
108
|
+
}
|
|
109
|
+
compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback)=>{
|
|
110
|
+
const dep = new _ContainerEntryDependency.default(name, //@ts-ignore
|
|
111
|
+
exposes, shareScope, runtimePlugins);
|
|
112
|
+
dep.loc = {
|
|
113
|
+
name
|
|
114
|
+
};
|
|
115
|
+
compilation.addEntry(compilation.options.context || '', //@ts-ignore
|
|
116
|
+
dep, {
|
|
117
|
+
name,
|
|
118
|
+
filename,
|
|
119
|
+
runtime,
|
|
120
|
+
library
|
|
121
|
+
}, (error)=>{
|
|
122
|
+
if (error) {
|
|
123
|
+
return callback(error);
|
|
124
|
+
}
|
|
125
|
+
callback();
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation, { normalModuleFactory })=>{
|
|
129
|
+
compilation.dependencyFactories.set(//@ts-ignore
|
|
130
|
+
_ContainerEntryDependency.default, new _ContainerEntryModuleFactory.default());
|
|
131
|
+
compilation.dependencyFactories.set(//@ts-ignore
|
|
132
|
+
_ContainerExposedDependency.default, normalModuleFactory);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* @param {ContainerPluginOptions} options options
|
|
137
|
+
*/ constructor(options){
|
|
138
|
+
validate(options);
|
|
139
|
+
this.name = PLUGIN_NAME;
|
|
140
|
+
this._options = {
|
|
141
|
+
name: options.name,
|
|
142
|
+
shareScope: options.shareScope || 'default',
|
|
143
|
+
library: options.library || {
|
|
144
|
+
type: 'var',
|
|
145
|
+
name: options.name
|
|
146
|
+
},
|
|
147
|
+
runtime: options.runtime,
|
|
148
|
+
filename: options.filename || undefined,
|
|
149
|
+
//@ts-ignore
|
|
150
|
+
exposes: (0, _options.parseOptions)(options.exposes, (item)=>({
|
|
151
|
+
import: Array.isArray(item) ? item : [
|
|
152
|
+
item
|
|
153
|
+
],
|
|
154
|
+
name: undefined
|
|
155
|
+
}), (item)=>({
|
|
156
|
+
import: Array.isArray(item.import) ? item.import : [
|
|
157
|
+
item.import
|
|
158
|
+
],
|
|
159
|
+
name: item.name || undefined
|
|
160
|
+
})),
|
|
161
|
+
runtimePlugins: options.runtimePlugins
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
const _default = ContainerPlugin;
|
|
166
|
+
|
|
167
|
+
//# sourceMappingURL=ContainerPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerPlugin.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr\n*/\n//@ts-ignore\nimport createSchemaValidation from 'webpack/lib/util/create-schema-validation';\nimport ContainerEntryDependency from './ContainerEntryDependency';\nimport ContainerEntryModuleFactory from './ContainerEntryModuleFactory';\nimport ContainerExposedDependency from './ContainerExposedDependency';\nimport { parseOptions } from './options';\nimport type { optimize, Compiler, Compilation } from 'webpack';\nimport type { ContainerPluginOptions } from '../../declarations/plugins/container/ContainerPlugin';\nimport FederationRuntimePlugin from './runtime/FederationRuntimePlugin';\nimport checkOptions from '../../schemas/container/ContainerPlugin.check';\nimport schema from '../../schemas/container/ContainerPlugin';\n\ntype ExcludeUndefined<T> = T extends undefined ? never : T;\ntype NonUndefined<T> = ExcludeUndefined<T>;\n\ntype OptimizationSplitChunksOptions = NonUndefined<\n ConstructorParameters<typeof optimize.SplitChunksPlugin>[0]\n>;\n\ntype CacheGroups = OptimizationSplitChunksOptions['cacheGroups'];\ntype CacheGroup = NonUndefined<CacheGroups>[string];\n\nconst validate = createSchemaValidation(checkOptions, () => schema, {\n name: 'Container Plugin',\n baseDataPath: 'options',\n});\n\nconst PLUGIN_NAME = 'ContainerPlugin';\n\nclass ContainerPlugin {\n _options: ContainerPluginOptions;\n name: string;\n /**\n * @param {ContainerPluginOptions} options options\n */\n constructor(options: ContainerPluginOptions) {\n validate(options);\n this.name = PLUGIN_NAME;\n this._options = {\n name: options.name,\n shareScope: options.shareScope || 'default',\n library: options.library || {\n type: 'var',\n name: options.name,\n },\n runtime: options.runtime,\n filename: options.filename || undefined,\n //@ts-ignore\n exposes: parseOptions(\n options.exposes,\n (item) => ({\n import: Array.isArray(item) ? item : [item],\n name: undefined,\n }),\n (item) => ({\n import: Array.isArray(item.import) ? item.import : [item.import],\n name: item.name || undefined,\n }),\n ),\n runtimePlugins: options.runtimePlugins,\n };\n }\n\n // container should not be affected by splitChunks\n static patchChunkSplit(compiler: Compiler, name: string): void {\n const { splitChunks } = compiler.options.optimization;\n const patchChunkSplit = (cacheGroup: CacheGroup) => {\n switch (typeof cacheGroup) {\n case 'boolean':\n case 'string':\n case 'function':\n break;\n // cacheGroup.chunks 会继承 splitChunks.chunks ,因此只需要对单独设置了 chunks 的 做修改\n case 'object':\n {\n if (cacheGroup instanceof RegExp) {\n break;\n }\n if (!cacheGroup.chunks) {\n break;\n }\n if (typeof cacheGroup.chunks === 'function') {\n const prevChunks = cacheGroup.chunks;\n cacheGroup.chunks = (chunk) => {\n if (chunk.name && chunk.name === name) {\n return false;\n }\n return prevChunks(chunk);\n };\n break;\n }\n\n if (cacheGroup.chunks === 'all') {\n cacheGroup.chunks = (chunk) => {\n if (chunk.name && chunk.name === name) {\n return false;\n }\n return true;\n };\n break;\n }\n if (cacheGroup.chunks === 'initial') {\n cacheGroup.chunks = (chunk) => {\n if (chunk.name && chunk.name === name) {\n return false;\n }\n return chunk.isOnlyInitial();\n };\n break;\n }\n }\n break;\n }\n };\n\n if (!splitChunks) {\n return;\n }\n // 修改 splitChunk.chunks\n patchChunkSplit(splitChunks);\n\n const cacheGroups = splitChunks.cacheGroups;\n if (!cacheGroups) {\n return;\n }\n\n // 修改 splitChunk.cacheGroups[key].chunks\n Object.keys(cacheGroups).forEach((cacheGroupKey) => {\n patchChunkSplit(cacheGroups[cacheGroupKey]);\n });\n }\n\n apply(compiler: Compiler): void {\n const useModuleFederationPlugin = compiler.options.plugins.find((p) => {\n if (typeof p !== 'object' || !p) {\n return false;\n }\n\n return p['name'] === 'ModuleFederationPlugin';\n });\n\n if (!useModuleFederationPlugin) {\n ContainerPlugin.patchChunkSplit(compiler, this._options.name);\n }\n\n new FederationRuntimePlugin().apply(compiler);\n const {\n name,\n exposes,\n shareScope,\n filename,\n library,\n runtime,\n runtimePlugins,\n } = this._options;\n\n if (\n library &&\n compiler.options.output &&\n compiler.options.output.enabledLibraryTypes &&\n !compiler.options.output.enabledLibraryTypes.includes(library.type)\n ) {\n compiler.options.output.enabledLibraryTypes.push(library.type);\n }\n\n compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => {\n const dep = new ContainerEntryDependency(\n name,\n //@ts-ignore\n exposes,\n shareScope,\n runtimePlugins,\n );\n\n dep.loc = { name };\n compilation.addEntry(\n compilation.options.context || '',\n //@ts-ignore\n dep,\n {\n name,\n filename,\n runtime,\n library,\n },\n (error: WebpackError | null | undefined) => {\n if (error) {\n return callback(error);\n }\n callback();\n },\n );\n });\n\n compiler.hooks.thisCompilation.tap(\n PLUGIN_NAME,\n (compilation: Compilation, { normalModuleFactory }) => {\n compilation.dependencyFactories.set(\n //@ts-ignore\n ContainerEntryDependency,\n new ContainerEntryModuleFactory(),\n );\n\n compilation.dependencyFactories.set(\n //@ts-ignore\n ContainerExposedDependency,\n normalModuleFactory,\n );\n },\n );\n }\n}\n\nexport default ContainerPlugin;\n"],"names":["validate","createSchemaValidation","checkOptions","schema","name","baseDataPath","PLUGIN_NAME","ContainerPlugin","patchChunkSplit","compiler","splitChunks","options","optimization","cacheGroup","RegExp","chunks","prevChunks","chunk","isOnlyInitial","cacheGroups","Object","keys","forEach","cacheGroupKey","apply","useModuleFederationPlugin","plugins","find","p","_options","FederationRuntimePlugin","exposes","shareScope","filename","library","runtime","runtimePlugins","output","enabledLibraryTypes","includes","type","push","hooks","make","tapAsync","compilation","callback","dep","ContainerEntryDependency","loc","addEntry","context","error","thisCompilation","tap","normalModuleFactory","dependencyFactories","set","ContainerEntryModuleFactory","ContainerExposedDependency","constructor","undefined","parseOptions","item","import","Array","isArray"],"mappings":"AAAA;;;AAGA,GACA,YAAY;;;;;+BAqNZ;;;eAAA;;;;iFApNmC;mFACE;sFACG;qFACD;yBACV;kFAGO;+EACX;0EACN;AAYnB,MAAMA,WAAWC,IAAAA,+BAAsB,EAACC,6BAAY,EAAE,IAAMC,wBAAM,EAAE;IAClEC,MAAM;IACNC,cAAc;AAChB;AAEA,MAAMC,cAAc;AAEpB,IAAA,AAAMC,kBAAN,MAAMA;IAkCJ,kDAAkD;IAClD,OAAOC,gBAAgBC,QAAkB,EAAEL,IAAY,EAAQ;QAC7D,MAAM,EAAEM,WAAW,EAAE,GAAGD,SAASE,OAAO,CAACC,YAAY;QACrD,MAAMJ,kBAAkB,CAACK;YACvB,OAAQ,OAAOA;gBACb,KAAK;gBACL,KAAK;gBACL,KAAK;oBACH;gBACF,sEAAsE;gBACtE,KAAK;oBACH;wBACE,IAAIA,sBAAsBC,QAAQ;4BAChC;wBACF;wBACA,IAAI,CAACD,WAAWE,MAAM,EAAE;4BACtB;wBACF;wBACA,IAAI,OAAOF,WAAWE,MAAM,KAAK,YAAY;4BAC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QuB,OAAO,IAAI;gBAC1BM,MAAM;gBACNpC,MAAMO,QAAQP,IAAI;YACpB;YACA+B,SAASxB,QAAQwB,OAAO;YACxBF,UAAUtB,QAAQsB,QAAQ,IAAI4B;YAC9B,YAAY;YACZ9B,SAAS+B,IAAAA,qBAAY,EACnBnD,QAAQoB,OAAO,EACf,CAACgC,OAAU,CAAA;oBACTC,QAAQC,MAAMC,OAAO,CAACH,QAAQA,OAAO;wBAACA;qBAAK;oBAC3C3D,MAAMyD;gBACR,CAAA,GACA,CAACE,OAAU,CAAA;oBACTC,QAAQC,MAAMC,OAAO,CAACH,KAAKC,MAAM,IAAID,KAAKC,MAAM,GAAG;wBAACD,KAAKC,MAAM;qBAAC;oBAChE5D,MAAM2D,KAAK3D,IAAI,IAAIyD;gBACrB,CAAA;YAEFzB,gBAAgBzB,QAAQyB,cAAc;QACxC;IACF;AAsJF;MAEA,WAAe7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerReferencePlugin.d.ts"],"sourcesContent":["export = ContainerReferencePlugin;\ndeclare class ContainerReferencePlugin {\n /**\n * @param {ContainerReferencePluginOptions} options options\n */\n constructor(options: ContainerReferencePluginOptions);\n _remoteType: import('../../declarations/plugins/container/ContainerReferencePlugin').ExternalsType;\n _remotes: [\n string,\n {\n external: string[];\n shareScope: string;\n },\n ][];\n /**\n * Apply the plugin\n * @param {Compiler} compiler the compiler instance\n * @returns {void}\n */\n apply(compiler: Compiler): void;\n}\ndeclare namespace ContainerReferencePlugin {\n export { ContainerReferencePluginOptions, RemotesConfig, Compiler };\n}\ntype Compiler = import('webpack/lib/Compiler');\ntype ContainerReferencePluginOptions =\n import('../../declarations/plugins/container/ContainerReferencePlugin').ContainerReferencePluginOptions;\ntype RemotesConfig =\n import('../../declarations/plugins/container/ContainerReferencePlugin').RemotesConfig;\n"],"names":["ContainerReferencePlugin"],"mappings":";iBAASA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type Compiler from 'webpack/lib/Compiler';
|
|
2
|
+
import { ContainerReferencePluginOptions } from '../../declarations/plugins/container/ContainerReferencePlugin';
|
|
3
|
+
declare class ContainerReferencePlugin {
|
|
4
|
+
private _remoteType;
|
|
5
|
+
private _remotes;
|
|
6
|
+
constructor(options: ContainerReferencePluginOptions);
|
|
7
|
+
/**
|
|
8
|
+
* Apply the plugin
|
|
9
|
+
* @param {Compiler} compiler the compiler instance
|
|
10
|
+
* @returns {void}
|
|
11
|
+
*/
|
|
12
|
+
apply(compiler: Compiler): void;
|
|
13
|
+
}
|
|
14
|
+
export default ContainerReferencePlugin;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy
|
|
4
|
+
*/ "use strict";
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "default", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function() {
|
|
11
|
+
return _default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
15
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
16
|
+
const _RuntimeGlobals = /*#__PURE__*/ _interop_require_wildcard._(require("webpack/lib/RuntimeGlobals"));
|
|
17
|
+
const _createschemavalidation = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/util/create-schema-validation"));
|
|
18
|
+
const _FallbackDependency = /*#__PURE__*/ _interop_require_default._(require("./FallbackDependency"));
|
|
19
|
+
const _FallbackItemDependency = /*#__PURE__*/ _interop_require_default._(require("./FallbackItemDependency"));
|
|
20
|
+
const _FallbackModuleFactory = /*#__PURE__*/ _interop_require_default._(require("./FallbackModuleFactory"));
|
|
21
|
+
const _RemoteModule = /*#__PURE__*/ _interop_require_default._(require("./RemoteModule"));
|
|
22
|
+
const _RemoteRuntimeModule = /*#__PURE__*/ _interop_require_default._(require("./RemoteRuntimeModule"));
|
|
23
|
+
const _RemoteToExternalDependency = /*#__PURE__*/ _interop_require_default._(require("./RemoteToExternalDependency"));
|
|
24
|
+
const _options = require("./options");
|
|
25
|
+
const _ExternalsPlugin = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/ExternalsPlugin"));
|
|
26
|
+
const _FederationRuntimePlugin = /*#__PURE__*/ _interop_require_default._(require("./runtime/FederationRuntimePlugin"));
|
|
27
|
+
const validate = (0, _createschemavalidation.default)(//eslint-disable-next-line
|
|
28
|
+
require('webpack/schemas/plugins/container/ContainerReferencePlugin.check.js'), ()=>require('webpack/schemas/plugins/container/ContainerReferencePlugin.json'), {
|
|
29
|
+
name: 'Container Reference Plugin',
|
|
30
|
+
baseDataPath: 'options'
|
|
31
|
+
});
|
|
32
|
+
const slashCode = '/'.charCodeAt(0);
|
|
33
|
+
let ContainerReferencePlugin = class ContainerReferencePlugin {
|
|
34
|
+
/**
|
|
35
|
+
* Apply the plugin
|
|
36
|
+
* @param {Compiler} compiler the compiler instance
|
|
37
|
+
* @returns {void}
|
|
38
|
+
*/ apply(compiler) {
|
|
39
|
+
const { _remotes: remotes, _remoteType: remoteType } = this;
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
new _FederationRuntimePlugin.default().apply(compiler);
|
|
42
|
+
/** @type {Record<string, string>} */ const remoteExternals = {};
|
|
43
|
+
for (const [key, config] of remotes){
|
|
44
|
+
let i = 0;
|
|
45
|
+
for (const external of config.external){
|
|
46
|
+
if (typeof external === 'string' && external.startsWith('internal ')) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
remoteExternals[`webpack/container/reference/${key}${i ? `/fallback-${i}` : ''}`] = external;
|
|
50
|
+
i++;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const Externals = compiler.webpack.ExternalsPlugin || _ExternalsPlugin.default;
|
|
54
|
+
//@ts-ignore
|
|
55
|
+
new Externals(remoteType, remoteExternals).apply(compiler);
|
|
56
|
+
compiler.hooks.compilation.tap('ContainerReferencePlugin', (compilation, { normalModuleFactory })=>{
|
|
57
|
+
compilation.dependencyFactories.set(_RemoteToExternalDependency.default, normalModuleFactory);
|
|
58
|
+
compilation.dependencyFactories.set(_FallbackItemDependency.default, normalModuleFactory);
|
|
59
|
+
compilation.dependencyFactories.set(_FallbackDependency.default, new _FallbackModuleFactory.default());
|
|
60
|
+
normalModuleFactory.hooks.factorize.tap('ContainerReferencePlugin', //@ts-ignore
|
|
61
|
+
(data)=>{
|
|
62
|
+
if (!data.request.includes('!')) {
|
|
63
|
+
for (const [key, config] of remotes){
|
|
64
|
+
if (data.request.startsWith(`${key}`) && (data.request.length === key.length || data.request.charCodeAt(key.length) === slashCode)) {
|
|
65
|
+
return new _RemoteModule.default(data.request, //@ts-ignore
|
|
66
|
+
config.external.map((external, i)=>external.startsWith('internal ') ? external.slice(9) : `webpack/container/reference/${key}${i ? `/fallback-${i}` : ''}`), `.${data.request.slice(key.length)}`, //@ts-ignore
|
|
67
|
+
config.shareScope, config.name);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
compilation.hooks.runtimeRequirementInTree.for(_RuntimeGlobals.ensureChunkHandlers).tap('ContainerReferencePlugin', (chunk, set)=>{
|
|
73
|
+
set.add(_RuntimeGlobals.module);
|
|
74
|
+
set.add(_RuntimeGlobals.moduleFactoriesAddOnly);
|
|
75
|
+
set.add(_RuntimeGlobals.hasOwnProperty);
|
|
76
|
+
set.add(_RuntimeGlobals.initializeSharing);
|
|
77
|
+
set.add(_RuntimeGlobals.shareScopeMap);
|
|
78
|
+
compilation.addRuntimeModule(chunk, new _RemoteRuntimeModule.default());
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
constructor(options){
|
|
83
|
+
validate(options);
|
|
84
|
+
this._remoteType = options.remoteType;
|
|
85
|
+
this._remotes = (0, _options.parseOptions)(options.remotes, (item)=>({
|
|
86
|
+
external: Array.isArray(item) ? item : [
|
|
87
|
+
item
|
|
88
|
+
],
|
|
89
|
+
shareScope: options.shareScope || 'default',
|
|
90
|
+
name: undefined
|
|
91
|
+
}), (item)=>({
|
|
92
|
+
external: Array.isArray(item.external) ? item.external : [
|
|
93
|
+
item.external
|
|
94
|
+
],
|
|
95
|
+
shareScope: item.shareScope || options.shareScope || 'default',
|
|
96
|
+
name: item.name
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const _default = ContainerReferencePlugin;
|
|
101
|
+
|
|
102
|
+
//# sourceMappingURL=ContainerReferencePlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerReferencePlugin.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy\n*/\n\nimport type Compiler from 'webpack/lib/Compiler';\nimport * as RuntimeGlobals from 'webpack/lib/RuntimeGlobals';\nimport createSchemaValidation from 'webpack/lib/util/create-schema-validation';\nimport FallbackDependency from './FallbackDependency';\nimport FallbackItemDependency from './FallbackItemDependency';\nimport FallbackModuleFactory from './FallbackModuleFactory';\nimport RemoteModule from './RemoteModule';\nimport RemoteRuntimeModule from './RemoteRuntimeModule';\nimport RemoteToExternalDependency from './RemoteToExternalDependency';\nimport { parseOptions } from './options';\nimport ExternalsPlugin from 'webpack/lib/ExternalsPlugin';\nimport type Compilation from 'webpack/lib/Compilation';\nimport type { ResolveData } from 'webpack/lib/NormalModuleFactory';\nimport NormalModuleFactory from 'webpack/lib/NormalModuleFactory';\nimport {\n ExternalsType,\n ContainerReferencePluginOptions,\n RemotesConfig,\n} from '../../declarations/plugins/container/ContainerReferencePlugin';\nimport FederationRuntimePlugin from './runtime/FederationRuntimePlugin';\n\nconst validate = createSchemaValidation(\n //eslint-disable-next-line\n require('webpack/schemas/plugins/container/ContainerReferencePlugin.check.js'),\n () =>\n require('webpack/schemas/plugins/container/ContainerReferencePlugin.json'),\n {\n name: 'Container Reference Plugin',\n baseDataPath: 'options',\n },\n);\n\nconst slashCode = '/'.charCodeAt(0);\n\nclass ContainerReferencePlugin {\n private _remoteType: ExternalsType;\n private _remotes: [string, RemotesConfig][];\n\n constructor(options: ContainerReferencePluginOptions) {\n validate(options);\n\n this._remoteType = options.remoteType;\n this._remotes = parseOptions(\n options.remotes,\n (item) => ({\n external: Array.isArray(item) ? item : [item],\n shareScope: options.shareScope || 'default',\n name: undefined,\n }),\n (item) => ({\n external: Array.isArray(item.external)\n ? item.external\n : [item.external],\n shareScope: item.shareScope || options.shareScope || 'default',\n name: item.name,\n }),\n );\n }\n\n /**\n * Apply the plugin\n * @param {Compiler} compiler the compiler instance\n * @returns {void}\n */\n apply(compiler: Compiler): void {\n const { _remotes: remotes, _remoteType: remoteType } = this;\n // @ts-ignore\n new FederationRuntimePlugin().apply(compiler);\n\n /** @type {Record<string, string>} */\n const remoteExternals: Record<string, string> = {};\n\n for (const [key, config] of remotes) {\n let i = 0;\n for (const external of config.external) {\n if (typeof external === 'string' && external.startsWith('internal ')) {\n continue;\n }\n remoteExternals[\n `webpack/container/reference/${key}${i ? `/fallback-${i}` : ''}`\n ] = external;\n i++;\n }\n }\n const Externals = compiler.webpack.ExternalsPlugin || ExternalsPlugin;\n //@ts-ignore\n new Externals(remoteType, remoteExternals).apply(compiler);\n\n compiler.hooks.compilation.tap(\n 'ContainerReferencePlugin',\n (\n compilation: Compilation,\n { normalModuleFactory }: { normalModuleFactory: NormalModuleFactory },\n ) => {\n compilation.dependencyFactories.set(\n RemoteToExternalDependency,\n normalModuleFactory,\n );\n\n compilation.dependencyFactories.set(\n FallbackItemDependency,\n normalModuleFactory,\n );\n\n compilation.dependencyFactories.set(\n FallbackDependency,\n new FallbackModuleFactory(),\n );\n\n normalModuleFactory.hooks.factorize.tap(\n 'ContainerReferencePlugin',\n //@ts-ignore\n (data: ResolveData): Module => {\n if (!data.request.includes('!')) {\n for (const [key, config] of remotes) {\n if (\n data.request.startsWith(`${key}`) &&\n (data.request.length === key.length ||\n data.request.charCodeAt(key.length) === slashCode)\n ) {\n return new RemoteModule(\n data.request,\n //@ts-ignore\n config.external.map((external: any, i: any) =>\n external.startsWith('internal ')\n ? external.slice(9)\n : `webpack/container/reference/${key}${\n i ? `/fallback-${i}` : ''\n }`,\n ),\n `.${data.request.slice(key.length)}`,\n //@ts-ignore\n config.shareScope,\n config.name,\n );\n }\n }\n }\n },\n );\n\n compilation.hooks.runtimeRequirementInTree\n .for(RuntimeGlobals.ensureChunkHandlers)\n .tap('ContainerReferencePlugin', (chunk, set) => {\n set.add(RuntimeGlobals.module);\n set.add(RuntimeGlobals.moduleFactoriesAddOnly);\n set.add(RuntimeGlobals.hasOwnProperty);\n set.add(RuntimeGlobals.initializeSharing);\n set.add(RuntimeGlobals.shareScopeMap);\n compilation.addRuntimeModule(chunk, new RemoteRuntimeModule());\n });\n },\n );\n }\n}\n\nexport default ContainerReferencePlugin;\n"],"names":["validate","createSchemaValidation","require","name","baseDataPath","slashCode","charCodeAt","ContainerReferencePlugin","apply","compiler","_remotes","remotes","_remoteType","remoteType","FederationRuntimePlugin","remoteExternals","key","config","i","external","startsWith","Externals","webpack","ExternalsPlugin","hooks","compilation","tap","normalModuleFactory","dependencyFactories","set","RemoteToExternalDependency","FallbackItemDependency","FallbackDependency","FallbackModuleFactory","factorize","data","request","includes","length","RemoteModule","map","slice","shareScope","runtimeRequirementInTree","for","RuntimeGlobals","ensureChunkHandlers","chunk","add","module","moduleFactoriesAddOnly","hasOwnProperty","initializeSharing","shareScopeMap","addRuntimeModule","RemoteRuntimeModule","constructor","options","parseOptions","item","Array","isArray","undefined"],"mappings":"AAAA;;;AAGA;;;;+BA8JA;;;eAAA;;;;;0EA3JgC;iFACG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AAwC,CAAE;QACpDzD,SAASyD;QAET,IAAI,CAAC7C,WAAW,GAAG6C,QAAQ5C,UAAU;QACrC,IAAI,CAACH,QAAQ,GAAGgD,IAAAA,qBAAY,EAC1BD,QAAQ9C,OAAO,EACf,CAACgD,OAAU,CAAA;gBACTxC,UAAUyC,MAAMC,OAAO,CAACF,QAAQA,OAAO;oBAACA;iBAAK;gBAC7CjB,YAAYe,QAAQf,UAAU,IAAI;gBAClCvC,MAAM2D;YACR,CAAA,GACA,CAACH,OAAU,CAAA;gBACTxC,UAAUyC,MAAMC,OAAO,CAACF,KAAKxC,QAAQ,IACjCwC,KAAKxC,QAAQ,GACb;oBAACwC,KAAKxC,QAAQ;iBAAC;gBACnBuB,YAAYiB,KAAKjB,UAAU,IAAIe,QAAQf,UAAU,IAAI;gBACrDvC,MAAMwD,KAAKxD,IAAI;YACjB,CAAA;IAEJ;AAiGF;MAEA,WAAeI"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "FallbackDependency", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return FallbackDependency;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
let FallbackDependency = class FallbackDependency extends Dependency {
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=FallbackDependency.d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/FallbackDependency.d.ts"],"sourcesContent":["export class FallbackDependency extends Dependency {\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {FallbackDependency} deserialize fallback dependency\n */\n static deserialize(context: ObjectDeserializerContext): FallbackDependency;\n /**\n * @param {string[]} requests requests\n */\n constructor(requests: string[]);\n requests: string[];\n}\ndeclare namespace FallbackDependency {\n export { ObjectDeserializerContext, ObjectSerializerContext };\n}\n"],"names":["FallbackDependency","Dependency"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,IAAA,AAAMA,qBAAN,MAAMA,2BAA2BC;AAWxC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ObjectDeserializerContext, ObjectSerializerContext } from 'webpack/lib/Dependency';
|
|
2
|
+
import Dependency from 'webpack/lib/Dependency';
|
|
3
|
+
declare class FallbackDependency extends Dependency {
|
|
4
|
+
requests: string[];
|
|
5
|
+
/**
|
|
6
|
+
* @param {string[]} requests requests
|
|
7
|
+
*/
|
|
8
|
+
constructor(requests: string[]);
|
|
9
|
+
/**
|
|
10
|
+
* @returns {string | null} an identifier to merge equal requests
|
|
11
|
+
*/
|
|
12
|
+
getResourceIdentifier(): string | null;
|
|
13
|
+
get type(): string;
|
|
14
|
+
get category(): string;
|
|
15
|
+
/**
|
|
16
|
+
* @param {ObjectSerializerContext} context context
|
|
17
|
+
*/
|
|
18
|
+
serialize(context: ObjectSerializerContext): void;
|
|
19
|
+
/**
|
|
20
|
+
* @param {ObjectDeserializerContext} context context
|
|
21
|
+
* @returns {FallbackDependency} deserialize fallback dependency
|
|
22
|
+
*/
|
|
23
|
+
static deserialize(context: ObjectDeserializerContext): FallbackDependency;
|
|
24
|
+
}
|
|
25
|
+
export default FallbackDependency;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy
|
|
4
|
+
*/ 'use strict';
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "default", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function() {
|
|
11
|
+
return _default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
15
|
+
const _Dependency = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/Dependency"));
|
|
16
|
+
const _makeSerializable = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/util/makeSerializable"));
|
|
17
|
+
let FallbackDependency = class FallbackDependency extends _Dependency.default {
|
|
18
|
+
/**
|
|
19
|
+
* @returns {string | null} an identifier to merge equal requests
|
|
20
|
+
*/ getResourceIdentifier() {
|
|
21
|
+
return `fallback ${this.requests.join(' ')}`;
|
|
22
|
+
}
|
|
23
|
+
get type() {
|
|
24
|
+
return 'fallback';
|
|
25
|
+
}
|
|
26
|
+
get category() {
|
|
27
|
+
return 'esm';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @param {ObjectSerializerContext} context context
|
|
31
|
+
*/ serialize(context) {
|
|
32
|
+
const { write } = context;
|
|
33
|
+
write(this.requests);
|
|
34
|
+
super.serialize(context);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @param {ObjectDeserializerContext} context context
|
|
38
|
+
* @returns {FallbackDependency} deserialize fallback dependency
|
|
39
|
+
*/ static deserialize(context) {
|
|
40
|
+
const { read } = context;
|
|
41
|
+
const obj = new FallbackDependency(read());
|
|
42
|
+
obj.deserialize(context);
|
|
43
|
+
return obj;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @param {string[]} requests requests
|
|
47
|
+
*/ constructor(requests){
|
|
48
|
+
super();
|
|
49
|
+
this.requests = requests;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
(0, _makeSerializable.default)(FallbackDependency, 'enhanced/lib/container/FallbackDependency');
|
|
53
|
+
const _default = FallbackDependency;
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=FallbackDependency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/FallbackDependency.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';\n\nimport type {\n ObjectDeserializerContext,\n ObjectSerializerContext,\n} from 'webpack/lib/Dependency';\nimport Dependency from 'webpack/lib/Dependency';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\n\nclass FallbackDependency extends Dependency {\n requests: string[];\n\n /**\n * @param {string[]} requests requests\n */\n constructor(requests: string[]) {\n super();\n this.requests = requests;\n }\n\n /**\n * @returns {string | null} an identifier to merge equal requests\n */\n override getResourceIdentifier(): string | null {\n return `fallback ${this.requests.join(' ')}`;\n }\n\n override get type(): string {\n return 'fallback';\n }\n\n override get category(): string {\n return 'esm';\n }\n\n /**\n * @param {ObjectSerializerContext} context context\n */\n override serialize(context: ObjectSerializerContext): void {\n const { write } = context;\n write(this.requests);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {FallbackDependency} deserialize fallback dependency\n */\n static deserialize(context: ObjectDeserializerContext): FallbackDependency {\n const { read } = context;\n const obj = new FallbackDependency(read());\n obj.deserialize(context);\n return obj;\n }\n}\n\nmakeSerializable(\n FallbackDependency,\n 'enhanced/lib/container/FallbackDependency',\n);\n\nexport default FallbackDependency;\n"],"names":["FallbackDependency","Dependency","getResourceIdentifier","requests","join","type","category","serialize","context","write","deserialize","read","obj","constructor","makeSerializable"],"mappings":"AAAA;;;AAGA,GAEA;;;;+BA6DA;;;eAAA;;;;qEAvDuB;2EACM;AAE7B,IAAA,AAAMA,qBAAN,MAAMA,2BAA2BC,mBAAU;IAWzC;;GAEC,GACD,AAASC,wBAAuC;QAC9C,OAAO,CAAC,SAAS,EAAE,IAAI,CAACC,QAAQ,CAACC,IAAI,CAAC,KAAK,CAAC;IAC9C;IAEA,IAAaC,OAAe;QAC1B,OAAO;IACT;IAEA,IAAaC,WAAmB;QAC9B,OAAO;IACT;IAEA;;GAEC,GACD,AAASC,UAAUC,OAAgC,EAAQ;QACzD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClBC,MAAM,IAAI,CAACN,QAAQ;QACnB,KAAK,CAACI,UAAUC;IAClB;IAEA;;;GAGC,GACD,OAAOE,YAAYF,OAAkC,EAAsB;QACzE,MAAM,EAAEG,IAAI,EAAE,GAAGH;QACjB,MAAMI,MAAM,IAAIZ,mBAAmBW;QACnCC,IAAIF,WAAW,CAACF;QAChB,OAAOI;IACT;IAzCA;;GAEC,GACDC,YAAYV,QAAkB,CAAE;QAC9B,KAAK;QACL,IAAI,CAACA,QAAQ,GAAGA;IAClB;AAoCF;AAEAW,IAAAA,yBAAgB,EACdd,oBACA;MAGF,WAAeA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/FallbackItemDependency.d.ts"],"sourcesContent":["export = FallbackItemDependency;\ndeclare class FallbackItemDependency extends ModuleDependency {}\nimport ModuleDependency = require('webpack/lib/dependencies/ModuleDependency');\n"],"names":["FallbackItemDependency"],"mappings":";iBAASA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import ModuleDependency from 'webpack/lib/dependencies/ModuleDependency';
|
|
2
|
+
declare class FallbackItemDependency extends ModuleDependency {
|
|
3
|
+
/**
|
|
4
|
+
* @param {string} request request
|
|
5
|
+
*/
|
|
6
|
+
constructor(request: string);
|
|
7
|
+
get type(): string;
|
|
8
|
+
get category(): string;
|
|
9
|
+
}
|
|
10
|
+
export default FallbackItemDependency;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy
|
|
4
|
+
*/ "use strict";
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "default", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function() {
|
|
11
|
+
return _default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
15
|
+
const _ModuleDependency = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/dependencies/ModuleDependency"));
|
|
16
|
+
const _makeSerializable = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/util/makeSerializable"));
|
|
17
|
+
let FallbackItemDependency = class FallbackItemDependency extends _ModuleDependency.default {
|
|
18
|
+
get type() {
|
|
19
|
+
return 'fallback item';
|
|
20
|
+
}
|
|
21
|
+
get category() {
|
|
22
|
+
return 'esm';
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @param {string} request request
|
|
26
|
+
*/ constructor(request){
|
|
27
|
+
super(request);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
(0, _makeSerializable.default)(FallbackItemDependency, 'enhanced/lib/container/FallbackItemDependency');
|
|
31
|
+
const _default = FallbackItemDependency;
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=FallbackItemDependency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/FallbackItemDependency.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy\n*/\nimport ModuleDependency from 'webpack/lib/dependencies/ModuleDependency';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\n\nclass FallbackItemDependency extends ModuleDependency {\n /**\n * @param {string} request request\n */\n constructor(request: string) {\n super(request);\n }\n\n override get type(): string {\n return 'fallback item';\n }\n\n override get category(): string {\n return 'esm';\n }\n}\n\nmakeSerializable(\n FallbackItemDependency,\n 'enhanced/lib/container/FallbackItemDependency',\n);\n\nexport default FallbackItemDependency;\n"],"names":["FallbackItemDependency","ModuleDependency","type","category","constructor","request","makeSerializable"],"mappings":"AAAA;;;AAGA;;;;+BA0BA;;;eAAA;;;;2EAzB6B;2EACA;AAE7B,IAAA,AAAMA,yBAAN,MAAMA,+BAA+BC,yBAAgB;IAQnD,IAAaC,OAAe;QAC1B,OAAO;IACT;IAEA,IAAaC,WAAmB;QAC9B,OAAO;IACT;IAbA;;GAEC,GACDC,YAAYC,OAAe,CAAE;QAC3B,KAAK,CAACA;IACR;AASF;AAEAC,IAAAA,yBAAgB,EACdN,wBACA;MAGF,WAAeA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/FallbackModule.d.ts"],"sourcesContent":["export = FallbackModule;\ndeclare class FallbackModule extends Module {\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {FallbackModule} deserialized fallback module\n */\n static deserialize(context: ObjectDeserializerContext): FallbackModule;\n /**\n * @param {string[]} requests list of requests to choose one\n */\n constructor(requests: string[]);\n requests: string[];\n _identifier: string;\n}\ndeclare namespace FallbackModule {\n export {\n WebpackOptions,\n Chunk,\n ChunkGraph,\n ChunkGroup,\n Compilation,\n CodeGenerationContext,\n CodeGenerationResult,\n LibIdentOptions,\n NeedBuildContext,\n RequestShortener,\n ResolverWithOptions,\n WebpackError,\n ObjectDeserializerContext,\n ObjectSerializerContext,\n Hash,\n InputFileSystem,\n };\n}\nimport Module = require('webpack/lib/Module');\ntype ObjectDeserializerContext =\n import('webpack/lib/serialization/ObjectMiddleware').ObjectDeserializerContext;\ntype WebpackOptions = any;\ntype Chunk = import('webpack/lib/Chunk');\ntype ChunkGraph = import('webpack/lib/ChunkGraph');\ntype ChunkGroup = import('webpack/lib/ChunkGroup');\ntype Compilation = import('webpack/lib/Compilation');\ntype CodeGenerationContext = import('webpack/lib/Module').CodeGenerationContext;\ntype CodeGenerationResult = import('webpack/lib/Module').CodeGenerationResult;\ntype LibIdentOptions = import('webpack/lib/Module').LibIdentOptions;\ntype NeedBuildContext = import('webpack/lib/Module').NeedBuildContext;\ntype RequestShortener = import('webpack/lib/RequestShortener');\ntype ResolverWithOptions =\n import('webpack/lib/ResolverFactory').ResolverWithOptions;\ntype WebpackError = import('webpack/lib/WebpackError');\ntype ObjectSerializerContext =\n import('webpack/lib/serialization/ObjectMiddleware').ObjectSerializerContext;\ntype Hash = import('webpack/lib/util/Hash');\ntype InputFileSystem = import('webpack/lib/util/fs').InputFileSystem;\n"],"names":["FallbackModule"],"mappings":";iBAASA"}
|