@react-native-oh/react-native-harmony-cli 0.77.33 → 0.77.44

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 (192) hide show
  1. package/dist/assetResolver.js +43 -74
  2. package/dist/autolinking/Autolinking.js +178 -179
  3. package/dist/codegen/core/CodegenError.js +3 -23
  4. package/dist/codegen/core/EventUtils.js +3 -3
  5. package/dist/codegen/core/TypeAnnotationToTS.js +24 -28
  6. package/dist/codegen/core/UberSchema.js +55 -97
  7. package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +28 -41
  8. package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +27 -34
  9. package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +25 -33
  10. package/dist/codegen/generators/CppComponentCodeGenerator.js +23 -28
  11. package/dist/codegen/generators/LibGlueCodeGenerator.js +26 -29
  12. package/dist/codegen/generators/NativeModuleCodeGenerator.js +25 -30
  13. package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
  14. package/dist/codegen/generators/UberGeneratorV1.js +24 -23
  15. package/dist/codegen/generators/UberGeneratorV2.js +34 -35
  16. package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +50 -24
  17. package/dist/codegen/templates/BasePackageHTemplate.js +120 -21
  18. package/dist/codegen/templates/ComponentDescriptorHTemplate.js +54 -8
  19. package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +75 -27
  20. package/dist/codegen/templates/ComponentUtilsTSTemplate.js +162 -29
  21. package/dist/codegen/templates/IndexTSTemplate.js +37 -17
  22. package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +119 -24
  23. package/dist/codegen/templates/TurboModuleCppTemplate.js +38 -15
  24. package/dist/codegen/templates/TurboModuleHTemplate.js +32 -11
  25. package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +52 -19
  26. package/dist/commands/bundle-harmony.js +118 -221
  27. package/dist/commands/clean-harmony.js +58 -63
  28. package/dist/commands/codegen-harmony.js +105 -165
  29. package/dist/commands/codegen-lib-harmony.js +76 -116
  30. package/dist/commands/init-harmony.js +151 -196
  31. package/dist/commands/init.js +537 -961
  32. package/dist/commands/link-harmony.js +35 -82
  33. package/dist/commands/run-harmony.js +372 -518
  34. package/dist/commands/verify-package-harmony.js +54 -117
  35. package/dist/core/AbsolutePath.js +33 -49
  36. package/dist/core/CodegenConfig.js +24 -22
  37. package/dist/core/DescriptiveError.js +18 -37
  38. package/dist/core/FileSystem.js +14 -18
  39. package/dist/core/OHPackageJSON5.js +17 -23
  40. package/dist/core/PackageJSON.js +26 -42
  41. package/dist/core/ProjectDependenciesManager.js +40 -92
  42. package/dist/core/ValidationError.js +2 -22
  43. package/dist/core/fs.js +10 -7
  44. package/dist/index.js +1 -1
  45. package/dist/init/templates/AppScopeAppJSON5Template.js +21 -8
  46. package/dist/init/templates/AppScopeStringVarTemplate.js +19 -8
  47. package/dist/init/templates/EntryIndexTemplate.js +56 -8
  48. package/dist/init/templates/EntryStringVarTemplate.js +27 -8
  49. package/dist/init/templates/HvigorConfigJson5Template.js +33 -8
  50. package/dist/init/templates/MetroConfigTemplate.js +38 -8
  51. package/dist/init/templates/OhPackageJson5Template.js +28 -8
  52. package/dist/init/templates/harmony/AppScope/app.json5 +10 -0
  53. package/dist/init/templates/harmony/AppScope/resources/base/element/string.json +8 -0
  54. package/dist/init/templates/harmony/AppScope/resources/base/media/app_icon.png +0 -0
  55. package/dist/init/templates/harmony/build-profile.json5 +36 -0
  56. package/dist/init/templates/harmony/codelinter.json +32 -0
  57. package/dist/init/templates/harmony/entry/build-profile.json5 +18 -0
  58. package/dist/init/templates/harmony/entry/gitignore +7 -0
  59. package/dist/init/templates/harmony/entry/hvigorfile.ts +13 -0
  60. package/dist/init/templates/harmony/entry/oh-package.json5 +9 -0
  61. package/dist/init/templates/harmony/entry/src/main/cpp/CMakeLists.txt +27 -0
  62. package/dist/init/templates/harmony/entry/src/main/cpp/PackageProvider.cpp +13 -0
  63. package/dist/init/templates/harmony/entry/src/main/cpp/gitignore +4 -0
  64. package/dist/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +8 -0
  65. package/dist/init/templates/harmony/entry/src/main/ets/codegen/gitignore +2 -0
  66. package/dist/init/templates/harmony/entry/src/main/ets/entryability/EntryAbility.ets +11 -0
  67. package/dist/init/templates/harmony/entry/src/main/ets/gitignore +1 -0
  68. package/dist/init/templates/harmony/entry/src/main/ets/pages/.gitkeep +0 -0
  69. package/dist/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +16 -0
  70. package/dist/init/templates/harmony/entry/src/main/module.json5 +65 -0
  71. package/dist/init/templates/harmony/entry/src/main/resources/base/element/color.json +8 -0
  72. package/dist/init/templates/harmony/entry/src/main/resources/base/element/string.json +16 -0
  73. package/dist/init/templates/harmony/entry/src/main/resources/base/media/background.png +0 -0
  74. package/dist/init/templates/harmony/entry/src/main/resources/base/media/foreground.png +0 -0
  75. package/dist/init/templates/harmony/entry/src/main/resources/base/media/layered_image.json +7 -0
  76. package/dist/init/templates/harmony/entry/src/main/resources/base/media/startIcon.png +0 -0
  77. package/dist/init/templates/harmony/entry/src/main/resources/base/profile/main_pages.json +5 -0
  78. package/dist/init/templates/harmony/entry/src/main/resources/gitignore +1 -0
  79. package/dist/init/templates/harmony/entry/src/ohosTest/ets/test/List.test.ets +2 -0
  80. package/dist/init/templates/harmony/entry/src/ohosTest/module.json5 +13 -0
  81. package/dist/init/templates/harmony/gitignore +16 -0
  82. package/dist/init/templates/harmony/hvigor/hvigor-config.json5 +22 -0
  83. package/dist/init/templates/harmony/hvigorfile.ts +7 -0
  84. package/dist/io/CliExecutor.js +46 -98
  85. package/dist/io/Logger.js +40 -46
  86. package/dist/io/RealFS.js +43 -100
  87. package/dist/io/TarGz.js +11 -8
  88. package/dist/io/__fixtures__.js +79 -141
  89. package/dist/io/fsUtils.js +13 -12
  90. package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +19 -47
  91. package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +13 -41
  92. package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +8 -38
  93. package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +22 -54
  94. package/dist/package-verifier/verify-package.js +56 -133
  95. package/dist/simulator/LaunchSimulator.js +224 -301
  96. package/harmony/rnoh-hvigor-plugin-0.77.44.tgz +0 -0
  97. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0271b9dd +0 -0
  98. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/07ba0208 +0 -0
  99. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/082dd09d +0 -0
  100. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0a9e1b0b +0 -0
  101. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0c3d528a +0 -0
  102. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1014d3ff +0 -0
  103. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1184678c +0 -0
  104. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/12621366 +0 -0
  105. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/126d3e66 +0 -0
  106. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/19262852 +0 -0
  107. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/203fac53 +0 -0
  108. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/237b660a +0 -0
  109. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2528002d +0 -0
  110. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2587d041 +0 -0
  111. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2893bd11 +0 -0
  112. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2af6ff9d +0 -0
  113. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2bf31f33 +0 -0
  114. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/333648cc +0 -0
  115. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/386f6df0 +0 -0
  116. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3b8c270e +0 -0
  117. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3bcc34ba +0 -0
  118. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/444808bd +0 -0
  119. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/44a775e2 +0 -0
  120. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/46da3ccd +0 -0
  121. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/51f80e35 +0 -0
  122. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5203a2ca +0 -0
  123. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/52795646 +0 -0
  124. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/577f8208 +0 -0
  125. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5c2aafe7 +0 -0
  126. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5c69bcfe +0 -0
  127. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/62695b92 +0 -0
  128. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/62698102 +0 -0
  129. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6411ab00 +0 -0
  130. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6569ba92 +0 -0
  131. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/65e5133c +0 -0
  132. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/66029655 +0 -0
  133. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/69e85d0d +0 -0
  134. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6afcb99e +0 -0
  135. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6de07367 +0 -0
  136. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/72498307 +0 -0
  137. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7babd1de +0 -0
  138. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7fe56d21 +0 -0
  139. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/810cbd72 +0 -0
  140. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/812386d2 +0 -0
  141. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8448897d +0 -0
  142. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/84ab0a41 +0 -0
  143. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/853825e2 +0 -0
  144. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/862ad93a +0 -0
  145. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/86b14da6 +0 -0
  146. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/87f0fe62 +0 -0
  147. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/88ee8f74 +0 -0
  148. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8c5237c9 +0 -0
  149. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8c725800 +0 -0
  150. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8e83cbe1 +0 -0
  151. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8f4085b9 +0 -0
  152. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/931f0b2e +0 -0
  153. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/940c8f92 +0 -0
  154. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/968191a3 +0 -0
  155. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/970780c0 +0 -0
  156. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/98bc4394 +0 -0
  157. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/99a3b0b0 +0 -0
  158. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/9c0ffa6b +0 -0
  159. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/9d9b42c2 +0 -0
  160. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a04266ef +0 -0
  161. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a18f78c5 +0 -0
  162. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a642fb0e +0 -0
  163. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a97edf40 +0 -0
  164. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/aa672a20 +0 -0
  165. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ae25c61a +0 -0
  166. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b2bebae6 +0 -0
  167. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ba492422 +0 -0
  168. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/bd3e6c21 +0 -0
  169. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/be9e564e +0 -0
  170. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c342b18e +0 -0
  171. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c3993e7e +0 -0
  172. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c52ffd54 +0 -0
  173. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c7079ad4 +0 -0
  174. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c8eb01c1 +0 -0
  175. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/caee5d30 +0 -0
  176. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cf039161 +0 -0
  177. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d0377c40 +0 -0
  178. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d262bc85 +0 -0
  179. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d287cb5c +0 -0
  180. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d64bff57 +0 -0
  181. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d716a608 +0 -0
  182. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d751012b +0 -0
  183. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e0873711 +0 -0
  184. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e1fcf77b +0 -0
  185. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e8548d8a +0 -0
  186. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/eaedd71d +0 -0
  187. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/eca0019e +0 -0
  188. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f7189953 +0 -0
  189. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f75cb201 +0 -0
  190. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f888164b +0 -0
  191. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/fdb9eb5a +0 -0
  192. package/package.json +5 -1
@@ -1,17 +1,37 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.OhPackageJson5Template = void 0;
4
- var mustache_1 = require("mustache");
5
- var TEMPLATE = "\n{\n name: \"example-name\",\n description: \"example description\",\n version: \"1.0.0\",\n modelVersion: \"5.0.0\",\n license: \"ISC\",\n repository: {},\n dependencies: {\n \"@rnoh/react-native-openharmony\": \"file:../node_modules/{{{rnohNpmPackageName}}}/react_native_openharmony.har\",\n },\n devDependencies: {\n \"@ohos/hypium\": \"1.0.6\",\n },\n overrides: {\n \"@rnoh/react-native-openharmony\": \"file:../node_modules/{{{rnohNpmPackageName}}}/react_native_openharmony.har\",\n },\n}\n";
6
- var OhPackageJson5Template = /** @class */ (function () {
7
- function OhPackageJson5Template(rnohNpmPackageName) {
7
+ const mustache_1 = __importDefault(require("mustache"));
8
+ const TEMPLATE = `
9
+ {
10
+ name: "example-name",
11
+ description: "example description",
12
+ version: "1.0.0",
13
+ modelVersion: "5.0.0",
14
+ license: "ISC",
15
+ repository: {},
16
+ dependencies: {
17
+ "@rnoh/react-native-openharmony": "file:../node_modules/{{{rnohNpmPackageName}}}/react_native_openharmony.har",
18
+ },
19
+ devDependencies: {
20
+ "@ohos/hypium": "1.0.6",
21
+ },
22
+ overrides: {
23
+ "@rnoh/react-native-openharmony": "file:../node_modules/{{{rnohNpmPackageName}}}/react_native_openharmony.har",
24
+ },
25
+ }
26
+ `;
27
+ class OhPackageJson5Template {
28
+ constructor(rnohNpmPackageName) {
8
29
  this.rnohNpmPackageName = rnohNpmPackageName;
9
30
  }
10
- OhPackageJson5Template.prototype.build = function () {
31
+ build() {
11
32
  return mustache_1.default.render(TEMPLATE.trimStart(), {
12
33
  rnohNpmPackageName: this.rnohNpmPackageName,
13
34
  });
14
- };
15
- return OhPackageJson5Template;
16
- }());
35
+ }
36
+ }
17
37
  exports.OhPackageJson5Template = OhPackageJson5Template;
@@ -0,0 +1,10 @@
1
+ {
2
+ "app": {
3
+ "bundleName": "com.example",
4
+ "vendor": "example",
5
+ "versionCode": 1000000,
6
+ "versionName": "1.0.0",
7
+ "icon": "$media:app_icon",
8
+ "label": "$string:app_name",
9
+ }
10
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "string": [
3
+ {
4
+ "name": "app_name",
5
+ "value": "example"
6
+ }
7
+ ]
8
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ app: {
3
+ products: [
4
+ {
5
+ name: 'default',
6
+ signingConfig: 'default',
7
+ compatibleSdkVersion: '5.0.0(12)',
8
+ runtimeOS: 'HarmonyOS',
9
+ buildOption: {
10
+ nativeCompiler: 'BiSheng'
11
+ }
12
+ },
13
+ ],
14
+ buildModeSet: [
15
+ {
16
+ name: 'debug',
17
+ },
18
+ {
19
+ name: 'release',
20
+ },
21
+ ],
22
+ signingConfigs: [],
23
+ },
24
+ modules: [
25
+ {
26
+ name: 'entry',
27
+ srcPath: './entry',
28
+ targets: [
29
+ {
30
+ name: 'default',
31
+ applyToProducts: ['default'],
32
+ },
33
+ ],
34
+ },
35
+ ],
36
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "files": ["**/*.ts", "**/*.ets"],
3
+ "ignore": [
4
+ "**/ohosTest/**/*",
5
+ "**/node_modules/**/*",
6
+ "**/hvigorfile.ts",
7
+ "**/node_modules/**/*",
8
+ "**/oh_modules/**/*",
9
+ "**/build/**/*",
10
+ "**/.preview/**/*"
11
+ ],
12
+ "plugins": ["@typescript-eslint"],
13
+ "ruleSet": [],
14
+ "rules": {
15
+ "@typescript-eslint/await-thenable": "warn",
16
+ "@typescript-eslint/consistent-type-imports": "warn",
17
+ "@typescript-eslint/explicit-function-return-type": "warn",
18
+ "@typescript-eslint/explicit-module-boundary-types": "warn",
19
+ "@typescript-eslint/no-dynamic-delete": "warn",
20
+ "@typescript-eslint/no-explicit-any": "warn",
21
+ "@typescript-eslint/no-for-in-array": "warn",
22
+ "@typescript-eslint/no-this-alias": "warn",
23
+ "@typescript-eslint/no-unnecessary-type-constraint": "warn",
24
+ "@typescript-eslint/no-unsafe-argument": "warn",
25
+ "@typescript-eslint/no-unsafe-assignment": "warn",
26
+ "@typescript-eslint/no-unsafe-call": "warn",
27
+ "@typescript-eslint/no-unsafe-member-access": "warn",
28
+ "@typescript-eslint/no-unsafe-return": "warn",
29
+ "@typescript-eslint/prefer-literal-enum-member": "warn"
30
+ },
31
+ "overrides": []
32
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "apiType": 'stageMode',
3
+ "buildOption": {
4
+ "externalNativeOptions": {
5
+ "path": "./src/main/cpp/CMakeLists.txt",
6
+ "arguments": "",
7
+ },
8
+ },
9
+ "targets": [
10
+ {
11
+ "name": "default",
12
+ "runtimeOS": "HarmonyOS"
13
+ },
14
+ {
15
+ "name": "ohosTest",
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,7 @@
1
+ /node_modules
2
+ /.preview
3
+ /build
4
+ /.cxx
5
+ package-lock.json
6
+ /oh_modules
7
+ /assets
@@ -0,0 +1,13 @@
1
+ import { hapTasks } from '@ohos/hvigor-ohos-plugin';
2
+ import { createRNOHModulePlugin } from '@rnoh/hvigor-plugin';
3
+
4
+ export default {
5
+ system: hapTasks,
6
+ plugins: [
7
+ createRNOHModulePlugin({
8
+ codegen: {
9
+ rnohModulePath: './oh_modules/@rnoh/react-native-openharmony',
10
+ },
11
+ }),
12
+ ],
13
+ };
@@ -0,0 +1,9 @@
1
+ {
2
+ "license": "ISC",
3
+ "devDependencies": {},
4
+ "name": "entry",
5
+ "description": "example description",
6
+ "version": "1.0.0",
7
+ "dependencies": {
8
+ }
9
+ }
@@ -0,0 +1,27 @@
1
+ cmake_minimum_required(VERSION 3.11)
2
+ project(rnapp)
3
+
4
+ set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
5
+ set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules")
6
+ set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../oh_modules/@rnoh/react-native-openharmony/src/main/cpp")
7
+ set(RNOH_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/generated")
8
+ set(LOG_VERBOSITY_LEVEL 1)
9
+ set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments")
10
+ set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie")
11
+ set(WITH_HITRACE_SYSTRACE ON)
12
+ set(WITH_HITRACE_REACT_MARKER ON)
13
+ set(OH_MODULES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../oh_modules") # required by 'autolink_libraries'
14
+
15
+ add_subdirectory("${RNOH_CPP_DIR}" ./rn)
16
+
17
+ include("${CMAKE_CURRENT_SOURCE_DIR}/autolinking.cmake")
18
+
19
+ file(GLOB GENERATED_CPP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/generated/*.cpp") # this line is needed by codegen v1
20
+ add_library(rnoh_app SHARED
21
+ ${GENERATED_CPP_FILES}
22
+ "./PackageProvider.cpp"
23
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
24
+ )
25
+ target_link_libraries(rnoh_app PUBLIC rnoh)
26
+
27
+ autolink_libraries(rnoh_app)
@@ -0,0 +1,13 @@
1
+ #include "RNOH/PackageProvider.h"
2
+ #include "RNOHPackagesFactory.h"
3
+ #include "generated/RNOHGeneratedPackage.h"
4
+
5
+ using namespace rnoh;
6
+
7
+ std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(
8
+ Package::Context ctx) {
9
+ auto packages = createRNOHPackages(ctx); // <= autolinking
10
+ packages.push_back(std::make_shared<RNOHGeneratedPackage>(
11
+ ctx)); // generated by codegen-harmony v1 on app preBuilt stage)
12
+ return packages;
13
+ }
@@ -0,0 +1,4 @@
1
+ generated/
2
+ /RNOHPackagesFactory.h
3
+ autolinking.cmake
4
+
@@ -0,0 +1,8 @@
1
+ import type { RNPackageContext, RNOHPackage } from '@rnoh/react-native-openharmony';
2
+ import { createRNOHPackages as createRNOHPackagesAutolinking } from "./RNOHPackagesFactory"
3
+
4
+ export function getRNOHPackages(ctx: RNPackageContext): RNOHPackage[] {
5
+ return [
6
+ ...createRNOHPackagesAutolinking(ctx)
7
+ ]
8
+ }
@@ -0,0 +1,11 @@
1
+ import {RNAbility} from '@rnoh/react-native-openharmony';
2
+
3
+ export default class EntryAbility extends RNAbility {
4
+ override getPagePath() {
5
+ return 'pages/Index';
6
+ }
7
+
8
+ override getRNOHWorkerScriptUrl() {
9
+ return "entry/ets/workers/RNOHWorker.ets"
10
+ }
11
+ }
@@ -0,0 +1 @@
1
+ /RNOHPackagesFactory.ets
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Importing some ets files in the following way results in runtime errors e.g.
3
+ * import { setupRNOHWorker } from "@rnoh/react-native-openharmony"
4
+ *
5
+ * It looks like this is ArkTS problem and it may be fixed in the future.
6
+ * For the time being, use direct imports.
7
+ */
8
+ import { setupRNOHWorker } from "@rnoh/react-native-openharmony/src/main/ets/setupRNOHWorker"
9
+ import { getRNOHPackages } from "../PackageProvider"
10
+
11
+ setupRNOHWorker({
12
+ createWorkerRNInstanceConfig: (_rnInstanceName) => {
13
+ return { thirdPartyPackagesFactory: getRNOHPackages }
14
+ }
15
+ })
16
+
@@ -0,0 +1,65 @@
1
+ {
2
+ "module": {
3
+ "name": "entry",
4
+ "type": "entry",
5
+ "description": "$string:module_desc",
6
+ "mainElement": "EntryAbility",
7
+ "deviceTypes": [
8
+ "default"
9
+ ],
10
+ "deliveryWithInstall": true,
11
+ "installationFree": false,
12
+ "pages": "$profile:main_pages",
13
+ // This is needed by bundleManager.canOpenLink to check if the app can open some url
14
+ "querySchemes": [
15
+ "maps",
16
+ "http",
17
+ "https",
18
+ "customDomain"
19
+ ],
20
+ "requestPermissions": [
21
+ {
22
+ "name": "ohos.permission.INTERNET"
23
+ },
24
+ {
25
+ "name": "ohos.permission.VIBRATE"
26
+ }
27
+ ],
28
+ "metadata": [
29
+ {
30
+ "name": "OPTLazyForEach",
31
+ "value": "true",
32
+ },
33
+ {
34
+ "name": "can_preview_text",
35
+ "value": "true",
36
+ },
37
+ {
38
+ "name": "halfLeading",
39
+ "value": "true",
40
+ },
41
+ ],
42
+ "abilities": [
43
+ {
44
+ "name": "EntryAbility",
45
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
46
+ "description": "$string:EntryAbility_desc",
47
+ "icon": "$media:layered_image",
48
+ "label": "$string:EntryAbility_label",
49
+ "startWindowIcon": "$media:startIcon",
50
+ "startWindowBackground": "$color:start_window_background",
51
+ "visible": true,
52
+ "skills": [
53
+ {
54
+ "entities": [
55
+ "entity.system.home"
56
+ ],
57
+ "actions": [
58
+ "action.system.home"
59
+ ],
60
+ }
61
+ ]
62
+ }
63
+ ]
64
+ }
65
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "color": [
3
+ {
4
+ "name": "start_window_background",
5
+ "value": "#FFFFFF"
6
+ }
7
+ ]
8
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "string": [
3
+ {
4
+ "name": "module_desc",
5
+ "value": "module description"
6
+ },
7
+ {
8
+ "name": "EntryAbility_desc",
9
+ "value": "description"
10
+ },
11
+ {
12
+ "name": "EntryAbility_label",
13
+ "value": "template app"
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "layered-image":
3
+ {
4
+ "background" : "$media:background",
5
+ "foreground" : "$media:foreground"
6
+ }
7
+ }
@@ -0,0 +1,2 @@
1
+ export default function testsuite() {
2
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "module": {
3
+ "name": "entry_test",
4
+ "type": "feature",
5
+ "deviceTypes": [
6
+ "phone",
7
+ "tablet",
8
+ "2in1"
9
+ ],
10
+ "deliveryWithInstall": true,
11
+ "installationFree": false
12
+ }
13
+ }
@@ -0,0 +1,16 @@
1
+ /build-profile.json5
2
+
3
+ # ---
4
+
5
+ /local.properties
6
+ /.idea
7
+ **/build
8
+ /.hvigor
9
+ .cxx
10
+ /.clangd
11
+ /.clang-format
12
+ /.clang-tidy
13
+ /oh_modules
14
+ hvigorw
15
+ hvigorw.bat
16
+ hvigor/hvigor-wrapper.js
@@ -0,0 +1,22 @@
1
+ {
2
+ modelVersion: '5.0.0',
3
+ dependencies: {
4
+ // "@rnoh/hvigor-plugin": "../../node_modules/<RNOH_CLI>/harmony/rnoh-hvigor-plugin-X.X.X.tgz",
5
+ },
6
+ execution: {
7
+ // "analyze": "default", /* Define the build analyze mode. Value: [ "default" | "verbose" | false ]. Default: "default" */
8
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
9
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
10
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
11
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
12
+ },
13
+ logging: {
14
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
15
+ },
16
+ debugging: {
17
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
18
+ },
19
+ nodeOptions: {
20
+ // "maxOldSpaceSize": 4096 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process */
21
+ },
22
+ }
@@ -0,0 +1,7 @@
1
+ import { appTasks } from '@ohos/hvigor-ohos-plugin';
2
+ import { createRNOHProjectPlugin } from '@rnoh/hvigor-plugin';
3
+
4
+ export default {
5
+ system: appTasks,
6
+ plugins: [createRNOHProjectPlugin()],
7
+ };
@@ -1,19 +1,4 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -23,92 +8,55 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
23
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
24
9
  });
25
10
  };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
28
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- 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;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
11
  Object.defineProperty(exports, "__esModule", { value: true });
54
12
  exports.RealCliExecutor = exports.CliExecutor = void 0;
55
- var node_child_process_1 = require("node:child_process");
56
- var CliExecutor = /** @class */ (function () {
57
- function CliExecutor() {
58
- }
59
- return CliExecutor;
60
- }());
13
+ const node_child_process_1 = require("node:child_process");
14
+ class CliExecutor {
15
+ }
61
16
  exports.CliExecutor = CliExecutor;
62
- var RealCliExecutor = /** @class */ (function (_super) {
63
- __extends(RealCliExecutor, _super);
64
- function RealCliExecutor() {
65
- return _super !== null && _super.apply(this, arguments) || this;
66
- }
67
- RealCliExecutor.prototype.run = function (command, options) {
68
- return __awaiter(this, void 0, void 0, function () {
69
- return __generator(this, function (_a) {
70
- return [2 /*return*/, new Promise(function (resolve, reject) {
71
- var _a, _b;
72
- var commandWithArgs = command;
73
- var argStrings = [];
74
- if (options === null || options === void 0 ? void 0 : options.args) {
75
- argStrings = options.args;
76
- commandWithArgs += ' ' + argStrings.join(' ');
77
- }
78
- (_a = options === null || options === void 0 ? void 0 : options.onArgsStringified) === null || _a === void 0 ? void 0 : _a.call(options, commandWithArgs);
79
- var process = (0, node_child_process_1.spawn)(command, argStrings, {
80
- cwd: (_b = options === null || options === void 0 ? void 0 : options.cwd) === null || _b === void 0 ? void 0 : _b.toString(),
81
- shell: (options === null || options === void 0 ? void 0 : options.shell) ? true : false,
82
- });
83
- var stdout = '';
84
- var stderr = '';
85
- process.stdout.on('data', function (data) {
86
- var _a;
87
- var output = data.toString();
88
- stdout += output;
89
- (_a = options === null || options === void 0 ? void 0 : options.onStdout) === null || _a === void 0 ? void 0 : _a.call(options, output);
90
- });
91
- process.stderr.on('data', function (data) {
92
- var _a;
93
- var output = data.toString();
94
- stderr += output;
95
- (_a = options === null || options === void 0 ? void 0 : options.onStderr) === null || _a === void 0 ? void 0 : _a.call(options, output);
96
- });
97
- process.on('error', function (error) {
98
- reject(error);
99
- });
100
- process.on('close', function (code) {
101
- if (code === 0) {
102
- resolve(stdout);
103
- }
104
- else {
105
- reject(new Error("Command failed with code ".concat(code, "\nStderr: ").concat(stderr)));
106
- }
107
- });
108
- })];
17
+ class RealCliExecutor extends CliExecutor {
18
+ run(command, options) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ return new Promise((resolve, reject) => {
21
+ var _a, _b;
22
+ let commandWithArgs = command;
23
+ let argStrings = [];
24
+ if (options === null || options === void 0 ? void 0 : options.args) {
25
+ argStrings = options.args;
26
+ commandWithArgs += ' ' + argStrings.join(' ');
27
+ }
28
+ (_a = options === null || options === void 0 ? void 0 : options.onArgsStringified) === null || _a === void 0 ? void 0 : _a.call(options, commandWithArgs);
29
+ const process = (0, node_child_process_1.spawn)(command, argStrings, {
30
+ cwd: (_b = options === null || options === void 0 ? void 0 : options.cwd) === null || _b === void 0 ? void 0 : _b.toString(),
31
+ shell: (options === null || options === void 0 ? void 0 : options.shell) ? true : false,
32
+ });
33
+ let stdout = '';
34
+ let stderr = '';
35
+ process.stdout.on('data', (data) => {
36
+ var _a;
37
+ const output = data.toString();
38
+ stdout += output;
39
+ (_a = options === null || options === void 0 ? void 0 : options.onStdout) === null || _a === void 0 ? void 0 : _a.call(options, output);
40
+ });
41
+ process.stderr.on('data', (data) => {
42
+ var _a;
43
+ const output = data.toString();
44
+ stderr += output;
45
+ (_a = options === null || options === void 0 ? void 0 : options.onStderr) === null || _a === void 0 ? void 0 : _a.call(options, output);
46
+ });
47
+ process.on('error', (error) => {
48
+ reject(error);
49
+ });
50
+ process.on('close', (code) => {
51
+ if (code === 0) {
52
+ resolve(stdout);
53
+ }
54
+ else {
55
+ reject(new Error(`Command failed with code ${code}\nStderr: ${stderr}`));
56
+ }
57
+ });
109
58
  });
110
59
  });
111
- };
112
- return RealCliExecutor;
113
- }(CliExecutor));
60
+ }
61
+ }
114
62
  exports.RealCliExecutor = RealCliExecutor;