@react-native-oh/react-native-harmony-cli 0.82.32 → 0.82.34

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 (220) hide show
  1. package/README.md +2 -2
  2. package/dist/assetResolver.js +1 -1
  3. package/dist/autolinking/Autolinking.js +4 -2
  4. package/dist/autolinking/JSON5Writer.js +5 -1
  5. package/dist/codegen/core/TypeAnnotationToTS.js +2 -0
  6. package/dist/commands/bundle-harmony.js +7 -2
  7. package/dist/commands/clean-harmony.js +5 -5
  8. package/dist/commands/init-harmony.js +2 -2
  9. package/dist/commands/init.js +2 -2
  10. package/dist/commands/verify-package-harmony.js +2 -0
  11. package/dist/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +1 -1
  12. package/dist/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +2 -2
  13. package/dist/package-verifier/verify-package.js +1 -1
  14. package/dist/simulator/LaunchSimulator.js +14 -6
  15. package/harmony/rnoh-hvigor-plugin-0.82.34.tgz +0 -0
  16. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/00295336 +0 -0
  17. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/008b46d2 +0 -0
  18. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/00cd4dda +0 -0
  19. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/04cea04c +0 -0
  20. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/05456871 +0 -0
  21. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/0ae32abb +0 -0
  22. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/0b48ad8e +0 -0
  23. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/0cae97fc +0 -0
  24. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/1480fa97 +0 -0
  25. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/1605ee89 +0 -0
  26. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/1e6ae961 +0 -0
  27. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/240d2667 +0 -0
  28. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/27934436 +0 -0
  29. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/308da66a +0 -0
  30. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/3442f3cf +0 -0
  31. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/349f72a0 +0 -0
  32. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/37767edf +0 -0
  33. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/37ce5add +0 -0
  34. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/385deae1 +0 -0
  35. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/3cd62667 +0 -0
  36. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/4387cd63 +0 -0
  37. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/444b6d47 +0 -0
  38. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/45ece0fb +0 -0
  39. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/47ccd396 +0 -0
  40. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/496f7444 +0 -0
  41. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/4d82696e +0 -0
  42. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/4eb25953 +0 -0
  43. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/50c3e9bb +0 -0
  44. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/5926231b +0 -0
  45. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/59c354c2 +0 -0
  46. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/5c74cb2d +0 -0
  47. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/5dcb9ab8 +0 -0
  48. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/5e5aa298 +0 -0
  49. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/5ebb4e14 +0 -0
  50. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/608a0945 +0 -0
  51. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/62001dcc +0 -0
  52. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/63177a89 +0 -0
  53. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/690790d2 +0 -0
  54. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/6948fdf0 +0 -0
  55. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/6debf626 +0 -0
  56. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/708bb39b +0 -0
  57. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/76f64b03 +0 -0
  58. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/78ea606f +0 -0
  59. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/7b8ac24d +0 -0
  60. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/7d186843 +0 -0
  61. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/7f12dc56 +0 -0
  62. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/8313724a +0 -0
  63. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/84492c6c +0 -0
  64. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/8449f6fc +0 -0
  65. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/86506236 +0 -0
  66. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/8b8ad1ff +0 -0
  67. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/8f473a16 +0 -0
  68. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/8f91e6a2 +0 -0
  69. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/9ef6c589 +0 -0
  70. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/a06f5312 +0 -0
  71. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/a25c6436 +0 -0
  72. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/a376585e +0 -0
  73. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/a4e0b7a8 +0 -0
  74. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/a53962e8 +0 -0
  75. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/a576458a +0 -0
  76. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/a8bbebf8 +0 -0
  77. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/af8536f0 +0 -0
  78. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/b00cb392 +0 -0
  79. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/b26b36fb +0 -0
  80. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/b3783e31 +0 -0
  81. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/b41523d2 +0 -0
  82. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/b45a94bb +0 -0
  83. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/bb2a0b08 +0 -0
  84. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/bb563230 +0 -0
  85. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/bd3da552 +0 -0
  86. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/c3025482 +0 -0
  87. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/c75a650e +0 -0
  88. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/c7dc8283 +0 -0
  89. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/cbf6c034 +0 -0
  90. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/cf9197ca +0 -0
  91. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/cffe922b +0 -0
  92. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/d49ea56c +0 -0
  93. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/d533a666 +0 -0
  94. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/d948e745 +0 -0
  95. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/d9f2d22b +0 -0
  96. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/dc1052ee +0 -0
  97. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/dde88fbf +0 -0
  98. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/dfa0a41b +0 -0
  99. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/edce8119 +0 -0
  100. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/ee4cf060 +0 -0
  101. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/f079d49d +0 -0
  102. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/f2452d07 +0 -0
  103. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/fb134c38 +0 -0
  104. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/fd1210c0 +0 -0
  105. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/fe159876 +0 -0
  106. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/ff657ffe +0 -0
  107. package/node-compile-cache/v24.14.1-x64-cf738c9d-0/ff687756 +0 -0
  108. package/package.json +5 -5
  109. package/src/assetResolver.ts +1 -1
  110. package/src/autolinking/Autolinking.test.ts +56 -0
  111. package/src/autolinking/Autolinking.ts +7 -3
  112. package/src/autolinking/JSON5Writer.ts +5 -1
  113. package/src/codegen/core/TypeAnnotationToTS.ts +2 -0
  114. package/src/commands/bundle-harmony.ts +7 -2
  115. package/src/commands/clean-harmony.ts +8 -6
  116. package/src/commands/init-harmony.ts +2 -2
  117. package/src/commands/init.ts +7 -3
  118. package/src/commands/run-harmony.ts +7 -1
  119. package/src/commands/verify-package-harmony.ts +2 -0
  120. package/src/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +1 -1
  121. package/src/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +2 -2
  122. package/src/package-verifier/verify-package.ts +1 -1
  123. package/src/simulator/LaunchSimulator.ts +6 -6
  124. package/harmony/rnoh-hvigor-plugin-0.82.32.tgz +0 -0
  125. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/00a68392 +0 -0
  126. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0544a6cc +0 -0
  127. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0f36b2db +0 -0
  128. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/12f23f1e +0 -0
  129. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/13d95d98 +0 -0
  130. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1629e86b +0 -0
  131. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/180c8379 +0 -0
  132. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1a697147 +0 -0
  133. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1a8271b1 +0 -0
  134. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1b7fa689 +0 -0
  135. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/255a9f13 +0 -0
  136. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/268d155b +0 -0
  137. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/27db9aa4 +0 -0
  138. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/28db79ed +0 -0
  139. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2dc2bbcb +0 -0
  140. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2df5f8c5 +0 -0
  141. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2f88aedb +0 -0
  142. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/31b3a7ea +0 -0
  143. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/36335b1c +0 -0
  144. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/38fca641 +0 -0
  145. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/397722eb +0 -0
  146. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/397b6432 +0 -0
  147. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3b17421f +0 -0
  148. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/454f5e18 +0 -0
  149. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/45ec6cce +0 -0
  150. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/482d51b1 +0 -0
  151. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4ac5cd67 +0 -0
  152. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4d40499a +0 -0
  153. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4dcad919 +0 -0
  154. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4fc31929 +0 -0
  155. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/54edc8f5 +0 -0
  156. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/558a5405 +0 -0
  157. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/58d2b670 +0 -0
  158. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5ec7feca +0 -0
  159. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/62180f3e +0 -0
  160. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/63981360 +0 -0
  161. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/64096c89 +0 -0
  162. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/64af560b +0 -0
  163. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6585e783 +0 -0
  164. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6954304f +0 -0
  165. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/69fd6235 +0 -0
  166. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6d3a0478 +0 -0
  167. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6e131db7 +0 -0
  168. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/778cd8f1 +0 -0
  169. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/788206b6 +0 -0
  170. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7882dc26 +0 -0
  171. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7b3c14f7 +0 -0
  172. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7cdfe667 +0 -0
  173. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8048c487 +0 -0
  174. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8332d9a3 +0 -0
  175. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/84e5b603 +0 -0
  176. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/854d8127 +0 -0
  177. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/88c97376 +0 -0
  178. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/90d5f644 +0 -0
  179. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/967e25ac +0 -0
  180. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/969896c2 +0 -0
  181. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/9790193e +0 -0
  182. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/97ae40c5 +0 -0
  183. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/9a5bf482 +0 -0
  184. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a07adeb9 +0 -0
  185. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a427f355 +0 -0
  186. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a9dd7eb7 +0 -0
  187. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a9e9d79e +0 -0
  188. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ab920855 +0 -0
  189. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ab9e3038 +0 -0
  190. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/af054988 +0 -0
  191. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/afe03e51 +0 -0
  192. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b3b83913 +0 -0
  193. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b4db7b4d +0 -0
  194. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b5225355 +0 -0
  195. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b8c00f06 +0 -0
  196. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b917a081 +0 -0
  197. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b9e2f3bd +0 -0
  198. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/bd70db0e +0 -0
  199. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/bdbda648 +0 -0
  200. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/be1e5469 +0 -0
  201. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c9462295 +0 -0
  202. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ca6e5efa +0 -0
  203. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/caf52beb +0 -0
  204. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cb268960 +0 -0
  205. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cca16b15 +0 -0
  206. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cfc1c937 +0 -0
  207. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d10e6e05 +0 -0
  208. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d172fc04 +0 -0
  209. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d4e94e50 +0 -0
  210. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d59f8d2c +0 -0
  211. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/da964053 +0 -0
  212. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e0bb712a +0 -0
  213. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e3e6ca34 +0 -0
  214. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e50f7385 +0 -0
  215. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f1a1d282 +0 -0
  216. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f2514c3c +0 -0
  217. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f66207cf +0 -0
  218. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f8d129ce +0 -0
  219. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/fb1e9558 +0 -0
  220. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ff7e3608 +0 -0
@@ -202,6 +202,7 @@ export class Autolinking {
202
202
  const autolinkingConfig =
203
203
  providedAutolinkingConfig === true ? {} : providedAutolinkingConfig;
204
204
 
205
+
205
206
  // 获取自定义的 HAR 扫描路径
206
207
  const mainHarPath = autolinkingConfig?.mainHarPath;
207
208
 
@@ -241,6 +242,7 @@ export class Autolinking {
241
242
  cppRNOHPackageClassName: autolinkingConfig?.cppPackageClassName,
242
243
  cmakeLibraryTargetName: autolinkingConfig?.cmakeLibraryTargetName,
243
244
  });
245
+
244
246
  }
245
247
  );
246
248
  const ohPackagePath = harmonyProjectPath.copyWithNewSegment(
@@ -357,10 +359,11 @@ export class Autolinking {
357
359
  this.npmPackageNameToCMakeLibraryTargetName(lib.npmPackageName),
358
360
  resolvedHars: lib.resolvedHars,
359
361
  };
362
+
360
363
  });
361
364
  autolinkableLibraries.sort((a, b) => {
362
- if (a.npmPackageName < b.npmPackageName) return -1;
363
- if (a.npmPackageName > b.npmPackageName) return 1;
365
+ if (a.npmPackageName < b.npmPackageName) { return -1; }
366
+ if (a.npmPackageName > b.npmPackageName) { return 1; }
364
367
  return 0;
365
368
  });
366
369
 
@@ -428,6 +431,7 @@ export class Autolinking {
428
431
  ...lib,
429
432
  ohPackageName: primaryOhPackageName,
430
433
  };
434
+
431
435
  });
432
436
 
433
437
  return {
@@ -518,7 +522,7 @@ export class Autolinking {
518
522
  if (afterNodeModules.startsWith('@')) {
519
523
  const parts = afterNodeModules.split('/');
520
524
  if (parts.length >= 2) {
521
- return `${parts[0]}/${parts[1]}`; // @scope/package
525
+ return `${parts[0]}/${parts[1]}`; // @scope/package
522
526
  }
523
527
  } else {
524
528
  // 非 scoped package
@@ -40,7 +40,11 @@ export class JSON5Writer {
40
40
  // Return the modified source with JSON5-style formatting
41
41
  // Use double quotes for both keys and values, and trailing commas
42
42
  // quoteKeys: true ensures keys with special characters (like @, /, -) are properly quoted
43
- return writer.toSource({ quote: 'double', quoteKeys: true, trailingComma: true }) + '\n';
43
+ // NOTE: toSource() preserves the original trailing newlines, so strip them
44
+ // before appending exactly one — otherwise every rewrite appends an extra
45
+ // blank line and they accumulate across builds (idempotency fix).
46
+ const source = writer.toSource({ quote: 'double', quoteKeys: true, trailingComma: true });
47
+ return source.replace(/(\r?\n)+$/, '') + '\n';
44
48
  }
45
49
 
46
50
  /**
@@ -153,6 +153,8 @@ export class TypeAnnotationToTS {
153
153
  return 'Object';
154
154
  case 'StringTypeAnnotation':
155
155
  return 'string';
156
+ default:
157
+ return 'unknown';
156
158
  }
157
159
  }
158
160
 
@@ -138,6 +138,7 @@ export const commandBundleHarmony: Command = {
138
138
  func: async (argv, config, args: any) => {
139
139
  const logger = new Logger();
140
140
  try {
141
+ debugLog(`bundle-harmony entry: entry=${args.entryFile} dev=${args.dev} minify=${args.minify} jsEngine=${args.jsEngine} sourcemap=${args.sourcemapOutput} bundleOutput=${args.bundleOutput}`);
141
142
  const defaultBundleName =
142
143
  args.jsEngine === 'hermes' ? 'hermes_bundle.hbc' : 'bundle.harmony.js';
143
144
  const bundleOutput: string =
@@ -158,12 +159,16 @@ export const commandBundleHarmony: Command = {
158
159
  sourceMap: args.sourcemapOutput,
159
160
  sourceMapUrl: args.sourcemapOutput,
160
161
  };
162
+ const configLoadStart = Date.now();
161
163
  const metroConfig = await loadMetroConfig({
162
164
  config: args.config,
163
165
  resetCache: args.resetCache,
164
166
  });
167
+ debugLog(`Metro config loaded in ${Date.now() - configLoadStart}ms`);
165
168
 
166
- const {assets, ...bundle}= await createBundle(metroConfig, buildOptions);
169
+ const bundleStart = Date.now();
170
+ const {assets, ...bundle } = await createBundle(metroConfig, buildOptions);
171
+ debugLog(`Bundle built in ${Date.now() - bundleStart}ms, codeSize=${bundle.code?.length ?? 0}`);
167
172
 
168
173
  if (shouldGenerateHbcBundle) {
169
174
  debugLog('Starting Hermes bytecode compilation...');
@@ -179,7 +184,7 @@ export const commandBundleHarmony: Command = {
179
184
  await saveJSBundle(logger, bundle, bundleOutput);
180
185
  }
181
186
  maybeSaveSourceMap(logger, bundle, args.sourcemapOutput);
182
- if(assets){
187
+ if (assets) {
183
188
  await copyAssets(logger, assets, assetsDest);
184
189
  debugLog('Assets copy completed, cleaning up...');
185
190
  }
@@ -19,15 +19,15 @@ export const commandCleanHarmony: Command = {
19
19
  description: 'Remove cached files in the OpenHarmony project.',
20
20
  options: [
21
21
  {
22
- name: "--harmony-project-path <path>",
23
- description: "Specifies the root of your OpenHarmony project.",
24
- default: "./harmony"
22
+ name: '--harmony-project-path <path>',
23
+ description: 'Specifies the root of your OpenHarmony project.',
24
+ default: './harmony'
25
25
  }
26
26
  ],
27
27
  func: async (_argv, _config, rawArgs: any) => {
28
28
  const harmonyProjectPath = new AbsolutePath(rawArgs.harmonyProjectPath);
29
- const md5Path = crypto.createHash("md5").update(harmonyProjectPath.getValue()).digest("hex");
30
- const hvigorCachePath = new AbsolutePath(path.join(os.homedir(), ".hvigor", "project_caches", md5Path));
29
+ const md5Path = crypto.createHash('md5').update(harmonyProjectPath.getValue()).digest('hex');
30
+ const hvigorCachePath = new AbsolutePath(path.join(os.homedir(), '.hvigor', 'project_caches', md5Path));
31
31
 
32
32
  if (fs.existsSync(hvigorCachePath.getValue())) {
33
33
  fs.rmSync(hvigorCachePath.getValue(), { recursive: true, force: true });
@@ -42,16 +42,18 @@ export const commandCleanHarmony: Command = {
42
42
  if (Array.isArray(buildProfile.modules)) {
43
43
  buildProfile.modules.forEach((module: any) => {
44
44
  if (module && module.srcPath) {
45
- const modulePath = harmonyProjectPath.copyWithNewSegment(module.srcPath);
45
+ const modulePath = harmonyProjectPath.copyWithNewSegment(module.srcPath);
46
46
  const cxxPath = modulePath.copyWithNewSegment('.cxx');
47
47
  const buildPath = modulePath.copyWithNewSegment('build');
48
48
 
49
49
  if (fs.existsSync(cxxPath.getValue())) {
50
50
  fs.rmSync(cxxPath.getValue(), { recursive: true, force: true });
51
+
51
52
  }
52
53
 
53
54
  if (fs.existsSync(buildPath.getValue())) {
54
55
  fs.rmSync(buildPath.getValue(), { recursive: true, force: true });
56
+
55
57
  }
56
58
  }
57
59
  });
@@ -223,12 +223,12 @@ export const commandInitHarmony: Command = {
223
223
  fs.writeTextSync(path, content);
224
224
  });
225
225
 
226
- const buildProfileTemplateComment = "build-profile.json5 can contain signingConfigs which are unique for each developer, therefore that file is ignored by Git. Create a build-profile.json5 based on this template after cloning this repository to be able to open this project in DevEco Studio.";
226
+ const buildProfileTemplateComment = 'build-profile.json5 can contain signingConfigs which are unique for each developer, therefore that file is ignored by Git. Create a build-profile.json5 based on this template after cloning this repository to be able to open this project in DevEco Studio.';
227
227
 
228
228
  const buildProfilePath = harmonyDirPath.copyWithNewSegment('build-profile.json5');
229
229
  const buildProfileContent = fs.readTextSync(buildProfilePath);
230
230
  const contentLines = buildProfileContent.split('\n');
231
- contentLines.splice(1, 0, " // " + buildProfileTemplateComment);
231
+ contentLines.splice(1, 0, ' // ' + buildProfileTemplateComment);
232
232
  const buildProfileTemplateContent = contentLines.join('\n');
233
233
 
234
234
  fs.writeTextSync(
@@ -153,7 +153,7 @@ class ValidationHelper {
153
153
  }
154
154
  return reactNativeVersion;
155
155
  }
156
- return "0.77";
156
+ return '0.77';
157
157
  }
158
158
  }
159
159
 
@@ -482,6 +482,7 @@ async function renameDotFiles(destDir: string): Promise<void> {
482
482
  const srcPath = path.join(destDir, src);
483
483
  if (await fs.pathExists(srcPath)) {
484
484
  await fs.move(srcPath, path.join(destDir, dest), { overwrite: true });
485
+
485
486
  }
486
487
  });
487
488
 
@@ -580,7 +581,7 @@ async function cleanupTempDir(tempDir: string): Promise<void> {
580
581
  async function getRNOHVersion(rnVersion: string): Promise<string> {
581
582
  const versionParts = rnVersion.split('.');
582
583
  const majorMinorVersion = `${versionParts[0]}.${versionParts[1]}`;
583
- let versionInfos = "";
584
+ let versionInfos = '';
584
585
  await runCliCommand(NPM_EXE, ['view', DEFAULT_TEMPLATE_PKG, 'versions', '--json'], process.cwd(), false,
585
586
  (data) => {
586
587
  versionInfos += data.toString();
@@ -597,7 +598,10 @@ async function getRNOHVersion(rnVersion: string): Promise<string> {
597
598
  return matchingVersions.pop();
598
599
  }
599
600
 
600
- async function handleMissingHarmonyDir(destDir: string, rnVersion: string): Promise<{ rnohTemplateConfig: TemplateConfig, rnohVersion: string, rnohCliVersion: string }> {
601
+ async function handleMissingHarmonyDir(
602
+ destDir: string,
603
+ rnVersion: string,
604
+ ): Promise<{ rnohTemplateConfig: TemplateConfig, rnohVersion: string, rnohCliVersion: string }> {
601
605
  const lastestVersion = await getRNOHVersion(rnVersion);
602
606
  const defaultTempDir = await createTempDir();
603
607
  try {
@@ -192,7 +192,7 @@ export const commandRunHarmony: Command = {
192
192
  message: 'Please select a device:',
193
193
  choices: connectedDevices.map((deviceOrSimulator, index) => `${index + 1}. ${deviceOrSimulator.name}`)
194
194
  }
195
- ])
195
+ ]);
196
196
  return connectedDevices[parseInt(answers.selectedDeviceIndex) - 1].name;
197
197
  }
198
198
 
@@ -333,6 +333,7 @@ export const commandRunHarmony: Command = {
333
333
  onArgsStringified: (commandWithArgs) =>
334
334
  logger.debug((s) => s.bold(s.gray(commandWithArgs))),
335
335
  });
336
+
336
337
  if (result.startsWith('[Fail]')) {
337
338
  throw new DescriptiveError({ whatHappened: result });
338
339
  }
@@ -363,6 +364,7 @@ export const commandRunHarmony: Command = {
363
364
  logger.debug((s) => s.gray(msg.trimEnd()));
364
365
  },
365
366
  });
367
+
366
368
  if (fportInfo.includes(`tcp:${currentPort} tcp:${currentPort}`)) {
367
369
  await exec(hdcPathStr, [
368
370
  'fport',
@@ -397,6 +399,7 @@ export const commandRunHarmony: Command = {
397
399
  .toString(),
398
400
  ohosTmpDirPath,
399
401
  ]);
402
+
400
403
  const installationResult = await exec(hdcPathStr, [
401
404
  '-t',
402
405
  deviceOrSimulatorName,
@@ -406,6 +409,7 @@ export const commandRunHarmony: Command = {
406
409
  '-p',
407
410
  ohosTmpDirPath,
408
411
  ]);
412
+
409
413
  if (installationResult.includes('failed to install')) {
410
414
  throw new DescriptiveError({
411
415
  whatHappened: 'Installation failed.',
@@ -413,6 +417,7 @@ export const commandRunHarmony: Command = {
413
417
  `If an application with the same bundle name is already installed, try uninstalling it:\n${hdcPathStr} shell bm uninstall -n ${bundleName}`,
414
418
  ],
415
419
  });
420
+
416
421
  }
417
422
  } finally {
418
423
  await exec(hdcPathStr, ['-t', deviceOrSimulatorName, 'shell', 'rm', '-rf', ohosTmpDirPath]);
@@ -428,6 +433,7 @@ export const commandRunHarmony: Command = {
428
433
  '-b',
429
434
  bundleName,
430
435
  ]);
436
+
431
437
  await tryRemoveForwardPorting();
432
438
  await exec(hdcPathStr, [
433
439
  '-t',
@@ -105,6 +105,8 @@ function logCheckResult(loader: Loader, checkResult: CheckResult) {
105
105
  return `${chalk.red('FAIL')}`;
106
106
  case 'skip':
107
107
  return `${chalk.yellow('SKIP')}`;
108
+ default:
109
+ return '';
108
110
  }
109
111
  })();
110
112
  loader.info(
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { RNPackageContext, RNOHPackage } from '@rnoh/react-native-openharmony';
9
- import { createRNOHPackages as createRNOHPackagesAutolinking } from "./RNOHPackagesFactory"
9
+ import { createRNOHPackages as createRNOHPackagesAutolinking } from './RNOHPackagesFactory'
10
10
 
11
11
  export function getRNOHPackages(ctx: RNPackageContext): RNOHPackage[] {
12
12
  return [
@@ -12,8 +12,8 @@
12
12
  * It looks like this is ArkTS problem and it may be fixed in the future.
13
13
  * For the time being, use direct imports.
14
14
  */
15
- import { setupRNOHWorker } from "@rnoh/react-native-openharmony/src/main/ets/setupRNOHWorker"
16
- import { getRNOHPackages } from "../PackageProvider"
15
+ import { setupRNOHWorker } from '@rnoh/react-native-openharmony/src/main/ets/setupRNOHWorker'
16
+ import { getRNOHPackages } from '../PackageProvider'
17
17
 
18
18
  setupRNOHWorker({
19
19
  createWorkerRNInstanceConfig: (_rnInstanceName) => {
@@ -116,7 +116,7 @@ function findHarPath(packagePath: AbsolutePath): AbsolutePath | null {
116
116
  const harFilenames = fileOrDirNames.filter((fileOrDirName) =>
117
117
  fileOrDirName.endsWith('.har')
118
118
  );
119
- if (harFilenames.length != 1) {
119
+ if (harFilenames.length !== 1) {
120
120
  return null;
121
121
  }
122
122
  return packageHarmonyPath.copyWithNewSegment(harFilenames[0]);
@@ -25,13 +25,13 @@ function compareVersionTuple(a: number[], b: number[]): number {
25
25
  for (let i = 0; i < Math.max(a.length, b.length); i++) {
26
26
  const av = a[i] ?? 0;
27
27
  const bv = b[i] ?? 0;
28
- if (av !== bv) return av - bv;
28
+ if (av !== bv) { return av - bv; }
29
29
  }
30
30
  return 0;
31
31
  }
32
32
  function isSupportedVersion(versionDir: string): boolean {
33
33
  const m = versionDir.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)/);
34
- if (!m) return false;
34
+ if (!m) { return false; }
35
35
  const current = m.slice(1).map(n => parseInt(n, 10));
36
36
  return compareVersionTuple(current, MIN_SUPPORTED_VERSION) >= 0;
37
37
  }
@@ -143,9 +143,9 @@ function parseDeviceManagerXml(xmlContent: string): DevicePathInfo {
143
143
  while ((m = optionRegex.exec(xmlContent))) {
144
144
  const tag = m[0];
145
145
  const nameMatch = tag.match(/\bname=["']([^"']+)["']/i);
146
- if (!nameMatch) continue;
146
+ if (!nameMatch) { continue };
147
147
  const valueMatch = tag.match(/\bvalue=["']([^"']+)["']/i);
148
- if (!valueMatch) continue;
148
+ if (!valueMatch) { continue };
149
149
  const name = nameMatch[1];
150
150
  const value = valueMatch[1];
151
151
  if (name === 'imageDeployPath' && !info.imageRoot) {
@@ -153,7 +153,7 @@ function parseDeviceManagerXml(xmlContent: string): DevicePathInfo {
153
153
  } else if (name === 'openharmonyDeployPath' && !info.instancePath) {
154
154
  info.instancePath = value;
155
155
  }
156
- if (info.imageRoot && info.instancePath) break;
156
+ if (info.imageRoot && info.instancePath) { break; }
157
157
  }
158
158
  return info;
159
159
  }
@@ -221,7 +221,7 @@ async function resolveInstanceAndImageRoot(
221
221
  try {
222
222
  const content = await fs.readFile(xmlPath, 'utf-8');
223
223
  xmlInfo = parseDeviceManagerXml(content);
224
- if (xmlInfo.instancePath || xmlInfo.imageRoot) break;
224
+ if (xmlInfo.instancePath || xmlInfo.imageRoot) { break; }
225
225
  } catch (error) {
226
226
  throw new DescriptiveError({
227
227
  whatHappened: `Failed to read or parse device manager XML at ${xmlPath}: ${(error as any)?.message || error}`,