@rnx-kit/cli 0.16.21 → 0.16.23
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/lib/bundle/hermes.js +14 -6
- package/package.json +21 -10
- package/src/bundle/hermes.ts +18 -8
- package/CHANGELOG.md +0 -1659
- package/coverage/clover.xml +0 -323
- package/coverage/coverage-final.json +0 -8
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -131
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/src/bundle/defaultPlugins.ts.html +0 -133
- package/coverage/lcov-report/src/bundle/index.html +0 -161
- package/coverage/lcov-report/src/bundle/kit-config.ts.html +0 -328
- package/coverage/lcov-report/src/bundle/metro.ts.html +0 -283
- package/coverage/lcov-report/src/bundle/overrides.ts.html +0 -238
- package/coverage/lcov-report/src/copy-assets.ts.html +0 -1720
- package/coverage/lcov-report/src/index.html +0 -146
- package/coverage/lcov-report/src/metro-config.ts.html +0 -709
- package/coverage/lcov-report/src/test.ts.html +0 -496
- package/coverage/lcov.info +0 -605
- package/eslint.config.js +0 -1
- package/lib/align-deps.d.ts.map +0 -1
- package/lib/align-deps.js.map +0 -1
- package/lib/bundle/cliOptions.d.ts.map +0 -1
- package/lib/bundle/cliOptions.js.map +0 -1
- package/lib/bundle/defaultPlugins.d.ts.map +0 -1
- package/lib/bundle/defaultPlugins.js.map +0 -1
- package/lib/bundle/hermes.d.ts.map +0 -1
- package/lib/bundle/hermes.js.map +0 -1
- package/lib/bundle/kit-config.d.ts.map +0 -1
- package/lib/bundle/kit-config.js.map +0 -1
- package/lib/bundle/metro.d.ts.map +0 -1
- package/lib/bundle/metro.js.map +0 -1
- package/lib/bundle/overrides.d.ts.map +0 -1
- package/lib/bundle/overrides.js.map +0 -1
- package/lib/bundle/types.d.ts.map +0 -1
- package/lib/bundle/types.js.map +0 -1
- package/lib/bundle.d.ts.map +0 -1
- package/lib/bundle.js.map +0 -1
- package/lib/clean.d.ts.map +0 -1
- package/lib/clean.js.map +0 -1
- package/lib/copy-assets.d.ts.map +0 -1
- package/lib/copy-assets.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/metro-config.d.ts.map +0 -1
- package/lib/metro-config.js.map +0 -1
- package/lib/parsers.d.ts.map +0 -1
- package/lib/parsers.js.map +0 -1
- package/lib/ram-bundle.d.ts.map +0 -1
- package/lib/ram-bundle.js.map +0 -1
- package/lib/serve/external.d.ts.map +0 -1
- package/lib/serve/external.js.map +0 -1
- package/lib/serve/help.d.ts.map +0 -1
- package/lib/serve/help.js.map +0 -1
- package/lib/serve/keyboard.d.ts.map +0 -1
- package/lib/serve/keyboard.js.map +0 -1
- package/lib/serve/kit-config.d.ts.map +0 -1
- package/lib/serve/kit-config.js.map +0 -1
- package/lib/serve/types.d.ts.map +0 -1
- package/lib/serve/types.js.map +0 -1
- package/lib/start.d.ts.map +0 -1
- package/lib/start.js.map +0 -1
- package/lib/test.d.ts.map +0 -1
- package/lib/test.js.map +0 -1
- package/lib/write-third-party-notices.d.ts.map +0 -1
- package/lib/write-third-party-notices.js.map +0 -1
- package/test/__mocks__/child_process.js +0 -5
- package/test/__mocks__/fs-extra.js +0 -20
- package/test/__mocks__/fs.js +0 -1
- package/test/bundle/__mocks__/@rnx-kit/config.js +0 -14
- package/test/bundle/__mocks__/@rnx-kit/console.js +0 -1
- package/test/bundle/__mocks__/@rnx-kit/metro-service.js +0 -1
- package/test/bundle/kit-config.test.ts +0 -160
- package/test/bundle/metro.test.ts +0 -78
- package/test/bundle/overrides.test.ts +0 -85
- package/test/copy-assets/assembleAarBundle.test.ts +0 -313
- package/test/copy-assets/copyAssets.test.ts +0 -122
- package/test/metro-config.test.ts +0 -206
- package/test/test.test.ts +0 -11
- package/tsconfig.json +0 -4
package/lib/bundle/hermes.js
CHANGED
|
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.emitBytecode = void 0;
|
|
27
27
|
const console_1 = require("@rnx-kit/console");
|
|
28
28
|
const package_1 = require("@rnx-kit/tools-node/package");
|
|
29
|
+
const metro_1 = require("@rnx-kit/tools-react-native/metro");
|
|
29
30
|
const child_process_1 = require("child_process");
|
|
30
31
|
const fs = __importStar(require("fs"));
|
|
31
32
|
const os = __importStar(require("os"));
|
|
@@ -77,9 +78,6 @@ function getOutput(args) {
|
|
|
77
78
|
}
|
|
78
79
|
return null;
|
|
79
80
|
}
|
|
80
|
-
function isSourceMapFlag(flag) {
|
|
81
|
-
return flag === "-source-map" || flag.startsWith("-source-map=");
|
|
82
|
-
}
|
|
83
81
|
function emitBytecode(input, sourcemap, options) {
|
|
84
82
|
var _a;
|
|
85
83
|
const cmd = options.command || findHermesBinary();
|
|
@@ -103,15 +101,25 @@ function emitBytecode(input, sourcemap, options) {
|
|
|
103
101
|
output = input + ".hbc";
|
|
104
102
|
args.push("-out", output);
|
|
105
103
|
}
|
|
106
|
-
if (sourcemap && !args.some(isSourceMapFlag)) {
|
|
107
|
-
args.push("-source-map", sourcemap);
|
|
108
|
-
}
|
|
109
104
|
args.push(input);
|
|
110
105
|
(0, console_1.info)("Emitting bytecode to:", output);
|
|
111
106
|
const result = (0, child_process_1.spawnSync)(cmd, args, { stdio: "inherit" });
|
|
112
107
|
if (result.status !== 0) {
|
|
113
108
|
throw result.error;
|
|
114
109
|
}
|
|
110
|
+
if (sourcemap && args.includes("-output-source-map")) {
|
|
111
|
+
const outputMap = output + ".map";
|
|
112
|
+
(0, console_1.info)(`Combining source maps: ${sourcemap} + ${outputMap}`);
|
|
113
|
+
const options = { encoding: "utf-8" };
|
|
114
|
+
const packagerSourcemap = JSON.parse(fs.readFileSync(sourcemap, options));
|
|
115
|
+
const compilerSourcemap = JSON.parse(fs.readFileSync(outputMap, options));
|
|
116
|
+
// `composeSourceMaps` was introduced in 0.56 — see
|
|
117
|
+
// https://github.com/facebook/metro/commit/6017085bdad96ca5cec39d50038eb5622ce1097b
|
|
118
|
+
// @ts-expect-error Property 'composeSourceMaps' does not exist
|
|
119
|
+
const { composeSourceMaps } = (0, metro_1.requireModuleFromMetro)("metro-source-map");
|
|
120
|
+
const composed = composeSourceMaps([packagerSourcemap, compilerSourcemap]);
|
|
121
|
+
fs.writeFileSync(outputMap, JSON.stringify(composed));
|
|
122
|
+
}
|
|
115
123
|
}
|
|
116
124
|
exports.emitBytecode = emitBytecode;
|
|
117
125
|
//# sourceMappingURL=hermes.js.map
|
package/package.json
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rnx-kit/cli",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.23",
|
|
4
4
|
"description": "Command-line interface for working with kit packages in your repo",
|
|
5
5
|
"homepage": "https://github.com/microsoft/rnx-kit/tree/main/packages/cli#readme",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Microsoft Open Source",
|
|
9
|
+
"email": "microsoftopensource@users.noreply.github.com"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"lib/**/*.d.ts",
|
|
13
|
+
"lib/**/*.js",
|
|
14
|
+
"react-native.config.js",
|
|
15
|
+
"src"
|
|
16
|
+
],
|
|
7
17
|
"main": "lib/index.js",
|
|
8
18
|
"types": "lib/index.d.ts",
|
|
9
19
|
"exports": {
|
|
@@ -27,7 +37,7 @@
|
|
|
27
37
|
"test": "rnx-kit-scripts test"
|
|
28
38
|
},
|
|
29
39
|
"dependencies": {
|
|
30
|
-
"@rnx-kit/align-deps": "^2.
|
|
40
|
+
"@rnx-kit/align-deps": "^2.3.3",
|
|
31
41
|
"@rnx-kit/config": "^0.6.6",
|
|
32
42
|
"@rnx-kit/console": "^1.0.11",
|
|
33
43
|
"@rnx-kit/metro-plugin-cyclic-dependencies-detector": "^1.1.1",
|
|
@@ -39,7 +49,7 @@
|
|
|
39
49
|
"@rnx-kit/third-party-notices": "^1.3.4",
|
|
40
50
|
"@rnx-kit/tools-language": "^2.0.0",
|
|
41
51
|
"@rnx-kit/tools-node": "^2.1.1",
|
|
42
|
-
"@rnx-kit/tools-react-native": "^1.3.
|
|
52
|
+
"@rnx-kit/tools-react-native": "^1.3.5",
|
|
43
53
|
"chalk": "^4.1.0",
|
|
44
54
|
"fs-extra": "^10.0.0",
|
|
45
55
|
"node-fetch": "^2.6.7",
|
|
@@ -62,26 +72,27 @@
|
|
|
62
72
|
"devDependencies": {
|
|
63
73
|
"@babel/core": "^7.20.0",
|
|
64
74
|
"@babel/preset-env": "^7.20.0",
|
|
65
|
-
"@react-native-community/cli-clean": "^
|
|
66
|
-
"@react-native-community/cli-types": "^
|
|
75
|
+
"@react-native-community/cli-clean": "^12.3.0",
|
|
76
|
+
"@react-native-community/cli-types": "^12.3.0",
|
|
67
77
|
"@rnx-kit/eslint-config": "*",
|
|
68
78
|
"@rnx-kit/jest-preset": "*",
|
|
69
79
|
"@rnx-kit/scripts": "*",
|
|
80
|
+
"@rnx-kit/tsconfig": "*",
|
|
70
81
|
"@types/connect": "^3.4.36",
|
|
71
82
|
"@types/fs-extra": "^9.0.0",
|
|
72
83
|
"@types/jest": "^29.2.1",
|
|
73
84
|
"@types/node": "^20.0.0",
|
|
74
85
|
"@types/node-fetch": "^2.6.5",
|
|
75
86
|
"@types/qrcode": "^1.4.2",
|
|
76
|
-
"eslint": "^8.
|
|
87
|
+
"eslint": "^8.56.0",
|
|
77
88
|
"jest": "^29.2.1",
|
|
78
89
|
"memfs": "^4.0.0",
|
|
79
|
-
"metro": "^0.
|
|
80
|
-
"metro-babel-transformer": "^0.
|
|
81
|
-
"metro-config": "^0.
|
|
90
|
+
"metro": "^0.80.0",
|
|
91
|
+
"metro-babel-transformer": "^0.80.0",
|
|
92
|
+
"metro-config": "^0.80.0",
|
|
82
93
|
"prettier": "^3.0.0",
|
|
83
94
|
"react": "18.2.0",
|
|
84
|
-
"react-native": "^0.
|
|
95
|
+
"react-native": "^0.73.0",
|
|
85
96
|
"type-fest": "^4.0.0",
|
|
86
97
|
"typescript": "^5.0.0"
|
|
87
98
|
},
|
package/src/bundle/hermes.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { HermesOptions } from "@rnx-kit/config";
|
|
2
2
|
import { error, info } from "@rnx-kit/console";
|
|
3
3
|
import { findPackageDependencyDir } from "@rnx-kit/tools-node/package";
|
|
4
|
+
import { requireModuleFromMetro } from "@rnx-kit/tools-react-native/metro";
|
|
4
5
|
import { spawnSync } from "child_process";
|
|
5
6
|
import * as fs from "fs";
|
|
6
7
|
import * as os from "os";
|
|
@@ -57,10 +58,6 @@ function getOutput(args: string[]): string | null {
|
|
|
57
58
|
return null;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
function isSourceMapFlag(flag: string): boolean {
|
|
61
|
-
return flag === "-source-map" || flag.startsWith("-source-map=");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
61
|
export function emitBytecode(
|
|
65
62
|
input: string,
|
|
66
63
|
sourcemap: string | undefined,
|
|
@@ -90,10 +87,6 @@ export function emitBytecode(
|
|
|
90
87
|
args.push("-out", output);
|
|
91
88
|
}
|
|
92
89
|
|
|
93
|
-
if (sourcemap && !args.some(isSourceMapFlag)) {
|
|
94
|
-
args.push("-source-map", sourcemap);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
90
|
args.push(input);
|
|
98
91
|
|
|
99
92
|
info("Emitting bytecode to:", output);
|
|
@@ -101,4 +94,21 @@ export function emitBytecode(
|
|
|
101
94
|
if (result.status !== 0) {
|
|
102
95
|
throw result.error;
|
|
103
96
|
}
|
|
97
|
+
|
|
98
|
+
if (sourcemap && args.includes("-output-source-map")) {
|
|
99
|
+
const outputMap = output + ".map";
|
|
100
|
+
info(`Combining source maps: ${sourcemap} + ${outputMap}`);
|
|
101
|
+
|
|
102
|
+
const options = { encoding: "utf-8" } as const;
|
|
103
|
+
const packagerSourcemap = JSON.parse(fs.readFileSync(sourcemap, options));
|
|
104
|
+
const compilerSourcemap = JSON.parse(fs.readFileSync(outputMap, options));
|
|
105
|
+
|
|
106
|
+
// `composeSourceMaps` was introduced in 0.56 — see
|
|
107
|
+
// https://github.com/facebook/metro/commit/6017085bdad96ca5cec39d50038eb5622ce1097b
|
|
108
|
+
// @ts-expect-error Property 'composeSourceMaps' does not exist
|
|
109
|
+
const { composeSourceMaps } = requireModuleFromMetro("metro-source-map");
|
|
110
|
+
|
|
111
|
+
const composed = composeSourceMaps([packagerSourcemap, compilerSourcemap]);
|
|
112
|
+
fs.writeFileSync(outputMap, JSON.stringify(composed));
|
|
113
|
+
}
|
|
104
114
|
}
|