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

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.40.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 +1 -1
@@ -8,33 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- 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);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- 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;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
11
  var __asyncValues = (this && this.__asyncValues) || function (o) {
39
12
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
40
13
  var m = o[Symbol.asyncIterator], i;
@@ -42,22 +15,16 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
42
15
  function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
43
16
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
44
17
  };
45
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
46
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
47
- if (ar || !(i in from)) {
48
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
49
- ar[i] = from[i];
50
- }
51
- }
52
- return to.concat(ar || Array.prototype.slice.call(from));
18
+ var __importDefault = (this && this.__importDefault) || function (mod) {
19
+ return (mod && mod.__esModule) ? mod : { "default": mod };
53
20
  };
54
21
  Object.defineProperty(exports, "__esModule", { value: true });
55
22
  exports.commandVerifyPackageHarmony = void 0;
56
- var cli_tools_1 = require("@react-native-community/cli-tools");
57
- var chalk_1 = require("chalk");
58
- var core_1 = require("../core");
59
- var io_1 = require("../io");
60
- var package_verifier_1 = require("../package-verifier");
23
+ const cli_tools_1 = require("@react-native-community/cli-tools");
24
+ const chalk_1 = __importDefault(require("chalk"));
25
+ const core_1 = require("../core");
26
+ const io_1 = require("../io");
27
+ const package_verifier_1 = require("../package-verifier");
61
28
  exports.commandVerifyPackageHarmony = {
62
29
  name: 'verify-package-harmony',
63
30
  description: 'Validates that a package is compliant with guidelines',
@@ -73,37 +40,25 @@ exports.commandVerifyPackageHarmony = {
73
40
  {
74
41
  name: '--skip-checks <string...>',
75
42
  description: 'Disable certain checks by their names',
76
- parse: function (val, prev) { return (prev ? __spreadArray(__spreadArray([], prev, true), [val], false) : [val]); },
43
+ parse: (val, prev) => (prev ? [...prev, val] : [val]),
77
44
  },
78
45
  ],
79
- func: function (argv, config, rawArgs) { return __awaiter(void 0, void 0, void 0, function () {
80
- var loader, args, checkResults, _a, _b, _c, checkResult, e_1_1, err_1;
81
- var _d, e_1, _e, _f;
82
- return __generator(this, function (_g) {
83
- switch (_g.label) {
84
- case 0:
85
- loader = (0, cli_tools_1.getLoader)();
86
- _g.label = 1;
87
- case 1:
88
- _g.trys.push([1, 14, , 15]);
89
- args = validateArgs(rawArgs);
90
- loader.info("Verifying RNOH package: ".concat(args.packagePath.getValue()));
91
- checkResults = [];
92
- _g.label = 2;
93
- case 2:
94
- _g.trys.push([2, 7, 8, 13]);
95
- _a = true, _b = __asyncValues((0, package_verifier_1.verifyRNOHPackage)({
96
- npmPackagePath: args.packagePath,
97
- hasHarmonyCode: args.hasHarmonyCode,
98
- checkNamesToSkip: args.checkNamesToSkip,
99
- }));
100
- _g.label = 3;
101
- case 3: return [4 /*yield*/, _b.next()];
102
- case 4:
103
- if (!(_c = _g.sent(), _d = _c.done, !_d)) return [3 /*break*/, 6];
104
- _f = _c.value;
105
- _a = false;
106
- checkResult = _f;
46
+ func: (argv, config, rawArgs) => __awaiter(void 0, void 0, void 0, function* () {
47
+ var _a, e_1, _b, _c;
48
+ const loader = (0, cli_tools_1.getLoader)();
49
+ try {
50
+ const args = validateArgs(rawArgs);
51
+ loader.info(`Verifying RNOH package: ${args.packagePath.getValue()}`);
52
+ const checkResults = [];
53
+ try {
54
+ for (var _d = true, _e = __asyncValues((0, package_verifier_1.verifyRNOHPackage)({
55
+ npmPackagePath: args.packagePath,
56
+ hasHarmonyCode: args.hasHarmonyCode,
57
+ checkNamesToSkip: args.checkNamesToSkip,
58
+ })), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
59
+ _c = _f.value;
60
+ _d = false;
61
+ const checkResult = _c;
107
62
  if (checkResult.type === 'START_PROCESS') {
108
63
  loader.start(chalk_1.default.gray(checkResult.name));
109
64
  }
@@ -111,49 +66,31 @@ exports.commandVerifyPackageHarmony = {
111
66
  checkResults.push(checkResult);
112
67
  logCheckResult(loader, checkResult);
113
68
  }
114
- _g.label = 5;
115
- case 5:
116
- _a = true;
117
- return [3 /*break*/, 3];
118
- case 6: return [3 /*break*/, 13];
119
- case 7:
120
- e_1_1 = _g.sent();
121
- e_1 = { error: e_1_1 };
122
- return [3 /*break*/, 13];
123
- case 8:
124
- _g.trys.push([8, , 11, 12]);
125
- if (!(!_a && !_d && (_e = _b.return))) return [3 /*break*/, 10];
126
- return [4 /*yield*/, _e.call(_b)];
127
- case 9:
128
- _g.sent();
129
- _g.label = 10;
130
- case 10: return [3 /*break*/, 12];
131
- case 11:
132
- if (e_1) throw e_1.error;
133
- return [7 /*endfinally*/];
134
- case 12: return [7 /*endfinally*/];
135
- case 13:
136
- if (checkResults.every(function (checkResult) {
137
- return checkResult.status === 'pass' || checkResult.status === 'skip';
138
- })) {
139
- loader.info(chalk_1.default.bold('OK'));
140
- }
141
- else {
142
- loader.info(chalk_1.default.red('Package verification failed. Please fix those checks before publishing your package.'));
143
- process.exit(1);
144
- }
145
- return [3 /*break*/, 15];
146
- case 14:
147
- err_1 = _g.sent();
148
- if (err_1 instanceof core_1.DescriptiveError) {
149
- new io_1.Logger().descriptiveError(err_1);
150
- process.exit(1);
151
- }
152
- throw err_1;
153
- case 15: return [2 /*return*/];
69
+ }
154
70
  }
155
- });
156
- }); },
71
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
72
+ finally {
73
+ try {
74
+ if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
75
+ }
76
+ finally { if (e_1) throw e_1.error; }
77
+ }
78
+ if (checkResults.every((checkResult) => checkResult.status === 'pass' || checkResult.status === 'skip')) {
79
+ loader.info(chalk_1.default.bold('OK'));
80
+ }
81
+ else {
82
+ loader.info(chalk_1.default.red('Package verification failed. Please fix those checks before publishing your package.'));
83
+ process.exit(1);
84
+ }
85
+ }
86
+ catch (err) {
87
+ if (err instanceof core_1.DescriptiveError) {
88
+ new io_1.Logger().descriptiveError(err);
89
+ process.exit(1);
90
+ }
91
+ throw err;
92
+ }
93
+ }),
157
94
  };
158
95
  function validateArgs(args) {
159
96
  if (!args.packagePath) {
@@ -171,17 +108,17 @@ function validateArgs(args) {
171
108
  };
172
109
  }
173
110
  function logCheckResult(loader, checkResult) {
174
- var prefix = (function () {
111
+ const prefix = (() => {
175
112
  switch (checkResult.status) {
176
113
  case 'pass':
177
- return "".concat(chalk_1.default.green('PASS'));
114
+ return `${chalk_1.default.green('PASS')}`;
178
115
  case 'fail':
179
- return "".concat(chalk_1.default.red('FAIL'));
116
+ return `${chalk_1.default.red('FAIL')}`;
180
117
  case 'skip':
181
- return "".concat(chalk_1.default.yellow('SKIP'));
118
+ return `${chalk_1.default.yellow('SKIP')}`;
182
119
  }
183
120
  })();
184
121
  loader.info(checkResult.message
185
- ? "[".concat(chalk_1.default.bold(prefix), "] ").concat(chalk_1.default.bold(checkResult.name), "\n").concat(checkResult.message)
186
- : "[".concat(chalk_1.default.bold(prefix), "] ").concat(chalk_1.default.bold(checkResult.name)));
122
+ ? `[${chalk_1.default.bold(prefix)}] ${chalk_1.default.bold(checkResult.name)}\n${checkResult.message}`
123
+ : `[${chalk_1.default.bold(prefix)}] ${chalk_1.default.bold(checkResult.name)}`);
187
124
  }
@@ -1,72 +1,56 @@
1
1
  "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
4
  };
11
5
  Object.defineProperty(exports, "__esModule", { value: true });
12
6
  exports.AbsolutePath = void 0;
13
- var node_path_1 = require("node:path");
14
- var AbsolutePath = /** @class */ (function () {
15
- function AbsolutePath(path) {
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ class AbsolutePath {
9
+ static fromSegments(...segments) {
10
+ return new AbsolutePath(node_path_1.default.join(...segments));
11
+ }
12
+ constructor(path) {
16
13
  this.value = '';
17
14
  this.value = node_path_1.default.resolve(path);
18
15
  }
19
- AbsolutePath.fromSegments = function () {
20
- var segments = [];
21
- for (var _i = 0; _i < arguments.length; _i++) {
22
- segments[_i] = arguments[_i];
23
- }
24
- return new AbsolutePath(node_path_1.default.join.apply(node_path_1.default, segments));
25
- };
26
- AbsolutePath.prototype.getValue = function () {
16
+ getValue() {
27
17
  return this.value;
28
- };
29
- AbsolutePath.prototype.toString = function () {
18
+ }
19
+ toString() {
30
20
  return this.value;
31
- };
32
- AbsolutePath.prototype.copyWithNewSegment = function () {
33
- var relativePath = [];
34
- for (var _i = 0; _i < arguments.length; _i++) {
35
- relativePath[_i] = arguments[_i];
36
- }
37
- return new AbsolutePath(node_path_1.default.join.apply(node_path_1.default, __spreadArray([this.getValue()], relativePath, false)));
38
- };
39
- AbsolutePath.prototype.getExtension = function () {
40
- var maybeExtWithDot = node_path_1.default.extname(this.value);
21
+ }
22
+ copyWithNewSegment(...relativePath) {
23
+ return new AbsolutePath(node_path_1.default.join(this.getValue(), ...relativePath));
24
+ }
25
+ getExtension() {
26
+ const maybeExtWithDot = node_path_1.default.extname(this.value);
41
27
  if (maybeExtWithDot) {
42
28
  return maybeExtWithDot.substring(1);
43
29
  }
44
30
  return null;
45
- };
46
- AbsolutePath.prototype.getBasename = function () {
31
+ }
32
+ getBasename() {
47
33
  return node_path_1.default.basename(this.value);
48
- };
49
- AbsolutePath.prototype.getDirectoryPath = function () {
50
- var dirPath = node_path_1.default.extname(this.value)
34
+ }
35
+ getDirectoryPath() {
36
+ const dirPath = node_path_1.default.extname(this.value)
51
37
  ? node_path_1.default.dirname(this.value)
52
38
  : this.value;
53
39
  return new AbsolutePath(dirPath);
54
- };
55
- AbsolutePath.prototype.relativeTo = function (absolutePath) {
40
+ }
41
+ relativeTo(absolutePath) {
56
42
  return new RelativePath(node_path_1.default.relative(absolutePath.getValue(), this.value));
57
- };
58
- return AbsolutePath;
59
- }());
43
+ }
44
+ }
60
45
  exports.AbsolutePath = AbsolutePath;
61
- var RelativePath = /** @class */ (function () {
62
- function RelativePath(value) {
46
+ class RelativePath {
47
+ constructor(value) {
63
48
  this.value = value;
64
49
  }
65
- RelativePath.prototype.getValue = function () {
50
+ getValue() {
66
51
  return this.value;
67
- };
68
- RelativePath.prototype.toString = function () {
52
+ }
53
+ toString() {
69
54
  return this.value;
70
- };
71
- return RelativePath;
72
- }());
55
+ }
56
+ }
@@ -1,18 +1,17 @@
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.CodegenConfig = void 0;
4
- var node_fs_1 = require("node:fs");
5
- var io_1 = require("../io");
6
- var DescriptiveError_1 = require("./DescriptiveError");
7
- var CodegenConfig = /** @class */ (function () {
8
- function CodegenConfig(specFilePaths, version) {
9
- this.specFilePaths = specFilePaths;
10
- this.version = version;
11
- }
12
- CodegenConfig.fromRawCodegenConfig = function (rawCodegenConfig, packageRootPath, projectRootPath, packageName) {
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const io_1 = require("../io");
9
+ const DescriptiveError_1 = require("./DescriptiveError");
10
+ class CodegenConfig {
11
+ static fromRawCodegenConfig(rawCodegenConfig, packageRootPath, projectRootPath, packageName) {
13
12
  var _a, _b;
14
- var SUPPORTED_SPEC_EXTENSIONS = ['js', 'jsx', 'ts', 'tsx'];
15
- var specPaths = ((_a = rawCodegenConfig.specPaths) !== null && _a !== void 0 ? _a : []).map(function (rawSpecPath) {
13
+ const SUPPORTED_SPEC_EXTENSIONS = ['js', 'jsx', 'ts', 'tsx'];
14
+ const specPaths = ((_a = rawCodegenConfig.specPaths) !== null && _a !== void 0 ? _a : []).map((rawSpecPath) => {
16
15
  if (rawSpecPath.startsWith('~')) {
17
16
  return projectRootPath.copyWithNewSegment(rawSpecPath.replace('~', ''));
18
17
  }
@@ -20,12 +19,12 @@ var CodegenConfig = /** @class */ (function () {
20
19
  return packageRootPath.copyWithNewSegment(rawSpecPath);
21
20
  }
22
21
  });
23
- var specFilePaths = specPaths.flatMap(function (specPath) {
22
+ const specFilePaths = specPaths.flatMap((specPath) => {
24
23
  if (!node_fs_1.default.existsSync(specPath.getValue())) {
25
24
  throw new DescriptiveError_1.DescriptiveError({
26
- whatHappened: "No such file or directory: ".concat(specPath.getValue()),
25
+ whatHappened: `No such file or directory: ${specPath.getValue()}`,
27
26
  whatCanUserDo: [
28
- "Please verify \"".concat(packageName, "/package.json::harmony::codegenConfig\". If you are not the maintainer of this package, please report this problem to the package maintainer."),
27
+ `Please verify "${packageName}/package.json::harmony::codegenConfig". If you are not the maintainer of this package, please report this problem to the package maintainer.`,
29
28
  ],
30
29
  });
31
30
  }
@@ -33,7 +32,7 @@ var CodegenConfig = /** @class */ (function () {
33
32
  return (0, io_1.findFilePathsWithExtensions)(specPath, SUPPORTED_SPEC_EXTENSIONS);
34
33
  }
35
34
  else {
36
- var ext = specPath.getExtension();
35
+ const ext = specPath.getExtension();
37
36
  if (ext && SUPPORTED_SPEC_EXTENSIONS.includes(ext)) {
38
37
  return [specPath];
39
38
  }
@@ -41,13 +40,16 @@ var CodegenConfig = /** @class */ (function () {
41
40
  }
42
41
  });
43
42
  return new CodegenConfig(specFilePaths, (_b = rawCodegenConfig.version) !== null && _b !== void 0 ? _b : 1);
44
- };
45
- CodegenConfig.prototype.getSpecFilePaths = function () {
43
+ }
44
+ constructor(specFilePaths, version) {
45
+ this.specFilePaths = specFilePaths;
46
+ this.version = version;
47
+ }
48
+ getSpecFilePaths() {
46
49
  return this.specFilePaths;
47
- };
48
- CodegenConfig.prototype.getVersion = function () {
50
+ }
51
+ getVersion() {
49
52
  return this.version;
50
- };
51
- return CodegenConfig;
52
- }());
53
+ }
54
+ }
53
55
  exports.CodegenConfig = CodegenConfig;
@@ -1,35 +1,18 @@
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
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.DescriptiveError = void 0;
19
- var DescriptiveError = /** @class */ (function (_super) {
20
- __extends(DescriptiveError, _super);
21
- function DescriptiveError(data) {
22
- var _this = _super.call(this, data.whatHappened) || this;
23
- _this.data = data;
24
- return _this;
4
+ class DescriptiveError extends Error {
5
+ constructor(data) {
6
+ super(data.whatHappened);
7
+ this.data = data;
25
8
  }
26
- DescriptiveError.prototype.isUnexpected = function () {
9
+ isUnexpected() {
27
10
  return 'unexpected' in this.data;
28
- };
29
- DescriptiveError.prototype.getMessage = function () {
11
+ }
12
+ getMessage() {
30
13
  return this.data.whatHappened;
31
- };
32
- DescriptiveError.prototype.getSuggestions = function () {
14
+ }
15
+ getSuggestions() {
33
16
  var _a;
34
17
  if ('whatCanUserDo' in this.data) {
35
18
  return (_a = this.data.whatCanUserDo) !== null && _a !== void 0 ? _a : [];
@@ -37,11 +20,11 @@ var DescriptiveError = /** @class */ (function (_super) {
37
20
  else {
38
21
  return [];
39
22
  }
40
- };
41
- DescriptiveError.prototype.getRawData = function () {
23
+ }
24
+ getRawData() {
42
25
  return this.data;
43
- };
44
- DescriptiveError.prototype.getDetails = function () {
26
+ }
27
+ getDetails() {
45
28
  var _a;
46
29
  if (!this.data.extraData) {
47
30
  return '';
@@ -50,11 +33,10 @@ var DescriptiveError = /** @class */ (function (_super) {
50
33
  return this.data.extraData.trim();
51
34
  }
52
35
  if (this.data.extraData instanceof Error) {
53
- var lines = [
54
- "".concat(this.data.extraData.name, ": ").concat(this.data.extraData.message),
36
+ let lines = [
37
+ `${this.data.extraData.name}: ${this.data.extraData.message}`,
55
38
  ];
56
- for (var _i = 0, _b = ((_a = this.data.extraData.stack) !== null && _a !== void 0 ? _a : '').split('\n'); _i < _b.length; _i++) {
57
- var stackEntry = _b[_i];
39
+ for (let stackEntry of ((_a = this.data.extraData.stack) !== null && _a !== void 0 ? _a : '').split('\n')) {
58
40
  lines.push('');
59
41
  lines.push(stackEntry);
60
42
  }
@@ -66,7 +48,6 @@ var DescriptiveError = /** @class */ (function (_super) {
66
48
  catch (err) {
67
49
  return '';
68
50
  }
69
- };
70
- return DescriptiveError;
71
- }(Error));
51
+ }
52
+ }
72
53
  exports.DescriptiveError = DescriptiveError;
@@ -1,22 +1,19 @@
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.FS = exports.Dirent = void 0;
4
- var node_path_1 = require("node:path");
5
- var Dirent = /** @class */ (function () {
6
- function Dirent() {
7
- }
8
- return Dirent;
9
- }());
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ class Dirent {
9
+ }
10
10
  exports.Dirent = Dirent;
11
- var FS = /** @class */ (function () {
12
- function FS() {
13
- }
14
- FS.prototype.findFilePathsWithExtensions = function (dirPath, fileExtensions) {
15
- var results = [];
16
- var dirents = this.readDirentsSync(dirPath);
17
- for (var _i = 0, dirents_1 = dirents; _i < dirents_1.length; _i++) {
18
- var dirent = dirents_1[_i];
19
- var path = dirPath.copyWithNewSegment(dirent.name.toString());
11
+ class FS {
12
+ findFilePathsWithExtensions(dirPath, fileExtensions) {
13
+ let results = [];
14
+ const dirents = this.readDirentsSync(dirPath);
15
+ for (const dirent of dirents) {
16
+ const path = dirPath.copyWithNewSegment(dirent.name.toString());
20
17
  if (dirent.isDirectory()) {
21
18
  results = results.concat(this.findFilePathsWithExtensions(path, fileExtensions));
22
19
  }
@@ -25,7 +22,6 @@ var FS = /** @class */ (function () {
25
22
  }
26
23
  }
27
24
  return results;
28
- };
29
- return FS;
30
- }());
25
+ }
26
+ }
31
27
  exports.FS = FS;
@@ -1,29 +1,23 @@
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.OHPackageJSON5 = void 0;
4
- var json5_1 = require("json5");
5
- var node_fs_1 = require("node:fs");
6
- var OHPackageJSON5 = /** @class */ (function () {
7
- function OHPackageJSON5(rawData) {
7
+ const json5_1 = __importDefault(require("json5"));
8
+ const node_fs_1 = __importDefault(require("node:fs"));
9
+ class OHPackageJSON5 {
10
+ static fromPath(ohPackageJson5Path) {
11
+ return new OHPackageJSON5(json5_1.default.parse(node_fs_1.default.readFileSync(ohPackageJson5Path.getValue(), { encoding: 'utf-8' })));
12
+ }
13
+ constructor(rawData) {
8
14
  this.rawData = rawData;
9
15
  }
10
- OHPackageJSON5.fromPath = function (ohPackageJson5Path) {
11
- return new OHPackageJSON5(json5_1.default.parse(node_fs_1.default.readFileSync(ohPackageJson5Path.getValue(), { encoding: 'utf-8' })));
12
- };
13
- Object.defineProperty(OHPackageJSON5.prototype, "name", {
14
- get: function () {
15
- return this.rawData['name'];
16
- },
17
- enumerable: false,
18
- configurable: true
19
- });
20
- Object.defineProperty(OHPackageJSON5.prototype, "version", {
21
- get: function () {
22
- return this.rawData['version'];
23
- },
24
- enumerable: false,
25
- configurable: true
26
- });
27
- return OHPackageJSON5;
28
- }());
16
+ get name() {
17
+ return this.rawData['name'];
18
+ }
19
+ get version() {
20
+ return this.rawData['version'];
21
+ }
22
+ }
29
23
  exports.OHPackageJSON5 = OHPackageJSON5;