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

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 (200) hide show
  1. package/dist/assetResolver.js +74 -43
  2. package/dist/autolinking/Autolinking.js +179 -178
  3. package/dist/codegen/core/CodegenError.js +23 -3
  4. package/dist/codegen/core/EventUtils.js +3 -3
  5. package/dist/codegen/core/TypeAnnotationToTS.js +28 -24
  6. package/dist/codegen/core/UberSchema.js +97 -55
  7. package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +41 -28
  8. package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +34 -27
  9. package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +33 -25
  10. package/dist/codegen/generators/CppComponentCodeGenerator.js +28 -23
  11. package/dist/codegen/generators/LibGlueCodeGenerator.js +29 -26
  12. package/dist/codegen/generators/NativeModuleCodeGenerator.js +30 -25
  13. package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
  14. package/dist/codegen/generators/UberGeneratorV1.js +24 -18
  15. package/dist/codegen/generators/UberGeneratorV2.js +36 -28
  16. package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +24 -50
  17. package/dist/codegen/templates/BasePackageHTemplate.js +21 -120
  18. package/dist/codegen/templates/ComponentDescriptorHTemplate.js +8 -54
  19. package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +27 -75
  20. package/dist/codegen/templates/ComponentUtilsTSTemplate.js +29 -162
  21. package/dist/codegen/templates/IndexTSTemplate.js +17 -37
  22. package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +24 -119
  23. package/dist/codegen/templates/TurboModuleCppTemplate.js +15 -38
  24. package/dist/codegen/templates/TurboModuleHTemplate.js +11 -32
  25. package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +19 -52
  26. package/dist/commands/bundle-harmony.js +221 -118
  27. package/dist/commands/clean-harmony.js +63 -58
  28. package/dist/commands/codegen-harmony.js +175 -104
  29. package/dist/commands/codegen-lib-harmony.js +116 -76
  30. package/dist/commands/init-harmony.js +196 -151
  31. package/dist/commands/init.js +961 -537
  32. package/dist/commands/link-harmony.js +82 -35
  33. package/dist/commands/run-harmony.js +518 -374
  34. package/dist/commands/verify-package-harmony.js +117 -54
  35. package/dist/core/AbsolutePath.js +49 -33
  36. package/dist/core/CodegenConfig.js +22 -24
  37. package/dist/core/DescriptiveError.js +37 -18
  38. package/dist/core/FileSystem.js +18 -14
  39. package/dist/core/OHPackageJSON5.js +23 -17
  40. package/dist/core/PackageJSON.js +42 -26
  41. package/dist/core/ProjectDependenciesManager.js +92 -40
  42. package/dist/core/ValidationError.js +22 -2
  43. package/dist/core/fs.js +7 -10
  44. package/dist/index.js +1 -1
  45. package/dist/init/templates/AppScopeAppJSON5Template.js +8 -21
  46. package/dist/init/templates/AppScopeStringVarTemplate.js +8 -19
  47. package/dist/init/templates/EntryIndexTemplate.js +8 -56
  48. package/dist/init/templates/EntryStringVarTemplate.js +8 -27
  49. package/dist/init/templates/HvigorConfigJson5Template.js +8 -33
  50. package/dist/init/templates/MetroConfigTemplate.js +8 -38
  51. package/dist/init/templates/OhPackageJson5Template.js +8 -28
  52. package/dist/io/CliExecutor.js +98 -46
  53. package/dist/io/Logger.js +46 -40
  54. package/dist/io/RealFS.js +100 -43
  55. package/dist/io/TarGz.js +8 -11
  56. package/dist/io/__fixtures__.js +141 -79
  57. package/dist/io/fsUtils.js +12 -13
  58. package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +47 -19
  59. package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +41 -13
  60. package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +38 -8
  61. package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +54 -22
  62. package/dist/package-verifier/verify-package.js +133 -56
  63. package/dist/simulator/LaunchSimulator.js +301 -217
  64. package/package.json +2 -11
  65. package/scripts/sync-hvigor.js +27 -0
  66. package/src/autolinking/Autolinking.ts +1 -1
  67. package/src/codegen/generators/UberGeneratorV1.ts +7 -2
  68. package/src/codegen/generators/UberGeneratorV2.ts +6 -1
  69. package/src/commands/codegen-harmony.ts +17 -7
  70. package/src/commands/run-harmony.ts +0 -2
  71. package/src/simulator/LaunchSimulator.ts +9 -2
  72. package/dist/init/templates/harmony/AppScope/app.json5 +0 -10
  73. package/dist/init/templates/harmony/AppScope/resources/base/element/string.json +0 -8
  74. package/dist/init/templates/harmony/AppScope/resources/base/media/app_icon.png +0 -0
  75. package/dist/init/templates/harmony/build-profile.json5 +0 -36
  76. package/dist/init/templates/harmony/codelinter.json +0 -32
  77. package/dist/init/templates/harmony/entry/build-profile.json5 +0 -18
  78. package/dist/init/templates/harmony/entry/gitignore +0 -7
  79. package/dist/init/templates/harmony/entry/hvigorfile.ts +0 -13
  80. package/dist/init/templates/harmony/entry/oh-package.json5 +0 -9
  81. package/dist/init/templates/harmony/entry/src/main/cpp/CMakeLists.txt +0 -27
  82. package/dist/init/templates/harmony/entry/src/main/cpp/PackageProvider.cpp +0 -13
  83. package/dist/init/templates/harmony/entry/src/main/cpp/gitignore +0 -4
  84. package/dist/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +0 -8
  85. package/dist/init/templates/harmony/entry/src/main/ets/codegen/gitignore +0 -2
  86. package/dist/init/templates/harmony/entry/src/main/ets/entryability/EntryAbility.ets +0 -11
  87. package/dist/init/templates/harmony/entry/src/main/ets/gitignore +0 -1
  88. package/dist/init/templates/harmony/entry/src/main/ets/pages/.gitkeep +0 -0
  89. package/dist/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +0 -16
  90. package/dist/init/templates/harmony/entry/src/main/module.json5 +0 -65
  91. package/dist/init/templates/harmony/entry/src/main/resources/base/element/color.json +0 -8
  92. package/dist/init/templates/harmony/entry/src/main/resources/base/element/string.json +0 -16
  93. package/dist/init/templates/harmony/entry/src/main/resources/base/media/background.png +0 -0
  94. package/dist/init/templates/harmony/entry/src/main/resources/base/media/foreground.png +0 -0
  95. package/dist/init/templates/harmony/entry/src/main/resources/base/media/layered_image.json +0 -7
  96. package/dist/init/templates/harmony/entry/src/main/resources/base/media/startIcon.png +0 -0
  97. package/dist/init/templates/harmony/entry/src/main/resources/base/profile/main_pages.json +0 -5
  98. package/dist/init/templates/harmony/entry/src/main/resources/gitignore +0 -1
  99. package/dist/init/templates/harmony/entry/src/ohosTest/ets/test/List.test.ets +0 -2
  100. package/dist/init/templates/harmony/entry/src/ohosTest/module.json5 +0 -13
  101. package/dist/init/templates/harmony/gitignore +0 -16
  102. package/dist/init/templates/harmony/hvigor/hvigor-config.json5 +0 -22
  103. package/dist/init/templates/harmony/hvigorfile.ts +0 -7
  104. package/harmony/rnoh-hvigor-plugin-0.77.22.tgz +0 -0
  105. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/02febc14 +0 -0
  106. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0429e5b7 +0 -0
  107. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/05339e68 +0 -0
  108. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/070be2fe +0 -0
  109. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/07851ff1 +0 -0
  110. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/12e10c06 +0 -0
  111. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/12e1d696 +0 -0
  112. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/14950087 +0 -0
  113. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/15e87372 +0 -0
  114. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/19e6ecbe +0 -0
  115. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1aac0ac4 +0 -0
  116. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1b8db102 +0 -0
  117. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1c181646 +0 -0
  118. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/203e747c +0 -0
  119. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/21ba4c08 +0 -0
  120. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/259939e5 +0 -0
  121. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/288ba98c +0 -0
  122. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2a45461c +0 -0
  123. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2d773091 +0 -0
  124. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2eda89fc +0 -0
  125. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2f584eca +0 -0
  126. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/35b495ca +0 -0
  127. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/36478aed +0 -0
  128. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3844e772 +0 -0
  129. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3ee777f4 +0 -0
  130. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/471ac436 +0 -0
  131. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4a91abcc +0 -0
  132. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4d1a5094 +0 -0
  133. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4d3ef38f +0 -0
  134. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4daf5855 +0 -0
  135. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4ef0389f +0 -0
  136. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4f72da28 +0 -0
  137. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/59d3e924 +0 -0
  138. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5a8edfaa +0 -0
  139. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5d28a510 +0 -0
  140. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/61a6391d +0 -0
  141. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/65921a14 +0 -0
  142. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6624e7fc +0 -0
  143. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/66d28144 +0 -0
  144. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6aceb8d2 +0 -0
  145. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/702393d3 +0 -0
  146. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/714f932b +0 -0
  147. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/73f9d4a6 +0 -0
  148. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/78d3adae +0 -0
  149. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7b6564b8 +0 -0
  150. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7c7c3e6e +0 -0
  151. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7cbc9b6a +0 -0
  152. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7dd579e0 +0 -0
  153. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7e0b7d06 +0 -0
  154. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7e153eef +0 -0
  155. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7ee84fd7 +0 -0
  156. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7f5146a4 +0 -0
  157. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/844e633a +0 -0
  158. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8a1af22c +0 -0
  159. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/90a1680d +0 -0
  160. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a15fb79a +0 -0
  161. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ac288a8a +0 -0
  162. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ad7a66b4 +0 -0
  163. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/aee8805e +0 -0
  164. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b0487ec8 +0 -0
  165. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b10e16d2 +0 -0
  166. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b32d42ac +0 -0
  167. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b7d8f35c +0 -0
  168. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b96748af +0 -0
  169. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/bedb2fea +0 -0
  170. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c01ad640 +0 -0
  171. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c0472cf5 +0 -0
  172. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c102ed0f +0 -0
  173. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c1a91819 +0 -0
  174. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c243857a +0 -0
  175. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c407792f +0 -0
  176. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c4459bee +0 -0
  177. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c72a4dcd +0 -0
  178. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c83537a9 +0 -0
  179. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c88f7498 +0 -0
  180. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c8d04070 +0 -0
  181. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cc44d6f1 +0 -0
  182. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d4d913f6 +0 -0
  183. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/da97f202 +0 -0
  184. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/dc965522 +0 -0
  185. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/dff6f700 +0 -0
  186. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e507c001 +0 -0
  187. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e52f3f2d +0 -0
  188. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e5c3890d +0 -0
  189. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e720074d +0 -0
  190. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e7656fa7 +0 -0
  191. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e80bcaac +0 -0
  192. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e8e7900e +0 -0
  193. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ee8993f9 +0 -0
  194. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ef8cf362 +0 -0
  195. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f1405b1d +0 -0
  196. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f20f0e0d +0 -0
  197. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f2586978 +0 -0
  198. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f53cd716 +0 -0
  199. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/fe71f6bb +0 -0
  200. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/febfc20b +0 -0
@@ -8,8 +8,32 @@ 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 __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
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
+ }
13
37
  };
14
38
  Object.defineProperty(exports, "__esModule", { value: true });
15
39
  exports.copyAssets = copyAssets;
@@ -19,17 +43,18 @@ exports.copyAssets = copyAssets;
19
43
  * This source code is licensed under the MIT license found in the
20
44
  * LICENSE-MIT file in the root directory of this source tree.
21
45
  */
22
- const fs_1 = __importDefault(require("fs"));
23
- const path_1 = __importDefault(require("path"));
24
- const ALLOWED_SCALES = [1, 2, 3, 4];
46
+ var fs_1 = require("fs");
47
+ var path_1 = require("path");
48
+ var ALLOWED_SCALES = [1, 2, 3, 4];
25
49
  function filterAssetScales(scales) {
26
- const result = scales.filter(scale => ALLOWED_SCALES.includes(scale));
50
+ var result = scales.filter(function (scale) { return ALLOWED_SCALES.includes(scale); });
27
51
  if (result.length === 0 && scales.length > 0) {
28
52
  // No matching scale found, but there are some available. Ideally we don't
29
53
  // want to be in this situation and should throw, but for now as a fallback
30
54
  // let's just use the closest larger image
31
- const maxScale = ALLOWED_SCALES[ALLOWED_SCALES.length - 1];
32
- for (const scale of scales) {
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];
33
58
  if (scale > maxScale) {
34
59
  result.push(scale);
35
60
  break;
@@ -43,63 +68,69 @@ function filterAssetScales(scales) {
43
68
  return result;
44
69
  }
45
70
  function copyAssets(logger, assetsData, assetsDest) {
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);
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
+ });
65
93
  });
66
94
  }
67
- function getAssetDestRelativePath(asset, scale = 1) {
68
- const suffix = scale === 1 ? '' : `@${scale}x`;
69
- const fileName = getResourceIdentifier(asset);
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);
70
99
  // Assets can have relative paths outside of the project root.
71
100
  // Replace `../` with `_` to make sure they don't end up outside of
72
101
  // the expected assets directory.
73
- return `${fileName + suffix}.${asset.type}`.replace(/\.\.\//g, '_');
102
+ return "".concat(fileName + suffix, ".").concat(asset.type).replace(/\.\.\//g, '_');
74
103
  }
75
104
  function getResourceIdentifier(asset) {
76
- const folderPath = getBasePath(asset);
77
- return `${folderPath}/${asset.name}`.replace(/^assets\//, '');
105
+ var folderPath = getBasePath(asset);
106
+ return "".concat(folderPath, "/").concat(asset.name).replace(/^assets\//, '');
78
107
  }
79
108
  function getBasePath(asset) {
80
- const basePath = asset.httpServerLocation;
109
+ var basePath = asset.httpServerLocation;
81
110
  return basePath.startsWith('/') ? basePath.slice(1) : basePath;
82
111
  }
83
112
  function copyFiles(logger, fileDestBySrc) {
84
- const fileSources = Object.keys(fileDestBySrc);
113
+ var fileSources = Object.keys(fileDestBySrc);
85
114
  if (fileSources.length === 0) {
86
115
  return Promise.resolve();
87
116
  }
88
- const assetFilesCount = fileSources.length;
89
- return new Promise((resolve, reject) => {
90
- const copyNext = (error) => {
117
+ var assetFilesCount = fileSources.length;
118
+ return new Promise(function (resolve, reject) {
119
+ var copyNext = function (error) {
91
120
  if (error) {
92
121
  reject(error);
93
122
  return;
94
123
  }
95
124
  if (fileSources.length === 0) {
96
- logger.info(() => `Copied ${assetFilesCount} ${assetFilesCount === 1 ? 'asset' : 'assets'}`);
125
+ logger.info(function () {
126
+ return "Copied ".concat(assetFilesCount, " ").concat(assetFilesCount === 1 ? 'asset' : 'assets');
127
+ });
97
128
  resolve();
98
129
  }
99
130
  else {
100
131
  // fileSources.length === 0 is checked in previous branch, so this is string
101
- const src = fileSources.shift();
102
- const dest = fileDestBySrc[src];
132
+ var src = fileSources.shift();
133
+ var dest = fileDestBySrc[src];
103
134
  copyFile(src, dest, copyNext);
104
135
  }
105
136
  };
@@ -107,8 +138,8 @@ function copyFiles(logger, fileDestBySrc) {
107
138
  });
108
139
  }
109
140
  function copyFile(src, dest, onFinished) {
110
- const destDir = path_1.default.dirname(dest);
111
- fs_1.default.mkdir(destDir, { recursive: true }, (err) => {
141
+ var destDir = path_1.default.dirname(dest);
142
+ fs_1.default.mkdir(destDir, { recursive: true }, function (err) {
112
143
  if (err) {
113
144
  onFinished(err);
114
145
  return;
@@ -1,4 +1,15 @@
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
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,171 +19,152 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
19
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
20
  });
10
21
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
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
+ }
13
48
  };
14
49
  Object.defineProperty(exports, "__esModule", { value: true });
15
50
  exports.Autolinking = void 0;
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) {
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) {
83
61
  this.fs = fs;
84
62
  this.logger = logger;
85
63
  }
86
- prepareInput(config) {
87
- return __awaiter(this, void 0, void 0, function* () {
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;
88
67
  var _a;
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;
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
+ }];
125
140
  }
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
- });
137
141
  });
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
- };
152
142
  });
153
- }
154
- evaluate(input) {
155
- const autolinkableLibraries = input.autolinkableLibraries.map((lib) => {
143
+ };
144
+ Autolinking.prototype.evaluate = function (input) {
145
+ var _this = this;
146
+ var autolinkableLibraries = input.autolinkableLibraries.map(function (lib) {
156
147
  var _a, _b, _c, _d;
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) });
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) });
158
149
  });
159
- autolinkableLibraries.sort((a, b) => {
150
+ autolinkableLibraries.sort(function (a, b) {
160
151
  if (a.npmPackageName < b.npmPackageName)
161
152
  return -1;
162
153
  if (a.npmPackageName > b.npmPackageName)
163
154
  return 1;
164
155
  return 0;
165
156
  });
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]) => {
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];
170
162
  if (!(dependencySpecifier.includes('file:') &&
171
163
  dependencySpecifier.includes('node_modules'))) {
172
164
  unmanagedNativeDependencySpecifierByName[name] = dependencySpecifier;
173
165
  }
174
166
  else {
175
- const harFilePathRelativeToHarmony = dependencySpecifier.replace('file:', '');
167
+ var harFilePathRelativeToHarmony = dependencySpecifier.replace('file:', '');
176
168
  if (!autolinkableHarFilePathsRelativeToHarmony.includes(node_path_1.default.normalize(harFilePathRelativeToHarmony)) &&
177
169
  input.nodeModuleHarFilePathsRelativeToHarmony.includes(node_path_1.default.normalize(harFilePathRelativeToHarmony))) {
178
170
  unmanagedNativeDependencySpecifierByName[name] =
@@ -180,14 +172,15 @@ class Autolinking {
180
172
  }
181
173
  }
182
174
  });
183
- const managedNativeDependencySpecifierByName = {};
184
- for (const library of autolinkableLibraries) {
175
+ var managedNativeDependencySpecifierByName = {};
176
+ for (var _i = 0, autolinkableLibraries_1 = autolinkableLibraries; _i < autolinkableLibraries_1.length; _i++) {
177
+ var library = autolinkableLibraries_1[_i];
185
178
  managedNativeDependencySpecifierByName[library.ohPackageName] =
186
- 'file:' + library.harFilePathRelativeToHarmony;
179
+ "file:".concat(library.harFilePathRelativeToHarmony).split(node_path_1.default.sep).join('/');
187
180
  }
188
181
  return {
189
182
  skippedLibraryNpmPackageNames: input.skippedLibraryNpmPackageNames,
190
- linkedLibraryNpmPackageNames: autolinkableLibraries.map((lib) => lib.npmPackageName),
183
+ linkedLibraryNpmPackageNames: autolinkableLibraries.map(function (lib) { return lib.npmPackageName; }),
191
184
  projectRootPath: input.projectRootPath,
192
185
  cppRNOHPackagesFactoryPathAndContent: [
193
186
  input.cppRNOHPackagesFactoryPath,
@@ -209,62 +202,70 @@ class Autolinking {
209
202
  ],
210
203
  ohPackagePathAndContent: [
211
204
  input.ohPackagePathAndContent[0],
212
- json5_1.default.stringify(Object.assign(Object.assign({}, ohPackage), { dependencies: Object.assign(Object.assign({}, unmanagedNativeDependencySpecifierByName), managedNativeDependencySpecifierByName) }), { space: 2, quote: '"' }) + '\n',
205
+ json5_1.default.stringify(__assign(__assign({}, ohPackage), { dependencies: __assign(__assign({}, unmanagedNativeDependencySpecifierByName), managedNativeDependencySpecifierByName) }), { space: 2, quote: '"' }) + '\n',
213
206
  ],
214
207
  };
215
- }
216
- npmPackageNameToRNOHPackageClassName(fullNpmPackageName) {
208
+ };
209
+ Autolinking.prototype.npmPackageNameToRNOHPackageClassName = function (fullNpmPackageName) {
217
210
  if (fullNpmPackageName.startsWith('@')) {
218
- const [scopeName, packageName] = fullNpmPackageName
211
+ var _a = fullNpmPackageName
219
212
  .replace('@', '')
220
- .split('/');
213
+ .split('/'), scopeName = _a[0], packageName = _a[1];
221
214
  return case_1.default.pascal(scopeName) + case_1.default.pascal(packageName) + 'Package';
222
215
  }
223
216
  return case_1.default.pascal(fullNpmPackageName) + 'Package';
224
- }
225
- npmPackageNameToCMakeLibraryTargetName(fullNpmPackageName) {
217
+ };
218
+ Autolinking.prototype.npmPackageNameToCMakeLibraryTargetName = function (fullNpmPackageName) {
226
219
  if (fullNpmPackageName.startsWith('@')) {
227
- const [scopeName, packageName] = fullNpmPackageName
220
+ var _a = fullNpmPackageName
228
221
  .replace('@', '')
229
- .split('/');
222
+ .split('/'), scopeName = _a[0], packageName = _a[1];
230
223
  return 'rnoh__' + case_1.default.snake(scopeName) + '__' + case_1.default.snake(packageName);
231
224
  }
232
225
  return 'rnoh__' + case_1.default.snake(fullNpmPackageName);
233
- }
234
- npmPackageNameToOHPackageName(fullNpmPackageName) {
226
+ };
227
+ Autolinking.prototype.npmPackageNameToOHPackageName = function (fullNpmPackageName) {
235
228
  if (fullNpmPackageName.startsWith('@')) {
236
- const [scopeName, packageName] = fullNpmPackageName
229
+ var _a = fullNpmPackageName
237
230
  .replace('@', '')
238
- .split('/');
231
+ .split('/'), scopeName = _a[0], packageName = _a[1];
239
232
  return '@rnoh/' + case_1.default.kebab(scopeName) + '--' + case_1.default.kebab(packageName);
240
233
  }
241
234
  return '@rnoh/' + case_1.default.kebab(fullNpmPackageName);
242
- }
243
- saveAndLogOutput(output) {
244
- const pathAndContentPairs = [];
235
+ };
236
+ Autolinking.prototype.saveAndLogOutput = function (output) {
237
+ var _this = this;
238
+ var pathAndContentPairs = [];
245
239
  pathAndContentPairs.push(output.etsRNOHPackagesFactoryPathAndContent);
246
240
  pathAndContentPairs.push(output.cppRNOHPackagesFactoryPathAndContent);
247
241
  pathAndContentPairs.push(output.cmakeAutolinkingPathAndContent);
248
242
  pathAndContentPairs.push(output.ohPackagePathAndContent);
249
- pathAndContentPairs.forEach(([path, content]) => {
250
- this.fs.writeTextSync(path, content);
243
+ pathAndContentPairs.forEach(function (_a) {
244
+ var path = _a[0], content = _a[1];
245
+ _this.fs.writeTextSync(path, content);
251
246
  });
252
- output.linkedLibraryNpmPackageNames.forEach((npmPackageName) => {
253
- this.logger.debug((styles) => `[${styles.green(styles.bold('link'))}] ${npmPackageName}`);
247
+ output.linkedLibraryNpmPackageNames.forEach(function (npmPackageName) {
248
+ _this.logger.debug(function (styles) { return "[".concat(styles.green(styles.bold('link')), "] ").concat(npmPackageName); });
254
249
  });
255
- output.skippedLibraryNpmPackageNames.forEach((npmPackageName) => {
256
- this.logger.debug((styles) => `[${styles.yellow(styles.bold('skip'))}] ${npmPackageName}`);
250
+ output.skippedLibraryNpmPackageNames.forEach(function (npmPackageName) {
251
+ _this.logger.debug(function (styles) { return "[".concat(styles.yellow(styles.bold('skip')), "] ").concat(npmPackageName); });
257
252
  });
258
- this.logger.debug(() => '');
259
- const sortedPathsRelativeToRoot = pathAndContentPairs
260
- .map(([path]) => path.relativeTo(output.projectRootPath).toString())
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
+ })
261
259
  .sort();
262
- sortedPathsRelativeToRoot.forEach((pathStr) => {
263
- this.logger.debug((styles) => styles.gray(`• ${pathStr}`));
260
+ sortedPathsRelativeToRoot.forEach(function (pathStr) {
261
+ _this.logger.debug(function (styles) { return styles.gray("\u2022 ".concat(pathStr)); });
264
262
  });
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
- }
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");
266
+ });
267
+ this.logger.debug(function () { return ''; });
268
+ };
269
+ return Autolinking;
270
+ }());
270
271
  exports.Autolinking = Autolinking;