@react-native-oh/react-native-harmony-cli 0.0.40 → 0.0.42
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/README.md +11 -11
- package/dist/assetResolver.js +74 -77
- package/dist/autolinking/Autolinking.js +179 -179
- package/dist/autolinking/JSON5Writer.js +61 -0
- package/dist/codegen/core/CodegenError.js +3 -23
- package/dist/codegen/core/EventUtils.js +3 -3
- package/dist/codegen/core/TypeAnnotationToTS.js +24 -28
- package/dist/codegen/core/UberSchema.js +57 -96
- package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +28 -41
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +27 -34
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +25 -33
- package/dist/codegen/generators/CppComponentCodeGenerator.js +23 -28
- package/dist/codegen/generators/LibGlueCodeGenerator.js +26 -29
- package/dist/codegen/generators/NativeModuleCodeGenerator.js +25 -30
- package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
- package/dist/codegen/generators/UberGeneratorV1.js +24 -23
- package/dist/codegen/generators/UberGeneratorV2.js +34 -35
- package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +50 -24
- package/dist/codegen/templates/BasePackageHTemplate.js +120 -21
- package/dist/codegen/templates/ComponentDescriptorHTemplate.js +53 -8
- package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +75 -27
- package/dist/codegen/templates/ComponentUtilsTSTemplate.js +162 -29
- package/dist/codegen/templates/IndexTSTemplate.js +37 -17
- package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +119 -24
- package/dist/codegen/templates/TurboModuleCppTemplate.js +38 -15
- package/dist/codegen/templates/TurboModuleHTemplate.js +32 -11
- package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +52 -19
- package/dist/commands/bundle-harmony.js +65 -138
- package/dist/commands/codegen-harmony.js +105 -165
- package/dist/commands/codegen-lib-harmony.js +76 -116
- package/dist/commands/create-metro-host-constants.js +18 -47
- package/dist/commands/init.js +537 -961
- package/dist/commands/link-harmony.js +33 -71
- package/dist/commands/pack-harmony.js +47 -108
- package/dist/commands/run-harmony.js +372 -518
- package/dist/commands/unpack-harmony.js +105 -198
- package/dist/commands/verify-package-harmony.js +54 -108
- package/dist/core/AbsolutePath.js +31 -47
- package/dist/core/CodegenConfig.js +24 -22
- package/dist/core/DescriptiveError.js +18 -37
- package/dist/core/FileSystem.js +14 -18
- package/dist/core/OHPackageJSON5.js +17 -23
- package/dist/core/PackageJSON.js +26 -42
- package/dist/core/ProjectDependenciesManager.js +40 -92
- package/dist/core/ValidationError.js +2 -22
- package/dist/core/fs.js +9 -6
- package/dist/index.js +1 -1
- package/dist/io/CliExecutor.js +46 -98
- package/dist/io/Logger.js +40 -46
- package/dist/io/RealFS.js +35 -88
- package/dist/io/TarGz.js +11 -8
- package/dist/io/__fixtures__.js +79 -141
- package/dist/io/fsUtils.js +13 -12
- package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +19 -47
- package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +13 -41
- package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +8 -38
- package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +22 -54
- package/dist/package-verifier/verify-package.js +55 -132
- package/dist/simulator/LaunchSimulator.js +224 -301
- package/harmony/rnoh-hvigor-plugin-0.3.0.tgz +0 -0
- package/jest.config.js +12 -12
- package/package.json +79 -78
- package/react-native.config.js +17 -17
- package/tsconfig.build.json +6 -6
- package/tsconfig.json +2 -2
|
@@ -14,38 +14,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
20
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
21
|
-
function step(op) {
|
|
22
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
23
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
24
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
25
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
26
|
-
switch (op[0]) {
|
|
27
|
-
case 0: case 1: t = op; break;
|
|
28
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
29
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
30
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
31
|
-
default:
|
|
32
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
33
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
34
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
35
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
36
|
-
if (t[2]) _.ops.pop();
|
|
37
|
-
_.trys.pop(); continue;
|
|
38
|
-
}
|
|
39
|
-
op = body.call(thisArg, _);
|
|
40
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
41
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
42
|
-
}
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
19
|
};
|
|
44
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
21
|
exports.commandCreateMetroConstantsHarmony = void 0;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
22
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
23
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
24
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
49
25
|
exports.commandCreateMetroConstantsHarmony = {
|
|
50
26
|
name: 'create-metro-host-constants-harmony',
|
|
51
27
|
description: 'Creates a Typescript file that exports constant with IP of the host machine. That IP is later used to connect to the Metro server from a physical device.',
|
|
@@ -56,21 +32,16 @@ exports.commandCreateMetroConstantsHarmony = {
|
|
|
56
32
|
default: './harmony/entry/src/main/ets/codegen/MetroHostConstants.ts',
|
|
57
33
|
},
|
|
58
34
|
],
|
|
59
|
-
func:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return [2 /*return*/];
|
|
63
|
-
});
|
|
64
|
-
}); },
|
|
35
|
+
func: (argv, config, args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
createMetroHostConstants(node_path_1.default.resolve(args.output));
|
|
37
|
+
}),
|
|
65
38
|
};
|
|
66
39
|
function createMetroHostConstants(outputPath) {
|
|
67
|
-
|
|
68
|
-
|
|
40
|
+
const networkInterfacesByName = node_os_1.default.networkInterfaces();
|
|
41
|
+
const getIP = () => {
|
|
69
42
|
var _a;
|
|
70
|
-
for (
|
|
71
|
-
|
|
72
|
-
for (var _c = 0, _d = (_a = networkInterfacesByName[name_1]) !== null && _a !== void 0 ? _a : []; _c < _d.length; _c++) {
|
|
73
|
-
var net = _d[_c];
|
|
43
|
+
for (let name of Object.keys(networkInterfacesByName)) {
|
|
44
|
+
for (let net of (_a = networkInterfacesByName[name]) !== null && _a !== void 0 ? _a : []) {
|
|
74
45
|
// skip over non-ipv4 and internal (i.e. 127.0.0.1) addresses
|
|
75
46
|
if (net.family === 'IPv4' && !net.internal) {
|
|
76
47
|
return net.address;
|
|
@@ -79,18 +50,18 @@ function createMetroHostConstants(outputPath) {
|
|
|
79
50
|
}
|
|
80
51
|
return;
|
|
81
52
|
};
|
|
82
|
-
|
|
83
|
-
|
|
53
|
+
const ip = getIP();
|
|
54
|
+
const tsCode = [
|
|
84
55
|
'// This file is autogenerated. Do not modify it manually.',
|
|
85
56
|
'',
|
|
86
|
-
|
|
57
|
+
`export const METRO_SERVER_IP = '${ip}';\n`,
|
|
87
58
|
];
|
|
88
|
-
node_fs_1.default.writeFile(outputPath, tsCode.join('\n'),
|
|
59
|
+
node_fs_1.default.writeFile(outputPath, tsCode.join('\n'), (err) => {
|
|
89
60
|
if (err) {
|
|
90
|
-
console.error(
|
|
61
|
+
console.error(`Error writing to ${outputPath}:`, err);
|
|
91
62
|
}
|
|
92
63
|
else {
|
|
93
|
-
console.log(
|
|
64
|
+
console.log(`Created file at ${outputPath}`);
|
|
94
65
|
}
|
|
95
66
|
});
|
|
96
67
|
}
|