@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
package/dist/io/Logger.js CHANGED
@@ -1,54 +1,49 @@
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.Logger = void 0;
4
- var chalk_1 = require("chalk");
5
- var cli_tools_1 = require("@react-native-community/cli-tools");
6
- var node_process_1 = require("node:process");
7
- var Logger = /** @class */ (function () {
8
- function Logger() {
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const cli_tools_1 = require("@react-native-community/cli-tools");
9
+ const node_process_1 = __importDefault(require("node:process"));
10
+ class Logger {
11
+ constructor() {
9
12
  this.loader = (0, cli_tools_1.getLoader)({
10
13
  interval: node_process_1.default.stdout.isTTY ? undefined : 0,
11
14
  });
12
15
  this.logger = cli_tools_1.logger;
13
16
  this.isLoaderActive = false;
14
17
  }
15
- Logger.prototype.start = function (prepareMsg) {
16
- var _this = this;
18
+ start(prepareMsg) {
17
19
  this.loader.start(prepareMsg(chalk_1.default));
18
20
  this.isLoaderActive = true;
19
- return function (options) {
20
- _this.isLoaderActive = false;
21
+ return (options) => {
22
+ this.isLoaderActive = false;
21
23
  if (options === null || options === void 0 ? void 0 : options.persist) {
22
- console.log({ loader: _this.loader });
23
- _this.loader.stopAndPersist();
24
+ console.log({ loader: this.loader });
25
+ this.loader.stopAndPersist();
24
26
  }
25
27
  else {
26
- _this.loader.stop();
28
+ this.loader.stop();
27
29
  }
28
30
  };
29
- };
30
- Logger.prototype.info = function (prepareMsg) {
31
- var _this = this;
32
- var info = function (msg) {
33
- _this.isLoaderActive ? _this.loader.info(msg) : _this.logger.info(msg);
31
+ }
32
+ info(prepareMsg) {
33
+ const info = (msg) => {
34
+ this.isLoaderActive ? this.loader.info(msg) : this.logger.info(msg);
34
35
  };
35
36
  info(prepareMsg(chalk_1.default));
36
- };
37
- Logger.prototype.succeed = function (prepareMsg) {
38
- var _this = this;
39
- var succeed = function (msg) {
40
- return _this.isLoaderActive ? _this.loader.succeed(msg) : _this.logger.success(msg);
41
- };
37
+ }
38
+ succeed(prepareMsg) {
39
+ const succeed = (msg) => this.isLoaderActive ? this.loader.succeed(msg) : this.logger.success(msg);
42
40
  succeed(prepareMsg(chalk_1.default));
43
- };
44
- Logger.prototype.warn = function (prepareMsg) {
45
- var _this = this;
46
- var warn = function (msg) {
47
- return _this.isLoaderActive ? _this.loader.warn(msg) : _this.logger.warn(msg);
48
- };
41
+ }
42
+ warn(prepareMsg) {
43
+ const warn = (msg) => this.isLoaderActive ? this.loader.warn(msg) : this.logger.warn(msg);
49
44
  warn(prepareMsg(chalk_1.default));
50
- };
51
- Logger.prototype.debug = function (prepareMsg) {
45
+ }
46
+ debug(prepareMsg) {
52
47
  if (this.isLoaderActive) {
53
48
  clearLine(node_process_1.default.stdout);
54
49
  moveCursor(node_process_1.default.stdout, 0);
@@ -58,27 +53,27 @@ var Logger = /** @class */ (function () {
58
53
  else {
59
54
  console.debug(prepareMsg(chalk_1.default));
60
55
  }
61
- };
62
- Logger.prototype.descriptiveError = function (error) {
63
- var lines = [];
56
+ }
57
+ descriptiveError(error) {
58
+ const lines = [];
64
59
  if (error.isUnexpected() && error.stack) {
65
60
  lines.push('');
66
61
  lines.push(chalk_1.default.bold('Stack'));
67
- error.stack.split('\n').forEach(function (line) { return lines.push(chalk_1.default.gray(line)); });
62
+ error.stack.split('\n').forEach((line) => lines.push(chalk_1.default.gray(line)));
68
63
  }
69
- var details = error.getDetails();
64
+ const details = error.getDetails();
70
65
  if (details) {
71
66
  lines.push('');
72
67
  lines.push(chalk_1.default.bold('Details'));
73
- details.split('\n').forEach(function (line) { return lines.push(line); });
68
+ details.split('\n').forEach((line) => lines.push(line));
74
69
  }
75
70
  lines.push('');
76
- lines.push("".concat(error.getMessage()));
77
- var suggestions = error.getSuggestions();
71
+ lines.push(`${error.getMessage()}`);
72
+ const suggestions = error.getSuggestions();
78
73
  if (suggestions.length > 0) {
79
74
  lines.push('');
80
- lines.push(chalk_1.default.bold("Suggestions"));
81
- suggestions.forEach(function (suggestion) {
75
+ lines.push(chalk_1.default.bold(`Suggestions`));
76
+ suggestions.forEach((suggestion) => {
82
77
  lines.push('• ' + suggestion);
83
78
  });
84
79
  }
@@ -88,11 +83,10 @@ var Logger = /** @class */ (function () {
88
83
  else {
89
84
  this.logger.error(lines.join('\n').trim());
90
85
  }
91
- };
92
- return Logger;
93
- }());
86
+ }
87
+ }
94
88
  exports.Logger = Logger;
95
- var clearLine = function (stream) {
89
+ const clearLine = (stream) => {
96
90
  if (stream.clearLine) {
97
91
  stream.clearLine(0);
98
92
  }
@@ -100,7 +94,7 @@ var clearLine = function (stream) {
100
94
  node_process_1.default.stdout.write('\r' + ' '.repeat(node_process_1.default.stdout.columns || 80) + '\r');
101
95
  }
102
96
  };
103
- var moveCursor = function (stream, x) {
97
+ const moveCursor = (stream, x) => {
104
98
  if (stream.cursorTo) {
105
99
  stream.cursorTo(x);
106
100
  }
package/dist/io/RealFS.js CHANGED
@@ -1,19 +1,4 @@
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
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -23,107 +8,65 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
23
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
24
9
  });
25
10
  };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- 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);
28
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- 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;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
52
13
  };
53
14
  Object.defineProperty(exports, "__esModule", { value: true });
54
15
  exports.RealFS = void 0;
55
- var core_1 = require("../core");
56
- var FileSystem_1 = require("../core/FileSystem");
57
- var node_fs_1 = require("node:fs");
58
- var RealFSDirent = /** @class */ (function (_super) {
59
- __extends(RealFSDirent, _super);
60
- function RealFSDirent(nodeFSDirent) {
61
- var _this = _super.call(this) || this;
62
- _this.nodeFSDirent = nodeFSDirent;
63
- return _this;
16
+ const core_1 = require("../core");
17
+ const FileSystem_1 = require("../core/FileSystem");
18
+ const node_fs_1 = __importDefault(require("node:fs"));
19
+ class RealFSDirent extends FileSystem_1.Dirent {
20
+ constructor(nodeFSDirent) {
21
+ super();
22
+ this.nodeFSDirent = nodeFSDirent;
64
23
  }
65
- RealFSDirent.prototype.isDirectory = function () {
24
+ isDirectory() {
66
25
  return this.nodeFSDirent.isDirectory();
67
- };
68
- RealFSDirent.prototype.isSymbolicLink = function () {
26
+ }
27
+ isSymbolicLink() {
69
28
  return this.nodeFSDirent.isSymbolicLink();
70
- };
71
- Object.defineProperty(RealFSDirent.prototype, "name", {
72
- get: function () {
73
- return this.nodeFSDirent.name;
74
- },
75
- enumerable: false,
76
- configurable: true
77
- });
78
- Object.defineProperty(RealFSDirent.prototype, "path", {
79
- get: function () {
80
- return new core_1.AbsolutePath(this.nodeFSDirent.path).copyWithNewSegment(this.nodeFSDirent.name);
81
- },
82
- enumerable: false,
83
- configurable: true
84
- });
85
- return RealFSDirent;
86
- }(FileSystem_1.Dirent));
87
- var RealFS = /** @class */ (function (_super) {
88
- __extends(RealFS, _super);
89
- function RealFS() {
90
- return _super !== null && _super.apply(this, arguments) || this;
91
29
  }
92
- RealFS.prototype.existsSync = function (path) {
30
+ get name() {
31
+ return this.nodeFSDirent.name;
32
+ }
33
+ get path() {
34
+ return new core_1.AbsolutePath(this.nodeFSDirent.path).copyWithNewSegment(this.nodeFSDirent.name);
35
+ }
36
+ }
37
+ class RealFS extends FileSystem_1.FS {
38
+ existsSync(path) {
93
39
  return node_fs_1.default.existsSync(path.toString());
94
- };
95
- RealFS.prototype.readTextSync = function (path) {
40
+ }
41
+ readTextSync(path) {
96
42
  return node_fs_1.default.readFileSync(path.toString()).toString();
97
- };
98
- RealFS.prototype.readText = function (path) {
99
- return __awaiter(this, void 0, void 0, function () {
100
- return __generator(this, function (_a) {
101
- return [2 /*return*/, new Promise(function (resolve, reject) {
102
- node_fs_1.default.readFile(path.toString(), undefined, function (err, data) {
103
- if (err) {
104
- reject(err);
105
- return;
106
- }
107
- resolve(data.toString());
108
- });
109
- })];
43
+ }
44
+ readText(path) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ return new Promise((resolve, reject) => {
47
+ node_fs_1.default.readFile(path.toString(), undefined, (err, data) => {
48
+ if (err) {
49
+ reject(err);
50
+ return;
51
+ }
52
+ resolve(data.toString());
53
+ });
110
54
  });
111
55
  });
112
- };
113
- RealFS.prototype.writeTextSync = function (path, data) {
56
+ }
57
+ writeTextSync(path, data) {
114
58
  node_fs_1.default.writeFileSync(path.toString(), data);
115
- };
116
- RealFS.prototype.readDirentsSync = function (path, options) {
59
+ }
60
+ readDirentsSync(path, options) {
117
61
  return node_fs_1.default
118
62
  .readdirSync(path.toString(), {
119
63
  withFileTypes: true,
120
64
  recursive: options === null || options === void 0 ? void 0 : options.recursive,
121
65
  })
122
- .map(function (rawDirent) { return new RealFSDirent(rawDirent); });
123
- };
124
- RealFS.prototype.renameSync = function (oldPath, newPath) {
66
+ .map((rawDirent) => new RealFSDirent(rawDirent));
67
+ }
68
+ renameSync(oldPath, newPath) {
125
69
  node_fs_1.default.renameSync(oldPath.toString(), newPath.toString());
126
- };
127
- return RealFS;
128
- }(FileSystem_1.FS));
70
+ }
71
+ }
129
72
  exports.RealFS = RealFS;
package/dist/io/TarGz.js CHANGED
@@ -1,23 +1,26 @@
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.unpackTarGz = unpackTarGz;
4
- var node_fs_1 = require("node:fs");
5
- var node_zlib_1 = require("node:zlib");
6
- var tar_1 = require("tar");
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_zlib_1 = __importDefault(require("node:zlib"));
9
+ const tar_1 = __importDefault(require("tar"));
7
10
  function unpackTarGz(archivePath, outputDirPath) {
8
11
  if (!node_fs_1.default.existsSync(outputDirPath.getValue())) {
9
12
  node_fs_1.default.mkdirSync(outputDirPath.getValue(), { recursive: true });
10
13
  }
11
- var readStream = node_fs_1.default.createReadStream(archivePath.getValue());
12
- var writeStream = tar_1.default.extract({
14
+ const readStream = node_fs_1.default.createReadStream(archivePath.getValue());
15
+ const writeStream = tar_1.default.extract({
13
16
  cwd: outputDirPath.getValue(),
14
17
  });
15
18
  readStream.pipe(node_zlib_1.default.createGunzip()).pipe(writeStream);
16
- return new Promise(function (resolve, reject) {
17
- writeStream.on('finish', function () {
19
+ return new Promise((resolve, reject) => {
20
+ writeStream.on('finish', () => {
18
21
  resolve(undefined);
19
22
  });
20
- writeStream.on('error', function (err) {
23
+ writeStream.on('error', (err) => {
21
24
  reject(err);
22
25
  });
23
26
  });
@@ -1,19 +1,4 @@
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
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -23,167 +8,120 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
23
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
24
9
  });
25
10
  };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- 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);
28
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- 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;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
52
13
  };
53
14
  Object.defineProperty(exports, "__esModule", { value: true });
54
15
  exports.MockedLogger = exports.MemFS = exports.FakeCliExecutor = void 0;
55
- var core_1 = require("../core");
56
- var CliExecutor_1 = require("./CliExecutor");
57
- var memfs_1 = require("memfs");
58
- var Dirent_1 = require("memfs/lib/Dirent");
59
- var Logger_1 = require("./Logger");
60
- var chalk_1 = require("chalk");
61
- var FakeCliExecutor = /** @class */ (function (_super) {
62
- __extends(FakeCliExecutor, _super);
63
- function FakeCliExecutor(onRun) {
64
- var _this = _super.call(this) || this;
65
- _this.onRun = onRun;
66
- _this.commands = [];
67
- return _this;
68
- }
69
- FakeCliExecutor.prototype.run = function (command, options) {
70
- var commandWithArgs = command;
16
+ const core_1 = require("../core");
17
+ const CliExecutor_1 = require("./CliExecutor");
18
+ const memfs_1 = require("memfs");
19
+ const Dirent_1 = __importDefault(require("memfs/lib/Dirent"));
20
+ const Logger_1 = require("./Logger");
21
+ const chalk_1 = __importDefault(require("chalk"));
22
+ class FakeCliExecutor extends CliExecutor_1.CliExecutor {
23
+ constructor(onRun) {
24
+ super();
25
+ this.onRun = onRun;
26
+ this.commands = [];
27
+ }
28
+ run(command, options) {
29
+ let commandWithArgs = command;
71
30
  if (options.args) {
72
31
  commandWithArgs += options.args.join(' ');
73
32
  }
74
33
  this.commands.push(commandWithArgs);
75
34
  return this.onRun(commandWithArgs);
76
- };
77
- FakeCliExecutor.prototype.getCommands = function () {
35
+ }
36
+ getCommands() {
78
37
  return this.commands;
79
- };
80
- return FakeCliExecutor;
81
- }(CliExecutor_1.CliExecutor));
38
+ }
39
+ }
82
40
  exports.FakeCliExecutor = FakeCliExecutor;
83
- var MemFSDirent = /** @class */ (function (_super) {
84
- __extends(MemFSDirent, _super);
85
- function MemFSDirent(rawDirent) {
86
- var _this = _super.call(this) || this;
87
- _this.rawDirent = rawDirent;
88
- return _this;
89
- }
90
- MemFSDirent.prototype.isDirectory = function () {
41
+ class MemFSDirent extends core_1.Dirent {
42
+ constructor(rawDirent) {
43
+ super();
44
+ this.rawDirent = rawDirent;
45
+ }
46
+ isDirectory() {
91
47
  return this.rawDirent.isDirectory();
92
- };
93
- MemFSDirent.prototype.isSymbolicLink = function () {
48
+ }
49
+ isSymbolicLink() {
94
50
  return false;
95
- };
96
- Object.defineProperty(MemFSDirent.prototype, "name", {
97
- get: function () {
98
- return this.rawDirent.name.toString();
99
- },
100
- enumerable: false,
101
- configurable: true
102
- });
103
- Object.defineProperty(MemFSDirent.prototype, "path", {
104
- get: function () {
105
- return new core_1.AbsolutePath(this.rawDirent.path).copyWithNewSegment(this.rawDirent.name.toString());
106
- },
107
- enumerable: false,
108
- configurable: true
109
- });
110
- return MemFSDirent;
111
- }(core_1.Dirent));
112
- var MemFS = /** @class */ (function (_super) {
113
- __extends(MemFS, _super);
114
- function MemFS(initialFileStructure) {
115
- var _this = _super.call(this) || this;
116
- _this.fs = (0, memfs_1.memfs)(initialFileStructure, './').fs;
117
- return _this;
118
- }
119
- MemFS.prototype.existsSync = function (path) {
51
+ }
52
+ get name() {
53
+ return this.rawDirent.name.toString();
54
+ }
55
+ get path() {
56
+ return new core_1.AbsolutePath(this.rawDirent.path).copyWithNewSegment(this.rawDirent.name.toString());
57
+ }
58
+ }
59
+ class MemFS extends core_1.FS {
60
+ constructor(initialFileStructure) {
61
+ super();
62
+ this.fs = (0, memfs_1.memfs)(initialFileStructure, './').fs;
63
+ }
64
+ existsSync(path) {
120
65
  return this.fs.existsSync(path.toString());
121
- };
122
- MemFS.prototype.readTextSync = function (path) {
66
+ }
67
+ readTextSync(path) {
123
68
  return this.fs.readFileSync(path.toString()).toString();
124
- };
125
- MemFS.prototype.readText = function (path) {
126
- return __awaiter(this, void 0, void 0, function () {
127
- var _this = this;
128
- return __generator(this, function (_a) {
129
- return [2 /*return*/, new Promise(function (resolve, reject) {
130
- _this.fs.readFile(path.toString(), {}, function (err, data) {
131
- var _a;
132
- if (err) {
133
- reject(err);
134
- return;
135
- }
136
- resolve((_a = data === null || data === void 0 ? void 0 : data.toString()) !== null && _a !== void 0 ? _a : '');
137
- });
138
- })];
69
+ }
70
+ readText(path) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ return new Promise((resolve, reject) => {
73
+ this.fs.readFile(path.toString(), {}, (err, data) => {
74
+ var _a;
75
+ if (err) {
76
+ reject(err);
77
+ return;
78
+ }
79
+ resolve((_a = data === null || data === void 0 ? void 0 : data.toString()) !== null && _a !== void 0 ? _a : '');
80
+ });
139
81
  });
140
82
  });
141
- };
142
- MemFS.prototype.writeTextSync = function (path, data) {
83
+ }
84
+ writeTextSync(path, data) {
143
85
  return this.fs.writeFileSync(path.toString(), data);
144
- };
145
- MemFS.prototype.readDirentsSync = function (path, options) {
86
+ }
87
+ readDirentsSync(path, options) {
146
88
  return this.fs
147
89
  .readdirSync(path.toString(), {
148
90
  withFileTypes: true,
149
91
  recursive: options === null || options === void 0 ? void 0 : options.recursive,
150
92
  })
151
- .flatMap(function (dataOutOrDirent) {
93
+ .flatMap((dataOutOrDirent) => {
152
94
  if (!(dataOutOrDirent instanceof Dirent_1.default)) {
153
95
  return [];
154
96
  }
155
97
  return [new MemFSDirent(dataOutOrDirent)];
156
98
  });
157
- };
158
- return MemFS;
159
- }(core_1.FS));
99
+ }
100
+ }
160
101
  exports.MemFS = MemFS;
161
- var MockedLogger = /** @class */ (function (_super) {
162
- __extends(MockedLogger, _super);
163
- function MockedLogger() {
164
- var _this = _super !== null && _super.apply(this, arguments) || this;
165
- _this.logs = [];
166
- return _this;
167
- }
168
- MockedLogger.prototype.debug = function (prepareMsg) {
102
+ class MockedLogger extends Logger_1.Logger {
103
+ constructor() {
104
+ super(...arguments);
105
+ this.logs = [];
106
+ }
107
+ debug(prepareMsg) {
169
108
  chalk_1.default.level = 0;
170
109
  this.logs.push({ type: 'debug', msg: prepareMsg(chalk_1.default) });
171
- };
172
- MockedLogger.prototype.info = function (prepareMsg, options) {
110
+ }
111
+ info(prepareMsg, options) {
173
112
  chalk_1.default.level = 0;
174
113
  this.logs.push({ type: 'info', msg: prepareMsg(chalk_1.default) });
175
- };
176
- MockedLogger.prototype.warn = function (prepareMsg) {
114
+ }
115
+ warn(prepareMsg) {
177
116
  chalk_1.default.level = 0;
178
117
  this.logs.push({ type: 'warn', msg: prepareMsg(chalk_1.default) });
179
- };
180
- MockedLogger.prototype.descriptiveError = function (error) {
118
+ }
119
+ descriptiveError(error) {
181
120
  chalk_1.default.level = 0;
182
121
  this.logs.push({ type: 'error', msg: error.getMessage() });
183
- };
184
- MockedLogger.prototype.getLogs = function () {
122
+ }
123
+ getLogs() {
185
124
  return this.logs;
186
- };
187
- return MockedLogger;
188
- }(Logger_1.Logger));
125
+ }
126
+ }
189
127
  exports.MockedLogger = MockedLogger;
@@ -1,23 +1,24 @@
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.findFilePathsWithExtensions = findFilePathsWithExtensions;
4
- var node_path_1 = require("node:path");
5
- var Dirent_1 = require("memfs/lib/Dirent");
6
- var node_fs_1 = require("node:fs");
7
- var node_fs_2 = require("node:fs");
8
- function findFilePathsWithExtensions(dirPath, fileExtensions, options) {
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const Dirent_1 = __importDefault(require("memfs/lib/Dirent"));
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const node_fs_2 = require("node:fs");
11
+ function findFilePathsWithExtensions(dirPath, fileExtensions, options = {}) {
9
12
  var _a;
10
- if (options === void 0) { options = {}; }
11
- var fs = ((_a = options === null || options === void 0 ? void 0 : options.fs) !== null && _a !== void 0 ? _a : node_fs_1.default);
12
- var results = [];
13
- var files = fs.readdirSync(dirPath.getValue(), { withFileTypes: true });
14
- for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
15
- var file = files_1[_i];
13
+ const fs = ((_a = options === null || options === void 0 ? void 0 : options.fs) !== null && _a !== void 0 ? _a : node_fs_1.default);
14
+ let results = [];
15
+ const files = fs.readdirSync(dirPath.getValue(), { withFileTypes: true });
16
+ for (const file of files) {
16
17
  if (!(file instanceof node_fs_2.Dirent) &&
17
18
  !(file instanceof Dirent_1.default)) {
18
19
  continue;
19
20
  }
20
- var path = dirPath.copyWithNewSegment(file.name.toString());
21
+ const path = dirPath.copyWithNewSegment(file.name.toString());
21
22
  if (fs.lstatSync(path.toString()).isDirectory()) {
22
23
  results = results.concat(findFilePathsWithExtensions(path, fileExtensions, options));
23
24
  }