@module-federation/manifest 0.0.0-next-20240529095100 → 0.0.0-next-20240529103203
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 +83 -47
- package/dist/index.esm.js +83 -47
- package/dist/package.json +1 -1
- package/dist/src/ManifestManager.d.ts +4 -1
- package/dist/src/StatsManager.d.ts +5 -2
- package/dist/src/StatsPlugin.d.ts +5 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/types.d.ts +13 -0
- package/package.json +4 -4
package/dist/index.cjs.js
CHANGED
|
@@ -658,53 +658,52 @@ var ManifestManager = /*#__PURE__*/ function() {
|
|
|
658
658
|
{
|
|
659
659
|
key: "generateManifest",
|
|
660
660
|
value: function generateManifest(options) {
|
|
661
|
+
var extraOptions = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
661
662
|
var _this = this;
|
|
662
663
|
return _async_to_generator$2(function() {
|
|
663
|
-
var compilation, publicPath, stats, compiler, bundler, additionalData, manifest, manifestFileName, ret;
|
|
664
|
+
var compilation, publicPath, stats, compiler, bundler, additionalData, disableEmit, manifest, manifestFileName, ret;
|
|
664
665
|
return _ts_generator$2(this, function(_state) {
|
|
665
666
|
switch(_state.label){
|
|
666
667
|
case 0:
|
|
667
668
|
compilation = options.compilation, publicPath = options.publicPath, stats = options.stats, compiler = options.compiler, bundler = options.bundler, additionalData = options.additionalData;
|
|
669
|
+
disableEmit = extraOptions.disableEmit;
|
|
668
670
|
manifest = _object_spread$2({}, stats);
|
|
669
|
-
manifest.exposes =
|
|
670
|
-
var statsExpose = manifest.exposes[cur];
|
|
671
|
+
manifest.exposes = stats.exposes.reduce(function(sum, cur) {
|
|
671
672
|
var expose = {
|
|
672
|
-
id:
|
|
673
|
-
name:
|
|
674
|
-
assets:
|
|
675
|
-
path:
|
|
673
|
+
id: cur.id,
|
|
674
|
+
name: cur.name,
|
|
675
|
+
assets: cur.assets,
|
|
676
|
+
path: cur.path
|
|
676
677
|
};
|
|
677
678
|
sum.push(expose);
|
|
678
679
|
return sum;
|
|
679
680
|
}, []);
|
|
680
|
-
manifest.shared =
|
|
681
|
-
var statsShared = manifest.shared[cur];
|
|
681
|
+
manifest.shared = stats.shared.reduce(function(sum, cur) {
|
|
682
682
|
var shared = {
|
|
683
|
-
id:
|
|
684
|
-
name:
|
|
685
|
-
version:
|
|
686
|
-
singleton:
|
|
687
|
-
requiredVersion:
|
|
688
|
-
hash:
|
|
689
|
-
assets:
|
|
683
|
+
id: cur.id,
|
|
684
|
+
name: cur.name,
|
|
685
|
+
version: cur.version,
|
|
686
|
+
singleton: cur.singleton,
|
|
687
|
+
requiredVersion: cur.requiredVersion,
|
|
688
|
+
hash: cur.hash,
|
|
689
|
+
assets: cur.assets
|
|
690
690
|
};
|
|
691
691
|
sum.push(shared);
|
|
692
692
|
return sum;
|
|
693
693
|
}, []);
|
|
694
|
-
manifest.remotes =
|
|
695
|
-
var statsRemote = manifest.remotes[cur];
|
|
694
|
+
manifest.remotes = stats.remotes.reduce(function(sum, cur) {
|
|
696
695
|
// @ts-ignore version/entry will be added as follow
|
|
697
696
|
var remote = {
|
|
698
|
-
federationContainerName:
|
|
699
|
-
moduleName:
|
|
700
|
-
alias:
|
|
697
|
+
federationContainerName: cur.federationContainerName,
|
|
698
|
+
moduleName: cur.moduleName,
|
|
699
|
+
alias: cur.alias
|
|
701
700
|
};
|
|
702
|
-
if ('entry' in
|
|
701
|
+
if ('entry' in cur) {
|
|
703
702
|
// @ts-ignore
|
|
704
|
-
remote.entry =
|
|
705
|
-
} else if ('version' in
|
|
703
|
+
remote.entry = cur.entry;
|
|
704
|
+
} else if ('version' in cur) {
|
|
706
705
|
// @ts-ignore
|
|
707
|
-
remote.entry =
|
|
706
|
+
remote.entry = cur.version;
|
|
708
707
|
}
|
|
709
708
|
sum.push(remote);
|
|
710
709
|
return sum;
|
|
@@ -731,12 +730,18 @@ var ManifestManager = /*#__PURE__*/ function() {
|
|
|
731
730
|
_this._manifest = ret || _this._manifest;
|
|
732
731
|
_state.label = 2;
|
|
733
732
|
case 2:
|
|
734
|
-
|
|
733
|
+
if (!disableEmit) {
|
|
734
|
+
compilation.emitAsset(manifestFileName, new compiler.webpack.sources.RawSource(JSON.stringify(_this._manifest, null, 2)));
|
|
735
|
+
}
|
|
735
736
|
if (isDev()) {
|
|
736
737
|
console.log(chalk__default["default"](_templateObject$1(), PLUGIN_IDENTIFIER, publicPath === 'auto' ? '{auto}/' : publicPath, manifestFileName));
|
|
737
738
|
}
|
|
738
739
|
return [
|
|
739
|
-
2
|
|
740
|
+
2,
|
|
741
|
+
{
|
|
742
|
+
manifest: _this._manifest,
|
|
743
|
+
filename: manifestFileName
|
|
744
|
+
}
|
|
740
745
|
];
|
|
741
746
|
}
|
|
742
747
|
});
|
|
@@ -1486,7 +1491,7 @@ var StatsManager = /*#__PURE__*/ function() {
|
|
|
1486
1491
|
remoteEntry: {
|
|
1487
1492
|
name: getRemoteEntryName(),
|
|
1488
1493
|
path: '',
|
|
1489
|
-
// same as the types supported by runtime, currently only global/var/script is supported
|
|
1494
|
+
// same as the types supported by runtime, currently only global/var/script/cjs:webpack is supported
|
|
1490
1495
|
type: 'global'
|
|
1491
1496
|
},
|
|
1492
1497
|
types: getTypesMetaInfo(this._options, compiler.context),
|
|
@@ -1754,10 +1759,11 @@ var StatsManager = /*#__PURE__*/ function() {
|
|
|
1754
1759
|
},
|
|
1755
1760
|
{
|
|
1756
1761
|
key: "generateStats",
|
|
1757
|
-
value: function generateStats(compiler, compilation
|
|
1762
|
+
value: function generateStats(compiler, compilation) {
|
|
1763
|
+
var extraOptions = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1758
1764
|
var _this = this;
|
|
1759
1765
|
return _async_to_generator$1(function() {
|
|
1760
|
-
var existedStats, _this__options, tmp, manifestOptions, stats, ret, err;
|
|
1766
|
+
var disableEmit, existedStats, _this__options, tmp, manifestOptions, stats, ret, err;
|
|
1761
1767
|
return _ts_generator$1(this, function(_state) {
|
|
1762
1768
|
switch(_state.label){
|
|
1763
1769
|
case 0:
|
|
@@ -1767,11 +1773,15 @@ var StatsManager = /*#__PURE__*/ function() {
|
|
|
1767
1773
|
,
|
|
1768
1774
|
5
|
|
1769
1775
|
]);
|
|
1776
|
+
disableEmit = extraOptions.disableEmit;
|
|
1770
1777
|
existedStats = compilation.getAsset(_this.fileName);
|
|
1771
|
-
if (existedStats) {
|
|
1778
|
+
if (existedStats && !isDev()) {
|
|
1772
1779
|
return [
|
|
1773
1780
|
2,
|
|
1774
|
-
|
|
1781
|
+
{
|
|
1782
|
+
stats: JSON.parse(existedStats.source.source().toString()),
|
|
1783
|
+
filename: _this.fileName
|
|
1784
|
+
}
|
|
1775
1785
|
];
|
|
1776
1786
|
}
|
|
1777
1787
|
_this__options = _this._options, tmp = _this__options.manifest, manifestOptions = tmp === void 0 ? {} : tmp;
|
|
@@ -1800,10 +1810,15 @@ var StatsManager = /*#__PURE__*/ function() {
|
|
|
1800
1810
|
stats = ret || stats;
|
|
1801
1811
|
_state.label = 3;
|
|
1802
1812
|
case 3:
|
|
1803
|
-
|
|
1813
|
+
if (!disableEmit) {
|
|
1814
|
+
compilation.emitAsset(_this.fileName, new compiler.webpack.sources.RawSource(JSON.stringify(stats, null, 2)));
|
|
1815
|
+
}
|
|
1804
1816
|
return [
|
|
1805
1817
|
2,
|
|
1806
|
-
|
|
1818
|
+
{
|
|
1819
|
+
stats: stats,
|
|
1820
|
+
filename: _this.fileName
|
|
1821
|
+
}
|
|
1807
1822
|
];
|
|
1808
1823
|
case 4:
|
|
1809
1824
|
err = _state.sent();
|
|
@@ -2008,9 +2023,13 @@ var StatsPlugin = /*#__PURE__*/ function() {
|
|
|
2008
2023
|
_define_property(this, "_manifestManager", new ManifestManager());
|
|
2009
2024
|
_define_property(this, "_enable", true);
|
|
2010
2025
|
_define_property(this, "_bundler", 'webpack');
|
|
2026
|
+
_define_property(this, "statsInfo", void 0);
|
|
2027
|
+
_define_property(this, "manifestInfo", void 0);
|
|
2028
|
+
_define_property(this, "disableEmit", void 0);
|
|
2011
2029
|
try {
|
|
2012
2030
|
this._options = options;
|
|
2013
2031
|
this._bundler = bundler;
|
|
2032
|
+
this.disableEmit = Boolean(process.env['MF_DISABLE_EMIT_STATS']);
|
|
2014
2033
|
this._statsManager.init(this._options, {
|
|
2015
2034
|
pluginVersion: pluginVersion,
|
|
2016
2035
|
bundler: bundler
|
|
@@ -2043,30 +2062,38 @@ var StatsPlugin = /*#__PURE__*/ function() {
|
|
|
2043
2062
|
// @ts-ignore use runtime variable in case peer dep not installed
|
|
2044
2063
|
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
|
|
2045
2064
|
}, /*#__PURE__*/ _async_to_generator(function() {
|
|
2046
|
-
var stats;
|
|
2047
2065
|
return _ts_generator(this, function(_state) {
|
|
2048
2066
|
switch(_state.label){
|
|
2049
2067
|
case 0:
|
|
2050
2068
|
if (!(_this1._options.manifest !== false)) return [
|
|
2051
2069
|
3,
|
|
2052
|
-
|
|
2070
|
+
3
|
|
2053
2071
|
];
|
|
2054
2072
|
return [
|
|
2055
2073
|
4,
|
|
2056
|
-
_this1._statsManager.generateStats(compiler, compilation
|
|
2074
|
+
_this1._statsManager.generateStats(compiler, compilation, {
|
|
2075
|
+
disableEmit: _this1.disableEmit
|
|
2076
|
+
})
|
|
2057
2077
|
];
|
|
2058
2078
|
case 1:
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2079
|
+
_this1.statsInfo = _state.sent();
|
|
2080
|
+
return [
|
|
2081
|
+
4,
|
|
2082
|
+
_this1._manifestManager.generateManifest({
|
|
2083
|
+
compilation: compilation,
|
|
2084
|
+
stats: _this1.statsInfo.stats,
|
|
2085
|
+
publicPath: _this1._statsManager.getPublicPath(compiler),
|
|
2086
|
+
compiler: compiler,
|
|
2087
|
+
bundler: _this1._bundler,
|
|
2088
|
+
additionalData: typeof _this1._options.manifest === 'object' ? _this1._options.manifest.additionalData : undefined
|
|
2089
|
+
}, {
|
|
2090
|
+
disableEmit: _this1.disableEmit
|
|
2091
|
+
})
|
|
2092
|
+
];
|
|
2069
2093
|
case 2:
|
|
2094
|
+
_this1.manifestInfo = _state.sent();
|
|
2095
|
+
_state.label = 3;
|
|
2096
|
+
case 3:
|
|
2070
2097
|
return [
|
|
2071
2098
|
2
|
|
2072
2099
|
];
|
|
@@ -2075,6 +2102,15 @@ var StatsPlugin = /*#__PURE__*/ function() {
|
|
|
2075
2102
|
}));
|
|
2076
2103
|
});
|
|
2077
2104
|
}
|
|
2105
|
+
},
|
|
2106
|
+
{
|
|
2107
|
+
key: "resourceInfo",
|
|
2108
|
+
get: function get() {
|
|
2109
|
+
return {
|
|
2110
|
+
stats: this.statsInfo,
|
|
2111
|
+
manifest: this.manifestInfo
|
|
2112
|
+
};
|
|
2113
|
+
}
|
|
2078
2114
|
}
|
|
2079
2115
|
]);
|
|
2080
2116
|
return StatsPlugin;
|
package/dist/index.esm.js
CHANGED
|
@@ -649,53 +649,52 @@ var ManifestManager = /*#__PURE__*/ function() {
|
|
|
649
649
|
{
|
|
650
650
|
key: "generateManifest",
|
|
651
651
|
value: function generateManifest(options) {
|
|
652
|
+
var extraOptions = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
652
653
|
var _this = this;
|
|
653
654
|
return _async_to_generator$2(function() {
|
|
654
|
-
var compilation, publicPath, stats, compiler, bundler, additionalData, manifest, manifestFileName, ret;
|
|
655
|
+
var compilation, publicPath, stats, compiler, bundler, additionalData, disableEmit, manifest, manifestFileName, ret;
|
|
655
656
|
return _ts_generator$2(this, function(_state) {
|
|
656
657
|
switch(_state.label){
|
|
657
658
|
case 0:
|
|
658
659
|
compilation = options.compilation, publicPath = options.publicPath, stats = options.stats, compiler = options.compiler, bundler = options.bundler, additionalData = options.additionalData;
|
|
660
|
+
disableEmit = extraOptions.disableEmit;
|
|
659
661
|
manifest = _object_spread$2({}, stats);
|
|
660
|
-
manifest.exposes =
|
|
661
|
-
var statsExpose = manifest.exposes[cur];
|
|
662
|
+
manifest.exposes = stats.exposes.reduce(function(sum, cur) {
|
|
662
663
|
var expose = {
|
|
663
|
-
id:
|
|
664
|
-
name:
|
|
665
|
-
assets:
|
|
666
|
-
path:
|
|
664
|
+
id: cur.id,
|
|
665
|
+
name: cur.name,
|
|
666
|
+
assets: cur.assets,
|
|
667
|
+
path: cur.path
|
|
667
668
|
};
|
|
668
669
|
sum.push(expose);
|
|
669
670
|
return sum;
|
|
670
671
|
}, []);
|
|
671
|
-
manifest.shared =
|
|
672
|
-
var statsShared = manifest.shared[cur];
|
|
672
|
+
manifest.shared = stats.shared.reduce(function(sum, cur) {
|
|
673
673
|
var shared = {
|
|
674
|
-
id:
|
|
675
|
-
name:
|
|
676
|
-
version:
|
|
677
|
-
singleton:
|
|
678
|
-
requiredVersion:
|
|
679
|
-
hash:
|
|
680
|
-
assets:
|
|
674
|
+
id: cur.id,
|
|
675
|
+
name: cur.name,
|
|
676
|
+
version: cur.version,
|
|
677
|
+
singleton: cur.singleton,
|
|
678
|
+
requiredVersion: cur.requiredVersion,
|
|
679
|
+
hash: cur.hash,
|
|
680
|
+
assets: cur.assets
|
|
681
681
|
};
|
|
682
682
|
sum.push(shared);
|
|
683
683
|
return sum;
|
|
684
684
|
}, []);
|
|
685
|
-
manifest.remotes =
|
|
686
|
-
var statsRemote = manifest.remotes[cur];
|
|
685
|
+
manifest.remotes = stats.remotes.reduce(function(sum, cur) {
|
|
687
686
|
// @ts-ignore version/entry will be added as follow
|
|
688
687
|
var remote = {
|
|
689
|
-
federationContainerName:
|
|
690
|
-
moduleName:
|
|
691
|
-
alias:
|
|
688
|
+
federationContainerName: cur.federationContainerName,
|
|
689
|
+
moduleName: cur.moduleName,
|
|
690
|
+
alias: cur.alias
|
|
692
691
|
};
|
|
693
|
-
if ('entry' in
|
|
692
|
+
if ('entry' in cur) {
|
|
694
693
|
// @ts-ignore
|
|
695
|
-
remote.entry =
|
|
696
|
-
} else if ('version' in
|
|
694
|
+
remote.entry = cur.entry;
|
|
695
|
+
} else if ('version' in cur) {
|
|
697
696
|
// @ts-ignore
|
|
698
|
-
remote.entry =
|
|
697
|
+
remote.entry = cur.version;
|
|
699
698
|
}
|
|
700
699
|
sum.push(remote);
|
|
701
700
|
return sum;
|
|
@@ -722,12 +721,18 @@ var ManifestManager = /*#__PURE__*/ function() {
|
|
|
722
721
|
_this._manifest = ret || _this._manifest;
|
|
723
722
|
_state.label = 2;
|
|
724
723
|
case 2:
|
|
725
|
-
|
|
724
|
+
if (!disableEmit) {
|
|
725
|
+
compilation.emitAsset(manifestFileName, new compiler.webpack.sources.RawSource(JSON.stringify(_this._manifest, null, 2)));
|
|
726
|
+
}
|
|
726
727
|
if (isDev()) {
|
|
727
728
|
console.log(chalk(_templateObject$1(), PLUGIN_IDENTIFIER, publicPath === 'auto' ? '{auto}/' : publicPath, manifestFileName));
|
|
728
729
|
}
|
|
729
730
|
return [
|
|
730
|
-
2
|
|
731
|
+
2,
|
|
732
|
+
{
|
|
733
|
+
manifest: _this._manifest,
|
|
734
|
+
filename: manifestFileName
|
|
735
|
+
}
|
|
731
736
|
];
|
|
732
737
|
}
|
|
733
738
|
});
|
|
@@ -1477,7 +1482,7 @@ var StatsManager = /*#__PURE__*/ function() {
|
|
|
1477
1482
|
remoteEntry: {
|
|
1478
1483
|
name: getRemoteEntryName(),
|
|
1479
1484
|
path: '',
|
|
1480
|
-
// same as the types supported by runtime, currently only global/var/script is supported
|
|
1485
|
+
// same as the types supported by runtime, currently only global/var/script/cjs:webpack is supported
|
|
1481
1486
|
type: 'global'
|
|
1482
1487
|
},
|
|
1483
1488
|
types: getTypesMetaInfo(this._options, compiler.context),
|
|
@@ -1745,10 +1750,11 @@ var StatsManager = /*#__PURE__*/ function() {
|
|
|
1745
1750
|
},
|
|
1746
1751
|
{
|
|
1747
1752
|
key: "generateStats",
|
|
1748
|
-
value: function generateStats(compiler, compilation
|
|
1753
|
+
value: function generateStats(compiler, compilation) {
|
|
1754
|
+
var extraOptions = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1749
1755
|
var _this = this;
|
|
1750
1756
|
return _async_to_generator$1(function() {
|
|
1751
|
-
var existedStats, _this__options, tmp, manifestOptions, stats, ret, err;
|
|
1757
|
+
var disableEmit, existedStats, _this__options, tmp, manifestOptions, stats, ret, err;
|
|
1752
1758
|
return _ts_generator$1(this, function(_state) {
|
|
1753
1759
|
switch(_state.label){
|
|
1754
1760
|
case 0:
|
|
@@ -1758,11 +1764,15 @@ var StatsManager = /*#__PURE__*/ function() {
|
|
|
1758
1764
|
,
|
|
1759
1765
|
5
|
|
1760
1766
|
]);
|
|
1767
|
+
disableEmit = extraOptions.disableEmit;
|
|
1761
1768
|
existedStats = compilation.getAsset(_this.fileName);
|
|
1762
|
-
if (existedStats) {
|
|
1769
|
+
if (existedStats && !isDev()) {
|
|
1763
1770
|
return [
|
|
1764
1771
|
2,
|
|
1765
|
-
|
|
1772
|
+
{
|
|
1773
|
+
stats: JSON.parse(existedStats.source.source().toString()),
|
|
1774
|
+
filename: _this.fileName
|
|
1775
|
+
}
|
|
1766
1776
|
];
|
|
1767
1777
|
}
|
|
1768
1778
|
_this__options = _this._options, tmp = _this__options.manifest, manifestOptions = tmp === void 0 ? {} : tmp;
|
|
@@ -1791,10 +1801,15 @@ var StatsManager = /*#__PURE__*/ function() {
|
|
|
1791
1801
|
stats = ret || stats;
|
|
1792
1802
|
_state.label = 3;
|
|
1793
1803
|
case 3:
|
|
1794
|
-
|
|
1804
|
+
if (!disableEmit) {
|
|
1805
|
+
compilation.emitAsset(_this.fileName, new compiler.webpack.sources.RawSource(JSON.stringify(stats, null, 2)));
|
|
1806
|
+
}
|
|
1795
1807
|
return [
|
|
1796
1808
|
2,
|
|
1797
|
-
|
|
1809
|
+
{
|
|
1810
|
+
stats: stats,
|
|
1811
|
+
filename: _this.fileName
|
|
1812
|
+
}
|
|
1798
1813
|
];
|
|
1799
1814
|
case 4:
|
|
1800
1815
|
err = _state.sent();
|
|
@@ -1999,9 +2014,13 @@ var StatsPlugin = /*#__PURE__*/ function() {
|
|
|
1999
2014
|
_define_property(this, "_manifestManager", new ManifestManager());
|
|
2000
2015
|
_define_property(this, "_enable", true);
|
|
2001
2016
|
_define_property(this, "_bundler", 'webpack');
|
|
2017
|
+
_define_property(this, "statsInfo", void 0);
|
|
2018
|
+
_define_property(this, "manifestInfo", void 0);
|
|
2019
|
+
_define_property(this, "disableEmit", void 0);
|
|
2002
2020
|
try {
|
|
2003
2021
|
this._options = options;
|
|
2004
2022
|
this._bundler = bundler;
|
|
2023
|
+
this.disableEmit = Boolean(process.env['MF_DISABLE_EMIT_STATS']);
|
|
2005
2024
|
this._statsManager.init(this._options, {
|
|
2006
2025
|
pluginVersion: pluginVersion,
|
|
2007
2026
|
bundler: bundler
|
|
@@ -2034,30 +2053,38 @@ var StatsPlugin = /*#__PURE__*/ function() {
|
|
|
2034
2053
|
// @ts-ignore use runtime variable in case peer dep not installed
|
|
2035
2054
|
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
|
|
2036
2055
|
}, /*#__PURE__*/ _async_to_generator(function() {
|
|
2037
|
-
var stats;
|
|
2038
2056
|
return _ts_generator(this, function(_state) {
|
|
2039
2057
|
switch(_state.label){
|
|
2040
2058
|
case 0:
|
|
2041
2059
|
if (!(_this1._options.manifest !== false)) return [
|
|
2042
2060
|
3,
|
|
2043
|
-
|
|
2061
|
+
3
|
|
2044
2062
|
];
|
|
2045
2063
|
return [
|
|
2046
2064
|
4,
|
|
2047
|
-
_this1._statsManager.generateStats(compiler, compilation
|
|
2065
|
+
_this1._statsManager.generateStats(compiler, compilation, {
|
|
2066
|
+
disableEmit: _this1.disableEmit
|
|
2067
|
+
})
|
|
2048
2068
|
];
|
|
2049
2069
|
case 1:
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2070
|
+
_this1.statsInfo = _state.sent();
|
|
2071
|
+
return [
|
|
2072
|
+
4,
|
|
2073
|
+
_this1._manifestManager.generateManifest({
|
|
2074
|
+
compilation: compilation,
|
|
2075
|
+
stats: _this1.statsInfo.stats,
|
|
2076
|
+
publicPath: _this1._statsManager.getPublicPath(compiler),
|
|
2077
|
+
compiler: compiler,
|
|
2078
|
+
bundler: _this1._bundler,
|
|
2079
|
+
additionalData: typeof _this1._options.manifest === 'object' ? _this1._options.manifest.additionalData : undefined
|
|
2080
|
+
}, {
|
|
2081
|
+
disableEmit: _this1.disableEmit
|
|
2082
|
+
})
|
|
2083
|
+
];
|
|
2060
2084
|
case 2:
|
|
2085
|
+
_this1.manifestInfo = _state.sent();
|
|
2086
|
+
_state.label = 3;
|
|
2087
|
+
case 3:
|
|
2061
2088
|
return [
|
|
2062
2089
|
2
|
|
2063
2090
|
];
|
|
@@ -2066,6 +2093,15 @@ var StatsPlugin = /*#__PURE__*/ function() {
|
|
|
2066
2093
|
}));
|
|
2067
2094
|
});
|
|
2068
2095
|
}
|
|
2096
|
+
},
|
|
2097
|
+
{
|
|
2098
|
+
key: "resourceInfo",
|
|
2099
|
+
get: function get() {
|
|
2100
|
+
return {
|
|
2101
|
+
stats: this.statsInfo,
|
|
2102
|
+
manifest: this.manifestInfo
|
|
2103
|
+
};
|
|
2104
|
+
}
|
|
2069
2105
|
}
|
|
2070
2106
|
]);
|
|
2071
2107
|
return StatsPlugin;
|
package/dist/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Stats, Manifest, moduleFederationPlugin } from '@module-federation/sdk';
|
|
2
2
|
import type { Compilation, Compiler } from 'webpack';
|
|
3
|
+
import { ManifestInfo } from './types';
|
|
3
4
|
interface GenerateManifestOptions {
|
|
4
5
|
compilation: Compilation;
|
|
5
6
|
stats: Stats;
|
|
@@ -14,6 +15,8 @@ declare class ManifestManager {
|
|
|
14
15
|
get manifest(): Manifest | undefined;
|
|
15
16
|
init(options: moduleFederationPlugin.ModuleFederationPluginOptions): void;
|
|
16
17
|
get fileName(): string;
|
|
17
|
-
generateManifest(options: GenerateManifestOptions
|
|
18
|
+
generateManifest(options: GenerateManifestOptions, extraOptions?: {
|
|
19
|
+
disableEmit?: boolean;
|
|
20
|
+
}): Promise<ManifestInfo>;
|
|
18
21
|
}
|
|
19
22
|
export { ManifestManager };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { StatsBuildInfo,
|
|
1
|
+
import { StatsBuildInfo, moduleFederationPlugin } from '@module-federation/sdk';
|
|
2
2
|
import { Compilation, Compiler } from 'webpack';
|
|
3
|
+
import { StatsInfo } from './types';
|
|
3
4
|
declare class StatsManager {
|
|
4
5
|
private _options;
|
|
5
6
|
private _publicPath?;
|
|
@@ -21,7 +22,9 @@ declare class StatsManager {
|
|
|
21
22
|
pluginVersion: string;
|
|
22
23
|
bundler: 'webpack' | 'rspack';
|
|
23
24
|
}): void;
|
|
24
|
-
generateStats(compiler: Compiler, compilation: Compilation, extraOptions?: {
|
|
25
|
+
generateStats(compiler: Compiler, compilation: Compilation, extraOptions?: {
|
|
26
|
+
disableEmit?: boolean;
|
|
27
|
+
}): Promise<StatsInfo>;
|
|
25
28
|
validate(compiler: Compiler): boolean;
|
|
26
29
|
}
|
|
27
30
|
export { StatsManager };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Compiler, WebpackPluginInstance } from 'webpack';
|
|
2
2
|
import { moduleFederationPlugin } from '@module-federation/sdk';
|
|
3
|
+
import { StatsInfo, ManifestInfo, ResourceInfo } from './types';
|
|
3
4
|
export declare class StatsPlugin implements WebpackPluginInstance {
|
|
4
5
|
readonly name = "StatsPlugin";
|
|
5
6
|
private _options;
|
|
@@ -7,9 +8,13 @@ export declare class StatsPlugin implements WebpackPluginInstance {
|
|
|
7
8
|
private _manifestManager;
|
|
8
9
|
private _enable;
|
|
9
10
|
private _bundler;
|
|
11
|
+
statsInfo?: StatsInfo;
|
|
12
|
+
manifestInfo?: ManifestInfo;
|
|
13
|
+
disableEmit?: boolean;
|
|
10
14
|
constructor(options: moduleFederationPlugin.ModuleFederationPluginOptions, { pluginVersion, bundler, }: {
|
|
11
15
|
pluginVersion: string;
|
|
12
16
|
bundler: 'webpack' | 'rspack';
|
|
13
17
|
});
|
|
14
18
|
apply(compiler: Compiler): void;
|
|
19
|
+
get resourceInfo(): Partial<ResourceInfo>;
|
|
15
20
|
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Manifest, Stats } from '@module-federation/sdk';
|
|
2
|
+
export type StatsInfo = {
|
|
3
|
+
stats: Stats;
|
|
4
|
+
filename: string;
|
|
5
|
+
};
|
|
6
|
+
export type ManifestInfo = {
|
|
7
|
+
manifest: Manifest;
|
|
8
|
+
filename: string;
|
|
9
|
+
};
|
|
10
|
+
export type ResourceInfo = {
|
|
11
|
+
stats: StatsInfo;
|
|
12
|
+
manifest: ManifestInfo;
|
|
13
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/manifest",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20240529103203",
|
|
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.0.0-next-
|
|
28
|
-
"@module-federation/dts-plugin": "0.0.0-next-
|
|
29
|
-
"@module-federation/managers": "0.0.0-next-
|
|
27
|
+
"@module-federation/sdk": "0.0.0-next-20240529103203",
|
|
28
|
+
"@module-federation/dts-plugin": "0.0.0-next-20240529103203",
|
|
29
|
+
"@module-federation/managers": "0.0.0-next-20240529103203"
|
|
30
30
|
},
|
|
31
31
|
"exports": {
|
|
32
32
|
".": {
|