@module-federation/managers 2.7.0 → 2.8.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/PKGJsonManager.js +3 -5
- package/dist/PKGJsonManager.mjs +2 -4
- package/dist/SharedManager.js +6 -5
- package/dist/SharedManager.mjs +5 -4
- package/dist/findPackageJson.d.mts +1 -0
- package/dist/findPackageJson.d.ts +1 -0
- package/dist/findPackageJson.js +91 -0
- package/dist/findPackageJson.mjs +23 -0
- package/package.json +2 -3
package/dist/PKGJsonManager.js
CHANGED
|
@@ -61,13 +61,13 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
61
61
|
;// CONCATENATED MODULE: external "path"
|
|
62
62
|
const external_path_namespaceObject = require("path");
|
|
63
63
|
var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_namespaceObject);
|
|
64
|
-
;// CONCATENATED MODULE: external "empathic/package"
|
|
65
|
-
const package_namespaceObject = require("empathic/package");
|
|
66
64
|
;// CONCATENATED MODULE: external "fs"
|
|
67
65
|
const external_fs_namespaceObject = require("fs");
|
|
68
66
|
var external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_namespaceObject);
|
|
69
67
|
;// CONCATENATED MODULE: external "@module-federation/sdk"
|
|
70
68
|
const sdk_namespaceObject = require("@module-federation/sdk");
|
|
69
|
+
;// CONCATENATED MODULE: external "./findPackageJson.js"
|
|
70
|
+
const external_findPackageJson_js_namespaceObject = require("./findPackageJson.js");
|
|
71
71
|
;// CONCATENATED MODULE: ./src/PKGJsonManager.ts
|
|
72
72
|
|
|
73
73
|
|
|
@@ -88,9 +88,7 @@ class PKGJsonManager {
|
|
|
88
88
|
return pkg;
|
|
89
89
|
} catch (_err) {
|
|
90
90
|
try {
|
|
91
|
-
const pkgPath = (0,
|
|
92
|
-
cwd: root
|
|
93
|
-
});
|
|
91
|
+
const pkgPath = (0,external_findPackageJson_js_namespaceObject.findPackageJson)(root);
|
|
94
92
|
if (!pkgPath) {
|
|
95
93
|
return {};
|
|
96
94
|
}
|
package/dist/PKGJsonManager.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { up } from "empathic/package";
|
|
3
2
|
import fs from "fs";
|
|
4
3
|
import { MFModuleType, logger } from "@module-federation/sdk";
|
|
4
|
+
import { findPackageJson } from "./findPackageJson.mjs";
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -26,9 +26,7 @@ class PKGJsonManager {
|
|
|
26
26
|
return pkg;
|
|
27
27
|
} catch (_err) {
|
|
28
28
|
try {
|
|
29
|
-
const pkgPath =
|
|
30
|
-
cwd: root
|
|
31
|
-
});
|
|
29
|
+
const pkgPath = findPackageJson(root);
|
|
32
30
|
if (!pkgPath) {
|
|
33
31
|
return {};
|
|
34
32
|
}
|
package/dist/SharedManager.js
CHANGED
|
@@ -58,8 +58,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
58
58
|
SharedManager: () => (/* binding */ SharedManager)
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
;// CONCATENATED MODULE: external "empathic/package"
|
|
62
|
-
const package_namespaceObject = require("empathic/package");
|
|
63
61
|
;// CONCATENATED MODULE: external "path"
|
|
64
62
|
const external_path_namespaceObject = require("path");
|
|
65
63
|
var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_namespaceObject);
|
|
@@ -72,6 +70,8 @@ const sdk_namespaceObject = require("@module-federation/sdk");
|
|
|
72
70
|
const external_BasicPluginOptionsManager_js_namespaceObject = require("./BasicPluginOptionsManager.js");
|
|
73
71
|
;// CONCATENATED MODULE: external "./utils.js"
|
|
74
72
|
const external_utils_js_namespaceObject = require("./utils.js");
|
|
73
|
+
;// CONCATENATED MODULE: external "./findPackageJson.js"
|
|
74
|
+
const external_findPackageJson_js_namespaceObject = require("./findPackageJson.js");
|
|
75
75
|
;// CONCATENATED MODULE: ./src/SharedManager.ts
|
|
76
76
|
|
|
77
77
|
|
|
@@ -123,9 +123,10 @@ class SharedManager extends external_BasicPluginOptionsManager_js_namespaceObjec
|
|
|
123
123
|
this.root
|
|
124
124
|
]
|
|
125
125
|
});
|
|
126
|
-
const pkgJsonPath = (0,
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
const pkgJsonPath = (0,external_findPackageJson_js_namespaceObject.findPackageJson)(external_path_default().dirname(pkgPath));
|
|
127
|
+
if (!pkgJsonPath) {
|
|
128
|
+
throw new Error(`Unable to find package.json for ${depName}`);
|
|
129
|
+
}
|
|
129
130
|
return {
|
|
130
131
|
pkg: JSON.parse(external_fs_default().readFileSync(pkgJsonPath, 'utf-8')),
|
|
131
132
|
path: '',
|
package/dist/SharedManager.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { up } from "empathic/package";
|
|
2
1
|
import path from "path";
|
|
3
2
|
import fs from "fs";
|
|
4
3
|
import { isRequiredVersion } from "@module-federation/sdk";
|
|
5
4
|
import { BasicPluginOptionsManager } from "./BasicPluginOptionsManager.mjs";
|
|
6
5
|
import { parseOptions } from "./utils.mjs";
|
|
6
|
+
import { findPackageJson } from "./findPackageJson.mjs";
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -61,9 +61,10 @@ class SharedManager extends BasicPluginOptionsManager {
|
|
|
61
61
|
this.root
|
|
62
62
|
]
|
|
63
63
|
});
|
|
64
|
-
const pkgJsonPath =
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
const pkgJsonPath = findPackageJson(path.dirname(pkgPath));
|
|
65
|
+
if (!pkgJsonPath) {
|
|
66
|
+
throw new Error(`Unable to find package.json for ${depName}`);
|
|
67
|
+
}
|
|
67
68
|
return {
|
|
68
69
|
pkg: JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8')),
|
|
69
70
|
path: '',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function findPackageJson(startPath: string): string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function findPackageJson(startPath: string): string | undefined;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
|
|
3
|
+
return typeof document === 'undefined'
|
|
4
|
+
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
|
|
5
|
+
: (document.currentScript && document.currentScript.src) ||
|
|
6
|
+
new URL('main.js', document.baseURI).href;
|
|
7
|
+
})();
|
|
8
|
+
;
|
|
9
|
+
// The require scope
|
|
10
|
+
var __webpack_require__ = {};
|
|
11
|
+
|
|
12
|
+
// webpack/runtime/compat_get_default_export
|
|
13
|
+
(() => {
|
|
14
|
+
// getDefaultExport function for compatibility with non-ESM modules
|
|
15
|
+
__webpack_require__.n = (module) => {
|
|
16
|
+
var getter = module && module.__esModule ?
|
|
17
|
+
() => (module['default']) :
|
|
18
|
+
() => (module);
|
|
19
|
+
__webpack_require__.d(getter, { a: getter });
|
|
20
|
+
return getter;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
})();
|
|
24
|
+
// webpack/runtime/define_property_getters
|
|
25
|
+
(() => {
|
|
26
|
+
__webpack_require__.d = (exports, getters, values) => {
|
|
27
|
+
var define = (defs, kind) => {
|
|
28
|
+
for(var key in defs) {
|
|
29
|
+
if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
|
|
30
|
+
Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
define(getters, "get");
|
|
35
|
+
define(values, "value");
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
// webpack/runtime/has_own_property
|
|
39
|
+
(() => {
|
|
40
|
+
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
41
|
+
})();
|
|
42
|
+
// webpack/runtime/make_namespace_object
|
|
43
|
+
(() => {
|
|
44
|
+
// define __esModule on exports
|
|
45
|
+
__webpack_require__.r = (exports) => {
|
|
46
|
+
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
47
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
48
|
+
}
|
|
49
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
50
|
+
};
|
|
51
|
+
})();
|
|
52
|
+
var __webpack_exports__ = {};
|
|
53
|
+
// ESM COMPAT FLAG
|
|
54
|
+
__webpack_require__.r(__webpack_exports__);
|
|
55
|
+
|
|
56
|
+
// EXPORTS
|
|
57
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
58
|
+
findPackageJson: () => (/* binding */ findPackageJson)
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
;// CONCATENATED MODULE: external "node:fs"
|
|
62
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
63
|
+
var external_node_fs_default = /*#__PURE__*/__webpack_require__.n(external_node_fs_namespaceObject);
|
|
64
|
+
;// CONCATENATED MODULE: external "node:path"
|
|
65
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
66
|
+
var external_node_path_default = /*#__PURE__*/__webpack_require__.n(external_node_path_namespaceObject);
|
|
67
|
+
;// CONCATENATED MODULE: ./src/findPackageJson.ts
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
function findPackageJson(startPath) {
|
|
71
|
+
let currentPath = external_node_path_default().resolve(startPath);
|
|
72
|
+
while(true){
|
|
73
|
+
const packageJsonPath = external_node_path_default().join(currentPath, 'package.json');
|
|
74
|
+
if (external_node_fs_default().existsSync(packageJsonPath)) {
|
|
75
|
+
return packageJsonPath;
|
|
76
|
+
}
|
|
77
|
+
const parentPath = external_node_path_default().dirname(currentPath);
|
|
78
|
+
if (parentPath === currentPath) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
currentPath = parentPath;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
exports.findPackageJson = __webpack_exports__.findPackageJson;
|
|
86
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
87
|
+
if(["findPackageJson"].indexOf(__rspack_i) === -1) {
|
|
88
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import node_fs from "node:fs";
|
|
2
|
+
import node_path from "node:path";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
function findPackageJson(startPath) {
|
|
9
|
+
let currentPath = node_path.resolve(startPath);
|
|
10
|
+
while(true){
|
|
11
|
+
const packageJsonPath = node_path.join(currentPath, 'package.json');
|
|
12
|
+
if (node_fs.existsSync(packageJsonPath)) {
|
|
13
|
+
return packageJsonPath;
|
|
14
|
+
}
|
|
15
|
+
const parentPath = node_path.dirname(currentPath);
|
|
16
|
+
if (parentPath === currentPath) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
currentPath = parentPath;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { findPackageJson };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/managers",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Provide managers for helping handle mf data .",
|
|
6
6
|
"keywords": [
|
|
@@ -25,8 +25,7 @@
|
|
|
25
25
|
"module": "./dist/index.mjs",
|
|
26
26
|
"types": "./dist/index.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"
|
|
29
|
-
"@module-federation/sdk": "2.7.0"
|
|
28
|
+
"@module-federation/sdk": "2.8.0"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
31
|
"webpack": "5.104.1"
|