@module-federation/managers 0.0.0-next-20241015065721 → 0.0.0-next-20241016071233

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
@@ -1,20 +1,11 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var path = require('path');
6
4
  var sdk = require('@module-federation/sdk');
7
5
  var finder = require('find-pkg');
8
6
  var fs = require('fs');
9
7
  var fs$1 = require('fs-extra');
10
8
 
11
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
-
13
- var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
14
- var finder__default = /*#__PURE__*/_interopDefaultLegacy(finder);
15
- var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
16
- var fs__default$1 = /*#__PURE__*/_interopDefaultLegacy(fs$1);
17
-
18
9
  class BasicPluginOptionsManager {
19
10
  get enable() {
20
11
  return Boolean(this._options);
@@ -40,12 +31,12 @@ class PKGJsonManager {
40
31
  }
41
32
  try {
42
33
  // eslint-disable-next-line no-restricted-globals
43
- const pkg = JSON.parse(fs__default["default"].readFileSync(path__default["default"].resolve(ctx, 'package.json'), 'utf8'));
34
+ const pkg = JSON.parse(fs.readFileSync(path.resolve(ctx, 'package.json'), 'utf8'));
44
35
  this._pkg = pkg;
45
36
  return pkg;
46
37
  } catch (_err) {
47
38
  try {
48
- const pkg = finder__default["default"].sync(ctx);
39
+ const pkg = finder.sync(ctx);
49
40
  this._pkg = pkg;
50
41
  return pkg;
51
42
  } catch (err) {
@@ -62,6 +53,7 @@ class PKGJsonManager {
62
53
  }
63
54
 
64
55
  const LOCAL_BUILD_VERSION = 'local';
56
+ const UNKNOWN_MODULE_NAME = 'UNKNOWN';
65
57
 
66
58
  function processFn(options, normalizeSimple, normalizeOptions, fn) {
67
59
  const object = (obj)=>{
@@ -117,22 +109,16 @@ function getBuildVersion() {
117
109
  function getBuildName() {
118
110
  return process.env['MF_BUILD_NAME'];
119
111
  }
120
- // RegExp for version string
121
- const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
122
- function isRequiredVersion(str) {
123
- return VERSION_PATTERN_REGEXP.test(str);
124
- }
125
112
 
126
113
  var utils = /*#__PURE__*/Object.freeze({
127
114
  __proto__: null,
128
- parseOptions: parseOptions,
129
- getBuildVersion: getBuildVersion,
130
115
  getBuildName: getBuildName,
131
- isRequiredVersion: isRequiredVersion
116
+ getBuildVersion: getBuildVersion,
117
+ parseOptions: parseOptions
132
118
  });
133
119
 
134
120
  function normalizeExposeModuleName(exposeKey) {
135
- const relativePath = path__default["default"].relative('.', exposeKey);
121
+ const relativePath = path.relative('.', exposeKey);
136
122
  if (!relativePath) {
137
123
  return 'ExposeEntry';
138
124
  }
@@ -199,7 +185,7 @@ let ContainerManager = class ContainerManager extends BasicPluginOptionsManager
199
185
  const [exposeKey, exposeObject] = item;
200
186
  sum[exposeKey] = [];
201
187
  exposeObject.import.forEach((item)=>{
202
- const relativePath = path__default["default"].relative('.', item.replace(path__default["default"].extname(item), ''));
188
+ const relativePath = path.relative('.', item.replace(path.extname(item), ''));
203
189
  sum[exposeKey].push(relativePath);
204
190
  });
205
191
  return sum;
@@ -299,7 +285,7 @@ let RemoteManager = class RemoteManager extends BasicPluginOptionsManager {
299
285
  curObj = {
300
286
  entry: normalizedOption.entry,
301
287
  alias: normalizedOption.alias,
302
- moduleName: normalizedOption.name,
288
+ moduleName: UNKNOWN_MODULE_NAME,
303
289
  federationContainerName: normalizedOption.name,
304
290
  consumingFederationContainerName: name,
305
291
  usedIn: []
@@ -307,7 +293,7 @@ let RemoteManager = class RemoteManager extends BasicPluginOptionsManager {
307
293
  } else {
308
294
  curObj = {
309
295
  alias: normalizedOption.alias,
310
- moduleName: normalizedOption.name,
296
+ moduleName: UNKNOWN_MODULE_NAME,
311
297
  version: normalizedOption.version,
312
298
  federationContainerName: normalizedOption.name,
313
299
  consumingFederationContainerName: name,
@@ -364,8 +350,7 @@ let RemoteManager = class RemoteManager extends BasicPluginOptionsManager {
364
350
  this.normalizeOptions(options.remotes);
365
351
  }
366
352
  constructor(...args){
367
- super(...args);
368
- this.normalizedOptions = {};
353
+ super(...args), this.normalizedOptions = {};
369
354
  }
370
355
  };
371
356
 
@@ -397,10 +382,10 @@ let SharedManager = class SharedManager extends BasicPluginOptionsManager {
397
382
  let pkgPath = '';
398
383
  let depName = name;
399
384
  if (shareConfig.import) {
400
- if (path__default["default"].isAbsolute(shareConfig.import)) {
385
+ if (path.isAbsolute(shareConfig.import)) {
401
386
  pkgPath = shareConfig.import;
402
387
  } else if (shareConfig.import.startsWith('.')) {
403
- pkgPath = path__default["default"].resolve(process.cwd(), shareConfig.import);
388
+ pkgPath = path.resolve(process.cwd(), shareConfig.import);
404
389
  }
405
390
  } else {
406
391
  if (shareConfig.packageName) {
@@ -412,9 +397,9 @@ let SharedManager = class SharedManager extends BasicPluginOptionsManager {
412
397
  process.cwd()
413
398
  ]
414
399
  });
415
- const pkgJsonPath = finder__default["default"].sync(pkgPath);
400
+ const pkgJsonPath = finder.sync(pkgPath);
416
401
  return {
417
- pkg: JSON.parse(fs__default$1["default"].readFileSync(pkgJsonPath, 'utf-8')),
402
+ pkg: JSON.parse(fs$1.readFileSync(pkgJsonPath, 'utf-8')),
418
403
  path: '',
419
404
  pkgPath: ''
420
405
  };
@@ -438,7 +423,7 @@ let SharedManager = class SharedManager extends BasicPluginOptionsManager {
438
423
  const normalizedShared = {};
439
424
  const sharedOptions = parseOptions(options, (item, key)=>{
440
425
  if (typeof item !== 'string') throw new Error('Unexpected array in shared');
441
- const config = item === key || !isRequiredVersion(item) ? {
426
+ const config = item === key || !sdk.isRequiredVersion(item) ? {
442
427
  import: item
443
428
  } : {
444
429
  import: key,
@@ -464,8 +449,7 @@ let SharedManager = class SharedManager extends BasicPluginOptionsManager {
464
449
  this.normalizeOptions(options.shared);
465
450
  }
466
451
  constructor(...args){
467
- super(...args);
468
- this.normalizedOptions = {};
452
+ super(...args), this.normalizedOptions = {};
469
453
  }
470
454
  };
471
455
 
@@ -0,0 +1 @@
1
+ export * from "./src/index";
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import path from 'path';
2
- import { MFModuleType, generateExposeFilename, composeKeyWithSeparator, parseEntry } from '@module-federation/sdk';
2
+ import { MFModuleType, generateExposeFilename, composeKeyWithSeparator, parseEntry, isRequiredVersion } from '@module-federation/sdk';
3
3
  import finder from 'find-pkg';
4
4
  import fs from 'fs';
5
5
  import fs$1 from 'fs-extra';
@@ -51,6 +51,7 @@ class PKGJsonManager {
51
51
  }
52
52
 
53
53
  const LOCAL_BUILD_VERSION = 'local';
54
+ const UNKNOWN_MODULE_NAME = 'UNKNOWN';
54
55
 
55
56
  function processFn(options, normalizeSimple, normalizeOptions, fn) {
56
57
  const object = (obj)=>{
@@ -106,18 +107,12 @@ function getBuildVersion() {
106
107
  function getBuildName() {
107
108
  return process.env['MF_BUILD_NAME'];
108
109
  }
109
- // RegExp for version string
110
- const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
111
- function isRequiredVersion(str) {
112
- return VERSION_PATTERN_REGEXP.test(str);
113
- }
114
110
 
115
111
  var utils = /*#__PURE__*/Object.freeze({
116
112
  __proto__: null,
117
- parseOptions: parseOptions,
118
- getBuildVersion: getBuildVersion,
119
113
  getBuildName: getBuildName,
120
- isRequiredVersion: isRequiredVersion
114
+ getBuildVersion: getBuildVersion,
115
+ parseOptions: parseOptions
121
116
  });
122
117
 
123
118
  function normalizeExposeModuleName(exposeKey) {
@@ -288,7 +283,7 @@ let RemoteManager = class RemoteManager extends BasicPluginOptionsManager {
288
283
  curObj = {
289
284
  entry: normalizedOption.entry,
290
285
  alias: normalizedOption.alias,
291
- moduleName: normalizedOption.name,
286
+ moduleName: UNKNOWN_MODULE_NAME,
292
287
  federationContainerName: normalizedOption.name,
293
288
  consumingFederationContainerName: name,
294
289
  usedIn: []
@@ -296,7 +291,7 @@ let RemoteManager = class RemoteManager extends BasicPluginOptionsManager {
296
291
  } else {
297
292
  curObj = {
298
293
  alias: normalizedOption.alias,
299
- moduleName: normalizedOption.name,
294
+ moduleName: UNKNOWN_MODULE_NAME,
300
295
  version: normalizedOption.version,
301
296
  federationContainerName: normalizedOption.name,
302
297
  consumingFederationContainerName: name,
@@ -353,8 +348,7 @@ let RemoteManager = class RemoteManager extends BasicPluginOptionsManager {
353
348
  this.normalizeOptions(options.remotes);
354
349
  }
355
350
  constructor(...args){
356
- super(...args);
357
- this.normalizedOptions = {};
351
+ super(...args), this.normalizedOptions = {};
358
352
  }
359
353
  };
360
354
 
@@ -453,8 +447,7 @@ let SharedManager = class SharedManager extends BasicPluginOptionsManager {
453
447
  this.normalizeOptions(options.shared);
454
448
  }
455
449
  constructor(...args){
456
- super(...args);
457
- this.normalizedOptions = {};
450
+ super(...args), this.normalizedOptions = {};
458
451
  }
459
452
  };
460
453
 
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/managers",
3
- "version": "0.6.6",
3
+ "version": "0.6.10",
4
4
  "license": "MIT",
5
5
  "description": "Provide managers for helping handle mf data .",
6
6
  "keywords": [
@@ -40,4 +40,4 @@
40
40
  ]
41
41
  }
42
42
  }
43
- }
43
+ }
@@ -1 +1,2 @@
1
1
  export declare const LOCAL_BUILD_VERSION = "local";
2
+ export declare const UNKNOWN_MODULE_NAME = "UNKNOWN";
@@ -2,4 +2,3 @@ import { ContainerOptionsFormat, NormalizeSimple, NormalizeOptions, ParsedContai
2
2
  export declare function parseOptions<T, R>(options: ContainerOptionsFormat<T>, normalizeSimple: NormalizeSimple<R>, normalizeOptions: NormalizeOptions<T, R>): ParsedContainerOptions<R>;
3
3
  export declare function getBuildVersion(): string;
4
4
  export declare function getBuildName(): string | undefined;
5
- export declare function isRequiredVersion(str: string): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/managers",
3
- "version": "0.0.0-next-20241015065721",
3
+ "version": "0.0.0-next-20241016071233",
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-20241015065721"
24
+ "@module-federation/sdk": "0.0.0-next-20241016071233"
25
25
  },
26
26
  "devDependencies": {
27
27
  "webpack": "5.93.0"