@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,32 +8,8 @@ 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
- }
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
13
  };
38
14
  Object.defineProperty(exports, "__esModule", { value: true });
39
15
  exports.copyAssets = copyAssets;
@@ -43,18 +19,17 @@ exports.copyAssets = copyAssets;
43
19
  * This source code is licensed under the MIT license found in the
44
20
  * LICENSE-MIT file in the root directory of this source tree.
45
21
  */
46
- var fs_1 = require("fs");
47
- var path_1 = require("path");
48
- var ALLOWED_SCALES = [1, 2, 3, 4];
22
+ const fs_1 = __importDefault(require("fs"));
23
+ const path_1 = __importDefault(require("path"));
24
+ const ALLOWED_SCALES = [1, 2, 3, 4];
49
25
  function filterAssetScales(scales) {
50
- var result = scales.filter(function (scale) { return ALLOWED_SCALES.includes(scale); });
26
+ const result = scales.filter(scale => ALLOWED_SCALES.includes(scale));
51
27
  if (result.length === 0 && scales.length > 0) {
52
28
  // No matching scale found, but there are some available. Ideally we don't
53
29
  // want to be in this situation and should throw, but for now as a fallback
54
30
  // let's just use the closest larger image
55
- var maxScale = ALLOWED_SCALES[ALLOWED_SCALES.length - 1];
56
- for (var _i = 0, scales_1 = scales; _i < scales_1.length; _i++) {
57
- var scale = scales_1[_i];
31
+ const maxScale = ALLOWED_SCALES[ALLOWED_SCALES.length - 1];
32
+ for (const scale of scales) {
58
33
  if (scale > maxScale) {
59
34
  result.push(scale);
60
35
  break;
@@ -68,69 +43,63 @@ function filterAssetScales(scales) {
68
43
  return result;
69
44
  }
70
45
  function copyAssets(logger, assetsData, assetsDest) {
71
- return __awaiter(this, void 0, void 0, function () {
72
- var filesToCopy, addAssetToCopy;
73
- return __generator(this, function (_a) {
74
- if (assetsDest == null) {
75
- logger.warn(function (s) { return 'Assets destination folder is not set, skipping...'; });
76
- return [2 /*return*/];
77
- }
78
- filesToCopy = {};
79
- addAssetToCopy = function (asset) {
80
- var validScales = filterAssetScales(asset.scales);
81
- asset.scales.forEach(function (scale, idx) {
82
- if (!validScales.includes(scale)) {
83
- return;
84
- }
85
- var src = asset.files[idx];
86
- var dest = path_1.default.join(assetsDest, getAssetDestRelativePath(asset, scale));
87
- filesToCopy[src] = dest;
88
- });
89
- };
90
- assetsData.forEach(addAssetToCopy);
91
- return [2 /*return*/, copyFiles(logger, filesToCopy)];
92
- });
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ if (assetsDest == null) {
48
+ logger.warn((s) => 'Assets destination folder is not set, skipping...');
49
+ return;
50
+ }
51
+ const filesToCopy = {};
52
+ const addAssetToCopy = (asset) => {
53
+ const validScales = filterAssetScales(asset.scales);
54
+ asset.scales.forEach((scale, idx) => {
55
+ if (!validScales.includes(scale)) {
56
+ return;
57
+ }
58
+ const src = asset.files[idx];
59
+ const dest = path_1.default.join(assetsDest, getAssetDestRelativePath(asset, scale));
60
+ filesToCopy[src] = dest;
61
+ });
62
+ };
63
+ assetsData.forEach(addAssetToCopy);
64
+ return copyFiles(logger, filesToCopy);
93
65
  });
94
66
  }
95
- function getAssetDestRelativePath(asset, scale) {
96
- if (scale === void 0) { scale = 1; }
97
- var suffix = scale === 1 ? '' : "@".concat(scale, "x");
98
- var fileName = getResourceIdentifier(asset);
67
+ function getAssetDestRelativePath(asset, scale = 1) {
68
+ const suffix = scale === 1 ? '' : `@${scale}x`;
69
+ const fileName = getResourceIdentifier(asset);
99
70
  // Assets can have relative paths outside of the project root.
100
71
  // Replace `../` with `_` to make sure they don't end up outside of
101
72
  // the expected assets directory.
102
- return "".concat(fileName + suffix, ".").concat(asset.type).replace(/\.\.\//g, '_');
73
+ return `${fileName + suffix}.${asset.type}`.replace(/\.\.\//g, '_');
103
74
  }
104
75
  function getResourceIdentifier(asset) {
105
- var folderPath = getBasePath(asset);
106
- return "".concat(folderPath, "/").concat(asset.name).replace(/^assets\//, '');
76
+ const folderPath = getBasePath(asset);
77
+ return `${folderPath}/${asset.name}`.replace(/^assets\//, '');
107
78
  }
108
79
  function getBasePath(asset) {
109
- var basePath = asset.httpServerLocation;
80
+ const basePath = asset.httpServerLocation;
110
81
  return basePath.startsWith('/') ? basePath.slice(1) : basePath;
111
82
  }
112
83
  function copyFiles(logger, fileDestBySrc) {
113
- var fileSources = Object.keys(fileDestBySrc);
84
+ const fileSources = Object.keys(fileDestBySrc);
114
85
  if (fileSources.length === 0) {
115
86
  return Promise.resolve();
116
87
  }
117
- var assetFilesCount = fileSources.length;
118
- return new Promise(function (resolve, reject) {
119
- var copyNext = function (error) {
88
+ const assetFilesCount = fileSources.length;
89
+ return new Promise((resolve, reject) => {
90
+ const copyNext = (error) => {
120
91
  if (error) {
121
92
  reject(error);
122
93
  return;
123
94
  }
124
95
  if (fileSources.length === 0) {
125
- logger.info(function () {
126
- return "Copied ".concat(assetFilesCount, " ").concat(assetFilesCount === 1 ? 'asset' : 'assets');
127
- });
96
+ logger.info(() => `Copied ${assetFilesCount} ${assetFilesCount === 1 ? 'asset' : 'assets'}`);
128
97
  resolve();
129
98
  }
130
99
  else {
131
100
  // fileSources.length === 0 is checked in previous branch, so this is string
132
- var src = fileSources.shift();
133
- var dest = fileDestBySrc[src];
101
+ const src = fileSources.shift();
102
+ const dest = fileDestBySrc[src];
134
103
  copyFile(src, dest, copyNext);
135
104
  }
136
105
  };
@@ -138,8 +107,8 @@ function copyFiles(logger, fileDestBySrc) {
138
107
  });
139
108
  }
140
109
  function copyFile(src, dest, onFinished) {
141
- var destDir = path_1.default.dirname(dest);
142
- fs_1.default.mkdir(destDir, { recursive: true }, function (err) {
110
+ const destDir = path_1.default.dirname(dest);
111
+ fs_1.default.mkdir(destDir, { recursive: true }, (err) => {
143
112
  if (err) {
144
113
  onFinished(err);
145
114
  return;
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -19,152 +8,171 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
19
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
20
9
  });
21
10
  };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- 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);
24
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
- 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;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
48
13
  };
49
14
  Object.defineProperty(exports, "__esModule", { value: true });
50
15
  exports.Autolinking = void 0;
51
- var json5_1 = require("json5");
52
- var core_1 = require("../core");
53
- var mustache_1 = require("mustache");
54
- var case_1 = require("case");
55
- var node_path_1 = require("node:path");
56
- var ETS_RNOH_PACKAGES_FACTORY_TEMPLATE = "\n/*\n * This file was generated by RNOH autolinking.\n * DO NOT modify it manually, your changes WILL be overwritten.\n */\nimport type { RNPackageContext, RNOHPackage } from '@rnoh/react-native-openharmony';\n{{#libraries}}\nimport {{etsRNOHPackageClassName}} from '{{{ohPackageName}}}';\n{{/libraries}}\n\nexport function createRNOHPackages(ctx: RNPackageContext): RNOHPackage[] {\n return [\n{{#libraries}}\n new {{etsRNOHPackageClassName}}(ctx),\n{{/libraries}}\n ];\n}\n".trimStart();
57
- var CPP_RNOH_PACKAGES_FACTORY_TEMPLATE = "\n/*\n * This file was generated by RNOH autolinking.\n * DO NOT modify it manually, your changes WILL be overwritten.\n */\n// clang-format off\n#pragma once\n#include \"RNOH/Package.h\"\n{{#libraries}}\n#include \"{{cppRNOHPackageClassName}}.h\"\n{{/libraries}}\n\nstd::vector<rnoh::Package::Shared> createRNOHPackages(const rnoh::Package::Context &ctx) {\n return {\n{{#libraries}}\n std::make_shared<rnoh::{{cppRNOHPackageClassName}}>(ctx),\n{{/libraries}}\n };\n}\n".trimStart();
58
- var CMAKE_AUTOLINKING_TEMPLATE = "\n# This file was generated by RNOH autolinking.\n# DO NOT modify it manually, your changes WILL be overwritten.\ncmake_minimum_required(VERSION 3.5)\n\n# @actor RNOH_APP\nfunction(autolink_libraries target)\n{{#libraries}}\n add_subdirectory(\"${OH_MODULES_DIR}/{{{ohPackageName}}}/src/main/cpp\" ./{{cmakeLibraryTargetName}})\n{{/libraries}}\n\n set(AUTOLINKED_LIBRARIES\n{{#libraries}}\n {{cmakeLibraryTargetName}}\n{{/libraries}}\n )\n\n foreach(lib ${AUTOLINKED_LIBRARIES})\n target_link_libraries(${target} PUBLIC ${lib})\n endforeach()\nendfunction()\n".trimStart();
59
- var Autolinking = /** @class */ (function () {
60
- function Autolinking(fs, logger) {
16
+ const json5_1 = __importDefault(require("json5"));
17
+ const core_1 = require("../core");
18
+ const mustache_1 = __importDefault(require("mustache"));
19
+ const case_1 = __importDefault(require("case"));
20
+ const node_path_1 = __importDefault(require("node:path"));
21
+ const ETS_RNOH_PACKAGES_FACTORY_TEMPLATE = `
22
+ /*
23
+ * This file was generated by RNOH autolinking.
24
+ * DO NOT modify it manually, your changes WILL be overwritten.
25
+ */
26
+ import type { RNPackageContext, RNOHPackage } from '@rnoh/react-native-openharmony';
27
+ {{#libraries}}
28
+ import {{etsRNOHPackageClassName}} from '{{{ohPackageName}}}';
29
+ {{/libraries}}
30
+
31
+ export function createRNOHPackages(ctx: RNPackageContext): RNOHPackage[] {
32
+ return [
33
+ {{#libraries}}
34
+ new {{etsRNOHPackageClassName}}(ctx),
35
+ {{/libraries}}
36
+ ];
37
+ }
38
+ `.trimStart();
39
+ const CPP_RNOH_PACKAGES_FACTORY_TEMPLATE = `
40
+ /*
41
+ * This file was generated by RNOH autolinking.
42
+ * DO NOT modify it manually, your changes WILL be overwritten.
43
+ */
44
+ // clang-format off
45
+ #pragma once
46
+ #include "RNOH/Package.h"
47
+ {{#libraries}}
48
+ #include "{{cppRNOHPackageClassName}}.h"
49
+ {{/libraries}}
50
+
51
+ std::vector<rnoh::Package::Shared> createRNOHPackages(const rnoh::Package::Context &ctx) {
52
+ return {
53
+ {{#libraries}}
54
+ std::make_shared<rnoh::{{cppRNOHPackageClassName}}>(ctx),
55
+ {{/libraries}}
56
+ };
57
+ }
58
+ `.trimStart();
59
+ const CMAKE_AUTOLINKING_TEMPLATE = `
60
+ # This file was generated by RNOH autolinking.
61
+ # DO NOT modify it manually, your changes WILL be overwritten.
62
+ cmake_minimum_required(VERSION 3.5)
63
+
64
+ # @actor RNOH_APP
65
+ function(autolink_libraries target)
66
+ {{#libraries}}
67
+ add_subdirectory("\${OH_MODULES_DIR}/{{{ohPackageName}}}/src/main/cpp" ./{{cmakeLibraryTargetName}})
68
+ {{/libraries}}
69
+
70
+ set(AUTOLINKED_LIBRARIES
71
+ {{#libraries}}
72
+ {{cmakeLibraryTargetName}}
73
+ {{/libraries}}
74
+ )
75
+
76
+ foreach(lib \${AUTOLINKED_LIBRARIES})
77
+ target_link_libraries(\${target} PUBLIC \${lib})
78
+ endforeach()
79
+ endfunction()
80
+ `.trimStart();
81
+ class Autolinking {
82
+ constructor(fs, logger) {
61
83
  this.fs = fs;
62
84
  this.logger = logger;
63
85
  }
64
- Autolinking.prototype.prepareInput = function (config) {
65
- return __awaiter(this, void 0, void 0, function () {
66
- var harmonyProjectPath, nodeModuleHarPaths, autolinkableLibraries, projectRootPath, skippedLibraryNpmPackageNames, ohPackagePath, ohPackageContent, cppRNOHPackagesFactoryPath, cmakeAutolinkingPath;
86
+ prepareInput(config) {
87
+ return __awaiter(this, void 0, void 0, function* () {
67
88
  var _a;
68
- return __generator(this, function (_b) {
69
- switch (_b.label) {
70
- case 0:
71
- if (config.includedNpmPackageNames.size > 0 &&
72
- config.excludedNpmPackageNames.size > 0) {
73
- throw new core_1.DescriptiveError({
74
- whatHappened: 'Tried to exclude and include npm packages.',
75
- whatCanUserDo: ['Include or exclude npm packages, but not both.'],
76
- extraData: {
77
- includedNpmPackageNamesCount: config.includedNpmPackageNames.size,
78
- excludedNpmPackageNamesCount: config.excludedNpmPackageNames.size,
79
- includedNpmPackageNames: config.includedNpmPackageNames,
80
- excludedNpmPackageNames: config.excludedNpmPackageNames,
81
- },
82
- });
83
- }
84
- harmonyProjectPath = (_a = config.harmonyProjectPath) !== null && _a !== void 0 ? _a : new core_1.AbsolutePath('./');
85
- nodeModuleHarPaths = [];
86
- autolinkableLibraries = [];
87
- projectRootPath = config.nodeModulesPath.copyWithNewSegment('..');
88
- skippedLibraryNpmPackageNames = [];
89
- return [4 /*yield*/, new core_1.ProjectDependenciesManager(this.fs, projectRootPath).forEachAsync(function (dependency) {
90
- var _a;
91
- var harFilePaths = dependency.getHarFilePaths();
92
- if (harFilePaths.length === 0) {
93
- return;
94
- }
95
- nodeModuleHarPaths.push.apply(nodeModuleHarPaths, harFilePaths);
96
- var packageJson = dependency.readPackageJSON();
97
- var providedAutolinkingConfig = (_a = packageJson.harmony) === null || _a === void 0 ? void 0 : _a.autolinking;
98
- if (providedAutolinkingConfig === undefined ||
99
- providedAutolinkingConfig === null ||
100
- (config.excludedNpmPackageNames.has(packageJson.name) &&
101
- config.excludedNpmPackageNames.size > 0) ||
102
- (!config.includedNpmPackageNames.has(packageJson.name) &&
103
- config.includedNpmPackageNames.size > 0) ||
104
- harFilePaths.length !== 1) {
105
- skippedLibraryNpmPackageNames.push(packageJson.name);
106
- return;
107
- }
108
- var autolinkingConfig = providedAutolinkingConfig === true ? {} : providedAutolinkingConfig;
109
- autolinkableLibraries.push({
110
- npmPackageName: packageJson.name,
111
- etsRNOHPackageClassName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.etsPackageClassName,
112
- cppRNOHPackageClassName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.cppPackageClassName,
113
- cmakeLibraryTargetName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.cmakeLibraryTargetName,
114
- ohPackageName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.ohPackageName,
115
- harFilePathRelativeToHarmony: harFilePaths[0]
116
- .relativeTo(harmonyProjectPath)
117
- .toString(),
118
- });
119
- })];
120
- case 1:
121
- _b.sent();
122
- ohPackagePath = harmonyProjectPath.copyWithNewSegment(config.ohPackagePathRelativeToHarmony);
123
- return [4 /*yield*/, this.fs.readText(ohPackagePath)];
124
- case 2:
125
- ohPackageContent = _b.sent();
126
- cppRNOHPackagesFactoryPath = harmonyProjectPath.copyWithNewSegment(config.cppRNOHPackagesFactoryPathRelativeToHarmony);
127
- cmakeAutolinkingPath = harmonyProjectPath.copyWithNewSegment(config.cmakeAutolinkPathRelativeToHarmony);
128
- return [2 /*return*/, {
129
- projectRootPath: projectRootPath,
130
- skippedLibraryNpmPackageNames: skippedLibraryNpmPackageNames,
131
- etsRNOHPackagesFactoryPath: harmonyProjectPath.copyWithNewSegment(config.etsRNOHPackagesFactoryPathRelativeToHarmony),
132
- cppRNOHPackagesFactoryPath: cppRNOHPackagesFactoryPath,
133
- cmakeAutolinkingPath: cmakeAutolinkingPath,
134
- ohPackagePathAndContent: [ohPackagePath, ohPackageContent],
135
- autolinkableLibraries: autolinkableLibraries,
136
- nodeModuleHarFilePathsRelativeToHarmony: nodeModuleHarPaths.map(function (p) {
137
- return p.relativeTo(harmonyProjectPath).toString();
138
- }),
139
- }];
89
+ if (config.includedNpmPackageNames.size > 0 &&
90
+ config.excludedNpmPackageNames.size > 0) {
91
+ throw new core_1.DescriptiveError({
92
+ whatHappened: 'Tried to exclude and include npm packages.',
93
+ whatCanUserDo: ['Include or exclude npm packages, but not both.'],
94
+ extraData: {
95
+ includedNpmPackageNamesCount: config.includedNpmPackageNames.size,
96
+ excludedNpmPackageNamesCount: config.excludedNpmPackageNames.size,
97
+ includedNpmPackageNames: config.includedNpmPackageNames,
98
+ excludedNpmPackageNames: config.excludedNpmPackageNames,
99
+ },
100
+ });
101
+ }
102
+ const harmonyProjectPath = (_a = config.harmonyProjectPath) !== null && _a !== void 0 ? _a : new core_1.AbsolutePath('./');
103
+ const nodeModuleHarPaths = [];
104
+ const autolinkableLibraries = [];
105
+ const projectRootPath = config.nodeModulesPath.copyWithNewSegment('..');
106
+ const skippedLibraryNpmPackageNames = [];
107
+ yield new core_1.ProjectDependenciesManager(this.fs, projectRootPath).forEachAsync((dependency) => {
108
+ var _a;
109
+ const harFilePaths = dependency.getHarFilePaths();
110
+ if (harFilePaths.length === 0) {
111
+ return;
112
+ }
113
+ nodeModuleHarPaths.push(...harFilePaths);
114
+ const packageJson = dependency.readPackageJSON();
115
+ const providedAutolinkingConfig = (_a = packageJson.harmony) === null || _a === void 0 ? void 0 : _a.autolinking;
116
+ if (providedAutolinkingConfig === undefined ||
117
+ providedAutolinkingConfig === null ||
118
+ (config.excludedNpmPackageNames.has(packageJson.name) &&
119
+ config.excludedNpmPackageNames.size > 0) ||
120
+ (!config.includedNpmPackageNames.has(packageJson.name) &&
121
+ config.includedNpmPackageNames.size > 0) ||
122
+ harFilePaths.length !== 1) {
123
+ skippedLibraryNpmPackageNames.push(packageJson.name);
124
+ return;
140
125
  }
126
+ const autolinkingConfig = providedAutolinkingConfig === true ? {} : providedAutolinkingConfig;
127
+ autolinkableLibraries.push({
128
+ npmPackageName: packageJson.name,
129
+ etsRNOHPackageClassName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.etsPackageClassName,
130
+ cppRNOHPackageClassName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.cppPackageClassName,
131
+ cmakeLibraryTargetName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.cmakeLibraryTargetName,
132
+ ohPackageName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.ohPackageName,
133
+ harFilePathRelativeToHarmony: harFilePaths[0]
134
+ .relativeTo(harmonyProjectPath)
135
+ .toString(),
136
+ });
141
137
  });
138
+ const ohPackagePath = harmonyProjectPath.copyWithNewSegment(config.ohPackagePathRelativeToHarmony);
139
+ const ohPackageContent = yield this.fs.readText(ohPackagePath);
140
+ const cppRNOHPackagesFactoryPath = harmonyProjectPath.copyWithNewSegment(config.cppRNOHPackagesFactoryPathRelativeToHarmony);
141
+ const cmakeAutolinkingPath = harmonyProjectPath.copyWithNewSegment(config.cmakeAutolinkPathRelativeToHarmony);
142
+ return {
143
+ projectRootPath,
144
+ skippedLibraryNpmPackageNames,
145
+ etsRNOHPackagesFactoryPath: harmonyProjectPath.copyWithNewSegment(config.etsRNOHPackagesFactoryPathRelativeToHarmony),
146
+ cppRNOHPackagesFactoryPath,
147
+ cmakeAutolinkingPath: cmakeAutolinkingPath,
148
+ ohPackagePathAndContent: [ohPackagePath, ohPackageContent],
149
+ autolinkableLibraries,
150
+ nodeModuleHarFilePathsRelativeToHarmony: nodeModuleHarPaths.map((p) => p.relativeTo(harmonyProjectPath).toString()),
151
+ };
142
152
  });
143
- };
144
- Autolinking.prototype.evaluate = function (input) {
145
- var _this = this;
146
- var autolinkableLibraries = input.autolinkableLibraries.map(function (lib) {
153
+ }
154
+ evaluate(input) {
155
+ const autolinkableLibraries = input.autolinkableLibraries.map((lib) => {
147
156
  var _a, _b, _c, _d;
148
- return __assign(__assign({}, lib), { etsRNOHPackageClassName: (_a = lib.etsRNOHPackageClassName) !== null && _a !== void 0 ? _a : _this.npmPackageNameToRNOHPackageClassName(lib.npmPackageName), cppRNOHPackageClassName: (_b = lib.cppRNOHPackageClassName) !== null && _b !== void 0 ? _b : _this.npmPackageNameToRNOHPackageClassName(lib.npmPackageName), cmakeLibraryTargetName: (_c = lib.cmakeLibraryTargetName) !== null && _c !== void 0 ? _c : _this.npmPackageNameToCMakeLibraryTargetName(lib.npmPackageName), ohPackageName: (_d = lib.ohPackageName) !== null && _d !== void 0 ? _d : _this.npmPackageNameToOHPackageName(lib.npmPackageName) });
157
+ return Object.assign(Object.assign({}, lib), { etsRNOHPackageClassName: (_a = lib.etsRNOHPackageClassName) !== null && _a !== void 0 ? _a : this.npmPackageNameToRNOHPackageClassName(lib.npmPackageName), cppRNOHPackageClassName: (_b = lib.cppRNOHPackageClassName) !== null && _b !== void 0 ? _b : this.npmPackageNameToRNOHPackageClassName(lib.npmPackageName), cmakeLibraryTargetName: (_c = lib.cmakeLibraryTargetName) !== null && _c !== void 0 ? _c : this.npmPackageNameToCMakeLibraryTargetName(lib.npmPackageName), ohPackageName: (_d = lib.ohPackageName) !== null && _d !== void 0 ? _d : this.npmPackageNameToOHPackageName(lib.npmPackageName) });
149
158
  });
150
- autolinkableLibraries.sort(function (a, b) {
159
+ autolinkableLibraries.sort((a, b) => {
151
160
  if (a.npmPackageName < b.npmPackageName)
152
161
  return -1;
153
162
  if (a.npmPackageName > b.npmPackageName)
154
163
  return 1;
155
164
  return 0;
156
165
  });
157
- var ohPackage = json5_1.default.parse(input.ohPackagePathAndContent[1]);
158
- var autolinkableHarFilePathsRelativeToHarmony = autolinkableLibraries.map(function (lib) { return lib.harFilePathRelativeToHarmony; });
159
- var unmanagedNativeDependencySpecifierByName = {};
160
- Object.entries(ohPackage.dependencies).forEach(function (_a) {
161
- var name = _a[0], dependencySpecifier = _a[1];
166
+ const ohPackage = json5_1.default.parse(input.ohPackagePathAndContent[1]);
167
+ const autolinkableHarFilePathsRelativeToHarmony = autolinkableLibraries.map((lib) => lib.harFilePathRelativeToHarmony);
168
+ const unmanagedNativeDependencySpecifierByName = {};
169
+ Object.entries(ohPackage.dependencies).forEach(([name, dependencySpecifier]) => {
162
170
  if (!(dependencySpecifier.includes('file:') &&
163
171
  dependencySpecifier.includes('node_modules'))) {
164
172
  unmanagedNativeDependencySpecifierByName[name] = dependencySpecifier;
165
173
  }
166
174
  else {
167
- var harFilePathRelativeToHarmony = dependencySpecifier.replace('file:', '');
175
+ const harFilePathRelativeToHarmony = dependencySpecifier.replace('file:', '');
168
176
  if (!autolinkableHarFilePathsRelativeToHarmony.includes(node_path_1.default.normalize(harFilePathRelativeToHarmony)) &&
169
177
  input.nodeModuleHarFilePathsRelativeToHarmony.includes(node_path_1.default.normalize(harFilePathRelativeToHarmony))) {
170
178
  unmanagedNativeDependencySpecifierByName[name] =
@@ -172,15 +180,14 @@ var Autolinking = /** @class */ (function () {
172
180
  }
173
181
  }
174
182
  });
175
- var managedNativeDependencySpecifierByName = {};
176
- for (var _i = 0, autolinkableLibraries_1 = autolinkableLibraries; _i < autolinkableLibraries_1.length; _i++) {
177
- var library = autolinkableLibraries_1[_i];
183
+ const managedNativeDependencySpecifierByName = {};
184
+ for (const library of autolinkableLibraries) {
178
185
  managedNativeDependencySpecifierByName[library.ohPackageName] =
179
- "file:".concat(library.harFilePathRelativeToHarmony).split(node_path_1.default.sep).join('/');
186
+ `file:${library.harFilePathRelativeToHarmony}`.split(node_path_1.default.sep).join('/');
180
187
  }
181
188
  return {
182
189
  skippedLibraryNpmPackageNames: input.skippedLibraryNpmPackageNames,
183
- linkedLibraryNpmPackageNames: autolinkableLibraries.map(function (lib) { return lib.npmPackageName; }),
190
+ linkedLibraryNpmPackageNames: autolinkableLibraries.map((lib) => lib.npmPackageName),
184
191
  projectRootPath: input.projectRootPath,
185
192
  cppRNOHPackagesFactoryPathAndContent: [
186
193
  input.cppRNOHPackagesFactoryPath,
@@ -202,70 +209,62 @@ var Autolinking = /** @class */ (function () {
202
209
  ],
203
210
  ohPackagePathAndContent: [
204
211
  input.ohPackagePathAndContent[0],
205
- json5_1.default.stringify(__assign(__assign({}, ohPackage), { dependencies: __assign(__assign({}, unmanagedNativeDependencySpecifierByName), managedNativeDependencySpecifierByName) }), { space: 2, quote: '"' }) + '\n',
212
+ json5_1.default.stringify(Object.assign(Object.assign({}, ohPackage), { dependencies: Object.assign(Object.assign({}, unmanagedNativeDependencySpecifierByName), managedNativeDependencySpecifierByName) }), { space: 2, quote: '"' }) + '\n',
206
213
  ],
207
214
  };
208
- };
209
- Autolinking.prototype.npmPackageNameToRNOHPackageClassName = function (fullNpmPackageName) {
215
+ }
216
+ npmPackageNameToRNOHPackageClassName(fullNpmPackageName) {
210
217
  if (fullNpmPackageName.startsWith('@')) {
211
- var _a = fullNpmPackageName
218
+ const [scopeName, packageName] = fullNpmPackageName
212
219
  .replace('@', '')
213
- .split('/'), scopeName = _a[0], packageName = _a[1];
220
+ .split('/');
214
221
  return case_1.default.pascal(scopeName) + case_1.default.pascal(packageName) + 'Package';
215
222
  }
216
223
  return case_1.default.pascal(fullNpmPackageName) + 'Package';
217
- };
218
- Autolinking.prototype.npmPackageNameToCMakeLibraryTargetName = function (fullNpmPackageName) {
224
+ }
225
+ npmPackageNameToCMakeLibraryTargetName(fullNpmPackageName) {
219
226
  if (fullNpmPackageName.startsWith('@')) {
220
- var _a = fullNpmPackageName
227
+ const [scopeName, packageName] = fullNpmPackageName
221
228
  .replace('@', '')
222
- .split('/'), scopeName = _a[0], packageName = _a[1];
229
+ .split('/');
223
230
  return 'rnoh__' + case_1.default.snake(scopeName) + '__' + case_1.default.snake(packageName);
224
231
  }
225
232
  return 'rnoh__' + case_1.default.snake(fullNpmPackageName);
226
- };
227
- Autolinking.prototype.npmPackageNameToOHPackageName = function (fullNpmPackageName) {
233
+ }
234
+ npmPackageNameToOHPackageName(fullNpmPackageName) {
228
235
  if (fullNpmPackageName.startsWith('@')) {
229
- var _a = fullNpmPackageName
236
+ const [scopeName, packageName] = fullNpmPackageName
230
237
  .replace('@', '')
231
- .split('/'), scopeName = _a[0], packageName = _a[1];
238
+ .split('/');
232
239
  return '@rnoh/' + case_1.default.kebab(scopeName) + '--' + case_1.default.kebab(packageName);
233
240
  }
234
241
  return '@rnoh/' + case_1.default.kebab(fullNpmPackageName);
235
- };
236
- Autolinking.prototype.saveAndLogOutput = function (output) {
237
- var _this = this;
238
- var pathAndContentPairs = [];
242
+ }
243
+ saveAndLogOutput(output) {
244
+ const pathAndContentPairs = [];
239
245
  pathAndContentPairs.push(output.etsRNOHPackagesFactoryPathAndContent);
240
246
  pathAndContentPairs.push(output.cppRNOHPackagesFactoryPathAndContent);
241
247
  pathAndContentPairs.push(output.cmakeAutolinkingPathAndContent);
242
248
  pathAndContentPairs.push(output.ohPackagePathAndContent);
243
- pathAndContentPairs.forEach(function (_a) {
244
- var path = _a[0], content = _a[1];
245
- _this.fs.writeTextSync(path, content);
249
+ pathAndContentPairs.forEach(([path, content]) => {
250
+ this.fs.writeTextSync(path, content);
246
251
  });
247
- output.linkedLibraryNpmPackageNames.forEach(function (npmPackageName) {
248
- _this.logger.debug(function (styles) { return "[".concat(styles.green(styles.bold('link')), "] ").concat(npmPackageName); });
252
+ output.linkedLibraryNpmPackageNames.forEach((npmPackageName) => {
253
+ this.logger.debug((styles) => `[${styles.green(styles.bold('link'))}] ${npmPackageName}`);
249
254
  });
250
- output.skippedLibraryNpmPackageNames.forEach(function (npmPackageName) {
251
- _this.logger.debug(function (styles) { return "[".concat(styles.yellow(styles.bold('skip')), "] ").concat(npmPackageName); });
255
+ output.skippedLibraryNpmPackageNames.forEach((npmPackageName) => {
256
+ this.logger.debug((styles) => `[${styles.yellow(styles.bold('skip'))}] ${npmPackageName}`);
252
257
  });
253
- this.logger.debug(function () { return ''; });
254
- var sortedPathsRelativeToRoot = pathAndContentPairs
255
- .map(function (_a) {
256
- var path = _a[0];
257
- return path.relativeTo(output.projectRootPath).toString();
258
- })
258
+ this.logger.debug(() => '');
259
+ const sortedPathsRelativeToRoot = pathAndContentPairs
260
+ .map(([path]) => path.relativeTo(output.projectRootPath).toString())
259
261
  .sort();
260
- sortedPathsRelativeToRoot.forEach(function (pathStr) {
261
- _this.logger.debug(function (styles) { return styles.gray("\u2022 ".concat(pathStr)); });
262
- });
263
- this.logger.debug(function () { return ''; });
264
- this.logger.info(function (styles) {
265
- return "updated ".concat(styles.green(styles.bold(sortedPathsRelativeToRoot.length)), " file(s), linked ").concat(styles.green(styles.bold(output.linkedLibraryNpmPackageNames.length)), " libraries, skipped ").concat(styles.yellow(styles.bold(output.skippedLibraryNpmPackageNames.length)), " libraries");
262
+ sortedPathsRelativeToRoot.forEach((pathStr) => {
263
+ this.logger.debug((styles) => styles.gray(`• ${pathStr}`));
266
264
  });
267
- this.logger.debug(function () { return ''; });
268
- };
269
- return Autolinking;
270
- }());
265
+ this.logger.debug(() => '');
266
+ this.logger.info((styles) => `updated ${styles.green(styles.bold(sortedPathsRelativeToRoot.length))} file(s), linked ${styles.green(styles.bold(output.linkedLibraryNpmPackageNames.length))} libraries, skipped ${styles.yellow(styles.bold(output.skippedLibraryNpmPackageNames.length))} libraries`);
267
+ this.logger.debug(() => '');
268
+ }
269
+ }
271
270
  exports.Autolinking = Autolinking;