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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/dist/assetResolver.js +43 -74
  2. package/dist/autolinking/Autolinking.js +178 -179
  3. package/dist/codegen/core/CodegenError.js +3 -23
  4. package/dist/codegen/core/EventUtils.js +3 -3
  5. package/dist/codegen/core/TypeAnnotationToTS.js +24 -28
  6. package/dist/codegen/core/UberSchema.js +55 -97
  7. package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +28 -41
  8. package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +27 -34
  9. package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +25 -33
  10. package/dist/codegen/generators/CppComponentCodeGenerator.js +23 -28
  11. package/dist/codegen/generators/LibGlueCodeGenerator.js +26 -29
  12. package/dist/codegen/generators/NativeModuleCodeGenerator.js +25 -30
  13. package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
  14. package/dist/codegen/generators/UberGeneratorV1.js +24 -23
  15. package/dist/codegen/generators/UberGeneratorV2.js +34 -35
  16. package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +50 -24
  17. package/dist/codegen/templates/BasePackageHTemplate.js +120 -21
  18. package/dist/codegen/templates/ComponentDescriptorHTemplate.js +54 -8
  19. package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +75 -27
  20. package/dist/codegen/templates/ComponentUtilsTSTemplate.js +162 -29
  21. package/dist/codegen/templates/IndexTSTemplate.js +37 -17
  22. package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +119 -24
  23. package/dist/codegen/templates/TurboModuleCppTemplate.js +38 -15
  24. package/dist/codegen/templates/TurboModuleHTemplate.js +32 -11
  25. package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +52 -19
  26. package/dist/commands/bundle-harmony.js +118 -221
  27. package/dist/commands/clean-harmony.js +58 -63
  28. package/dist/commands/codegen-harmony.js +105 -165
  29. package/dist/commands/codegen-lib-harmony.js +76 -116
  30. package/dist/commands/init-harmony.js +151 -196
  31. package/dist/commands/init.js +537 -961
  32. package/dist/commands/link-harmony.js +35 -82
  33. package/dist/commands/run-harmony.js +372 -518
  34. package/dist/commands/verify-package-harmony.js +54 -117
  35. package/dist/core/AbsolutePath.js +33 -49
  36. package/dist/core/CodegenConfig.js +24 -22
  37. package/dist/core/DescriptiveError.js +18 -37
  38. package/dist/core/FileSystem.js +14 -18
  39. package/dist/core/OHPackageJSON5.js +17 -23
  40. package/dist/core/PackageJSON.js +26 -42
  41. package/dist/core/ProjectDependenciesManager.js +40 -92
  42. package/dist/core/ValidationError.js +2 -22
  43. package/dist/core/fs.js +10 -7
  44. package/dist/index.js +1 -1
  45. package/dist/init/templates/AppScopeAppJSON5Template.js +21 -8
  46. package/dist/init/templates/AppScopeStringVarTemplate.js +19 -8
  47. package/dist/init/templates/EntryIndexTemplate.js +56 -8
  48. package/dist/init/templates/EntryStringVarTemplate.js +27 -8
  49. package/dist/init/templates/HvigorConfigJson5Template.js +33 -8
  50. package/dist/init/templates/MetroConfigTemplate.js +38 -8
  51. package/dist/init/templates/OhPackageJson5Template.js +28 -8
  52. package/dist/init/templates/harmony/AppScope/app.json5 +10 -0
  53. package/dist/init/templates/harmony/AppScope/resources/base/element/string.json +8 -0
  54. package/dist/init/templates/harmony/AppScope/resources/base/media/app_icon.png +0 -0
  55. package/dist/init/templates/harmony/build-profile.json5 +36 -0
  56. package/dist/init/templates/harmony/codelinter.json +32 -0
  57. package/dist/init/templates/harmony/entry/build-profile.json5 +18 -0
  58. package/dist/init/templates/harmony/entry/gitignore +7 -0
  59. package/dist/init/templates/harmony/entry/hvigorfile.ts +13 -0
  60. package/dist/init/templates/harmony/entry/oh-package.json5 +9 -0
  61. package/dist/init/templates/harmony/entry/src/main/cpp/CMakeLists.txt +27 -0
  62. package/dist/init/templates/harmony/entry/src/main/cpp/PackageProvider.cpp +13 -0
  63. package/dist/init/templates/harmony/entry/src/main/cpp/gitignore +4 -0
  64. package/dist/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +8 -0
  65. package/dist/init/templates/harmony/entry/src/main/ets/codegen/gitignore +2 -0
  66. package/dist/init/templates/harmony/entry/src/main/ets/entryability/EntryAbility.ets +11 -0
  67. package/dist/init/templates/harmony/entry/src/main/ets/gitignore +1 -0
  68. package/dist/init/templates/harmony/entry/src/main/ets/pages/.gitkeep +0 -0
  69. package/dist/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +16 -0
  70. package/dist/init/templates/harmony/entry/src/main/module.json5 +65 -0
  71. package/dist/init/templates/harmony/entry/src/main/resources/base/element/color.json +8 -0
  72. package/dist/init/templates/harmony/entry/src/main/resources/base/element/string.json +16 -0
  73. package/dist/init/templates/harmony/entry/src/main/resources/base/media/background.png +0 -0
  74. package/dist/init/templates/harmony/entry/src/main/resources/base/media/foreground.png +0 -0
  75. package/dist/init/templates/harmony/entry/src/main/resources/base/media/layered_image.json +7 -0
  76. package/dist/init/templates/harmony/entry/src/main/resources/base/media/startIcon.png +0 -0
  77. package/dist/init/templates/harmony/entry/src/main/resources/base/profile/main_pages.json +5 -0
  78. package/dist/init/templates/harmony/entry/src/main/resources/gitignore +1 -0
  79. package/dist/init/templates/harmony/entry/src/ohosTest/ets/test/List.test.ets +2 -0
  80. package/dist/init/templates/harmony/entry/src/ohosTest/module.json5 +13 -0
  81. package/dist/init/templates/harmony/gitignore +16 -0
  82. package/dist/init/templates/harmony/hvigor/hvigor-config.json5 +22 -0
  83. package/dist/init/templates/harmony/hvigorfile.ts +7 -0
  84. package/dist/io/CliExecutor.js +46 -98
  85. package/dist/io/Logger.js +40 -46
  86. package/dist/io/RealFS.js +43 -100
  87. package/dist/io/TarGz.js +11 -8
  88. package/dist/io/__fixtures__.js +79 -141
  89. package/dist/io/fsUtils.js +13 -12
  90. package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +19 -47
  91. package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +13 -41
  92. package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +8 -38
  93. package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +22 -54
  94. package/dist/package-verifier/verify-package.js +56 -133
  95. package/dist/simulator/LaunchSimulator.js +224 -301
  96. package/harmony/rnoh-hvigor-plugin-0.77.44.tgz +0 -0
  97. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0271b9dd +0 -0
  98. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/07ba0208 +0 -0
  99. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/082dd09d +0 -0
  100. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0a9e1b0b +0 -0
  101. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0c3d528a +0 -0
  102. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1014d3ff +0 -0
  103. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1184678c +0 -0
  104. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/12621366 +0 -0
  105. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/126d3e66 +0 -0
  106. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/19262852 +0 -0
  107. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/203fac53 +0 -0
  108. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/237b660a +0 -0
  109. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2528002d +0 -0
  110. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2587d041 +0 -0
  111. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2893bd11 +0 -0
  112. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2af6ff9d +0 -0
  113. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2bf31f33 +0 -0
  114. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/333648cc +0 -0
  115. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/386f6df0 +0 -0
  116. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3b8c270e +0 -0
  117. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3bcc34ba +0 -0
  118. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/444808bd +0 -0
  119. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/44a775e2 +0 -0
  120. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/46da3ccd +0 -0
  121. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/51f80e35 +0 -0
  122. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5203a2ca +0 -0
  123. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/52795646 +0 -0
  124. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/577f8208 +0 -0
  125. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5c2aafe7 +0 -0
  126. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5c69bcfe +0 -0
  127. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/62695b92 +0 -0
  128. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/62698102 +0 -0
  129. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6411ab00 +0 -0
  130. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6569ba92 +0 -0
  131. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/65e5133c +0 -0
  132. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/66029655 +0 -0
  133. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/69e85d0d +0 -0
  134. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6afcb99e +0 -0
  135. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6de07367 +0 -0
  136. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/72498307 +0 -0
  137. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7babd1de +0 -0
  138. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7fe56d21 +0 -0
  139. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/810cbd72 +0 -0
  140. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/812386d2 +0 -0
  141. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8448897d +0 -0
  142. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/84ab0a41 +0 -0
  143. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/853825e2 +0 -0
  144. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/862ad93a +0 -0
  145. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/86b14da6 +0 -0
  146. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/87f0fe62 +0 -0
  147. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/88ee8f74 +0 -0
  148. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8c5237c9 +0 -0
  149. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8c725800 +0 -0
  150. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8e83cbe1 +0 -0
  151. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8f4085b9 +0 -0
  152. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/931f0b2e +0 -0
  153. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/940c8f92 +0 -0
  154. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/968191a3 +0 -0
  155. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/970780c0 +0 -0
  156. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/98bc4394 +0 -0
  157. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/99a3b0b0 +0 -0
  158. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/9c0ffa6b +0 -0
  159. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/9d9b42c2 +0 -0
  160. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a04266ef +0 -0
  161. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a18f78c5 +0 -0
  162. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a642fb0e +0 -0
  163. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a97edf40 +0 -0
  164. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/aa672a20 +0 -0
  165. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ae25c61a +0 -0
  166. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b2bebae6 +0 -0
  167. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ba492422 +0 -0
  168. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/bd3e6c21 +0 -0
  169. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/be9e564e +0 -0
  170. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c342b18e +0 -0
  171. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c3993e7e +0 -0
  172. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c52ffd54 +0 -0
  173. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c7079ad4 +0 -0
  174. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c8eb01c1 +0 -0
  175. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/caee5d30 +0 -0
  176. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cf039161 +0 -0
  177. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d0377c40 +0 -0
  178. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d262bc85 +0 -0
  179. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d287cb5c +0 -0
  180. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d64bff57 +0 -0
  181. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d716a608 +0 -0
  182. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d751012b +0 -0
  183. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e0873711 +0 -0
  184. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e1fcf77b +0 -0
  185. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e8548d8a +0 -0
  186. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/eaedd71d +0 -0
  187. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/eca0019e +0 -0
  188. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f7189953 +0 -0
  189. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f75cb201 +0 -0
  190. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f888164b +0 -0
  191. package/node-compile-cache/v22.14.0-x64-efe9a9df-0/fdb9eb5a +0 -0
  192. package/package.json +5 -1
@@ -1,16 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PackageJSON = void 0;
4
- var CodegenConfig_1 = require("./CodegenConfig");
5
- var DescriptiveError_1 = require("./DescriptiveError");
6
- var PackageJSON = /** @class */ (function () {
7
- function PackageJSON(rawPackageJSON, packageRootPath, projectRootPath) {
8
- this.rawPackageJSON = rawPackageJSON;
9
- this.packageRootPath = packageRootPath;
10
- this.projectRootPath = projectRootPath;
11
- }
12
- PackageJSON.fromProjectRootPath = function (fs, packageRootPath, projectRootPath) {
13
- var packageJSONPath = packageRootPath.copyWithNewSegment('package.json');
4
+ const CodegenConfig_1 = require("./CodegenConfig");
5
+ const DescriptiveError_1 = require("./DescriptiveError");
6
+ class PackageJSON {
7
+ static fromProjectRootPath(fs, packageRootPath, projectRootPath) {
8
+ const packageJSONPath = packageRootPath.copyWithNewSegment('package.json');
14
9
  if (!fs.existsSync(packageJSONPath)) {
15
10
  throw new DescriptiveError_1.DescriptiveError({
16
11
  whatHappened: "Couldn't find 'package.json'",
@@ -27,33 +22,25 @@ var PackageJSON = /** @class */ (function () {
27
22
  catch (err) {
28
23
  throw new DescriptiveError_1.DescriptiveError({
29
24
  whatHappened: "Couldn't parse package.json",
30
- extraData: { packageJSONPath: packageJSONPath, err: err },
25
+ extraData: { packageJSONPath, err },
31
26
  });
32
27
  }
33
- };
34
- Object.defineProperty(PackageJSON.prototype, "name", {
35
- get: function () {
36
- return this.rawPackageJSON.name;
37
- },
38
- enumerable: false,
39
- configurable: true
40
- });
41
- Object.defineProperty(PackageJSON.prototype, "version", {
42
- get: function () {
43
- return this.rawPackageJSON.version;
44
- },
45
- enumerable: false,
46
- configurable: true
47
- });
48
- Object.defineProperty(PackageJSON.prototype, "harmony", {
49
- get: function () {
50
- return this.rawPackageJSON.harmony;
51
- },
52
- enumerable: false,
53
- configurable: true
54
- });
55
- PackageJSON.prototype.getCodegenConfigs = function () {
56
- var _this = this;
28
+ }
29
+ constructor(rawPackageJSON, packageRootPath, projectRootPath) {
30
+ this.rawPackageJSON = rawPackageJSON;
31
+ this.packageRootPath = packageRootPath;
32
+ this.projectRootPath = projectRootPath;
33
+ }
34
+ get name() {
35
+ return this.rawPackageJSON.name;
36
+ }
37
+ get version() {
38
+ return this.rawPackageJSON.version;
39
+ }
40
+ get harmony() {
41
+ return this.rawPackageJSON.harmony;
42
+ }
43
+ getCodegenConfigs() {
57
44
  var _a;
58
45
  /**
59
46
  * Shared codegenConfig is not used on purpose. Android, iOS and other platforms shouldn't
@@ -61,19 +48,16 @@ var PackageJSON = /** @class */ (function () {
61
48
  * that the shape of the shared config, to allow specifying which specific turbo modules or
62
49
  * fabric components should be code generated.
63
50
  */
64
- var rawCodegenConfig = (_a = this.rawPackageJSON.harmony) === null || _a === void 0 ? void 0 : _a.codegenConfig;
51
+ const rawCodegenConfig = (_a = this.rawPackageJSON.harmony) === null || _a === void 0 ? void 0 : _a.codegenConfig;
65
52
  if (!rawCodegenConfig) {
66
53
  return [];
67
54
  }
68
55
  if (Array.isArray(rawCodegenConfig)) {
69
- return rawCodegenConfig.map(function (config) {
70
- return CodegenConfig_1.CodegenConfig.fromRawCodegenConfig(config, _this.packageRootPath, _this.projectRootPath, _this.name);
71
- });
56
+ return rawCodegenConfig.map((config) => CodegenConfig_1.CodegenConfig.fromRawCodegenConfig(config, this.packageRootPath, this.projectRootPath, this.name));
72
57
  }
73
58
  return [
74
59
  CodegenConfig_1.CodegenConfig.fromRawCodegenConfig(rawCodegenConfig, this.packageRootPath, this.projectRootPath, this.name),
75
60
  ];
76
- };
77
- return PackageJSON;
78
- }());
61
+ }
62
+ }
79
63
  exports.PackageJSON = PackageJSON;
@@ -8,120 +8,68 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
11
  Object.defineProperty(exports, "__esModule", { value: true });
39
12
  exports.ProjectDependenciesManager = exports.ProjectDependency = void 0;
40
- var PackageJSON_1 = require("./PackageJSON");
41
- var ProjectDependency = /** @class */ (function () {
42
- function ProjectDependency(fs, packageRootPath, projectRootPath) {
13
+ const PackageJSON_1 = require("./PackageJSON");
14
+ class ProjectDependency {
15
+ constructor(fs, packageRootPath, projectRootPath) {
43
16
  this.fs = fs;
44
17
  this.packageRootPath = packageRootPath;
45
18
  this.projectRootPath = projectRootPath;
46
19
  }
47
- ProjectDependency.prototype.getRootPath = function () {
20
+ getRootPath() {
48
21
  return this.packageRootPath;
49
- };
50
- ProjectDependency.prototype.getCodegenConfigs = function () {
22
+ }
23
+ getCodegenConfigs() {
51
24
  return this.readPackageJSON().getCodegenConfigs();
52
- };
53
- ProjectDependency.prototype.getHarFilePaths = function () {
54
- var packageHarmonyPath = this.packageRootPath.copyWithNewSegment('harmony');
25
+ }
26
+ getHarFilePaths() {
27
+ const packageHarmonyPath = this.packageRootPath.copyWithNewSegment('harmony');
55
28
  if (this.fs.existsSync(packageHarmonyPath)) {
56
29
  return this.fs.findFilePathsWithExtensions(packageHarmonyPath, ['har']);
57
30
  }
58
31
  else {
59
32
  return this.fs.findFilePathsWithExtensions(this.packageRootPath, ['har']);
60
33
  }
61
- };
62
- ProjectDependency.prototype.readPackageJSON = function () {
34
+ }
35
+ readPackageJSON() {
63
36
  return PackageJSON_1.PackageJSON.fromProjectRootPath(this.fs, this.packageRootPath, this.projectRootPath);
64
- };
65
- return ProjectDependency;
66
- }());
37
+ }
38
+ }
67
39
  exports.ProjectDependency = ProjectDependency;
68
- var ProjectDependenciesManager = /** @class */ (function () {
69
- function ProjectDependenciesManager(fs, projectRootPath) {
40
+ class ProjectDependenciesManager {
41
+ constructor(fs, projectRootPath) {
70
42
  this.fs = fs;
71
43
  this.projectRootPath = projectRootPath;
72
44
  }
73
- ProjectDependenciesManager.prototype.forEachAsync = function (cb) {
74
- return __awaiter(this, void 0, void 0, function () {
75
- return __generator(this, function (_a) {
76
- switch (_a.label) {
77
- case 0: return [4 /*yield*/, this.forEachDependencyInDirectory(cb, this.projectRootPath.copyWithNewSegment('node_modules'))];
78
- case 1:
79
- _a.sent();
80
- return [2 /*return*/];
81
- }
82
- });
45
+ forEachAsync(cb) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ yield this.forEachDependencyInDirectory(cb, this.projectRootPath.copyWithNewSegment('node_modules'));
83
48
  });
84
- };
85
- ProjectDependenciesManager.prototype.forEachDependencyInDirectory = function (cb, directoryPath) {
86
- return __awaiter(this, void 0, void 0, function () {
87
- var _i, _a, dirent, potentialDependencyRootPath;
88
- return __generator(this, function (_b) {
89
- switch (_b.label) {
90
- case 0:
91
- if (!this.fs.existsSync(directoryPath)) {
92
- return [2 /*return*/];
93
- }
94
- _i = 0, _a = this.fs.readDirentsSync(directoryPath);
95
- _b.label = 1;
96
- case 1:
97
- if (!(_i < _a.length)) return [3 /*break*/, 7];
98
- dirent = _a[_i];
99
- if (!(dirent.isDirectory() || dirent.isSymbolicLink())) return [3 /*break*/, 6];
100
- if (!dirent.name.startsWith('.')) return [3 /*break*/, 2];
101
- return [3 /*break*/, 6];
102
- case 2:
103
- if (!dirent.name.startsWith('@')) return [3 /*break*/, 4];
104
- return [4 /*yield*/, this.forEachDependencyInDirectory(cb, directoryPath.copyWithNewSegment(dirent.name))];
105
- case 3:
106
- _b.sent();
107
- return [3 /*break*/, 6];
108
- case 4:
109
- potentialDependencyRootPath = directoryPath.copyWithNewSegment(dirent.name);
49
+ }
50
+ forEachDependencyInDirectory(cb, directoryPath) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ if (!this.fs.existsSync(directoryPath)) {
53
+ return;
54
+ }
55
+ for (let dirent of this.fs.readDirentsSync(directoryPath)) {
56
+ if (dirent.isDirectory() || dirent.isSymbolicLink()) {
57
+ if (dirent.name.startsWith('.')) {
58
+ continue;
59
+ }
60
+ else if (dirent.name.startsWith('@')) {
61
+ yield this.forEachDependencyInDirectory(cb, directoryPath.copyWithNewSegment(dirent.name));
62
+ }
63
+ else {
64
+ const potentialDependencyRootPath = directoryPath.copyWithNewSegment(dirent.name);
110
65
  if (!this.fs.existsSync(potentialDependencyRootPath.copyWithNewSegment('package.json'))) {
111
- return [3 /*break*/, 6];
66
+ continue;
112
67
  }
113
- return [4 /*yield*/, cb(new ProjectDependency(this.fs, potentialDependencyRootPath, this.projectRootPath))];
114
- case 5:
115
- _b.sent();
116
- _b.label = 6;
117
- case 6:
118
- _i++;
119
- return [3 /*break*/, 1];
120
- case 7: return [2 /*return*/];
68
+ yield cb(new ProjectDependency(this.fs, potentialDependencyRootPath, this.projectRootPath));
69
+ }
121
70
  }
122
- });
71
+ }
123
72
  });
124
- };
125
- return ProjectDependenciesManager;
126
- }());
73
+ }
74
+ }
127
75
  exports.ProjectDependenciesManager = ProjectDependenciesManager;
@@ -1,26 +1,6 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.ValidationError = void 0;
19
- var ValidationError = /** @class */ (function (_super) {
20
- __extends(ValidationError, _super);
21
- function ValidationError() {
22
- return _super !== null && _super.apply(this, arguments) || this;
23
- }
24
- return ValidationError;
25
- }(Error));
4
+ class ValidationError extends Error {
5
+ }
26
6
  exports.ValidationError = ValidationError;
package/dist/core/fs.js CHANGED
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.maybeMakeDirectories = maybeMakeDirectories;
4
7
  exports.maybeRemoveFilesInDirectory = maybeRemoveFilesInDirectory;
5
8
  exports.maybeReadFile = maybeReadFile;
6
- var node_fs_1 = require("node:fs");
7
- var DescriptiveError_1 = require("./DescriptiveError");
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const DescriptiveError_1 = require("./DescriptiveError");
8
11
  function maybeMakeDirectories(path) {
9
12
  if (!node_fs_1.default.existsSync(path.getValue())) {
10
13
  node_fs_1.default.mkdirSync(path.getValue(), { recursive: true });
@@ -17,12 +20,12 @@ function maybeRemoveFilesInDirectory(path) {
17
20
  if (!node_fs_1.default.lstatSync(path.getValue()).isDirectory()) {
18
21
  throw new DescriptiveError_1.DescriptiveError({
19
22
  whatHappened: "Tried to remove all files from a path that doesn't point to a directory",
20
- whatCanUserDo: ["Verify path: ".concat(path.getValue())],
23
+ whatCanUserDo: [`Verify path: ${path.getValue()}`],
21
24
  });
22
25
  }
23
- var fileOrDirNames = node_fs_1.default.readdirSync(path.getValue());
24
- fileOrDirNames.forEach(function (fileOrDirName) {
25
- var maybeFilePath = path.copyWithNewSegment(fileOrDirName);
26
+ const fileOrDirNames = node_fs_1.default.readdirSync(path.getValue());
27
+ fileOrDirNames.forEach((fileOrDirName) => {
28
+ const maybeFilePath = path.copyWithNewSegment(fileOrDirName);
26
29
  if (node_fs_1.default.statSync(maybeFilePath.getValue()).isDirectory()) {
27
30
  return;
28
31
  }
@@ -38,7 +41,7 @@ function maybeReadFile(path) {
38
41
  if (!node_fs_1.default.lstatSync(path.getValue()).isFile()) {
39
42
  throw new DescriptiveError_1.DescriptiveError({
40
43
  whatHappened: "Tried to read a path that doesn't point to a file",
41
- whatCanUserDo: ["Verify path: ".concat(path.getValue())],
44
+ whatCanUserDo: [`Verify path: ${path.getValue()}`],
42
45
  });
43
46
  }
44
47
  return node_fs_1.default.readFileSync(path.getValue(), 'utf-8');
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.config = void 0;
4
- var commands_1 = require("./commands");
4
+ const commands_1 = require("./commands");
5
5
  exports.config = {
6
6
  commands: [
7
7
  commands_1.commandBundleHarmony,
@@ -1,17 +1,30 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.AppScopeAppJSON5Template = void 0;
4
- var mustache_1 = require("mustache");
5
- var TEMPLATE = "\n{\n \"app\": {\n \"bundleName\": \"{{bundleName}}\",\n \"vendor\": \"example\",\n \"versionCode\": 1000000,\n \"versionName\": \"1.0.0\",\n \"icon\": \"$media:app_icon\",\n \"label\": \"$string:app_name\",\n }\n}\n";
6
- var AppScopeAppJSON5Template = /** @class */ (function () {
7
- function AppScopeAppJSON5Template(bundleName) {
7
+ const mustache_1 = __importDefault(require("mustache"));
8
+ const TEMPLATE = `
9
+ {
10
+ "app": {
11
+ "bundleName": "{{bundleName}}",
12
+ "vendor": "example",
13
+ "versionCode": 1000000,
14
+ "versionName": "1.0.0",
15
+ "icon": "$media:app_icon",
16
+ "label": "$string:app_name",
17
+ }
18
+ }
19
+ `;
20
+ class AppScopeAppJSON5Template {
21
+ constructor(bundleName) {
8
22
  this.bundleName = bundleName;
9
23
  }
10
- AppScopeAppJSON5Template.prototype.build = function () {
24
+ build() {
11
25
  return mustache_1.default.render(TEMPLATE.trimStart(), {
12
26
  bundleName: this.bundleName,
13
27
  });
14
- };
15
- return AppScopeAppJSON5Template;
16
- }());
28
+ }
29
+ }
17
30
  exports.AppScopeAppJSON5Template = AppScopeAppJSON5Template;
@@ -1,17 +1,28 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.AppScopeStringVarTemplate = void 0;
4
- var mustache_1 = require("mustache");
5
- var TEMPLATE = "\n{\n \"string\": [\n {\n \"name\": \"app_name\",\n \"value\": \"{{name}}\"\n }\n ]\n}\n";
6
- var AppScopeStringVarTemplate = /** @class */ (function () {
7
- function AppScopeStringVarTemplate(name) {
7
+ const mustache_1 = __importDefault(require("mustache"));
8
+ const TEMPLATE = `
9
+ {
10
+ "string": [
11
+ {
12
+ "name": "app_name",
13
+ "value": "{{name}}"
14
+ }
15
+ ]
16
+ }
17
+ `;
18
+ class AppScopeStringVarTemplate {
19
+ constructor(name) {
8
20
  this.name = name;
9
21
  }
10
- AppScopeStringVarTemplate.prototype.build = function () {
22
+ build() {
11
23
  return mustache_1.default.render(TEMPLATE.trimStart(), {
12
24
  name: this.name,
13
25
  });
14
- };
15
- return AppScopeStringVarTemplate;
16
- }());
26
+ }
27
+ }
17
28
  exports.AppScopeStringVarTemplate = AppScopeStringVarTemplate;
@@ -1,17 +1,65 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.EntryIndexTemplate = void 0;
4
- var mustache_1 = require("mustache");
5
- var TEMPLATE = "\nimport {\n AnyJSBundleProvider,\n MetroJSBundleProvider,\n RNApp,\n RNOHErrorDialog,\n ResourceJSBundleProvider,\n RNOHCoreContext\n} from '@rnoh/react-native-openharmony';\nimport { getRNOHPackages } from '../PackageProvider';\n\n@Entry\n@Component\nstruct Index {\n @StorageLink('RNOHCoreContext') private rnohCoreContext: RNOHCoreContext | undefined = undefined\n\n build() {\n Column() {\n if (this.rnohCoreContext) {\n if (this.rnohCoreContext?.isDebugModeEnabled) {\n RNOHErrorDialog({ ctx: this.rnohCoreContext })\n }\n RNApp({\n rnInstanceConfig: {\n name: \"{{name}}\",\n createRNPackages: getRNOHPackages,\n fontResourceByFontFamily: {},\n enableDebugger: this.rnohCoreContext?.isDebugModeEnabled,\n },\n appKey: \"{{name}}\",\n jsBundleProvider: this.rnohCoreContext?.isDebugModeEnabled ?\n new AnyJSBundleProvider([\n new MetroJSBundleProvider(),\n new ResourceJSBundleProvider(this.rnohCoreContext.uiAbilityContext.resourceManager, 'hermes_bundle.hbc'),\n ]) :\n /**\n * NOTE: The HBC format is recommended for Hermes in a production environment. HBC provides better performance and loading times.\n */\n new ResourceJSBundleProvider(this.rnohCoreContext.uiAbilityContext.resourceManager, 'hermes_bundle.hbc'),\n })\n }\n }\n .height('100%')\n .width('100%')\n }\n}\n";
6
- var EntryIndexTemplate = /** @class */ (function () {
7
- function EntryIndexTemplate(name) {
7
+ const mustache_1 = __importDefault(require("mustache"));
8
+ const TEMPLATE = `
9
+ import {
10
+ AnyJSBundleProvider,
11
+ MetroJSBundleProvider,
12
+ RNApp,
13
+ RNOHErrorDialog,
14
+ ResourceJSBundleProvider,
15
+ RNOHCoreContext
16
+ } from '@rnoh/react-native-openharmony';
17
+ import { getRNOHPackages } from '../PackageProvider';
18
+
19
+ @Entry
20
+ @Component
21
+ struct Index {
22
+ @StorageLink('RNOHCoreContext') private rnohCoreContext: RNOHCoreContext | undefined = undefined
23
+
24
+ build() {
25
+ Column() {
26
+ if (this.rnohCoreContext) {
27
+ if (this.rnohCoreContext?.isDebugModeEnabled) {
28
+ RNOHErrorDialog({ ctx: this.rnohCoreContext })
29
+ }
30
+ RNApp({
31
+ rnInstanceConfig: {
32
+ name: "{{name}}",
33
+ createRNPackages: getRNOHPackages,
34
+ fontResourceByFontFamily: {},
35
+ enableDebugger: this.rnohCoreContext?.isDebugModeEnabled,
36
+ },
37
+ appKey: "{{name}}",
38
+ jsBundleProvider: this.rnohCoreContext?.isDebugModeEnabled ?
39
+ new AnyJSBundleProvider([
40
+ new MetroJSBundleProvider(),
41
+ new ResourceJSBundleProvider(this.rnohCoreContext.uiAbilityContext.resourceManager, 'hermes_bundle.hbc'),
42
+ ]) :
43
+ /**
44
+ * NOTE: The HBC format is recommended for Hermes in a production environment. HBC provides better performance and loading times.
45
+ */
46
+ new ResourceJSBundleProvider(this.rnohCoreContext.uiAbilityContext.resourceManager, 'hermes_bundle.hbc'),
47
+ })
48
+ }
49
+ }
50
+ .height('100%')
51
+ .width('100%')
52
+ }
53
+ }
54
+ `;
55
+ class EntryIndexTemplate {
56
+ constructor(name) {
8
57
  this.name = name;
9
58
  }
10
- EntryIndexTemplate.prototype.build = function () {
59
+ build() {
11
60
  return mustache_1.default.render(TEMPLATE.trimStart(), {
12
61
  name: this.name,
13
62
  });
14
- };
15
- return EntryIndexTemplate;
16
- }());
63
+ }
64
+ }
17
65
  exports.EntryIndexTemplate = EntryIndexTemplate;
@@ -1,19 +1,38 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.EntryStringVarTemplate = void 0;
4
- var mustache_1 = require("mustache");
5
- var TEMPLATE = "\n{\n \"string\": [\n {\n \"name\": \"module_desc\",\n \"value\": \"{{description}}\"\n },\n {\n \"name\": \"EntryAbility_desc\",\n \"value\": \"{{description}}\"\n },\n {\n \"name\": \"EntryAbility_label\",\n \"value\": \"{{name}}\"\n }\n ]\n}\n";
6
- var EntryStringVarTemplate = /** @class */ (function () {
7
- function EntryStringVarTemplate(name, description) {
7
+ const mustache_1 = __importDefault(require("mustache"));
8
+ const TEMPLATE = `
9
+ {
10
+ "string": [
11
+ {
12
+ "name": "module_desc",
13
+ "value": "{{description}}"
14
+ },
15
+ {
16
+ "name": "EntryAbility_desc",
17
+ "value": "{{description}}"
18
+ },
19
+ {
20
+ "name": "EntryAbility_label",
21
+ "value": "{{name}}"
22
+ }
23
+ ]
24
+ }
25
+ `;
26
+ class EntryStringVarTemplate {
27
+ constructor(name, description) {
8
28
  this.name = name;
9
29
  this.description = description;
10
30
  }
11
- EntryStringVarTemplate.prototype.build = function () {
31
+ build() {
12
32
  return mustache_1.default.render(TEMPLATE.trimStart(), {
13
33
  name: this.name,
14
34
  description: this.description,
15
35
  });
16
- };
17
- return EntryStringVarTemplate;
18
- }());
36
+ }
37
+ }
19
38
  exports.EntryStringVarTemplate = EntryStringVarTemplate;
@@ -1,19 +1,44 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.HvigorConfigJson5Template = void 0;
4
- var mustache_1 = require("mustache");
5
- var TEMPLATE = "\n{\n \"modelVersion\": \"5.0.0\",\n \"dependencies\": {\n \"@rnoh/hvigor-plugin\": \"../../node_modules/{{{rnohCliNpmPackageName}}}/harmony/{{{rnohHvigorPluginFilename}}}\", // <PROJECT_ROOT>/node_modules/<RNOH_CLI>/harmony/rnoh-hvigor-plugin-X.X.X.tgz\n },\n \"execution\": {\n // \"analyze\": \"default\", /* Define the build analyze mode. Value: [ \"default\" | \"verbose\" | false ]. Default: \"default\" */\n // \"daemon\": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */\n // \"incremental\": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */\n // \"parallel\": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */\n // \"typeCheck\": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */\n },\n \"logging\": {\n // \"level\": \"info\" /* Define the log level. Value: [ \"debug\" | \"info\" | \"warn\" | \"error\" ]. Default: \"info\" */\n },\n \"debugging\": {\n // \"stacktrace\": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */\n },\n \"nodeOptions\": {\n // \"maxOldSpaceSize\": 4096 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process */\n }\n}\n";
6
- var HvigorConfigJson5Template = /** @class */ (function () {
7
- function HvigorConfigJson5Template(rnohCliNpmPackageName, rnohHvigorPluginFilename) {
7
+ const mustache_1 = __importDefault(require("mustache"));
8
+ const TEMPLATE = `
9
+ {
10
+ "modelVersion": "5.0.0",
11
+ "dependencies": {
12
+ "@rnoh/hvigor-plugin": "../../node_modules/{{{rnohCliNpmPackageName}}}/harmony/{{{rnohHvigorPluginFilename}}}", // <PROJECT_ROOT>/node_modules/<RNOH_CLI>/harmony/rnoh-hvigor-plugin-X.X.X.tgz
13
+ },
14
+ "execution": {
15
+ // "analyze": "default", /* Define the build analyze mode. Value: [ "default" | "verbose" | false ]. Default: "default" */
16
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
17
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
18
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
19
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
20
+ },
21
+ "logging": {
22
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
23
+ },
24
+ "debugging": {
25
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
26
+ },
27
+ "nodeOptions": {
28
+ // "maxOldSpaceSize": 4096 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process */
29
+ }
30
+ }
31
+ `;
32
+ class HvigorConfigJson5Template {
33
+ constructor(rnohCliNpmPackageName, rnohHvigorPluginFilename) {
8
34
  this.rnohCliNpmPackageName = rnohCliNpmPackageName;
9
35
  this.rnohHvigorPluginFilename = rnohHvigorPluginFilename;
10
36
  }
11
- HvigorConfigJson5Template.prototype.build = function () {
37
+ build() {
12
38
  return mustache_1.default.render(TEMPLATE.trimStart(), {
13
39
  rnohCliNpmPackageName: this.rnohCliNpmPackageName,
14
40
  rnohHvigorPluginFilename: this.rnohHvigorPluginFilename,
15
41
  });
16
- };
17
- return HvigorConfigJson5Template;
18
- }());
42
+ }
43
+ }
19
44
  exports.HvigorConfigJson5Template = HvigorConfigJson5Template;
@@ -1,17 +1,47 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.MetroConfigTemplate = void 0;
4
- var mustache_1 = require("mustache");
5
- var TEMPLATE = "\nconst {mergeConfig, getDefaultConfig} = require('@react-native/metro-config');\nconst {\n createHarmonyMetroConfig,\n} = require('{{{reactNativeHarmonyPackageName}}}/metro.config');\n\n/**\n * @type {import(\"metro-config\").MetroConfig}\n */\nconst config = {\n transformer: {\n getTransformOptions: async () => ({\n transform: {\n experimentalImportSupport: false,\n inlineRequires: true,\n },\n }),\n },\n};\n\nmodule.exports = mergeConfig(\n getDefaultConfig(__dirname),\n createHarmonyMetroConfig({\n reactNativeHarmonyPackageName: '{{{reactNativeHarmonyPackageName}}}',\n }),\n config,\n);\n\n";
6
- var MetroConfigTemplate = /** @class */ (function () {
7
- function MetroConfigTemplate(reactNativeHarmonyPackageName) {
7
+ const mustache_1 = __importDefault(require("mustache"));
8
+ const TEMPLATE = `
9
+ const {mergeConfig, getDefaultConfig} = require('@react-native/metro-config');
10
+ const {
11
+ createHarmonyMetroConfig,
12
+ } = require('{{{reactNativeHarmonyPackageName}}}/metro.config');
13
+
14
+ /**
15
+ * @type {import("metro-config").MetroConfig}
16
+ */
17
+ const config = {
18
+ transformer: {
19
+ getTransformOptions: async () => ({
20
+ transform: {
21
+ experimentalImportSupport: false,
22
+ inlineRequires: true,
23
+ },
24
+ }),
25
+ },
26
+ };
27
+
28
+ module.exports = mergeConfig(
29
+ getDefaultConfig(__dirname),
30
+ createHarmonyMetroConfig({
31
+ reactNativeHarmonyPackageName: '{{{reactNativeHarmonyPackageName}}}',
32
+ }),
33
+ config,
34
+ );
35
+
36
+ `;
37
+ class MetroConfigTemplate {
38
+ constructor(reactNativeHarmonyPackageName) {
8
39
  this.reactNativeHarmonyPackageName = reactNativeHarmonyPackageName;
9
40
  }
10
- MetroConfigTemplate.prototype.build = function () {
41
+ build() {
11
42
  return mustache_1.default.render(TEMPLATE.trimStart(), {
12
43
  reactNativeHarmonyPackageName: this.reactNativeHarmonyPackageName,
13
44
  });
14
- };
15
- return MetroConfigTemplate;
16
- }());
45
+ }
46
+ }
17
47
  exports.MetroConfigTemplate = MetroConfigTemplate;