@module-federation/manifest 0.2.0 → 0.2.1

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 CHANGED
@@ -24,7 +24,7 @@ function _array_like_to_array$2(arr, len) {
24
24
  function _array_with_holes$2(arr) {
25
25
  if (Array.isArray(arr)) return arr;
26
26
  }
27
- function _array_without_holes(arr) {
27
+ function _array_without_holes$1(arr) {
28
28
  if (Array.isArray(arr)) return _array_like_to_array$2(arr);
29
29
  }
30
30
  function _define_property$4(obj, key, value) {
@@ -40,7 +40,7 @@ function _define_property$4(obj, key, value) {
40
40
  }
41
41
  return obj;
42
42
  }
43
- function _iterable_to_array(iter) {
43
+ function _iterable_to_array$1(iter) {
44
44
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
45
45
  }
46
46
  function _iterable_to_array_limit$2(arr, i) {
@@ -70,7 +70,7 @@ function _iterable_to_array_limit$2(arr, i) {
70
70
  function _non_iterable_rest$2() {
71
71
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
72
72
  }
73
- function _non_iterable_spread() {
73
+ function _non_iterable_spread$1() {
74
74
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
75
75
  }
76
76
  function _object_spread$3(target) {
@@ -125,8 +125,8 @@ function _tagged_template_literal$2(strings, raw) {
125
125
  }
126
126
  }));
127
127
  }
128
- function _to_consumable_array(arr) {
129
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread();
128
+ function _to_consumable_array$1(arr) {
129
+ return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$1();
130
130
  }
131
131
  function _unsupported_iterable_to_array$2(o, minLen) {
132
132
  if (!o) return;
@@ -185,7 +185,7 @@ function getAssetsByChunkIDs(compilation, chunkIDMap) {
185
185
  return item.id === chunkID;
186
186
  });
187
187
  if (chunk) {
188
- collectAssets(_to_consumable_array(chunk.files), assetMap[key].js, assetMap[key].css);
188
+ collectAssets(_to_consumable_array$1(chunk.files), assetMap[key].js, assetMap[key].css);
189
189
  }
190
190
  });
191
191
  });
@@ -319,7 +319,7 @@ function getSharedModules(stats, sharedModules) {
319
319
  }
320
320
  return effectiveSharedModules;
321
321
  }
322
- function getAssetsByChunk(chunk) {
322
+ function getAssetsByChunk(chunk, entryPointNames) {
323
323
  var assesSet = {
324
324
  js: {
325
325
  sync: new Set(),
@@ -331,13 +331,15 @@ function getAssetsByChunk(chunk) {
331
331
  }
332
332
  };
333
333
  var collectChunkFiles = function(targetChunk, type) {
334
- _to_consumable_array(targetChunk.groupsIterable).forEach(function(chunkGroup) {
335
- collectAssets(chunkGroup.getFiles(), assesSet.js[type], assesSet.css[type]);
334
+ _to_consumable_array$1(targetChunk.groupsIterable).forEach(function(chunkGroup) {
335
+ if (chunkGroup.name && !entryPointNames.includes(chunkGroup.name)) {
336
+ collectAssets(chunkGroup.getFiles(), assesSet.js[type], assesSet.css[type]);
337
+ }
336
338
  });
337
339
  };
338
340
  collectChunkFiles(chunk, 'sync');
339
- _to_consumable_array(chunk.getAllAsyncChunks()).forEach(function(asyncChunk) {
340
- collectAssets(_to_consumable_array(asyncChunk.files), assesSet.js['async'], assesSet.css['async']);
341
+ _to_consumable_array$1(chunk.getAllAsyncChunks()).forEach(function(asyncChunk) {
342
+ collectAssets(_to_consumable_array$1(asyncChunk.files), assesSet.js['async'], assesSet.css['async']);
341
343
  collectChunkFiles(asyncChunk, 'async');
342
344
  });
343
345
  var assets = {
@@ -1155,6 +1157,9 @@ var ModuleHandler = /*#__PURE__*/ function() {
1155
1157
  function _array_with_holes(arr) {
1156
1158
  if (Array.isArray(arr)) return arr;
1157
1159
  }
1160
+ function _array_without_holes(arr) {
1161
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
1162
+ }
1158
1163
  function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
1159
1164
  try {
1160
1165
  var info = gen[key](arg);
@@ -1216,6 +1221,9 @@ function _define_property$1(obj, key, value) {
1216
1221
  }
1217
1222
  return obj;
1218
1223
  }
1224
+ function _iterable_to_array(iter) {
1225
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1226
+ }
1219
1227
  function _iterable_to_array_limit(arr, i) {
1220
1228
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1221
1229
  if (_i == null) return;
@@ -1243,6 +1251,9 @@ function _iterable_to_array_limit(arr, i) {
1243
1251
  function _non_iterable_rest() {
1244
1252
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1245
1253
  }
1254
+ function _non_iterable_spread() {
1255
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1256
+ }
1246
1257
  function _object_spread(target) {
1247
1258
  for(var i = 1; i < arguments.length; i++){
1248
1259
  var source = arguments[i] != null ? arguments[i] : {};
@@ -1295,6 +1306,9 @@ function _tagged_template_literal(strings, raw) {
1295
1306
  }
1296
1307
  }));
1297
1308
  }
1309
+ function _to_consumable_array(arr) {
1310
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
1311
+ }
1298
1312
  function _type_of$1(obj) {
1299
1313
  "@swc/helpers - typeof";
1300
1314
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
@@ -1494,6 +1508,14 @@ var StatsManager = /*#__PURE__*/ function() {
1494
1508
  globalName: globalName,
1495
1509
  pluginVersion: this._pluginVersion
1496
1510
  };
1511
+ if (this._options.getPublicPath) {
1512
+ if ('publicPath' in metaData) {
1513
+ delete metaData.publicPath;
1514
+ }
1515
+ return _object_spread_props(_object_spread({}, metaData), {
1516
+ getPublicPath: this._options.getPublicPath
1517
+ });
1518
+ }
1497
1519
  return _object_spread_props(_object_spread({}, metaData), {
1498
1520
  publicPath: this.getPublicPath(compiler)
1499
1521
  });
@@ -1525,11 +1547,16 @@ var StatsManager = /*#__PURE__*/ function() {
1525
1547
  var chunks = compilation.chunks;
1526
1548
  var exposeFileNameImportMap = this._containerManager.exposeFileNameImportMap;
1527
1549
  var assets = {};
1550
+ var entryPointNames = _to_consumable_array(compilation.entrypoints.values()).map(function(e) {
1551
+ return e.name;
1552
+ }).filter(function(v) {
1553
+ return !!v;
1554
+ });
1528
1555
  chunks.forEach(function(chunk) {
1529
1556
  if (typeof chunk.name === 'string' && exposeFileNameImportMap[chunk.name]) {
1530
1557
  // TODO: support multiple import
1531
1558
  var exposeKey = exposeFileNameImportMap[chunk.name][0];
1532
- assets[getFileNameWithOutExt(exposeKey)] = getAssetsByChunk(chunk);
1559
+ assets[getFileNameWithOutExt(exposeKey)] = getAssetsByChunk(chunk, entryPointNames);
1533
1560
  }
1534
1561
  });
1535
1562
  return assets;
package/dist/index.esm.js CHANGED
@@ -15,7 +15,7 @@ function _array_like_to_array$2(arr, len) {
15
15
  function _array_with_holes$2(arr) {
16
16
  if (Array.isArray(arr)) return arr;
17
17
  }
18
- function _array_without_holes(arr) {
18
+ function _array_without_holes$1(arr) {
19
19
  if (Array.isArray(arr)) return _array_like_to_array$2(arr);
20
20
  }
21
21
  function _define_property$4(obj, key, value) {
@@ -31,7 +31,7 @@ function _define_property$4(obj, key, value) {
31
31
  }
32
32
  return obj;
33
33
  }
34
- function _iterable_to_array(iter) {
34
+ function _iterable_to_array$1(iter) {
35
35
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
36
36
  }
37
37
  function _iterable_to_array_limit$2(arr, i) {
@@ -61,7 +61,7 @@ function _iterable_to_array_limit$2(arr, i) {
61
61
  function _non_iterable_rest$2() {
62
62
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
63
63
  }
64
- function _non_iterable_spread() {
64
+ function _non_iterable_spread$1() {
65
65
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
66
66
  }
67
67
  function _object_spread$3(target) {
@@ -116,8 +116,8 @@ function _tagged_template_literal$2(strings, raw) {
116
116
  }
117
117
  }));
118
118
  }
119
- function _to_consumable_array(arr) {
120
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread();
119
+ function _to_consumable_array$1(arr) {
120
+ return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$1();
121
121
  }
122
122
  function _unsupported_iterable_to_array$2(o, minLen) {
123
123
  if (!o) return;
@@ -176,7 +176,7 @@ function getAssetsByChunkIDs(compilation, chunkIDMap) {
176
176
  return item.id === chunkID;
177
177
  });
178
178
  if (chunk) {
179
- collectAssets(_to_consumable_array(chunk.files), assetMap[key].js, assetMap[key].css);
179
+ collectAssets(_to_consumable_array$1(chunk.files), assetMap[key].js, assetMap[key].css);
180
180
  }
181
181
  });
182
182
  });
@@ -310,7 +310,7 @@ function getSharedModules(stats, sharedModules) {
310
310
  }
311
311
  return effectiveSharedModules;
312
312
  }
313
- function getAssetsByChunk(chunk) {
313
+ function getAssetsByChunk(chunk, entryPointNames) {
314
314
  var assesSet = {
315
315
  js: {
316
316
  sync: new Set(),
@@ -322,13 +322,15 @@ function getAssetsByChunk(chunk) {
322
322
  }
323
323
  };
324
324
  var collectChunkFiles = function(targetChunk, type) {
325
- _to_consumable_array(targetChunk.groupsIterable).forEach(function(chunkGroup) {
326
- collectAssets(chunkGroup.getFiles(), assesSet.js[type], assesSet.css[type]);
325
+ _to_consumable_array$1(targetChunk.groupsIterable).forEach(function(chunkGroup) {
326
+ if (chunkGroup.name && !entryPointNames.includes(chunkGroup.name)) {
327
+ collectAssets(chunkGroup.getFiles(), assesSet.js[type], assesSet.css[type]);
328
+ }
327
329
  });
328
330
  };
329
331
  collectChunkFiles(chunk, 'sync');
330
- _to_consumable_array(chunk.getAllAsyncChunks()).forEach(function(asyncChunk) {
331
- collectAssets(_to_consumable_array(asyncChunk.files), assesSet.js['async'], assesSet.css['async']);
332
+ _to_consumable_array$1(chunk.getAllAsyncChunks()).forEach(function(asyncChunk) {
333
+ collectAssets(_to_consumable_array$1(asyncChunk.files), assesSet.js['async'], assesSet.css['async']);
332
334
  collectChunkFiles(asyncChunk, 'async');
333
335
  });
334
336
  var assets = {
@@ -1146,6 +1148,9 @@ var ModuleHandler = /*#__PURE__*/ function() {
1146
1148
  function _array_with_holes(arr) {
1147
1149
  if (Array.isArray(arr)) return arr;
1148
1150
  }
1151
+ function _array_without_holes(arr) {
1152
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
1153
+ }
1149
1154
  function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
1150
1155
  try {
1151
1156
  var info = gen[key](arg);
@@ -1207,6 +1212,9 @@ function _define_property$1(obj, key, value) {
1207
1212
  }
1208
1213
  return obj;
1209
1214
  }
1215
+ function _iterable_to_array(iter) {
1216
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1217
+ }
1210
1218
  function _iterable_to_array_limit(arr, i) {
1211
1219
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1212
1220
  if (_i == null) return;
@@ -1234,6 +1242,9 @@ function _iterable_to_array_limit(arr, i) {
1234
1242
  function _non_iterable_rest() {
1235
1243
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1236
1244
  }
1245
+ function _non_iterable_spread() {
1246
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1247
+ }
1237
1248
  function _object_spread(target) {
1238
1249
  for(var i = 1; i < arguments.length; i++){
1239
1250
  var source = arguments[i] != null ? arguments[i] : {};
@@ -1286,6 +1297,9 @@ function _tagged_template_literal(strings, raw) {
1286
1297
  }
1287
1298
  }));
1288
1299
  }
1300
+ function _to_consumable_array(arr) {
1301
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
1302
+ }
1289
1303
  function _type_of$1(obj) {
1290
1304
  "@swc/helpers - typeof";
1291
1305
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
@@ -1485,6 +1499,14 @@ var StatsManager = /*#__PURE__*/ function() {
1485
1499
  globalName: globalName,
1486
1500
  pluginVersion: this._pluginVersion
1487
1501
  };
1502
+ if (this._options.getPublicPath) {
1503
+ if ('publicPath' in metaData) {
1504
+ delete metaData.publicPath;
1505
+ }
1506
+ return _object_spread_props(_object_spread({}, metaData), {
1507
+ getPublicPath: this._options.getPublicPath
1508
+ });
1509
+ }
1488
1510
  return _object_spread_props(_object_spread({}, metaData), {
1489
1511
  publicPath: this.getPublicPath(compiler)
1490
1512
  });
@@ -1516,11 +1538,16 @@ var StatsManager = /*#__PURE__*/ function() {
1516
1538
  var chunks = compilation.chunks;
1517
1539
  var exposeFileNameImportMap = this._containerManager.exposeFileNameImportMap;
1518
1540
  var assets = {};
1541
+ var entryPointNames = _to_consumable_array(compilation.entrypoints.values()).map(function(e) {
1542
+ return e.name;
1543
+ }).filter(function(v) {
1544
+ return !!v;
1545
+ });
1519
1546
  chunks.forEach(function(chunk) {
1520
1547
  if (typeof chunk.name === 'string' && exposeFileNameImportMap[chunk.name]) {
1521
1548
  // TODO: support multiple import
1522
1549
  var exposeKey = exposeFileNameImportMap[chunk.name][0];
1523
- assets[getFileNameWithOutExt(exposeKey)] = getAssetsByChunk(chunk);
1550
+ assets[getFileNameWithOutExt(exposeKey)] = getAssetsByChunk(chunk, entryPointNames);
1524
1551
  }
1525
1552
  });
1526
1553
  return assets;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/manifest",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "license": "MIT",
5
5
  "description": "Provide manifest/stats for webpack/rspack MF project .",
6
6
  "keywords": [
@@ -6,7 +6,7 @@ export declare function getAssetsByChunkIDs(compilation: Compilation, chunkIDMap
6
6
  }>;
7
7
  export declare function findChunk(id: string | number, chunks: Set<Chunk>): Chunk | void;
8
8
  export declare function getSharedModules(stats: StatsCompilation, sharedModules: StatsModule[]): [string, StatsModule][];
9
- export declare function getAssetsByChunk(chunk: Chunk): StatsAssets;
9
+ export declare function getAssetsByChunk(chunk: Chunk, entryPointNames: Array<string>): StatsAssets;
10
10
  export declare function assert(condition: any, msg: string): asserts condition;
11
11
  export declare function error(msg: string | Error | unknown): never;
12
12
  export declare function isDev(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/manifest",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "license": "MIT",
5
5
  "description": "Provide manifest/stats for webpack/rspack MF project .",
6
6
  "keywords": [
@@ -24,9 +24,9 @@
24
24
  "dependencies": {
25
25
  "find-pkg": "2.0.0",
26
26
  "chalk": "3.0.0",
27
- "@module-federation/sdk": "0.2.0",
28
- "@module-federation/dts-plugin": "0.2.0",
29
- "@module-federation/managers": "0.2.0"
27
+ "@module-federation/sdk": "0.2.1",
28
+ "@module-federation/dts-plugin": "0.2.1",
29
+ "@module-federation/managers": "0.2.1"
30
30
  },
31
31
  "exports": {
32
32
  ".": {