@module-federation/manifest 0.1.17 → 0.1.19

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
@@ -147,6 +147,24 @@ function _templateObject$2() {
147
147
  };
148
148
  return data;
149
149
  }
150
+ function isHotFile(file) {
151
+ return file.includes(HOT_UPDATE_SUFFIX);
152
+ }
153
+ var collectAssets = function(assets, jsTargetSet, cssTargetSet) {
154
+ assets.forEach(function(file) {
155
+ if (file.endsWith('.css')) {
156
+ cssTargetSet.add(file);
157
+ } else {
158
+ if (isDev()) {
159
+ if (!isHotFile(file)) {
160
+ jsTargetSet.add(file);
161
+ }
162
+ } else {
163
+ jsTargetSet.add(file);
164
+ }
165
+ }
166
+ });
167
+ };
150
168
  function getSharedModuleName(name) {
151
169
  var _name_split = _sliced_to_array$2(name.split(' '), 5); _name_split[0]; _name_split[1]; _name_split[2]; _name_split[3]; var sharedInfo = _name_split[4];
152
170
  return sharedInfo.split('@').slice(0, -1).join('@');
@@ -167,19 +185,7 @@ function getAssetsByChunkIDs(compilation, chunkIDMap) {
167
185
  return item.id === chunkID;
168
186
  });
169
187
  if (chunk) {
170
- _to_consumable_array(chunk.files).forEach(function(asset) {
171
- if (asset.endsWith('.css')) {
172
- assetMap[key].css.add(asset);
173
- } else {
174
- if (process.env['NODE_ENV'] === 'development') {
175
- if (!asset.includes(HOT_UPDATE_SUFFIX)) {
176
- assetMap[key].js.add(asset);
177
- }
178
- } else {
179
- assetMap[key].js.add(asset);
180
- }
181
- }
182
- });
188
+ collectAssets(_to_consumable_array(chunk.files), assetMap[key].js, assetMap[key].css);
183
189
  }
184
190
  });
185
191
  });
@@ -326,24 +332,12 @@ function getAssetsByChunk(chunk) {
326
332
  };
327
333
  var collectChunkFiles = function(targetChunk, type) {
328
334
  _to_consumable_array(targetChunk.groupsIterable).forEach(function(chunkGroup) {
329
- chunkGroup.getFiles().forEach(function(file) {
330
- if (file.endsWith('.css')) {
331
- assesSet.css[type].add(file);
332
- } else {
333
- assesSet.js[type].add(file);
334
- }
335
- });
335
+ collectAssets(chunkGroup.getFiles(), assesSet.js[type], assesSet.css[type]);
336
336
  });
337
337
  };
338
338
  collectChunkFiles(chunk, 'sync');
339
339
  _to_consumable_array(chunk.getAllAsyncChunks()).forEach(function(asyncChunk) {
340
- asyncChunk.files.forEach(function(file) {
341
- if (file.endsWith('.css')) {
342
- assesSet.css.async.add(file);
343
- } else {
344
- assesSet.js.async.add(file);
345
- }
346
- });
340
+ collectAssets(_to_consumable_array(asyncChunk.files), assesSet.js['async'], assesSet.css['async']);
347
341
  collectChunkFiles(asyncChunk, 'async');
348
342
  });
349
343
  var assets = {
@@ -1459,6 +1453,7 @@ var StatsManager = /*#__PURE__*/ function() {
1459
1453
  key: "_getMetaData",
1460
1454
  value: function _getMetaData(compiler, compilation, extraOptions) {
1461
1455
  var _this = this;
1456
+ var _this__options_library, _this__options;
1462
1457
  var context = compiler.options.context;
1463
1458
  var _this1 = this, name = _this1._options.name, buildInfo = _this1.buildInfo;
1464
1459
  var type = this._pkgJsonManager.getExposeGarfishModuleType(context || process.cwd());
@@ -1489,7 +1484,7 @@ var StatsManager = /*#__PURE__*/ function() {
1489
1484
  name: getRemoteEntryName(),
1490
1485
  path: '',
1491
1486
  // same as the types supported by runtime, currently only global/var/script is supported
1492
- type: 'global'
1487
+ type: ((_this__options = this._options) === null || _this__options === void 0 ? void 0 : (_this__options_library = _this__options.library) === null || _this__options_library === void 0 ? void 0 : _this__options_library.type) || 'global'
1493
1488
  },
1494
1489
  types: getTypesMetaInfo(this._options, compiler.context),
1495
1490
  globalName: globalName,
package/dist/index.esm.js CHANGED
@@ -138,6 +138,24 @@ function _templateObject$2() {
138
138
  };
139
139
  return data;
140
140
  }
141
+ function isHotFile(file) {
142
+ return file.includes(HOT_UPDATE_SUFFIX);
143
+ }
144
+ var collectAssets = function(assets, jsTargetSet, cssTargetSet) {
145
+ assets.forEach(function(file) {
146
+ if (file.endsWith('.css')) {
147
+ cssTargetSet.add(file);
148
+ } else {
149
+ if (isDev()) {
150
+ if (!isHotFile(file)) {
151
+ jsTargetSet.add(file);
152
+ }
153
+ } else {
154
+ jsTargetSet.add(file);
155
+ }
156
+ }
157
+ });
158
+ };
141
159
  function getSharedModuleName(name) {
142
160
  var _name_split = _sliced_to_array$2(name.split(' '), 5); _name_split[0]; _name_split[1]; _name_split[2]; _name_split[3]; var sharedInfo = _name_split[4];
143
161
  return sharedInfo.split('@').slice(0, -1).join('@');
@@ -158,19 +176,7 @@ function getAssetsByChunkIDs(compilation, chunkIDMap) {
158
176
  return item.id === chunkID;
159
177
  });
160
178
  if (chunk) {
161
- _to_consumable_array(chunk.files).forEach(function(asset) {
162
- if (asset.endsWith('.css')) {
163
- assetMap[key].css.add(asset);
164
- } else {
165
- if (process.env['NODE_ENV'] === 'development') {
166
- if (!asset.includes(HOT_UPDATE_SUFFIX)) {
167
- assetMap[key].js.add(asset);
168
- }
169
- } else {
170
- assetMap[key].js.add(asset);
171
- }
172
- }
173
- });
179
+ collectAssets(_to_consumable_array(chunk.files), assetMap[key].js, assetMap[key].css);
174
180
  }
175
181
  });
176
182
  });
@@ -317,24 +323,12 @@ function getAssetsByChunk(chunk) {
317
323
  };
318
324
  var collectChunkFiles = function(targetChunk, type) {
319
325
  _to_consumable_array(targetChunk.groupsIterable).forEach(function(chunkGroup) {
320
- chunkGroup.getFiles().forEach(function(file) {
321
- if (file.endsWith('.css')) {
322
- assesSet.css[type].add(file);
323
- } else {
324
- assesSet.js[type].add(file);
325
- }
326
- });
326
+ collectAssets(chunkGroup.getFiles(), assesSet.js[type], assesSet.css[type]);
327
327
  });
328
328
  };
329
329
  collectChunkFiles(chunk, 'sync');
330
330
  _to_consumable_array(chunk.getAllAsyncChunks()).forEach(function(asyncChunk) {
331
- asyncChunk.files.forEach(function(file) {
332
- if (file.endsWith('.css')) {
333
- assesSet.css.async.add(file);
334
- } else {
335
- assesSet.js.async.add(file);
336
- }
337
- });
331
+ collectAssets(_to_consumable_array(asyncChunk.files), assesSet.js['async'], assesSet.css['async']);
338
332
  collectChunkFiles(asyncChunk, 'async');
339
333
  });
340
334
  var assets = {
@@ -1450,6 +1444,7 @@ var StatsManager = /*#__PURE__*/ function() {
1450
1444
  key: "_getMetaData",
1451
1445
  value: function _getMetaData(compiler, compilation, extraOptions) {
1452
1446
  var _this = this;
1447
+ var _this__options_library, _this__options;
1453
1448
  var context = compiler.options.context;
1454
1449
  var _this1 = this, name = _this1._options.name, buildInfo = _this1.buildInfo;
1455
1450
  var type = this._pkgJsonManager.getExposeGarfishModuleType(context || process.cwd());
@@ -1480,7 +1475,7 @@ var StatsManager = /*#__PURE__*/ function() {
1480
1475
  name: getRemoteEntryName(),
1481
1476
  path: '',
1482
1477
  // same as the types supported by runtime, currently only global/var/script is supported
1483
- type: 'global'
1478
+ type: ((_this__options = this._options) === null || _this__options === void 0 ? void 0 : (_this__options_library = _this__options.library) === null || _this__options_library === void 0 ? void 0 : _this__options_library.type) || 'global'
1484
1479
  },
1485
1480
  types: getTypesMetaInfo(this._options, compiler.context),
1486
1481
  globalName: globalName,
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/manifest",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "license": "MIT",
5
5
  "description": "Provide manifest/stats for webpack/rspack MF project .",
6
6
  "keywords": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/manifest",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
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.1.17",
28
- "@module-federation/dts-plugin": "0.1.17",
29
- "@module-federation/managers": "0.1.17"
27
+ "@module-federation/sdk": "0.1.19",
28
+ "@module-federation/dts-plugin": "0.1.19",
29
+ "@module-federation/managers": "0.1.19"
30
30
  },
31
31
  "exports": {
32
32
  ".": {