@module-federation/enhanced 0.1.4 → 0.1.5

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.
Files changed (194) hide show
  1. package/package.json +8 -8
  2. package/dist/package.json +0 -67
  3. package/dist/src/declarations/plugins/container/AsyncDependenciesBlock.d.ts +0 -57
  4. package/dist/src/declarations/plugins/container/Dependency.d.ts +0 -285
  5. package/dist/src/declarations/plugins/container/Module.d.ts +0 -138
  6. package/dist/src/declarations/plugins/container/ModuleFactory.d.ts +0 -33
  7. package/dist/src/declarations/plugins/container/ObjectDeserializerContext.d.ts +0 -4
  8. package/dist/src/declarations/plugins/container/StaticExportsDependency.d.ts +0 -28
  9. package/dist/src/declarations/plugins/container/Template.d.ts +0 -198
  10. package/dist/src/declarations/plugins/container/WebpackError.d.ts +0 -32
  11. package/dist/src/declarations/plugins/container/WebpackOptions.d.ts +0 -140
  12. package/dist/src/declarations/plugins/sharing/ConsumeSharedPlugin.d.ts +0 -74
  13. package/dist/src/declarations/plugins/sharing/ProvideSharedPlugin.d.ts +0 -67
  14. package/dist/src/declarations/plugins/sharing/SharePlugin.d.ts +0 -78
  15. package/dist/src/index.d.ts +0 -14
  16. package/dist/src/index.js +0 -37
  17. package/dist/src/index.js.map +0 -1
  18. package/dist/src/lib/Constants.d.ts +0 -117
  19. package/dist/src/lib/Constants.js +0 -125
  20. package/dist/src/lib/Constants.js.map +0 -1
  21. package/dist/src/lib/RuntimeGlobals.d.ts +0 -0
  22. package/dist/src/lib/RuntimeGlobals.js +0 -316
  23. package/dist/src/lib/RuntimeGlobals.js.map +0 -1
  24. package/dist/src/lib/container/AsyncBoundaryPlugin.d.ts +0 -20
  25. package/dist/src/lib/container/AsyncBoundaryPlugin.js +0 -183
  26. package/dist/src/lib/container/AsyncBoundaryPlugin.js.map +0 -1
  27. package/dist/src/lib/container/ContainerEntryDependency.d.ts +0 -24
  28. package/dist/src/lib/container/ContainerEntryDependency.js +0 -39
  29. package/dist/src/lib/container/ContainerEntryDependency.js.map +0 -1
  30. package/dist/src/lib/container/ContainerEntryModule.d.ts +0 -75
  31. package/dist/src/lib/container/ContainerEntryModule.js +0 -250
  32. package/dist/src/lib/container/ContainerEntryModule.js.map +0 -1
  33. package/dist/src/lib/container/ContainerEntryModuleFactory.d.ts +0 -15
  34. package/dist/src/lib/container/ContainerEntryModuleFactory.js +0 -30
  35. package/dist/src/lib/container/ContainerEntryModuleFactory.js.map +0 -1
  36. package/dist/src/lib/container/ContainerExposedDependency.d.ts +0 -19
  37. package/dist/src/lib/container/ContainerExposedDependency.js +0 -49
  38. package/dist/src/lib/container/ContainerExposedDependency.js.map +0 -1
  39. package/dist/src/lib/container/ContainerPlugin.d.ts +0 -13
  40. package/dist/src/lib/container/ContainerPlugin.js +0 -185
  41. package/dist/src/lib/container/ContainerPlugin.js.map +0 -1
  42. package/dist/src/lib/container/ContainerReferencePlugin.d.ts +0 -14
  43. package/dist/src/lib/container/ContainerReferencePlugin.js +0 -102
  44. package/dist/src/lib/container/ContainerReferencePlugin.js.map +0 -1
  45. package/dist/src/lib/container/FallbackDependency.d.ts +0 -15
  46. package/dist/src/lib/container/FallbackDependency.js +0 -47
  47. package/dist/src/lib/container/FallbackDependency.js.map +0 -1
  48. package/dist/src/lib/container/FallbackItemDependency.d.ts +0 -3
  49. package/dist/src/lib/container/FallbackItemDependency.js +0 -26
  50. package/dist/src/lib/container/FallbackItemDependency.js.map +0 -1
  51. package/dist/src/lib/container/FallbackModule.d.ts +0 -54
  52. package/dist/src/lib/container/FallbackModule.js +0 -152
  53. package/dist/src/lib/container/FallbackModule.js.map +0 -1
  54. package/dist/src/lib/container/FallbackModuleFactory.d.ts +0 -11
  55. package/dist/src/lib/container/FallbackModuleFactory.js +0 -28
  56. package/dist/src/lib/container/FallbackModuleFactory.js.map +0 -1
  57. package/dist/src/lib/container/HoistContainerReferencesPlugin.d.ts +0 -14
  58. package/dist/src/lib/container/HoistContainerReferencesPlugin.js +0 -61
  59. package/dist/src/lib/container/HoistContainerReferencesPlugin.js.map +0 -1
  60. package/dist/src/lib/container/ModuleFederationPlugin.d.ts +0 -16
  61. package/dist/src/lib/container/ModuleFederationPlugin.js +0 -122
  62. package/dist/src/lib/container/ModuleFederationPlugin.js.map +0 -1
  63. package/dist/src/lib/container/RemoteModule.d.ts +0 -90
  64. package/dist/src/lib/container/RemoteModule.js +0 -148
  65. package/dist/src/lib/container/RemoteModule.js.map +0 -1
  66. package/dist/src/lib/container/RemoteRuntimeModule.d.ts +0 -12
  67. package/dist/src/lib/container/RemoteRuntimeModule.js +0 -101
  68. package/dist/src/lib/container/RemoteRuntimeModule.js.map +0 -1
  69. package/dist/src/lib/container/RemoteToExternalDependency.d.ts +0 -4
  70. package/dist/src/lib/container/RemoteToExternalDependency.js +0 -26
  71. package/dist/src/lib/container/RemoteToExternalDependency.js.map +0 -1
  72. package/dist/src/lib/container/constant.d.ts +0 -3
  73. package/dist/src/lib/container/constant.js +0 -12
  74. package/dist/src/lib/container/constant.js.map +0 -1
  75. package/dist/src/lib/container/options.d.ts +0 -26
  76. package/dist/src/lib/container/options.js +0 -81
  77. package/dist/src/lib/container/options.js.map +0 -1
  78. package/dist/src/lib/container/runtime/FederationRuntimeModule.d.ts +0 -13
  79. package/dist/src/lib/container/runtime/FederationRuntimeModule.js +0 -27
  80. package/dist/src/lib/container/runtime/FederationRuntimeModule.js.map +0 -1
  81. package/dist/src/lib/container/runtime/FederationRuntimePlugin.d.ts +0 -17
  82. package/dist/src/lib/container/runtime/FederationRuntimePlugin.js +0 -200
  83. package/dist/src/lib/container/runtime/FederationRuntimePlugin.js.map +0 -1
  84. package/dist/src/lib/container/runtime/getFederationGlobal.d.ts +0 -5
  85. package/dist/src/lib/container/runtime/getFederationGlobal.js +0 -24
  86. package/dist/src/lib/container/runtime/getFederationGlobal.js.map +0 -1
  87. package/dist/src/lib/container/runtime/utils.d.ts +0 -16
  88. package/dist/src/lib/container/runtime/utils.js +0 -83
  89. package/dist/src/lib/container/runtime/utils.js.map +0 -1
  90. package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.d.ts +0 -3
  91. package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.js +0 -26
  92. package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.js.map +0 -1
  93. package/dist/src/lib/sharing/ConsumeSharedModule.d.ts +0 -99
  94. package/dist/src/lib/sharing/ConsumeSharedModule.js +0 -206
  95. package/dist/src/lib/sharing/ConsumeSharedModule.js.map +0 -1
  96. package/dist/src/lib/sharing/ConsumeSharedPlugin.d.ts +0 -30
  97. package/dist/src/lib/sharing/ConsumeSharedPlugin.js +0 -245
  98. package/dist/src/lib/sharing/ConsumeSharedPlugin.js.map +0 -1
  99. package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.d.ts +0 -31
  100. package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.js +0 -108
  101. package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.js.map +0 -1
  102. package/dist/src/lib/sharing/ProvideForSharedDependency.d.ts +0 -3
  103. package/dist/src/lib/sharing/ProvideForSharedDependency.js +0 -27
  104. package/dist/src/lib/sharing/ProvideForSharedDependency.js.map +0 -1
  105. package/dist/src/lib/sharing/ProvideSharedDependency.d.ts +0 -36
  106. package/dist/src/lib/sharing/ProvideSharedDependency.js +0 -70
  107. package/dist/src/lib/sharing/ProvideSharedDependency.js.map +0 -1
  108. package/dist/src/lib/sharing/ProvideSharedModule.d.ts +0 -67
  109. package/dist/src/lib/sharing/ProvideSharedModule.js +0 -186
  110. package/dist/src/lib/sharing/ProvideSharedModule.js.map +0 -1
  111. package/dist/src/lib/sharing/ProvideSharedModuleFactory.d.ts +0 -18
  112. package/dist/src/lib/sharing/ProvideSharedModuleFactory.js +0 -30
  113. package/dist/src/lib/sharing/ProvideSharedModuleFactory.js.map +0 -1
  114. package/dist/src/lib/sharing/ProvideSharedPlugin.d.ts +0 -47
  115. package/dist/src/lib/sharing/ProvideSharedPlugin.js +0 -195
  116. package/dist/src/lib/sharing/ProvideSharedPlugin.js.map +0 -1
  117. package/dist/src/lib/sharing/SharePlugin.d.ts +0 -41
  118. package/dist/src/lib/sharing/SharePlugin.js +0 -79
  119. package/dist/src/lib/sharing/SharePlugin.js.map +0 -1
  120. package/dist/src/lib/sharing/ShareRuntimeModule.d.ts +0 -14
  121. package/dist/src/lib/sharing/ShareRuntimeModule.js +0 -89
  122. package/dist/src/lib/sharing/ShareRuntimeModule.js.map +0 -1
  123. package/dist/src/lib/sharing/resolveMatchedConfigs.d.ts +0 -12
  124. package/dist/src/lib/sharing/resolveMatchedConfigs.js +0 -66
  125. package/dist/src/lib/sharing/resolveMatchedConfigs.js.map +0 -1
  126. package/dist/src/lib/sharing/utils.d.ts +0 -37
  127. package/dist/src/lib/sharing/utils.js +0 -359
  128. package/dist/src/lib/sharing/utils.js.map +0 -1
  129. package/dist/src/rspack.d.ts +0 -1
  130. package/dist/src/rspack.js +0 -6
  131. package/dist/src/rspack.js.map +0 -1
  132. package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +0 -5
  133. package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js +0 -19
  134. package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js.map +0 -1
  135. package/dist/src/runtime.d.ts +0 -1
  136. package/dist/src/runtime.js +0 -18
  137. package/dist/src/runtime.js.map +0 -1
  138. package/dist/src/schemas/container/ContainerPlugin.check.d.ts +0 -7
  139. package/dist/src/schemas/container/ContainerPlugin.check.js +0 -2318
  140. package/dist/src/schemas/container/ContainerPlugin.check.js.map +0 -1
  141. package/dist/src/schemas/container/ContainerPlugin.d.ts +0 -289
  142. package/dist/src/schemas/container/ContainerPlugin.js +0 -326
  143. package/dist/src/schemas/container/ContainerPlugin.js.map +0 -1
  144. package/dist/src/schemas/container/ContainerReferencePlugin.check.d.ts +0 -7
  145. package/dist/src/schemas/container/ContainerReferencePlugin.check.js +0 -939
  146. package/dist/src/schemas/container/ContainerReferencePlugin.check.js.map +0 -1
  147. package/dist/src/schemas/container/ContainerReferencePlugin.d.ts +0 -87
  148. package/dist/src/schemas/container/ContainerReferencePlugin.js +0 -132
  149. package/dist/src/schemas/container/ContainerReferencePlugin.js.map +0 -1
  150. package/dist/src/schemas/container/ModuleFederationPlugin.check.d.ts +0 -9
  151. package/dist/src/schemas/container/ModuleFederationPlugin.check.js +0 -4001
  152. package/dist/src/schemas/container/ModuleFederationPlugin.check.js.map +0 -1
  153. package/dist/src/schemas/container/ModuleFederationPlugin.d.ts +0 -626
  154. package/dist/src/schemas/container/ModuleFederationPlugin.js +0 -720
  155. package/dist/src/schemas/container/ModuleFederationPlugin.js.map +0 -1
  156. package/dist/src/schemas/sharing/ProviderSharedPlugin.check.d.ts +0 -7
  157. package/dist/src/schemas/sharing/ProviderSharedPlugin.check.js +0 -434
  158. package/dist/src/schemas/sharing/ProviderSharedPlugin.check.js.map +0 -1
  159. package/dist/src/schemas/sharing/ProviderSharedPlugin.d.ts +0 -104
  160. package/dist/src/schemas/sharing/ProviderSharedPlugin.js +0 -119
  161. package/dist/src/schemas/sharing/ProviderSharedPlugin.js.map +0 -1
  162. package/dist/src/types/runtime.d.ts +0 -7
  163. package/dist/src/types/runtime.js +0 -3
  164. package/dist/src/types/runtime.js.map +0 -1
  165. package/dist/src/webpack.d.ts +0 -1
  166. package/dist/src/webpack.js +0 -9
  167. package/dist/src/webpack.js.map +0 -1
  168. package/dist/src/wrapper/AsyncBoundaryPlugin.d.ts +0 -8
  169. package/dist/src/wrapper/AsyncBoundaryPlugin.js +0 -19
  170. package/dist/src/wrapper/AsyncBoundaryPlugin.js.map +0 -1
  171. package/dist/src/wrapper/ConsumeSharedPlugin.d.ts +0 -8
  172. package/dist/src/wrapper/ConsumeSharedPlugin.js +0 -19
  173. package/dist/src/wrapper/ConsumeSharedPlugin.js.map +0 -1
  174. package/dist/src/wrapper/ContainerPlugin.d.ts +0 -8
  175. package/dist/src/wrapper/ContainerPlugin.js +0 -19
  176. package/dist/src/wrapper/ContainerPlugin.js.map +0 -1
  177. package/dist/src/wrapper/ContainerReferencePlugin.d.ts +0 -8
  178. package/dist/src/wrapper/ContainerReferencePlugin.js +0 -19
  179. package/dist/src/wrapper/ContainerReferencePlugin.js.map +0 -1
  180. package/dist/src/wrapper/FederationRuntimePlugin.d.ts +0 -9
  181. package/dist/src/wrapper/FederationRuntimePlugin.js +0 -22
  182. package/dist/src/wrapper/FederationRuntimePlugin.js.map +0 -1
  183. package/dist/src/wrapper/HoistContainerReferencesPlugin.d.ts +0 -6
  184. package/dist/src/wrapper/HoistContainerReferencesPlugin.js +0 -18
  185. package/dist/src/wrapper/HoistContainerReferencesPlugin.js.map +0 -1
  186. package/dist/src/wrapper/ModuleFederationPlugin.d.ts +0 -8
  187. package/dist/src/wrapper/ModuleFederationPlugin.js +0 -24
  188. package/dist/src/wrapper/ModuleFederationPlugin.js.map +0 -1
  189. package/dist/src/wrapper/ProvideSharedPlugin.d.ts +0 -8
  190. package/dist/src/wrapper/ProvideSharedPlugin.js +0 -19
  191. package/dist/src/wrapper/ProvideSharedPlugin.js.map +0 -1
  192. package/dist/src/wrapper/SharePlugin.d.ts +0 -8
  193. package/dist/src/wrapper/SharePlugin.js +0 -19
  194. package/dist/src/wrapper/SharePlugin.js.map +0 -1
@@ -1,148 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- /*
7
- MIT License http://www.opensource.org/licenses/mit-license.php
8
- Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy
9
- */
10
- const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
11
- const FallbackDependency_1 = __importDefault(require("./FallbackDependency"));
12
- const RemoteToExternalDependency_1 = __importDefault(require("./RemoteToExternalDependency"));
13
- const Constants_1 = require("../Constants");
14
- const { sources: webpackSources } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
15
- const { Module, RuntimeGlobals } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
16
- const makeSerializable = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/makeSerializable'));
17
- const TYPES = new Set(['remote', 'share-init']);
18
- const RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]);
19
- class RemoteModule extends Module {
20
- /**
21
- * @param {string} request request string
22
- * @param {string[]} externalRequests list of external requests to containers
23
- * @param {string} internalRequest name of exposed module in container
24
- * @param {string} shareScope the used share scope name
25
- */
26
- constructor(request, externalRequests, internalRequest, shareScope) {
27
- super(Constants_1.WEBPACK_MODULE_TYPE_REMOTE);
28
- this.request = request;
29
- this.externalRequests = externalRequests;
30
- this.internalRequest = internalRequest;
31
- this.shareScope = shareScope;
32
- this._identifier = `remote (${shareScope}) ${this.externalRequests.join(' ')} ${this.internalRequest}`;
33
- }
34
- /**
35
- * @returns {string} a unique identifier of the module
36
- */
37
- identifier() {
38
- return this._identifier;
39
- }
40
- /**
41
- * @param {RequestShortener} requestShortener the request shortener
42
- * @returns {string} a user readable identifier of the module
43
- */
44
- readableIdentifier(requestShortener) {
45
- return `remote ${this.request}`;
46
- }
47
- /**
48
- * @param {LibIdentOptions} options options
49
- * @returns {string | null} an identifier for library inclusion
50
- */
51
- libIdent(options) {
52
- return `${this.layer ? `(${this.layer})/` : ''}webpack/container/remote/${this.request}`;
53
- }
54
- /**
55
- * @param {NeedBuildContext} context context info
56
- * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
57
- * @returns {void}
58
- */
59
- // @ts-ignore
60
- needBuild(context, callback) {
61
- callback(null, !this.buildInfo);
62
- }
63
- /**
64
- * @param {WebpackOptions} options webpack options
65
- * @param {Compilation} compilation the compilation
66
- * @param {ResolverWithOptions} resolver the resolver
67
- * @param {InputFileSystem} fs the file system
68
- * @param {function(WebpackError=): void} callback callback function
69
- * @returns {void}
70
- */
71
- // @ts-ignore
72
- build(options, compilation, resolver, fs, callback) {
73
- this.buildMeta = {};
74
- this.buildInfo = {
75
- strict: true,
76
- };
77
- this.clearDependenciesAndBlocks();
78
- if (this.externalRequests.length === 1) {
79
- this.addDependency(new RemoteToExternalDependency_1.default(this.externalRequests[0]));
80
- }
81
- else {
82
- this.addDependency(new FallbackDependency_1.default(this.externalRequests));
83
- }
84
- callback();
85
- }
86
- /**
87
- * @param {string=} type the source type for which the size should be estimated
88
- * @returns {number} the estimated size of the module (must be non-zero)
89
- */
90
- size(type) {
91
- return 6;
92
- }
93
- /**
94
- * @returns {Set<string>} types available (do not mutate)
95
- */
96
- getSourceTypes() {
97
- return TYPES;
98
- }
99
- /**
100
- * @returns {string | null} absolute path which should be used for condition matching (usually the resource path)
101
- */
102
- nameForCondition() {
103
- return this.request;
104
- }
105
- /**
106
- * @param {CodeGenerationContext} context context for code generation
107
- * @returns {CodeGenerationResult} result
108
- */
109
- // @ts-ignore
110
- codeGeneration(context) {
111
- const { runtimeTemplate, moduleGraph, chunkGraph } = context;
112
- // @ts-ignore
113
- const module = moduleGraph.getModule(this.dependencies[0]);
114
- const id = module && chunkGraph.getModuleId(module);
115
- const sources = new Map();
116
- sources.set('remote', new webpackSources.RawSource(''));
117
- const data = new Map();
118
- data.set('share-init', [
119
- {
120
- shareScope: this.shareScope,
121
- initStage: 20,
122
- init: id === undefined ? '' : `initExternal(${JSON.stringify(id)});`,
123
- },
124
- ]);
125
- return { sources, data, runtimeRequirements: RUNTIME_REQUIREMENTS };
126
- }
127
- serialize(context) {
128
- const { write } = context;
129
- write(this.request);
130
- write(this.externalRequests);
131
- write(this.internalRequest);
132
- write(this.shareScope);
133
- super.serialize(context);
134
- }
135
- /**
136
- * @param {ObjectDeserializerContext} context context
137
- * @returns {RemoteModule} deserialized module
138
- */
139
- static deserialize(context) {
140
- const { read } = context;
141
- const obj = new RemoteModule(read(), read(), read(), read());
142
- obj.deserialize(context);
143
- return obj;
144
- }
145
- }
146
- makeSerializable(RemoteModule, 'enhanced/lib/container/RemoteModule');
147
- exports.default = RemoteModule;
148
- //# sourceMappingURL=RemoteModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RemoteModule.js","sourceRoot":"","sources":["../../../../src/lib/container/RemoteModule.ts"],"names":[],"mappings":";;;;;AAAA;;;EAGE;AACF,0FAAqF;AASrF,8EAAsD;AACtD,8FAAsE;AACtE,4CAA0D;AAM1D,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CACzC,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAC9B,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CACxC,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAC9B,MAAM,gBAAgB,GAAG,OAAO,CAC9B,IAAA,6CAAoB,EAAC,mCAAmC,CAAC,CACJ,CAAC;AAExD,MAAM,KAAK,GAAgB,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;AAC7D,MAAM,oBAAoB,GAAgB,IAAI,GAAG,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AAE3E,MAAM,YAAa,SAAQ,MAAM;IAO/B;;;;;OAKG;IACH,YACE,OAAe,EACf,gBAA0B,EAC1B,eAAuB,EACvB,UAAkB;QAElB,KAAK,CAAC,sCAA0B,CAAC,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,UAAU,KAAK,IAAI,CAAC,gBAAgB,CAAC,IAAI,CACrE,GAAG,CACJ,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;IAC9B,CAAC;IAED;;OAEG;IACM,UAAU;QACjB,OA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;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,OAAkC;QACnD,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QACzB,MAAM,GAAG,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7D,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACzB,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED,gBAAgB,CAAC,YAAY,EAAE,qCAAqC,CAAC,CAAC;AAEtE,kBAAe,YAAY,CAAC"}
@@ -1,12 +0,0 @@
1
- export default RemoteRuntimeModule;
2
- /** @typedef {import("webpack/lib/Chunk")} Chunk */
3
- /** @typedef {import("./RemoteModule")} RemoteModule */
4
- declare class RemoteRuntimeModule extends RuntimeModule {
5
- constructor();
6
- }
7
- declare namespace RemoteRuntimeModule {
8
- export { Chunk, RemoteModule };
9
- }
10
- import RuntimeModule = require('webpack/lib/RuntimeModule');
11
- type Chunk = import('webpack/lib/Chunk');
12
- type RemoteModule = import('./RemoteModule');
@@ -1,101 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /*
4
- MIT License http://www.opensource.org/licenses/mit-license.php
5
- Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy
6
- */
7
- const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
8
- const utils_1 = require("./runtime/utils");
9
- const extractUrlAndGlobal = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/extractUrlAndGlobal'));
10
- const { Template, RuntimeModule, RuntimeGlobals } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
11
- class RemoteRuntimeModule extends RuntimeModule {
12
- constructor() {
13
- super('remotes loading');
14
- }
15
- /**
16
- * @returns {string | null} runtime code
17
- */
18
- generate() {
19
- const { compilation, chunkGraph } = this;
20
- const { runtimeTemplate, moduleGraph } = compilation;
21
- const chunkToRemotesMapping = {};
22
- const idToExternalAndNameMapping = {};
23
- const idToRemoteMap = {};
24
- const allChunks = [
25
- ...Array.from(this.chunk?.getAllReferencedChunks() || []),
26
- ];
27
- for (const chunk of allChunks) {
28
- const modules = chunkGraph?.getChunkModulesIterableBySourceType(chunk, 'remote');
29
- if (!modules) {
30
- continue;
31
- }
32
- // @ts-ignore
33
- const remotes = (chunkToRemotesMapping[chunk.id] = []);
34
- for (const m of modules) {
35
- const module = m;
36
- const name = module.internalRequest;
37
- // @ts-ignore
38
- const id = chunkGraph ? chunkGraph.getModuleId(module) : undefined;
39
- const { shareScope } = module;
40
- const dep = module.dependencies[0];
41
- // @ts-ignore
42
- const externalModule = moduleGraph.getModule(dep);
43
- const externalModuleId = chunkGraph && externalModule
44
- ? // @ts-ignore
45
- chunkGraph.getModuleId(externalModule)
46
- : undefined;
47
- if (id !== undefined) {
48
- //@ts-ignore
49
- remotes.push(id);
50
- idToExternalAndNameMapping[id] = [shareScope, name, externalModuleId];
51
- const remoteModules = [];
52
- // FallbackModule has requests
53
- if ('requests' in externalModule && externalModule.requests) {
54
- externalModule.dependencies.forEach((dependency) => {
55
- const remoteModule = moduleGraph.getModule(dependency);
56
- if (remoteModule) {
57
- // @ts-ignore
58
- remoteModules.push(remoteModule);
59
- }
60
- });
61
- }
62
- else {
63
- remoteModules.push(externalModule);
64
- }
65
- idToRemoteMap[id] = [];
66
- remoteModules.forEach((remoteModule) => {
67
- let remoteName = '';
68
- try {
69
- const [_url, name] = extractUrlAndGlobal(remoteModule.request);
70
- remoteName = name;
71
- }
72
- catch (err) {
73
- //noop
74
- }
75
- const externalModuleId = chunkGraph &&
76
- remoteModule &&
77
- // @ts-ignore
78
- chunkGraph.getModuleId(remoteModule);
79
- idToRemoteMap[id].push({
80
- externalType: remoteModule.externalType,
81
- name: remoteModule.externalType === 'script' ? remoteName : '',
82
- externalModuleId,
83
- });
84
- });
85
- }
86
- }
87
- }
88
- const federationGlobal = (0, utils_1.getFederationGlobalScope)(RuntimeGlobals || {});
89
- return Template.asString([
90
- `var chunkMapping = ${JSON.stringify(chunkToRemotesMapping, null, '\t')};`,
91
- `var idToExternalAndNameMapping = ${JSON.stringify(idToExternalAndNameMapping, null, '\t')};`,
92
- `var idToRemoteMap = ${JSON.stringify(idToRemoteMap, null, '\t')};`,
93
- `${federationGlobal}.bundlerRuntimeOptions.remotes = {idToRemoteMap,chunkMapping, idToExternalAndNameMapping, webpackRequire:${RuntimeGlobals.require}};`,
94
- `${RuntimeGlobals.ensureChunkHandlers}.remotes = ${runtimeTemplate.basicFunction('chunkId, promises', [
95
- `${federationGlobal}.bundlerRuntime.remotes({idToRemoteMap,chunkMapping, idToExternalAndNameMapping, chunkId, promises, webpackRequire:${RuntimeGlobals.require}});`,
96
- ])}`,
97
- ]);
98
- }
99
- }
100
- exports.default = RemoteRuntimeModule;
101
- //# sourceMappingURL=RemoteRuntimeModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RemoteRuntimeModule.js","sourceRoot":"","sources":["../../../../src/lib/container/RemoteRuntimeModule.ts"],"names":[],"mappings":";;AAAA;;;EAGE;AACF,0FAAqF;AAGrF,2CAA2D;AAK3D,MAAM,mBAAmB,GAAG,OAAO,CACjC,IAAA,6CAAoB,EAAC,sCAAsC,CAAC,CACJ,CAAC;AAE3D,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,OAAO,CACzD,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAE9B,MAAM,mBAAoB,SAAQ,aAAa;IAC7C;QACE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACM,QAAQ;QACf,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QACzC,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,WAA0B,CAAC;QACpE,MAAM,qBAAqB,GAAwB,EAAE,CAAC;QACtD,MAAM,0BAA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AC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;QACD,MAAM,gBAAgB,GAAG,IAAA,gCAAwB,EAC/C,cAAc,IAAK,EAA4B,CAChD,CAAC;QAEF,OAAO,QAAQ,CAAC,QAAQ,CAAC;YACvB,sBAAsB,IAAI,CAAC,SAAS,CAClC,qBAAqB,EACrB,IAAI,EACJ,IAAI,CACL,GAAG;YACJ,oCAAoC,IAAI,CAAC,SAAS,CAChD,0BAA0B,EAC1B,IAAI,EACJ,IAAI,CACL,GAAG;YACJ,uBAAuB,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG;YACnE,GAAG,gBAAgB,4GAA4G,cAAc,CAAC,OAAO,IAAI;YACzJ,GACE,cAAc,CAAC,mBACjB,cAAc,eAAe,CAAC,aAAa,CAAC,mBAAmB,EAAE;gBAC/D,GAAG,gBAAgB,sHAAsH,cAAc,CAAC,OAAO,KAAK;aACrK,CAAC,EAAE;SACL,CAAC,CAAC;IACL,CAAC;CACF;AAED,kBAAe,mBAAmB,CAAC"}
@@ -1,4 +0,0 @@
1
- export default RemoteToExternalDependency;
2
- declare class RemoteToExternalDependency extends ModuleDependency {}
3
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
4
- import ModuleDependency from 'webpack/lib/dependencies/ModuleDependency';
@@ -1,26 +0,0 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy
4
- */
5
- 'use strict';
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
8
- const makeSerializable = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/makeSerializable'));
9
- const { dependencies } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
10
- class RemoteToExternalDependency extends dependencies.ModuleDependency {
11
- /**
12
- * @param {string} request request
13
- */
14
- constructor(request) {
15
- super(request);
16
- }
17
- get type() {
18
- return 'remote to external';
19
- }
20
- get category() {
21
- return 'esm';
22
- }
23
- }
24
- makeSerializable(RemoteToExternalDependency, 'enhanced/lib/container/RemoteToExternalDependency');
25
- exports.default = RemoteToExternalDependency;
26
- //# sourceMappingURL=RemoteToExternalDependency.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RemoteToExternalDependency.js","sourceRoot":"","sources":["../../../../src/lib/container/RemoteToExternalDependency.ts"],"names":[],"mappings":"AAAA;;;EAGE;AAEF,YAAY,CAAC;;AACb,0FAAqF;AAErF,MAAM,gBAAgB,GAAG,OAAO,CAC9B,IAAA,6CAAoB,EAAC,mCAAmC,CAAC,CACJ,CAAC;AACxD,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAC9B,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAE9B,MAAM,0BAA2B,SAAQ,YAAY,CAAC,gBAAgB;IACpE;;OAEG;IACH,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IACD,IAAa,IAAI;QACf,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,IAAa,QAAQ;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,gBAAgB,CACd,0BAA0B,EAC1B,mDAAmD,CACpD,CAAC;AAEF,kBAAe,0BAA0B,CAAC"}
@@ -1,3 +0,0 @@
1
- declare const FEDERATION_SUPPORTED_TYPES: string[];
2
- declare const TEMP_DIR: string;
3
- export { FEDERATION_SUPPORTED_TYPES, TEMP_DIR };
@@ -1,12 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.TEMP_DIR = exports.FEDERATION_SUPPORTED_TYPES = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const FEDERATION_SUPPORTED_TYPES = ['script'];
9
- exports.FEDERATION_SUPPORTED_TYPES = FEDERATION_SUPPORTED_TYPES;
10
- const TEMP_DIR = path_1.default.join(`${process.cwd()}/node_modules`, `.federation`);
11
- exports.TEMP_DIR = TEMP_DIR;
12
- //# sourceMappingURL=constant.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constant.js","sourceRoot":"","sources":["../../../../src/lib/container/constant.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,MAAM,0BAA0B,GAAG,CAAC,QAAQ,CAAC,CAAC;AAGrC,gEAA0B;AAFnC,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;AAEtC,4BAAQ"}
@@ -1,26 +0,0 @@
1
- export type ContainerOptionsFormat<T> =
2
- | (string | Record<string, string | string[] | T>)[]
3
- | Record<string, string | string[] | T>;
4
- /**
5
- * @template T
6
- * @template R
7
- * @param {ContainerOptionsFormat<T>} options options passed by the user
8
- * @param {function(string | string[], string) : R} normalizeSimple normalize a simple item
9
- * @param {function(T, string) : R} normalizeOptions normalize a complex item
10
- * @returns {[string, R][]} parsed options
11
- */
12
- export function parseOptions<T, R>(
13
- options: ContainerOptionsFormat<T>,
14
- normalizeSimple: (arg0: string | string[], arg1: string) => R,
15
- normalizeOptions: (arg0: T, arg1: string) => R,
16
- ): [string, R][];
17
- /**
18
- * @template T
19
- * @param {string} scope scope name
20
- * @param {ContainerOptionsFormat<T>} options options passed by the user
21
- * @returns {Record<string, string | string[] | T>} options to spread or pass
22
- */
23
- export function scope<T>(
24
- scope: string,
25
- options: ContainerOptionsFormat<T>,
26
- ): Record<string, string | string[] | T>;
@@ -1,81 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scope = exports.parseOptions = void 0;
4
- /** @template T @typedef {(string | Record<string, string | string[] | T>)[] | Record<string, string | string[] | T>} ContainerOptionsFormat */
5
- /**
6
- * @template T
7
- * @template N
8
- * @param {ContainerOptionsFormat<T>} options options passed by the user
9
- * @param {function(string | string[], string) : N} normalizeSimple normalize a simple item
10
- * @param {function(T, string) : N} normalizeOptions normalize a complex item
11
- * @param {function(string, N): void} fn processing function
12
- * @returns {void}
13
- */
14
- const process = (options, normalizeSimple, normalizeOptions, fn) => {
15
- const array = (items) => {
16
- for (const item of items) {
17
- if (typeof item === 'string') {
18
- fn(item, normalizeSimple(item, item));
19
- }
20
- else if (item && typeof item === 'object') {
21
- object(item);
22
- }
23
- else {
24
- throw new Error('Unexpected options format');
25
- }
26
- }
27
- };
28
- const object = (obj) => {
29
- for (const [key, value] of Object.entries(obj)) {
30
- if (typeof value === 'string' || Array.isArray(value)) {
31
- fn(key, normalizeSimple(value, key));
32
- }
33
- else {
34
- fn(key, normalizeOptions(value, key));
35
- }
36
- }
37
- };
38
- if (!options) {
39
- return;
40
- }
41
- else if (Array.isArray(options)) {
42
- array(options);
43
- }
44
- else if (typeof options === 'object') {
45
- object(options);
46
- }
47
- else {
48
- throw new Error('Unexpected options format');
49
- }
50
- };
51
- /**
52
- * @template T
53
- * @template R
54
- * @param {ContainerOptionsFormat<T>} options options passed by the user
55
- * @param {function(string | string[], string) : R} normalizeSimple normalize a simple item
56
- * @param {function(T, string) : R} normalizeOptions normalize a complex item
57
- * @returns {[string, R][]} parsed options
58
- */
59
- const parseOptions = (options, normalizeSimple, normalizeOptions) => {
60
- const items = [];
61
- process(options, normalizeSimple, normalizeOptions, (key, value) => {
62
- items.push([key, value]);
63
- });
64
- return items;
65
- };
66
- exports.parseOptions = parseOptions;
67
- /**
68
- * @template T
69
- * @param {string} scope scope name
70
- * @param {ContainerOptionsFormat<T>} options options passed by the user
71
- * @returns {Record<string, string | string[] | T>} options to spread or pass
72
- */
73
- const scope = (scope, options) => {
74
- const obj = {};
75
- process(options, (item) => item, (item) => item, (key, value) => {
76
- obj[key.startsWith('./') ? `${scope}${key.slice(1)}` : `${scope}/${key}`] = value;
77
- });
78
- return obj;
79
- };
80
- exports.scope = scope;
81
- //# sourceMappingURL=options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../src/lib/container/options.ts"],"names":[],"mappings":";;;AAQA,+IAA+I;AAE/I;;;;;;;;GAQG;AACH,MAAM,OAAO,GAAG,CACd,OAAkC,EAClC,eAA6D,EAC7D,gBAA8C,EAC9C,EAAmC,EAC7B,EAAE;IACR,MAAM,KAAK,GAAG,CACZ,KAAyD,EACnD,EAAE;QACR,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC7B,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YACxC,CAAC;iBAAM,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC5C,MAAM,CAAC,IAA6C,CAAC,CAAC;YACxD,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,MAAM,MAAM,GAAG,CAAC,GAA0C,EAAQ,EAAE;QAClE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACtD,EAAE,CAAC,GAAG,EAAE,eAAe,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;YACvC,CAAC;iBAAM,CAAC;gBACN,EAAE,CAAC,GAAG,EAAE,gBAAgB,CAAC,KAAU,EAAE,GAAG,CAAC,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb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BAAK"}
@@ -1,13 +0,0 @@
1
- import { NormalizedRuntimeInitOptionsWithOutShared } from '../../../types/runtime';
2
- declare const RuntimeModule: typeof import("webpack").RuntimeModule;
3
- declare class FederationRuntimeModule extends RuntimeModule {
4
- runtimeRequirements: Set<string>;
5
- containerName: string;
6
- initOptionsWithoutShared: NormalizedRuntimeInitOptionsWithOutShared;
7
- constructor(runtimeRequirements: Set<string>, containerName: string, initOptionsWithoutShared: NormalizedRuntimeInitOptionsWithOutShared);
8
- /**
9
- * @returns {string | null} runtime code
10
- */
11
- generate(): string;
12
- }
13
- export default FederationRuntimeModule;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
7
- // inspired by react-refresh-webpack-plugin
8
- const getFederationGlobal_1 = __importDefault(require("./getFederationGlobal"));
9
- const { RuntimeModule, RuntimeGlobals, Template } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
10
- class FederationRuntimeModule extends RuntimeModule {
11
- constructor(runtimeRequirements, containerName, initOptionsWithoutShared) {
12
- super('federation runtime', RuntimeModule.STAGE_NORMAL - 1);
13
- this.runtimeRequirements = runtimeRequirements;
14
- this.containerName = containerName;
15
- this.initOptionsWithoutShared = initOptionsWithoutShared;
16
- }
17
- /**
18
- * @returns {string | null} runtime code
19
- */
20
- generate() {
21
- return Template.asString([
22
- (0, getFederationGlobal_1.default)(Template, RuntimeGlobals, this.initOptionsWithoutShared),
23
- ]);
24
- }
25
- }
26
- exports.default = FederationRuntimeModule;
27
- //# sourceMappingURL=FederationRuntimeModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FederationRuntimeModule.js","sourceRoot":"","sources":["../../../../../src/lib/container/runtime/FederationRuntimeModule.ts"],"names":[],"mappings":";;;;;AAAA,0FAAqF;AACrF,2CAA2C;AAC3C,gFAAwD;AAGxD,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,OAAO,CACzD,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAE9B,MAAM,uBAAwB,SAAQ,aAAa;IAKjD,YACE,mBAAgC,EAChC,aAAqB,EACrB,wBAAmE;QAEnE,KAAK,CAAC,oBAAoB,EAAE,aAAa,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QAC/C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,wBAAwB,GAAG,wBAAwB,CAAC;IAC3D,CAAC;IAED;;OAEG;IACM,QAAQ;QACf,OAAO,QAAQ,CAAC,QAAQ,CAAC;YACvB,IAAA,6BAAmB,EACjB,QAAQ,EACR,cAAc,EACd,IAAI,CAAC,wBAAwB,CAC9B;SACF,CAAC,CAAC;IACL,CAAC;CACF;AACD,kBAAe,uBAAuB,CAAC"}
@@ -1,17 +0,0 @@
1
- import type { Compiler } from 'webpack';
2
- import type { moduleFederationPlugin } from '@module-federation/sdk';
3
- declare class FederationRuntimePlugin {
4
- options?: moduleFederationPlugin.ModuleFederationPluginOptions;
5
- entryFilePath: string;
6
- bundlerRuntimePath: string;
7
- constructor(options?: moduleFederationPlugin.ModuleFederationPluginOptions);
8
- static getTemplate(runtimePlugins: string[], bundlerRuntimePath?: string): string;
9
- static getFilePath(containerName: string, runtimePlugins: string[], bundlerRuntimePath?: string): string;
10
- getFilePath(): string;
11
- ensureFile(): void;
12
- prependEntry(compiler: Compiler): void;
13
- injectRuntime(compiler: Compiler): void;
14
- setRuntimeAlias(compiler: Compiler): void;
15
- apply(compiler: Compiler): void;
16
- }
17
- export default FederationRuntimePlugin;