@react-native-oh/react-native-harmony-cli 0.0.36 → 0.0.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 (137) hide show
  1. package/README.md +11 -11
  2. package/dist/assetResolver.js +74 -43
  3. package/dist/autolinking/Autolinking.js +183 -179
  4. package/dist/codegen/core/CodegenError.js +23 -3
  5. package/dist/codegen/core/EventUtils.js +3 -3
  6. package/dist/codegen/core/TypeAnnotationToTS.js +28 -24
  7. package/dist/codegen/core/UberSchema.js +96 -57
  8. package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +42 -28
  9. package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +34 -27
  10. package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +33 -25
  11. package/dist/codegen/generators/CppComponentCodeGenerator.js +28 -23
  12. package/dist/codegen/generators/LibGlueCodeGenerator.js +29 -26
  13. package/dist/codegen/generators/NativeModuleCodeGenerator.js +30 -25
  14. package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
  15. package/dist/codegen/generators/UberGeneratorV1.js +24 -18
  16. package/dist/codegen/generators/UberGeneratorV2.js +36 -28
  17. package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +24 -50
  18. package/dist/codegen/templates/BasePackageHTemplate.js +21 -109
  19. package/dist/codegen/templates/ComponentDescriptorHTemplate.js +8 -53
  20. package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +27 -75
  21. package/dist/codegen/templates/ComponentUtilsTSTemplate.js +29 -162
  22. package/dist/codegen/templates/IndexTSTemplate.js +17 -37
  23. package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +24 -108
  24. package/dist/codegen/templates/TurboModuleCppTemplate.js +15 -38
  25. package/dist/codegen/templates/TurboModuleHTemplate.js +11 -32
  26. package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +19 -52
  27. package/dist/commands/bundle-harmony.js +138 -53
  28. package/dist/commands/codegen-harmony.js +175 -104
  29. package/dist/commands/codegen-lib-harmony.js +116 -76
  30. package/dist/commands/create-metro-host-constants.js +47 -18
  31. package/dist/commands/init.js +961 -537
  32. package/dist/commands/link-harmony.js +71 -33
  33. package/dist/commands/pack-harmony.js +108 -47
  34. package/dist/commands/run-harmony.js +520 -352
  35. package/dist/commands/unpack-harmony.js +198 -105
  36. package/dist/commands/verify-package-harmony.js +108 -54
  37. package/dist/core/AbsolutePath.js +47 -31
  38. package/dist/core/CodegenConfig.js +22 -24
  39. package/dist/core/DescriptiveError.js +37 -18
  40. package/dist/core/FileSystem.js +18 -14
  41. package/dist/core/OHPackageJSON5.js +23 -17
  42. package/dist/core/PackageJSON.js +42 -26
  43. package/dist/core/ProjectDependenciesManager.js +96 -46
  44. package/dist/core/ValidationError.js +22 -2
  45. package/dist/core/fs.js +6 -9
  46. package/dist/index.js +1 -1
  47. package/dist/io/CliExecutor.js +98 -46
  48. package/dist/io/Logger.js +46 -40
  49. package/dist/io/RealFS.js +88 -35
  50. package/dist/io/TarGz.js +8 -11
  51. package/dist/io/__fixtures__.js +141 -79
  52. package/dist/io/fsUtils.js +12 -13
  53. package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +47 -19
  54. package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +41 -13
  55. package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +38 -8
  56. package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +54 -22
  57. package/dist/package-verifier/verify-package.js +132 -55
  58. package/dist/simulator/LaunchSimulator.js +395 -0
  59. package/dist/simulator/index.js +23 -0
  60. package/jest.config.js +12 -12
  61. package/package.json +78 -70
  62. package/react-native.config.js +17 -17
  63. package/tsconfig.build.json +6 -6
  64. package/tsconfig.json +2 -2
  65. package/.prettierrc +0 -6
  66. package/src/assetResolver.ts +0 -134
  67. package/src/autolinking/Autolinking.test.ts +0 -483
  68. package/src/autolinking/Autolinking.ts +0 -382
  69. package/src/autolinking/index.ts +0 -8
  70. package/src/codegen/core/CodeGenerator.ts +0 -16
  71. package/src/codegen/core/CodegenError.ts +0 -10
  72. package/src/codegen/core/EventUtils.ts +0 -23
  73. package/src/codegen/core/TypeAnnotationToTS.test.ts +0 -82
  74. package/src/codegen/core/TypeAnnotationToTS.ts +0 -195
  75. package/src/codegen/core/UberSchema.ts +0 -152
  76. package/src/codegen/core/index.ts +0 -12
  77. package/src/codegen/generators/AppBuildTimeGlueCodeGenerator.ts +0 -120
  78. package/src/codegen/generators/ArkTSComponentCodeGeneratorArkTS.ts +0 -128
  79. package/src/codegen/generators/ArkTSComponentCodeGeneratorCAPI.ts +0 -122
  80. package/src/codegen/generators/CppComponentCodeGenerator.ts +0 -95
  81. package/src/codegen/generators/LibGlueCodeGenerator.ts +0 -98
  82. package/src/codegen/generators/NativeModuleCodeGenerator.ts +0 -124
  83. package/src/codegen/generators/SharedComponentCodeGenerator.ts +0 -57
  84. package/src/codegen/generators/UberGeneratorV1.ts +0 -75
  85. package/src/codegen/generators/UberGeneratorV2.ts +0 -114
  86. package/src/codegen/generators/index.ts +0 -15
  87. package/src/codegen/index.ts +0 -9
  88. package/src/codegen/templates/BaseComponentInstanceHTemplate.ts +0 -128
  89. package/src/codegen/templates/BasePackageHTemplate.ts +0 -147
  90. package/src/codegen/templates/ComponentDescriptorHTemplate.ts +0 -63
  91. package/src/codegen/templates/ComponentJSIBinderHTemplate.ts +0 -121
  92. package/src/codegen/templates/ComponentUtilsTSTemplate.ts +0 -222
  93. package/src/codegen/templates/IndexTSTemplate.ts +0 -62
  94. package/src/codegen/templates/RNOHGeneratedPackageHTemplate.ts +0 -138
  95. package/src/codegen/templates/TurboModuleCppTemplate.ts +0 -61
  96. package/src/codegen/templates/TurboModuleHTemplate.ts +0 -42
  97. package/src/codegen/templates/TurboModuleSpecTSTemplate.ts +0 -101
  98. package/src/codegen/templates/index.ts +0 -16
  99. package/src/commands/bundle-harmony.ts +0 -134
  100. package/src/commands/codegen-harmony.ts +0 -297
  101. package/src/commands/codegen-lib-harmony.ts +0 -389
  102. package/src/commands/create-metro-host-constants.ts +0 -55
  103. package/src/commands/index.ts +0 -16
  104. package/src/commands/init.ts +0 -755
  105. package/src/commands/link-harmony.ts +0 -102
  106. package/src/commands/pack-harmony.ts +0 -128
  107. package/src/commands/run-harmony.ts +0 -478
  108. package/src/commands/types.ts +0 -21
  109. package/src/commands/unpack-harmony.ts +0 -238
  110. package/src/commands/verify-package-harmony.ts +0 -113
  111. package/src/core/AbsolutePath.ts +0 -66
  112. package/src/core/CodegenConfig.ts +0 -67
  113. package/src/core/DescriptiveError.ts +0 -68
  114. package/src/core/FileSystem.ts +0 -57
  115. package/src/core/OHPackageJSON5.ts +0 -30
  116. package/src/core/PackageJSON.ts +0 -104
  117. package/src/core/ProjectDependenciesManager.ts +0 -103
  118. package/src/core/ValidationError.ts +0 -8
  119. package/src/core/ValueObject.ts +0 -9
  120. package/src/core/fs.ts +0 -38
  121. package/src/core/index.ts +0 -17
  122. package/src/index.ts +0 -33
  123. package/src/io/CliExecutor.ts +0 -69
  124. package/src/io/Logger.ts +0 -112
  125. package/src/io/RealFS.ts +0 -62
  126. package/src/io/TarGz.ts +0 -33
  127. package/src/io/__fixtures__.ts +0 -139
  128. package/src/io/fsUtils.ts +0 -44
  129. package/src/io/index.ts +0 -11
  130. package/src/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.ts +0 -35
  131. package/src/package-verifier/checks/HarmonyDirExistsCheck.ts +0 -31
  132. package/src/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.ts +0 -25
  133. package/src/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.ts +0 -54
  134. package/src/package-verifier/checks/index.ts +0 -11
  135. package/src/package-verifier/index.ts +0 -9
  136. package/src/package-verifier/types.ts +0 -19
  137. package/src/package-verifier/verify-package.ts +0 -123
@@ -5,8 +5,28 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE-MIT file in the root directory of this source tree.
7
7
  */
8
+ var __extends = (this && this.__extends) || (function () {
9
+ var extendStatics = function (d, b) {
10
+ extendStatics = Object.setPrototypeOf ||
11
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
12
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
13
+ return extendStatics(d, b);
14
+ };
15
+ return function (d, b) {
16
+ if (typeof b !== "function" && b !== null)
17
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
18
+ extendStatics(d, b);
19
+ function __() { this.constructor = d; }
20
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
21
+ };
22
+ })();
8
23
  Object.defineProperty(exports, "__esModule", { value: true });
9
24
  exports.ValidationError = void 0;
10
- class ValidationError extends Error {
11
- }
25
+ var ValidationError = /** @class */ (function (_super) {
26
+ __extends(ValidationError, _super);
27
+ function ValidationError() {
28
+ return _super !== null && _super.apply(this, arguments) || this;
29
+ }
30
+ return ValidationError;
31
+ }(Error));
12
32
  exports.ValidationError = ValidationError;
package/dist/core/fs.js CHANGED
@@ -5,14 +5,11 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE-MIT file in the root directory of this source tree.
7
7
  */
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
8
  Object.defineProperty(exports, "__esModule", { value: true });
12
9
  exports.maybeMakeDirectories = maybeMakeDirectories;
13
10
  exports.maybeRemoveFilesInDirectory = maybeRemoveFilesInDirectory;
14
- const node_fs_1 = __importDefault(require("node:fs"));
15
- const DescriptiveError_1 = require("./DescriptiveError");
11
+ var node_fs_1 = require("node:fs");
12
+ var DescriptiveError_1 = require("./DescriptiveError");
16
13
  function maybeMakeDirectories(path) {
17
14
  if (!node_fs_1.default.existsSync(path.getValue())) {
18
15
  node_fs_1.default.mkdirSync(path.getValue(), { recursive: true });
@@ -25,12 +22,12 @@ function maybeRemoveFilesInDirectory(path) {
25
22
  if (!node_fs_1.default.lstatSync(path.getValue()).isDirectory()) {
26
23
  throw new DescriptiveError_1.DescriptiveError({
27
24
  whatHappened: "Tried to remove all files from a path that doesn't point to a directory",
28
- whatCanUserDo: [`Verify path: ${path.getValue()}`],
25
+ whatCanUserDo: ["Verify path: ".concat(path.getValue())],
29
26
  });
30
27
  }
31
- const fileOrDirNames = node_fs_1.default.readdirSync(path.getValue());
32
- fileOrDirNames.forEach((fileOrDirName) => {
33
- const maybeFilePath = path.copyWithNewSegment(fileOrDirName);
28
+ var fileOrDirNames = node_fs_1.default.readdirSync(path.getValue());
29
+ fileOrDirNames.forEach(function (fileOrDirName) {
30
+ var maybeFilePath = path.copyWithNewSegment(fileOrDirName);
34
31
  if (node_fs_1.default.statSync(maybeFilePath.getValue()).isDirectory()) {
35
32
  return;
36
33
  }
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.config = void 0;
10
- const commands_1 = require("./commands");
10
+ var commands_1 = require("./commands");
11
11
  exports.config = {
12
12
  commands: [
13
13
  commands_1.commandBundleHarmony,
@@ -5,6 +5,21 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE-MIT file in the root directory of this source tree.
7
7
  */
8
+ var __extends = (this && this.__extends) || (function () {
9
+ var extendStatics = function (d, b) {
10
+ extendStatics = Object.setPrototypeOf ||
11
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
12
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
13
+ return extendStatics(d, b);
14
+ };
15
+ return function (d, b) {
16
+ if (typeof b !== "function" && b !== null)
17
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
18
+ extendStatics(d, b);
19
+ function __() { this.constructor = d; }
20
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
21
+ };
22
+ })();
8
23
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
24
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
25
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -14,55 +29,92 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
14
29
  step((generator = generator.apply(thisArg, _arguments || [])).next());
15
30
  });
16
31
  };
32
+ var __generator = (this && this.__generator) || function (thisArg, body) {
33
+ 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);
34
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
35
+ function verb(n) { return function (v) { return step([n, v]); }; }
36
+ function step(op) {
37
+ if (f) throw new TypeError("Generator is already executing.");
38
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
39
+ 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;
40
+ if (y = 0, t) op = [op[0] & 2, t.value];
41
+ switch (op[0]) {
42
+ case 0: case 1: t = op; break;
43
+ case 4: _.label++; return { value: op[1], done: false };
44
+ case 5: _.label++; y = op[1]; op = [0]; continue;
45
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
46
+ default:
47
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
48
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
49
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
50
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
51
+ if (t[2]) _.ops.pop();
52
+ _.trys.pop(); continue;
53
+ }
54
+ op = body.call(thisArg, _);
55
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
56
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
57
+ }
58
+ };
17
59
  Object.defineProperty(exports, "__esModule", { value: true });
18
60
  exports.RealCliExecutor = exports.CliExecutor = void 0;
19
- const node_child_process_1 = require("node:child_process");
20
- class CliExecutor {
21
- }
61
+ var node_child_process_1 = require("node:child_process");
62
+ var CliExecutor = /** @class */ (function () {
63
+ function CliExecutor() {
64
+ }
65
+ return CliExecutor;
66
+ }());
22
67
  exports.CliExecutor = CliExecutor;
23
- class RealCliExecutor extends CliExecutor {
24
- run(command, options) {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- return new Promise((resolve, reject) => {
27
- var _a, _b;
28
- let commandWithArgs = command;
29
- let argStrings = [];
30
- if (options === null || options === void 0 ? void 0 : options.args) {
31
- argStrings = options.args;
32
- commandWithArgs += ' ' + argStrings.join(' ');
33
- }
34
- (_a = options === null || options === void 0 ? void 0 : options.onArgsStringified) === null || _a === void 0 ? void 0 : _a.call(options, commandWithArgs);
35
- const process = (0, node_child_process_1.spawn)(command, argStrings, {
36
- cwd: (_b = options === null || options === void 0 ? void 0 : options.cwd) === null || _b === void 0 ? void 0 : _b.toString(),
37
- shell: (options === null || options === void 0 ? void 0 : options.shell) ? true : false,
38
- });
39
- let stdout = '';
40
- let stderr = '';
41
- process.stdout.on('data', (data) => {
42
- var _a;
43
- const output = data.toString();
44
- stdout += output;
45
- (_a = options === null || options === void 0 ? void 0 : options.onStdout) === null || _a === void 0 ? void 0 : _a.call(options, output);
46
- });
47
- process.stderr.on('data', (data) => {
48
- var _a;
49
- const output = data.toString();
50
- stderr += output;
51
- (_a = options === null || options === void 0 ? void 0 : options.onStderr) === null || _a === void 0 ? void 0 : _a.call(options, output);
52
- });
53
- process.on('error', (error) => {
54
- reject(error);
55
- });
56
- process.on('close', (code) => {
57
- if (code === 0) {
58
- resolve(stdout);
59
- }
60
- else {
61
- reject(new Error(`Command failed with code ${code}\nStderr: ${stderr}`));
62
- }
63
- });
68
+ var RealCliExecutor = /** @class */ (function (_super) {
69
+ __extends(RealCliExecutor, _super);
70
+ function RealCliExecutor() {
71
+ return _super !== null && _super.apply(this, arguments) || this;
72
+ }
73
+ RealCliExecutor.prototype.run = function (command, options) {
74
+ return __awaiter(this, void 0, void 0, function () {
75
+ return __generator(this, function (_a) {
76
+ return [2 /*return*/, new Promise(function (resolve, reject) {
77
+ var _a, _b;
78
+ var commandWithArgs = command;
79
+ var argStrings = [];
80
+ if (options === null || options === void 0 ? void 0 : options.args) {
81
+ argStrings = options.args;
82
+ commandWithArgs += ' ' + argStrings.join(' ');
83
+ }
84
+ (_a = options === null || options === void 0 ? void 0 : options.onArgsStringified) === null || _a === void 0 ? void 0 : _a.call(options, commandWithArgs);
85
+ var process = (0, node_child_process_1.spawn)(command, argStrings, {
86
+ cwd: (_b = options === null || options === void 0 ? void 0 : options.cwd) === null || _b === void 0 ? void 0 : _b.toString(),
87
+ shell: (options === null || options === void 0 ? void 0 : options.shell) ? true : false,
88
+ });
89
+ var stdout = '';
90
+ var stderr = '';
91
+ process.stdout.on('data', function (data) {
92
+ var _a;
93
+ var output = data.toString();
94
+ stdout += output;
95
+ (_a = options === null || options === void 0 ? void 0 : options.onStdout) === null || _a === void 0 ? void 0 : _a.call(options, output);
96
+ });
97
+ process.stderr.on('data', function (data) {
98
+ var _a;
99
+ var output = data.toString();
100
+ stderr += output;
101
+ (_a = options === null || options === void 0 ? void 0 : options.onStderr) === null || _a === void 0 ? void 0 : _a.call(options, output);
102
+ });
103
+ process.on('error', function (error) {
104
+ reject(error);
105
+ });
106
+ process.on('close', function (code) {
107
+ if (code === 0) {
108
+ resolve(stdout);
109
+ }
110
+ else {
111
+ reject(new Error("Command failed with code ".concat(code, "\nStderr: ").concat(stderr)));
112
+ }
113
+ });
114
+ })];
64
115
  });
65
116
  });
66
- }
67
- }
117
+ };
118
+ return RealCliExecutor;
119
+ }(CliExecutor));
68
120
  exports.RealCliExecutor = RealCliExecutor;
package/dist/io/Logger.js CHANGED
@@ -5,51 +5,56 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE-MIT file in the root directory of this source tree.
7
7
  */
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
8
  Object.defineProperty(exports, "__esModule", { value: true });
12
9
  exports.Logger = void 0;
13
- const chalk_1 = __importDefault(require("chalk"));
14
- const cli_tools_1 = require("@react-native-community/cli-tools");
15
- const node_process_1 = __importDefault(require("node:process"));
16
- class Logger {
17
- constructor() {
10
+ var chalk_1 = require("chalk");
11
+ var cli_tools_1 = require("@react-native-community/cli-tools");
12
+ var node_process_1 = require("node:process");
13
+ var Logger = /** @class */ (function () {
14
+ function Logger() {
18
15
  this.loader = (0, cli_tools_1.getLoader)({
19
16
  interval: node_process_1.default.stdout.isTTY ? undefined : 0,
20
17
  });
21
18
  this.logger = cli_tools_1.logger;
22
19
  this.isLoaderActive = false;
23
20
  }
24
- start(prepareMsg) {
21
+ Logger.prototype.start = function (prepareMsg) {
22
+ var _this = this;
25
23
  this.loader.start(prepareMsg(chalk_1.default));
26
24
  this.isLoaderActive = true;
27
- return (options) => {
28
- this.isLoaderActive = false;
25
+ return function (options) {
26
+ _this.isLoaderActive = false;
29
27
  if (options === null || options === void 0 ? void 0 : options.persist) {
30
- console.log({ loader: this.loader });
31
- this.loader.stopAndPersist();
28
+ console.log({ loader: _this.loader });
29
+ _this.loader.stopAndPersist();
32
30
  }
33
31
  else {
34
- this.loader.stop();
32
+ _this.loader.stop();
35
33
  }
36
34
  };
37
- }
38
- info(prepareMsg) {
39
- const info = (msg) => {
40
- this.isLoaderActive ? this.loader.info(msg) : this.logger.info(msg);
35
+ };
36
+ Logger.prototype.info = function (prepareMsg) {
37
+ var _this = this;
38
+ var info = function (msg) {
39
+ _this.isLoaderActive ? _this.loader.info(msg) : _this.logger.info(msg);
41
40
  };
42
41
  info(prepareMsg(chalk_1.default));
43
- }
44
- succeed(prepareMsg) {
45
- const succeed = (msg) => this.isLoaderActive ? this.loader.succeed(msg) : this.logger.success(msg);
42
+ };
43
+ Logger.prototype.succeed = function (prepareMsg) {
44
+ var _this = this;
45
+ var succeed = function (msg) {
46
+ return _this.isLoaderActive ? _this.loader.succeed(msg) : _this.logger.success(msg);
47
+ };
46
48
  succeed(prepareMsg(chalk_1.default));
47
- }
48
- warn(prepareMsg) {
49
- const warn = (msg) => this.isLoaderActive ? this.loader.warn(msg) : this.logger.warn(msg);
49
+ };
50
+ Logger.prototype.warn = function (prepareMsg) {
51
+ var _this = this;
52
+ var warn = function (msg) {
53
+ return _this.isLoaderActive ? _this.loader.warn(msg) : _this.logger.warn(msg);
54
+ };
50
55
  warn(prepareMsg(chalk_1.default));
51
- }
52
- debug(prepareMsg) {
56
+ };
57
+ Logger.prototype.debug = function (prepareMsg) {
53
58
  if (this.isLoaderActive) {
54
59
  clearLine(node_process_1.default.stdout);
55
60
  moveCursor(node_process_1.default.stdout, 0);
@@ -59,27 +64,27 @@ class Logger {
59
64
  else {
60
65
  console.debug(prepareMsg(chalk_1.default));
61
66
  }
62
- }
63
- descriptiveError(error) {
64
- const lines = [];
67
+ };
68
+ Logger.prototype.descriptiveError = function (error) {
69
+ var lines = [];
65
70
  if (error.isUnexpected() && error.stack) {
66
71
  lines.push('');
67
72
  lines.push(chalk_1.default.bold('Stack'));
68
- error.stack.split('\n').forEach((line) => lines.push(chalk_1.default.gray(line)));
73
+ error.stack.split('\n').forEach(function (line) { return lines.push(chalk_1.default.gray(line)); });
69
74
  }
70
- const details = error.getDetails();
75
+ var details = error.getDetails();
71
76
  if (details) {
72
77
  lines.push('');
73
78
  lines.push(chalk_1.default.bold('Details'));
74
- details.split('\n').forEach((line) => lines.push(line));
79
+ details.split('\n').forEach(function (line) { return lines.push(line); });
75
80
  }
76
81
  lines.push('');
77
- lines.push(`${error.getMessage()}`);
78
- const suggestions = error.getSuggestions();
82
+ lines.push("".concat(error.getMessage()));
83
+ var suggestions = error.getSuggestions();
79
84
  if (suggestions.length > 0) {
80
85
  lines.push('');
81
- lines.push(chalk_1.default.bold(`Suggestions`));
82
- suggestions.forEach((suggestion) => {
86
+ lines.push(chalk_1.default.bold("Suggestions"));
87
+ suggestions.forEach(function (suggestion) {
83
88
  lines.push('• ' + suggestion);
84
89
  });
85
90
  }
@@ -89,10 +94,11 @@ class Logger {
89
94
  else {
90
95
  this.logger.error(lines.join('\n').trim());
91
96
  }
92
- }
93
- }
97
+ };
98
+ return Logger;
99
+ }());
94
100
  exports.Logger = Logger;
95
- const clearLine = (stream) => {
101
+ var clearLine = function (stream) {
96
102
  if (stream.clearLine) {
97
103
  stream.clearLine(0);
98
104
  }
@@ -100,7 +106,7 @@ const clearLine = (stream) => {
100
106
  node_process_1.default.stdout.write('\r' + ' '.repeat(node_process_1.default.stdout.columns || 80) + '\r');
101
107
  }
102
108
  };
103
- const moveCursor = (stream, x) => {
109
+ var moveCursor = function (stream, x) {
104
110
  if (stream.cursorTo) {
105
111
  stream.cursorTo(x);
106
112
  }
package/dist/io/RealFS.js CHANGED
@@ -5,6 +5,21 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE-MIT file in the root directory of this source tree.
7
7
  */
8
+ var __extends = (this && this.__extends) || (function () {
9
+ var extendStatics = function (d, b) {
10
+ extendStatics = Object.setPrototypeOf ||
11
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
12
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
13
+ return extendStatics(d, b);
14
+ };
15
+ return function (d, b) {
16
+ if (typeof b !== "function" && b !== null)
17
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
18
+ extendStatics(d, b);
19
+ function __() { this.constructor = d; }
20
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
21
+ };
22
+ })();
8
23
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
24
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
25
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -14,55 +29,93 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
14
29
  step((generator = generator.apply(thisArg, _arguments || [])).next());
15
30
  });
16
31
  };
17
- var __importDefault = (this && this.__importDefault) || function (mod) {
18
- return (mod && mod.__esModule) ? mod : { "default": mod };
32
+ var __generator = (this && this.__generator) || function (thisArg, body) {
33
+ 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);
34
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
35
+ function verb(n) { return function (v) { return step([n, v]); }; }
36
+ function step(op) {
37
+ if (f) throw new TypeError("Generator is already executing.");
38
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
39
+ 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;
40
+ if (y = 0, t) op = [op[0] & 2, t.value];
41
+ switch (op[0]) {
42
+ case 0: case 1: t = op; break;
43
+ case 4: _.label++; return { value: op[1], done: false };
44
+ case 5: _.label++; y = op[1]; op = [0]; continue;
45
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
46
+ default:
47
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
48
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
49
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
50
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
51
+ if (t[2]) _.ops.pop();
52
+ _.trys.pop(); continue;
53
+ }
54
+ op = body.call(thisArg, _);
55
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
56
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
57
+ }
19
58
  };
20
59
  Object.defineProperty(exports, "__esModule", { value: true });
21
60
  exports.RealFS = void 0;
22
- const FileSystem_1 = require("../core/FileSystem");
23
- const node_fs_1 = __importDefault(require("node:fs"));
24
- class RealFSDirent extends FileSystem_1.Dirent {
25
- constructor(nodeFSDirent) {
26
- super();
27
- this.nodeFSDirent = nodeFSDirent;
61
+ var FileSystem_1 = require("../core/FileSystem");
62
+ var node_fs_1 = require("node:fs");
63
+ var RealFSDirent = /** @class */ (function (_super) {
64
+ __extends(RealFSDirent, _super);
65
+ function RealFSDirent(nodeFSDirent) {
66
+ var _this = _super.call(this) || this;
67
+ _this.nodeFSDirent = nodeFSDirent;
68
+ return _this;
28
69
  }
29
- isDirectory() {
70
+ RealFSDirent.prototype.isDirectory = function () {
30
71
  return this.nodeFSDirent.isDirectory();
72
+ };
73
+ Object.defineProperty(RealFSDirent.prototype, "name", {
74
+ get: function () {
75
+ return this.nodeFSDirent.name;
76
+ },
77
+ enumerable: false,
78
+ configurable: true
79
+ });
80
+ return RealFSDirent;
81
+ }(FileSystem_1.Dirent));
82
+ var RealFS = /** @class */ (function (_super) {
83
+ __extends(RealFS, _super);
84
+ function RealFS() {
85
+ return _super !== null && _super.apply(this, arguments) || this;
31
86
  }
32
- get name() {
33
- return this.nodeFSDirent.name;
34
- }
35
- }
36
- class RealFS extends FileSystem_1.FS {
37
- existsSync(path) {
87
+ RealFS.prototype.existsSync = function (path) {
38
88
  return node_fs_1.default.existsSync(path.toString());
39
- }
40
- readTextSync(path) {
89
+ };
90
+ RealFS.prototype.readTextSync = function (path) {
41
91
  return node_fs_1.default.readFileSync(path.toString()).toString();
42
- }
43
- readText(path) {
44
- return __awaiter(this, void 0, void 0, function* () {
45
- return new Promise((resolve, reject) => {
46
- node_fs_1.default.readFile(path.toString(), undefined, (err, data) => {
47
- if (err) {
48
- reject(err);
49
- return;
50
- }
51
- resolve(data.toString());
52
- });
92
+ };
93
+ RealFS.prototype.readText = function (path) {
94
+ return __awaiter(this, void 0, void 0, function () {
95
+ return __generator(this, function (_a) {
96
+ return [2 /*return*/, new Promise(function (resolve, reject) {
97
+ node_fs_1.default.readFile(path.toString(), undefined, function (err, data) {
98
+ if (err) {
99
+ reject(err);
100
+ return;
101
+ }
102
+ resolve(data.toString());
103
+ });
104
+ })];
53
105
  });
54
106
  });
55
- }
56
- writeTextSync(path, data) {
107
+ };
108
+ RealFS.prototype.writeTextSync = function (path, data) {
57
109
  node_fs_1.default.writeFileSync(path.toString(), data);
58
- }
59
- readDirentsSync(path, options) {
110
+ };
111
+ RealFS.prototype.readDirentsSync = function (path, options) {
60
112
  return node_fs_1.default
61
113
  .readdirSync(path.toString(), {
62
114
  withFileTypes: true,
63
115
  recursive: options === null || options === void 0 ? void 0 : options.recursive,
64
116
  })
65
- .map((rawDirent) => new RealFSDirent(rawDirent));
66
- }
67
- }
117
+ .map(function (rawDirent) { return new RealFSDirent(rawDirent); });
118
+ };
119
+ return RealFS;
120
+ }(FileSystem_1.FS));
68
121
  exports.RealFS = RealFS;
package/dist/io/TarGz.js CHANGED
@@ -5,28 +5,25 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE-MIT file in the root directory of this source tree.
7
7
  */
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
8
  Object.defineProperty(exports, "__esModule", { value: true });
12
9
  exports.unpackTarGz = unpackTarGz;
13
- const node_fs_1 = __importDefault(require("node:fs"));
14
- const zlib_1 = __importDefault(require("zlib"));
15
- const tar_1 = __importDefault(require("tar"));
10
+ var node_fs_1 = require("node:fs");
11
+ var zlib_1 = require("zlib");
12
+ var tar_1 = require("tar");
16
13
  function unpackTarGz(archivePath, outputDirPath) {
17
14
  if (!node_fs_1.default.existsSync(outputDirPath.getValue())) {
18
15
  node_fs_1.default.mkdirSync(outputDirPath.getValue(), { recursive: true });
19
16
  }
20
- const readStream = node_fs_1.default.createReadStream(archivePath.getValue());
21
- const writeStream = tar_1.default.extract({
17
+ var readStream = node_fs_1.default.createReadStream(archivePath.getValue());
18
+ var writeStream = tar_1.default.extract({
22
19
  cwd: outputDirPath.getValue(),
23
20
  });
24
21
  readStream.pipe(zlib_1.default.createGunzip()).pipe(writeStream);
25
- return new Promise((resolve, reject) => {
26
- writeStream.on('finish', () => {
22
+ return new Promise(function (resolve, reject) {
23
+ writeStream.on('finish', function () {
27
24
  resolve(undefined);
28
25
  });
29
- writeStream.on('error', (err) => {
26
+ writeStream.on('error', function (err) {
30
27
  reject(err);
31
28
  });
32
29
  });