@module-federation/manifest 0.2.7 → 0.3.0
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 +82 -46
- package/dist/index.esm.js +82 -46
- 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
|
@@ -654,53 +654,52 @@ var ManifestManager = /*#__PURE__*/ function() {
|
|
|
654
654
|
{
|
|
655
655
|
key: "generateManifest",
|
|
656
656
|
value: function generateManifest(options) {
|
|
657
|
+
var extraOptions = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
657
658
|
var _this = this;
|
|
658
659
|
return _async_to_generator$2(function() {
|
|
659
|
-
var compilation, publicPath, stats, compiler, bundler, additionalData, manifest, manifestFileName, ret;
|
|
660
|
+
var compilation, publicPath, stats, compiler, bundler, additionalData, disableEmit, manifest, manifestFileName, ret;
|
|
660
661
|
return _ts_generator$2(this, function(_state) {
|
|
661
662
|
switch(_state.label){
|
|
662
663
|
case 0:
|
|
663
664
|
compilation = options.compilation, publicPath = options.publicPath, stats = options.stats, compiler = options.compiler, bundler = options.bundler, additionalData = options.additionalData;
|
|
665
|
+
disableEmit = extraOptions.disableEmit;
|
|
664
666
|
manifest = _object_spread$2({}, stats);
|
|
665
|
-
manifest.exposes =
|
|
666
|
-
var statsExpose = manifest.exposes[cur];
|
|
667
|
+
manifest.exposes = stats.exposes.reduce(function(sum, cur) {
|
|
667
668
|
var expose = {
|
|
668
|
-
id:
|
|
669
|
-
name:
|
|
670
|
-
assets:
|
|
671
|
-
path:
|
|
669
|
+
id: cur.id,
|
|
670
|
+
name: cur.name,
|
|
671
|
+
assets: cur.assets,
|
|
672
|
+
path: cur.path
|
|
672
673
|
};
|
|
673
674
|
sum.push(expose);
|
|
674
675
|
return sum;
|
|
675
676
|
}, []);
|
|
676
|
-
manifest.shared =
|
|
677
|
-
var statsShared = manifest.shared[cur];
|
|
677
|
+
manifest.shared = stats.shared.reduce(function(sum, cur) {
|
|
678
678
|
var shared = {
|
|
679
|
-
id:
|
|
680
|
-
name:
|
|
681
|
-
version:
|
|
682
|
-
singleton:
|
|
683
|
-
requiredVersion:
|
|
684
|
-
hash:
|
|
685
|
-
assets:
|
|
679
|
+
id: cur.id,
|
|
680
|
+
name: cur.name,
|
|
681
|
+
version: cur.version,
|
|
682
|
+
singleton: cur.singleton,
|
|
683
|
+
requiredVersion: cur.requiredVersion,
|
|
684
|
+
hash: cur.hash,
|
|
685
|
+
assets: cur.assets
|
|
686
686
|
};
|
|
687
687
|
sum.push(shared);
|
|
688
688
|
return sum;
|
|
689
689
|
}, []);
|
|
690
|
-
manifest.remotes =
|
|
691
|
-
var statsRemote = manifest.remotes[cur];
|
|
690
|
+
manifest.remotes = stats.remotes.reduce(function(sum, cur) {
|
|
692
691
|
// @ts-ignore version/entry will be added as follow
|
|
693
692
|
var remote = {
|
|
694
|
-
federationContainerName:
|
|
695
|
-
moduleName:
|
|
696
|
-
alias:
|
|
693
|
+
federationContainerName: cur.federationContainerName,
|
|
694
|
+
moduleName: cur.moduleName,
|
|
695
|
+
alias: cur.alias
|
|
697
696
|
};
|
|
698
|
-
if ('entry' in
|
|
697
|
+
if ('entry' in cur) {
|
|
699
698
|
// @ts-ignore
|
|
700
|
-
remote.entry =
|
|
701
|
-
} else if ('version' in
|
|
699
|
+
remote.entry = cur.entry;
|
|
700
|
+
} else if ('version' in cur) {
|
|
702
701
|
// @ts-ignore
|
|
703
|
-
remote.entry =
|
|
702
|
+
remote.entry = cur.version;
|
|
704
703
|
}
|
|
705
704
|
sum.push(remote);
|
|
706
705
|
return sum;
|
|
@@ -727,12 +726,18 @@ var ManifestManager = /*#__PURE__*/ function() {
|
|
|
727
726
|
_this._manifest = ret || _this._manifest;
|
|
728
727
|
_state.label = 2;
|
|
729
728
|
case 2:
|
|
730
|
-
|
|
729
|
+
if (!disableEmit) {
|
|
730
|
+
compilation.emitAsset(manifestFileName, new compiler.webpack.sources.RawSource(JSON.stringify(_this._manifest, null, 2)));
|
|
731
|
+
}
|
|
731
732
|
if (isDev()) {
|
|
732
733
|
console.log(chalk__default["default"](_templateObject$1(), PLUGIN_IDENTIFIER, publicPath === 'auto' ? '{auto}/' : publicPath, manifestFileName));
|
|
733
734
|
}
|
|
734
735
|
return [
|
|
735
|
-
2
|
|
736
|
+
2,
|
|
737
|
+
{
|
|
738
|
+
manifest: _this._manifest,
|
|
739
|
+
filename: manifestFileName
|
|
740
|
+
}
|
|
736
741
|
];
|
|
737
742
|
}
|
|
738
743
|
});
|
|
@@ -1782,10 +1787,11 @@ var StatsManager = /*#__PURE__*/ function() {
|
|
|
1782
1787
|
},
|
|
1783
1788
|
{
|
|
1784
1789
|
key: "generateStats",
|
|
1785
|
-
value: function generateStats(compiler, compilation
|
|
1790
|
+
value: function generateStats(compiler, compilation) {
|
|
1791
|
+
var extraOptions = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1786
1792
|
var _this = this;
|
|
1787
1793
|
return _async_to_generator$1(function() {
|
|
1788
|
-
var existedStats, _this__options, tmp, manifestOptions, stats, ret, err;
|
|
1794
|
+
var disableEmit, existedStats, _this__options, tmp, manifestOptions, stats, ret, err;
|
|
1789
1795
|
return _ts_generator$1(this, function(_state) {
|
|
1790
1796
|
switch(_state.label){
|
|
1791
1797
|
case 0:
|
|
@@ -1795,11 +1801,15 @@ var StatsManager = /*#__PURE__*/ function() {
|
|
|
1795
1801
|
,
|
|
1796
1802
|
5
|
|
1797
1803
|
]);
|
|
1804
|
+
disableEmit = extraOptions.disableEmit;
|
|
1798
1805
|
existedStats = compilation.getAsset(_this.fileName);
|
|
1799
|
-
if (existedStats) {
|
|
1806
|
+
if (existedStats && !isDev()) {
|
|
1800
1807
|
return [
|
|
1801
1808
|
2,
|
|
1802
|
-
|
|
1809
|
+
{
|
|
1810
|
+
stats: JSON.parse(existedStats.source.source().toString()),
|
|
1811
|
+
filename: _this.fileName
|
|
1812
|
+
}
|
|
1803
1813
|
];
|
|
1804
1814
|
}
|
|
1805
1815
|
_this__options = _this._options, tmp = _this__options.manifest, manifestOptions = tmp === void 0 ? {} : tmp;
|
|
@@ -1828,10 +1838,15 @@ var StatsManager = /*#__PURE__*/ function() {
|
|
|
1828
1838
|
stats = ret || stats;
|
|
1829
1839
|
_state.label = 3;
|
|
1830
1840
|
case 3:
|
|
1831
|
-
|
|
1841
|
+
if (!disableEmit) {
|
|
1842
|
+
compilation.emitAsset(_this.fileName, new compiler.webpack.sources.RawSource(JSON.stringify(stats, null, 2)));
|
|
1843
|
+
}
|
|
1832
1844
|
return [
|
|
1833
1845
|
2,
|
|
1834
|
-
|
|
1846
|
+
{
|
|
1847
|
+
stats: stats,
|
|
1848
|
+
filename: _this.fileName
|
|
1849
|
+
}
|
|
1835
1850
|
];
|
|
1836
1851
|
case 4:
|
|
1837
1852
|
err = _state.sent();
|
|
@@ -2040,9 +2055,13 @@ var StatsPlugin = /*#__PURE__*/ function() {
|
|
|
2040
2055
|
_define_property(this, "_manifestManager", new ManifestManager());
|
|
2041
2056
|
_define_property(this, "_enable", true);
|
|
2042
2057
|
_define_property(this, "_bundler", 'webpack');
|
|
2058
|
+
_define_property(this, "statsInfo", void 0);
|
|
2059
|
+
_define_property(this, "manifestInfo", void 0);
|
|
2060
|
+
_define_property(this, "disableEmit", void 0);
|
|
2043
2061
|
try {
|
|
2044
2062
|
this._options = options;
|
|
2045
2063
|
this._bundler = bundler;
|
|
2064
|
+
this.disableEmit = Boolean(process.env['MF_DISABLE_EMIT_STATS']);
|
|
2046
2065
|
this._statsManager.init(this._options, {
|
|
2047
2066
|
pluginVersion: pluginVersion,
|
|
2048
2067
|
bundler: bundler
|
|
@@ -2075,30 +2094,38 @@ var StatsPlugin = /*#__PURE__*/ function() {
|
|
|
2075
2094
|
// @ts-ignore use runtime variable in case peer dep not installed
|
|
2076
2095
|
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
|
|
2077
2096
|
}, /*#__PURE__*/ _async_to_generator(function() {
|
|
2078
|
-
var stats;
|
|
2079
2097
|
return _ts_generator(this, function(_state) {
|
|
2080
2098
|
switch(_state.label){
|
|
2081
2099
|
case 0:
|
|
2082
2100
|
if (!(_this1._options.manifest !== false)) return [
|
|
2083
2101
|
3,
|
|
2084
|
-
|
|
2102
|
+
3
|
|
2085
2103
|
];
|
|
2086
2104
|
return [
|
|
2087
2105
|
4,
|
|
2088
|
-
_this1._statsManager.generateStats(compiler, compilation
|
|
2106
|
+
_this1._statsManager.generateStats(compiler, compilation, {
|
|
2107
|
+
disableEmit: _this1.disableEmit
|
|
2108
|
+
})
|
|
2089
2109
|
];
|
|
2090
2110
|
case 1:
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2111
|
+
_this1.statsInfo = _state.sent();
|
|
2112
|
+
return [
|
|
2113
|
+
4,
|
|
2114
|
+
_this1._manifestManager.generateManifest({
|
|
2115
|
+
compilation: compilation,
|
|
2116
|
+
stats: _this1.statsInfo.stats,
|
|
2117
|
+
publicPath: _this1._statsManager.getPublicPath(compiler),
|
|
2118
|
+
compiler: compiler,
|
|
2119
|
+
bundler: _this1._bundler,
|
|
2120
|
+
additionalData: _type_of(_this1._options.manifest) === 'object' ? _this1._options.manifest.additionalData : undefined
|
|
2121
|
+
}, {
|
|
2122
|
+
disableEmit: _this1.disableEmit
|
|
2123
|
+
})
|
|
2124
|
+
];
|
|
2101
2125
|
case 2:
|
|
2126
|
+
_this1.manifestInfo = _state.sent();
|
|
2127
|
+
_state.label = 3;
|
|
2128
|
+
case 3:
|
|
2102
2129
|
return [
|
|
2103
2130
|
2
|
|
2104
2131
|
];
|
|
@@ -2107,6 +2134,15 @@ var StatsPlugin = /*#__PURE__*/ function() {
|
|
|
2107
2134
|
}));
|
|
2108
2135
|
});
|
|
2109
2136
|
}
|
|
2137
|
+
},
|
|
2138
|
+
{
|
|
2139
|
+
key: "resourceInfo",
|
|
2140
|
+
get: function get() {
|
|
2141
|
+
return {
|
|
2142
|
+
stats: this.statsInfo,
|
|
2143
|
+
manifest: this.manifestInfo
|
|
2144
|
+
};
|
|
2145
|
+
}
|
|
2110
2146
|
}
|
|
2111
2147
|
]);
|
|
2112
2148
|
return StatsPlugin;
|
package/dist/index.esm.js
CHANGED
|
@@ -645,53 +645,52 @@ var ManifestManager = /*#__PURE__*/ function() {
|
|
|
645
645
|
{
|
|
646
646
|
key: "generateManifest",
|
|
647
647
|
value: function generateManifest(options) {
|
|
648
|
+
var extraOptions = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
648
649
|
var _this = this;
|
|
649
650
|
return _async_to_generator$2(function() {
|
|
650
|
-
var compilation, publicPath, stats, compiler, bundler, additionalData, manifest, manifestFileName, ret;
|
|
651
|
+
var compilation, publicPath, stats, compiler, bundler, additionalData, disableEmit, manifest, manifestFileName, ret;
|
|
651
652
|
return _ts_generator$2(this, function(_state) {
|
|
652
653
|
switch(_state.label){
|
|
653
654
|
case 0:
|
|
654
655
|
compilation = options.compilation, publicPath = options.publicPath, stats = options.stats, compiler = options.compiler, bundler = options.bundler, additionalData = options.additionalData;
|
|
656
|
+
disableEmit = extraOptions.disableEmit;
|
|
655
657
|
manifest = _object_spread$2({}, stats);
|
|
656
|
-
manifest.exposes =
|
|
657
|
-
var statsExpose = manifest.exposes[cur];
|
|
658
|
+
manifest.exposes = stats.exposes.reduce(function(sum, cur) {
|
|
658
659
|
var expose = {
|
|
659
|
-
id:
|
|
660
|
-
name:
|
|
661
|
-
assets:
|
|
662
|
-
path:
|
|
660
|
+
id: cur.id,
|
|
661
|
+
name: cur.name,
|
|
662
|
+
assets: cur.assets,
|
|
663
|
+
path: cur.path
|
|
663
664
|
};
|
|
664
665
|
sum.push(expose);
|
|
665
666
|
return sum;
|
|
666
667
|
}, []);
|
|
667
|
-
manifest.shared =
|
|
668
|
-
var statsShared = manifest.shared[cur];
|
|
668
|
+
manifest.shared = stats.shared.reduce(function(sum, cur) {
|
|
669
669
|
var shared = {
|
|
670
|
-
id:
|
|
671
|
-
name:
|
|
672
|
-
version:
|
|
673
|
-
singleton:
|
|
674
|
-
requiredVersion:
|
|
675
|
-
hash:
|
|
676
|
-
assets:
|
|
670
|
+
id: cur.id,
|
|
671
|
+
name: cur.name,
|
|
672
|
+
version: cur.version,
|
|
673
|
+
singleton: cur.singleton,
|
|
674
|
+
requiredVersion: cur.requiredVersion,
|
|
675
|
+
hash: cur.hash,
|
|
676
|
+
assets: cur.assets
|
|
677
677
|
};
|
|
678
678
|
sum.push(shared);
|
|
679
679
|
return sum;
|
|
680
680
|
}, []);
|
|
681
|
-
manifest.remotes =
|
|
682
|
-
var statsRemote = manifest.remotes[cur];
|
|
681
|
+
manifest.remotes = stats.remotes.reduce(function(sum, cur) {
|
|
683
682
|
// @ts-ignore version/entry will be added as follow
|
|
684
683
|
var remote = {
|
|
685
|
-
federationContainerName:
|
|
686
|
-
moduleName:
|
|
687
|
-
alias:
|
|
684
|
+
federationContainerName: cur.federationContainerName,
|
|
685
|
+
moduleName: cur.moduleName,
|
|
686
|
+
alias: cur.alias
|
|
688
687
|
};
|
|
689
|
-
if ('entry' in
|
|
688
|
+
if ('entry' in cur) {
|
|
690
689
|
// @ts-ignore
|
|
691
|
-
remote.entry =
|
|
692
|
-
} else if ('version' in
|
|
690
|
+
remote.entry = cur.entry;
|
|
691
|
+
} else if ('version' in cur) {
|
|
693
692
|
// @ts-ignore
|
|
694
|
-
remote.entry =
|
|
693
|
+
remote.entry = cur.version;
|
|
695
694
|
}
|
|
696
695
|
sum.push(remote);
|
|
697
696
|
return sum;
|
|
@@ -718,12 +717,18 @@ var ManifestManager = /*#__PURE__*/ function() {
|
|
|
718
717
|
_this._manifest = ret || _this._manifest;
|
|
719
718
|
_state.label = 2;
|
|
720
719
|
case 2:
|
|
721
|
-
|
|
720
|
+
if (!disableEmit) {
|
|
721
|
+
compilation.emitAsset(manifestFileName, new compiler.webpack.sources.RawSource(JSON.stringify(_this._manifest, null, 2)));
|
|
722
|
+
}
|
|
722
723
|
if (isDev()) {
|
|
723
724
|
console.log(chalk(_templateObject$1(), PLUGIN_IDENTIFIER, publicPath === 'auto' ? '{auto}/' : publicPath, manifestFileName));
|
|
724
725
|
}
|
|
725
726
|
return [
|
|
726
|
-
2
|
|
727
|
+
2,
|
|
728
|
+
{
|
|
729
|
+
manifest: _this._manifest,
|
|
730
|
+
filename: manifestFileName
|
|
731
|
+
}
|
|
727
732
|
];
|
|
728
733
|
}
|
|
729
734
|
});
|
|
@@ -1773,10 +1778,11 @@ var StatsManager = /*#__PURE__*/ function() {
|
|
|
1773
1778
|
},
|
|
1774
1779
|
{
|
|
1775
1780
|
key: "generateStats",
|
|
1776
|
-
value: function generateStats(compiler, compilation
|
|
1781
|
+
value: function generateStats(compiler, compilation) {
|
|
1782
|
+
var extraOptions = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1777
1783
|
var _this = this;
|
|
1778
1784
|
return _async_to_generator$1(function() {
|
|
1779
|
-
var existedStats, _this__options, tmp, manifestOptions, stats, ret, err;
|
|
1785
|
+
var disableEmit, existedStats, _this__options, tmp, manifestOptions, stats, ret, err;
|
|
1780
1786
|
return _ts_generator$1(this, function(_state) {
|
|
1781
1787
|
switch(_state.label){
|
|
1782
1788
|
case 0:
|
|
@@ -1786,11 +1792,15 @@ var StatsManager = /*#__PURE__*/ function() {
|
|
|
1786
1792
|
,
|
|
1787
1793
|
5
|
|
1788
1794
|
]);
|
|
1795
|
+
disableEmit = extraOptions.disableEmit;
|
|
1789
1796
|
existedStats = compilation.getAsset(_this.fileName);
|
|
1790
|
-
if (existedStats) {
|
|
1797
|
+
if (existedStats && !isDev()) {
|
|
1791
1798
|
return [
|
|
1792
1799
|
2,
|
|
1793
|
-
|
|
1800
|
+
{
|
|
1801
|
+
stats: JSON.parse(existedStats.source.source().toString()),
|
|
1802
|
+
filename: _this.fileName
|
|
1803
|
+
}
|
|
1794
1804
|
];
|
|
1795
1805
|
}
|
|
1796
1806
|
_this__options = _this._options, tmp = _this__options.manifest, manifestOptions = tmp === void 0 ? {} : tmp;
|
|
@@ -1819,10 +1829,15 @@ var StatsManager = /*#__PURE__*/ function() {
|
|
|
1819
1829
|
stats = ret || stats;
|
|
1820
1830
|
_state.label = 3;
|
|
1821
1831
|
case 3:
|
|
1822
|
-
|
|
1832
|
+
if (!disableEmit) {
|
|
1833
|
+
compilation.emitAsset(_this.fileName, new compiler.webpack.sources.RawSource(JSON.stringify(stats, null, 2)));
|
|
1834
|
+
}
|
|
1823
1835
|
return [
|
|
1824
1836
|
2,
|
|
1825
|
-
|
|
1837
|
+
{
|
|
1838
|
+
stats: stats,
|
|
1839
|
+
filename: _this.fileName
|
|
1840
|
+
}
|
|
1826
1841
|
];
|
|
1827
1842
|
case 4:
|
|
1828
1843
|
err = _state.sent();
|
|
@@ -2031,9 +2046,13 @@ var StatsPlugin = /*#__PURE__*/ function() {
|
|
|
2031
2046
|
_define_property(this, "_manifestManager", new ManifestManager());
|
|
2032
2047
|
_define_property(this, "_enable", true);
|
|
2033
2048
|
_define_property(this, "_bundler", 'webpack');
|
|
2049
|
+
_define_property(this, "statsInfo", void 0);
|
|
2050
|
+
_define_property(this, "manifestInfo", void 0);
|
|
2051
|
+
_define_property(this, "disableEmit", void 0);
|
|
2034
2052
|
try {
|
|
2035
2053
|
this._options = options;
|
|
2036
2054
|
this._bundler = bundler;
|
|
2055
|
+
this.disableEmit = Boolean(process.env['MF_DISABLE_EMIT_STATS']);
|
|
2037
2056
|
this._statsManager.init(this._options, {
|
|
2038
2057
|
pluginVersion: pluginVersion,
|
|
2039
2058
|
bundler: bundler
|
|
@@ -2066,30 +2085,38 @@ var StatsPlugin = /*#__PURE__*/ function() {
|
|
|
2066
2085
|
// @ts-ignore use runtime variable in case peer dep not installed
|
|
2067
2086
|
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
|
|
2068
2087
|
}, /*#__PURE__*/ _async_to_generator(function() {
|
|
2069
|
-
var stats;
|
|
2070
2088
|
return _ts_generator(this, function(_state) {
|
|
2071
2089
|
switch(_state.label){
|
|
2072
2090
|
case 0:
|
|
2073
2091
|
if (!(_this1._options.manifest !== false)) return [
|
|
2074
2092
|
3,
|
|
2075
|
-
|
|
2093
|
+
3
|
|
2076
2094
|
];
|
|
2077
2095
|
return [
|
|
2078
2096
|
4,
|
|
2079
|
-
_this1._statsManager.generateStats(compiler, compilation
|
|
2097
|
+
_this1._statsManager.generateStats(compiler, compilation, {
|
|
2098
|
+
disableEmit: _this1.disableEmit
|
|
2099
|
+
})
|
|
2080
2100
|
];
|
|
2081
2101
|
case 1:
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2102
|
+
_this1.statsInfo = _state.sent();
|
|
2103
|
+
return [
|
|
2104
|
+
4,
|
|
2105
|
+
_this1._manifestManager.generateManifest({
|
|
2106
|
+
compilation: compilation,
|
|
2107
|
+
stats: _this1.statsInfo.stats,
|
|
2108
|
+
publicPath: _this1._statsManager.getPublicPath(compiler),
|
|
2109
|
+
compiler: compiler,
|
|
2110
|
+
bundler: _this1._bundler,
|
|
2111
|
+
additionalData: _type_of(_this1._options.manifest) === 'object' ? _this1._options.manifest.additionalData : undefined
|
|
2112
|
+
}, {
|
|
2113
|
+
disableEmit: _this1.disableEmit
|
|
2114
|
+
})
|
|
2115
|
+
];
|
|
2092
2116
|
case 2:
|
|
2117
|
+
_this1.manifestInfo = _state.sent();
|
|
2118
|
+
_state.label = 3;
|
|
2119
|
+
case 3:
|
|
2093
2120
|
return [
|
|
2094
2121
|
2
|
|
2095
2122
|
];
|
|
@@ -2098,6 +2125,15 @@ var StatsPlugin = /*#__PURE__*/ function() {
|
|
|
2098
2125
|
}));
|
|
2099
2126
|
});
|
|
2100
2127
|
}
|
|
2128
|
+
},
|
|
2129
|
+
{
|
|
2130
|
+
key: "resourceInfo",
|
|
2131
|
+
get: function get() {
|
|
2132
|
+
return {
|
|
2133
|
+
stats: this.statsInfo,
|
|
2134
|
+
manifest: this.manifestInfo
|
|
2135
|
+
};
|
|
2136
|
+
}
|
|
2101
2137
|
}
|
|
2102
2138
|
]);
|
|
2103
2139
|
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.
|
|
3
|
+
"version": "0.3.0",
|
|
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.
|
|
28
|
-
"@module-federation/dts-plugin": "0.
|
|
29
|
-
"@module-federation/managers": "0.
|
|
27
|
+
"@module-federation/sdk": "0.3.0",
|
|
28
|
+
"@module-federation/dts-plugin": "0.3.0",
|
|
29
|
+
"@module-federation/managers": "0.3.0"
|
|
30
30
|
},
|
|
31
31
|
"exports": {
|
|
32
32
|
".": {
|