@module-federation/metro 0.0.0-perf-devtools-20260107043700 → 0.0.0-perf-website-code-usage-20260914033703
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/babel/transformer.js +1 -1
- package/dist/commands/bundle-host/index.js +17 -12
- package/dist/commands/bundle-host/index.mjs +8 -30
- 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 +34 -19
- package/dist/commands/bundle-remote/index.mjs +28 -38
- 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.d.ts +1 -1
- 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.d.ts +1 -2
- package/dist/commands/utils/get-community-plugin.js +15 -12
- package/dist/commands/utils/get-community-plugin.mjs +5 -6
- 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.d.ts +2 -0
- package/dist/commands/utils/path-utils.js +51 -0
- package/dist/commands/utils/path-utils.mjs +11 -0
- package/dist/commands/utils/save-bundle-and-map.d.ts +1 -1
- package/dist/commands/utils/save-bundle-and-map.js +14 -11
- package/dist/commands/utils/save-bundle-and-map.mjs +3 -27
- package/dist/index.js +14 -10
- package/dist/index.mjs +3 -5
- package/dist/logger.d.ts +2 -0
- package/dist/logger.js +43 -0
- package/dist/logger.mjs +6 -0
- package/dist/modules/asyncRequire.ts +41 -10
- package/dist/modules/metroCorePlugin.ts +2 -3
- package/dist/plugin/babel-transformer.js +13 -9
- package/dist/plugin/babel-transformer.mjs +3 -3
- package/dist/plugin/constants.d.ts +1 -0
- package/dist/plugin/constants.js +27 -19
- package/dist/plugin/constants.mjs +3 -3
- package/dist/plugin/generators.js +28 -21
- package/dist/plugin/generators.mjs +14 -11
- package/dist/plugin/helpers.d.ts +1 -0
- package/dist/plugin/helpers.js +28 -20
- package/dist/plugin/helpers.mjs +9 -9
- package/dist/plugin/index.d.ts +2 -0
- package/dist/plugin/index.js +64 -13
- package/dist/plugin/index.mjs +54 -7
- package/dist/plugin/manifest-middleware.d.ts +12 -0
- package/dist/plugin/manifest-middleware.js +217 -0
- package/dist/plugin/manifest-middleware.mjs +170 -0
- package/dist/plugin/manifest.d.ts +15 -2
- package/dist/plugin/manifest.js +126 -26
- package/dist/plugin/manifest.mjs +107 -22
- package/dist/plugin/normalize-extra-options.js +16 -12
- package/dist/plugin/normalize-extra-options.mjs +2 -3
- package/dist/plugin/normalize-options.js +70 -20
- package/dist/plugin/normalize-options.mjs +60 -14
- package/dist/plugin/resolver.d.ts +1 -1
- package/dist/plugin/resolver.js +16 -12
- package/dist/plugin/resolver.mjs +10 -11
- package/dist/plugin/rewrite-request.d.ts +5 -1
- package/dist/plugin/rewrite-request.js +23 -10
- package/dist/plugin/rewrite-request.mjs +13 -5
- package/dist/plugin/serializer.d.ts +2 -1
- package/dist/plugin/serializer.js +59 -39
- package/dist/plugin/serializer.mjs +48 -55
- package/dist/plugin/validate-options.js +116 -12
- package/dist/plugin/validate-options.mjs +95 -7
- package/dist/types.d.ts +15 -15
- 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.d.ts +12 -0
- package/dist/utils/federated-remote-types.js +140 -0
- package/dist/utils/federated-remote-types.mjs +90 -0
- package/dist/utils/index.js +14 -10
- package/dist/utils/index.mjs +3 -5
- package/dist/utils/metro-compat.d.ts +23 -0
- package/dist/utils/metro-compat.js +74 -0
- package/dist/utils/metro-compat.mjs +26 -0
- package/dist/utils/vm-manager.d.ts +1 -1
- package/dist/utils/vm-manager.js +14 -12
- package/dist/utils/vm-manager.mjs +3 -6
- package/package.json +22 -7
- package/dist/babel/transformer.d.ts +0 -2
- package/dist/runtime/host-entry.d.ts +0 -1
- package/dist/runtime/init-host.d.ts +0 -1
- package/dist/runtime/remote-entry.d.ts +0 -1
- package/dist/runtime/remote-hmr.d.ts +0 -1
- package/dist/runtime/remote-module-registry.d.ts +0 -7
- package/dist/runtime/remote-module.d.ts +0 -1
|
@@ -45,9 +45,9 @@ function metroPatchInitializeCorePlugin() {
|
|
|
45
45
|
Program: {
|
|
46
46
|
enter(_, state) {
|
|
47
47
|
state.hasInjected = false;
|
|
48
|
-
state.shouldTransform = state.file.opts.filename
|
|
49
|
-
'
|
|
50
|
-
|
|
48
|
+
state.shouldTransform = state.file.opts.filename
|
|
49
|
+
.replaceAll('\\', '/')
|
|
50
|
+
.includes('react-native/Libraries/Core/InitializeCore.js');
|
|
51
51
|
},
|
|
52
52
|
exit(path, state) {
|
|
53
53
|
if (!state.shouldTransform) return;
|
|
@@ -140,9 +140,9 @@ function metroPatchRequireBabelPlugin() {
|
|
|
140
140
|
Program: {
|
|
141
141
|
enter(_, state) {
|
|
142
142
|
// Transform only require.js from metro-runtime
|
|
143
|
-
state.shouldTransform = state.file.opts.filename
|
|
144
|
-
'
|
|
145
|
-
|
|
143
|
+
state.shouldTransform = state.file.opts.filename
|
|
144
|
+
.replaceAll('\\', '/')
|
|
145
|
+
.includes('metro-runtime/src/polyfills/require.js');
|
|
146
146
|
// Perform refreshSymbols transformation only once
|
|
147
147
|
// Because it is referenced in multiple places
|
|
148
148
|
state.hasTransformed = {
|
|
@@ -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', {
|
|
@@ -40,14 +44,14 @@ const external_node_path_namespaceObject = require("node:path");
|
|
|
40
44
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
41
45
|
const external_node_util_namespaceObject = require("node:util");
|
|
42
46
|
var external_node_util_default = /*#__PURE__*/ __webpack_require__.n(external_node_util_namespaceObject);
|
|
43
|
-
const Server_namespaceObject = require("metro/src/Server");
|
|
44
|
-
var Server_default = /*#__PURE__*/ __webpack_require__.n(Server_namespaceObject);
|
|
45
47
|
const errors_js_namespaceObject = require("../../utils/errors.js");
|
|
48
|
+
const metro_compat_js_namespaceObject = require("../../utils/metro-compat.js");
|
|
46
49
|
const create_resolver_js_namespaceObject = require("../utils/create-resolver.js");
|
|
47
50
|
const get_community_plugin_js_namespaceObject = require("../utils/get-community-plugin.js");
|
|
48
51
|
const load_metro_config_js_namespaceObject = require("../utils/load-metro-config.js");
|
|
49
52
|
var load_metro_config_js_default = /*#__PURE__*/ __webpack_require__.n(load_metro_config_js_namespaceObject);
|
|
50
53
|
const save_bundle_and_map_js_namespaceObject = require("../utils/save-bundle-and-map.js");
|
|
54
|
+
const helpers_js_namespaceObject = require("../../plugin/helpers.js");
|
|
51
55
|
const external_options_js_namespaceObject = require("./options.js");
|
|
52
56
|
var external_options_js_default = /*#__PURE__*/ __webpack_require__.n(external_options_js_namespaceObject);
|
|
53
57
|
async function bundleFederatedHost(_argv, cfg, args) {
|
|
@@ -70,12 +74,13 @@ async function bundleFederatedHost(_argv, cfg, args) {
|
|
|
70
74
|
build: async (server, requestOpts)=>{
|
|
71
75
|
config.server.enhanceMiddleware(server.processRequest, server);
|
|
72
76
|
const resolver = await (0, create_resolver_js_namespaceObject.createResolver)(server, args.platform);
|
|
77
|
+
const relativeHostEntryPath = (0, helpers_js_namespaceObject.toPosixPath)(external_node_path_default().relative(config.projectRoot, hostEntryFilepath));
|
|
73
78
|
resolver.resolve({
|
|
74
79
|
from: config.projectRoot,
|
|
75
|
-
to: `./${
|
|
80
|
+
to: `./${relativeHostEntryPath}`
|
|
76
81
|
});
|
|
77
82
|
return server.build({
|
|
78
|
-
...
|
|
83
|
+
...metro_compat_js_namespaceObject.Server.DEFAULT_BUNDLE_OPTIONS,
|
|
79
84
|
...requestOpts
|
|
80
85
|
});
|
|
81
86
|
},
|
|
@@ -86,10 +91,10 @@ async function bundleFederatedHost(_argv, cfg, args) {
|
|
|
86
91
|
const bundle_host = bundleFederatedHost;
|
|
87
92
|
exports.bundleFederatedHostOptions = __webpack_exports__.bundleFederatedHostOptions;
|
|
88
93
|
exports["default"] = __webpack_exports__["default"];
|
|
89
|
-
for(var
|
|
94
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
90
95
|
"bundleFederatedHostOptions",
|
|
91
96
|
"default"
|
|
92
|
-
].indexOf(
|
|
97
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
93
98
|
Object.defineProperty(exports, '__esModule', {
|
|
94
99
|
value: true
|
|
95
100
|
});
|
|
@@ -1,37 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
1
|
+
import "node:module";
|
|
3
2
|
import node_path from "node:path";
|
|
4
3
|
import node_util from "node:util";
|
|
5
4
|
import { CLIError } from "../../utils/errors.mjs";
|
|
5
|
+
import { Server } from "../../utils/metro-compat.mjs";
|
|
6
6
|
import { createResolver } from "../utils/create-resolver.mjs";
|
|
7
7
|
import { getCommunityCliPlugin } from "../utils/get-community-plugin.mjs";
|
|
8
8
|
import load_metro_config from "../utils/load-metro-config.mjs";
|
|
9
9
|
import { saveBundleAndMap } from "../utils/save-bundle-and-map.mjs";
|
|
10
|
-
import
|
|
11
|
-
import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "node:module";
|
|
12
|
-
var __webpack_require__ = {};
|
|
13
|
-
(()=>{
|
|
14
|
-
__webpack_require__.n = (module)=>{
|
|
15
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
16
|
-
__webpack_require__.d(getter, {
|
|
17
|
-
a: getter
|
|
18
|
-
});
|
|
19
|
-
return getter;
|
|
20
|
-
};
|
|
21
|
-
})();
|
|
22
|
-
(()=>{
|
|
23
|
-
__webpack_require__.d = (exports, definition)=>{
|
|
24
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: definition[key]
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
})();
|
|
30
|
-
(()=>{
|
|
31
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
32
|
-
})();
|
|
33
|
-
const Server_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("metro/src/Server");
|
|
34
|
-
var Server_default = /*#__PURE__*/ __webpack_require__.n(Server_namespaceObject);
|
|
10
|
+
import { toPosixPath } from "../../plugin/helpers.mjs";
|
|
35
11
|
async function bundleFederatedHost(_argv, cfg, args) {
|
|
36
12
|
const logger = cfg.logger ?? console;
|
|
37
13
|
global.__METRO_FEDERATION_ORIGINAL_ENTRY_PATH = args.entryFile;
|
|
@@ -52,12 +28,13 @@ async function bundleFederatedHost(_argv, cfg, args) {
|
|
|
52
28
|
build: async (server, requestOpts)=>{
|
|
53
29
|
config.server.enhanceMiddleware(server.processRequest, server);
|
|
54
30
|
const resolver = await createResolver(server, args.platform);
|
|
31
|
+
const relativeHostEntryPath = toPosixPath(node_path.relative(config.projectRoot, hostEntryFilepath));
|
|
55
32
|
resolver.resolve({
|
|
56
33
|
from: config.projectRoot,
|
|
57
|
-
to: `./${
|
|
34
|
+
to: `./${relativeHostEntryPath}`
|
|
58
35
|
});
|
|
59
36
|
return server.build({
|
|
60
|
-
...
|
|
37
|
+
...Server.DEFAULT_BUNDLE_OPTIONS,
|
|
61
38
|
...requestOpts
|
|
62
39
|
});
|
|
63
40
|
},
|
|
@@ -66,4 +43,5 @@ async function bundleFederatedHost(_argv, cfg, args) {
|
|
|
66
43
|
});
|
|
67
44
|
}
|
|
68
45
|
const bundle_host = bundleFederatedHost;
|
|
69
|
-
export {
|
|
46
|
+
export { default as bundleFederatedHostOptions } from "./options.mjs";
|
|
47
|
+
export default bundle_host;
|
|
@@ -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', {
|
|
@@ -31,9 +35,9 @@ const communityCliPlugin = (0, get_community_plugin_js_namespaceObject.getCommun
|
|
|
31
35
|
const options = communityCliPlugin.bundleCommand.options;
|
|
32
36
|
const bundle_host_options = options;
|
|
33
37
|
exports["default"] = __webpack_exports__["default"];
|
|
34
|
-
for(var
|
|
38
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
35
39
|
"default"
|
|
36
|
-
].indexOf(
|
|
40
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
37
41
|
Object.defineProperty(exports, '__esModule', {
|
|
38
42
|
value: true
|
|
39
43
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
1
|
+
import "node:module";
|
|
3
2
|
import { getCommunityCliPlugin } from "../utils/get-community-plugin.mjs";
|
|
4
3
|
const communityCliPlugin = getCommunityCliPlugin();
|
|
5
4
|
const options = communityCliPlugin.bundleCommand.options;
|
|
6
5
|
const bundle_host_options = options;
|
|
7
|
-
export
|
|
6
|
+
export default bundle_host_options;
|
|
@@ -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
|
});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
1
|
+
import "node:module";
|
|
@@ -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', {
|
|
@@ -39,24 +43,25 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
39
43
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
40
44
|
const external_node_path_namespaceObject = require("node:path");
|
|
41
45
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
42
|
-
const external_node_url_namespaceObject = require("node:url");
|
|
43
46
|
const external_node_util_namespaceObject = require("node:util");
|
|
44
47
|
var external_node_util_default = /*#__PURE__*/ __webpack_require__.n(external_node_util_namespaceObject);
|
|
45
48
|
const external_metro_namespaceObject = require("metro");
|
|
46
|
-
const Server_namespaceObject = require("metro/src/Server");
|
|
47
|
-
var Server_default = /*#__PURE__*/ __webpack_require__.n(Server_namespaceObject);
|
|
48
49
|
const errors_js_namespaceObject = require("../../utils/errors.js");
|
|
50
|
+
const federated_remote_types_js_namespaceObject = require("../../utils/federated-remote-types.js");
|
|
51
|
+
const metro_compat_js_namespaceObject = require("../../utils/metro-compat.js");
|
|
49
52
|
const create_module_path_remapper_js_namespaceObject = require("../utils/create-module-path-remapper.js");
|
|
50
53
|
const create_resolver_js_namespaceObject = require("../utils/create-resolver.js");
|
|
51
54
|
const load_metro_config_js_namespaceObject = require("../utils/load-metro-config.js");
|
|
52
55
|
var load_metro_config_js_default = /*#__PURE__*/ __webpack_require__.n(load_metro_config_js_namespaceObject);
|
|
56
|
+
const path_utils_js_namespaceObject = require("../utils/path-utils.js");
|
|
53
57
|
const save_bundle_and_map_js_namespaceObject = require("../utils/save-bundle-and-map.js");
|
|
58
|
+
const helpers_js_namespaceObject = require("../../plugin/helpers.js");
|
|
54
59
|
const external_options_js_namespaceObject = require("./options.js");
|
|
55
60
|
var external_options_js_default = /*#__PURE__*/ __webpack_require__.n(external_options_js_namespaceObject);
|
|
56
61
|
const DEFAULT_OUTPUT = 'dist';
|
|
57
62
|
async function buildBundle(server, requestOpts) {
|
|
58
63
|
const bundle = await server.build({
|
|
59
|
-
...
|
|
64
|
+
...metro_compat_js_namespaceObject.Server.DEFAULT_BUNDLE_OPTIONS,
|
|
60
65
|
...requestOpts
|
|
61
66
|
});
|
|
62
67
|
return bundle;
|
|
@@ -132,7 +137,7 @@ async function bundleFederatedRemote(_argv, cfg, args) {
|
|
|
132
137
|
}
|
|
133
138
|
}
|
|
134
139
|
});
|
|
135
|
-
const server = new (
|
|
140
|
+
const server = new metro_compat_js_namespaceObject.Server(config);
|
|
136
141
|
config.server.enhanceMiddleware(server.processRequest, server);
|
|
137
142
|
const resolver = await (0, create_resolver_js_namespaceObject.createResolver)(server, args.platform);
|
|
138
143
|
const outputDir = args.output ? external_node_path_default().resolve(external_node_path_default().join(args.output, args.platform)) : external_node_path_default().resolve(config.projectRoot, external_node_path_default().join(DEFAULT_OUTPUT, args.platform));
|
|
@@ -143,9 +148,10 @@ async function bundleFederatedRemote(_argv, cfg, args) {
|
|
|
143
148
|
isContainerModule: true
|
|
144
149
|
}
|
|
145
150
|
};
|
|
151
|
+
const relativeContainerEntryPath = (0, helpers_js_namespaceObject.toPosixPath)(external_node_path_default().relative(config.projectRoot, containerEntryFilepath));
|
|
146
152
|
resolver.resolve({
|
|
147
153
|
from: config.projectRoot,
|
|
148
|
-
to: `./${
|
|
154
|
+
to: `./${relativeContainerEntryPath}`
|
|
149
155
|
});
|
|
150
156
|
const exposedModules = Object.entries(federationConfig.exposes).map(([moduleName, moduleFilepath])=>[
|
|
151
157
|
moduleName.slice(2),
|
|
@@ -177,11 +183,12 @@ async function bundleFederatedRemote(_argv, cfg, args) {
|
|
|
177
183
|
}).map(([moduleName, { moduleInputFilepath, moduleOutputDir, isContainerModule = false }])=>{
|
|
178
184
|
const moduleBundleName = isContainerModule ? moduleName : `${moduleName}.bundle`;
|
|
179
185
|
const moduleBundleFilepath = external_node_path_default().resolve(moduleOutputDir, moduleBundleName);
|
|
180
|
-
const
|
|
186
|
+
const relativeModuleBundlePath = (0, path_utils_js_namespaceObject.normalizeOutputRelativePath)(external_node_path_default().relative(outputDir, moduleBundleFilepath));
|
|
187
|
+
const moduleBundleUrl = (0, path_utils_js_namespaceObject.toFileSourceUrl)(relativeModuleBundlePath);
|
|
181
188
|
const moduleSourceMapName = `${moduleBundleName}.map`;
|
|
182
189
|
const moduleSourceMapFilepath = external_node_path_default().resolve(moduleOutputDir, moduleSourceMapName);
|
|
183
|
-
const moduleSourceMapUrl = external_node_path_default().relative(outputDir, moduleSourceMapFilepath);
|
|
184
|
-
if (!isContainerModule) modulePathRemapper.addMapping(moduleInputFilepath,
|
|
190
|
+
const moduleSourceMapUrl = (0, path_utils_js_namespaceObject.normalizeOutputRelativePath)(external_node_path_default().relative(outputDir, moduleSourceMapFilepath));
|
|
191
|
+
if (!isContainerModule) modulePathRemapper.addMapping(moduleInputFilepath, relativeModuleBundlePath);
|
|
185
192
|
return {
|
|
186
193
|
targetDir: external_node_path_default().dirname(moduleBundleFilepath),
|
|
187
194
|
requestOpts: getRequestOpts(args, {
|
|
@@ -206,9 +213,17 @@ async function bundleFederatedRemote(_argv, cfg, args) {
|
|
|
206
213
|
const bundle = await buildBundle(server, requestOpts);
|
|
207
214
|
await (0, save_bundle_and_map_js_namespaceObject.saveBundleAndMap)(bundle, saveBundleOpts, logger.info);
|
|
208
215
|
}
|
|
209
|
-
logger.info(`${external_node_util_default().styleText('blue', 'Processing manifest')}`);
|
|
210
216
|
const manifestOutputFilepath = external_node_path_default().resolve(outputDir, 'mf-manifest.json');
|
|
211
|
-
await
|
|
217
|
+
const typesMeta = await (0, federated_remote_types_js_namespaceObject.maybeGenerateFederatedRemoteTypes)({
|
|
218
|
+
federationConfig,
|
|
219
|
+
projectRoot: config.projectRoot,
|
|
220
|
+
outputDir,
|
|
221
|
+
logger
|
|
222
|
+
});
|
|
223
|
+
logger.info(`${external_node_util_default().styleText('blue', 'Processing manifest')}`);
|
|
224
|
+
const rawManifest = JSON.parse(await external_node_fs_namespaceObject.promises.readFile(manifestFilepath, 'utf-8'));
|
|
225
|
+
(0, federated_remote_types_js_namespaceObject.applyTypesMetaToManifest)(rawManifest, typesMeta);
|
|
226
|
+
await external_node_fs_namespaceObject.promises.writeFile(manifestOutputFilepath, JSON.stringify(rawManifest, void 0, 2), 'utf-8');
|
|
212
227
|
logger.info(`Done writing MF Manifest to:\n${external_node_util_default().styleText('dim', manifestOutputFilepath)}`);
|
|
213
228
|
} finally{
|
|
214
229
|
await server.end();
|
|
@@ -217,10 +232,10 @@ async function bundleFederatedRemote(_argv, cfg, args) {
|
|
|
217
232
|
const bundle_remote = bundleFederatedRemote;
|
|
218
233
|
exports.bundleFederatedRemoteOptions = __webpack_exports__.bundleFederatedRemoteOptions;
|
|
219
234
|
exports["default"] = __webpack_exports__["default"];
|
|
220
|
-
for(var
|
|
235
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
221
236
|
"bundleFederatedRemoteOptions",
|
|
222
237
|
"default"
|
|
223
|
-
].indexOf(
|
|
238
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
224
239
|
Object.defineProperty(exports, '__esModule', {
|
|
225
240
|
value: true
|
|
226
241
|
});
|
|
@@ -1,44 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
1
|
+
import "node:module";
|
|
3
2
|
import { promises } from "node:fs";
|
|
4
3
|
import node_path from "node:path";
|
|
5
|
-
import { pathToFileURL } from "node:url";
|
|
6
4
|
import node_util from "node:util";
|
|
7
5
|
import { CLIError } from "../../utils/errors.mjs";
|
|
6
|
+
import { applyTypesMetaToManifest, maybeGenerateFederatedRemoteTypes } from "../../utils/federated-remote-types.mjs";
|
|
7
|
+
import { Server } from "../../utils/metro-compat.mjs";
|
|
8
8
|
import { createModulePathRemapper } from "../utils/create-module-path-remapper.mjs";
|
|
9
9
|
import { createResolver } from "../utils/create-resolver.mjs";
|
|
10
10
|
import load_metro_config from "../utils/load-metro-config.mjs";
|
|
11
|
+
import { normalizeOutputRelativePath, toFileSourceUrl } from "../utils/path-utils.mjs";
|
|
11
12
|
import { saveBundleAndMap } from "../utils/save-bundle-and-map.mjs";
|
|
12
|
-
import
|
|
13
|
-
import { createRequire as
|
|
14
|
-
|
|
15
|
-
(
|
|
16
|
-
__webpack_require__.n = (module)=>{
|
|
17
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
18
|
-
__webpack_require__.d(getter, {
|
|
19
|
-
a: getter
|
|
20
|
-
});
|
|
21
|
-
return getter;
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
(()=>{
|
|
25
|
-
__webpack_require__.d = (exports, definition)=>{
|
|
26
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: definition[key]
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
})();
|
|
32
|
-
(()=>{
|
|
33
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
34
|
-
})();
|
|
35
|
-
const external_metro_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("metro");
|
|
36
|
-
const Server_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("metro/src/Server");
|
|
37
|
-
var Server_default = /*#__PURE__*/ __webpack_require__.n(Server_namespaceObject);
|
|
13
|
+
import { toPosixPath } from "../../plugin/helpers.mjs";
|
|
14
|
+
import { createRequire as __rspack_createRequire } from "node:module";
|
|
15
|
+
const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
16
|
+
const external_metro_namespaceObject = __rspack_createRequire_require("metro");
|
|
38
17
|
const DEFAULT_OUTPUT = 'dist';
|
|
39
18
|
async function buildBundle(server, requestOpts) {
|
|
40
19
|
const bundle = await server.build({
|
|
41
|
-
...
|
|
20
|
+
...Server.DEFAULT_BUNDLE_OPTIONS,
|
|
42
21
|
...requestOpts
|
|
43
22
|
});
|
|
44
23
|
return bundle;
|
|
@@ -114,7 +93,7 @@ async function bundleFederatedRemote(_argv, cfg, args) {
|
|
|
114
93
|
}
|
|
115
94
|
}
|
|
116
95
|
});
|
|
117
|
-
const server = new (
|
|
96
|
+
const server = new Server(config);
|
|
118
97
|
config.server.enhanceMiddleware(server.processRequest, server);
|
|
119
98
|
const resolver = await createResolver(server, args.platform);
|
|
120
99
|
const outputDir = args.output ? node_path.resolve(node_path.join(args.output, args.platform)) : node_path.resolve(config.projectRoot, node_path.join(DEFAULT_OUTPUT, args.platform));
|
|
@@ -125,9 +104,10 @@ async function bundleFederatedRemote(_argv, cfg, args) {
|
|
|
125
104
|
isContainerModule: true
|
|
126
105
|
}
|
|
127
106
|
};
|
|
107
|
+
const relativeContainerEntryPath = toPosixPath(node_path.relative(config.projectRoot, containerEntryFilepath));
|
|
128
108
|
resolver.resolve({
|
|
129
109
|
from: config.projectRoot,
|
|
130
|
-
to: `./${
|
|
110
|
+
to: `./${relativeContainerEntryPath}`
|
|
131
111
|
});
|
|
132
112
|
const exposedModules = Object.entries(federationConfig.exposes).map(([moduleName, moduleFilepath])=>[
|
|
133
113
|
moduleName.slice(2),
|
|
@@ -159,11 +139,12 @@ async function bundleFederatedRemote(_argv, cfg, args) {
|
|
|
159
139
|
}).map(([moduleName, { moduleInputFilepath, moduleOutputDir, isContainerModule = false }])=>{
|
|
160
140
|
const moduleBundleName = isContainerModule ? moduleName : `${moduleName}.bundle`;
|
|
161
141
|
const moduleBundleFilepath = node_path.resolve(moduleOutputDir, moduleBundleName);
|
|
162
|
-
const
|
|
142
|
+
const relativeModuleBundlePath = normalizeOutputRelativePath(node_path.relative(outputDir, moduleBundleFilepath));
|
|
143
|
+
const moduleBundleUrl = toFileSourceUrl(relativeModuleBundlePath);
|
|
163
144
|
const moduleSourceMapName = `${moduleBundleName}.map`;
|
|
164
145
|
const moduleSourceMapFilepath = node_path.resolve(moduleOutputDir, moduleSourceMapName);
|
|
165
|
-
const moduleSourceMapUrl = node_path.relative(outputDir, moduleSourceMapFilepath);
|
|
166
|
-
if (!isContainerModule) modulePathRemapper.addMapping(moduleInputFilepath,
|
|
146
|
+
const moduleSourceMapUrl = normalizeOutputRelativePath(node_path.relative(outputDir, moduleSourceMapFilepath));
|
|
147
|
+
if (!isContainerModule) modulePathRemapper.addMapping(moduleInputFilepath, relativeModuleBundlePath);
|
|
167
148
|
return {
|
|
168
149
|
targetDir: node_path.dirname(moduleBundleFilepath),
|
|
169
150
|
requestOpts: getRequestOpts(args, {
|
|
@@ -188,13 +169,22 @@ async function bundleFederatedRemote(_argv, cfg, args) {
|
|
|
188
169
|
const bundle = await buildBundle(server, requestOpts);
|
|
189
170
|
await saveBundleAndMap(bundle, saveBundleOpts, logger.info);
|
|
190
171
|
}
|
|
191
|
-
logger.info(`${node_util.styleText('blue', 'Processing manifest')}`);
|
|
192
172
|
const manifestOutputFilepath = node_path.resolve(outputDir, 'mf-manifest.json');
|
|
193
|
-
await
|
|
173
|
+
const typesMeta = await maybeGenerateFederatedRemoteTypes({
|
|
174
|
+
federationConfig,
|
|
175
|
+
projectRoot: config.projectRoot,
|
|
176
|
+
outputDir,
|
|
177
|
+
logger
|
|
178
|
+
});
|
|
179
|
+
logger.info(`${node_util.styleText('blue', 'Processing manifest')}`);
|
|
180
|
+
const rawManifest = JSON.parse(await promises.readFile(manifestFilepath, 'utf-8'));
|
|
181
|
+
applyTypesMetaToManifest(rawManifest, typesMeta);
|
|
182
|
+
await promises.writeFile(manifestOutputFilepath, JSON.stringify(rawManifest, void 0, 2), 'utf-8');
|
|
194
183
|
logger.info(`Done writing MF Manifest to:\n${node_util.styleText('dim', manifestOutputFilepath)}`);
|
|
195
184
|
} finally{
|
|
196
185
|
await server.end();
|
|
197
186
|
}
|
|
198
187
|
}
|
|
199
188
|
const bundle_remote = bundleFederatedRemote;
|
|
200
|
-
export {
|
|
189
|
+
export { default as bundleFederatedRemoteOptions } from "./options.mjs";
|
|
190
|
+
export default bundle_remote;
|
|
@@ -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', {
|
|
@@ -33,11 +37,11 @@ var __webpack_require__ = {};
|
|
|
33
37
|
var __webpack_exports__ = {};
|
|
34
38
|
__webpack_require__.r(__webpack_exports__);
|
|
35
39
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
default: ()=>
|
|
40
|
+
default: ()=>bundle_remote_options
|
|
37
41
|
});
|
|
38
42
|
const external_node_path_namespaceObject = require("node:path");
|
|
39
43
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
40
|
-
const
|
|
44
|
+
const options = [
|
|
41
45
|
{
|
|
42
46
|
name: '--platform <string>',
|
|
43
47
|
description: 'Either "ios" or "android"',
|
|
@@ -99,11 +103,11 @@ const options_options = [
|
|
|
99
103
|
description: 'Output directory for the bundle'
|
|
100
104
|
}
|
|
101
105
|
];
|
|
102
|
-
const
|
|
106
|
+
const bundle_remote_options = options;
|
|
103
107
|
exports["default"] = __webpack_exports__["default"];
|
|
104
|
-
for(var
|
|
108
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
105
109
|
"default"
|
|
106
|
-
].indexOf(
|
|
110
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
107
111
|
Object.defineProperty(exports, '__esModule', {
|
|
108
112
|
value: true
|
|
109
113
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
1
|
+
import "node:module";
|
|
3
2
|
import node_path from "node:path";
|
|
4
|
-
const
|
|
3
|
+
const options = [
|
|
5
4
|
{
|
|
6
5
|
name: '--platform <string>',
|
|
7
6
|
description: 'Either "ios" or "android"',
|
|
@@ -63,5 +62,5 @@ const options_options = [
|
|
|
63
62
|
description: 'Output directory for the bundle'
|
|
64
63
|
}
|
|
65
64
|
];
|
|
66
|
-
const
|
|
67
|
-
export
|
|
65
|
+
const bundle_remote_options = options;
|
|
66
|
+
export default bundle_remote_options;
|
|
@@ -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
|
});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
1
|
+
import "node:module";
|