@react-native-oh/react-native-harmony-cli 0.82.30 → 0.82.32
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 +4 -4
- package/dist/codegen/core/CodeGenerator.js +6 -0
- package/dist/codegen/core/CodegenError.js +6 -0
- package/dist/codegen/core/EventUtils.js +6 -0
- package/dist/codegen/core/TypeAnnotationToTS.js +6 -0
- package/dist/codegen/core/UberSchema.js +6 -0
- package/dist/codegen/core/index.js +6 -0
- package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +6 -0
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +6 -0
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +6 -0
- package/dist/codegen/generators/CppComponentCodeGenerator.js +6 -0
- package/dist/codegen/generators/LibGlueCodeGenerator.js +22 -6
- package/dist/codegen/generators/NativeModuleCodeGenerator.js +6 -0
- package/dist/codegen/generators/SharedComponentCodeGenerator.js +6 -0
- package/dist/codegen/generators/UberGeneratorV1.js +6 -0
- package/dist/codegen/generators/UberGeneratorV2.js +6 -0
- package/dist/codegen/generators/index.js +6 -0
- package/dist/codegen/index.js +6 -0
- package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +6 -0
- package/dist/codegen/templates/BasePackageHTemplate.js +6 -0
- package/dist/codegen/templates/ComponentDescriptorHTemplate.js +6 -0
- package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +6 -0
- package/dist/codegen/templates/ComponentUtilsTSTemplate.js +6 -0
- package/dist/codegen/templates/IndexTSTemplate.js +6 -0
- package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +6 -0
- package/dist/codegen/templates/TurboModuleCppTemplate.js +6 -0
- package/dist/codegen/templates/TurboModuleHTemplate.js +6 -0
- package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +6 -0
- package/dist/codegen/templates/index.js +6 -0
- package/dist/commands/bundle-harmony.js +6 -0
- package/dist/commands/clean-harmony.js +6 -0
- package/dist/commands/codegen-harmony.js +6 -0
- package/dist/commands/codegen-lib-harmony.js +84 -40
- package/dist/commands/index.js +6 -0
- package/dist/commands/init-harmony.js +6 -0
- package/dist/commands/link-harmony.js +6 -0
- package/dist/commands/types.js +6 -0
- package/dist/commands/verify-package-harmony.js +6 -0
- package/dist/core/AbsolutePath.js +6 -0
- package/dist/core/CodegenConfig.js +6 -0
- package/dist/core/DescriptiveError.js +6 -0
- package/dist/core/FileSystem.js +6 -0
- package/dist/core/OHPackageJSON5.js +6 -0
- package/dist/core/ValidationError.js +6 -0
- package/dist/core/ValueObject.js +6 -0
- package/dist/core/fs.js +6 -0
- package/dist/core/index.js +6 -0
- package/dist/index.js +6 -0
- package/dist/init/templates/AppScopeAppJSON5Template.js +6 -0
- package/dist/init/templates/AppScopeStringVarTemplate.js +6 -0
- package/dist/init/templates/EntryIndexTemplate.js +6 -0
- package/dist/init/templates/EntryStringVarTemplate.js +6 -0
- package/dist/init/templates/HvigorConfigJson5Template.js +6 -0
- package/dist/init/templates/MetroConfigTemplate.js +6 -0
- package/dist/init/templates/OhPackageJson5Template.js +6 -0
- package/dist/init/templates/harmony/entry/gitignore +5 -0
- package/dist/init/templates/harmony/entry/src/main/cpp/gitignore +5 -0
- package/dist/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +7 -0
- package/dist/init/templates/harmony/entry/src/main/ets/codegen/gitignore +5 -0
- package/dist/init/templates/harmony/entry/src/main/ets/entryability/EntryAbility.ets +7 -0
- package/dist/init/templates/harmony/entry/src/main/ets/gitignore +5 -0
- package/dist/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +7 -0
- package/dist/init/templates/harmony/entry/src/main/resources/gitignore +5 -0
- package/dist/init/templates/harmony/entry/src/ohosTest/ets/test/List.test.ets +7 -0
- package/dist/init/templates/harmony/gitignore +5 -0
- package/dist/init/templates/index.js +6 -0
- package/dist/io/CliExecutor.js +6 -0
- package/dist/io/Logger.js +6 -0
- package/dist/io/RealFS.js +6 -0
- package/dist/io/TarGz.js +6 -0
- package/dist/io/__fixtures__.js +6 -0
- package/dist/io/fsUtils.js +6 -0
- package/dist/io/index.js +6 -0
- package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +6 -0
- package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +6 -0
- package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +6 -0
- package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +6 -0
- package/dist/package-verifier/checks/index.js +6 -0
- package/dist/package-verifier/index.js +6 -0
- package/dist/package-verifier/types.js +6 -0
- package/dist/package-verifier/verify-package.js +6 -0
- package/harmony/rnoh-hvigor-plugin-0.82.32.tgz +0 -0
- package/jest.config.js +7 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/00a68392 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0544a6cc +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0f36b2db +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/12f23f1e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/13d95d98 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1629e86b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/180c8379 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1a697147 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1a8271b1 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1b7fa689 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/255a9f13 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/268d155b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/27db9aa4 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/28db79ed +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2dc2bbcb +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2df5f8c5 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2f88aedb +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/31b3a7ea +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/36335b1c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/38fca641 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/397722eb +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/397b6432 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3b17421f +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/454f5e18 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/45ec6cce +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/482d51b1 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4ac5cd67 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4d40499a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4dcad919 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4fc31929 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/54edc8f5 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/558a5405 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/58d2b670 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5ec7feca +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/62180f3e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/63981360 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/64096c89 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/64af560b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6585e783 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6954304f +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/69fd6235 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6d3a0478 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6e131db7 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/778cd8f1 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/788206b6 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7882dc26 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7b3c14f7 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7cdfe667 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8048c487 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8332d9a3 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/84e5b603 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/854d8127 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/88c97376 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/90d5f644 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/967e25ac +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/969896c2 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/9790193e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/97ae40c5 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/9a5bf482 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a07adeb9 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a427f355 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a9dd7eb7 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a9e9d79e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ab920855 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ab9e3038 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/af054988 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/afe03e51 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b3b83913 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b4db7b4d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b5225355 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b8c00f06 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b917a081 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b9e2f3bd +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/bd70db0e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/bdbda648 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/be1e5469 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c9462295 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ca6e5efa +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/caf52beb +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cb268960 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cca16b15 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cfc1c937 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d10e6e05 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d172fc04 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d4e94e50 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d59f8d2c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/da964053 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e0bb712a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e3e6ca34 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e50f7385 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f1a1d282 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f2514c3c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f66207cf +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f8d129ce +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/fb1e9558 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ff7e3608 +0 -0
- package/package.json +1 -1
- package/react-native.config.js +7 -0
- package/scripts/copy-template.js +7 -0
- package/src/codegen/core/CodeGenerator.ts +7 -0
- package/src/codegen/core/CodegenError.ts +7 -0
- package/src/codegen/core/EventUtils.ts +7 -0
- package/src/codegen/core/TypeAnnotationToTS.test.ts +7 -0
- package/src/codegen/core/TypeAnnotationToTS.ts +7 -0
- package/src/codegen/core/UberSchema.ts +7 -0
- package/src/codegen/core/index.ts +7 -0
- package/src/codegen/generators/AppBuildTimeGlueCodeGenerator.ts +7 -0
- package/src/codegen/generators/ArkTSComponentCodeGeneratorArkTS.ts +7 -0
- package/src/codegen/generators/ArkTSComponentCodeGeneratorCAPI.ts +7 -0
- package/src/codegen/generators/CppComponentCodeGenerator.ts +7 -0
- package/src/codegen/generators/LibGlueCodeGenerator.ts +30 -12
- package/src/codegen/generators/NativeModuleCodeGenerator.ts +7 -0
- package/src/codegen/generators/SharedComponentCodeGenerator.ts +7 -0
- package/src/codegen/generators/UberGeneratorV1.ts +7 -0
- package/src/codegen/generators/UberGeneratorV2.ts +7 -0
- package/src/codegen/generators/index.ts +7 -0
- package/src/codegen/index.ts +7 -0
- package/src/codegen/templates/BaseComponentInstanceHTemplate.ts +7 -0
- package/src/codegen/templates/BasePackageHTemplate.ts +7 -0
- package/src/codegen/templates/ComponentDescriptorHTemplate.ts +7 -0
- package/src/codegen/templates/ComponentJSIBinderHTemplate.ts +7 -0
- package/src/codegen/templates/ComponentUtilsTSTemplate.ts +7 -0
- package/src/codegen/templates/IndexTSTemplate.ts +7 -0
- package/src/codegen/templates/RNOHGeneratedPackageHTemplate.ts +7 -0
- package/src/codegen/templates/TurboModuleCppTemplate.ts +7 -0
- package/src/codegen/templates/TurboModuleHTemplate.ts +7 -0
- package/src/codegen/templates/TurboModuleSpecTSTemplate.ts +7 -0
- package/src/codegen/templates/index.ts +7 -0
- package/src/commands/bundle-harmony.ts +7 -0
- package/src/commands/clean-harmony.ts +7 -0
- package/src/commands/codegen-harmony.ts +7 -0
- package/src/commands/codegen-lib-harmony.ts +117 -56
- package/src/commands/index.ts +7 -0
- package/src/commands/init-harmony.ts +7 -0
- package/src/commands/link-harmony.ts +7 -0
- package/src/commands/types.ts +7 -0
- package/src/commands/verify-package-harmony.ts +7 -0
- package/src/core/AbsolutePath.ts +7 -0
- package/src/core/CodegenConfig.ts +7 -0
- package/src/core/DescriptiveError.ts +7 -0
- package/src/core/FileSystem.ts +7 -0
- package/src/core/OHPackageJSON5.ts +7 -0
- package/src/core/ValidationError.ts +7 -0
- package/src/core/ValueObject.ts +7 -0
- package/src/core/fs.ts +7 -0
- package/src/core/index.ts +7 -0
- package/src/index.ts +7 -0
- package/src/init/templates/AppScopeAppJSON5Template.ts +7 -0
- package/src/init/templates/AppScopeStringVarTemplate.ts +7 -0
- package/src/init/templates/EntryIndexTemplate.ts +7 -0
- package/src/init/templates/EntryStringVarTemplate.ts +7 -0
- package/src/init/templates/HvigorConfigJson5Template.ts +7 -0
- package/src/init/templates/MetroConfigTemplate.ts +7 -0
- package/src/init/templates/OhPackageJson5Template.ts +7 -0
- package/src/init/templates/harmony/entry/gitignore +5 -0
- package/src/init/templates/harmony/entry/src/main/cpp/gitignore +5 -0
- package/src/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +7 -0
- package/src/init/templates/harmony/entry/src/main/ets/codegen/gitignore +5 -0
- package/src/init/templates/harmony/entry/src/main/ets/entryability/EntryAbility.ets +7 -0
- package/src/init/templates/harmony/entry/src/main/ets/gitignore +5 -0
- package/src/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +7 -0
- package/src/init/templates/harmony/entry/src/main/resources/gitignore +5 -0
- package/src/init/templates/harmony/entry/src/ohosTest/ets/test/List.test.ets +7 -0
- package/src/init/templates/harmony/gitignore +5 -0
- package/src/init/templates/index.ts +7 -0
- package/src/io/CliExecutor.ts +7 -0
- package/src/io/Logger.ts +7 -0
- package/src/io/RealFS.ts +7 -0
- package/src/io/TarGz.ts +7 -0
- package/src/io/__fixtures__.ts +7 -0
- package/src/io/fsUtils.ts +7 -0
- package/src/io/index.ts +7 -0
- package/src/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.ts +7 -0
- package/src/package-verifier/checks/HarmonyDirExistsCheck.ts +7 -0
- package/src/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.ts +7 -0
- package/src/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.ts +7 -0
- package/src/package-verifier/checks/index.ts +7 -0
- package/src/package-verifier/index.ts +7 -0
- package/src/package-verifier/types.ts +7 -0
- package/src/package-verifier/verify-package.ts +7 -0
- package/harmony/rnoh-hvigor-plugin-0.82.30.tgz +0 -0
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import { Command } from './types';
|
|
2
9
|
import {
|
|
3
10
|
AbsolutePath,
|
|
@@ -19,6 +26,9 @@ import { LibGlueCodeGenerator } from '../codegen/generators/LibGlueCodeGenerator
|
|
|
19
26
|
|
|
20
27
|
const COMMAND_NAME = 'codegen-lib-harmony';
|
|
21
28
|
|
|
29
|
+
const VALID_GENERATE_TYPES = ['all', 'turbo-module', 'fabric'] as const;
|
|
30
|
+
type GenerateType = (typeof VALID_GENERATE_TYPES)[number];
|
|
31
|
+
|
|
22
32
|
export const commandCodegenLibHarmony: Command = {
|
|
23
33
|
name: COMMAND_NAME,
|
|
24
34
|
description:
|
|
@@ -62,6 +72,14 @@ export const commandCodegenLibHarmony: Command = {
|
|
|
62
72
|
description:
|
|
63
73
|
'Skips the check that prevents file operations outside the current working directory. This command permanently deletes previously generated files. Files are generated in the path specified by cpp-output-path.',
|
|
64
74
|
},
|
|
75
|
+
{
|
|
76
|
+
name: '--generate-type <string>',
|
|
77
|
+
description:
|
|
78
|
+
'Controls which type of code to generate. ' +
|
|
79
|
+
'Possible values: "all" (default, generates both TurboModule and Fabric code), ' +
|
|
80
|
+
'"turbo-module" (generates only TurboModule code), ' +
|
|
81
|
+
'"fabric" (generates only Fabric component code).',
|
|
82
|
+
},
|
|
65
83
|
],
|
|
66
84
|
func: async (_argv, _config, rawArgs: any) => {
|
|
67
85
|
const logger = new Logger();
|
|
@@ -91,6 +109,7 @@ type RawArgs = {
|
|
|
91
109
|
cppOutputPath?: string;
|
|
92
110
|
etsOutputPath?: string;
|
|
93
111
|
safetyCheck?: boolean;
|
|
112
|
+
generateType?: string;
|
|
94
113
|
};
|
|
95
114
|
|
|
96
115
|
function validateArgsAndRetrieveUberSchemaByType(rawArgs: RawArgs) {
|
|
@@ -134,6 +153,7 @@ type Args = {
|
|
|
134
153
|
cppOutputPath: AbsolutePath;
|
|
135
154
|
etsOutputPath: AbsolutePath;
|
|
136
155
|
safetyCheck: boolean;
|
|
156
|
+
generateType: GenerateType;
|
|
137
157
|
};
|
|
138
158
|
|
|
139
159
|
function validateRawArgs(rawArgs: RawArgs): Args {
|
|
@@ -155,6 +175,15 @@ function validateRawArgs(rawArgs: RawArgs): Args {
|
|
|
155
175
|
whatCanUserDo: ['Please specify --ets-output-path'],
|
|
156
176
|
});
|
|
157
177
|
}
|
|
178
|
+
const generateType = (rawArgs.generateType ?? 'all') as GenerateType;
|
|
179
|
+
if (!VALID_GENERATE_TYPES.includes(generateType)) {
|
|
180
|
+
throw new DescriptiveError({
|
|
181
|
+
whatHappened: `Invalid --generate-type value: "${rawArgs.generateType}". Valid values are: ${VALID_GENERATE_TYPES.join(', ')}`,
|
|
182
|
+
whatCanUserDo: [
|
|
183
|
+
`Please specify one of: ${VALID_GENERATE_TYPES.join(', ')}`,
|
|
184
|
+
],
|
|
185
|
+
});
|
|
186
|
+
}
|
|
158
187
|
return {
|
|
159
188
|
npmPackageName: rawArgs.npmPackageName!,
|
|
160
189
|
tmSpecPaths: (rawArgs.turboModulesSpecPaths ?? []).map(
|
|
@@ -169,6 +198,7 @@ function validateRawArgs(rawArgs: RawArgs): Args {
|
|
|
169
198
|
etsOutputPath: new AbsolutePath(rawArgs.etsOutputPath!),
|
|
170
199
|
cppOutputPath: new AbsolutePath(rawArgs.cppOutputPath!),
|
|
171
200
|
safetyCheck: !!rawArgs.safetyCheck,
|
|
201
|
+
generateType,
|
|
172
202
|
};
|
|
173
203
|
}
|
|
174
204
|
|
|
@@ -213,25 +243,36 @@ function generateCodeInMemory({
|
|
|
213
243
|
fileContentByPath.set(path, fileContent);
|
|
214
244
|
};
|
|
215
245
|
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
)
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
246
|
+
const { generateType } = args;
|
|
247
|
+
const shouldGenerateTurboModule =
|
|
248
|
+
generateType === 'all' || generateType === 'turbo-module';
|
|
249
|
+
const shouldGenerateFabric =
|
|
250
|
+
generateType === 'all' || generateType === 'fabric';
|
|
251
|
+
|
|
252
|
+
let turboModuleGlueCodeData: ReturnType<
|
|
253
|
+
NativeModuleCodeGenerator['getGlueCodeData']
|
|
254
|
+
> = [];
|
|
255
|
+
if (shouldGenerateTurboModule) {
|
|
256
|
+
turboModuleGlueCodeData = turboModulesUberSchema
|
|
257
|
+
.findAllSpecSchemasByType('NativeModule')
|
|
258
|
+
.map((specSchema) => {
|
|
259
|
+
const nativeModuleCodeGenerator = new NativeModuleCodeGenerator(
|
|
260
|
+
args.cppOutputPath.copyWithNewSegment(
|
|
261
|
+
'RNOH',
|
|
262
|
+
'generated',
|
|
263
|
+
'turbo_modules'
|
|
264
|
+
),
|
|
265
|
+
args.etsOutputPath.copyWithNewSegment('turboModules'),
|
|
266
|
+
CODEGEN_NOTICE_LINES,
|
|
267
|
+
'@rnoh/react-native-openharmony/ts'
|
|
268
|
+
);
|
|
269
|
+
nativeModuleCodeGenerator
|
|
270
|
+
.generate(specSchema)
|
|
271
|
+
.forEach(appendToFileContentByPath);
|
|
272
|
+
return nativeModuleCodeGenerator.getGlueCodeData();
|
|
273
|
+
})
|
|
274
|
+
.flat();
|
|
275
|
+
}
|
|
235
276
|
|
|
236
277
|
const arkTSComponentCodeGeneratorCAPI = new ArkTSComponentCodeGeneratorCAPI(
|
|
237
278
|
args.cppOutputPath.copyWithNewSegment('RNOH', 'generated', 'components'),
|
|
@@ -239,9 +280,12 @@ function generateCodeInMemory({
|
|
|
239
280
|
CODEGEN_NOTICE_LINES,
|
|
240
281
|
'@rnoh/react-native-openharmony/ts'
|
|
241
282
|
);
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
283
|
+
|
|
284
|
+
if (shouldGenerateFabric) {
|
|
285
|
+
arkTSComponentCodeGeneratorCAPI
|
|
286
|
+
.generate(arkTSComponentsUberSchema)
|
|
287
|
+
.forEach(appendToFileContentByPath);
|
|
288
|
+
}
|
|
245
289
|
|
|
246
290
|
const libraryCppName = deriveLibraryCppNameFromNpmPackageName(
|
|
247
291
|
args.npmPackageName
|
|
@@ -257,27 +301,29 @@ function generateCodeInMemory({
|
|
|
257
301
|
},
|
|
258
302
|
CODEGEN_NOTICE_LINES
|
|
259
303
|
);
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
304
|
+
if (shouldGenerateFabric) {
|
|
305
|
+
cppComponentCodeGenerator
|
|
306
|
+
.generate({
|
|
307
|
+
libraryCppName: libraryCppName,
|
|
308
|
+
uberSchema: cppComponentsUberSchema,
|
|
309
|
+
})
|
|
310
|
+
.forEach(appendToFileContentByPath);
|
|
266
311
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
})
|
|
276
|
-
.generate({
|
|
277
|
-
libraryCppName: libraryCppName,
|
|
278
|
-
uberSchema: componentsUberSchema,
|
|
312
|
+
new SharedComponentCodeGenerator((filename) => {
|
|
313
|
+
return args.cppOutputPath.copyWithNewSegment(
|
|
314
|
+
'react',
|
|
315
|
+
'renderer',
|
|
316
|
+
'components',
|
|
317
|
+
libraryCppName,
|
|
318
|
+
filename
|
|
319
|
+
);
|
|
279
320
|
})
|
|
280
|
-
|
|
321
|
+
.generate({
|
|
322
|
+
libraryCppName: libraryCppName,
|
|
323
|
+
uberSchema: componentsUberSchema,
|
|
324
|
+
})
|
|
325
|
+
.forEach(appendToFileContentByPath);
|
|
326
|
+
}
|
|
281
327
|
|
|
282
328
|
new LibGlueCodeGenerator(
|
|
283
329
|
args.cppOutputPath,
|
|
@@ -286,11 +332,15 @@ function generateCodeInMemory({
|
|
|
286
332
|
)
|
|
287
333
|
.generate({
|
|
288
334
|
libraryCppName,
|
|
289
|
-
arkTSComponents:
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
335
|
+
arkTSComponents: shouldGenerateFabric
|
|
336
|
+
? arkTSComponentCodeGeneratorCAPI.getLibGlueCodeData()
|
|
337
|
+
: [],
|
|
338
|
+
cppComponents: shouldGenerateFabric
|
|
339
|
+
? cppComponentCodeGenerator
|
|
340
|
+
.getGlueCodeData()
|
|
341
|
+
.map(({ name }) => ({ componentName: name }))
|
|
342
|
+
: [],
|
|
343
|
+
turboModules: shouldGenerateTurboModule ? turboModuleGlueCodeData : [],
|
|
294
344
|
})
|
|
295
345
|
.forEach(appendToFileContentByPath);
|
|
296
346
|
|
|
@@ -318,7 +368,8 @@ function saveAndLogCodegenResult(
|
|
|
318
368
|
fileContentByPath,
|
|
319
369
|
args.cppOutputPath,
|
|
320
370
|
args.etsOutputPath,
|
|
321
|
-
args.safetyCheck
|
|
371
|
+
args.safetyCheck,
|
|
372
|
+
args.generateType
|
|
322
373
|
);
|
|
323
374
|
logCodegenResult(logger, fileContentByPath, new AbsolutePath(''));
|
|
324
375
|
}
|
|
@@ -327,18 +378,28 @@ function saveCodegenResultToFileSystem(
|
|
|
327
378
|
fileContentByPath: Map<AbsolutePath, string>,
|
|
328
379
|
cppOutputPath: AbsolutePath,
|
|
329
380
|
etsOutputPath: AbsolutePath,
|
|
330
|
-
enableSafetyCheck: boolean
|
|
381
|
+
enableSafetyCheck: boolean,
|
|
382
|
+
generateType: GenerateType
|
|
331
383
|
) {
|
|
384
|
+
const shouldGenerateTurboModule =
|
|
385
|
+
generateType === 'all' || generateType === 'turbo-module';
|
|
386
|
+
const shouldGenerateFabric =
|
|
387
|
+
generateType === 'all' || generateType === 'fabric';
|
|
388
|
+
|
|
332
389
|
prepareDirectory(cppOutputPath, enableSafetyCheck);
|
|
333
390
|
prepareDirectory(etsOutputPath, enableSafetyCheck);
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
391
|
+
if (shouldGenerateFabric) {
|
|
392
|
+
prepareDirectory(
|
|
393
|
+
etsOutputPath.copyWithNewSegment('components'),
|
|
394
|
+
enableSafetyCheck
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
if (shouldGenerateTurboModule) {
|
|
398
|
+
prepareDirectory(
|
|
399
|
+
etsOutputPath.copyWithNewSegment('turboModules'),
|
|
400
|
+
enableSafetyCheck
|
|
401
|
+
);
|
|
402
|
+
}
|
|
342
403
|
fileContentByPath.forEach((_fileContent, path) => {
|
|
343
404
|
prepareDirectory(path.getDirectoryPath(), enableSafetyCheck);
|
|
344
405
|
});
|
package/src/commands/index.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
export * from './bundle-harmony';
|
|
2
9
|
export * from './codegen-harmony';
|
|
3
10
|
export * from './verify-package-harmony';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import { Command } from './types';
|
|
2
9
|
import { Logger, RealFS } from '../io';
|
|
3
10
|
import {
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import { Command } from './types';
|
|
2
9
|
import { AbsolutePath, DescriptiveError } from '../core';
|
|
3
10
|
import { Logger, RealFS } from '../io';
|
package/src/commands/types.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import { Command as CLICommand } from '@react-native-community/cli-types';
|
|
2
9
|
|
|
3
10
|
// RNOH patch: The parse function in the Command.options type is missing an extra argument in @react-native-community/cli-types.
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import { Command } from './types';
|
|
2
9
|
import { getLoader, Loader } from '@react-native-community/cli-tools';
|
|
3
10
|
import chalk from 'chalk';
|
package/src/core/AbsolutePath.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import pathUtils from 'node:path';
|
|
2
9
|
import { ValueObject } from './ValueObject';
|
|
3
10
|
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import fs from 'node:fs';
|
|
2
9
|
import { AbsolutePath } from './AbsolutePath';
|
|
3
10
|
import { findFilePathsWithExtensions } from '../io';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
export class DescriptiveError extends Error {
|
|
2
9
|
constructor(
|
|
3
10
|
private data:
|
package/src/core/FileSystem.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import { AbsolutePath } from './AbsolutePath';
|
|
2
9
|
import pathUtils from 'node:path';
|
|
3
10
|
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import json5 from 'json5';
|
|
2
9
|
import fs from 'node:fs';
|
|
3
10
|
import { AbsolutePath } from './AbsolutePath';
|
package/src/core/ValueObject.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
/** https://en.wikipedia.org/wiki/Value_object */
|
|
2
9
|
export interface ValueObject {}
|
package/src/core/fs.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import fs from 'node:fs';
|
|
2
9
|
import { AbsolutePath } from './AbsolutePath';
|
|
3
10
|
import { DescriptiveError } from './DescriptiveError';
|
package/src/core/index.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
export * from './AbsolutePath';
|
|
2
9
|
export * from './ValidationError';
|
|
3
10
|
export * from './DescriptiveError';
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import { Config, Command } from '@react-native-community/cli-types';
|
|
2
9
|
import {
|
|
3
10
|
commandBundleHarmony,
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import type { RNPackageContext, RNOHPackage } from '@rnoh/react-native-openharmony';
|
|
2
9
|
import { createRNOHPackages as createRNOHPackagesAutolinking } from "./RNOHPackagesFactory"
|
|
3
10
|
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import {RNAbility} from '@rnoh/react-native-openharmony';
|
|
2
9
|
|
|
3
10
|
export default class EntryAbility extends RNAbility {
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
/**
|
|
2
9
|
* Importing some ets files in the following way results in runtime errors e.g.
|
|
3
10
|
* import { setupRNOHWorker } from "@rnoh/react-native-openharmony"
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
export * from './MetroConfigTemplate';
|
|
2
9
|
export * from './EntryStringVarTemplate';
|
|
3
10
|
export * from './EntryIndexTemplate';
|
package/src/io/CliExecutor.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import { AbsolutePath } from '../core';
|
|
2
9
|
import { spawn } from 'node:child_process';
|
|
3
10
|
|
package/src/io/Logger.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-2026 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import chalk from 'chalk';
|
|
2
9
|
import { DescriptiveError } from '../core';
|
|
3
10
|
import { getLoader, logger as LOGGER } from '@react-native-community/cli-tools';
|