@react-native-oh/react-native-harmony-cli 0.0.36 → 0.77.18-1

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.
Files changed (229) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +4 -4
  3. package/dist/autolinking/Autolinking.js +13 -16
  4. package/dist/autolinking/index.js +0 -6
  5. package/dist/codegen/core/CodeGenerator.js +0 -6
  6. package/dist/codegen/core/CodegenError.js +0 -6
  7. package/dist/codegen/core/EventUtils.js +0 -6
  8. package/dist/codegen/core/TypeAnnotationToTS.js +0 -6
  9. package/dist/codegen/core/UberSchema.js +2 -11
  10. package/dist/codegen/core/index.js +0 -6
  11. package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +2 -7
  12. package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +0 -6
  13. package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +0 -6
  14. package/dist/codegen/generators/CppComponentCodeGenerator.js +0 -6
  15. package/dist/codegen/generators/LibGlueCodeGenerator.js +2 -8
  16. package/dist/codegen/generators/NativeModuleCodeGenerator.js +1 -7
  17. package/dist/codegen/generators/SharedComponentCodeGenerator.js +0 -6
  18. package/dist/codegen/generators/UberGeneratorV1.js +0 -6
  19. package/dist/codegen/generators/UberGeneratorV2.js +0 -6
  20. package/dist/codegen/generators/index.js +0 -6
  21. package/dist/codegen/index.js +0 -6
  22. package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +0 -6
  23. package/dist/codegen/templates/BasePackageHTemplate.js +12 -7
  24. package/dist/codegen/templates/ComponentDescriptorHTemplate.js +1 -6
  25. package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +0 -6
  26. package/dist/codegen/templates/ComponentUtilsTSTemplate.js +0 -6
  27. package/dist/codegen/templates/IndexTSTemplate.js +0 -6
  28. package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +12 -7
  29. package/dist/codegen/templates/TurboModuleCppTemplate.js +0 -6
  30. package/dist/codegen/templates/TurboModuleHTemplate.js +0 -6
  31. package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +0 -6
  32. package/dist/codegen/templates/index.js +0 -6
  33. package/dist/commands/bundle-harmony.js +131 -36
  34. package/dist/commands/clean-harmony.js +84 -0
  35. package/dist/commands/codegen-harmony.js +0 -6
  36. package/dist/commands/codegen-lib-harmony.js +6 -12
  37. package/dist/commands/index.js +2 -9
  38. package/dist/commands/init-harmony.js +226 -0
  39. package/dist/commands/init.js +0 -0
  40. package/dist/commands/link-harmony.js +12 -16
  41. package/dist/commands/types.js +0 -6
  42. package/dist/commands/verify-package-harmony.js +6 -10
  43. package/dist/core/AbsolutePath.js +3 -6
  44. package/dist/core/CodegenConfig.js +0 -6
  45. package/dist/core/DescriptiveError.js +0 -6
  46. package/dist/core/FileSystem.js +0 -6
  47. package/dist/core/OHPackageJSON5.js +0 -6
  48. package/dist/core/ProjectDependenciesManager.js +6 -14
  49. package/dist/core/ValidationError.js +0 -6
  50. package/dist/core/ValueObject.js +0 -6
  51. package/dist/core/fs.js +13 -6
  52. package/dist/core/index.js +0 -6
  53. package/dist/index.js +2 -9
  54. package/dist/init/templates/AppScopeAppJSON5Template.js +30 -0
  55. package/dist/init/templates/AppScopeStringVarTemplate.js +28 -0
  56. package/dist/init/templates/EntryIndexTemplate.js +65 -0
  57. package/dist/init/templates/EntryStringVarTemplate.js +38 -0
  58. package/dist/init/templates/HvigorConfigJson5Template.js +44 -0
  59. package/dist/init/templates/MetroConfigTemplate.js +47 -0
  60. package/dist/init/templates/OhPackageJson5Template.js +37 -0
  61. package/dist/init/templates/harmony/AppScope/app.json5 +10 -0
  62. package/dist/init/templates/harmony/AppScope/resources/base/element/string.json +8 -0
  63. package/dist/init/templates/harmony/AppScope/resources/base/media/app_icon.png +0 -0
  64. package/dist/init/templates/harmony/build-profile.json5 +36 -0
  65. package/dist/init/templates/harmony/codelinter.json +32 -0
  66. package/dist/init/templates/harmony/entry/build-profile.json5 +18 -0
  67. package/dist/init/templates/harmony/entry/gitignore +7 -0
  68. package/dist/init/templates/harmony/entry/hvigorfile.ts +13 -0
  69. package/dist/init/templates/harmony/entry/oh-package.json5 +9 -0
  70. package/dist/init/templates/harmony/entry/src/main/cpp/CMakeLists.txt +27 -0
  71. package/dist/init/templates/harmony/entry/src/main/cpp/PackageProvider.cpp +13 -0
  72. package/dist/init/templates/harmony/entry/src/main/cpp/gitignore +4 -0
  73. package/dist/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +8 -0
  74. package/dist/init/templates/harmony/entry/src/main/ets/codegen/gitignore +2 -0
  75. package/dist/init/templates/harmony/entry/src/main/ets/entryability/EntryAbility.ets +11 -0
  76. package/dist/init/templates/harmony/entry/src/main/ets/gitignore +1 -0
  77. package/dist/init/templates/harmony/entry/src/main/ets/pages/.gitkeep +0 -0
  78. package/dist/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +16 -0
  79. package/dist/init/templates/harmony/entry/src/main/module.json5 +58 -0
  80. package/dist/init/templates/harmony/entry/src/main/resources/base/element/color.json +8 -0
  81. package/dist/init/templates/harmony/entry/src/main/resources/base/element/string.json +16 -0
  82. package/dist/init/templates/harmony/entry/src/main/resources/base/media/background.png +0 -0
  83. package/dist/init/templates/harmony/entry/src/main/resources/base/media/foreground.png +0 -0
  84. package/dist/init/templates/harmony/entry/src/main/resources/base/media/layered_image.json +7 -0
  85. package/dist/init/templates/harmony/entry/src/main/resources/base/media/startIcon.png +0 -0
  86. package/dist/init/templates/harmony/entry/src/main/resources/base/profile/main_pages.json +5 -0
  87. package/dist/init/templates/harmony/entry/src/main/resources/gitignore +1 -0
  88. package/dist/init/templates/harmony/entry/src/ohosTest/ets/test/List.test.ets +2 -0
  89. package/dist/init/templates/harmony/entry/src/ohosTest/module.json5 +13 -0
  90. package/dist/init/templates/harmony/gitignore +16 -0
  91. package/dist/init/templates/harmony/hvigor/hvigor-config.json5 +22 -0
  92. package/dist/init/templates/harmony/hvigorfile.ts +7 -0
  93. package/dist/init/templates/index.js +21 -0
  94. package/dist/io/CliExecutor.js +0 -6
  95. package/dist/io/Logger.js +0 -6
  96. package/dist/io/RealFS.js +10 -6
  97. package/dist/io/TarGz.js +2 -8
  98. package/dist/io/__fixtures__.js +0 -6
  99. package/dist/io/fsUtils.js +0 -6
  100. package/dist/io/index.js +1 -6
  101. package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +0 -6
  102. package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +0 -6
  103. package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +0 -6
  104. package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +0 -6
  105. package/dist/package-verifier/checks/index.js +0 -6
  106. package/dist/package-verifier/index.js +0 -6
  107. package/dist/package-verifier/types.js +0 -6
  108. package/dist/package-verifier/verify-package.js +1 -7
  109. package/harmony/rnoh-hvigor-plugin-0.77.18.tgz +0 -0
  110. package/jest.config.js +0 -7
  111. package/package.json +15 -18
  112. package/react-native.config.js +0 -7
  113. package/scripts/copy-template.js +18 -0
  114. package/src/autolinking/Autolinking.test.ts +54 -18
  115. package/src/autolinking/Autolinking.ts +23 -20
  116. package/src/autolinking/index.ts +1 -8
  117. package/src/codegen/core/CodeGenerator.ts +0 -7
  118. package/src/codegen/core/CodegenError.ts +0 -7
  119. package/src/codegen/core/EventUtils.ts +0 -7
  120. package/src/codegen/core/TypeAnnotationToTS.test.ts +0 -7
  121. package/src/codegen/core/TypeAnnotationToTS.ts +3 -8
  122. package/src/codegen/core/UberSchema.ts +3 -12
  123. package/src/codegen/core/index.ts +0 -7
  124. package/src/codegen/generators/AppBuildTimeGlueCodeGenerator.ts +5 -8
  125. package/src/codegen/generators/ArkTSComponentCodeGeneratorArkTS.ts +0 -7
  126. package/src/codegen/generators/ArkTSComponentCodeGeneratorCAPI.ts +0 -7
  127. package/src/codegen/generators/CppComponentCodeGenerator.ts +0 -7
  128. package/src/codegen/generators/LibGlueCodeGenerator.ts +2 -9
  129. package/src/codegen/generators/NativeModuleCodeGenerator.ts +1 -8
  130. package/src/codegen/generators/SharedComponentCodeGenerator.ts +0 -7
  131. package/src/codegen/generators/UberGeneratorV1.ts +0 -7
  132. package/src/codegen/generators/UberGeneratorV2.ts +0 -7
  133. package/src/codegen/generators/index.ts +0 -7
  134. package/src/codegen/index.ts +0 -7
  135. package/src/codegen/templates/BaseComponentInstanceHTemplate.ts +0 -7
  136. package/src/codegen/templates/BasePackageHTemplate.ts +13 -8
  137. package/src/codegen/templates/ComponentDescriptorHTemplate.ts +1 -7
  138. package/src/codegen/templates/ComponentJSIBinderHTemplate.ts +0 -7
  139. package/src/codegen/templates/ComponentUtilsTSTemplate.ts +0 -7
  140. package/src/codegen/templates/IndexTSTemplate.ts +0 -7
  141. package/src/codegen/templates/RNOHGeneratedPackageHTemplate.ts +13 -8
  142. package/src/codegen/templates/TurboModuleCppTemplate.ts +0 -7
  143. package/src/codegen/templates/TurboModuleHTemplate.ts +0 -7
  144. package/src/codegen/templates/TurboModuleSpecTSTemplate.ts +0 -7
  145. package/src/codegen/templates/index.ts +0 -7
  146. package/src/commands/bundle-harmony.ts +174 -39
  147. package/src/commands/clean-harmony.ts +54 -0
  148. package/src/commands/codegen-harmony.ts +0 -7
  149. package/src/commands/codegen-lib-harmony.ts +6 -13
  150. package/src/commands/index.ts +2 -10
  151. package/src/commands/init-harmony.ts +299 -0
  152. package/src/commands/link-harmony.ts +13 -18
  153. package/src/commands/types.ts +0 -7
  154. package/src/commands/verify-package-harmony.ts +7 -10
  155. package/src/core/AbsolutePath.ts +4 -7
  156. package/src/core/CodegenConfig.ts +0 -7
  157. package/src/core/DescriptiveError.ts +0 -7
  158. package/src/core/FileSystem.ts +5 -8
  159. package/src/core/OHPackageJSON5.ts +0 -7
  160. package/src/core/PackageJSON.ts +0 -6
  161. package/src/core/ProjectDependenciesManager.ts +14 -22
  162. package/src/core/ValidationError.ts +0 -7
  163. package/src/core/ValueObject.ts +0 -7
  164. package/src/core/fs.ts +13 -7
  165. package/src/core/index.ts +0 -7
  166. package/src/index.ts +4 -13
  167. package/src/init/templates/AppScopeAppJSON5Template.ts +24 -0
  168. package/src/init/templates/AppScopeStringVarTemplate.ts +22 -0
  169. package/src/init/templates/EntryIndexTemplate.ts +59 -0
  170. package/src/init/templates/EntryStringVarTemplate.ts +31 -0
  171. package/src/init/templates/HvigorConfigJson5Template.ts +40 -0
  172. package/src/init/templates/MetroConfigTemplate.ts +41 -0
  173. package/src/init/templates/OhPackageJson5Template.ts +31 -0
  174. package/src/init/templates/harmony/AppScope/app.json5 +10 -0
  175. package/src/init/templates/harmony/AppScope/resources/base/element/string.json +8 -0
  176. package/src/init/templates/harmony/AppScope/resources/base/media/app_icon.png +0 -0
  177. package/src/init/templates/harmony/build-profile.json5 +36 -0
  178. package/src/init/templates/harmony/codelinter.json +32 -0
  179. package/src/init/templates/harmony/entry/build-profile.json5 +18 -0
  180. package/src/init/templates/harmony/entry/gitignore +7 -0
  181. package/src/init/templates/harmony/entry/hvigorfile.ts +13 -0
  182. package/src/init/templates/harmony/entry/oh-package.json5 +9 -0
  183. package/src/init/templates/harmony/entry/src/main/cpp/CMakeLists.txt +27 -0
  184. package/src/init/templates/harmony/entry/src/main/cpp/PackageProvider.cpp +13 -0
  185. package/src/init/templates/harmony/entry/src/main/cpp/gitignore +4 -0
  186. package/src/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +8 -0
  187. package/src/init/templates/harmony/entry/src/main/ets/codegen/gitignore +2 -0
  188. package/src/init/templates/harmony/entry/src/main/ets/entryability/EntryAbility.ets +11 -0
  189. package/src/init/templates/harmony/entry/src/main/ets/gitignore +1 -0
  190. package/src/init/templates/harmony/entry/src/main/ets/pages/.gitkeep +0 -0
  191. package/src/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +16 -0
  192. package/src/init/templates/harmony/entry/src/main/module.json5 +58 -0
  193. package/src/init/templates/harmony/entry/src/main/resources/base/element/color.json +8 -0
  194. package/src/init/templates/harmony/entry/src/main/resources/base/element/string.json +16 -0
  195. package/src/init/templates/harmony/entry/src/main/resources/base/media/background.png +0 -0
  196. package/src/init/templates/harmony/entry/src/main/resources/base/media/foreground.png +0 -0
  197. package/src/init/templates/harmony/entry/src/main/resources/base/media/layered_image.json +7 -0
  198. package/src/init/templates/harmony/entry/src/main/resources/base/media/startIcon.png +0 -0
  199. package/src/init/templates/harmony/entry/src/main/resources/base/profile/main_pages.json +5 -0
  200. package/src/init/templates/harmony/entry/src/main/resources/gitignore +1 -0
  201. package/src/init/templates/harmony/entry/src/ohosTest/ets/test/List.test.ets +2 -0
  202. package/src/init/templates/harmony/entry/src/ohosTest/module.json5 +13 -0
  203. package/src/init/templates/harmony/gitignore +16 -0
  204. package/src/init/templates/harmony/hvigor/hvigor-config.json5 +22 -0
  205. package/src/init/templates/harmony/hvigorfile.ts +7 -0
  206. package/src/init/templates/index.ts +5 -0
  207. package/src/io/CliExecutor.ts +1 -8
  208. package/src/io/Logger.ts +0 -7
  209. package/src/io/RealFS.ts +15 -8
  210. package/src/io/TarGz.ts +1 -8
  211. package/src/io/__fixtures__.ts +1 -8
  212. package/src/io/fsUtils.ts +1 -7
  213. package/src/io/index.ts +1 -7
  214. package/src/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.ts +0 -7
  215. package/src/package-verifier/checks/HarmonyDirExistsCheck.ts +0 -7
  216. package/src/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.ts +0 -7
  217. package/src/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.ts +0 -7
  218. package/src/package-verifier/checks/index.ts +0 -7
  219. package/src/package-verifier/index.ts +0 -7
  220. package/src/package-verifier/types.ts +0 -7
  221. package/src/package-verifier/verify-package.ts +0 -7
  222. package/tsconfig.build.json +2 -5
  223. package/tsconfig.json +4 -0
  224. package/dist/commands/create-metro-host-constants.js +0 -67
  225. package/dist/commands/pack-harmony.js +0 -106
  226. package/dist/commands/unpack-harmony.js +0 -189
  227. package/src/commands/create-metro-host-constants.ts +0 -55
  228. package/src/commands/pack-harmony.ts +0 -128
  229. package/src/commands/unpack-harmony.ts +0 -238
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # @react-native-oh/react-native-harmony-cli
2
2
 
3
- Please refer to: [RNOH repo](https://gitee.com/openharmony-sig/ohos_react_native) for more detail.
3
+ Please refer to: [RNOH repo](https://gitcode.com/openharmony-sig/ohos_react_native) for more detail.
4
4
 
5
5
  # Documentation
6
6
 
7
- - [中文](https://gitee.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/README.md)
8
- - [English](https://gitee.com/openharmony-sig/ohos_react_native/blob/master/docs/en/README.md)
7
+ - [中文](https://gitcode.com/openharmony-sig/ohos_react_native/blob/0.77.1-rc.1-ohos/docs/zh-cn/README.md)
8
+ - [English](https://gitcode.com/openharmony-sig/ohos_react_native/blob/0.77.1-rc.1-ohos/docs/en/README.md)
9
9
 
10
10
  # License
11
11
 
12
- This library is licensed under The [MIT License (MIT)](https://gitee.com/openharmony-sig/ohos_react_native)
12
+ This library is licensed under The [MIT License (MIT)](https://gitcode.com/openharmony-sig/ohos_react_native)
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024-2025 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -23,6 +17,7 @@ const json5_1 = __importDefault(require("json5"));
23
17
  const core_1 = require("../core");
24
18
  const mustache_1 = __importDefault(require("mustache"));
25
19
  const case_1 = __importDefault(require("case"));
20
+ const node_path_1 = __importDefault(require("node:path"));
26
21
  const ETS_RNOH_PACKAGES_FACTORY_TEMPLATE = `
27
22
  /*
28
23
  * This file was generated by RNOH autolinking.
@@ -50,7 +45,7 @@ const CPP_RNOH_PACKAGES_FACTORY_TEMPLATE = `
50
45
  #pragma once
51
46
  #include "RNOH/Package.h"
52
47
  {{#libraries}}
53
- #include "{{etsRNOHPackageClassName}}.h"
48
+ #include "{{cppRNOHPackageClassName}}.h"
54
49
  {{/libraries}}
55
50
 
56
51
  std::vector<rnoh::Package::Shared> createRNOHPackages(const rnoh::Package::Context &ctx) {
@@ -66,7 +61,7 @@ const CMAKE_AUTOLINKING_TEMPLATE = `
66
61
  # DO NOT modify it manually, your changes WILL be overwritten.
67
62
  cmake_minimum_required(VERSION 3.5)
68
63
 
69
- # @api
64
+ # @actor RNOH_APP
70
65
  function(autolink_libraries target)
71
66
  {{#libraries}}
72
67
  add_subdirectory("\${OH_MODULES_DIR}/{{{ohPackageName}}}/src/main/cpp" ./{{cmakeLibraryTargetName}})
@@ -111,11 +106,11 @@ class Autolinking {
111
106
  const skippedLibraryNpmPackageNames = [];
112
107
  yield new core_1.ProjectDependenciesManager(this.fs, projectRootPath).forEachAsync((dependency) => {
113
108
  var _a;
114
- const harFilePath = dependency.getHarFilePath();
115
- if (!harFilePath) {
109
+ const harFilePaths = dependency.getHarFilePaths();
110
+ if (harFilePaths.length === 0) {
116
111
  return;
117
112
  }
118
- nodeModuleHarPaths.push(harFilePath);
113
+ nodeModuleHarPaths.push(...harFilePaths);
119
114
  const packageJson = dependency.readPackageJSON();
120
115
  const providedAutolinkingConfig = (_a = packageJson.harmony) === null || _a === void 0 ? void 0 : _a.autolinking;
121
116
  if (providedAutolinkingConfig === undefined ||
@@ -123,7 +118,8 @@ class Autolinking {
123
118
  (config.excludedNpmPackageNames.has(packageJson.name) &&
124
119
  config.excludedNpmPackageNames.size > 0) ||
125
120
  (!config.includedNpmPackageNames.has(packageJson.name) &&
126
- config.includedNpmPackageNames.size > 0)) {
121
+ config.includedNpmPackageNames.size > 0) ||
122
+ harFilePaths.length !== 1) {
127
123
  skippedLibraryNpmPackageNames.push(packageJson.name);
128
124
  return;
129
125
  }
@@ -134,7 +130,7 @@ class Autolinking {
134
130
  cppRNOHPackageClassName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.cppPackageClassName,
135
131
  cmakeLibraryTargetName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.cmakeLibraryTargetName,
136
132
  ohPackageName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.ohPackageName,
137
- harFilePathRelativeToHarmony: harFilePath
133
+ harFilePathRelativeToHarmony: harFilePaths[0]
138
134
  .relativeTo(harmonyProjectPath)
139
135
  .toString(),
140
136
  });
@@ -171,13 +167,14 @@ class Autolinking {
171
167
  const autolinkableHarFilePathsRelativeToHarmony = autolinkableLibraries.map((lib) => lib.harFilePathRelativeToHarmony);
172
168
  const unmanagedNativeDependencySpecifierByName = {};
173
169
  Object.entries(ohPackage.dependencies).forEach(([name, dependencySpecifier]) => {
174
- if (!dependencySpecifier.includes('file:')) {
170
+ if (!(dependencySpecifier.includes('file:') &&
171
+ dependencySpecifier.includes('node_modules'))) {
175
172
  unmanagedNativeDependencySpecifierByName[name] = dependencySpecifier;
176
173
  }
177
174
  else {
178
175
  const harFilePathRelativeToHarmony = dependencySpecifier.replace('file:', '');
179
- if (!autolinkableHarFilePathsRelativeToHarmony.includes(harFilePathRelativeToHarmony) &&
180
- input.nodeModuleHarFilePathsRelativeToHarmony.includes(harFilePathRelativeToHarmony)) {
176
+ if (!autolinkableHarFilePathsRelativeToHarmony.includes(node_path_1.default.normalize(harFilePathRelativeToHarmony)) &&
177
+ input.nodeModuleHarFilePathsRelativeToHarmony.includes(node_path_1.default.normalize(harFilePathRelativeToHarmony))) {
181
178
  unmanagedNativeDependencySpecifierByName[name] =
182
179
  dependencySpecifier;
183
180
  }
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
3
  if (k2 === undefined) k2 = k;
10
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -1,8 +1,2 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.CodegenError = void 0;
10
4
  const core_1 = require("../../core");
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024-2025 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.createEventNameFromEventHandlerName = createEventNameFromEventHandlerName;
10
4
  const CodegenError_1 = require("./CodegenError");
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.TypeAnnotationToTS = void 0;
10
4
  exports.getStringifiedTSDefaultValueFromPropTypeAnnotation = getStringifiedTSDefaultValueFromPropTypeAnnotation;
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024-2025 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -14,17 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
14
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
15
9
  });
16
10
  };
17
- var __importDefault = (this && this.__importDefault) || function (mod) {
18
- return (mod && mod.__esModule) ? mod : { "default": mod };
19
- };
20
11
  Object.defineProperty(exports, "__esModule", { value: true });
21
12
  exports.UberSchema = void 0;
22
13
  const core_1 = require("../../core");
23
14
  // @ts-expect-error
24
- const combine_js_to_schema_js_1 = __importDefault(require("@react-native/codegen/lib/cli/combine/combine-js-to-schema.js"));
15
+ const combine_js_to_schema_js_1 = require("@react-native/codegen/lib/cli/combine/combine-js-to-schema.js");
25
16
  const CodegenError_1 = require("./CodegenError");
26
17
  function createRawUberSchemaFromSpecFilePaths(projectSourceFilePaths) {
27
- return (0, combine_js_to_schema_js_1.default)(projectSourceFilePaths.map((p) => p.getValue()));
18
+ return (0, combine_js_to_schema_js_1.combineSchemas)(projectSourceFilePaths.map((p) => p.getValue()));
28
19
  }
29
20
  /**
30
21
  * Contains component and turbo module (NativeModule) schemas. The "Uber" word is used here to highlight that SpecSchemas don't extend this class.
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
3
  if (k2 === undefined) k2 = k;
10
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
4
  };
@@ -35,6 +29,7 @@ class AppBuildTimeGlueCodeGenerator {
35
29
  generatedPackageH_v1.addComponent({
36
30
  name,
37
31
  supportedEventNames: eventNames,
32
+ isArkTSComponent: true,
38
33
  });
39
34
  });
40
35
  v1.turboModules.forEach((turboModule) => {
@@ -45,7 +40,7 @@ class AppBuildTimeGlueCodeGenerator {
45
40
  const basePackageClassName = `Base${case_1.default.pascal(libraryName)}Package`;
46
41
  const generatedPackageH_v2 = new BasePackageHTemplate_1.BasePackageHTemplate(basePackageClassName, this.codegenNoticeLines);
47
42
  components.forEach((component) => {
48
- generatedPackageH_v2.addComponent(component);
43
+ generatedPackageH_v2.addComponent(Object.assign(Object.assign({}, component), { isArkTSComponent: false }));
49
44
  });
50
45
  turboModules.forEach((turboModule) => {
51
46
  turboModules_indexTS.addReexport({ from: `./${turboModule.name}` });
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.ArkTSComponentCodeGeneratorArkTS = void 0;
10
4
  const core_1 = require("../core");
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.ArkTSComponentCodeGeneratorCAPI = void 0;
10
4
  const core_1 = require("../core");
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.CppComponentCodeGenerator = void 0;
10
4
  const templates_1 = require("../templates");
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
4
  };
@@ -35,11 +29,11 @@ class LibGlueCodeGenerator {
35
29
  });
36
30
  arkTSComponents.forEach(({ componentName, eventNames }) => {
37
31
  components_indexTS.addReexport({ from: `./${componentName}` });
38
- basePackageTemplate.addComponent({ name: componentName, libraryCppName });
32
+ basePackageTemplate.addComponent({ name: componentName, libraryCppName, isArkTSComponent: true });
39
33
  eventNames.forEach((eventName) => basePackageTemplate.addArkTSEvent({ name: eventName }));
40
34
  });
41
35
  cppComponents.forEach(({ componentName }) => {
42
- basePackageTemplate.addComponent({ name: componentName, libraryCppName });
36
+ basePackageTemplate.addComponent({ name: componentName, libraryCppName, isArkTSComponent: false });
43
37
  });
44
38
  fileContentByPath.set(this.cppOutputPath.copyWithNewSegment('RNOH', 'generated', `${basePackageClassName}.h`), basePackageTemplate.build());
45
39
  fileContentByPath.set(this.etsOutputPath.copyWithNewSegment('components', 'ts.ts'), components_indexTS.build());
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.NativeModuleCodeGenerator = void 0;
10
4
  const templates_1 = require("../templates");
@@ -53,7 +47,7 @@ class NativeModuleCodeGenerator {
53
47
  })),
54
48
  });
55
49
  });
56
- schema.spec.properties.map((prop) => {
50
+ schema.spec.methods.map((prop) => {
57
51
  if (prop.typeAnnotation.type === 'FunctionTypeAnnotation') {
58
52
  turboModuleCpp.addMethod({
59
53
  name: prop.name,
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
4
  };
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.UberGeneratorV1 = void 0;
10
4
  const core_1 = require("../core");
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.UberGeneratorV2 = void 0;
10
4
  const CppComponentCodeGenerator_1 = require("./CppComponentCodeGenerator");
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
3
  if (k2 === undefined) k2 = k;
10
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
3
  if (k2 === undefined) k2 = k;
10
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
4
  };
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
4
  };
@@ -50,16 +44,26 @@ class {{name}}EventEmitRequestHandler : public EventEmitRequestHandler {
50
44
  public:
51
45
  void handleEvent(Context const &ctx) override {
52
46
  auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
47
+ auto componentName = ctx.shadowViewRegistry->getComponentName(ctx.tag);
48
+
53
49
  if (eventEmitter == nullptr) {
54
50
  return;
55
51
  }
56
52
 
53
+ std::vector<std::string> supportedComponentNames = {
54
+ {{#arkTSComponents}}
55
+ "{{name}}",
56
+ {{/arkTSComponents}}
57
+ };
58
+
57
59
  std::vector<std::string> supportedEventNames = {
58
60
  {{#arkTSEvents}}
59
61
  "{{name}}",
60
62
  {{/arkTSEvents}}
61
63
  };
62
- if (std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
64
+
65
+ if (std::find(supportedComponentNames.begin(), supportedComponentNames.end(), componentName) != supportedComponentNames.end() &&
66
+ std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
63
67
  eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
64
68
  }
65
69
  }
@@ -126,6 +130,7 @@ class BasePackageHTemplate {
126
130
  name: this.name,
127
131
  turboModules: this.turboModules,
128
132
  components: this.components,
133
+ arkTSComponents: this.components.filter((component) => component.isArkTSComponent),
129
134
  arkTSEvents: this.arkTSEvents,
130
135
  libraries: Array.from(this.libraryCppNames).map((name) => ({
131
136
  name,
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
4
  };
@@ -30,6 +24,7 @@ const TEMPLATE = `
30
24
  namespace facebook {
31
25
  namespace react {
32
26
 
27
+ // RNOH patch
33
28
  constexpr char {{name}}ComponentName[] = "{{name}}";
34
29
 
35
30
  class {{name}}Props : public ViewProps {
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
4
  };
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
4
  };
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
4
  };
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
4
  };
@@ -53,16 +47,26 @@ class GeneratedEventEmitRequestHandler : public EventEmitRequestHandler {
53
47
  public:
54
48
  void handleEvent(Context const &ctx) override {
55
49
  auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
50
+ auto componentName = ctx.shadowViewRegistry->getComponentName(ctx.tag);
51
+
56
52
  if (eventEmitter == nullptr) {
57
53
  return;
58
54
  }
59
55
 
56
+ std::vector<std::string> supportedComponentNames = {
57
+ {{#arkTSComponents}}
58
+ "{{name}}",
59
+ {{/arkTSComponents}}
60
+ };
61
+
60
62
  std::vector<std::string> supportedEventNames = {
61
63
  {{#supportedEvents}}
62
64
  "{{name}}",
63
65
  {{/supportedEvents}}
64
66
  };
65
- if (std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
67
+
68
+ if (std::find(supportedComponentNames.begin(), supportedComponentNames.end(), componentName) != supportedComponentNames.end() &&
69
+ std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
66
70
  eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
67
71
  }
68
72
  }
@@ -121,6 +125,7 @@ class RNOHGeneratedPackageHTemplate {
121
125
  return mustache_1.default.render(TEMPLATE.trimStart(), {
122
126
  turboModules: this.turboModules,
123
127
  components: this.components,
128
+ arkTSComponents: this.components.filter((component) => component.isArkTSComponent),
124
129
  supportedEvents: this.supportedEventNames.map((eventName) => ({
125
130
  name: eventName,
126
131
  })),
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
4
  };
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
4
  };
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
4
  };
@@ -1,10 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE-MIT file in the root directory of this source tree.
7
- */
8
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
3
  if (k2 === undefined) k2 = k;
10
4
  var desc = Object.getOwnPropertyDescriptor(m, k);