@module-federation/manifest 0.8.4 → 0.8.6

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
@@ -806,6 +806,28 @@ function _unsupported_iterable_to_array$1(o, minLen) {
806
806
  if (n === "Map" || n === "Set") return Array.from(n);
807
807
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
808
808
  }
809
+ function getExposeItem(param) {
810
+ var exposeKey = param.exposeKey, name = param.name, file = param.file;
811
+ var exposeModuleName = exposeKey.replace('./', '');
812
+ return {
813
+ path: exposeKey,
814
+ id: "".concat(name, ":").concat(exposeModuleName),
815
+ name: exposeModuleName,
816
+ // @ts-ignore to deduplicate
817
+ requires: new Set(),
818
+ file: path.relative(process.cwd(), file.import[0]),
819
+ assets: {
820
+ js: {
821
+ async: [],
822
+ sync: []
823
+ },
824
+ css: {
825
+ async: [],
826
+ sync: []
827
+ }
828
+ }
829
+ };
830
+ }
809
831
  var ModuleHandler = /*#__PURE__*/ function() {
810
832
  function ModuleHandler(options, modules, param) {
811
833
  var bundler = param.bundler;
@@ -1024,26 +1046,12 @@ var ModuleHandler = /*#__PURE__*/ function() {
1024
1046
  var data = identifier.split(' ');
1025
1047
  JSON.parse(data[3]).forEach(function(param) {
1026
1048
  var _param = _sliced_to_array$1(param, 2), prefixedName = _param[0], file = _param[1];
1027
- var exposeModuleName = prefixedName.replace('./', '');
1028
1049
  // TODO: support multiple import
1029
- exposesMap[getFileNameWithOutExt(file.import[0])] = {
1030
- path: prefixedName,
1031
- id: "".concat(_this._options.name, ":").concat(exposeModuleName),
1032
- name: exposeModuleName,
1033
- // @ts-ignore to deduplicate
1034
- requires: new Set(),
1035
- file: path.relative(process.cwd(), file.import[0]),
1036
- assets: {
1037
- js: {
1038
- async: [],
1039
- sync: []
1040
- },
1041
- css: {
1042
- async: [],
1043
- sync: []
1044
- }
1045
- }
1046
- };
1050
+ exposesMap[getFileNameWithOutExt(file.import[0])] = getExposeItem({
1051
+ exposeKey: prefixedName,
1052
+ name: _this._options.name,
1053
+ file: file
1054
+ });
1047
1055
  });
1048
1056
  }
1049
1057
  },
@@ -1548,7 +1556,7 @@ var StatsManager = /*#__PURE__*/ function() {
1548
1556
  value: function _generateStats(compiler, compilation, extraOptions) {
1549
1557
  var _this = this;
1550
1558
  return _async_to_generator$1(function() {
1551
- var _this__options, name, tmp, manifestOptions, metaData, stats, remotes, liveStats, statsOptions, webpackStats, filteredModules, moduleHandler, _moduleHandler_collect, remotes1, exposesMap, sharedMap, err;
1559
+ var _this__options, name, tmp, manifestOptions, _this__options_exposes, exposes, metaData, stats, remotes, liveStats, statsOptions, webpackStats, filteredModules, moduleHandler, _moduleHandler_collect, remotes1, exposesMap, sharedMap, err;
1552
1560
  return _ts_generator$1(this, function(_state) {
1553
1561
  switch(_state.label){
1554
1562
  case 0:
@@ -1558,7 +1566,7 @@ var StatsManager = /*#__PURE__*/ function() {
1558
1566
  ,
1559
1567
  4
1560
1568
  ]);
1561
- _this__options = _this._options, name = _this__options.name, tmp = _this__options.manifest, manifestOptions = tmp === void 0 ? {} : tmp;
1569
+ _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;
1562
1570
  metaData = _this._getMetaData(compiler, compilation, extraOptions);
1563
1571
  stats = {
1564
1572
  id: name,
@@ -1571,6 +1579,15 @@ var StatsManager = /*#__PURE__*/ function() {
1571
1579
  if ((typeof manifestOptions === "undefined" ? "undefined" : _type_of$1(manifestOptions)) === 'object' && manifestOptions.disableAssetsAnalyze) {
1572
1580
  remotes = _this._remoteManager.statsRemoteWithEmptyUsedIn;
1573
1581
  stats.remotes = remotes;
1582
+ stats.exposes = Object.keys(exposes).map(function(exposeKey) {
1583
+ return getExposeItem({
1584
+ exposeKey: exposeKey,
1585
+ name: name,
1586
+ file: {
1587
+ import: exposes[exposeKey].import
1588
+ }
1589
+ });
1590
+ });
1574
1591
  return [
1575
1592
  2,
1576
1593
  stats
package/dist/index.esm.js CHANGED
@@ -804,6 +804,28 @@ function _unsupported_iterable_to_array$1(o, minLen) {
804
804
  if (n === "Map" || n === "Set") return Array.from(n);
805
805
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
806
806
  }
807
+ function getExposeItem(param) {
808
+ var exposeKey = param.exposeKey, name = param.name, file = param.file;
809
+ var exposeModuleName = exposeKey.replace('./', '');
810
+ return {
811
+ path: exposeKey,
812
+ id: "".concat(name, ":").concat(exposeModuleName),
813
+ name: exposeModuleName,
814
+ // @ts-ignore to deduplicate
815
+ requires: new Set(),
816
+ file: path.relative(process.cwd(), file.import[0]),
817
+ assets: {
818
+ js: {
819
+ async: [],
820
+ sync: []
821
+ },
822
+ css: {
823
+ async: [],
824
+ sync: []
825
+ }
826
+ }
827
+ };
828
+ }
807
829
  var ModuleHandler = /*#__PURE__*/ function() {
808
830
  function ModuleHandler(options, modules, param) {
809
831
  var bundler = param.bundler;
@@ -1022,26 +1044,12 @@ var ModuleHandler = /*#__PURE__*/ function() {
1022
1044
  var data = identifier.split(' ');
1023
1045
  JSON.parse(data[3]).forEach(function(param) {
1024
1046
  var _param = _sliced_to_array$1(param, 2), prefixedName = _param[0], file = _param[1];
1025
- var exposeModuleName = prefixedName.replace('./', '');
1026
1047
  // TODO: support multiple import
1027
- exposesMap[getFileNameWithOutExt(file.import[0])] = {
1028
- path: prefixedName,
1029
- id: "".concat(_this._options.name, ":").concat(exposeModuleName),
1030
- name: exposeModuleName,
1031
- // @ts-ignore to deduplicate
1032
- requires: new Set(),
1033
- file: path.relative(process.cwd(), file.import[0]),
1034
- assets: {
1035
- js: {
1036
- async: [],
1037
- sync: []
1038
- },
1039
- css: {
1040
- async: [],
1041
- sync: []
1042
- }
1043
- }
1044
- };
1048
+ exposesMap[getFileNameWithOutExt(file.import[0])] = getExposeItem({
1049
+ exposeKey: prefixedName,
1050
+ name: _this._options.name,
1051
+ file: file
1052
+ });
1045
1053
  });
1046
1054
  }
1047
1055
  },
@@ -1546,7 +1554,7 @@ var StatsManager = /*#__PURE__*/ function() {
1546
1554
  value: function _generateStats(compiler, compilation, extraOptions) {
1547
1555
  var _this = this;
1548
1556
  return _async_to_generator$1(function() {
1549
- var _this__options, name, tmp, manifestOptions, metaData, stats, remotes, liveStats, statsOptions, webpackStats, filteredModules, moduleHandler, _moduleHandler_collect, remotes1, exposesMap, sharedMap, err;
1557
+ var _this__options, name, tmp, manifestOptions, _this__options_exposes, exposes, metaData, stats, remotes, liveStats, statsOptions, webpackStats, filteredModules, moduleHandler, _moduleHandler_collect, remotes1, exposesMap, sharedMap, err;
1550
1558
  return _ts_generator$1(this, function(_state) {
1551
1559
  switch(_state.label){
1552
1560
  case 0:
@@ -1556,7 +1564,7 @@ var StatsManager = /*#__PURE__*/ function() {
1556
1564
  ,
1557
1565
  4
1558
1566
  ]);
1559
- _this__options = _this._options, name = _this__options.name, tmp = _this__options.manifest, manifestOptions = tmp === void 0 ? {} : tmp;
1567
+ _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;
1560
1568
  metaData = _this._getMetaData(compiler, compilation, extraOptions);
1561
1569
  stats = {
1562
1570
  id: name,
@@ -1569,6 +1577,15 @@ var StatsManager = /*#__PURE__*/ function() {
1569
1577
  if ((typeof manifestOptions === "undefined" ? "undefined" : _type_of$1(manifestOptions)) === 'object' && manifestOptions.disableAssetsAnalyze) {
1570
1578
  remotes = _this._remoteManager.statsRemoteWithEmptyUsedIn;
1571
1579
  stats.remotes = remotes;
1580
+ stats.exposes = Object.keys(exposes).map(function(exposeKey) {
1581
+ return getExposeItem({
1582
+ exposeKey: exposeKey,
1583
+ name: name,
1584
+ file: {
1585
+ import: exposes[exposeKey].import
1586
+ }
1587
+ });
1588
+ });
1572
1589
  return [
1573
1590
  2,
1574
1591
  stats
@@ -1,5 +1,12 @@
1
1
  import { StatsExpose, StatsRemote, StatsShared, moduleFederationPlugin } from '@module-federation/sdk';
2
2
  import type { StatsModule } from 'webpack';
3
+ export declare function getExposeItem({ exposeKey, name, file, }: {
4
+ exposeKey: string;
5
+ name: string;
6
+ file: {
7
+ import: string[];
8
+ };
9
+ }): StatsExpose;
3
10
  declare class ModuleHandler {
4
11
  private _options;
5
12
  private _bundler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/manifest",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "license": "MIT",
5
5
  "description": "Provide manifest/stats for webpack/rspack MF project .",
6
6
  "keywords": [
@@ -29,9 +29,9 @@
29
29
  "dependencies": {
30
30
  "find-pkg": "2.0.0",
31
31
  "chalk": "3.0.0",
32
- "@module-federation/sdk": "0.8.4",
33
- "@module-federation/dts-plugin": "0.8.4",
34
- "@module-federation/managers": "0.8.4"
32
+ "@module-federation/sdk": "0.8.6",
33
+ "@module-federation/dts-plugin": "0.8.6",
34
+ "@module-federation/managers": "0.8.6"
35
35
  },
36
36
  "exports": {
37
37
  ".": {