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