@module-federation/managers 0.0.0-next-20240227082542 → 0.0.0-next-20240227135200

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
@@ -395,6 +395,7 @@ var ContainerManager = /*#__PURE__*/ function(BasicPluginOptionsManager) {
395
395
  var _this;
396
396
  _this = _super.apply(this, arguments);
397
397
  _define_property$3(_assert_this_initialized$2(_this), "_manifestModuleInfos", void 0);
398
+ _define_property$3(_assert_this_initialized$2(_this), "_parsedOptions", void 0);
398
399
  return _this;
399
400
  }
400
401
  _create_class$3(ContainerManager, [
@@ -476,13 +477,10 @@ var ContainerManager = /*#__PURE__*/ function(BasicPluginOptionsManager) {
476
477
  get: // { '.' : './src/Button.jsx' } => { '.' : ['src/Button'] }
477
478
  function get() {
478
479
  var parsedOptions = this._parseOptions();
479
- return Object.keys(parsedOptions).reduce(function(sum, exposeKey) {
480
- var parsedOption = parsedOptions[exposeKey];
480
+ return parsedOptions.reduce(function(sum, item) {
481
+ var _item = _sliced_to_array$1(item, 2), exposeKey = _item[0], exposeObject = _item[1];
481
482
  sum[exposeKey] = [];
482
- var importArr = Array.isArray(parsedOption.import) ? parsedOption.import : [
483
- parsedOption.import
484
- ];
485
- importArr.forEach(function(item) {
483
+ exposeObject.import.forEach(function(item) {
486
484
  var relativePath = path__default["default"].relative(".", item.replace(path__default["default"].extname(item), ""));
487
485
  sum[exposeKey].push(relativePath);
488
486
  });
@@ -495,13 +493,10 @@ var ContainerManager = /*#__PURE__*/ function(BasicPluginOptionsManager) {
495
493
  get: // { '.' : './src/Button.jsx' } => ['./src/Button.jsx']
496
494
  function get() {
497
495
  var parsedOptions = this._parseOptions();
498
- return Object.keys(parsedOptions).reduce(function(sum, exposeKey) {
496
+ return parsedOptions.reduce(function(sum, item) {
499
497
  var _sum;
500
- var parsedOption = parsedOptions[exposeKey];
501
- var importArr = Array.isArray(parsedOption.import) ? parsedOption.import : [
502
- parsedOption.import
503
- ];
504
- (_sum = sum).push.apply(_sum, _to_consumable_array(importArr));
498
+ var _item = _sliced_to_array$1(item, 2); _item[0]; var exposeObject = _item[1];
499
+ (_sum = sum).push.apply(_sum, _to_consumable_array(exposeObject.import));
505
500
  return sum;
506
501
  }, []);
507
502
  }
@@ -514,13 +509,11 @@ var ContainerManager = /*#__PURE__*/ function(BasicPluginOptionsManager) {
514
509
  }
515
510
  // { '.' : './src/Button.jsx' } => { '.' : { name: 'ExposeEntry', file: './src/Button.jsx', requires: {} } }
516
511
  var parsedOptions = this._parseOptions();
517
- this._manifestModuleInfos = Object.keys(parsedOptions).reduce(function(sum, exposeKey) {
518
- var parsedOption = parsedOptions[exposeKey];
512
+ this._manifestModuleInfos = parsedOptions.reduce(function(sum, item) {
513
+ var _item = _sliced_to_array$1(item, 2), exposeKey = _item[0], exposeObject = _item[1];
519
514
  sum[exposeKey] = {
520
- name: parsedOption.name || normalizeExposeModuleName(exposeKey),
521
- file: Array.isArray(parsedOption.import) ? parsedOption.import : [
522
- parsedOption.import
523
- ]
515
+ name: exposeObject.name || normalizeExposeModuleName(exposeKey),
516
+ file: exposeObject.import
524
517
  };
525
518
  return sum;
526
519
  }, {});
@@ -541,17 +534,25 @@ var ContainerManager = /*#__PURE__*/ function(BasicPluginOptionsManager) {
541
534
  {
542
535
  key: "_parseOptions",
543
536
  value: function _parseOptions() {
544
- return parseOptions(this.options.exposes, function(item) {
537
+ if (this._parsedOptions) {
538
+ return this._parsedOptions;
539
+ }
540
+ this._parsedOptions = parseOptions(this.options.exposes, function(item) {
545
541
  return {
546
- import: item,
542
+ import: Array.isArray(item) ? item : [
543
+ item
544
+ ],
547
545
  name: undefined
548
546
  };
549
547
  }, function(item) {
550
548
  return {
551
- import: item.import,
549
+ import: Array.isArray(item.import) ? item.import : [
550
+ item.import
551
+ ],
552
552
  name: undefined
553
553
  };
554
554
  });
555
+ return this._parsedOptions;
555
556
  }
556
557
  },
557
558
  {
package/dist/index.esm.js CHANGED
@@ -384,6 +384,7 @@ var ContainerManager = /*#__PURE__*/ function(BasicPluginOptionsManager) {
384
384
  var _this;
385
385
  _this = _super.apply(this, arguments);
386
386
  _define_property$3(_assert_this_initialized$2(_this), "_manifestModuleInfos", void 0);
387
+ _define_property$3(_assert_this_initialized$2(_this), "_parsedOptions", void 0);
387
388
  return _this;
388
389
  }
389
390
  _create_class$3(ContainerManager, [
@@ -465,13 +466,10 @@ var ContainerManager = /*#__PURE__*/ function(BasicPluginOptionsManager) {
465
466
  get: // { '.' : './src/Button.jsx' } => { '.' : ['src/Button'] }
466
467
  function get() {
467
468
  var parsedOptions = this._parseOptions();
468
- return Object.keys(parsedOptions).reduce(function(sum, exposeKey) {
469
- var parsedOption = parsedOptions[exposeKey];
469
+ return parsedOptions.reduce(function(sum, item) {
470
+ var _item = _sliced_to_array$1(item, 2), exposeKey = _item[0], exposeObject = _item[1];
470
471
  sum[exposeKey] = [];
471
- var importArr = Array.isArray(parsedOption.import) ? parsedOption.import : [
472
- parsedOption.import
473
- ];
474
- importArr.forEach(function(item) {
472
+ exposeObject.import.forEach(function(item) {
475
473
  var relativePath = path.relative(".", item.replace(path.extname(item), ""));
476
474
  sum[exposeKey].push(relativePath);
477
475
  });
@@ -484,13 +482,10 @@ var ContainerManager = /*#__PURE__*/ function(BasicPluginOptionsManager) {
484
482
  get: // { '.' : './src/Button.jsx' } => ['./src/Button.jsx']
485
483
  function get() {
486
484
  var parsedOptions = this._parseOptions();
487
- return Object.keys(parsedOptions).reduce(function(sum, exposeKey) {
485
+ return parsedOptions.reduce(function(sum, item) {
488
486
  var _sum;
489
- var parsedOption = parsedOptions[exposeKey];
490
- var importArr = Array.isArray(parsedOption.import) ? parsedOption.import : [
491
- parsedOption.import
492
- ];
493
- (_sum = sum).push.apply(_sum, _to_consumable_array(importArr));
487
+ var _item = _sliced_to_array$1(item, 2); _item[0]; var exposeObject = _item[1];
488
+ (_sum = sum).push.apply(_sum, _to_consumable_array(exposeObject.import));
494
489
  return sum;
495
490
  }, []);
496
491
  }
@@ -503,13 +498,11 @@ var ContainerManager = /*#__PURE__*/ function(BasicPluginOptionsManager) {
503
498
  }
504
499
  // { '.' : './src/Button.jsx' } => { '.' : { name: 'ExposeEntry', file: './src/Button.jsx', requires: {} } }
505
500
  var parsedOptions = this._parseOptions();
506
- this._manifestModuleInfos = Object.keys(parsedOptions).reduce(function(sum, exposeKey) {
507
- var parsedOption = parsedOptions[exposeKey];
501
+ this._manifestModuleInfos = parsedOptions.reduce(function(sum, item) {
502
+ var _item = _sliced_to_array$1(item, 2), exposeKey = _item[0], exposeObject = _item[1];
508
503
  sum[exposeKey] = {
509
- name: parsedOption.name || normalizeExposeModuleName(exposeKey),
510
- file: Array.isArray(parsedOption.import) ? parsedOption.import : [
511
- parsedOption.import
512
- ]
504
+ name: exposeObject.name || normalizeExposeModuleName(exposeKey),
505
+ file: exposeObject.import
513
506
  };
514
507
  return sum;
515
508
  }, {});
@@ -530,17 +523,25 @@ var ContainerManager = /*#__PURE__*/ function(BasicPluginOptionsManager) {
530
523
  {
531
524
  key: "_parseOptions",
532
525
  value: function _parseOptions() {
533
- return parseOptions(this.options.exposes, function(item) {
526
+ if (this._parsedOptions) {
527
+ return this._parsedOptions;
528
+ }
529
+ this._parsedOptions = parseOptions(this.options.exposes, function(item) {
534
530
  return {
535
- import: item,
531
+ import: Array.isArray(item) ? item : [
532
+ item
533
+ ],
536
534
  name: undefined
537
535
  };
538
536
  }, function(item) {
539
537
  return {
540
- import: item.import,
538
+ import: Array.isArray(item.import) ? item.import : [
539
+ item.import
540
+ ],
541
541
  name: undefined
542
542
  };
543
543
  });
544
+ return this._parsedOptions;
544
545
  }
545
546
  },
546
547
  {
@@ -3,6 +3,7 @@ import type { EntryObject } from 'webpack';
3
3
  import { BasicPluginOptionsManager } from './BasicPluginOptionsManager';
4
4
  declare class ContainerManager extends BasicPluginOptionsManager<moduleFederationPlugin.ModuleFederationPluginOptions> {
5
5
  private _manifestModuleInfos?;
6
+ private _parsedOptions?;
6
7
  get enable(): boolean;
7
8
  get globalEntryName(): string | undefined;
8
9
  get containerPluginExposesOptions(): containerPlugin.ContainerPluginOptions['exposes'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/managers",
3
- "version": "0.0.0-next-20240227082542",
3
+ "version": "0.0.0-next-20240227135200",
4
4
  "license": "MIT",
5
5
  "description": "Provide managers for helping handle mf data .",
6
6
  "keywords": [
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "find-pkg": "2.0.0",
23
23
  "fs-extra": "9.1.0",
24
- "@module-federation/sdk": "0.0.0-next-20240227082542"
24
+ "@module-federation/sdk": "0.0.0-next-20240227135200"
25
25
  },
26
26
  "devDependencies": {
27
27
  "webpack": "5.75.0"