@module-federation/metro 2.6.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/babel-plugin/patch-initialize-core.js +3 -3
- package/babel-plugin/patch-require.js +3 -3
- package/dist/commands/bundle-host/index.js +12 -8
- package/dist/commands/bundle-host/index.mjs +3 -4
- package/dist/commands/bundle-host/options.js +12 -8
- package/dist/commands/bundle-host/options.mjs +2 -3
- package/dist/commands/bundle-host/types.js +2 -2
- package/dist/commands/bundle-host/types.mjs +1 -2
- package/dist/commands/bundle-remote/index.js +12 -8
- package/dist/commands/bundle-remote/index.mjs +6 -6
- package/dist/commands/bundle-remote/options.js +15 -11
- package/dist/commands/bundle-remote/options.mjs +4 -5
- package/dist/commands/bundle-remote/types.js +2 -2
- package/dist/commands/bundle-remote/types.mjs +1 -2
- package/dist/commands/index.js +14 -10
- package/dist/commands/index.mjs +3 -3
- package/dist/commands/types.js +2 -2
- package/dist/commands/types.mjs +1 -2
- package/dist/commands/utils/create-module-path-remapper.js +15 -11
- package/dist/commands/utils/create-module-path-remapper.mjs +1 -2
- package/dist/commands/utils/create-resolver.js +15 -11
- package/dist/commands/utils/create-resolver.mjs +1 -2
- package/dist/commands/utils/get-community-plugin.js +12 -8
- package/dist/commands/utils/get-community-plugin.mjs +2 -2
- package/dist/commands/utils/load-metro-config.js +15 -14
- package/dist/commands/utils/load-metro-config.mjs +9 -11
- package/dist/commands/utils/path-utils.js +12 -8
- package/dist/commands/utils/path-utils.mjs +1 -2
- package/dist/commands/utils/save-bundle-and-map.js +12 -8
- package/dist/commands/utils/save-bundle-and-map.mjs +1 -2
- package/dist/index.js +14 -10
- package/dist/index.mjs +3 -5
- package/dist/logger.js +12 -8
- package/dist/logger.mjs +2 -3
- package/dist/modules/asyncRequire.ts +2 -2
- package/dist/plugin/babel-transformer.js +12 -8
- package/dist/plugin/babel-transformer.mjs +2 -2
- package/dist/plugin/constants.js +24 -20
- package/dist/plugin/constants.mjs +1 -2
- package/dist/plugin/generators.js +16 -12
- package/dist/plugin/generators.mjs +2 -2
- package/dist/plugin/helpers.js +21 -19
- package/dist/plugin/helpers.mjs +5 -8
- package/dist/plugin/index.js +13 -9
- package/dist/plugin/index.mjs +3 -3
- package/dist/plugin/manifest-middleware.js +12 -8
- package/dist/plugin/manifest-middleware.mjs +1 -2
- package/dist/plugin/manifest.js +19 -16
- package/dist/plugin/manifest.mjs +5 -7
- package/dist/plugin/normalize-extra-options.js +16 -12
- package/dist/plugin/normalize-extra-options.mjs +2 -3
- package/dist/plugin/normalize-options.js +13 -12
- package/dist/plugin/normalize-options.mjs +3 -6
- package/dist/plugin/resolver.js +13 -9
- package/dist/plugin/resolver.mjs +6 -7
- package/dist/plugin/rewrite-request.js +15 -11
- package/dist/plugin/rewrite-request.mjs +4 -5
- package/dist/plugin/serializer.js +14 -17
- package/dist/plugin/serializer.mjs +3 -11
- package/dist/plugin/validate-options.js +12 -8
- package/dist/plugin/validate-options.mjs +1 -2
- package/dist/types.js +2 -2
- package/dist/types.mjs +1 -2
- package/dist/utils/errors.js +16 -12
- package/dist/utils/errors.mjs +1 -2
- package/dist/utils/federated-remote-types.js +103 -122
- package/dist/utils/federated-remote-types.mjs +2 -3
- package/dist/utils/index.js +14 -10
- package/dist/utils/index.mjs +3 -5
- package/dist/utils/metro-compat.js +19 -15
- package/dist/utils/metro-compat.mjs +2 -2
- package/dist/utils/vm-manager.js +14 -12
- package/dist/utils/vm-manager.mjs +3 -6
- package/package.json +10 -10
|
@@ -10,11 +10,15 @@ var __webpack_require__ = {};
|
|
|
10
10
|
};
|
|
11
11
|
})();
|
|
12
12
|
(()=>{
|
|
13
|
-
__webpack_require__.d = (exports1,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
18
22
|
};
|
|
19
23
|
})();
|
|
20
24
|
(()=>{
|
|
@@ -22,7 +26,7 @@ var __webpack_require__ = {};
|
|
|
22
26
|
})();
|
|
23
27
|
(()=>{
|
|
24
28
|
__webpack_require__.r = (exports1)=>{
|
|
25
|
-
if (
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
30
|
value: 'Module'
|
|
27
31
|
});
|
|
28
32
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -147,21 +151,14 @@ function isProjectSource(entryPoint, projectRoot) {
|
|
|
147
151
|
function getBundlePath(entryPoint, projectRoot, exposes, isUsingMFBundleCommand) {
|
|
148
152
|
const relativeEntryPath = external_node_path_default().relative(projectRoot, entryPoint);
|
|
149
153
|
const normalizedRelativeEntryPath = normalizeEntryPath(relativeEntryPath);
|
|
150
|
-
if (!isUsingMFBundleCommand)
|
|
151
|
-
const { dir, name } = external_node_path_default().parse(relativeEntryPath);
|
|
152
|
-
return external_node_path_default().format({
|
|
153
|
-
dir,
|
|
154
|
-
name,
|
|
155
|
-
ext: ''
|
|
156
|
-
});
|
|
157
|
-
}
|
|
154
|
+
if (!isUsingMFBundleCommand) return removePathExtension(normalizedRelativeEntryPath);
|
|
158
155
|
const exposeEntries = Object.entries(exposes).map(([exposeKey, exposePath])=>({
|
|
159
156
|
exposeKey,
|
|
160
157
|
normalizedExposePath: normalizeEntryPath(exposePath)
|
|
161
158
|
}));
|
|
162
159
|
const exactMatch = exposeEntries.find(({ normalizedExposePath })=>normalizedExposePath === normalizedRelativeEntryPath);
|
|
163
160
|
const extensionlessMatch = exposeEntries.find(({ normalizedExposePath })=>removePathExtension(normalizedExposePath) === removePathExtension(normalizedRelativeEntryPath));
|
|
164
|
-
const exposedMatchedKey =
|
|
161
|
+
const exposedMatchedKey = exactMatch?.exposeKey ?? extensionlessMatch?.exposeKey;
|
|
165
162
|
if (exposedMatchedKey) {
|
|
166
163
|
let exposedName = exposedMatchedKey;
|
|
167
164
|
if (exposedName.startsWith('./')) exposedName = exposedName.slice(2);
|
|
@@ -186,9 +183,9 @@ function getBundleCode(entryPoint, preModules, graph, options) {
|
|
|
186
183
|
return code;
|
|
187
184
|
}
|
|
188
185
|
exports.getModuleFederationSerializer = __webpack_exports__.getModuleFederationSerializer;
|
|
189
|
-
for(var
|
|
186
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
190
187
|
"getModuleFederationSerializer"
|
|
191
|
-
].indexOf(
|
|
188
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
192
189
|
Object.defineProperty(exports, '__esModule', {
|
|
193
190
|
value: true
|
|
194
191
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
1
|
+
import "node:module";
|
|
3
2
|
import node_path from "node:path";
|
|
4
3
|
import { ConfigError } from "../utils/errors.mjs";
|
|
5
4
|
import { toPosixPath } from "./helpers.mjs";
|
|
@@ -111,21 +110,14 @@ function isProjectSource(entryPoint, projectRoot) {
|
|
|
111
110
|
function getBundlePath(entryPoint, projectRoot, exposes, isUsingMFBundleCommand) {
|
|
112
111
|
const relativeEntryPath = node_path.relative(projectRoot, entryPoint);
|
|
113
112
|
const normalizedRelativeEntryPath = normalizeEntryPath(relativeEntryPath);
|
|
114
|
-
if (!isUsingMFBundleCommand)
|
|
115
|
-
const { dir, name } = node_path.parse(relativeEntryPath);
|
|
116
|
-
return node_path.format({
|
|
117
|
-
dir,
|
|
118
|
-
name,
|
|
119
|
-
ext: ''
|
|
120
|
-
});
|
|
121
|
-
}
|
|
113
|
+
if (!isUsingMFBundleCommand) return removePathExtension(normalizedRelativeEntryPath);
|
|
122
114
|
const exposeEntries = Object.entries(exposes).map(([exposeKey, exposePath])=>({
|
|
123
115
|
exposeKey,
|
|
124
116
|
normalizedExposePath: normalizeEntryPath(exposePath)
|
|
125
117
|
}));
|
|
126
118
|
const exactMatch = exposeEntries.find(({ normalizedExposePath })=>normalizedExposePath === normalizedRelativeEntryPath);
|
|
127
119
|
const extensionlessMatch = exposeEntries.find(({ normalizedExposePath })=>removePathExtension(normalizedExposePath) === removePathExtension(normalizedRelativeEntryPath));
|
|
128
|
-
const exposedMatchedKey =
|
|
120
|
+
const exposedMatchedKey = exactMatch?.exposeKey ?? extensionlessMatch?.exposeKey;
|
|
129
121
|
if (exposedMatchedKey) {
|
|
130
122
|
let exposedName = exposedMatchedKey;
|
|
131
123
|
if (exposedName.startsWith('./')) exposedName = exposedName.slice(2);
|
|
@@ -10,11 +10,15 @@ var __webpack_require__ = {};
|
|
|
10
10
|
};
|
|
11
11
|
})();
|
|
12
12
|
(()=>{
|
|
13
|
-
__webpack_require__.d = (exports1,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
18
22
|
};
|
|
19
23
|
})();
|
|
20
24
|
(()=>{
|
|
@@ -22,7 +26,7 @@ var __webpack_require__ = {};
|
|
|
22
26
|
})();
|
|
23
27
|
(()=>{
|
|
24
28
|
__webpack_require__.r = (exports1)=>{
|
|
25
|
-
if (
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
30
|
value: 'Module'
|
|
27
31
|
});
|
|
28
32
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -153,9 +157,9 @@ function validateOptions(options) {
|
|
|
153
157
|
validateShared(options.shared);
|
|
154
158
|
}
|
|
155
159
|
exports.validateOptions = __webpack_exports__.validateOptions;
|
|
156
|
-
for(var
|
|
160
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
157
161
|
"validateOptions"
|
|
158
|
-
].indexOf(
|
|
162
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
159
163
|
Object.defineProperty(exports, '__esModule', {
|
|
160
164
|
value: true
|
|
161
165
|
});
|
package/dist/types.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
4
|
__webpack_require__.r = (exports1)=>{
|
|
5
|
-
if (
|
|
5
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
6
|
value: 'Module'
|
|
7
7
|
});
|
|
8
8
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -12,7 +12,7 @@ var __webpack_require__ = {};
|
|
|
12
12
|
})();
|
|
13
13
|
var __webpack_exports__ = {};
|
|
14
14
|
__webpack_require__.r(__webpack_exports__);
|
|
15
|
-
for(var
|
|
15
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
16
16
|
Object.defineProperty(exports, '__esModule', {
|
|
17
17
|
value: true
|
|
18
18
|
});
|
package/dist/types.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
1
|
+
import "node:module";
|
package/dist/utils/errors.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -13,7 +17,7 @@ var __webpack_require__ = {};
|
|
|
13
17
|
})();
|
|
14
18
|
(()=>{
|
|
15
19
|
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if (
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
21
|
value: 'Module'
|
|
18
22
|
});
|
|
19
23
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -23,10 +27,6 @@ var __webpack_require__ = {};
|
|
|
23
27
|
})();
|
|
24
28
|
var __webpack_exports__ = {};
|
|
25
29
|
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
CLIError: ()=>CLIError,
|
|
28
|
-
ConfigError: ()=>ConfigError
|
|
29
|
-
});
|
|
30
30
|
const inlineString = (str = '')=>str.replace(/(\s{2,})/gm, ' ').trim();
|
|
31
31
|
class EnhancedError extends Error {
|
|
32
32
|
constructor(msg, originalError){
|
|
@@ -39,12 +39,16 @@ class ConfigError extends EnhancedError {
|
|
|
39
39
|
}
|
|
40
40
|
class CLIError extends EnhancedError {
|
|
41
41
|
}
|
|
42
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
43
|
+
CLIError: ()=>CLIError,
|
|
44
|
+
ConfigError: ()=>ConfigError
|
|
45
|
+
});
|
|
42
46
|
exports.CLIError = __webpack_exports__.CLIError;
|
|
43
47
|
exports.ConfigError = __webpack_exports__.ConfigError;
|
|
44
|
-
for(var
|
|
48
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
45
49
|
"CLIError",
|
|
46
50
|
"ConfigError"
|
|
47
|
-
].indexOf(
|
|
51
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
48
52
|
Object.defineProperty(exports, '__esModule', {
|
|
49
53
|
value: true
|
|
50
54
|
});
|
package/dist/utils/errors.mjs
CHANGED
|
@@ -1,26 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
"@module-federation/dts-plugin": function(module) {
|
|
4
|
-
module.exports = import("@module-federation/dts-plugin").then(function(module) {
|
|
5
|
-
return module;
|
|
6
|
-
});
|
|
7
|
-
},
|
|
8
|
-
"@module-federation/dts-plugin/core": function(module) {
|
|
9
|
-
module.exports = import("@module-federation/dts-plugin/core").then(function(module) {
|
|
10
|
-
return module;
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
var __webpack_module_cache__ = {};
|
|
15
|
-
function __webpack_require__(moduleId) {
|
|
16
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
17
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
18
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
19
|
-
exports: {}
|
|
20
|
-
};
|
|
21
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
22
|
-
return module.exports;
|
|
23
|
-
}
|
|
2
|
+
var __webpack_require__ = {};
|
|
24
3
|
(()=>{
|
|
25
4
|
__webpack_require__.n = (module)=>{
|
|
26
5
|
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
@@ -31,11 +10,15 @@ function __webpack_require__(moduleId) {
|
|
|
31
10
|
};
|
|
32
11
|
})();
|
|
33
12
|
(()=>{
|
|
34
|
-
__webpack_require__.d = (exports1,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
39
22
|
};
|
|
40
23
|
})();
|
|
41
24
|
(()=>{
|
|
@@ -43,7 +26,7 @@ function __webpack_require__(moduleId) {
|
|
|
43
26
|
})();
|
|
44
27
|
(()=>{
|
|
45
28
|
__webpack_require__.r = (exports1)=>{
|
|
46
|
-
if (
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
47
30
|
value: 'Module'
|
|
48
31
|
});
|
|
49
32
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -52,108 +35,106 @@ function __webpack_require__(moduleId) {
|
|
|
52
35
|
};
|
|
53
36
|
})();
|
|
54
37
|
var __webpack_exports__ = {};
|
|
55
|
-
(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
38
|
+
__webpack_require__.r(__webpack_exports__);
|
|
39
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
applyTypesMetaToManifest: ()=>applyTypesMetaToManifest,
|
|
41
|
+
maybeGenerateFederatedRemoteTypes: ()=>maybeGenerateFederatedRemoteTypes
|
|
42
|
+
});
|
|
43
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
44
|
+
const external_node_util_namespaceObject = require("node:util");
|
|
45
|
+
var external_node_util_default = /*#__PURE__*/ __webpack_require__.n(external_node_util_namespaceObject);
|
|
46
|
+
async function maybeGenerateFederatedRemoteTypes(opts) {
|
|
47
|
+
const { federationConfig, projectRoot, outputDir, logger } = opts;
|
|
48
|
+
if (false === federationConfig.dts) return;
|
|
49
|
+
const dtsPlugin = await import("@module-federation/dts-plugin");
|
|
50
|
+
const dtsPluginCore = await import("@module-federation/dts-plugin/core");
|
|
51
|
+
const dtsConfig = true === federationConfig.dts ? {
|
|
52
|
+
consumeTypes: false
|
|
53
|
+
} : 'object' != typeof federationConfig.dts || null === federationConfig.dts || Object.prototype.hasOwnProperty.call(federationConfig.dts, 'consumeTypes') ? federationConfig.dts : {
|
|
54
|
+
...federationConfig.dts,
|
|
55
|
+
consumeTypes: false
|
|
56
|
+
};
|
|
57
|
+
const mfOptions = {
|
|
58
|
+
name: federationConfig.name,
|
|
59
|
+
filename: federationConfig.filename,
|
|
60
|
+
remotes: federationConfig.remotes,
|
|
61
|
+
exposes: federationConfig.exposes,
|
|
62
|
+
shared: federationConfig.shared,
|
|
63
|
+
dts: dtsConfig
|
|
64
|
+
};
|
|
65
|
+
const normalizedDtsOptions = dtsPlugin.normalizeDtsOptions(mfOptions, projectRoot, {
|
|
66
|
+
defaultGenerateOptions: {
|
|
67
|
+
generateAPITypes: true,
|
|
68
|
+
compileInChildProcess: false,
|
|
69
|
+
abortOnError: false,
|
|
70
|
+
extractThirdParty: false,
|
|
71
|
+
extractRemoteTypes: false
|
|
72
|
+
},
|
|
73
|
+
defaultConsumeOptions: {
|
|
74
|
+
abortOnError: true,
|
|
75
|
+
consumeAPITypes: true
|
|
76
|
+
}
|
|
60
77
|
});
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
filename: federationConfig.filename,
|
|
78
|
-
remotes: federationConfig.remotes,
|
|
79
|
-
exposes: federationConfig.exposes,
|
|
80
|
-
shared: federationConfig.shared,
|
|
81
|
-
dts: dtsConfig
|
|
82
|
-
};
|
|
83
|
-
const normalizedDtsOptions = dtsPlugin.normalizeDtsOptions(mfOptions, projectRoot, {
|
|
84
|
-
defaultGenerateOptions: {
|
|
85
|
-
generateAPITypes: true,
|
|
86
|
-
compileInChildProcess: false,
|
|
87
|
-
abortOnError: false,
|
|
88
|
-
extractThirdParty: false,
|
|
89
|
-
extractRemoteTypes: false
|
|
90
|
-
},
|
|
91
|
-
defaultConsumeOptions: {
|
|
92
|
-
abortOnError: true,
|
|
93
|
-
consumeAPITypes: true
|
|
78
|
+
if (!normalizedDtsOptions) return;
|
|
79
|
+
const dtsManagerOptions = dtsPlugin.normalizeGenerateTypesOptions({
|
|
80
|
+
context: projectRoot,
|
|
81
|
+
outputDir,
|
|
82
|
+
dtsOptions: normalizedDtsOptions,
|
|
83
|
+
pluginOptions: mfOptions
|
|
84
|
+
});
|
|
85
|
+
if (!dtsManagerOptions) return;
|
|
86
|
+
if (dtsManagerOptions.host) {
|
|
87
|
+
let remoteTypeUrls = dtsManagerOptions.host.remoteTypeUrls;
|
|
88
|
+
if ('function' == typeof remoteTypeUrls) remoteTypeUrls = await remoteTypeUrls();
|
|
89
|
+
await dtsPluginCore.consumeTypes({
|
|
90
|
+
...dtsManagerOptions,
|
|
91
|
+
host: {
|
|
92
|
+
...dtsManagerOptions.host,
|
|
93
|
+
remoteTypeUrls
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
|
-
if (!normalizedDtsOptions) return;
|
|
97
|
-
const dtsManagerOptions = dtsPlugin.normalizeGenerateTypesOptions({
|
|
98
|
-
context: projectRoot,
|
|
99
|
-
outputDir,
|
|
100
|
-
dtsOptions: normalizedDtsOptions,
|
|
101
|
-
pluginOptions: mfOptions
|
|
102
|
-
});
|
|
103
|
-
if (!dtsManagerOptions) return;
|
|
104
|
-
if (dtsManagerOptions.host) {
|
|
105
|
-
let remoteTypeUrls = dtsManagerOptions.host.remoteTypeUrls;
|
|
106
|
-
if ('function' == typeof remoteTypeUrls) remoteTypeUrls = await remoteTypeUrls();
|
|
107
|
-
await dtsPluginCore.consumeTypes({
|
|
108
|
-
...dtsManagerOptions,
|
|
109
|
-
host: {
|
|
110
|
-
...dtsManagerOptions.host,
|
|
111
|
-
remoteTypeUrls
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
logger.info(`${external_node_util_default().styleText('blue', 'Generating federated types (d.ts)')}`);
|
|
116
|
-
await dtsPlugin.generateTypesAPI({
|
|
117
|
-
dtsManagerOptions
|
|
118
|
-
});
|
|
119
|
-
const { zipTypesPath, apiTypesPath, zipName, apiFileName } = dtsPluginCore.retrieveTypesAssetsInfo(dtsManagerOptions.remote);
|
|
120
|
-
const produced = {};
|
|
121
|
-
const fileExists = async (p)=>{
|
|
122
|
-
try {
|
|
123
|
-
await external_node_fs_namespaceObject.promises.stat(p);
|
|
124
|
-
return true;
|
|
125
|
-
} catch {
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
if (zipTypesPath && zipName && await fileExists(zipTypesPath)) produced.zipName = zipName;
|
|
130
|
-
if (apiTypesPath && apiFileName && await fileExists(apiTypesPath)) produced.apiFileName = apiFileName;
|
|
131
|
-
if (process.env['FEDERATION_DEBUG']) logger.info(`dts debug: zipTypesPath=${zipTypesPath} zipExists=${String(Boolean(produced.zipName))} apiTypesPath=${apiTypesPath} apiExists=${String(Boolean(produced.apiFileName))}`);
|
|
132
|
-
if (!produced.zipName && !produced.apiFileName) return void logger.warn(`${external_node_util_default().styleText('yellow', 'Federated types enabled, but no types files were produced.')}`);
|
|
133
|
-
logger.info(`Done writing federated types:\n${external_node_util_default().styleText('dim', [
|
|
134
|
-
produced.zipName,
|
|
135
|
-
produced.apiFileName
|
|
136
|
-
].filter(Boolean).join('\n'))}`);
|
|
137
|
-
return {
|
|
138
|
-
zipName: produced.zipName ?? '',
|
|
139
|
-
apiFileName: produced.apiFileName ?? ''
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function applyTypesMetaToManifest(manifest, typesMeta) {
|
|
143
|
-
if (!(null == typesMeta ? void 0 : typesMeta.zipName) && !(null == typesMeta ? void 0 : typesMeta.apiFileName)) return manifest;
|
|
144
|
-
manifest.metaData = manifest.metaData || {};
|
|
145
|
-
manifest.metaData.types = manifest.metaData.types || {};
|
|
146
|
-
if (typesMeta.zipName) manifest.metaData.types.zip = typesMeta.zipName;
|
|
147
|
-
if (typesMeta.apiFileName) manifest.metaData.types.api = typesMeta.apiFileName;
|
|
148
|
-
return manifest;
|
|
149
96
|
}
|
|
150
|
-
|
|
97
|
+
logger.info(`${external_node_util_default().styleText('blue', 'Generating federated types (d.ts)')}`);
|
|
98
|
+
await dtsPlugin.generateTypesAPI({
|
|
99
|
+
dtsManagerOptions
|
|
100
|
+
});
|
|
101
|
+
const { zipTypesPath, apiTypesPath, zipName, apiFileName } = dtsPluginCore.retrieveTypesAssetsInfo(dtsManagerOptions.remote);
|
|
102
|
+
const produced = {};
|
|
103
|
+
const fileExists = async (p)=>{
|
|
104
|
+
try {
|
|
105
|
+
await external_node_fs_namespaceObject.promises.stat(p);
|
|
106
|
+
return true;
|
|
107
|
+
} catch {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
if (zipTypesPath && zipName && await fileExists(zipTypesPath)) produced.zipName = zipName;
|
|
112
|
+
if (apiTypesPath && apiFileName && await fileExists(apiTypesPath)) produced.apiFileName = apiFileName;
|
|
113
|
+
if (process.env['FEDERATION_DEBUG']) logger.info(`dts debug: zipTypesPath=${zipTypesPath} zipExists=${String(Boolean(produced.zipName))} apiTypesPath=${apiTypesPath} apiExists=${String(Boolean(produced.apiFileName))}`);
|
|
114
|
+
if (!produced.zipName && !produced.apiFileName) return void logger.warn(`${external_node_util_default().styleText('yellow', 'Federated types enabled, but no types files were produced.')}`);
|
|
115
|
+
logger.info(`Done writing federated types:\n${external_node_util_default().styleText('dim', [
|
|
116
|
+
produced.zipName,
|
|
117
|
+
produced.apiFileName
|
|
118
|
+
].filter(Boolean).join('\n'))}`);
|
|
119
|
+
return {
|
|
120
|
+
zipName: produced.zipName ?? '',
|
|
121
|
+
apiFileName: produced.apiFileName ?? ''
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function applyTypesMetaToManifest(manifest, typesMeta) {
|
|
125
|
+
if (!typesMeta?.zipName && !typesMeta?.apiFileName) return manifest;
|
|
126
|
+
manifest.metaData = manifest.metaData || {};
|
|
127
|
+
manifest.metaData.types = manifest.metaData.types || {};
|
|
128
|
+
if (typesMeta.zipName) manifest.metaData.types.zip = typesMeta.zipName;
|
|
129
|
+
if (typesMeta.apiFileName) manifest.metaData.types.api = typesMeta.apiFileName;
|
|
130
|
+
return manifest;
|
|
131
|
+
}
|
|
151
132
|
exports.applyTypesMetaToManifest = __webpack_exports__.applyTypesMetaToManifest;
|
|
152
133
|
exports.maybeGenerateFederatedRemoteTypes = __webpack_exports__.maybeGenerateFederatedRemoteTypes;
|
|
153
|
-
for(var
|
|
134
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
154
135
|
"applyTypesMetaToManifest",
|
|
155
136
|
"maybeGenerateFederatedRemoteTypes"
|
|
156
|
-
].indexOf(
|
|
137
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
157
138
|
Object.defineProperty(exports, '__esModule', {
|
|
158
139
|
value: true
|
|
159
140
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
1
|
+
import "node:module";
|
|
3
2
|
import { promises } from "node:fs";
|
|
4
3
|
import node_util from "node:util";
|
|
5
4
|
async function maybeGenerateFederatedRemoteTypes(opts) {
|
|
@@ -81,7 +80,7 @@ async function maybeGenerateFederatedRemoteTypes(opts) {
|
|
|
81
80
|
};
|
|
82
81
|
}
|
|
83
82
|
function applyTypesMetaToManifest(manifest, typesMeta) {
|
|
84
|
-
if (!
|
|
83
|
+
if (!typesMeta?.zipName && !typesMeta?.apiFileName) return manifest;
|
|
85
84
|
manifest.metaData = manifest.metaData || {};
|
|
86
85
|
manifest.metaData.types = manifest.metaData.types || {};
|
|
87
86
|
if (typesMeta.zipName) manifest.metaData.types.zip = typesMeta.zipName;
|
package/dist/utils/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -13,7 +17,7 @@ var __webpack_require__ = {};
|
|
|
13
17
|
})();
|
|
14
18
|
(()=>{
|
|
15
19
|
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if (
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
21
|
value: 'Module'
|
|
18
22
|
});
|
|
19
23
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -24,20 +28,20 @@ var __webpack_require__ = {};
|
|
|
24
28
|
var __webpack_exports__ = {};
|
|
25
29
|
__webpack_require__.r(__webpack_exports__);
|
|
26
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
VirtualModuleManager: ()=>external_vm_manager_js_namespaceObject.VirtualModuleManager,
|
|
28
31
|
CLIError: ()=>external_errors_js_namespaceObject.CLIError,
|
|
29
|
-
ConfigError: ()=>external_errors_js_namespaceObject.ConfigError
|
|
32
|
+
ConfigError: ()=>external_errors_js_namespaceObject.ConfigError,
|
|
33
|
+
VirtualModuleManager: ()=>external_vm_manager_js_namespaceObject.VirtualModuleManager
|
|
30
34
|
});
|
|
31
35
|
const external_errors_js_namespaceObject = require("./errors.js");
|
|
32
36
|
const external_vm_manager_js_namespaceObject = require("./vm-manager.js");
|
|
33
37
|
exports.CLIError = __webpack_exports__.CLIError;
|
|
34
38
|
exports.ConfigError = __webpack_exports__.ConfigError;
|
|
35
39
|
exports.VirtualModuleManager = __webpack_exports__.VirtualModuleManager;
|
|
36
|
-
for(var
|
|
40
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
37
41
|
"CLIError",
|
|
38
42
|
"ConfigError",
|
|
39
43
|
"VirtualModuleManager"
|
|
40
|
-
].indexOf(
|
|
44
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
41
45
|
Object.defineProperty(exports, '__esModule', {
|
|
42
46
|
value: true
|
|
43
47
|
});
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { VirtualModuleManager } from "./vm-manager.mjs";
|
|
5
|
-
export { CLIError, ConfigError, VirtualModuleManager };
|
|
1
|
+
import "node:module";
|
|
2
|
+
export { CLIError, ConfigError } from "./errors.mjs";
|
|
3
|
+
export { VirtualModuleManager } from "./vm-manager.mjs";
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -13,7 +17,7 @@ var __webpack_require__ = {};
|
|
|
13
17
|
})();
|
|
14
18
|
(()=>{
|
|
15
19
|
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if (
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
21
|
value: 'Module'
|
|
18
22
|
});
|
|
19
23
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -23,13 +27,6 @@ var __webpack_require__ = {};
|
|
|
23
27
|
})();
|
|
24
28
|
var __webpack_exports__ = {};
|
|
25
29
|
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
CountingSet: ()=>CountingSet,
|
|
28
|
-
Server: ()=>Server,
|
|
29
|
-
baseJSBundle: ()=>baseJSBundle,
|
|
30
|
-
bundleToString: ()=>bundleToString,
|
|
31
|
-
relativizeSourceMapInline: ()=>relativizeSourceMapInline
|
|
32
|
-
});
|
|
33
30
|
function resolveAndImport(metro83Path, metro82Path) {
|
|
34
31
|
let resolvedPath;
|
|
35
32
|
try {
|
|
@@ -53,18 +50,25 @@ const CountingSet = getDefaultExport(resolveAndImport('metro/private/lib/Countin
|
|
|
53
50
|
const bundleToString = getDefaultExport(resolveAndImport('metro/private/lib/bundleToString', 'metro/src/lib/bundleToString'));
|
|
54
51
|
const relativizeSourceMapModule = resolveAndImport('metro/private/lib/relativizeSourceMap', 'metro/src/lib/relativizeSourceMap');
|
|
55
52
|
const relativizeSourceMapInline = relativizeSourceMapModule.relativizeSourceMapInline || getDefaultExport(relativizeSourceMapModule);
|
|
53
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
54
|
+
CountingSet: CountingSet,
|
|
55
|
+
Server: Server,
|
|
56
|
+
baseJSBundle: baseJSBundle,
|
|
57
|
+
bundleToString: bundleToString,
|
|
58
|
+
relativizeSourceMapInline: relativizeSourceMapInline
|
|
59
|
+
});
|
|
56
60
|
exports.CountingSet = __webpack_exports__.CountingSet;
|
|
57
61
|
exports.Server = __webpack_exports__.Server;
|
|
58
62
|
exports.baseJSBundle = __webpack_exports__.baseJSBundle;
|
|
59
63
|
exports.bundleToString = __webpack_exports__.bundleToString;
|
|
60
64
|
exports.relativizeSourceMapInline = __webpack_exports__.relativizeSourceMapInline;
|
|
61
|
-
for(var
|
|
65
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
62
66
|
"CountingSet",
|
|
63
67
|
"Server",
|
|
64
68
|
"baseJSBundle",
|
|
65
69
|
"bundleToString",
|
|
66
70
|
"relativizeSourceMapInline"
|
|
67
|
-
].indexOf(
|
|
71
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
68
72
|
Object.defineProperty(exports, '__esModule', {
|
|
69
73
|
value: true
|
|
70
74
|
});
|