@module-federation/manifest 0.0.0-next-20250926024003 → 0.0.0-refactor-manifest-20251015072237
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +916 -1880
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +916 -1880
- package/dist/index.esm.js.map +1 -1
- package/dist/src/ManifestManager.d.ts +1 -3
- package/dist/src/ModuleHandler.d.ts +3 -0
- package/dist/src/StatsManager.d.ts +1 -3
- package/dist/src/StatsPlugin.d.ts +1 -3
- package/dist/src/utils.d.ts +0 -4
- package/package.json +4 -4
package/dist/index.cjs.js
CHANGED
|
@@ -1,286 +1,110 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var sdk = require('@module-federation/sdk');
|
|
3
4
|
var chalk = require('chalk');
|
|
4
5
|
var path = require('path');
|
|
5
|
-
var sdk = require('@module-federation/sdk');
|
|
6
6
|
var core = require('@module-federation/dts-plugin/core');
|
|
7
7
|
var fs = require('fs');
|
|
8
8
|
var managers = require('@module-federation/managers');
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const PLUGIN_IDENTIFIER = 'Module Federation Manifest Plugin';
|
|
11
|
+
const HOT_UPDATE_SUFFIX = '.hot-update';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const createBundlerLogger = typeof sdk.createInfrastructureLogger === 'function'
|
|
14
|
+
? sdk.createInfrastructureLogger
|
|
15
|
+
: sdk.createLogger;
|
|
16
|
+
const logger = createBundlerLogger(chalk.cyan(`[ ${PLUGIN_IDENTIFIER} ]`));
|
|
14
17
|
|
|
15
|
-
function _array_like_to_array$2(arr, len) {
|
|
16
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
17
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
18
|
-
return arr2;
|
|
19
|
-
}
|
|
20
|
-
function _array_with_holes$2(arr) {
|
|
21
|
-
if (Array.isArray(arr)) return arr;
|
|
22
|
-
}
|
|
23
|
-
function _array_without_holes$1(arr) {
|
|
24
|
-
if (Array.isArray(arr)) return _array_like_to_array$2(arr);
|
|
25
|
-
}
|
|
26
|
-
function _define_property$2(obj, key, value) {
|
|
27
|
-
if (key in obj) {
|
|
28
|
-
Object.defineProperty(obj, key, {
|
|
29
|
-
value: value,
|
|
30
|
-
enumerable: true,
|
|
31
|
-
configurable: true,
|
|
32
|
-
writable: true
|
|
33
|
-
});
|
|
34
|
-
} else {
|
|
35
|
-
obj[key] = value;
|
|
36
|
-
}
|
|
37
|
-
return obj;
|
|
38
|
-
}
|
|
39
|
-
function _iterable_to_array$1(iter) {
|
|
40
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
41
|
-
}
|
|
42
|
-
function _iterable_to_array_limit$2(arr, i) {
|
|
43
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
44
|
-
if (_i == null) return;
|
|
45
|
-
var _arr = [];
|
|
46
|
-
var _n = true;
|
|
47
|
-
var _d = false;
|
|
48
|
-
var _s, _e;
|
|
49
|
-
try {
|
|
50
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
51
|
-
_arr.push(_s.value);
|
|
52
|
-
if (i && _arr.length === i) break;
|
|
53
|
-
}
|
|
54
|
-
} catch (err) {
|
|
55
|
-
_d = true;
|
|
56
|
-
_e = err;
|
|
57
|
-
} finally{
|
|
58
|
-
try {
|
|
59
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
60
|
-
} finally{
|
|
61
|
-
if (_d) throw _e;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return _arr;
|
|
65
|
-
}
|
|
66
|
-
function _non_iterable_rest$2() {
|
|
67
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
68
|
-
}
|
|
69
|
-
function _non_iterable_spread$1() {
|
|
70
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
71
|
-
}
|
|
72
|
-
function _object_spread$2(target) {
|
|
73
|
-
for(var i = 1; i < arguments.length; i++){
|
|
74
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
75
|
-
var ownKeys = Object.keys(source);
|
|
76
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
77
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
78
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
ownKeys.forEach(function(key) {
|
|
82
|
-
_define_property$2(target, key, source[key]);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
return target;
|
|
86
|
-
}
|
|
87
|
-
function ownKeys$2(object, enumerableOnly) {
|
|
88
|
-
var keys = Object.keys(object);
|
|
89
|
-
if (Object.getOwnPropertySymbols) {
|
|
90
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
91
|
-
keys.push.apply(keys, symbols);
|
|
92
|
-
}
|
|
93
|
-
return keys;
|
|
94
|
-
}
|
|
95
|
-
function _object_spread_props$2(target, source) {
|
|
96
|
-
source = source != null ? source : {};
|
|
97
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
98
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
99
|
-
} else {
|
|
100
|
-
ownKeys$2(Object(source)).forEach(function(key) {
|
|
101
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
return target;
|
|
105
|
-
}
|
|
106
|
-
function _sliced_to_array$2(arr, i) {
|
|
107
|
-
return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$2();
|
|
108
|
-
}
|
|
109
|
-
function _to_consumable_array$1(arr) {
|
|
110
|
-
return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$1();
|
|
111
|
-
}
|
|
112
|
-
function _unsupported_iterable_to_array$2(o, minLen) {
|
|
113
|
-
if (!o) return;
|
|
114
|
-
if (typeof o === "string") return _array_like_to_array$2(o, minLen);
|
|
115
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
116
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
117
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
118
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
|
|
119
|
-
}
|
|
120
18
|
function isHotFile(file) {
|
|
121
19
|
return file.includes(HOT_UPDATE_SUFFIX);
|
|
122
20
|
}
|
|
123
|
-
|
|
124
|
-
assets.forEach(
|
|
21
|
+
const collectAssets = (assets, jsTargetSet, cssTargetSet) => {
|
|
22
|
+
assets.forEach((file) => {
|
|
125
23
|
if (file.endsWith('.css')) {
|
|
126
24
|
cssTargetSet.add(file);
|
|
127
|
-
}
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
128
27
|
if (isDev()) {
|
|
129
28
|
if (!isHotFile(file)) {
|
|
130
29
|
jsTargetSet.add(file);
|
|
131
30
|
}
|
|
132
|
-
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
133
33
|
jsTargetSet.add(file);
|
|
134
34
|
}
|
|
135
35
|
}
|
|
136
36
|
});
|
|
137
37
|
};
|
|
138
38
|
function getSharedModuleName(name) {
|
|
139
|
-
|
|
39
|
+
const [_type, _shared, _module, _shareScope, sharedInfo] = name.split(' ');
|
|
140
40
|
return sharedInfo.split('@').slice(0, -1).join('@');
|
|
141
41
|
}
|
|
142
42
|
function getAssetsByChunkIDs(compilation, chunkIDMap) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
Object.keys(chunkIDMap).forEach(
|
|
146
|
-
|
|
43
|
+
const arrayChunks = Array.from(compilation.chunks);
|
|
44
|
+
const assetMap = {};
|
|
45
|
+
Object.keys(chunkIDMap).forEach((key) => {
|
|
46
|
+
const chunkIDs = Array.from(chunkIDMap[key]);
|
|
147
47
|
if (!assetMap[key]) {
|
|
148
48
|
assetMap[key] = {
|
|
149
49
|
css: new Set(),
|
|
150
|
-
js: new Set()
|
|
50
|
+
js: new Set(),
|
|
151
51
|
};
|
|
152
52
|
}
|
|
153
|
-
chunkIDs.forEach(
|
|
154
|
-
|
|
155
|
-
return item.id === chunkID;
|
|
156
|
-
});
|
|
53
|
+
chunkIDs.forEach((chunkID) => {
|
|
54
|
+
const chunk = arrayChunks.find((item) => item.id === chunkID);
|
|
157
55
|
if (chunk) {
|
|
158
|
-
collectAssets(
|
|
56
|
+
collectAssets([...chunk.files], assetMap[key].js, assetMap[key].css);
|
|
159
57
|
}
|
|
160
58
|
});
|
|
161
59
|
});
|
|
162
|
-
|
|
163
|
-
Object.keys(assetMap).map(
|
|
60
|
+
const assets = {};
|
|
61
|
+
Object.keys(assetMap).map((key) => {
|
|
164
62
|
assets[key] = {
|
|
165
63
|
js: Array.from(assetMap[key].js),
|
|
166
|
-
css: Array.from(assetMap[key].css)
|
|
64
|
+
css: Array.from(assetMap[key].css),
|
|
167
65
|
};
|
|
168
66
|
});
|
|
169
67
|
return assets;
|
|
170
68
|
}
|
|
171
69
|
function findChunk(id, chunks) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
var chunk = _step.value;
|
|
176
|
-
if (id === chunk.id) {
|
|
177
|
-
return chunk;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
} catch (err) {
|
|
181
|
-
_didIteratorError = true;
|
|
182
|
-
_iteratorError = err;
|
|
183
|
-
} finally{
|
|
184
|
-
try {
|
|
185
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
186
|
-
_iterator.return();
|
|
187
|
-
}
|
|
188
|
-
} finally{
|
|
189
|
-
if (_didIteratorError) {
|
|
190
|
-
throw _iteratorError;
|
|
191
|
-
}
|
|
70
|
+
for (const chunk of chunks) {
|
|
71
|
+
if (id === chunk.id) {
|
|
72
|
+
return chunk;
|
|
192
73
|
}
|
|
193
74
|
}
|
|
194
75
|
}
|
|
195
76
|
function getSharedModules(stats, sharedModules) {
|
|
196
|
-
var _stats_modules;
|
|
197
77
|
// 获取入口文件就是实际内容的 module
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
entryContentModuleNames.push(sharedModule.name);
|
|
206
|
-
sum.push([
|
|
207
|
-
getSharedModuleName(module.issuerName),
|
|
208
|
-
module
|
|
209
|
-
]);
|
|
210
|
-
return sum;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
} catch (err) {
|
|
214
|
-
_didIteratorError = true;
|
|
215
|
-
_iteratorError = err;
|
|
216
|
-
} finally{
|
|
217
|
-
try {
|
|
218
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
219
|
-
_iterator.return();
|
|
220
|
-
}
|
|
221
|
-
} finally{
|
|
222
|
-
if (_didIteratorError) {
|
|
223
|
-
throw _iteratorError;
|
|
224
|
-
}
|
|
78
|
+
const entryContentModuleNames = [];
|
|
79
|
+
let effectiveSharedModules = stats.modules?.reduce((sum, module) => {
|
|
80
|
+
for (const sharedModule of sharedModules) {
|
|
81
|
+
if (sharedModule.name === module.issuerName) {
|
|
82
|
+
entryContentModuleNames.push(sharedModule.name);
|
|
83
|
+
sum.push([getSharedModuleName(module.issuerName), module]);
|
|
84
|
+
return sum;
|
|
225
85
|
}
|
|
226
86
|
}
|
|
227
87
|
return sum;
|
|
228
|
-
}, [])
|
|
88
|
+
}, []) || [];
|
|
229
89
|
// 获取入口文件仅作为 Re Export 的 module
|
|
230
|
-
|
|
231
|
-
return !entryContentModuleNames.includes(sharedModule.name);
|
|
232
|
-
});
|
|
90
|
+
const entryReExportModules = sharedModules.filter((sharedModule) => !entryContentModuleNames.includes(sharedModule.name));
|
|
233
91
|
if (entryReExportModules.length) {
|
|
234
|
-
effectiveSharedModules = effectiveSharedModules.concat(stats.modules.reduce(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
var entryReExportModule = _step.value;
|
|
240
|
-
if (flag) {
|
|
241
|
-
break;
|
|
242
|
-
}
|
|
243
|
-
if (module.reasons) {
|
|
244
|
-
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
245
|
-
try {
|
|
246
|
-
for(var _iterator1 = module.reasons[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
247
|
-
var issueModule = _step1.value;
|
|
248
|
-
if (issueModule.moduleName === entryReExportModule.name) {
|
|
249
|
-
sum.push([
|
|
250
|
-
getSharedModuleName(entryReExportModule.name),
|
|
251
|
-
module
|
|
252
|
-
]);
|
|
253
|
-
flag = true;
|
|
254
|
-
break;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
} catch (err) {
|
|
258
|
-
_didIteratorError1 = true;
|
|
259
|
-
_iteratorError1 = err;
|
|
260
|
-
} finally{
|
|
261
|
-
try {
|
|
262
|
-
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
263
|
-
_iterator1.return();
|
|
264
|
-
}
|
|
265
|
-
} finally{
|
|
266
|
-
if (_didIteratorError1) {
|
|
267
|
-
throw _iteratorError1;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
92
|
+
effectiveSharedModules = effectiveSharedModules.concat(stats.modules.reduce((sum, module) => {
|
|
93
|
+
let flag = false;
|
|
94
|
+
for (const entryReExportModule of entryReExportModules) {
|
|
95
|
+
if (flag) {
|
|
96
|
+
break;
|
|
272
97
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
throw _iteratorError;
|
|
98
|
+
if (module.reasons) {
|
|
99
|
+
for (const issueModule of module.reasons) {
|
|
100
|
+
if (issueModule.moduleName === entryReExportModule.name) {
|
|
101
|
+
sum.push([
|
|
102
|
+
getSharedModuleName(entryReExportModule.name),
|
|
103
|
+
module,
|
|
104
|
+
]);
|
|
105
|
+
flag = true;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
284
108
|
}
|
|
285
109
|
}
|
|
286
110
|
}
|
|
@@ -290,37 +114,37 @@ function getSharedModules(stats, sharedModules) {
|
|
|
290
114
|
return effectiveSharedModules;
|
|
291
115
|
}
|
|
292
116
|
function getAssetsByChunk(chunk, entryPointNames) {
|
|
293
|
-
|
|
117
|
+
const assesSet = {
|
|
294
118
|
js: {
|
|
295
119
|
sync: new Set(),
|
|
296
|
-
async: new Set()
|
|
120
|
+
async: new Set(),
|
|
297
121
|
},
|
|
298
122
|
css: {
|
|
299
123
|
sync: new Set(),
|
|
300
|
-
async: new Set()
|
|
301
|
-
}
|
|
124
|
+
async: new Set(),
|
|
125
|
+
},
|
|
302
126
|
};
|
|
303
|
-
|
|
304
|
-
|
|
127
|
+
const collectChunkFiles = (targetChunk, type) => {
|
|
128
|
+
[...targetChunk.groupsIterable].forEach((chunkGroup) => {
|
|
305
129
|
if (chunkGroup.name && !entryPointNames.includes(chunkGroup.name)) {
|
|
306
130
|
collectAssets(chunkGroup.getFiles(), assesSet.js[type], assesSet.css[type]);
|
|
307
131
|
}
|
|
308
132
|
});
|
|
309
133
|
};
|
|
310
134
|
collectChunkFiles(chunk, 'sync');
|
|
311
|
-
|
|
312
|
-
collectAssets(
|
|
135
|
+
[...chunk.getAllAsyncChunks()].forEach((asyncChunk) => {
|
|
136
|
+
collectAssets([...asyncChunk.files], assesSet.js['async'], assesSet.css['async']);
|
|
313
137
|
collectChunkFiles(asyncChunk, 'async');
|
|
314
138
|
});
|
|
315
|
-
|
|
139
|
+
const assets = {
|
|
316
140
|
js: {
|
|
317
141
|
sync: Array.from(assesSet.js.sync),
|
|
318
|
-
async: Array.from(assesSet.js.async)
|
|
142
|
+
async: Array.from(assesSet.js.async),
|
|
319
143
|
},
|
|
320
144
|
css: {
|
|
321
145
|
sync: Array.from(assesSet.css.sync),
|
|
322
|
-
async: Array.from(assesSet.css.async)
|
|
323
|
-
}
|
|
146
|
+
async: Array.from(assesSet.css.async),
|
|
147
|
+
},
|
|
324
148
|
};
|
|
325
149
|
return assets;
|
|
326
150
|
}
|
|
@@ -330,7 +154,7 @@ function assert(condition, msg) {
|
|
|
330
154
|
}
|
|
331
155
|
}
|
|
332
156
|
function error(msg) {
|
|
333
|
-
throw new Error(
|
|
157
|
+
throw new Error(`[ ${PLUGIN_IDENTIFIER} ]: ${msg}`);
|
|
334
158
|
}
|
|
335
159
|
function isDev() {
|
|
336
160
|
return process.env['NODE_ENV'] === 'development';
|
|
@@ -338,462 +162,227 @@ function isDev() {
|
|
|
338
162
|
function getFileNameWithOutExt(str) {
|
|
339
163
|
return str.replace(path.extname(str), '');
|
|
340
164
|
}
|
|
341
|
-
function getFileName(manifestOptions) {
|
|
342
|
-
if (!manifestOptions) {
|
|
343
|
-
return {
|
|
344
|
-
statsFileName: sdk.StatsFileName,
|
|
345
|
-
manifestFileName: sdk.ManifestFileName
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
var filePath = typeof manifestOptions === 'boolean' ? '' : manifestOptions.filePath || '';
|
|
349
|
-
var fileName = typeof manifestOptions === 'boolean' ? '' : manifestOptions.fileName || '';
|
|
350
|
-
var JSON_EXT = '.json';
|
|
351
|
-
var addExt = function(name) {
|
|
352
|
-
if (name.endsWith(JSON_EXT)) {
|
|
353
|
-
return name;
|
|
354
|
-
}
|
|
355
|
-
return "".concat(name).concat(JSON_EXT);
|
|
356
|
-
};
|
|
357
|
-
var insertSuffix = function(name, suffix) {
|
|
358
|
-
return name.replace(JSON_EXT, "".concat(suffix).concat(JSON_EXT));
|
|
359
|
-
};
|
|
360
|
-
var manifestFileName = fileName ? addExt(fileName) : sdk.ManifestFileName;
|
|
361
|
-
var statsFileName = fileName ? insertSuffix(manifestFileName, '-stats') : sdk.StatsFileName;
|
|
362
|
-
return {
|
|
363
|
-
statsFileName: sdk.simpleJoinRemoteEntry(filePath, statsFileName),
|
|
364
|
-
manifestFileName: sdk.simpleJoinRemoteEntry(filePath, manifestFileName)
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
165
|
function getTypesMetaInfo(pluginOptions, context) {
|
|
368
|
-
|
|
166
|
+
const defaultRemoteOptions = {
|
|
369
167
|
generateAPITypes: true,
|
|
370
|
-
compileInChildProcess: true
|
|
168
|
+
compileInChildProcess: true,
|
|
371
169
|
};
|
|
372
|
-
|
|
170
|
+
const defaultTypesMetaInfo = {
|
|
373
171
|
path: '',
|
|
374
172
|
name: '',
|
|
375
173
|
zip: '',
|
|
376
|
-
api: ''
|
|
174
|
+
api: '',
|
|
377
175
|
};
|
|
378
176
|
try {
|
|
379
|
-
|
|
177
|
+
const normalizedDtsOptions = sdk.normalizeOptions(core.isTSProject(pluginOptions.dts, context), {
|
|
380
178
|
generateTypes: defaultRemoteOptions,
|
|
381
|
-
consumeTypes: {}
|
|
179
|
+
consumeTypes: {},
|
|
382
180
|
}, 'mfOptions.dts')(pluginOptions.dts);
|
|
383
181
|
if (normalizedDtsOptions === false) {
|
|
384
182
|
return defaultTypesMetaInfo;
|
|
385
183
|
}
|
|
386
|
-
|
|
184
|
+
const normalizedRemote = sdk.normalizeOptions(true, defaultRemoteOptions, 'mfOptions.dts.generateTypes')(normalizedDtsOptions.generateTypes);
|
|
387
185
|
if (normalizedRemote === false) {
|
|
388
186
|
return defaultTypesMetaInfo;
|
|
389
187
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
188
|
+
const { apiFileName, zipName, zipPrefix } = core.retrieveTypesAssetsInfo({
|
|
189
|
+
...normalizedRemote,
|
|
190
|
+
context,
|
|
191
|
+
moduleFederationConfig: pluginOptions,
|
|
192
|
+
});
|
|
193
|
+
const zip = path.join(zipPrefix, zipName);
|
|
194
|
+
const api = path.join(zipPrefix, apiFileName);
|
|
396
195
|
return {
|
|
397
196
|
path: '',
|
|
398
197
|
name: '',
|
|
399
|
-
zip
|
|
400
|
-
api
|
|
198
|
+
zip,
|
|
199
|
+
api,
|
|
401
200
|
};
|
|
402
|
-
}
|
|
403
|
-
|
|
201
|
+
}
|
|
202
|
+
catch (err) {
|
|
203
|
+
logger.warn(`getTypesMetaInfo failed, it will use the default types meta info, and the errors as belows: ${err}`);
|
|
404
204
|
return defaultTypesMetaInfo;
|
|
405
205
|
}
|
|
406
206
|
}
|
|
407
207
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
var value = info.value;
|
|
412
|
-
} catch (error) {
|
|
413
|
-
reject(error);
|
|
414
|
-
return;
|
|
208
|
+
class ManifestManager {
|
|
209
|
+
constructor() {
|
|
210
|
+
this._options = {};
|
|
415
211
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
} else {
|
|
419
|
-
Promise.resolve(value).then(_next, _throw);
|
|
212
|
+
get manifest() {
|
|
213
|
+
return this._manifest;
|
|
420
214
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
return function() {
|
|
424
|
-
var self = this, args = arguments;
|
|
425
|
-
return new Promise(function(resolve, reject) {
|
|
426
|
-
var gen = fn.apply(self, args);
|
|
427
|
-
function _next(value) {
|
|
428
|
-
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
|
|
429
|
-
}
|
|
430
|
-
function _throw(err) {
|
|
431
|
-
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
|
|
432
|
-
}
|
|
433
|
-
_next(undefined);
|
|
434
|
-
});
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
function _class_call_check$3(instance, Constructor) {
|
|
438
|
-
if (!(instance instanceof Constructor)) {
|
|
439
|
-
throw new TypeError("Cannot call a class as a function");
|
|
215
|
+
init(options) {
|
|
216
|
+
this._options = options;
|
|
440
217
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
for(var i = 0; i < props.length; i++){
|
|
444
|
-
var descriptor = props[i];
|
|
445
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
446
|
-
descriptor.configurable = true;
|
|
447
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
448
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
218
|
+
get fileName() {
|
|
219
|
+
return sdk.getManifestFileName(this._options.manifest).manifestFileName;
|
|
449
220
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
},
|
|
462
|
-
trys: [],
|
|
463
|
-
ops: []
|
|
464
|
-
};
|
|
465
|
-
return g = {
|
|
466
|
-
next: verb(0),
|
|
467
|
-
"throw": verb(1),
|
|
468
|
-
"return": verb(2)
|
|
469
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
470
|
-
return this;
|
|
471
|
-
}), g;
|
|
472
|
-
function verb(n) {
|
|
473
|
-
return function(v) {
|
|
474
|
-
return step([
|
|
475
|
-
n,
|
|
476
|
-
v
|
|
477
|
-
]);
|
|
221
|
+
async generateManifest(options) {
|
|
222
|
+
const { compilation, publicPath, stats, compiler, bundler, additionalData, } = options;
|
|
223
|
+
// Initialize manifest with required properties from stats
|
|
224
|
+
const { id, name, metaData } = stats;
|
|
225
|
+
const manifest = {
|
|
226
|
+
id,
|
|
227
|
+
name,
|
|
228
|
+
metaData,
|
|
229
|
+
shared: [],
|
|
230
|
+
remotes: [],
|
|
231
|
+
exposes: [],
|
|
478
232
|
};
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
_ = 0;
|
|
513
|
-
continue;
|
|
514
|
-
}
|
|
515
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
516
|
-
_.label = op[1];
|
|
517
|
-
break;
|
|
518
|
-
}
|
|
519
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
520
|
-
_.label = t[1];
|
|
521
|
-
t = op;
|
|
522
|
-
break;
|
|
523
|
-
}
|
|
524
|
-
if (t && _.label < t[2]) {
|
|
525
|
-
_.label = t[2];
|
|
526
|
-
_.ops.push(op);
|
|
527
|
-
break;
|
|
528
|
-
}
|
|
529
|
-
if (t[2]) _.ops.pop();
|
|
530
|
-
_.trys.pop();
|
|
531
|
-
continue;
|
|
233
|
+
manifest.exposes = stats.exposes.reduce((sum, cur) => {
|
|
234
|
+
const expose = {
|
|
235
|
+
id: cur.id,
|
|
236
|
+
name: cur.name,
|
|
237
|
+
assets: cur.assets,
|
|
238
|
+
path: cur.path,
|
|
239
|
+
};
|
|
240
|
+
sum.push(expose);
|
|
241
|
+
return sum;
|
|
242
|
+
}, []);
|
|
243
|
+
manifest.shared = stats.shared.reduce((sum, cur) => {
|
|
244
|
+
const shared = {
|
|
245
|
+
id: cur.id,
|
|
246
|
+
name: cur.name,
|
|
247
|
+
version: cur.version,
|
|
248
|
+
singleton: cur.singleton,
|
|
249
|
+
requiredVersion: cur.requiredVersion,
|
|
250
|
+
hash: cur.hash,
|
|
251
|
+
assets: cur.assets,
|
|
252
|
+
};
|
|
253
|
+
sum.push(shared);
|
|
254
|
+
return sum;
|
|
255
|
+
}, []);
|
|
256
|
+
manifest.remotes = stats.remotes.reduce((sum, cur) => {
|
|
257
|
+
// @ts-ignore version/entry will be added as follow
|
|
258
|
+
const remote = {
|
|
259
|
+
federationContainerName: cur.federationContainerName,
|
|
260
|
+
moduleName: cur.moduleName,
|
|
261
|
+
alias: cur.alias,
|
|
262
|
+
};
|
|
263
|
+
if ('entry' in cur) {
|
|
264
|
+
// @ts-ignore
|
|
265
|
+
remote.entry = cur.entry;
|
|
532
266
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
267
|
+
else if ('version' in cur) {
|
|
268
|
+
// @ts-ignore
|
|
269
|
+
remote.entry = cur.version;
|
|
270
|
+
}
|
|
271
|
+
sum.push(remote);
|
|
272
|
+
return sum;
|
|
273
|
+
}, []);
|
|
274
|
+
this._manifest = manifest;
|
|
275
|
+
const manifestFileName = this.fileName;
|
|
276
|
+
if (additionalData) {
|
|
277
|
+
const ret = await additionalData({
|
|
278
|
+
manifest: this._manifest,
|
|
279
|
+
stats,
|
|
280
|
+
pluginOptions: this._options,
|
|
281
|
+
compiler,
|
|
282
|
+
compilation,
|
|
283
|
+
bundler,
|
|
284
|
+
});
|
|
285
|
+
this._manifest = ret || this._manifest;
|
|
286
|
+
}
|
|
287
|
+
compilation.emitAsset(manifestFileName, new compiler.webpack.sources.RawSource(JSON.stringify(this._manifest, null, 2)));
|
|
288
|
+
if (isDev() &&
|
|
289
|
+
(process.env['MF_SSR_PRJ']
|
|
290
|
+
? compiler.options.target !== 'async-node'
|
|
291
|
+
: true)) {
|
|
292
|
+
logger.info(`Manifest Link: ${chalk.cyan(`${publicPath === 'auto' ? '{auto}/' : publicPath}${manifestFileName}`)} `);
|
|
542
293
|
}
|
|
543
|
-
if (op[0] & 5) throw op[1];
|
|
544
294
|
return {
|
|
545
|
-
|
|
546
|
-
|
|
295
|
+
manifest: this._manifest,
|
|
296
|
+
filename: manifestFileName,
|
|
547
297
|
};
|
|
548
298
|
}
|
|
549
299
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
300
|
+
|
|
301
|
+
const isNonEmptyString = (value) => {
|
|
302
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
303
|
+
};
|
|
304
|
+
const normalizeExposeValue = (exposeValue) => {
|
|
305
|
+
if (!exposeValue) {
|
|
306
|
+
return undefined;
|
|
554
307
|
}
|
|
555
|
-
|
|
556
|
-
{
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
return getFileName(this._options.manifest).manifestFileName;
|
|
572
|
-
}
|
|
573
|
-
},
|
|
574
|
-
{
|
|
575
|
-
key: "generateManifest",
|
|
576
|
-
value: function generateManifest(options) {
|
|
577
|
-
var extraOptions = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
578
|
-
var _this = this;
|
|
579
|
-
return _async_to_generator$2(function() {
|
|
580
|
-
var compilation, publicPath, stats, compiler, bundler, additionalData, disableEmit, id, name, metaData, manifest, manifestFileName, ret;
|
|
581
|
-
return _ts_generator$2(this, function(_state) {
|
|
582
|
-
switch(_state.label){
|
|
583
|
-
case 0:
|
|
584
|
-
compilation = options.compilation, publicPath = options.publicPath, stats = options.stats, compiler = options.compiler, bundler = options.bundler, additionalData = options.additionalData;
|
|
585
|
-
disableEmit = extraOptions.disableEmit;
|
|
586
|
-
// Initialize manifest with required properties from stats
|
|
587
|
-
id = stats.id, name = stats.name, metaData = stats.metaData;
|
|
588
|
-
manifest = {
|
|
589
|
-
id: id,
|
|
590
|
-
name: name,
|
|
591
|
-
metaData: metaData,
|
|
592
|
-
shared: [],
|
|
593
|
-
remotes: [],
|
|
594
|
-
exposes: []
|
|
595
|
-
};
|
|
596
|
-
manifest.exposes = stats.exposes.reduce(function(sum, cur) {
|
|
597
|
-
var expose = {
|
|
598
|
-
id: cur.id,
|
|
599
|
-
name: cur.name,
|
|
600
|
-
assets: cur.assets,
|
|
601
|
-
path: cur.path
|
|
602
|
-
};
|
|
603
|
-
sum.push(expose);
|
|
604
|
-
return sum;
|
|
605
|
-
}, []);
|
|
606
|
-
manifest.shared = stats.shared.reduce(function(sum, cur) {
|
|
607
|
-
var shared = {
|
|
608
|
-
id: cur.id,
|
|
609
|
-
name: cur.name,
|
|
610
|
-
version: cur.version,
|
|
611
|
-
singleton: cur.singleton,
|
|
612
|
-
requiredVersion: cur.requiredVersion,
|
|
613
|
-
hash: cur.hash,
|
|
614
|
-
assets: cur.assets
|
|
615
|
-
};
|
|
616
|
-
sum.push(shared);
|
|
617
|
-
return sum;
|
|
618
|
-
}, []);
|
|
619
|
-
manifest.remotes = stats.remotes.reduce(function(sum, cur) {
|
|
620
|
-
// @ts-ignore version/entry will be added as follow
|
|
621
|
-
var remote = {
|
|
622
|
-
federationContainerName: cur.federationContainerName,
|
|
623
|
-
moduleName: cur.moduleName,
|
|
624
|
-
alias: cur.alias
|
|
625
|
-
};
|
|
626
|
-
if ('entry' in cur) {
|
|
627
|
-
// @ts-ignore
|
|
628
|
-
remote.entry = cur.entry;
|
|
629
|
-
} else if ('version' in cur) {
|
|
630
|
-
// @ts-ignore
|
|
631
|
-
remote.entry = cur.version;
|
|
632
|
-
}
|
|
633
|
-
sum.push(remote);
|
|
634
|
-
return sum;
|
|
635
|
-
}, []);
|
|
636
|
-
_this._manifest = manifest;
|
|
637
|
-
manifestFileName = _this.fileName;
|
|
638
|
-
if (!additionalData) return [
|
|
639
|
-
3,
|
|
640
|
-
2
|
|
641
|
-
];
|
|
642
|
-
return [
|
|
643
|
-
4,
|
|
644
|
-
additionalData({
|
|
645
|
-
manifest: _this._manifest,
|
|
646
|
-
stats: stats,
|
|
647
|
-
pluginOptions: _this._options,
|
|
648
|
-
compiler: compiler,
|
|
649
|
-
compilation: compilation,
|
|
650
|
-
bundler: bundler
|
|
651
|
-
})
|
|
652
|
-
];
|
|
653
|
-
case 1:
|
|
654
|
-
ret = _state.sent();
|
|
655
|
-
_this._manifest = ret || _this._manifest;
|
|
656
|
-
_state.label = 2;
|
|
657
|
-
case 2:
|
|
658
|
-
if (!disableEmit) {
|
|
659
|
-
compilation.emitAsset(manifestFileName, new compiler.webpack.sources.RawSource(JSON.stringify(_this._manifest, null, 2)));
|
|
660
|
-
}
|
|
661
|
-
if (isDev() && (process.env['MF_SSR_PRJ'] ? compiler.options.target !== 'async-node' : true)) {
|
|
662
|
-
logger.info("Manifest Link: ".concat(chalk.cyan("".concat(publicPath === 'auto' ? '{auto}/' : publicPath).concat(manifestFileName)), " "));
|
|
663
|
-
}
|
|
664
|
-
return [
|
|
665
|
-
2,
|
|
666
|
-
{
|
|
667
|
-
manifest: _this._manifest,
|
|
668
|
-
filename: manifestFileName
|
|
669
|
-
}
|
|
670
|
-
];
|
|
671
|
-
}
|
|
672
|
-
});
|
|
673
|
-
})();
|
|
308
|
+
const toImportArray = (value) => {
|
|
309
|
+
if (isNonEmptyString(value)) {
|
|
310
|
+
return [value];
|
|
311
|
+
}
|
|
312
|
+
if (Array.isArray(value)) {
|
|
313
|
+
const normalized = value.filter(isNonEmptyString);
|
|
314
|
+
return normalized.length ? normalized : undefined;
|
|
315
|
+
}
|
|
316
|
+
return undefined;
|
|
317
|
+
};
|
|
318
|
+
if (typeof exposeValue === 'object') {
|
|
319
|
+
if ('import' in exposeValue) {
|
|
320
|
+
const { import: rawImport, name } = exposeValue;
|
|
321
|
+
const normalizedImport = toImportArray(rawImport);
|
|
322
|
+
if (!normalizedImport?.length) {
|
|
323
|
+
return undefined;
|
|
674
324
|
}
|
|
325
|
+
return {
|
|
326
|
+
import: normalizedImport,
|
|
327
|
+
...(isNonEmptyString(name) ? { name } : {}),
|
|
328
|
+
};
|
|
675
329
|
}
|
|
676
|
-
|
|
677
|
-
return ManifestManager;
|
|
678
|
-
}();
|
|
679
|
-
|
|
680
|
-
function _array_like_to_array$1(arr, len) {
|
|
681
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
682
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
683
|
-
return arr2;
|
|
684
|
-
}
|
|
685
|
-
function _array_with_holes$1(arr) {
|
|
686
|
-
if (Array.isArray(arr)) return arr;
|
|
687
|
-
}
|
|
688
|
-
function _class_call_check$2(instance, Constructor) {
|
|
689
|
-
if (!(instance instanceof Constructor)) {
|
|
690
|
-
throw new TypeError("Cannot call a class as a function");
|
|
330
|
+
return undefined;
|
|
691
331
|
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
var descriptor = props[i];
|
|
696
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
697
|
-
descriptor.configurable = true;
|
|
698
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
699
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
332
|
+
const normalizedImport = toImportArray(exposeValue);
|
|
333
|
+
if (!normalizedImport?.length) {
|
|
334
|
+
return undefined;
|
|
700
335
|
}
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
if (key in obj) {
|
|
708
|
-
Object.defineProperty(obj, key, {
|
|
709
|
-
value: value,
|
|
710
|
-
enumerable: true,
|
|
711
|
-
configurable: true,
|
|
712
|
-
writable: true
|
|
713
|
-
});
|
|
714
|
-
} else {
|
|
715
|
-
obj[key] = value;
|
|
336
|
+
return { import: normalizedImport };
|
|
337
|
+
};
|
|
338
|
+
const parseContainerExposeEntries = (identifier) => {
|
|
339
|
+
const startIndex = identifier.indexOf('[');
|
|
340
|
+
if (startIndex < 0) {
|
|
341
|
+
return undefined;
|
|
716
342
|
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
var _s, _e;
|
|
726
|
-
try {
|
|
727
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
728
|
-
_arr.push(_s.value);
|
|
729
|
-
if (i && _arr.length === i) break;
|
|
343
|
+
let depth = 0;
|
|
344
|
+
let inString = false;
|
|
345
|
+
let isEscaped = false;
|
|
346
|
+
for (let cursor = startIndex; cursor < identifier.length; cursor++) {
|
|
347
|
+
const char = identifier[cursor];
|
|
348
|
+
if (isEscaped) {
|
|
349
|
+
isEscaped = false;
|
|
350
|
+
continue;
|
|
730
351
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
} finally{
|
|
735
|
-
try {
|
|
736
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
737
|
-
} finally{
|
|
738
|
-
if (_d) throw _e;
|
|
352
|
+
if (char === '\\') {
|
|
353
|
+
isEscaped = true;
|
|
354
|
+
continue;
|
|
739
355
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
if (
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
356
|
+
if (char === '"') {
|
|
357
|
+
inString = !inString;
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
if (inString) {
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
if (char === '[') {
|
|
364
|
+
depth++;
|
|
365
|
+
}
|
|
366
|
+
else if (char === ']') {
|
|
367
|
+
depth--;
|
|
368
|
+
if (depth === 0) {
|
|
369
|
+
const serialized = identifier.slice(startIndex, cursor + 1);
|
|
370
|
+
try {
|
|
371
|
+
return JSON.parse(serialized);
|
|
372
|
+
}
|
|
373
|
+
catch {
|
|
374
|
+
return undefined;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
754
377
|
}
|
|
755
|
-
ownKeys.forEach(function(key) {
|
|
756
|
-
_define_property$1(target, key, source[key]);
|
|
757
|
-
});
|
|
758
|
-
}
|
|
759
|
-
return target;
|
|
760
|
-
}
|
|
761
|
-
function ownKeys$1(object, enumerableOnly) {
|
|
762
|
-
var keys = Object.keys(object);
|
|
763
|
-
if (Object.getOwnPropertySymbols) {
|
|
764
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
765
|
-
keys.push.apply(keys, symbols);
|
|
766
|
-
}
|
|
767
|
-
return keys;
|
|
768
|
-
}
|
|
769
|
-
function _object_spread_props$1(target, source) {
|
|
770
|
-
source = source != null ? source : {};
|
|
771
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
772
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
773
|
-
} else {
|
|
774
|
-
ownKeys$1(Object(source)).forEach(function(key) {
|
|
775
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
776
|
-
});
|
|
777
378
|
}
|
|
778
|
-
return
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
|
|
782
|
-
}
|
|
783
|
-
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
784
|
-
if (!o) return;
|
|
785
|
-
if (typeof o === "string") return _array_like_to_array$1(o, minLen);
|
|
786
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
787
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
788
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
789
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
790
|
-
}
|
|
791
|
-
var getExposeName = function(exposeKey) {
|
|
379
|
+
return undefined;
|
|
380
|
+
};
|
|
381
|
+
const getExposeName = (exposeKey) => {
|
|
792
382
|
return exposeKey.replace('./', '');
|
|
793
383
|
};
|
|
794
|
-
function getExposeItem(
|
|
795
|
-
|
|
796
|
-
var exposeModuleName = getExposeName(exposeKey);
|
|
384
|
+
function getExposeItem({ exposeKey, name, file, }) {
|
|
385
|
+
const exposeModuleName = getExposeName(exposeKey);
|
|
797
386
|
return {
|
|
798
387
|
path: exposeKey,
|
|
799
388
|
id: sdk.composeKeyWithSeparator(name, exposeModuleName),
|
|
@@ -804,542 +393,331 @@ function getExposeItem(param) {
|
|
|
804
393
|
assets: {
|
|
805
394
|
js: {
|
|
806
395
|
async: [],
|
|
807
|
-
sync: []
|
|
396
|
+
sync: [],
|
|
808
397
|
},
|
|
809
398
|
css: {
|
|
810
399
|
async: [],
|
|
811
|
-
sync: []
|
|
812
|
-
}
|
|
813
|
-
}
|
|
400
|
+
sync: [],
|
|
401
|
+
},
|
|
402
|
+
},
|
|
814
403
|
};
|
|
815
404
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
var bundler = param.bundler;
|
|
819
|
-
_class_call_check$2(this, ModuleHandler);
|
|
405
|
+
class ModuleHandler {
|
|
406
|
+
constructor(options, modules, { bundler }) {
|
|
820
407
|
this._bundler = 'webpack';
|
|
821
408
|
this._remoteManager = new managers.RemoteManager();
|
|
822
409
|
this._sharedManager = new managers.SharedManager();
|
|
823
410
|
this._options = options;
|
|
824
411
|
this._modules = modules;
|
|
825
412
|
this._bundler = bundler;
|
|
413
|
+
this._containerManager = new managers.ContainerManager();
|
|
414
|
+
this._containerManager.init(options);
|
|
826
415
|
this._remoteManager = new managers.RemoteManager();
|
|
827
416
|
this._remoteManager.init(options);
|
|
828
417
|
this._sharedManager = new managers.SharedManager();
|
|
829
418
|
this._sharedManager.init(options);
|
|
830
419
|
}
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
420
|
+
get isRspack() {
|
|
421
|
+
return this._bundler === 'rspack';
|
|
422
|
+
}
|
|
423
|
+
_handleSharedModule(mod, sharedMap, exposesMap) {
|
|
424
|
+
const { identifier, moduleType } = mod;
|
|
425
|
+
if (!identifier) {
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
const sharedManagerNormalizedOptions = this._sharedManager.normalizedOptions;
|
|
429
|
+
const initShared = (pkgName, pkgVersion) => {
|
|
430
|
+
if (sharedMap[pkgName]) {
|
|
431
|
+
return;
|
|
836
432
|
}
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
433
|
+
sharedMap[pkgName] = {
|
|
434
|
+
...sharedManagerNormalizedOptions[pkgName],
|
|
435
|
+
id: `${this._options.name}:${pkgName}`,
|
|
436
|
+
requiredVersion: sharedManagerNormalizedOptions[pkgName]?.requiredVersion ||
|
|
437
|
+
`^${pkgVersion}`,
|
|
438
|
+
name: pkgName,
|
|
439
|
+
version: pkgVersion,
|
|
440
|
+
assets: {
|
|
441
|
+
js: {
|
|
442
|
+
async: [],
|
|
443
|
+
sync: [],
|
|
444
|
+
},
|
|
445
|
+
css: {
|
|
446
|
+
async: [],
|
|
447
|
+
sync: [],
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
// @ts-ignore to deduplicate
|
|
451
|
+
usedIn: new Set(),
|
|
452
|
+
};
|
|
453
|
+
};
|
|
454
|
+
const collectRelationshipMap = (mod, pkgName) => {
|
|
455
|
+
const { issuerName, reasons } = mod;
|
|
456
|
+
if (issuerName) {
|
|
457
|
+
if (exposesMap[getFileNameWithOutExt(issuerName)]) {
|
|
458
|
+
const expose = exposesMap[getFileNameWithOutExt(issuerName)];
|
|
459
|
+
// @ts-ignore use Set to deduplicate
|
|
460
|
+
expose.requires.push(pkgName);
|
|
461
|
+
// @ts-ignore use Set to deduplicate
|
|
462
|
+
sharedMap[pkgName].usedIn.add(expose.path);
|
|
845
463
|
}
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
name: pkgName,
|
|
856
|
-
version: pkgVersion,
|
|
857
|
-
assets: {
|
|
858
|
-
js: {
|
|
859
|
-
async: [],
|
|
860
|
-
sync: []
|
|
861
|
-
},
|
|
862
|
-
css: {
|
|
863
|
-
async: [],
|
|
864
|
-
sync: []
|
|
865
|
-
}
|
|
866
|
-
},
|
|
867
|
-
// @ts-ignore to deduplicate
|
|
868
|
-
usedIn: new Set()
|
|
869
|
-
});
|
|
870
|
-
};
|
|
871
|
-
var collectRelationshipMap = function(mod, pkgName) {
|
|
872
|
-
var issuerName = mod.issuerName, reasons = mod.reasons;
|
|
873
|
-
if (issuerName) {
|
|
874
|
-
if (exposesMap[getFileNameWithOutExt(issuerName)]) {
|
|
875
|
-
var expose = exposesMap[getFileNameWithOutExt(issuerName)];
|
|
876
|
-
// @ts-ignore use Set to deduplicate
|
|
464
|
+
}
|
|
465
|
+
if (reasons) {
|
|
466
|
+
reasons.forEach(({ resolvedModule, moduleName }) => {
|
|
467
|
+
let exposeModName = this.isRspack ? moduleName : resolvedModule;
|
|
468
|
+
// filters out entrypoints
|
|
469
|
+
if (exposeModName) {
|
|
470
|
+
if (exposesMap[getFileNameWithOutExt(exposeModName)]) {
|
|
471
|
+
const expose = exposesMap[getFileNameWithOutExt(exposeModName)];
|
|
472
|
+
// @ts-ignore to deduplicate
|
|
877
473
|
expose.requires.push(pkgName);
|
|
878
|
-
// @ts-ignore
|
|
474
|
+
// @ts-ignore to deduplicate
|
|
879
475
|
sharedMap[pkgName].usedIn.add(expose.path);
|
|
880
476
|
}
|
|
881
477
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
const parseResolvedIdentifier = (nameAndVersion) => {
|
|
482
|
+
let name = '';
|
|
483
|
+
let version = '';
|
|
484
|
+
if (nameAndVersion.startsWith('@')) {
|
|
485
|
+
const splitInfo = nameAndVersion.split('@');
|
|
486
|
+
splitInfo[0] = '@';
|
|
487
|
+
name = splitInfo[0] + splitInfo[1];
|
|
488
|
+
version = splitInfo[2];
|
|
489
|
+
}
|
|
490
|
+
else if (nameAndVersion.includes('@')) {
|
|
491
|
+
[name, version] = nameAndVersion.split('@');
|
|
492
|
+
version = version.replace(/[\^~>|>=]/g, '');
|
|
493
|
+
}
|
|
494
|
+
return {
|
|
495
|
+
name,
|
|
496
|
+
version,
|
|
497
|
+
};
|
|
498
|
+
};
|
|
499
|
+
if (moduleType === 'provide-module') {
|
|
500
|
+
// identifier(rspack) = provide shared module (default) react@18.2.0 = /temp/node_modules/.pnpm/react@18.2.0/node_modules/react/index.js
|
|
501
|
+
// identifier(webpack) = provide module (default) react@18.2.0 = /temp/node_modules/.pnpm/react@18.2.0/node_modules/react/index.js
|
|
502
|
+
const data = identifier.split(' ');
|
|
503
|
+
const nameAndVersion = this.isRspack ? data[4] : data[3];
|
|
504
|
+
const { name, version } = parseResolvedIdentifier(nameAndVersion);
|
|
505
|
+
if (name && version) {
|
|
506
|
+
initShared(name, version);
|
|
507
|
+
collectRelationshipMap(mod, name);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
if (moduleType === 'consume-shared-module') {
|
|
511
|
+
// identifier(rspack) = consume shared module (default) lodash/get@^4.17.21 (strict) (fallback: /temp/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js)
|
|
512
|
+
// identifier(webpack) = consume-shared-module|default|react-dom|!=1.8...2...0|false|/temp/node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/index.js|true|false
|
|
513
|
+
const SEPARATOR = this.isRspack ? ' ' : '|';
|
|
514
|
+
const data = identifier.split(SEPARATOR);
|
|
515
|
+
let pkgName = '';
|
|
516
|
+
let pkgVersion = '';
|
|
517
|
+
if (this.isRspack) {
|
|
518
|
+
const nameAndVersion = data[4];
|
|
519
|
+
const res = parseResolvedIdentifier(nameAndVersion);
|
|
520
|
+
pkgName = res.name;
|
|
521
|
+
pkgVersion = res.version;
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
pkgName = data[2];
|
|
525
|
+
const pkgVersionRange = data[3];
|
|
526
|
+
pkgVersion = '';
|
|
527
|
+
if (pkgVersionRange.startsWith('=')) {
|
|
528
|
+
pkgVersion = data[3].replace('=', '');
|
|
927
529
|
}
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
pkgVersion = '';
|
|
944
|
-
if (pkgVersionRange.startsWith('=')) {
|
|
945
|
-
pkgVersion = data1[3].replace('=', '');
|
|
946
|
-
} else {
|
|
947
|
-
if (sharedManagerNormalizedOptions[pkgName]) {
|
|
948
|
-
pkgVersion = sharedManagerNormalizedOptions[pkgName].version;
|
|
949
|
-
} else {
|
|
950
|
-
var fullPkgName = pkgName.split('/').slice(0, -1).join('/');
|
|
951
|
-
// pkgName: react-dom/
|
|
952
|
-
if (sharedManagerNormalizedOptions["".concat(fullPkgName, "/")]) {
|
|
953
|
-
if (sharedManagerNormalizedOptions[fullPkgName]) {
|
|
954
|
-
pkgVersion = sharedManagerNormalizedOptions[fullPkgName].version;
|
|
955
|
-
} else {
|
|
956
|
-
pkgVersion = sharedManagerNormalizedOptions["".concat(fullPkgName, "/")].version;
|
|
957
|
-
}
|
|
958
|
-
}
|
|
530
|
+
else {
|
|
531
|
+
if (sharedManagerNormalizedOptions[pkgName]) {
|
|
532
|
+
pkgVersion = sharedManagerNormalizedOptions[pkgName].version;
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
const fullPkgName = pkgName.split('/').slice(0, -1).join('/');
|
|
536
|
+
// pkgName: react-dom/
|
|
537
|
+
if (sharedManagerNormalizedOptions[`${fullPkgName}/`]) {
|
|
538
|
+
if (sharedManagerNormalizedOptions[fullPkgName]) {
|
|
539
|
+
pkgVersion =
|
|
540
|
+
sharedManagerNormalizedOptions[fullPkgName].version;
|
|
541
|
+
}
|
|
542
|
+
else {
|
|
543
|
+
pkgVersion =
|
|
544
|
+
sharedManagerNormalizedOptions[`${fullPkgName}/`].version;
|
|
959
545
|
}
|
|
960
546
|
}
|
|
961
547
|
}
|
|
962
|
-
if (pkgName && pkgVersion) {
|
|
963
|
-
initShared(pkgName, pkgVersion);
|
|
964
|
-
collectRelationshipMap(mod, pkgName);
|
|
965
|
-
}
|
|
966
548
|
}
|
|
967
549
|
}
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
value: function _handleRemoteModule(mod, remotes, remotesConsumerMap) {
|
|
972
|
-
var _this = this;
|
|
973
|
-
var identifier = mod.identifier, reasons = mod.reasons, nameForCondition = mod.nameForCondition;
|
|
974
|
-
if (!identifier) {
|
|
975
|
-
return;
|
|
976
|
-
}
|
|
977
|
-
var remoteManagerNormalizedOptions = this._remoteManager.normalizedOptions;
|
|
978
|
-
// identifier = remote (default) webpack/container/reference/app2 ./Button
|
|
979
|
-
var data = identifier.split(' ');
|
|
980
|
-
if (data.length === 4) {
|
|
981
|
-
var moduleName = data[3].replace('./', '');
|
|
982
|
-
var remoteAlias = data[2].replace('webpack/container/reference/', '');
|
|
983
|
-
var normalizedRemote = remoteManagerNormalizedOptions[remoteAlias];
|
|
984
|
-
var basicRemote = {
|
|
985
|
-
alias: normalizedRemote.alias,
|
|
986
|
-
consumingFederationContainerName: this._options.name || '',
|
|
987
|
-
federationContainerName: remoteManagerNormalizedOptions[remoteAlias].name,
|
|
988
|
-
moduleName: moduleName,
|
|
989
|
-
// @ts-ignore to deduplicate
|
|
990
|
-
usedIn: new Set()
|
|
991
|
-
};
|
|
992
|
-
if (!nameForCondition) {
|
|
993
|
-
return;
|
|
994
|
-
}
|
|
995
|
-
var remote;
|
|
996
|
-
if ('version' in normalizedRemote) {
|
|
997
|
-
remote = _object_spread_props$1(_object_spread$1({}, basicRemote), {
|
|
998
|
-
version: normalizedRemote.version
|
|
999
|
-
});
|
|
1000
|
-
} else {
|
|
1001
|
-
remote = _object_spread_props$1(_object_spread$1({}, basicRemote), {
|
|
1002
|
-
entry: normalizedRemote.entry
|
|
1003
|
-
});
|
|
1004
|
-
}
|
|
1005
|
-
remotes.push(remote);
|
|
1006
|
-
remotesConsumerMap[nameForCondition] = remote;
|
|
1007
|
-
}
|
|
1008
|
-
if (reasons) {
|
|
1009
|
-
reasons.forEach(function(param) {
|
|
1010
|
-
var userRequest = param.userRequest, resolvedModule = param.resolvedModule, moduleName = param.moduleName;
|
|
1011
|
-
var exposeModName = _this.isRspack ? moduleName : resolvedModule;
|
|
1012
|
-
if (userRequest && exposeModName && remotesConsumerMap[userRequest]) {
|
|
1013
|
-
// @ts-ignore to deduplicate
|
|
1014
|
-
remotesConsumerMap[userRequest].usedIn.add(exposeModName.replace('./', ''));
|
|
1015
|
-
}
|
|
1016
|
-
});
|
|
1017
|
-
}
|
|
550
|
+
if (pkgName && pkgVersion) {
|
|
551
|
+
initShared(pkgName, pkgVersion);
|
|
552
|
+
collectRelationshipMap(mod, pkgName);
|
|
1018
553
|
}
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
_handleRemoteModule(mod, remotes, remotesConsumerMap) {
|
|
557
|
+
const { identifier, reasons, nameForCondition } = mod;
|
|
558
|
+
if (!identifier) {
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
const remoteManagerNormalizedOptions = this._remoteManager.normalizedOptions;
|
|
562
|
+
// identifier = remote (default) webpack/container/reference/app2 ./Button
|
|
563
|
+
const data = identifier.split(' ');
|
|
564
|
+
if (data.length === 4) {
|
|
565
|
+
const moduleName = data[3].replace('./', '');
|
|
566
|
+
const remoteAlias = data[2].replace('webpack/container/reference/', '');
|
|
567
|
+
const normalizedRemote = remoteManagerNormalizedOptions[remoteAlias];
|
|
568
|
+
const basicRemote = {
|
|
569
|
+
alias: normalizedRemote.alias,
|
|
570
|
+
consumingFederationContainerName: this._options.name || '',
|
|
571
|
+
federationContainerName: remoteManagerNormalizedOptions[remoteAlias].name,
|
|
572
|
+
moduleName,
|
|
573
|
+
// @ts-ignore to deduplicate
|
|
574
|
+
usedIn: new Set(),
|
|
575
|
+
};
|
|
576
|
+
if (!nameForCondition) {
|
|
577
|
+
return;
|
|
1039
578
|
}
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
var remotes = [];
|
|
1046
|
-
var remotesConsumerMap = {};
|
|
1047
|
-
var exposesMap = {};
|
|
1048
|
-
var sharedMap = {};
|
|
1049
|
-
var isSharedModule = function(moduleType) {
|
|
1050
|
-
return Boolean(moduleType && [
|
|
1051
|
-
'provide-module',
|
|
1052
|
-
'consume-shared-module'
|
|
1053
|
-
].includes(moduleType));
|
|
1054
|
-
};
|
|
1055
|
-
var isContainerModule = function(identifier) {
|
|
1056
|
-
var data = identifier.split(' ');
|
|
1057
|
-
return Boolean(data[0] === 'container' && data[1] === 'entry');
|
|
579
|
+
let remote;
|
|
580
|
+
if ('version' in normalizedRemote) {
|
|
581
|
+
remote = {
|
|
582
|
+
...basicRemote,
|
|
583
|
+
version: normalizedRemote.version,
|
|
1058
584
|
};
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
this._modules.forEach(function(mod) {
|
|
1065
|
-
var identifier = mod.identifier; mod.reasons; mod.nameForCondition; var moduleType = mod.moduleType;
|
|
1066
|
-
if (!identifier) {
|
|
1067
|
-
return;
|
|
1068
|
-
}
|
|
1069
|
-
if (isSharedModule(moduleType)) {
|
|
1070
|
-
_this._handleSharedModule(mod, sharedMap, exposesMap);
|
|
1071
|
-
}
|
|
1072
|
-
if (isRemoteModule(identifier)) {
|
|
1073
|
-
_this._handleRemoteModule(mod, remotes, remotesConsumerMap);
|
|
1074
|
-
} else if (isContainerModule(identifier)) {
|
|
1075
|
-
_this._handleContainerModule(mod, exposesMap);
|
|
1076
|
-
}
|
|
1077
|
-
});
|
|
1078
|
-
return {
|
|
1079
|
-
remotes: remotes,
|
|
1080
|
-
exposesMap: exposesMap,
|
|
1081
|
-
sharedMap: sharedMap
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
remote = {
|
|
588
|
+
...basicRemote,
|
|
589
|
+
entry: normalizedRemote.entry,
|
|
1082
590
|
};
|
|
1083
591
|
}
|
|
592
|
+
remotes.push(remote);
|
|
593
|
+
remotesConsumerMap[nameForCondition] = remote;
|
|
594
|
+
}
|
|
595
|
+
if (reasons) {
|
|
596
|
+
reasons.forEach(({ userRequest, resolvedModule, moduleName }) => {
|
|
597
|
+
let exposeModName = this.isRspack ? moduleName : resolvedModule;
|
|
598
|
+
if (userRequest && exposeModName && remotesConsumerMap[userRequest]) {
|
|
599
|
+
// @ts-ignore to deduplicate
|
|
600
|
+
remotesConsumerMap[userRequest].usedIn.add(exposeModName.replace('./', ''));
|
|
601
|
+
}
|
|
602
|
+
});
|
|
1084
603
|
}
|
|
1085
|
-
]);
|
|
1086
|
-
return ModuleHandler;
|
|
1087
|
-
}();
|
|
1088
|
-
|
|
1089
|
-
/* eslint-disable max-lines-per-function */ /* eslint-disable @typescript-eslint/member-ordering */ /* eslint-disable max-depth */ function _array_like_to_array(arr, len) {
|
|
1090
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
1091
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1092
|
-
return arr2;
|
|
1093
|
-
}
|
|
1094
|
-
function _array_with_holes(arr) {
|
|
1095
|
-
if (Array.isArray(arr)) return arr;
|
|
1096
|
-
}
|
|
1097
|
-
function _array_without_holes(arr) {
|
|
1098
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
1099
|
-
}
|
|
1100
|
-
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1101
|
-
try {
|
|
1102
|
-
var info = gen[key](arg);
|
|
1103
|
-
var value = info.value;
|
|
1104
|
-
} catch (error) {
|
|
1105
|
-
reject(error);
|
|
1106
|
-
return;
|
|
1107
|
-
}
|
|
1108
|
-
if (info.done) {
|
|
1109
|
-
resolve(value);
|
|
1110
|
-
} else {
|
|
1111
|
-
Promise.resolve(value).then(_next, _throw);
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
function _async_to_generator$1(fn) {
|
|
1115
|
-
return function() {
|
|
1116
|
-
var self = this, args = arguments;
|
|
1117
|
-
return new Promise(function(resolve, reject) {
|
|
1118
|
-
var gen = fn.apply(self, args);
|
|
1119
|
-
function _next(value) {
|
|
1120
|
-
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
|
|
1121
|
-
}
|
|
1122
|
-
function _throw(err) {
|
|
1123
|
-
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1124
|
-
}
|
|
1125
|
-
_next(undefined);
|
|
1126
|
-
});
|
|
1127
|
-
};
|
|
1128
|
-
}
|
|
1129
|
-
function _class_call_check$1(instance, Constructor) {
|
|
1130
|
-
if (!(instance instanceof Constructor)) {
|
|
1131
|
-
throw new TypeError("Cannot call a class as a function");
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
function _defineProperties$1(target, props) {
|
|
1135
|
-
for(var i = 0; i < props.length; i++){
|
|
1136
|
-
var descriptor = props[i];
|
|
1137
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
1138
|
-
descriptor.configurable = true;
|
|
1139
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
1140
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1141
604
|
}
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
605
|
+
_handleContainerModule(mod, exposesMap) {
|
|
606
|
+
const { identifier } = mod;
|
|
607
|
+
if (!identifier) {
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
// identifier: container entry (default) [[".",{"import":["./src/routes/page.tsx"],"name":"__federation_expose_default_export"}]]'
|
|
611
|
+
const entries = parseContainerExposeEntries(identifier) ??
|
|
612
|
+
this._getContainerExposeEntriesFromOptions();
|
|
613
|
+
if (!entries) {
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
entries.forEach(([prefixedName, file]) => {
|
|
617
|
+
// TODO: support multiple import
|
|
618
|
+
exposesMap[getFileNameWithOutExt(file.import[0])] = getExposeItem({
|
|
619
|
+
exposeKey: prefixedName,
|
|
620
|
+
name: this._options.name,
|
|
621
|
+
file,
|
|
622
|
+
});
|
|
1154
623
|
});
|
|
1155
|
-
} else {
|
|
1156
|
-
obj[key] = value;
|
|
1157
624
|
}
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
try {
|
|
1171
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
1172
|
-
_arr.push(_s.value);
|
|
1173
|
-
if (i && _arr.length === i) break;
|
|
625
|
+
_getContainerExposeEntriesFromOptions() {
|
|
626
|
+
const exposes = this._containerManager.containerPluginExposesOptions;
|
|
627
|
+
const normalizedEntries = Object.entries(exposes).reduce((acc, [exposeKey, exposeOptions]) => {
|
|
628
|
+
const normalizedExpose = normalizeExposeValue(exposeOptions);
|
|
629
|
+
if (!normalizedExpose?.import.length) {
|
|
630
|
+
return acc;
|
|
631
|
+
}
|
|
632
|
+
acc.push([exposeKey, normalizedExpose]);
|
|
633
|
+
return acc;
|
|
634
|
+
}, []);
|
|
635
|
+
if (normalizedEntries.length) {
|
|
636
|
+
return normalizedEntries;
|
|
1174
637
|
}
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
} finally{
|
|
1179
|
-
try {
|
|
1180
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
1181
|
-
} finally{
|
|
1182
|
-
if (_d) throw _e;
|
|
638
|
+
const rawExposes = this._options.exposes;
|
|
639
|
+
if (!rawExposes || Array.isArray(rawExposes)) {
|
|
640
|
+
return undefined;
|
|
1183
641
|
}
|
|
642
|
+
const normalizedFromOptions = Object.entries(rawExposes).reduce((acc, [exposeKey, exposeOptions]) => {
|
|
643
|
+
const normalizedExpose = normalizeExposeValue(exposeOptions);
|
|
644
|
+
if (!normalizedExpose?.import.length) {
|
|
645
|
+
return acc;
|
|
646
|
+
}
|
|
647
|
+
acc.push([exposeKey, normalizedExpose]);
|
|
648
|
+
return acc;
|
|
649
|
+
}, []);
|
|
650
|
+
return normalizedFromOptions.length ? normalizedFromOptions : undefined;
|
|
1184
651
|
}
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1189
|
-
}
|
|
1190
|
-
function _non_iterable_spread() {
|
|
1191
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1192
|
-
}
|
|
1193
|
-
function _object_spread(target) {
|
|
1194
|
-
for(var i = 1; i < arguments.length; i++){
|
|
1195
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
1196
|
-
var ownKeys = Object.keys(source);
|
|
1197
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
1198
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
1199
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
1200
|
-
}));
|
|
652
|
+
_initializeExposesFromOptions(exposesMap) {
|
|
653
|
+
if (!this._options.name || !this._containerManager.enable) {
|
|
654
|
+
return;
|
|
1201
655
|
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
1220
|
-
} else {
|
|
1221
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
1222
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
656
|
+
const exposes = this._containerManager.containerPluginExposesOptions;
|
|
657
|
+
Object.entries(exposes).forEach(([exposeKey, exposeOptions]) => {
|
|
658
|
+
if (!exposeOptions.import?.length) {
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
const [exposeImport] = exposeOptions.import;
|
|
662
|
+
if (!exposeImport) {
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
const exposeMapKey = getFileNameWithOutExt(exposeImport);
|
|
666
|
+
if (!exposesMap[exposeMapKey]) {
|
|
667
|
+
exposesMap[exposeMapKey] = getExposeItem({
|
|
668
|
+
exposeKey,
|
|
669
|
+
name: this._options.name,
|
|
670
|
+
file: exposeOptions,
|
|
671
|
+
});
|
|
672
|
+
}
|
|
1223
673
|
});
|
|
1224
674
|
}
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
"@swc/helpers - typeof";
|
|
1235
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1236
|
-
}
|
|
1237
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
1238
|
-
if (!o) return;
|
|
1239
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
1240
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1241
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1242
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1243
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
1244
|
-
}
|
|
1245
|
-
function _ts_generator$1(thisArg, body) {
|
|
1246
|
-
var f, y, t, g, _ = {
|
|
1247
|
-
label: 0,
|
|
1248
|
-
sent: function() {
|
|
1249
|
-
if (t[0] & 1) throw t[1];
|
|
1250
|
-
return t[1];
|
|
1251
|
-
},
|
|
1252
|
-
trys: [],
|
|
1253
|
-
ops: []
|
|
1254
|
-
};
|
|
1255
|
-
return g = {
|
|
1256
|
-
next: verb(0),
|
|
1257
|
-
"throw": verb(1),
|
|
1258
|
-
"return": verb(2)
|
|
1259
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
1260
|
-
return this;
|
|
1261
|
-
}), g;
|
|
1262
|
-
function verb(n) {
|
|
1263
|
-
return function(v) {
|
|
1264
|
-
return step([
|
|
1265
|
-
n,
|
|
1266
|
-
v
|
|
1267
|
-
]);
|
|
675
|
+
collect() {
|
|
676
|
+
const remotes = [];
|
|
677
|
+
const remotesConsumerMap = {};
|
|
678
|
+
const exposesMap = {};
|
|
679
|
+
const sharedMap = {};
|
|
680
|
+
this._initializeExposesFromOptions(exposesMap);
|
|
681
|
+
const isSharedModule = (moduleType) => {
|
|
682
|
+
return Boolean(moduleType &&
|
|
683
|
+
['provide-module', 'consume-shared-module'].includes(moduleType));
|
|
1268
684
|
};
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
case 1:
|
|
1281
|
-
t = op;
|
|
1282
|
-
break;
|
|
1283
|
-
case 4:
|
|
1284
|
-
_.label++;
|
|
1285
|
-
return {
|
|
1286
|
-
value: op[1],
|
|
1287
|
-
done: false
|
|
1288
|
-
};
|
|
1289
|
-
case 5:
|
|
1290
|
-
_.label++;
|
|
1291
|
-
y = op[1];
|
|
1292
|
-
op = [
|
|
1293
|
-
0
|
|
1294
|
-
];
|
|
1295
|
-
continue;
|
|
1296
|
-
case 7:
|
|
1297
|
-
op = _.ops.pop();
|
|
1298
|
-
_.trys.pop();
|
|
1299
|
-
continue;
|
|
1300
|
-
default:
|
|
1301
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1302
|
-
_ = 0;
|
|
1303
|
-
continue;
|
|
1304
|
-
}
|
|
1305
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
1306
|
-
_.label = op[1];
|
|
1307
|
-
break;
|
|
1308
|
-
}
|
|
1309
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
1310
|
-
_.label = t[1];
|
|
1311
|
-
t = op;
|
|
1312
|
-
break;
|
|
1313
|
-
}
|
|
1314
|
-
if (t && _.label < t[2]) {
|
|
1315
|
-
_.label = t[2];
|
|
1316
|
-
_.ops.push(op);
|
|
1317
|
-
break;
|
|
1318
|
-
}
|
|
1319
|
-
if (t[2]) _.ops.pop();
|
|
1320
|
-
_.trys.pop();
|
|
1321
|
-
continue;
|
|
685
|
+
const isContainerModule = (identifier) => {
|
|
686
|
+
return identifier.startsWith('container entry');
|
|
687
|
+
};
|
|
688
|
+
const isRemoteModule = (identifier) => {
|
|
689
|
+
return identifier.startsWith('remote ');
|
|
690
|
+
};
|
|
691
|
+
// handle remote/expose
|
|
692
|
+
this._modules.forEach((mod) => {
|
|
693
|
+
const { identifier, reasons, nameForCondition, moduleType } = mod;
|
|
694
|
+
if (!identifier) {
|
|
695
|
+
return;
|
|
1322
696
|
}
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
697
|
+
if (isSharedModule(moduleType)) {
|
|
698
|
+
this._handleSharedModule(mod, sharedMap, exposesMap);
|
|
699
|
+
}
|
|
700
|
+
if (isRemoteModule(identifier)) {
|
|
701
|
+
this._handleRemoteModule(mod, remotes, remotesConsumerMap);
|
|
702
|
+
}
|
|
703
|
+
else if (!this._containerManager.enable &&
|
|
704
|
+
isContainerModule(identifier)) {
|
|
705
|
+
this._handleContainerModule(mod, exposesMap);
|
|
706
|
+
}
|
|
707
|
+
});
|
|
1334
708
|
return {
|
|
1335
|
-
|
|
1336
|
-
|
|
709
|
+
remotes,
|
|
710
|
+
exposesMap,
|
|
711
|
+
sharedMap,
|
|
1337
712
|
};
|
|
1338
713
|
}
|
|
1339
714
|
}
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
715
|
+
|
|
716
|
+
/* eslint-disable max-lines-per-function */
|
|
717
|
+
/* eslint-disable @typescript-eslint/member-ordering */
|
|
718
|
+
/* eslint-disable max-depth */
|
|
719
|
+
class StatsManager {
|
|
720
|
+
constructor() {
|
|
1343
721
|
this._options = {};
|
|
1344
722
|
this._bundler = 'webpack';
|
|
1345
723
|
this._containerManager = new managers.ContainerManager();
|
|
@@ -1347,696 +725,394 @@ var StatsManager = /*#__PURE__*/ function() {
|
|
|
1347
725
|
this._sharedManager = new managers.SharedManager();
|
|
1348
726
|
this._pkgJsonManager = new managers.PKGJsonManager();
|
|
1349
727
|
}
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
728
|
+
getBuildInfo(context) {
|
|
729
|
+
const rootPath = context || process.cwd();
|
|
730
|
+
const pkg = this._pkgJsonManager.readPKGJson(rootPath);
|
|
731
|
+
return {
|
|
732
|
+
buildVersion: managers.utils.getBuildVersion(rootPath),
|
|
733
|
+
buildName: managers.utils.getBuildName() || pkg['name'],
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
get fileName() {
|
|
737
|
+
return sdk.getManifestFileName(this._options.manifest).statsFileName;
|
|
738
|
+
}
|
|
739
|
+
_getMetaData(compiler, compilation, extraOptions) {
|
|
740
|
+
const { context } = compiler.options;
|
|
741
|
+
const { _options: { name }, } = this;
|
|
742
|
+
const buildInfo = this.getBuildInfo(context);
|
|
743
|
+
const type = this._pkgJsonManager.getExposeGarfishModuleType(context || process.cwd());
|
|
744
|
+
const getRemoteEntryName = () => {
|
|
745
|
+
if (!this._containerManager.enable) {
|
|
746
|
+
return '';
|
|
1360
747
|
}
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
748
|
+
assert(name, 'name is required');
|
|
749
|
+
const remoteEntryPoint = compilation.entrypoints.get(name);
|
|
750
|
+
assert(remoteEntryPoint, 'Can not get remoteEntry entryPoint!');
|
|
751
|
+
const remoteEntryNameChunk = compilation.namedChunks.get(name);
|
|
752
|
+
assert(remoteEntryNameChunk, 'Can not get remoteEntry chunk!');
|
|
753
|
+
const files = Array.from(remoteEntryNameChunk.files).filter((f) => !f.includes(HOT_UPDATE_SUFFIX) && !f.endsWith('.css'));
|
|
754
|
+
assert(files.length > 0, 'no files found for remoteEntry chunk');
|
|
755
|
+
assert(files.length === 1, `remoteEntry chunk should not have multiple files!, current files: ${files.join(',')}`);
|
|
756
|
+
const remoteEntryName = files[0];
|
|
757
|
+
return remoteEntryName;
|
|
758
|
+
};
|
|
759
|
+
const globalName = this._containerManager.globalEntryName;
|
|
760
|
+
assert(globalName, 'Can not get library.name, please ensure you have set library.name and the type is "string" !');
|
|
761
|
+
assert(this._pluginVersion, 'Can not get pluginVersion, please ensure you have set pluginVersion !');
|
|
762
|
+
const metaData = {
|
|
763
|
+
name: name,
|
|
764
|
+
type,
|
|
765
|
+
buildInfo,
|
|
766
|
+
remoteEntry: {
|
|
767
|
+
name: getRemoteEntryName(),
|
|
768
|
+
path: '',
|
|
769
|
+
// same as the types supported by runtime, currently only global/var/script is supported
|
|
770
|
+
type: this._options?.library?.type ||
|
|
771
|
+
'global',
|
|
772
|
+
},
|
|
773
|
+
types: getTypesMetaInfo(this._options, compiler.context),
|
|
774
|
+
globalName: globalName,
|
|
775
|
+
pluginVersion: this._pluginVersion,
|
|
776
|
+
};
|
|
777
|
+
let prefetchInterface = false;
|
|
778
|
+
const prefetchFilePath = path.resolve(compiler.options.context || process.cwd(), `node_modules/.mf/${sdk.encodeName(name)}/${sdk.MFPrefetchCommon.fileName}`);
|
|
779
|
+
const existPrefetch = fs.existsSync(prefetchFilePath);
|
|
780
|
+
if (existPrefetch) {
|
|
781
|
+
const content = fs.readFileSync(prefetchFilePath).toString();
|
|
782
|
+
if (content) {
|
|
783
|
+
prefetchInterface = true;
|
|
1366
784
|
}
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
785
|
+
}
|
|
786
|
+
metaData.prefetchInterface = prefetchInterface;
|
|
787
|
+
if (this._options.getPublicPath) {
|
|
788
|
+
if ('publicPath' in metaData) {
|
|
789
|
+
delete metaData.publicPath;
|
|
790
|
+
}
|
|
791
|
+
return {
|
|
792
|
+
...metaData,
|
|
793
|
+
getPublicPath: this._options.getPublicPath,
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
return {
|
|
797
|
+
...metaData,
|
|
798
|
+
publicPath: this.getPublicPath(compiler),
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
_getFilteredModules(stats) {
|
|
802
|
+
const filteredModules = stats.modules.filter((module) => {
|
|
803
|
+
if (!module || !module.name) {
|
|
804
|
+
return false;
|
|
805
|
+
}
|
|
806
|
+
const array = [
|
|
807
|
+
module.name.includes('container entry'),
|
|
808
|
+
module.name.includes('remote '),
|
|
809
|
+
module.name.includes('shared module '),
|
|
810
|
+
module.name.includes('provide module '),
|
|
811
|
+
];
|
|
812
|
+
return array.some((item) => item);
|
|
813
|
+
});
|
|
814
|
+
return filteredModules;
|
|
815
|
+
}
|
|
816
|
+
_getModuleAssets(compilation, entryPointNames) {
|
|
817
|
+
const { chunks } = compilation;
|
|
818
|
+
const { exposeFileNameImportMap } = this._containerManager;
|
|
819
|
+
const assets = {};
|
|
820
|
+
chunks.forEach((chunk) => {
|
|
821
|
+
if (typeof chunk.name === 'string' &&
|
|
822
|
+
exposeFileNameImportMap[chunk.name]) {
|
|
823
|
+
// TODO: support multiple import
|
|
824
|
+
const exposeKey = exposeFileNameImportMap[chunk.name][0];
|
|
825
|
+
assets[getFileNameWithOutExt(exposeKey)] = getAssetsByChunk(chunk, entryPointNames);
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
return assets;
|
|
829
|
+
}
|
|
830
|
+
_getProvideSharedAssets(compilation, stats, entryPointNames) {
|
|
831
|
+
const sharedModules = stats.modules.filter((module) => {
|
|
832
|
+
if (!module || !module.name) {
|
|
833
|
+
return false;
|
|
834
|
+
}
|
|
835
|
+
const array = [module.name.includes('consume shared module ')];
|
|
836
|
+
return array.some((item) => item);
|
|
837
|
+
});
|
|
838
|
+
const manifestOverrideChunkIDMap = {};
|
|
839
|
+
const effectiveSharedModules = getSharedModules(stats, sharedModules);
|
|
840
|
+
effectiveSharedModules.forEach((item) => {
|
|
841
|
+
const [sharedModuleName, sharedModule] = item;
|
|
842
|
+
if (!manifestOverrideChunkIDMap[sharedModuleName]) {
|
|
843
|
+
manifestOverrideChunkIDMap[sharedModuleName] = {
|
|
844
|
+
async: new Set(),
|
|
845
|
+
sync: new Set(),
|
|
1410
846
|
};
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
prefetchInterface = true;
|
|
1418
|
-
}
|
|
847
|
+
}
|
|
848
|
+
sharedModule.chunks.forEach((chunkID) => {
|
|
849
|
+
const chunk = findChunk(chunkID, compilation.chunks);
|
|
850
|
+
manifestOverrideChunkIDMap[sharedModuleName].sync.add(chunkID);
|
|
851
|
+
if (!chunk) {
|
|
852
|
+
return;
|
|
1419
853
|
}
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
delete metaData.publicPath;
|
|
854
|
+
[...chunk.groupsIterable].forEach((group) => {
|
|
855
|
+
if (group.name && !entryPointNames.includes(group.name)) {
|
|
856
|
+
manifestOverrideChunkIDMap[sharedModuleName].sync.add(group.id);
|
|
1424
857
|
}
|
|
1425
|
-
return _object_spread_props(_object_spread({}, metaData), {
|
|
1426
|
-
getPublicPath: this._options.getPublicPath
|
|
1427
|
-
});
|
|
1428
|
-
}
|
|
1429
|
-
return _object_spread_props(_object_spread({}, metaData), {
|
|
1430
|
-
publicPath: this.getPublicPath(compiler)
|
|
1431
858
|
});
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
{
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
859
|
+
});
|
|
860
|
+
});
|
|
861
|
+
const assets = {
|
|
862
|
+
js: {
|
|
863
|
+
async: [],
|
|
864
|
+
sync: [],
|
|
865
|
+
},
|
|
866
|
+
css: {
|
|
867
|
+
async: [],
|
|
868
|
+
sync: [],
|
|
869
|
+
},
|
|
870
|
+
};
|
|
871
|
+
Object.keys(manifestOverrideChunkIDMap).forEach((override) => {
|
|
872
|
+
const asyncAssets = getAssetsByChunkIDs(compilation, {
|
|
873
|
+
[override]: manifestOverrideChunkIDMap[override].async,
|
|
874
|
+
});
|
|
875
|
+
const syncAssets = getAssetsByChunkIDs(compilation, {
|
|
876
|
+
[override]: manifestOverrideChunkIDMap[override].sync,
|
|
877
|
+
});
|
|
878
|
+
assets[override] = {
|
|
879
|
+
js: {
|
|
880
|
+
async: asyncAssets[override].js,
|
|
881
|
+
sync: syncAssets[override].js,
|
|
882
|
+
},
|
|
883
|
+
css: {
|
|
884
|
+
async: asyncAssets[override].css,
|
|
885
|
+
sync: syncAssets[override].css,
|
|
886
|
+
},
|
|
887
|
+
};
|
|
888
|
+
});
|
|
889
|
+
return assets;
|
|
890
|
+
}
|
|
891
|
+
async _generateStats(compiler, compilation, extraOptions) {
|
|
892
|
+
try {
|
|
893
|
+
const { name, manifest: manifestOptions = {}, exposes = {}, } = this._options;
|
|
894
|
+
const metaData = this._getMetaData(compiler, compilation, extraOptions);
|
|
895
|
+
const stats = {
|
|
896
|
+
id: name,
|
|
897
|
+
name: name,
|
|
898
|
+
metaData,
|
|
899
|
+
shared: [],
|
|
900
|
+
remotes: [],
|
|
901
|
+
exposes: [],
|
|
902
|
+
};
|
|
903
|
+
if (typeof manifestOptions === 'object' &&
|
|
904
|
+
manifestOptions.disableAssetsAnalyze) {
|
|
905
|
+
const remotes = this._remoteManager.statsRemoteWithEmptyUsedIn;
|
|
906
|
+
stats.remotes = remotes;
|
|
907
|
+
stats.exposes = Object.keys(exposes).map((exposeKey) => {
|
|
908
|
+
return getExposeItem({
|
|
909
|
+
exposeKey,
|
|
910
|
+
name: name,
|
|
911
|
+
file: {
|
|
912
|
+
import: exposes[exposeKey].import,
|
|
913
|
+
},
|
|
1449
914
|
});
|
|
1450
915
|
});
|
|
1451
|
-
return
|
|
916
|
+
return stats;
|
|
1452
917
|
}
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
918
|
+
const liveStats = compilation.getStats();
|
|
919
|
+
const statsOptions = {
|
|
920
|
+
all: false,
|
|
921
|
+
modules: true,
|
|
922
|
+
builtAt: true,
|
|
923
|
+
hash: true,
|
|
924
|
+
ids: true,
|
|
925
|
+
version: true,
|
|
926
|
+
entrypoints: true,
|
|
927
|
+
assets: false,
|
|
928
|
+
chunks: false,
|
|
929
|
+
reasons: true,
|
|
930
|
+
};
|
|
931
|
+
if (this._bundler === 'webpack') {
|
|
932
|
+
statsOptions['cached'] = true;
|
|
1468
933
|
}
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
934
|
+
statsOptions['cachedModules'] = true;
|
|
935
|
+
const webpackStats = liveStats.toJson(statsOptions);
|
|
936
|
+
const filteredModules = this._getFilteredModules(webpackStats);
|
|
937
|
+
const moduleHandler = new ModuleHandler(this._options, filteredModules, {
|
|
938
|
+
bundler: this._bundler,
|
|
939
|
+
});
|
|
940
|
+
const { remotes, exposesMap, sharedMap } = moduleHandler.collect();
|
|
941
|
+
const entryPointNames = [...compilation.entrypoints.values()]
|
|
942
|
+
.map((e) => e.name)
|
|
943
|
+
.filter((v) => !!v);
|
|
944
|
+
await Promise.all([
|
|
945
|
+
new Promise((resolve) => {
|
|
946
|
+
const sharedAssets = this._getProvideSharedAssets(compilation, webpackStats, entryPointNames);
|
|
947
|
+
Object.keys(sharedMap).forEach((sharedKey) => {
|
|
948
|
+
const assets = sharedAssets[sharedKey];
|
|
949
|
+
if (assets) {
|
|
950
|
+
sharedMap[sharedKey].assets = assets;
|
|
951
|
+
}
|
|
1482
952
|
});
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
953
|
+
resolve();
|
|
954
|
+
}),
|
|
955
|
+
new Promise((resolve) => {
|
|
956
|
+
const moduleAssets = this._getModuleAssets(compilation, entryPointNames);
|
|
957
|
+
Object.keys(exposesMap).forEach((exposeKey) => {
|
|
958
|
+
const assets = moduleAssets[exposeKey];
|
|
959
|
+
if (assets) {
|
|
960
|
+
exposesMap[exposeKey].assets = assets;
|
|
961
|
+
}
|
|
962
|
+
exposesMap[exposeKey].requires = Array.from(new Set(exposesMap[exposeKey].requires));
|
|
963
|
+
});
|
|
964
|
+
resolve();
|
|
965
|
+
}),
|
|
966
|
+
]);
|
|
967
|
+
await Promise.all([
|
|
968
|
+
new Promise((resolve) => {
|
|
969
|
+
const remoteMemo = new Set();
|
|
970
|
+
stats.remotes = remotes.map((remote) => {
|
|
971
|
+
remoteMemo.add(remote.federationContainerName);
|
|
972
|
+
return {
|
|
973
|
+
...remote,
|
|
974
|
+
usedIn: Array.from(remote.usedIn.values()),
|
|
1492
975
|
};
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
return;
|
|
976
|
+
});
|
|
977
|
+
const statsRemoteWithEmptyUsedIn = this._remoteManager.statsRemoteWithEmptyUsedIn;
|
|
978
|
+
statsRemoteWithEmptyUsedIn.forEach((remoteInfo) => {
|
|
979
|
+
if (!remoteMemo.has(remoteInfo.federationContainerName)) {
|
|
980
|
+
stats.remotes.push(remoteInfo);
|
|
1499
981
|
}
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
982
|
+
});
|
|
983
|
+
resolve();
|
|
984
|
+
}),
|
|
985
|
+
new Promise((resolve) => {
|
|
986
|
+
stats.shared = Object.values(sharedMap).map((shared) => ({
|
|
987
|
+
...shared,
|
|
988
|
+
usedIn: Array.from(shared.usedIn),
|
|
989
|
+
}));
|
|
990
|
+
resolve();
|
|
991
|
+
}),
|
|
992
|
+
]);
|
|
993
|
+
await new Promise((resolve) => {
|
|
994
|
+
const sharedAssets = stats.shared.reduce((sum, shared) => {
|
|
995
|
+
const { js, css } = shared.assets;
|
|
996
|
+
[...js.sync, ...js.async, ...css.async, css.sync].forEach((asset) => {
|
|
997
|
+
sum.add(asset);
|
|
998
|
+
});
|
|
999
|
+
return sum;
|
|
1000
|
+
}, new Set());
|
|
1001
|
+
const { fileExposeKeyMap } = this._containerManager;
|
|
1002
|
+
stats.exposes = [];
|
|
1003
|
+
Object.entries(fileExposeKeyMap).forEach(([exposeFileWithoutExt, exposeKeySet]) => {
|
|
1004
|
+
const expose = exposesMap[exposeFileWithoutExt] || {
|
|
1005
|
+
assets: {
|
|
1006
|
+
js: { sync: [], async: [] },
|
|
1007
|
+
css: { sync: [], async: [] },
|
|
1008
|
+
},
|
|
1009
|
+
};
|
|
1010
|
+
exposeKeySet.forEach((exposeKey) => {
|
|
1011
|
+
const { js, css } = expose.assets;
|
|
1012
|
+
const exposeModuleName = getExposeName(exposeKey);
|
|
1013
|
+
stats.exposes.push({
|
|
1014
|
+
...expose,
|
|
1015
|
+
path: exposeKey,
|
|
1016
|
+
id: sdk.composeKeyWithSeparator(this._options.name, exposeModuleName),
|
|
1017
|
+
name: exposeModuleName,
|
|
1018
|
+
assets: {
|
|
1019
|
+
js: {
|
|
1020
|
+
sync: js.sync.filter((asset) => !sharedAssets.has(asset)),
|
|
1021
|
+
async: js.async.filter((asset) => !sharedAssets.has(asset)),
|
|
1022
|
+
},
|
|
1023
|
+
css: {
|
|
1024
|
+
sync: css.sync.filter((asset) => !sharedAssets.has(asset)),
|
|
1025
|
+
async: css.async.filter((asset) => !sharedAssets.has(asset)),
|
|
1026
|
+
},
|
|
1027
|
+
},
|
|
1504
1028
|
});
|
|
1505
1029
|
});
|
|
1506
1030
|
});
|
|
1507
|
-
|
|
1508
|
-
js
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
assets[override] = {
|
|
1521
|
-
js: {
|
|
1522
|
-
async: asyncAssets[override].js,
|
|
1523
|
-
sync: syncAssets[override].js
|
|
1031
|
+
Object.values(exposesMap).map((expose) => {
|
|
1032
|
+
const { js, css } = expose.assets;
|
|
1033
|
+
return {
|
|
1034
|
+
...expose,
|
|
1035
|
+
assets: {
|
|
1036
|
+
js: {
|
|
1037
|
+
sync: js.sync.filter((asset) => !sharedAssets.has(asset)),
|
|
1038
|
+
async: js.async.filter((asset) => !sharedAssets.has(asset)),
|
|
1039
|
+
},
|
|
1040
|
+
css: {
|
|
1041
|
+
sync: css.sync.filter((asset) => !sharedAssets.has(asset)),
|
|
1042
|
+
async: css.async.filter((asset) => !sharedAssets.has(asset)),
|
|
1043
|
+
},
|
|
1524
1044
|
},
|
|
1525
|
-
css: {
|
|
1526
|
-
async: asyncAssets[override].css,
|
|
1527
|
-
sync: syncAssets[override].css
|
|
1528
|
-
}
|
|
1529
1045
|
};
|
|
1530
1046
|
});
|
|
1531
|
-
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
var _this = this;
|
|
1538
|
-
return _async_to_generator$1(function() {
|
|
1539
|
-
var _this__options, name, tmp, manifestOptions, _this__options_exposes, exposes, metaData, stats, remotes, liveStats, statsOptions, webpackStats, filteredModules, moduleHandler, _moduleHandler_collect, remotes1, exposesMap, sharedMap, entryPointNames, err;
|
|
1540
|
-
return _ts_generator$1(this, function(_state) {
|
|
1541
|
-
switch(_state.label){
|
|
1542
|
-
case 0:
|
|
1543
|
-
_state.trys.push([
|
|
1544
|
-
0,
|
|
1545
|
-
4,
|
|
1546
|
-
,
|
|
1547
|
-
5
|
|
1548
|
-
]);
|
|
1549
|
-
_this__options = _this._options, name = _this__options.name, tmp = _this__options.manifest, manifestOptions = tmp === void 0 ? {} : tmp, _this__options_exposes = _this__options.exposes, exposes = _this__options_exposes === void 0 ? {} : _this__options_exposes;
|
|
1550
|
-
metaData = _this._getMetaData(compiler, compilation, extraOptions);
|
|
1551
|
-
stats = {
|
|
1552
|
-
id: name,
|
|
1553
|
-
name: name,
|
|
1554
|
-
metaData: metaData,
|
|
1555
|
-
shared: [],
|
|
1556
|
-
remotes: [],
|
|
1557
|
-
exposes: []
|
|
1558
|
-
};
|
|
1559
|
-
if ((typeof manifestOptions === "undefined" ? "undefined" : _type_of$1(manifestOptions)) === 'object' && manifestOptions.disableAssetsAnalyze) {
|
|
1560
|
-
remotes = _this._remoteManager.statsRemoteWithEmptyUsedIn;
|
|
1561
|
-
stats.remotes = remotes;
|
|
1562
|
-
stats.exposes = Object.keys(exposes).map(function(exposeKey) {
|
|
1563
|
-
return getExposeItem({
|
|
1564
|
-
exposeKey: exposeKey,
|
|
1565
|
-
name: name,
|
|
1566
|
-
file: {
|
|
1567
|
-
import: exposes[exposeKey].import
|
|
1568
|
-
}
|
|
1569
|
-
});
|
|
1570
|
-
});
|
|
1571
|
-
return [
|
|
1572
|
-
2,
|
|
1573
|
-
stats
|
|
1574
|
-
];
|
|
1575
|
-
}
|
|
1576
|
-
liveStats = compilation.getStats();
|
|
1577
|
-
statsOptions = {
|
|
1578
|
-
all: false,
|
|
1579
|
-
modules: true,
|
|
1580
|
-
builtAt: true,
|
|
1581
|
-
hash: true,
|
|
1582
|
-
ids: true,
|
|
1583
|
-
version: true,
|
|
1584
|
-
entrypoints: true,
|
|
1585
|
-
assets: false,
|
|
1586
|
-
chunks: false,
|
|
1587
|
-
reasons: true
|
|
1588
|
-
};
|
|
1589
|
-
if (_this._bundler === 'webpack') {
|
|
1590
|
-
statsOptions['cached'] = true;
|
|
1591
|
-
}
|
|
1592
|
-
statsOptions['cachedModules'] = true;
|
|
1593
|
-
webpackStats = liveStats.toJson(statsOptions);
|
|
1594
|
-
filteredModules = _this._getFilteredModules(webpackStats);
|
|
1595
|
-
moduleHandler = new ModuleHandler(_this._options, filteredModules, {
|
|
1596
|
-
bundler: _this._bundler
|
|
1597
|
-
});
|
|
1598
|
-
_moduleHandler_collect = moduleHandler.collect(), remotes1 = _moduleHandler_collect.remotes, exposesMap = _moduleHandler_collect.exposesMap, sharedMap = _moduleHandler_collect.sharedMap;
|
|
1599
|
-
entryPointNames = _to_consumable_array(compilation.entrypoints.values()).map(function(e) {
|
|
1600
|
-
return e.name;
|
|
1601
|
-
}).filter(function(v) {
|
|
1602
|
-
return !!v;
|
|
1603
|
-
});
|
|
1604
|
-
return [
|
|
1605
|
-
4,
|
|
1606
|
-
Promise.all([
|
|
1607
|
-
new Promise(function(resolve) {
|
|
1608
|
-
var sharedAssets = _this._getProvideSharedAssets(compilation, webpackStats, entryPointNames);
|
|
1609
|
-
Object.keys(sharedMap).forEach(function(sharedKey) {
|
|
1610
|
-
var assets = sharedAssets[sharedKey];
|
|
1611
|
-
if (assets) {
|
|
1612
|
-
sharedMap[sharedKey].assets = assets;
|
|
1613
|
-
}
|
|
1614
|
-
});
|
|
1615
|
-
resolve();
|
|
1616
|
-
}),
|
|
1617
|
-
new Promise(function(resolve) {
|
|
1618
|
-
var moduleAssets = _this._getModuleAssets(compilation, entryPointNames);
|
|
1619
|
-
Object.keys(exposesMap).forEach(function(exposeKey) {
|
|
1620
|
-
var assets = moduleAssets[exposeKey];
|
|
1621
|
-
if (assets) {
|
|
1622
|
-
exposesMap[exposeKey].assets = assets;
|
|
1623
|
-
}
|
|
1624
|
-
exposesMap[exposeKey].requires = Array.from(new Set(exposesMap[exposeKey].requires));
|
|
1625
|
-
});
|
|
1626
|
-
resolve();
|
|
1627
|
-
})
|
|
1628
|
-
])
|
|
1629
|
-
];
|
|
1630
|
-
case 1:
|
|
1631
|
-
_state.sent();
|
|
1632
|
-
return [
|
|
1633
|
-
4,
|
|
1634
|
-
Promise.all([
|
|
1635
|
-
new Promise(function(resolve) {
|
|
1636
|
-
var remoteMemo = new Set();
|
|
1637
|
-
stats.remotes = remotes1.map(function(remote) {
|
|
1638
|
-
remoteMemo.add(remote.federationContainerName);
|
|
1639
|
-
return _object_spread_props(_object_spread({}, remote), {
|
|
1640
|
-
usedIn: Array.from(remote.usedIn.values())
|
|
1641
|
-
});
|
|
1642
|
-
});
|
|
1643
|
-
var statsRemoteWithEmptyUsedIn = _this._remoteManager.statsRemoteWithEmptyUsedIn;
|
|
1644
|
-
statsRemoteWithEmptyUsedIn.forEach(function(remoteInfo) {
|
|
1645
|
-
if (!remoteMemo.has(remoteInfo.federationContainerName)) {
|
|
1646
|
-
stats.remotes.push(remoteInfo);
|
|
1647
|
-
}
|
|
1648
|
-
});
|
|
1649
|
-
resolve();
|
|
1650
|
-
}),
|
|
1651
|
-
new Promise(function(resolve) {
|
|
1652
|
-
stats.shared = Object.values(sharedMap).map(function(shared) {
|
|
1653
|
-
return _object_spread_props(_object_spread({}, shared), {
|
|
1654
|
-
usedIn: Array.from(shared.usedIn)
|
|
1655
|
-
});
|
|
1656
|
-
});
|
|
1657
|
-
resolve();
|
|
1658
|
-
})
|
|
1659
|
-
])
|
|
1660
|
-
];
|
|
1661
|
-
case 2:
|
|
1662
|
-
_state.sent();
|
|
1663
|
-
return [
|
|
1664
|
-
4,
|
|
1665
|
-
new Promise(function(resolve) {
|
|
1666
|
-
var sharedAssets = stats.shared.reduce(function(sum, shared) {
|
|
1667
|
-
var _shared_assets = shared.assets, js = _shared_assets.js, css = _shared_assets.css;
|
|
1668
|
-
_to_consumable_array(js.sync).concat(_to_consumable_array(js.async), _to_consumable_array(css.async), [
|
|
1669
|
-
css.sync
|
|
1670
|
-
]).forEach(function(asset) {
|
|
1671
|
-
sum.add(asset);
|
|
1672
|
-
});
|
|
1673
|
-
return sum;
|
|
1674
|
-
}, new Set());
|
|
1675
|
-
var fileExposeKeyMap = _this._containerManager.fileExposeKeyMap;
|
|
1676
|
-
stats.exposes = [];
|
|
1677
|
-
Object.entries(fileExposeKeyMap).forEach(function(param) {
|
|
1678
|
-
var _param = _sliced_to_array(param, 2), exposeFileWithoutExt = _param[0], exposeKeySet = _param[1];
|
|
1679
|
-
var expose = exposesMap[exposeFileWithoutExt] || {
|
|
1680
|
-
assets: {
|
|
1681
|
-
js: {
|
|
1682
|
-
sync: [],
|
|
1683
|
-
async: []
|
|
1684
|
-
},
|
|
1685
|
-
css: {
|
|
1686
|
-
sync: [],
|
|
1687
|
-
async: []
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
};
|
|
1691
|
-
exposeKeySet.forEach(function(exposeKey) {
|
|
1692
|
-
var _expose_assets = expose.assets, js = _expose_assets.js, css = _expose_assets.css;
|
|
1693
|
-
var exposeModuleName = getExposeName(exposeKey);
|
|
1694
|
-
stats.exposes.push(_object_spread_props(_object_spread({}, expose), {
|
|
1695
|
-
path: exposeKey,
|
|
1696
|
-
id: sdk.composeKeyWithSeparator(_this._options.name, exposeModuleName),
|
|
1697
|
-
name: exposeModuleName,
|
|
1698
|
-
assets: {
|
|
1699
|
-
js: {
|
|
1700
|
-
sync: js.sync.filter(function(asset) {
|
|
1701
|
-
return !sharedAssets.has(asset);
|
|
1702
|
-
}),
|
|
1703
|
-
async: js.async.filter(function(asset) {
|
|
1704
|
-
return !sharedAssets.has(asset);
|
|
1705
|
-
})
|
|
1706
|
-
},
|
|
1707
|
-
css: {
|
|
1708
|
-
sync: css.sync.filter(function(asset) {
|
|
1709
|
-
return !sharedAssets.has(asset);
|
|
1710
|
-
}),
|
|
1711
|
-
async: css.async.filter(function(asset) {
|
|
1712
|
-
return !sharedAssets.has(asset);
|
|
1713
|
-
})
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
}));
|
|
1717
|
-
});
|
|
1718
|
-
});
|
|
1719
|
-
Object.values(exposesMap).map(function(expose) {
|
|
1720
|
-
var _expose_assets = expose.assets, js = _expose_assets.js, css = _expose_assets.css;
|
|
1721
|
-
return _object_spread_props(_object_spread({}, expose), {
|
|
1722
|
-
assets: {
|
|
1723
|
-
js: {
|
|
1724
|
-
sync: js.sync.filter(function(asset) {
|
|
1725
|
-
return !sharedAssets.has(asset);
|
|
1726
|
-
}),
|
|
1727
|
-
async: js.async.filter(function(asset) {
|
|
1728
|
-
return !sharedAssets.has(asset);
|
|
1729
|
-
})
|
|
1730
|
-
},
|
|
1731
|
-
css: {
|
|
1732
|
-
sync: css.sync.filter(function(asset) {
|
|
1733
|
-
return !sharedAssets.has(asset);
|
|
1734
|
-
}),
|
|
1735
|
-
async: css.async.filter(function(asset) {
|
|
1736
|
-
return !sharedAssets.has(asset);
|
|
1737
|
-
})
|
|
1738
|
-
}
|
|
1739
|
-
}
|
|
1740
|
-
});
|
|
1741
|
-
});
|
|
1742
|
-
resolve();
|
|
1743
|
-
})
|
|
1744
|
-
];
|
|
1745
|
-
case 3:
|
|
1746
|
-
_state.sent();
|
|
1747
|
-
return [
|
|
1748
|
-
2,
|
|
1749
|
-
stats
|
|
1750
|
-
];
|
|
1751
|
-
case 4:
|
|
1752
|
-
err = _state.sent();
|
|
1753
|
-
throw err;
|
|
1754
|
-
case 5:
|
|
1755
|
-
return [
|
|
1756
|
-
2
|
|
1757
|
-
];
|
|
1758
|
-
}
|
|
1759
|
-
});
|
|
1760
|
-
})();
|
|
1761
|
-
}
|
|
1762
|
-
},
|
|
1763
|
-
{
|
|
1764
|
-
key: "getPublicPath",
|
|
1765
|
-
value: function getPublicPath(compiler) {
|
|
1766
|
-
if (this._publicPath) {
|
|
1767
|
-
return this._publicPath;
|
|
1768
|
-
}
|
|
1769
|
-
var _compiler_options = compiler.options, _compiler_options_output = _compiler_options.output, originalPublicPath = _compiler_options_output.publicPath;
|
|
1770
|
-
var publicPath = originalPublicPath;
|
|
1771
|
-
this._publicPath = publicPath;
|
|
1772
|
-
return publicPath;
|
|
1773
|
-
}
|
|
1774
|
-
},
|
|
1775
|
-
{
|
|
1776
|
-
key: "init",
|
|
1777
|
-
value: function init(options, param) {
|
|
1778
|
-
var pluginVersion = param.pluginVersion, bundler = param.bundler;
|
|
1779
|
-
this._options = options;
|
|
1780
|
-
this._pluginVersion = pluginVersion;
|
|
1781
|
-
this._bundler = bundler;
|
|
1782
|
-
this._containerManager = new managers.ContainerManager();
|
|
1783
|
-
this._containerManager.init(options);
|
|
1784
|
-
this._remoteManager = new managers.RemoteManager();
|
|
1785
|
-
this._remoteManager.init(options);
|
|
1786
|
-
this._sharedManager = new managers.SharedManager();
|
|
1787
|
-
this._sharedManager.init(options);
|
|
1788
|
-
}
|
|
1789
|
-
},
|
|
1790
|
-
{
|
|
1791
|
-
key: "generateStats",
|
|
1792
|
-
value: function generateStats(compiler, compilation) {
|
|
1793
|
-
var extraOptions = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1794
|
-
var _this = this;
|
|
1795
|
-
return _async_to_generator$1(function() {
|
|
1796
|
-
var disableEmit, existedStats, _this__options, tmp, manifestOptions, stats, ret, err;
|
|
1797
|
-
return _ts_generator$1(this, function(_state) {
|
|
1798
|
-
switch(_state.label){
|
|
1799
|
-
case 0:
|
|
1800
|
-
_state.trys.push([
|
|
1801
|
-
0,
|
|
1802
|
-
4,
|
|
1803
|
-
,
|
|
1804
|
-
5
|
|
1805
|
-
]);
|
|
1806
|
-
disableEmit = extraOptions.disableEmit;
|
|
1807
|
-
existedStats = compilation.getAsset(_this.fileName);
|
|
1808
|
-
if (existedStats && !isDev()) {
|
|
1809
|
-
return [
|
|
1810
|
-
2,
|
|
1811
|
-
{
|
|
1812
|
-
stats: JSON.parse(existedStats.source.source().toString()),
|
|
1813
|
-
filename: _this.fileName
|
|
1814
|
-
}
|
|
1815
|
-
];
|
|
1816
|
-
}
|
|
1817
|
-
_this__options = _this._options, tmp = _this__options.manifest, manifestOptions = tmp === void 0 ? {} : tmp;
|
|
1818
|
-
return [
|
|
1819
|
-
4,
|
|
1820
|
-
_this._generateStats(compiler, compilation)
|
|
1821
|
-
];
|
|
1822
|
-
case 1:
|
|
1823
|
-
stats = _state.sent();
|
|
1824
|
-
if (!((typeof manifestOptions === "undefined" ? "undefined" : _type_of$1(manifestOptions)) === 'object' && manifestOptions.additionalData)) return [
|
|
1825
|
-
3,
|
|
1826
|
-
3
|
|
1827
|
-
];
|
|
1828
|
-
return [
|
|
1829
|
-
4,
|
|
1830
|
-
manifestOptions.additionalData({
|
|
1831
|
-
stats: stats,
|
|
1832
|
-
pluginOptions: _this._options,
|
|
1833
|
-
compiler: compiler,
|
|
1834
|
-
compilation: compilation,
|
|
1835
|
-
bundler: _this._bundler
|
|
1836
|
-
})
|
|
1837
|
-
];
|
|
1838
|
-
case 2:
|
|
1839
|
-
ret = _state.sent();
|
|
1840
|
-
stats = ret || stats;
|
|
1841
|
-
_state.label = 3;
|
|
1842
|
-
case 3:
|
|
1843
|
-
if (!disableEmit) {
|
|
1844
|
-
compilation.emitAsset(_this.fileName, new compiler.webpack.sources.RawSource(JSON.stringify(stats, null, 2)));
|
|
1845
|
-
}
|
|
1846
|
-
return [
|
|
1847
|
-
2,
|
|
1848
|
-
{
|
|
1849
|
-
stats: stats,
|
|
1850
|
-
filename: _this.fileName
|
|
1851
|
-
}
|
|
1852
|
-
];
|
|
1853
|
-
case 4:
|
|
1854
|
-
err = _state.sent();
|
|
1855
|
-
throw err;
|
|
1856
|
-
case 5:
|
|
1857
|
-
return [
|
|
1858
|
-
2
|
|
1859
|
-
];
|
|
1860
|
-
}
|
|
1861
|
-
});
|
|
1862
|
-
})();
|
|
1863
|
-
}
|
|
1864
|
-
},
|
|
1865
|
-
{
|
|
1866
|
-
key: "validate",
|
|
1867
|
-
value: function validate(compiler) {
|
|
1868
|
-
var _compiler_options = compiler.options, publicPath = _compiler_options.output.publicPath;
|
|
1869
|
-
if (typeof publicPath !== 'string') {
|
|
1870
|
-
logger.warn("Manifest will not generate, because publicPath can only be string, but got '".concat(publicPath, "'"));
|
|
1871
|
-
return false;
|
|
1872
|
-
} else if (publicPath === 'auto') {
|
|
1873
|
-
logger.warn("Manifest will use absolute path resolution via its host at runtime, reason: publicPath='".concat(publicPath, "'"));
|
|
1874
|
-
return true;
|
|
1875
|
-
}
|
|
1876
|
-
return true;
|
|
1877
|
-
}
|
|
1047
|
+
resolve();
|
|
1048
|
+
});
|
|
1049
|
+
return stats;
|
|
1050
|
+
}
|
|
1051
|
+
catch (err) {
|
|
1052
|
+
throw err;
|
|
1878
1053
|
}
|
|
1879
|
-
]);
|
|
1880
|
-
return StatsManager;
|
|
1881
|
-
}();
|
|
1882
|
-
|
|
1883
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1884
|
-
try {
|
|
1885
|
-
var info = gen[key](arg);
|
|
1886
|
-
var value = info.value;
|
|
1887
|
-
} catch (error) {
|
|
1888
|
-
reject(error);
|
|
1889
|
-
return;
|
|
1890
|
-
}
|
|
1891
|
-
if (info.done) {
|
|
1892
|
-
resolve(value);
|
|
1893
|
-
} else {
|
|
1894
|
-
Promise.resolve(value).then(_next, _throw);
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
function _async_to_generator(fn) {
|
|
1898
|
-
return function() {
|
|
1899
|
-
var self = this, args = arguments;
|
|
1900
|
-
return new Promise(function(resolve, reject) {
|
|
1901
|
-
var gen = fn.apply(self, args);
|
|
1902
|
-
function _next(value) {
|
|
1903
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
1904
|
-
}
|
|
1905
|
-
function _throw(err) {
|
|
1906
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1907
|
-
}
|
|
1908
|
-
_next(undefined);
|
|
1909
|
-
});
|
|
1910
|
-
};
|
|
1911
|
-
}
|
|
1912
|
-
function _class_call_check(instance, Constructor) {
|
|
1913
|
-
if (!(instance instanceof Constructor)) {
|
|
1914
|
-
throw new TypeError("Cannot call a class as a function");
|
|
1915
|
-
}
|
|
1916
|
-
}
|
|
1917
|
-
function _defineProperties(target, props) {
|
|
1918
|
-
for(var i = 0; i < props.length; i++){
|
|
1919
|
-
var descriptor = props[i];
|
|
1920
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
1921
|
-
descriptor.configurable = true;
|
|
1922
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
1923
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1924
1054
|
}
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
}
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
return
|
|
1933
|
-
} else {
|
|
1934
|
-
return left instanceof right;
|
|
1055
|
+
getPublicPath(compiler) {
|
|
1056
|
+
if (this._publicPath) {
|
|
1057
|
+
return this._publicPath;
|
|
1058
|
+
}
|
|
1059
|
+
const { output: { publicPath: originalPublicPath }, } = compiler.options;
|
|
1060
|
+
let publicPath = originalPublicPath;
|
|
1061
|
+
this._publicPath = publicPath;
|
|
1062
|
+
return publicPath;
|
|
1935
1063
|
}
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
return t[1];
|
|
1947
|
-
},
|
|
1948
|
-
trys: [],
|
|
1949
|
-
ops: []
|
|
1950
|
-
};
|
|
1951
|
-
return g = {
|
|
1952
|
-
next: verb(0),
|
|
1953
|
-
"throw": verb(1),
|
|
1954
|
-
"return": verb(2)
|
|
1955
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
1956
|
-
return this;
|
|
1957
|
-
}), g;
|
|
1958
|
-
function verb(n) {
|
|
1959
|
-
return function(v) {
|
|
1960
|
-
return step([
|
|
1961
|
-
n,
|
|
1962
|
-
v
|
|
1963
|
-
]);
|
|
1964
|
-
};
|
|
1064
|
+
init(options, { pluginVersion, bundler, }) {
|
|
1065
|
+
this._options = options;
|
|
1066
|
+
this._pluginVersion = pluginVersion;
|
|
1067
|
+
this._bundler = bundler;
|
|
1068
|
+
this._containerManager = new managers.ContainerManager();
|
|
1069
|
+
this._containerManager.init(options);
|
|
1070
|
+
this._remoteManager = new managers.RemoteManager();
|
|
1071
|
+
this._remoteManager.init(options);
|
|
1072
|
+
this._sharedManager = new managers.SharedManager();
|
|
1073
|
+
this._sharedManager.init(options);
|
|
1965
1074
|
}
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
if (
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
_.label++;
|
|
1981
|
-
return {
|
|
1982
|
-
value: op[1],
|
|
1983
|
-
done: false
|
|
1984
|
-
};
|
|
1985
|
-
case 5:
|
|
1986
|
-
_.label++;
|
|
1987
|
-
y = op[1];
|
|
1988
|
-
op = [
|
|
1989
|
-
0
|
|
1990
|
-
];
|
|
1991
|
-
continue;
|
|
1992
|
-
case 7:
|
|
1993
|
-
op = _.ops.pop();
|
|
1994
|
-
_.trys.pop();
|
|
1995
|
-
continue;
|
|
1996
|
-
default:
|
|
1997
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1998
|
-
_ = 0;
|
|
1999
|
-
continue;
|
|
2000
|
-
}
|
|
2001
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
2002
|
-
_.label = op[1];
|
|
2003
|
-
break;
|
|
2004
|
-
}
|
|
2005
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
2006
|
-
_.label = t[1];
|
|
2007
|
-
t = op;
|
|
2008
|
-
break;
|
|
2009
|
-
}
|
|
2010
|
-
if (t && _.label < t[2]) {
|
|
2011
|
-
_.label = t[2];
|
|
2012
|
-
_.ops.push(op);
|
|
2013
|
-
break;
|
|
2014
|
-
}
|
|
2015
|
-
if (t[2]) _.ops.pop();
|
|
2016
|
-
_.trys.pop();
|
|
2017
|
-
continue;
|
|
1075
|
+
async generateStats(compiler, compilation) {
|
|
1076
|
+
try {
|
|
1077
|
+
const { manifest: manifestOptions = {} } = this._options;
|
|
1078
|
+
let stats = await this._generateStats(compiler, compilation);
|
|
1079
|
+
if (typeof manifestOptions === 'object' &&
|
|
1080
|
+
manifestOptions.additionalData) {
|
|
1081
|
+
const ret = await manifestOptions.additionalData({
|
|
1082
|
+
stats,
|
|
1083
|
+
pluginOptions: this._options,
|
|
1084
|
+
compiler,
|
|
1085
|
+
compilation,
|
|
1086
|
+
bundler: this._bundler,
|
|
1087
|
+
});
|
|
1088
|
+
stats = ret || stats;
|
|
2018
1089
|
}
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
];
|
|
2025
|
-
y = 0;
|
|
2026
|
-
} finally{
|
|
2027
|
-
f = t = 0;
|
|
1090
|
+
compilation.emitAsset(this.fileName, new compiler.webpack.sources.RawSource(JSON.stringify(stats, null, 2)));
|
|
1091
|
+
return {
|
|
1092
|
+
stats,
|
|
1093
|
+
filename: this.fileName,
|
|
1094
|
+
};
|
|
2028
1095
|
}
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
1096
|
+
catch (err) {
|
|
1097
|
+
throw err;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
validate(compiler) {
|
|
1101
|
+
const { output: { publicPath }, } = compiler.options;
|
|
1102
|
+
if (typeof publicPath !== 'string') {
|
|
1103
|
+
logger.warn(`Manifest will not generate, because publicPath can only be string, but got '${publicPath}'`);
|
|
1104
|
+
return false;
|
|
1105
|
+
}
|
|
1106
|
+
else if (publicPath === 'auto') {
|
|
1107
|
+
logger.warn(`Manifest will use absolute path resolution via its host at runtime, reason: publicPath='${publicPath}'`);
|
|
1108
|
+
return true;
|
|
1109
|
+
}
|
|
1110
|
+
return true;
|
|
2034
1111
|
}
|
|
2035
1112
|
}
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
_class_call_check(this, StatsPlugin);
|
|
1113
|
+
|
|
1114
|
+
class StatsPlugin {
|
|
1115
|
+
constructor(options, { pluginVersion, bundler, }) {
|
|
2040
1116
|
this.name = 'StatsPlugin';
|
|
2041
1117
|
this._options = {};
|
|
2042
1118
|
this._statsManager = new StatsManager();
|
|
@@ -2046,93 +1122,53 @@ var StatsPlugin = /*#__PURE__*/ function() {
|
|
|
2046
1122
|
try {
|
|
2047
1123
|
this._options = options;
|
|
2048
1124
|
this._bundler = bundler;
|
|
2049
|
-
this.
|
|
2050
|
-
this._statsManager.init(this._options, {
|
|
2051
|
-
pluginVersion: pluginVersion,
|
|
2052
|
-
bundler: bundler
|
|
2053
|
-
});
|
|
1125
|
+
this._statsManager.init(this._options, { pluginVersion, bundler });
|
|
2054
1126
|
this._manifestManager.init(this._options);
|
|
2055
|
-
}
|
|
2056
|
-
|
|
2057
|
-
|
|
1127
|
+
}
|
|
1128
|
+
catch (err) {
|
|
1129
|
+
if (err instanceof Error) {
|
|
1130
|
+
err.message = `[ ${PLUGIN_IDENTIFIER} ]: Manifest will not generate, because: ${err.message}`;
|
|
2058
1131
|
}
|
|
2059
1132
|
logger.error(err);
|
|
2060
1133
|
this._enable = false;
|
|
2061
1134
|
}
|
|
2062
1135
|
}
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
var _this = this;
|
|
2068
|
-
if (!this._enable) {
|
|
2069
|
-
return;
|
|
2070
|
-
}
|
|
2071
|
-
var res = this._statsManager.validate(compiler);
|
|
2072
|
-
if (!res) {
|
|
2073
|
-
return;
|
|
2074
|
-
}
|
|
2075
|
-
compiler.hooks.thisCompilation.tap('generateStats', function(compilation) {
|
|
2076
|
-
var _this1 = _this;
|
|
2077
|
-
compilation.hooks.processAssets.tapPromise({
|
|
2078
|
-
name: 'generateStats',
|
|
2079
|
-
// @ts-ignore use runtime variable in case peer dep not installed
|
|
2080
|
-
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
|
|
2081
|
-
}, /*#__PURE__*/ _async_to_generator(function() {
|
|
2082
|
-
return _ts_generator(this, function(_state) {
|
|
2083
|
-
switch(_state.label){
|
|
2084
|
-
case 0:
|
|
2085
|
-
if (!(_this1._options.manifest !== false)) return [
|
|
2086
|
-
3,
|
|
2087
|
-
3
|
|
2088
|
-
];
|
|
2089
|
-
return [
|
|
2090
|
-
4,
|
|
2091
|
-
_this1._statsManager.generateStats(compiler, compilation, {
|
|
2092
|
-
disableEmit: _this1.disableEmit
|
|
2093
|
-
})
|
|
2094
|
-
];
|
|
2095
|
-
case 1:
|
|
2096
|
-
_this1.statsInfo = _state.sent();
|
|
2097
|
-
return [
|
|
2098
|
-
4,
|
|
2099
|
-
_this1._manifestManager.generateManifest({
|
|
2100
|
-
compilation: compilation,
|
|
2101
|
-
stats: _this1.statsInfo.stats,
|
|
2102
|
-
publicPath: _this1._statsManager.getPublicPath(compiler),
|
|
2103
|
-
compiler: compiler,
|
|
2104
|
-
bundler: _this1._bundler,
|
|
2105
|
-
additionalData: _type_of(_this1._options.manifest) === 'object' ? _this1._options.manifest.additionalData : undefined
|
|
2106
|
-
}, {
|
|
2107
|
-
disableEmit: _this1.disableEmit
|
|
2108
|
-
})
|
|
2109
|
-
];
|
|
2110
|
-
case 2:
|
|
2111
|
-
_this1.manifestInfo = _state.sent();
|
|
2112
|
-
_state.label = 3;
|
|
2113
|
-
case 3:
|
|
2114
|
-
return [
|
|
2115
|
-
2
|
|
2116
|
-
];
|
|
2117
|
-
}
|
|
2118
|
-
});
|
|
2119
|
-
}));
|
|
2120
|
-
});
|
|
2121
|
-
}
|
|
2122
|
-
},
|
|
2123
|
-
{
|
|
2124
|
-
key: "resourceInfo",
|
|
2125
|
-
get: function get() {
|
|
2126
|
-
return {
|
|
2127
|
-
stats: this.statsInfo,
|
|
2128
|
-
manifest: this.manifestInfo
|
|
2129
|
-
};
|
|
2130
|
-
}
|
|
1136
|
+
apply(compiler) {
|
|
1137
|
+
sdk.bindLoggerToCompiler(logger, compiler, PLUGIN_IDENTIFIER);
|
|
1138
|
+
if (!this._enable) {
|
|
1139
|
+
return;
|
|
2131
1140
|
}
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
1141
|
+
const res = this._statsManager.validate(compiler);
|
|
1142
|
+
if (!res) {
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
compiler.hooks.thisCompilation.tap('generateStats', (compilation) => {
|
|
1146
|
+
compilation.hooks.processAssets.tapPromise({
|
|
1147
|
+
name: 'generateStats',
|
|
1148
|
+
// @ts-ignore use runtime variable in case peer dep not installed
|
|
1149
|
+
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER,
|
|
1150
|
+
}, async () => {
|
|
1151
|
+
if (this._options.manifest !== false) {
|
|
1152
|
+
const existedStats = compilation.getAsset(this._statsManager.fileName);
|
|
1153
|
+
if (existedStats) {
|
|
1154
|
+
return;
|
|
1155
|
+
}
|
|
1156
|
+
this.statsInfo = await this._statsManager.generateStats(compiler, compilation);
|
|
1157
|
+
this.manifestInfo = await this._manifestManager.generateManifest({
|
|
1158
|
+
compilation,
|
|
1159
|
+
stats: this.statsInfo.stats,
|
|
1160
|
+
publicPath: this._statsManager.getPublicPath(compiler),
|
|
1161
|
+
compiler,
|
|
1162
|
+
bundler: this._bundler,
|
|
1163
|
+
additionalData: typeof this._options.manifest === 'object'
|
|
1164
|
+
? this._options.manifest.additionalData
|
|
1165
|
+
: undefined,
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
});
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
2136
1172
|
|
|
2137
1173
|
exports.ManifestManager = ManifestManager;
|
|
2138
1174
|
exports.StatsManager = StatsManager;
|