@module-federation/manifest 0.0.0-next-20240511031741 → 0.0.0-next-20240515062211

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
@@ -13,8 +13,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
13
13
  var chalk__default = /*#__PURE__*/_interopDefaultLegacy(chalk);
14
14
  var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
15
15
 
16
- var PLUGIN_IDENTIFIER = "Module Federation Manifest Plugin";
17
- var HOT_UPDATE_SUFFIX = ".hot-update";
16
+ var PLUGIN_IDENTIFIER = 'Module Federation Manifest Plugin';
17
+ var HOT_UPDATE_SUFFIX = '.hot-update';
18
18
 
19
19
  function _array_like_to_array$2(arr, len) {
20
20
  if (len == null || len > arr.length) len = arr.length;
@@ -148,8 +148,8 @@ function _templateObject$2() {
148
148
  return data;
149
149
  }
150
150
  function getSharedModuleName(name) {
151
- 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
- return sharedInfo.split("@").slice(0, -1).join("@");
151
+ 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
+ return sharedInfo.split('@').slice(0, -1).join('@');
153
153
  }
154
154
  function getAssetsByChunkIDs(compilation, chunkIDMap) {
155
155
  var arrayChunks = Array.from(compilation.chunks);
@@ -168,10 +168,10 @@ function getAssetsByChunkIDs(compilation, chunkIDMap) {
168
168
  });
169
169
  if (chunk) {
170
170
  _to_consumable_array(chunk.files).forEach(function(asset) {
171
- if (asset.endsWith(".css")) {
171
+ if (asset.endsWith('.css')) {
172
172
  assetMap[key].css.add(asset);
173
173
  } else {
174
- if (process.env["NODE_ENV"] === "development") {
174
+ if (process.env['NODE_ENV'] === 'development') {
175
175
  if (!asset.includes(HOT_UPDATE_SUFFIX)) {
176
176
  assetMap[key].js.add(asset);
177
177
  }
@@ -327,7 +327,7 @@ function getAssetsByChunk(chunk) {
327
327
  var collectChunkFiles = function(targetChunk, type) {
328
328
  _to_consumable_array(targetChunk.groupsIterable).forEach(function(chunkGroup) {
329
329
  chunkGroup.getFiles().forEach(function(file) {
330
- if (file.endsWith(".css")) {
330
+ if (file.endsWith('.css')) {
331
331
  assesSet.css[type].add(file);
332
332
  } else {
333
333
  assesSet.js[type].add(file);
@@ -335,16 +335,16 @@ function getAssetsByChunk(chunk) {
335
335
  });
336
336
  });
337
337
  };
338
- collectChunkFiles(chunk, "sync");
338
+ collectChunkFiles(chunk, 'sync');
339
339
  _to_consumable_array(chunk.getAllAsyncChunks()).forEach(function(asyncChunk) {
340
340
  asyncChunk.files.forEach(function(file) {
341
- if (file.endsWith(".css")) {
341
+ if (file.endsWith('.css')) {
342
342
  assesSet.css.async.add(file);
343
343
  } else {
344
344
  assesSet.js.async.add(file);
345
345
  }
346
346
  });
347
- collectChunkFiles(asyncChunk, "async");
347
+ collectChunkFiles(asyncChunk, 'async');
348
348
  });
349
349
  var assets = {
350
350
  js: {
@@ -367,10 +367,10 @@ function error(msg) {
367
367
  throw new Error("[ ".concat(PLUGIN_IDENTIFIER, " ]: ").concat(msg));
368
368
  }
369
369
  function isDev() {
370
- return process.env["NODE_ENV"] === "development";
370
+ return process.env['NODE_ENV'] === 'development';
371
371
  }
372
372
  function getFileNameWithOutExt(str) {
373
- return str.replace(path__default["default"].extname(str), "");
373
+ return str.replace(path__default["default"].extname(str), '');
374
374
  }
375
375
  function getFileName(manifestOptions) {
376
376
  if (!manifestOptions) {
@@ -379,9 +379,9 @@ function getFileName(manifestOptions) {
379
379
  manifestFileName: sdk.ManifestFileName
380
380
  };
381
381
  }
382
- var filePath = typeof manifestOptions === "boolean" ? "" : manifestOptions.filePath || "";
383
- var fileName = typeof manifestOptions === "boolean" ? "" : manifestOptions.fileName || "";
384
- var JSON_EXT = ".json";
382
+ var filePath = typeof manifestOptions === 'boolean' ? '' : manifestOptions.filePath || '';
383
+ var fileName = typeof manifestOptions === 'boolean' ? '' : manifestOptions.fileName || '';
384
+ var JSON_EXT = '.json';
385
385
  var addExt = function(name) {
386
386
  if (name.endsWith(JSON_EXT)) {
387
387
  return name;
@@ -392,7 +392,7 @@ function getFileName(manifestOptions) {
392
392
  return name.replace(JSON_EXT, "".concat(suffix).concat(JSON_EXT));
393
393
  };
394
394
  var manifestFileName = fileName ? addExt(fileName) : sdk.ManifestFileName;
395
- var statsFileName = fileName ? insertSuffix(manifestFileName, "-stats") : sdk.StatsFileName;
395
+ var statsFileName = fileName ? insertSuffix(manifestFileName, '-stats') : sdk.StatsFileName;
396
396
  return {
397
397
  statsFileName: sdk.simpleJoinRemoteEntry(filePath, statsFileName),
398
398
  manifestFileName: sdk.simpleJoinRemoteEntry(filePath, manifestFileName)
@@ -404,20 +404,20 @@ function getTypesMetaInfo(pluginOptions, context) {
404
404
  compileInChildProcess: true
405
405
  };
406
406
  var defaultTypesMetaInfo = {
407
- path: "",
408
- name: "",
409
- zip: "",
410
- api: ""
407
+ path: '',
408
+ name: '',
409
+ zip: '',
410
+ api: ''
411
411
  };
412
412
  try {
413
413
  var normalizedDtsOptions = sdk.normalizeOptions(core.isTSProject(pluginOptions.dts, context), {
414
414
  generateTypes: defaultRemoteOptions,
415
415
  consumeTypes: {}
416
- }, "mfOptions.dts")(pluginOptions.dts);
416
+ }, 'mfOptions.dts')(pluginOptions.dts);
417
417
  if (normalizedDtsOptions === false) {
418
418
  return defaultTypesMetaInfo;
419
419
  }
420
- var normalizedRemote = sdk.normalizeOptions(true, defaultRemoteOptions, "mfOptions.dts.generateTypes")(normalizedDtsOptions.generateTypes);
420
+ var normalizedRemote = sdk.normalizeOptions(true, defaultRemoteOptions, 'mfOptions.dts.generateTypes')(normalizedDtsOptions.generateTypes);
421
421
  if (normalizedRemote === false) {
422
422
  return defaultTypesMetaInfo;
423
423
  }
@@ -426,8 +426,8 @@ function getTypesMetaInfo(pluginOptions, context) {
426
426
  moduleFederationConfig: pluginOptions
427
427
  })), apiFileName = _retrieveTypesAssetsInfo.apiFileName, zipName = _retrieveTypesAssetsInfo.zipName;
428
428
  return {
429
- path: "",
430
- name: "",
429
+ path: '',
430
+ name: '',
431
431
  zip: zipName,
432
432
  api: apiFileName
433
433
  };
@@ -658,13 +658,15 @@ 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
671
  manifest.exposes = Object.keys(stats.exposes).reduce(function(sum, cur) {
670
672
  var statsExpose = manifest.exposes[cur];
@@ -699,10 +701,10 @@ var ManifestManager = /*#__PURE__*/ function() {
699
701
  moduleName: statsRemote.moduleName,
700
702
  alias: statsRemote.alias
701
703
  };
702
- if ("entry" in statsRemote) {
704
+ if ('entry' in statsRemote) {
703
705
  // @ts-ignore
704
706
  remote.entry = statsRemote.entry;
705
- } else if ("version" in statsRemote) {
707
+ } else if ('version' in statsRemote) {
706
708
  // @ts-ignore
707
709
  remote.entry = statsRemote.version;
708
710
  }
@@ -731,12 +733,18 @@ var ManifestManager = /*#__PURE__*/ function() {
731
733
  _this._manifest = ret || _this._manifest;
732
734
  _state.label = 2;
733
735
  case 2:
734
- compilation.emitAsset(manifestFileName, new compiler.webpack.sources.RawSource(JSON.stringify(_this._manifest, null, 2)));
736
+ if (!disableEmit) {
737
+ compilation.emitAsset(manifestFileName, new compiler.webpack.sources.RawSource(JSON.stringify(_this._manifest, null, 2)));
738
+ }
735
739
  if (isDev()) {
736
- console.log(chalk__default["default"](_templateObject$1(), PLUGIN_IDENTIFIER, publicPath === "auto" ? "{auto}/" : publicPath, manifestFileName));
740
+ console.log(chalk__default["default"](_templateObject$1(), PLUGIN_IDENTIFIER, publicPath === 'auto' ? '{auto}/' : publicPath, manifestFileName));
737
741
  }
738
742
  return [
739
- 2
743
+ 2,
744
+ {
745
+ manifest: _this._manifest,
746
+ filename: manifestFileName
747
+ }
740
748
  ];
741
749
  }
742
750
  });
@@ -869,7 +877,7 @@ var ModuleHandler = /*#__PURE__*/ function() {
869
877
  var bundler = param.bundler;
870
878
  _class_call_check$2(this, ModuleHandler);
871
879
  _define_property$2(this, "_options", void 0);
872
- _define_property$2(this, "_bundler", "webpack");
880
+ _define_property$2(this, "_bundler", 'webpack');
873
881
  _define_property$2(this, "_modules", void 0);
874
882
  _define_property$2(this, "_remoteManager", new managers.RemoteManager());
875
883
  _define_property$2(this, "_sharedManager", new managers.SharedManager());
@@ -885,7 +893,7 @@ var ModuleHandler = /*#__PURE__*/ function() {
885
893
  {
886
894
  key: "isRspack",
887
895
  get: function get() {
888
- return this._bundler === "rspack";
896
+ return this._bundler === 'rspack';
889
897
  }
890
898
  },
891
899
  {
@@ -948,27 +956,27 @@ var ModuleHandler = /*#__PURE__*/ function() {
948
956
  }
949
957
  };
950
958
  var parseResolvedIdentifier = function(nameAndVersion) {
951
- var name = "";
952
- var version = "";
953
- if (nameAndVersion.startsWith("@")) {
954
- var splitInfo = nameAndVersion.split("@");
955
- splitInfo[0] = "@";
959
+ var name = '';
960
+ var version = '';
961
+ if (nameAndVersion.startsWith('@')) {
962
+ var splitInfo = nameAndVersion.split('@');
963
+ splitInfo[0] = '@';
956
964
  name = splitInfo[0] + splitInfo[1];
957
965
  version = splitInfo[2];
958
- } else if (nameAndVersion.includes("@")) {
966
+ } else if (nameAndVersion.includes('@')) {
959
967
  var ref;
960
- ref = _sliced_to_array$1(nameAndVersion.split("@"), 2), name = ref[0], version = ref[1];
961
- version = version.replace(/[\^~>|>=]/g, "");
968
+ ref = _sliced_to_array$1(nameAndVersion.split('@'), 2), name = ref[0], version = ref[1];
969
+ version = version.replace(/[\^~>|>=]/g, '');
962
970
  }
963
971
  return {
964
972
  name: name,
965
973
  version: version
966
974
  };
967
975
  };
968
- if (moduleType === "provide-module") {
976
+ if (moduleType === 'provide-module') {
969
977
  // identifier(rspack) = provide shared module (default) react@18.2.0 = /temp/node_modules/.pnpm/react@18.2.0/node_modules/react/index.js
970
978
  // identifier(webpack) = provide module (default) react@18.2.0 = /temp/node_modules/.pnpm/react@18.2.0/node_modules/react/index.js
971
- var data = identifier.split(" ");
979
+ var data = identifier.split(' ');
972
980
  var nameAndVersion = this.isRspack ? data[4] : data[3];
973
981
  var _parseResolvedIdentifier = parseResolvedIdentifier(nameAndVersion), name = _parseResolvedIdentifier.name, version = _parseResolvedIdentifier.version;
974
982
  if (name && version) {
@@ -976,13 +984,13 @@ var ModuleHandler = /*#__PURE__*/ function() {
976
984
  collectRelationshipMap(mod, name);
977
985
  }
978
986
  }
979
- if (moduleType === "consume-shared-module") {
987
+ if (moduleType === 'consume-shared-module') {
980
988
  // identifier(rspack) = consume shared module (default) lodash/get@^4.17.21 (strict) (fallback: /temp/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js)
981
989
  // identifier(webpack) = consume-shared-module|default|react-dom|!=1.8...2...0|false|/temp/node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/index.js|true|false
982
- var SEPARATOR = this.isRspack ? " " : "|";
990
+ var SEPARATOR = this.isRspack ? ' ' : '|';
983
991
  var data1 = identifier.split(SEPARATOR);
984
- var pkgName = "";
985
- var pkgVersion = "";
992
+ var pkgName = '';
993
+ var pkgVersion = '';
986
994
  if (this.isRspack) {
987
995
  var nameAndVersion1 = data1[4];
988
996
  var res = parseResolvedIdentifier(nameAndVersion1);
@@ -991,14 +999,14 @@ var ModuleHandler = /*#__PURE__*/ function() {
991
999
  } else {
992
1000
  pkgName = data1[2];
993
1001
  var pkgVersionRange = data1[3];
994
- pkgVersion = "";
995
- if (pkgVersionRange.startsWith("=")) {
996
- pkgVersion = data1[3].replace("=", "");
1002
+ pkgVersion = '';
1003
+ if (pkgVersionRange.startsWith('=')) {
1004
+ pkgVersion = data1[3].replace('=', '');
997
1005
  } else {
998
1006
  if (sharedManagerNormalizedOptions[pkgName]) {
999
1007
  pkgVersion = sharedManagerNormalizedOptions[pkgName].version;
1000
1008
  } else {
1001
- var fullPkgName = pkgName.split("/").slice(0, -1).join("/");
1009
+ var fullPkgName = pkgName.split('/').slice(0, -1).join('/');
1002
1010
  // pkgName: react-dom/
1003
1011
  if (sharedManagerNormalizedOptions["".concat(fullPkgName, "/")]) {
1004
1012
  if (sharedManagerNormalizedOptions[fullPkgName]) {
@@ -1027,14 +1035,14 @@ var ModuleHandler = /*#__PURE__*/ function() {
1027
1035
  }
1028
1036
  var remoteManagerNormalizedOptions = this._remoteManager.normalizedOptions;
1029
1037
  // identifier = remote (default) webpack/container/reference/app2 ./Button
1030
- var data = identifier.split(" ");
1038
+ var data = identifier.split(' ');
1031
1039
  if (data.length === 4) {
1032
- var moduleName = data[3].replace("./", "");
1033
- var remoteAlias = data[2].replace("webpack/container/reference/", "");
1040
+ var moduleName = data[3].replace('./', '');
1041
+ var remoteAlias = data[2].replace('webpack/container/reference/', '');
1034
1042
  var normalizedRemote = remoteManagerNormalizedOptions[remoteAlias];
1035
1043
  var basicRemote = {
1036
1044
  alias: normalizedRemote.alias,
1037
- consumingFederationContainerName: this._options.name || "",
1045
+ consumingFederationContainerName: this._options.name || '',
1038
1046
  federationContainerName: remoteManagerNormalizedOptions[remoteAlias].name,
1039
1047
  moduleName: moduleName,
1040
1048
  // @ts-ignore to deduplicate
@@ -1044,7 +1052,7 @@ var ModuleHandler = /*#__PURE__*/ function() {
1044
1052
  return;
1045
1053
  }
1046
1054
  var remote;
1047
- if ("version" in normalizedRemote) {
1055
+ if ('version' in normalizedRemote) {
1048
1056
  remote = _object_spread_props$1(_object_spread$1({}, basicRemote), {
1049
1057
  version: normalizedRemote.version
1050
1058
  });
@@ -1062,7 +1070,7 @@ var ModuleHandler = /*#__PURE__*/ function() {
1062
1070
  var exposeModName = _this.isRspack ? moduleName : resolvedModule;
1063
1071
  if (userRequest && exposeModName && remotesConsumerMap[userRequest]) {
1064
1072
  // @ts-ignore to deduplicate
1065
- remotesConsumerMap[userRequest].usedIn.add(exposeModName.replace("./", ""));
1073
+ remotesConsumerMap[userRequest].usedIn.add(exposeModName.replace('./', ''));
1066
1074
  }
1067
1075
  });
1068
1076
  }
@@ -1077,10 +1085,10 @@ var ModuleHandler = /*#__PURE__*/ function() {
1077
1085
  return;
1078
1086
  }
1079
1087
  // identifier: container entry (default) [[".",{"import":["./src/routes/page.tsx"],"name":"__federation_expose_default_export"}]]'
1080
- var data = identifier.split(" ");
1088
+ var data = identifier.split(' ');
1081
1089
  JSON.parse(data[3]).forEach(function(param) {
1082
1090
  var _param = _sliced_to_array$1(param, 2), prefixedName = _param[0], file = _param[1];
1083
- var exposeModuleName = prefixedName.replace("./", "");
1091
+ var exposeModuleName = prefixedName.replace('./', '');
1084
1092
  // TODO: support multiple import
1085
1093
  exposesMap[getFileNameWithOutExt(file.import[0])] = {
1086
1094
  path: prefixedName,
@@ -1113,17 +1121,17 @@ var ModuleHandler = /*#__PURE__*/ function() {
1113
1121
  var sharedMap = {};
1114
1122
  var isSharedModule = function(moduleType) {
1115
1123
  return Boolean(moduleType && [
1116
- "provide-module",
1117
- "consume-shared-module"
1124
+ 'provide-module',
1125
+ 'consume-shared-module'
1118
1126
  ].includes(moduleType));
1119
1127
  };
1120
1128
  var isContainerModule = function(identifier) {
1121
- var data = identifier.split(" ");
1122
- return Boolean(data[0] === "container" && data[1] === "entry");
1129
+ var data = identifier.split(' ');
1130
+ return Boolean(data[0] === 'container' && data[1] === 'entry');
1123
1131
  };
1124
1132
  var isRemoteModule = function(identifier) {
1125
- var data = identifier.split(" ");
1126
- return data[0] === "remote";
1133
+ var data = identifier.split(' ');
1134
+ return data[0] === 'remote';
1127
1135
  };
1128
1136
  // handle remote/expose
1129
1137
  this._modules.forEach(function(mod) {
@@ -1430,7 +1438,7 @@ var StatsManager = /*#__PURE__*/ function() {
1430
1438
  _define_property$1(this, "_options", {});
1431
1439
  _define_property$1(this, "_publicPath", void 0);
1432
1440
  _define_property$1(this, "_pluginVersion", void 0);
1433
- _define_property$1(this, "_bundler", "webpack");
1441
+ _define_property$1(this, "_bundler", 'webpack');
1434
1442
  _define_property$1(this, "_containerManager", new managers.ContainerManager());
1435
1443
  _define_property$1(this, "_remoteManager", new managers.RemoteManager());
1436
1444
  _define_property$1(this, "_sharedManager", new managers.SharedManager());
@@ -1443,7 +1451,7 @@ var StatsManager = /*#__PURE__*/ function() {
1443
1451
  var pkg = this._pkgJsonManager.readPKGJson(process.cwd());
1444
1452
  return {
1445
1453
  buildVersion: managers.utils.getBuildVersion(),
1446
- buildName: managers.utils.getBuildName() || pkg["name"]
1454
+ buildName: managers.utils.getBuildName() || pkg['name']
1447
1455
  };
1448
1456
  }
1449
1457
  },
@@ -1462,32 +1470,32 @@ var StatsManager = /*#__PURE__*/ function() {
1462
1470
  var type = this._pkgJsonManager.getExposeGarfishModuleType(context || process.cwd());
1463
1471
  var getRemoteEntryName = function() {
1464
1472
  if (!_this._containerManager.enable) {
1465
- return "";
1473
+ return '';
1466
1474
  }
1467
- assert(name, "name is required");
1475
+ assert(name, 'name is required');
1468
1476
  var remoteEntryPoint = compilation.entrypoints.get(name);
1469
- assert(remoteEntryPoint, "Can not get remoteEntry entryPoint!");
1477
+ assert(remoteEntryPoint, 'Can not get remoteEntry entryPoint!');
1470
1478
  var remoteEntryNameChunk = compilation.namedChunks.get(name);
1471
- assert(remoteEntryNameChunk, "Can not get remoteEntry chunk!");
1479
+ assert(remoteEntryNameChunk, 'Can not get remoteEntry chunk!');
1472
1480
  var files = Array.from(remoteEntryNameChunk.files).filter(function(f) {
1473
- return !f.includes(HOT_UPDATE_SUFFIX);
1481
+ return !f.includes(HOT_UPDATE_SUFFIX) && !f.endsWith('.css');
1474
1482
  });
1475
- assert(files.length === 1, "remoteEntry chunk should not have multiple files!, current files: ".concat(files.join(",")));
1483
+ assert(files.length === 1, "remoteEntry chunk should not have multiple files!, current files: ".concat(files.join(',')));
1476
1484
  var remoteEntryName = files[0];
1477
1485
  return remoteEntryName;
1478
1486
  };
1479
1487
  var globalName = this._containerManager.globalEntryName;
1480
1488
  assert(globalName, 'Can not get library.name, please ensure you have set library.name and the type is "string" !');
1481
- assert(this._pluginVersion, "Can not get pluginVersion, please ensure you have set pluginVersion !");
1489
+ assert(this._pluginVersion, 'Can not get pluginVersion, please ensure you have set pluginVersion !');
1482
1490
  var metaData = {
1483
1491
  name: name,
1484
1492
  type: type,
1485
1493
  buildInfo: buildInfo,
1486
1494
  remoteEntry: {
1487
1495
  name: getRemoteEntryName(),
1488
- path: "",
1489
- // same as the types supported by runtime, currently only global/var/script is supported
1490
- type: "global"
1496
+ path: '',
1497
+ // same as the types supported by runtime, currently only global/var/script/cjs:webpack is supported
1498
+ type: 'global'
1491
1499
  },
1492
1500
  types: getTypesMetaInfo(this._options, compiler.context),
1493
1501
  globalName: globalName,
@@ -1506,10 +1514,10 @@ var StatsManager = /*#__PURE__*/ function() {
1506
1514
  return false;
1507
1515
  }
1508
1516
  var array = [
1509
- module.name.includes("container entry"),
1510
- module.name.includes("remote "),
1511
- module.name.includes("shared module "),
1512
- module.name.includes("provide module ")
1517
+ module.name.includes('container entry'),
1518
+ module.name.includes('remote '),
1519
+ module.name.includes('shared module '),
1520
+ module.name.includes('provide module ')
1513
1521
  ];
1514
1522
  return array.some(function(item) {
1515
1523
  return item;
@@ -1525,7 +1533,7 @@ var StatsManager = /*#__PURE__*/ function() {
1525
1533
  var exposeFileNameImportMap = this._containerManager.exposeFileNameImportMap;
1526
1534
  var assets = {};
1527
1535
  chunks.forEach(function(chunk) {
1528
- if (typeof chunk.name === "string" && exposeFileNameImportMap[chunk.name]) {
1536
+ if (typeof chunk.name === 'string' && exposeFileNameImportMap[chunk.name]) {
1529
1537
  // TODO: support multiple import
1530
1538
  var exposeKey = exposeFileNameImportMap[chunk.name][0];
1531
1539
  assets[getFileNameWithOutExt(exposeKey)] = getAssetsByChunk(chunk);
@@ -1542,7 +1550,7 @@ var StatsManager = /*#__PURE__*/ function() {
1542
1550
  return false;
1543
1551
  }
1544
1552
  var array = [
1545
- module.name.includes("consume shared module ")
1553
+ module.name.includes('consume shared module ')
1546
1554
  ];
1547
1555
  return array.some(function(item) {
1548
1556
  return item;
@@ -1621,7 +1629,7 @@ var StatsManager = /*#__PURE__*/ function() {
1621
1629
  remotes: [],
1622
1630
  exposes: []
1623
1631
  };
1624
- if (typeof manifestOptions === "object" && manifestOptions.disableAssetsAnalyze) {
1632
+ if (typeof manifestOptions === 'object' && manifestOptions.disableAssetsAnalyze) {
1625
1633
  remotes = _this._remoteManager.statsRemoteWithEmptyUsedIn;
1626
1634
  stats.remotes = remotes;
1627
1635
  return [
@@ -1642,9 +1650,9 @@ var StatsManager = /*#__PURE__*/ function() {
1642
1650
  chunks: false,
1643
1651
  reasons: true
1644
1652
  };
1645
- if (_this._bundler === "webpack") {
1646
- statsOptions["cached"] = true;
1647
- statsOptions["cachedModules"] = true;
1653
+ if (_this._bundler === 'webpack') {
1654
+ statsOptions['cached'] = true;
1655
+ statsOptions['cachedModules'] = true;
1648
1656
  }
1649
1657
  webpackStats = liveStats.toJson(statsOptions);
1650
1658
  filteredModules = _this._getFilteredModules(webpackStats);
@@ -1754,10 +1762,11 @@ var StatsManager = /*#__PURE__*/ function() {
1754
1762
  },
1755
1763
  {
1756
1764
  key: "generateStats",
1757
- value: function generateStats(compiler, compilation, extraOptions) {
1765
+ value: function generateStats(compiler, compilation) {
1766
+ var extraOptions = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1758
1767
  var _this = this;
1759
1768
  return _async_to_generator$1(function() {
1760
- var existedStats, _this__options, tmp, manifestOptions, stats, ret, err;
1769
+ var disableEmit, existedStats, _this__options, tmp, manifestOptions, stats, ret, err;
1761
1770
  return _ts_generator$1(this, function(_state) {
1762
1771
  switch(_state.label){
1763
1772
  case 0:
@@ -1767,6 +1776,7 @@ var StatsManager = /*#__PURE__*/ function() {
1767
1776
  ,
1768
1777
  5
1769
1778
  ]);
1779
+ disableEmit = extraOptions.disableEmit;
1770
1780
  existedStats = compilation.getAsset(_this.fileName);
1771
1781
  if (existedStats) {
1772
1782
  return [
@@ -1781,7 +1791,7 @@ var StatsManager = /*#__PURE__*/ function() {
1781
1791
  ];
1782
1792
  case 1:
1783
1793
  stats = _state.sent();
1784
- if (!(typeof manifestOptions === "object" && manifestOptions.additionalData)) return [
1794
+ if (!(typeof manifestOptions === 'object' && manifestOptions.additionalData)) return [
1785
1795
  3,
1786
1796
  3
1787
1797
  ];
@@ -1800,10 +1810,15 @@ var StatsManager = /*#__PURE__*/ function() {
1800
1810
  stats = ret || stats;
1801
1811
  _state.label = 3;
1802
1812
  case 3:
1803
- compilation.emitAsset(_this.fileName, new compiler.webpack.sources.RawSource(JSON.stringify(stats, null, 2)));
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
- stats
1818
+ {
1819
+ stats: stats,
1820
+ filename: _this.fileName
1821
+ }
1807
1822
  ];
1808
1823
  case 4:
1809
1824
  err = _state.sent();
@@ -1821,10 +1836,10 @@ var StatsManager = /*#__PURE__*/ function() {
1821
1836
  key: "validate",
1822
1837
  value: function validate(compiler) {
1823
1838
  var _compiler_options = compiler.options, publicPath = _compiler_options.output.publicPath;
1824
- if (typeof publicPath !== "string") {
1839
+ if (typeof publicPath !== 'string') {
1825
1840
  console.warn(chalk__default["default"](_templateObject(), PLUGIN_IDENTIFIER, publicPath));
1826
1841
  return false;
1827
- } else if (publicPath === "auto") {
1842
+ } else if (publicPath === 'auto') {
1828
1843
  console.warn(chalk__default["default"](_templateObject1(), PLUGIN_IDENTIFIER, publicPath));
1829
1844
  return true;
1830
1845
  }
@@ -2002,15 +2017,19 @@ var StatsPlugin = /*#__PURE__*/ function() {
2002
2017
  function StatsPlugin(options, param) {
2003
2018
  var pluginVersion = param.pluginVersion, bundler = param.bundler;
2004
2019
  _class_call_check(this, StatsPlugin);
2005
- _define_property(this, "name", "StatsPlugin");
2020
+ _define_property(this, "name", 'StatsPlugin');
2006
2021
  _define_property(this, "_options", {});
2007
2022
  _define_property(this, "_statsManager", new StatsManager());
2008
2023
  _define_property(this, "_manifestManager", new ManifestManager());
2009
2024
  _define_property(this, "_enable", true);
2010
- _define_property(this, "_bundler", "webpack");
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
@@ -2036,37 +2055,45 @@ var StatsPlugin = /*#__PURE__*/ function() {
2036
2055
  if (!res) {
2037
2056
  return;
2038
2057
  }
2039
- compiler.hooks.thisCompilation.tap("generateStats", function(compilation) {
2058
+ compiler.hooks.thisCompilation.tap('generateStats', function(compilation) {
2040
2059
  var _this1 = _this;
2041
2060
  compilation.hooks.processAssets.tapPromise({
2042
- name: "generateStats",
2061
+ name: 'generateStats',
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
- 2
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
- 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;
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;