@module-federation/metro 0.0.0-docs-remove-invalid-lark-link-20251205062649
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/LICENSE +21 -0
- package/README.md +11 -0
- package/babel-plugin/index.js +115 -0
- package/babel-plugin/patch-initialize-core.js +61 -0
- package/babel-plugin/patch-require.js +174 -0
- package/bootstrap/index.d.ts +1 -0
- package/bootstrap/index.js +1 -0
- package/dist/babel/transformer.d.ts +2 -0
- package/dist/babel/transformer.js +15 -0
- package/dist/commands/bundle-host/index.d.ts +13 -0
- package/dist/commands/bundle-host/index.js +95 -0
- package/dist/commands/bundle-host/index.mjs +69 -0
- package/dist/commands/bundle-host/options.d.ts +5 -0
- package/dist/commands/bundle-host/options.js +39 -0
- package/dist/commands/bundle-host/options.mjs +7 -0
- package/dist/commands/bundle-host/types.d.ts +22 -0
- package/dist/commands/bundle-host/types.js +18 -0
- package/dist/commands/bundle-host/types.mjs +2 -0
- package/dist/commands/bundle-remote/index.d.ts +12 -0
- package/dist/commands/bundle-remote/index.js +226 -0
- package/dist/commands/bundle-remote/index.mjs +200 -0
- package/dist/commands/bundle-remote/options.d.ts +32 -0
- package/dist/commands/bundle-remote/options.js +109 -0
- package/dist/commands/bundle-remote/options.mjs +67 -0
- package/dist/commands/bundle-remote/types.d.ts +16 -0
- package/dist/commands/bundle-remote/types.js +18 -0
- package/dist/commands/bundle-remote/types.mjs +2 -0
- package/dist/commands/index.d.ts +48 -0
- package/dist/commands/index.js +72 -0
- package/dist/commands/index.mjs +13 -0
- package/dist/commands/types.d.ts +14 -0
- package/dist/commands/types.js +18 -0
- package/dist/commands/types.mjs +2 -0
- package/dist/commands/utils/create-module-path-remapper.d.ts +7 -0
- package/dist/commands/utils/create-module-path-remapper.js +64 -0
- package/dist/commands/utils/create-module-path-remapper.mjs +32 -0
- package/dist/commands/utils/create-resolver.d.ts +20 -0
- package/dist/commands/utils/create-resolver.js +57 -0
- package/dist/commands/utils/create-resolver.mjs +25 -0
- package/dist/commands/utils/get-community-plugin.d.ts +29 -0
- package/dist/commands/utils/get-community-plugin.js +50 -0
- package/dist/commands/utils/get-community-plugin.mjs +18 -0
- package/dist/commands/utils/load-metro-config.d.ts +3 -0
- package/dist/commands/utils/load-metro-config.js +84 -0
- package/dist/commands/utils/load-metro-config.mjs +43 -0
- package/dist/commands/utils/save-bundle-and-map.d.ts +5 -0
- package/dist/commands/utils/save-bundle-and-map.js +77 -0
- package/dist/commands/utils/save-bundle-and-map.mjs +57 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +40 -0
- package/dist/index.mjs +5 -0
- package/dist/modules/HMRClient.ts +31 -0
- package/dist/modules/HMRClientShim.ts +1 -0
- package/dist/modules/asyncRequire.ts +134 -0
- package/dist/modules/asyncStartup.tsx +43 -0
- package/dist/modules/getDevServer.ts +15 -0
- package/dist/modules/metroCorePlugin.ts +88 -0
- package/dist/plugin/babel-transformer.d.ts +11 -0
- package/dist/plugin/babel-transformer.js +68 -0
- package/dist/plugin/babel-transformer.mjs +25 -0
- package/dist/plugin/constants.d.ts +9 -0
- package/dist/plugin/constants.js +68 -0
- package/dist/plugin/constants.mjs +12 -0
- package/dist/plugin/generators.d.ts +13 -0
- package/dist/plugin/generators.js +157 -0
- package/dist/plugin/generators.mjs +99 -0
- package/dist/plugin/helpers.d.ts +7 -0
- package/dist/plugin/helpers.js +119 -0
- package/dist/plugin/helpers.mjs +58 -0
- package/dist/plugin/index.d.ts +9 -0
- package/dist/plugin/index.js +167 -0
- package/dist/plugin/index.mjs +124 -0
- package/dist/plugin/manifest.d.ts +3 -0
- package/dist/plugin/manifest.js +146 -0
- package/dist/plugin/manifest.mjs +100 -0
- package/dist/plugin/normalize-extra-options.d.ts +8 -0
- package/dist/plugin/normalize-extra-options.js +46 -0
- package/dist/plugin/normalize-extra-options.mjs +14 -0
- package/dist/plugin/normalize-options.d.ts +7 -0
- package/dist/plugin/normalize-options.js +89 -0
- package/dist/plugin/normalize-options.mjs +46 -0
- package/dist/plugin/resolver.d.ts +25 -0
- package/dist/plugin/resolver.js +199 -0
- package/dist/plugin/resolver.mjs +160 -0
- package/dist/plugin/rewrite-request.d.ts +10 -0
- package/dist/plugin/rewrite-request.js +76 -0
- package/dist/plugin/rewrite-request.mjs +34 -0
- package/dist/plugin/serializer.d.ts +5 -0
- package/dist/plugin/serializer.js +171 -0
- package/dist/plugin/serializer.mjs +151 -0
- package/dist/plugin/validate-options.d.ts +2 -0
- package/dist/plugin/validate-options.js +61 -0
- package/dist/plugin/validate-options.mjs +29 -0
- package/dist/runtime/host-entry.d.ts +1 -0
- package/dist/runtime/host-entry.js +3 -0
- package/dist/runtime/init-host.d.ts +1 -0
- package/dist/runtime/init-host.js +31 -0
- package/dist/runtime/remote-entry.d.ts +1 -0
- package/dist/runtime/remote-entry.js +57 -0
- package/dist/runtime/remote-hmr.d.ts +1 -0
- package/dist/runtime/remote-hmr.js +19 -0
- package/dist/runtime/remote-module-registry.d.ts +7 -0
- package/dist/runtime/remote-module-registry.js +57 -0
- package/dist/runtime/remote-module.d.ts +1 -0
- package/dist/runtime/remote-module.js +2 -0
- package/dist/types.d.ts +26 -0
- package/dist/types.js +18 -0
- package/dist/types.mjs +2 -0
- package/dist/utils/errors.d.ts +8 -0
- package/dist/utils/errors.js +50 -0
- package/dist/utils/errors.mjs +15 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +43 -0
- package/dist/utils/index.mjs +5 -0
- package/dist/utils/vm-manager.d.ts +21 -0
- package/dist/utils/vm-manager.js +116 -0
- package/dist/utils/vm-manager.mjs +73 -0
- package/package.json +91 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type BundleFederatedRemoteArgs = {
|
|
2
|
+
entryFile: string;
|
|
3
|
+
platform: string;
|
|
4
|
+
dev: boolean;
|
|
5
|
+
minify?: boolean;
|
|
6
|
+
bundleEncoding?: 'utf8' | 'utf16le' | 'ascii';
|
|
7
|
+
maxWorkers?: string;
|
|
8
|
+
sourcemapOutput?: string;
|
|
9
|
+
sourcemapSourcesRoot?: string;
|
|
10
|
+
sourcemapUseAbsolutePath?: boolean;
|
|
11
|
+
assetsDest?: string;
|
|
12
|
+
assetCatalogDest?: string;
|
|
13
|
+
resetCache?: boolean;
|
|
14
|
+
config?: string;
|
|
15
|
+
output?: string;
|
|
16
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
16
|
+
Object.defineProperty(exports, '__esModule', {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import bundleFederatedHost, { bundleFederatedHostOptions } from './bundle-host';
|
|
2
|
+
import bundleFederatedRemote, { bundleFederatedRemoteOptions } from './bundle-remote';
|
|
3
|
+
import loadMetroConfig from './utils/load-metro-config';
|
|
4
|
+
export { bundleFederatedHost, bundleFederatedHostOptions, bundleFederatedRemote, bundleFederatedRemoteOptions, loadMetroConfig, };
|
|
5
|
+
declare const _default: {
|
|
6
|
+
bundleFederatedHost: typeof bundleFederatedHost;
|
|
7
|
+
bundleFederatedHostOptions: {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
}[];
|
|
11
|
+
bundleFederatedRemote: typeof bundleFederatedRemote;
|
|
12
|
+
bundleFederatedRemoteOptions: ({
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
default: string;
|
|
16
|
+
parse?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
parse: (val: string) => boolean;
|
|
21
|
+
default: boolean;
|
|
22
|
+
} | {
|
|
23
|
+
name: string;
|
|
24
|
+
description: string;
|
|
25
|
+
parse: (val: string) => boolean;
|
|
26
|
+
default?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
default?: undefined;
|
|
31
|
+
parse?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
default: boolean;
|
|
36
|
+
parse?: undefined;
|
|
37
|
+
} | {
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
parse: (val: string) => string;
|
|
41
|
+
default?: undefined;
|
|
42
|
+
})[];
|
|
43
|
+
loadMetroConfig: typeof loadMetroConfig;
|
|
44
|
+
};
|
|
45
|
+
export default _default;
|
|
46
|
+
export type { BundleFederatedHostArgs } from './bundle-host/types';
|
|
47
|
+
export type { BundleFederatedRemoteArgs } from './bundle-remote/types';
|
|
48
|
+
export type { Config } from './types';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
bundleFederatedHost: ()=>index_js_default(),
|
|
37
|
+
bundleFederatedHostOptions: ()=>index_js_namespaceObject.bundleFederatedHostOptions,
|
|
38
|
+
bundleFederatedRemoteOptions: ()=>external_bundle_remote_index_js_namespaceObject.bundleFederatedRemoteOptions,
|
|
39
|
+
default: ()=>commands,
|
|
40
|
+
loadMetroConfig: ()=>load_metro_config_js_default(),
|
|
41
|
+
bundleFederatedRemote: ()=>external_bundle_remote_index_js_default()
|
|
42
|
+
});
|
|
43
|
+
const index_js_namespaceObject = require("./bundle-host/index.js");
|
|
44
|
+
var index_js_default = /*#__PURE__*/ __webpack_require__.n(index_js_namespaceObject);
|
|
45
|
+
const external_bundle_remote_index_js_namespaceObject = require("./bundle-remote/index.js");
|
|
46
|
+
var external_bundle_remote_index_js_default = /*#__PURE__*/ __webpack_require__.n(external_bundle_remote_index_js_namespaceObject);
|
|
47
|
+
const load_metro_config_js_namespaceObject = require("./utils/load-metro-config.js");
|
|
48
|
+
var load_metro_config_js_default = /*#__PURE__*/ __webpack_require__.n(load_metro_config_js_namespaceObject);
|
|
49
|
+
const commands = {
|
|
50
|
+
bundleFederatedHost: index_js_default(),
|
|
51
|
+
bundleFederatedHostOptions: index_js_namespaceObject.bundleFederatedHostOptions,
|
|
52
|
+
bundleFederatedRemote: external_bundle_remote_index_js_default(),
|
|
53
|
+
bundleFederatedRemoteOptions: external_bundle_remote_index_js_namespaceObject.bundleFederatedRemoteOptions,
|
|
54
|
+
loadMetroConfig: load_metro_config_js_default()
|
|
55
|
+
};
|
|
56
|
+
exports.bundleFederatedHost = __webpack_exports__.bundleFederatedHost;
|
|
57
|
+
exports.bundleFederatedHostOptions = __webpack_exports__.bundleFederatedHostOptions;
|
|
58
|
+
exports.bundleFederatedRemote = __webpack_exports__.bundleFederatedRemote;
|
|
59
|
+
exports.bundleFederatedRemoteOptions = __webpack_exports__.bundleFederatedRemoteOptions;
|
|
60
|
+
exports["default"] = __webpack_exports__["default"];
|
|
61
|
+
exports.loadMetroConfig = __webpack_exports__.loadMetroConfig;
|
|
62
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
63
|
+
"bundleFederatedHost",
|
|
64
|
+
"bundleFederatedHostOptions",
|
|
65
|
+
"bundleFederatedRemote",
|
|
66
|
+
"bundleFederatedRemoteOptions",
|
|
67
|
+
"default",
|
|
68
|
+
"loadMetroConfig"
|
|
69
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
70
|
+
Object.defineProperty(exports, '__esModule', {
|
|
71
|
+
value: true
|
|
72
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import bundle_host, { bundleFederatedHostOptions } from "./bundle-host/index.mjs";
|
|
4
|
+
import bundle_remote, { bundleFederatedRemoteOptions } from "./bundle-remote/index.mjs";
|
|
5
|
+
import load_metro_config from "./utils/load-metro-config.mjs";
|
|
6
|
+
const commands = {
|
|
7
|
+
bundleFederatedHost: bundle_host,
|
|
8
|
+
bundleFederatedHostOptions: bundleFederatedHostOptions,
|
|
9
|
+
bundleFederatedRemote: bundle_remote,
|
|
10
|
+
bundleFederatedRemoteOptions: bundleFederatedRemoteOptions,
|
|
11
|
+
loadMetroConfig: load_metro_config
|
|
12
|
+
};
|
|
13
|
+
export { bundle_host as bundleFederatedHost, bundleFederatedHostOptions, bundle_remote as bundleFederatedRemote, bundleFederatedRemoteOptions, commands as default, load_metro_config as loadMetroConfig };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Config {
|
|
2
|
+
root: string;
|
|
3
|
+
platforms: Record<string, object>;
|
|
4
|
+
reactNativePath: string;
|
|
5
|
+
logger?: Logger;
|
|
6
|
+
}
|
|
7
|
+
export interface Logger {
|
|
8
|
+
success: (...messages: Array<unknown>) => void;
|
|
9
|
+
info: (...messages: Array<unknown>) => void;
|
|
10
|
+
warn: (...messages: Array<unknown>) => void;
|
|
11
|
+
error: (...messages: Array<unknown>) => void;
|
|
12
|
+
debug: (...messages: Array<unknown>) => void;
|
|
13
|
+
log: (...messages: Array<unknown>) => void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
16
|
+
Object.defineProperty(exports, '__esModule', {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Resolution } from 'metro-resolver';
|
|
2
|
+
export declare function createModulePathRemapper(): {
|
|
3
|
+
addMapping(originalPath: string, overridePath: string): void;
|
|
4
|
+
removeMapping(originalPath: string): void;
|
|
5
|
+
remap(resolved: Resolution): Resolution;
|
|
6
|
+
reverse(overridePath: string): string;
|
|
7
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
createModulePathRemapper: ()=>createModulePathRemapper
|
|
28
|
+
});
|
|
29
|
+
function createModulePathRemapper() {
|
|
30
|
+
const mappings = new Map();
|
|
31
|
+
const reverseMappings = new Map();
|
|
32
|
+
return {
|
|
33
|
+
addMapping (originalPath, overridePath) {
|
|
34
|
+
mappings.set(originalPath, overridePath);
|
|
35
|
+
reverseMappings.set(overridePath, originalPath);
|
|
36
|
+
},
|
|
37
|
+
removeMapping (originalPath) {
|
|
38
|
+
const overridePath = mappings.get(originalPath);
|
|
39
|
+
if (!overridePath) return;
|
|
40
|
+
mappings.delete(originalPath);
|
|
41
|
+
reverseMappings.delete(overridePath);
|
|
42
|
+
},
|
|
43
|
+
remap (resolved) {
|
|
44
|
+
if (!('filePath' in resolved)) return resolved;
|
|
45
|
+
if (!mappings.has(resolved.filePath)) return resolved;
|
|
46
|
+
const overridePath = mappings.get(resolved.filePath);
|
|
47
|
+
return {
|
|
48
|
+
filePath: overridePath,
|
|
49
|
+
type: resolved.type
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
reverse (overridePath) {
|
|
53
|
+
if (!reverseMappings.has(overridePath)) return overridePath;
|
|
54
|
+
return reverseMappings.get(overridePath);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
exports.createModulePathRemapper = __webpack_exports__.createModulePathRemapper;
|
|
59
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
60
|
+
"createModulePathRemapper"
|
|
61
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
62
|
+
Object.defineProperty(exports, '__esModule', {
|
|
63
|
+
value: true
|
|
64
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
function createModulePathRemapper() {
|
|
4
|
+
const mappings = new Map();
|
|
5
|
+
const reverseMappings = new Map();
|
|
6
|
+
return {
|
|
7
|
+
addMapping (originalPath, overridePath) {
|
|
8
|
+
mappings.set(originalPath, overridePath);
|
|
9
|
+
reverseMappings.set(overridePath, originalPath);
|
|
10
|
+
},
|
|
11
|
+
removeMapping (originalPath) {
|
|
12
|
+
const overridePath = mappings.get(originalPath);
|
|
13
|
+
if (!overridePath) return;
|
|
14
|
+
mappings.delete(originalPath);
|
|
15
|
+
reverseMappings.delete(overridePath);
|
|
16
|
+
},
|
|
17
|
+
remap (resolved) {
|
|
18
|
+
if (!('filePath' in resolved)) return resolved;
|
|
19
|
+
if (!mappings.has(resolved.filePath)) return resolved;
|
|
20
|
+
const overridePath = mappings.get(resolved.filePath);
|
|
21
|
+
return {
|
|
22
|
+
filePath: overridePath,
|
|
23
|
+
type: resolved.type
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
reverse (overridePath) {
|
|
27
|
+
if (!reverseMappings.has(overridePath)) return overridePath;
|
|
28
|
+
return reverseMappings.get(overridePath);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export { createModulePathRemapper };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type Server from 'metro/src/Server';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a resolver utility that mirrors Metro's bundling resolution behavior.
|
|
4
|
+
* This utility exposes Metro's internal resolver to the command context,
|
|
5
|
+
* allowing commands to resolve module paths exactly as Metro would during bundling.
|
|
6
|
+
* The resolver maintains consistency with Metro's resolution strategy,
|
|
7
|
+
* including platform-specific resolution and dependency graph traversal.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Creates a resolver that matches Metro's bundling resolution behavior
|
|
11
|
+
* @param server - The Metro server instance to use for resolution
|
|
12
|
+
* @param platform - The target platform for resolution (e.g., 'ios', 'android', null for default)
|
|
13
|
+
* @returns The resolver object with a resolve method that takes source and target paths
|
|
14
|
+
*/
|
|
15
|
+
export declare function createResolver(server: Server, platform: string | null): Promise<{
|
|
16
|
+
resolve: ({ from, to }: {
|
|
17
|
+
from: string;
|
|
18
|
+
to: string;
|
|
19
|
+
}) => string;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
createResolver: ()=>createResolver
|
|
28
|
+
});
|
|
29
|
+
async function createResolver(server, platform) {
|
|
30
|
+
const bundler = server.getBundler().getBundler();
|
|
31
|
+
const depGraph = await bundler.getDependencyGraph();
|
|
32
|
+
const resolve = ({ from, to })=>{
|
|
33
|
+
const config = {
|
|
34
|
+
name: to,
|
|
35
|
+
data: {
|
|
36
|
+
asyncType: null,
|
|
37
|
+
key: to,
|
|
38
|
+
locs: []
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const options = {
|
|
42
|
+
assumeFlatNodeModules: false
|
|
43
|
+
};
|
|
44
|
+
const res = depGraph.resolveDependency(from, config, platform, {}, options);
|
|
45
|
+
return res.filePath;
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
resolve
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
exports.createResolver = __webpack_exports__.createResolver;
|
|
52
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
53
|
+
"createResolver"
|
|
54
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
55
|
+
Object.defineProperty(exports, '__esModule', {
|
|
56
|
+
value: true
|
|
57
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
async function createResolver(server, platform) {
|
|
4
|
+
const bundler = server.getBundler().getBundler();
|
|
5
|
+
const depGraph = await bundler.getDependencyGraph();
|
|
6
|
+
const resolve = ({ from, to })=>{
|
|
7
|
+
const config = {
|
|
8
|
+
name: to,
|
|
9
|
+
data: {
|
|
10
|
+
asyncType: null,
|
|
11
|
+
key: to,
|
|
12
|
+
locs: []
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const options = {
|
|
16
|
+
assumeFlatNodeModules: false
|
|
17
|
+
};
|
|
18
|
+
const res = depGraph.resolveDependency(from, config, platform, {}, options);
|
|
19
|
+
return res.filePath;
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
resolve
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export { createResolver };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ConfigT } from 'metro-config';
|
|
2
|
+
import type Server from 'metro/src/Server';
|
|
3
|
+
import type { OutputOptions, RequestOptions } from 'metro/src/shared/types';
|
|
4
|
+
interface Command {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
func: () => Promise<void>;
|
|
8
|
+
options: {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
interface CommunityCliPlugin {
|
|
14
|
+
bundleCommand: Command;
|
|
15
|
+
startCommand: Command;
|
|
16
|
+
unstable_buildBundleWithConfig: (args: unknown, config: ConfigT, bundleImpl: {
|
|
17
|
+
build: (server: Server, requestOpts: RequestOptions) => Promise<{
|
|
18
|
+
code: string;
|
|
19
|
+
map: string;
|
|
20
|
+
}>;
|
|
21
|
+
save: (bundle: {
|
|
22
|
+
code: string;
|
|
23
|
+
map: string;
|
|
24
|
+
}, options: OutputOptions, log: (msg: string) => void) => Promise<void>;
|
|
25
|
+
formatName: 'bundle';
|
|
26
|
+
}) => Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export declare function getCommunityCliPlugin(reactNativePath?: string): CommunityCliPlugin;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
getCommunityCliPlugin: ()=>getCommunityCliPlugin
|
|
28
|
+
});
|
|
29
|
+
const errors_js_namespaceObject = require("../../utils/errors.js");
|
|
30
|
+
function getCommunityCliPlugin(reactNativePath) {
|
|
31
|
+
let communityCliPlugin;
|
|
32
|
+
try {
|
|
33
|
+
const communityCliPluginPath = require.resolve('@react-native/community-cli-plugin', {
|
|
34
|
+
paths: [
|
|
35
|
+
reactNativePath ?? require.resolve('react-native')
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
communityCliPlugin = require(communityCliPluginPath);
|
|
39
|
+
} catch {
|
|
40
|
+
throw new errors_js_namespaceObject.CLIError('Community CLI plugin is not installed.');
|
|
41
|
+
}
|
|
42
|
+
return communityCliPlugin;
|
|
43
|
+
}
|
|
44
|
+
exports.getCommunityCliPlugin = __webpack_exports__.getCommunityCliPlugin;
|
|
45
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
46
|
+
"getCommunityCliPlugin"
|
|
47
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
48
|
+
Object.defineProperty(exports, '__esModule', {
|
|
49
|
+
value: true
|
|
50
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import __rslib_shim_module__ from 'module';
|
|
2
|
+
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
|
|
3
|
+
import { CLIError } from "../../utils/errors.mjs";
|
|
4
|
+
function getCommunityCliPlugin(reactNativePath) {
|
|
5
|
+
let communityCliPlugin;
|
|
6
|
+
try {
|
|
7
|
+
const communityCliPluginPath = require.resolve('@react-native/community-cli-plugin', {
|
|
8
|
+
paths: [
|
|
9
|
+
reactNativePath ?? require.resolve('react-native')
|
|
10
|
+
]
|
|
11
|
+
});
|
|
12
|
+
communityCliPlugin = require(communityCliPluginPath);
|
|
13
|
+
} catch {
|
|
14
|
+
throw new CLIError('Community CLI plugin is not installed.');
|
|
15
|
+
}
|
|
16
|
+
return communityCliPlugin;
|
|
17
|
+
}
|
|
18
|
+
export { getCommunityCliPlugin };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
default: ()=>loadMetroConfig
|
|
37
|
+
});
|
|
38
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
39
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
40
|
+
const external_metro_config_namespaceObject = require("metro-config");
|
|
41
|
+
const errors_js_namespaceObject = require("../../utils/errors.js");
|
|
42
|
+
function getOverrideConfig(cfg, config) {
|
|
43
|
+
const nodePath = external_node_path_default();
|
|
44
|
+
const resolver = {
|
|
45
|
+
platforms: [
|
|
46
|
+
...Object.keys(cfg.platforms),
|
|
47
|
+
'native'
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
resolver,
|
|
52
|
+
serializer: {
|
|
53
|
+
getModulesRunBeforeMainModule: (entryFilePath)=>{
|
|
54
|
+
var _config_serializer_getModulesRunBeforeMainModule, _config_serializer;
|
|
55
|
+
return [
|
|
56
|
+
...(null == (_config_serializer = config.serializer) ? void 0 : null == (_config_serializer_getModulesRunBeforeMainModule = _config_serializer.getModulesRunBeforeMainModule) ? void 0 : _config_serializer_getModulesRunBeforeMainModule.call(_config_serializer, entryFilePath)) || [],
|
|
57
|
+
require.resolve(nodePath.join(cfg.reactNativePath, 'Libraries/Core/InitializeCore'), {
|
|
58
|
+
paths: [
|
|
59
|
+
cfg.root
|
|
60
|
+
]
|
|
61
|
+
})
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
async function loadMetroConfig(cfg, options = {}) {
|
|
68
|
+
const cwd = cfg.root;
|
|
69
|
+
const projectConfig = await (0, external_metro_config_namespaceObject.resolveConfig)(options.config, cwd);
|
|
70
|
+
if (projectConfig.isEmpty) throw new errors_js_namespaceObject.CLIError(`No Metro config found in ${cwd}`);
|
|
71
|
+
const config = await (0, external_metro_config_namespaceObject.loadConfig)({
|
|
72
|
+
cwd,
|
|
73
|
+
...options
|
|
74
|
+
});
|
|
75
|
+
const overrideConfig = getOverrideConfig(cfg, config);
|
|
76
|
+
return (0, external_metro_config_namespaceObject.mergeConfig)(config, overrideConfig);
|
|
77
|
+
}
|
|
78
|
+
exports["default"] = __webpack_exports__["default"];
|
|
79
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
80
|
+
"default"
|
|
81
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
82
|
+
Object.defineProperty(exports, '__esModule', {
|
|
83
|
+
value: true
|
|
84
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import __rslib_shim_module__ from 'module';
|
|
2
|
+
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
|
|
3
|
+
import node_path from "node:path";
|
|
4
|
+
import { CLIError } from "../../utils/errors.mjs";
|
|
5
|
+
import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "node:module";
|
|
6
|
+
const external_metro_config_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("metro-config");
|
|
7
|
+
function getOverrideConfig(cfg, config) {
|
|
8
|
+
const nodePath = node_path;
|
|
9
|
+
const resolver = {
|
|
10
|
+
platforms: [
|
|
11
|
+
...Object.keys(cfg.platforms),
|
|
12
|
+
'native'
|
|
13
|
+
]
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
resolver,
|
|
17
|
+
serializer: {
|
|
18
|
+
getModulesRunBeforeMainModule: (entryFilePath)=>{
|
|
19
|
+
var _config_serializer_getModulesRunBeforeMainModule, _config_serializer;
|
|
20
|
+
return [
|
|
21
|
+
...(null == (_config_serializer = config.serializer) ? void 0 : null == (_config_serializer_getModulesRunBeforeMainModule = _config_serializer.getModulesRunBeforeMainModule) ? void 0 : _config_serializer_getModulesRunBeforeMainModule.call(_config_serializer, entryFilePath)) || [],
|
|
22
|
+
require.resolve(nodePath.join(cfg.reactNativePath, 'Libraries/Core/InitializeCore'), {
|
|
23
|
+
paths: [
|
|
24
|
+
cfg.root
|
|
25
|
+
]
|
|
26
|
+
})
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
async function loadMetroConfig(cfg, options = {}) {
|
|
33
|
+
const cwd = cfg.root;
|
|
34
|
+
const projectConfig = await (0, external_metro_config_namespaceObject.resolveConfig)(options.config, cwd);
|
|
35
|
+
if (projectConfig.isEmpty) throw new CLIError(`No Metro config found in ${cwd}`);
|
|
36
|
+
const config = await (0, external_metro_config_namespaceObject.loadConfig)({
|
|
37
|
+
cwd,
|
|
38
|
+
...options
|
|
39
|
+
});
|
|
40
|
+
const overrideConfig = getOverrideConfig(cfg, config);
|
|
41
|
+
return (0, external_metro_config_namespaceObject.mergeConfig)(config, overrideConfig);
|
|
42
|
+
}
|
|
43
|
+
export { loadMetroConfig as default };
|