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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/assetResolver.js +74 -43
  2. package/dist/autolinking/Autolinking.js +179 -178
  3. package/dist/codegen/core/CodegenError.js +23 -3
  4. package/dist/codegen/core/EventUtils.js +3 -3
  5. package/dist/codegen/core/TypeAnnotationToTS.js +28 -24
  6. package/dist/codegen/core/UberSchema.js +97 -55
  7. package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +41 -28
  8. package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +34 -27
  9. package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +33 -25
  10. package/dist/codegen/generators/CppComponentCodeGenerator.js +28 -23
  11. package/dist/codegen/generators/LibGlueCodeGenerator.js +29 -26
  12. package/dist/codegen/generators/NativeModuleCodeGenerator.js +30 -25
  13. package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
  14. package/dist/codegen/generators/UberGeneratorV1.js +24 -18
  15. package/dist/codegen/generators/UberGeneratorV2.js +36 -28
  16. package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +24 -50
  17. package/dist/codegen/templates/BasePackageHTemplate.js +21 -120
  18. package/dist/codegen/templates/ComponentDescriptorHTemplate.js +8 -54
  19. package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +27 -75
  20. package/dist/codegen/templates/ComponentUtilsTSTemplate.js +29 -162
  21. package/dist/codegen/templates/IndexTSTemplate.js +17 -37
  22. package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +24 -119
  23. package/dist/codegen/templates/TurboModuleCppTemplate.js +15 -38
  24. package/dist/codegen/templates/TurboModuleHTemplate.js +11 -32
  25. package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +19 -52
  26. package/dist/commands/bundle-harmony.js +221 -118
  27. package/dist/commands/clean-harmony.js +63 -58
  28. package/dist/commands/codegen-harmony.js +175 -104
  29. package/dist/commands/codegen-lib-harmony.js +116 -76
  30. package/dist/commands/init-harmony.js +196 -151
  31. package/dist/commands/init.js +961 -537
  32. package/dist/commands/link-harmony.js +82 -35
  33. package/dist/commands/run-harmony.js +520 -352
  34. package/dist/commands/verify-package-harmony.js +117 -54
  35. package/dist/core/AbsolutePath.js +49 -33
  36. package/dist/core/CodegenConfig.js +22 -24
  37. package/dist/core/DescriptiveError.js +37 -18
  38. package/dist/core/FileSystem.js +18 -14
  39. package/dist/core/OHPackageJSON5.js +23 -17
  40. package/dist/core/PackageJSON.js +42 -26
  41. package/dist/core/ProjectDependenciesManager.js +92 -40
  42. package/dist/core/ValidationError.js +22 -2
  43. package/dist/core/fs.js +7 -10
  44. package/dist/index.js +1 -1
  45. package/dist/init/templates/AppScopeAppJSON5Template.js +8 -21
  46. package/dist/init/templates/AppScopeStringVarTemplate.js +8 -19
  47. package/dist/init/templates/EntryIndexTemplate.js +8 -56
  48. package/dist/init/templates/EntryStringVarTemplate.js +8 -27
  49. package/dist/init/templates/HvigorConfigJson5Template.js +8 -33
  50. package/dist/init/templates/MetroConfigTemplate.js +8 -38
  51. package/dist/init/templates/OhPackageJson5Template.js +8 -28
  52. package/dist/io/CliExecutor.js +98 -46
  53. package/dist/io/Logger.js +46 -40
  54. package/dist/io/RealFS.js +100 -43
  55. package/dist/io/TarGz.js +8 -11
  56. package/dist/io/__fixtures__.js +141 -79
  57. package/dist/io/fsUtils.js +12 -13
  58. package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +47 -19
  59. package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +41 -13
  60. package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +38 -8
  61. package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +54 -22
  62. package/dist/package-verifier/verify-package.js +133 -56
  63. package/dist/simulator/LaunchSimulator.js +395 -0
  64. package/dist/simulator/index.js +23 -0
  65. package/package.json +2 -11
  66. package/scripts/sync-hvigor.js +27 -0
  67. package/src/autolinking/Autolinking.ts +1 -1
  68. package/src/codegen/generators/UberGeneratorV1.ts +7 -2
  69. package/src/codegen/generators/UberGeneratorV2.ts +6 -1
  70. package/src/commands/codegen-harmony.ts +17 -7
  71. package/src/commands/run-harmony.ts +67 -41
  72. package/src/init/templates/harmony/entry/src/main/module.json5 +7 -0
  73. package/src/simulator/LaunchSimulator.ts +359 -0
  74. package/src/simulator/index.ts +8 -0
  75. package/dist/init/templates/harmony/AppScope/app.json5 +0 -10
  76. package/dist/init/templates/harmony/AppScope/resources/base/element/string.json +0 -8
  77. package/dist/init/templates/harmony/AppScope/resources/base/media/app_icon.png +0 -0
  78. package/dist/init/templates/harmony/build-profile.json5 +0 -36
  79. package/dist/init/templates/harmony/codelinter.json +0 -32
  80. package/dist/init/templates/harmony/entry/build-profile.json5 +0 -18
  81. package/dist/init/templates/harmony/entry/gitignore +0 -7
  82. package/dist/init/templates/harmony/entry/hvigorfile.ts +0 -13
  83. package/dist/init/templates/harmony/entry/oh-package.json5 +0 -9
  84. package/dist/init/templates/harmony/entry/src/main/cpp/CMakeLists.txt +0 -27
  85. package/dist/init/templates/harmony/entry/src/main/cpp/PackageProvider.cpp +0 -13
  86. package/dist/init/templates/harmony/entry/src/main/cpp/gitignore +0 -4
  87. package/dist/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +0 -8
  88. package/dist/init/templates/harmony/entry/src/main/ets/codegen/gitignore +0 -2
  89. package/dist/init/templates/harmony/entry/src/main/ets/entryability/EntryAbility.ets +0 -11
  90. package/dist/init/templates/harmony/entry/src/main/ets/gitignore +0 -1
  91. package/dist/init/templates/harmony/entry/src/main/ets/pages/.gitkeep +0 -0
  92. package/dist/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +0 -16
  93. package/dist/init/templates/harmony/entry/src/main/module.json5 +0 -58
  94. package/dist/init/templates/harmony/entry/src/main/resources/base/element/color.json +0 -8
  95. package/dist/init/templates/harmony/entry/src/main/resources/base/element/string.json +0 -16
  96. package/dist/init/templates/harmony/entry/src/main/resources/base/media/background.png +0 -0
  97. package/dist/init/templates/harmony/entry/src/main/resources/base/media/foreground.png +0 -0
  98. package/dist/init/templates/harmony/entry/src/main/resources/base/media/layered_image.json +0 -7
  99. package/dist/init/templates/harmony/entry/src/main/resources/base/media/startIcon.png +0 -0
  100. package/dist/init/templates/harmony/entry/src/main/resources/base/profile/main_pages.json +0 -5
  101. package/dist/init/templates/harmony/entry/src/main/resources/gitignore +0 -1
  102. package/dist/init/templates/harmony/entry/src/ohosTest/ets/test/List.test.ets +0 -2
  103. package/dist/init/templates/harmony/entry/src/ohosTest/module.json5 +0 -13
  104. package/dist/init/templates/harmony/gitignore +0 -16
  105. package/dist/init/templates/harmony/hvigor/hvigor-config.json5 +0 -22
  106. package/dist/init/templates/harmony/hvigorfile.ts +0 -7
@@ -1,37 +1,17 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.OhPackageJson5Template = void 0;
7
- const mustache_1 = __importDefault(require("mustache"));
8
- const TEMPLATE = `
9
- {
10
- name: "example-name",
11
- description: "example description",
12
- version: "1.0.0",
13
- modelVersion: "5.0.0",
14
- license: "ISC",
15
- repository: {},
16
- dependencies: {
17
- "@rnoh/react-native-openharmony": "file:../node_modules/{{{rnohNpmPackageName}}}/react_native_openharmony.har",
18
- },
19
- devDependencies: {
20
- "@ohos/hypium": "1.0.6",
21
- },
22
- overrides: {
23
- "@rnoh/react-native-openharmony": "file:../node_modules/{{{rnohNpmPackageName}}}/react_native_openharmony.har",
24
- },
25
- }
26
- `;
27
- class OhPackageJson5Template {
28
- constructor(rnohNpmPackageName) {
4
+ var mustache_1 = require("mustache");
5
+ var TEMPLATE = "\n{\n name: \"example-name\",\n description: \"example description\",\n version: \"1.0.0\",\n modelVersion: \"5.0.0\",\n license: \"ISC\",\n repository: {},\n dependencies: {\n \"@rnoh/react-native-openharmony\": \"file:../node_modules/{{{rnohNpmPackageName}}}/react_native_openharmony.har\",\n },\n devDependencies: {\n \"@ohos/hypium\": \"1.0.6\",\n },\n overrides: {\n \"@rnoh/react-native-openharmony\": \"file:../node_modules/{{{rnohNpmPackageName}}}/react_native_openharmony.har\",\n },\n}\n";
6
+ var OhPackageJson5Template = /** @class */ (function () {
7
+ function OhPackageJson5Template(rnohNpmPackageName) {
29
8
  this.rnohNpmPackageName = rnohNpmPackageName;
30
9
  }
31
- build() {
10
+ OhPackageJson5Template.prototype.build = function () {
32
11
  return mustache_1.default.render(TEMPLATE.trimStart(), {
33
12
  rnohNpmPackageName: this.rnohNpmPackageName,
34
13
  });
35
- }
36
- }
14
+ };
15
+ return OhPackageJson5Template;
16
+ }());
37
17
  exports.OhPackageJson5Template = OhPackageJson5Template;
@@ -1,4 +1,19 @@
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
+ })();
2
17
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
18
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
19
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,55 +23,92 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
23
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
24
  });
10
25
  };
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
+ }
52
+ };
11
53
  Object.defineProperty(exports, "__esModule", { value: true });
12
54
  exports.RealCliExecutor = exports.CliExecutor = void 0;
13
- const node_child_process_1 = require("node:child_process");
14
- class CliExecutor {
15
- }
55
+ var node_child_process_1 = require("node:child_process");
56
+ var CliExecutor = /** @class */ (function () {
57
+ function CliExecutor() {
58
+ }
59
+ return CliExecutor;
60
+ }());
16
61
  exports.CliExecutor = CliExecutor;
17
- class RealCliExecutor extends CliExecutor {
18
- run(command, options) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- return new Promise((resolve, reject) => {
21
- var _a, _b;
22
- let commandWithArgs = command;
23
- let argStrings = [];
24
- if (options === null || options === void 0 ? void 0 : options.args) {
25
- argStrings = options.args;
26
- commandWithArgs += ' ' + argStrings.join(' ');
27
- }
28
- (_a = options === null || options === void 0 ? void 0 : options.onArgsStringified) === null || _a === void 0 ? void 0 : _a.call(options, commandWithArgs);
29
- const process = (0, node_child_process_1.spawn)(command, argStrings, {
30
- cwd: (_b = options === null || options === void 0 ? void 0 : options.cwd) === null || _b === void 0 ? void 0 : _b.toString(),
31
- shell: (options === null || options === void 0 ? void 0 : options.shell) ? true : false,
32
- });
33
- let stdout = '';
34
- let stderr = '';
35
- process.stdout.on('data', (data) => {
36
- var _a;
37
- const output = data.toString();
38
- stdout += output;
39
- (_a = options === null || options === void 0 ? void 0 : options.onStdout) === null || _a === void 0 ? void 0 : _a.call(options, output);
40
- });
41
- process.stderr.on('data', (data) => {
42
- var _a;
43
- const output = data.toString();
44
- stderr += output;
45
- (_a = options === null || options === void 0 ? void 0 : options.onStderr) === null || _a === void 0 ? void 0 : _a.call(options, output);
46
- });
47
- process.on('error', (error) => {
48
- reject(error);
49
- });
50
- process.on('close', (code) => {
51
- if (code === 0) {
52
- resolve(stdout);
53
- }
54
- else {
55
- reject(new Error(`Command failed with code ${code}\nStderr: ${stderr}`));
56
- }
57
- });
62
+ var RealCliExecutor = /** @class */ (function (_super) {
63
+ __extends(RealCliExecutor, _super);
64
+ function RealCliExecutor() {
65
+ return _super !== null && _super.apply(this, arguments) || this;
66
+ }
67
+ RealCliExecutor.prototype.run = function (command, options) {
68
+ return __awaiter(this, void 0, void 0, function () {
69
+ return __generator(this, function (_a) {
70
+ return [2 /*return*/, new Promise(function (resolve, reject) {
71
+ var _a, _b;
72
+ var commandWithArgs = command;
73
+ var argStrings = [];
74
+ if (options === null || options === void 0 ? void 0 : options.args) {
75
+ argStrings = options.args;
76
+ commandWithArgs += ' ' + argStrings.join(' ');
77
+ }
78
+ (_a = options === null || options === void 0 ? void 0 : options.onArgsStringified) === null || _a === void 0 ? void 0 : _a.call(options, commandWithArgs);
79
+ var process = (0, node_child_process_1.spawn)(command, argStrings, {
80
+ cwd: (_b = options === null || options === void 0 ? void 0 : options.cwd) === null || _b === void 0 ? void 0 : _b.toString(),
81
+ shell: (options === null || options === void 0 ? void 0 : options.shell) ? true : false,
82
+ });
83
+ var stdout = '';
84
+ var stderr = '';
85
+ process.stdout.on('data', function (data) {
86
+ var _a;
87
+ var output = data.toString();
88
+ stdout += output;
89
+ (_a = options === null || options === void 0 ? void 0 : options.onStdout) === null || _a === void 0 ? void 0 : _a.call(options, output);
90
+ });
91
+ process.stderr.on('data', function (data) {
92
+ var _a;
93
+ var output = data.toString();
94
+ stderr += output;
95
+ (_a = options === null || options === void 0 ? void 0 : options.onStderr) === null || _a === void 0 ? void 0 : _a.call(options, output);
96
+ });
97
+ process.on('error', function (error) {
98
+ reject(error);
99
+ });
100
+ process.on('close', function (code) {
101
+ if (code === 0) {
102
+ resolve(stdout);
103
+ }
104
+ else {
105
+ reject(new Error("Command failed with code ".concat(code, "\nStderr: ").concat(stderr)));
106
+ }
107
+ });
108
+ })];
58
109
  });
59
110
  });
60
- }
61
- }
111
+ };
112
+ return RealCliExecutor;
113
+ }(CliExecutor));
62
114
  exports.RealCliExecutor = RealCliExecutor;
package/dist/io/Logger.js CHANGED
@@ -1,49 +1,54 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.Logger = void 0;
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() {
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() {
12
9
  this.loader = (0, cli_tools_1.getLoader)({
13
10
  interval: node_process_1.default.stdout.isTTY ? undefined : 0,
14
11
  });
15
12
  this.logger = cli_tools_1.logger;
16
13
  this.isLoaderActive = false;
17
14
  }
18
- start(prepareMsg) {
15
+ Logger.prototype.start = function (prepareMsg) {
16
+ var _this = this;
19
17
  this.loader.start(prepareMsg(chalk_1.default));
20
18
  this.isLoaderActive = true;
21
- return (options) => {
22
- this.isLoaderActive = false;
19
+ return function (options) {
20
+ _this.isLoaderActive = false;
23
21
  if (options === null || options === void 0 ? void 0 : options.persist) {
24
- console.log({ loader: this.loader });
25
- this.loader.stopAndPersist();
22
+ console.log({ loader: _this.loader });
23
+ _this.loader.stopAndPersist();
26
24
  }
27
25
  else {
28
- this.loader.stop();
26
+ _this.loader.stop();
29
27
  }
30
28
  };
31
- }
32
- info(prepareMsg) {
33
- const info = (msg) => {
34
- this.isLoaderActive ? this.loader.info(msg) : this.logger.info(msg);
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);
35
34
  };
36
35
  info(prepareMsg(chalk_1.default));
37
- }
38
- succeed(prepareMsg) {
39
- const succeed = (msg) => this.isLoaderActive ? this.loader.succeed(msg) : this.logger.success(msg);
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
+ };
40
42
  succeed(prepareMsg(chalk_1.default));
41
- }
42
- warn(prepareMsg) {
43
- const warn = (msg) => this.isLoaderActive ? this.loader.warn(msg) : this.logger.warn(msg);
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
+ };
44
49
  warn(prepareMsg(chalk_1.default));
45
- }
46
- debug(prepareMsg) {
50
+ };
51
+ Logger.prototype.debug = function (prepareMsg) {
47
52
  if (this.isLoaderActive) {
48
53
  clearLine(node_process_1.default.stdout);
49
54
  moveCursor(node_process_1.default.stdout, 0);
@@ -53,27 +58,27 @@ class Logger {
53
58
  else {
54
59
  console.debug(prepareMsg(chalk_1.default));
55
60
  }
56
- }
57
- descriptiveError(error) {
58
- const lines = [];
61
+ };
62
+ Logger.prototype.descriptiveError = function (error) {
63
+ var lines = [];
59
64
  if (error.isUnexpected() && error.stack) {
60
65
  lines.push('');
61
66
  lines.push(chalk_1.default.bold('Stack'));
62
- error.stack.split('\n').forEach((line) => lines.push(chalk_1.default.gray(line)));
67
+ error.stack.split('\n').forEach(function (line) { return lines.push(chalk_1.default.gray(line)); });
63
68
  }
64
- const details = error.getDetails();
69
+ var details = error.getDetails();
65
70
  if (details) {
66
71
  lines.push('');
67
72
  lines.push(chalk_1.default.bold('Details'));
68
- details.split('\n').forEach((line) => lines.push(line));
73
+ details.split('\n').forEach(function (line) { return lines.push(line); });
69
74
  }
70
75
  lines.push('');
71
- lines.push(`${error.getMessage()}`);
72
- const suggestions = error.getSuggestions();
76
+ lines.push("".concat(error.getMessage()));
77
+ var suggestions = error.getSuggestions();
73
78
  if (suggestions.length > 0) {
74
79
  lines.push('');
75
- lines.push(chalk_1.default.bold(`Suggestions`));
76
- suggestions.forEach((suggestion) => {
80
+ lines.push(chalk_1.default.bold("Suggestions"));
81
+ suggestions.forEach(function (suggestion) {
77
82
  lines.push('• ' + suggestion);
78
83
  });
79
84
  }
@@ -83,10 +88,11 @@ class Logger {
83
88
  else {
84
89
  this.logger.error(lines.join('\n').trim());
85
90
  }
86
- }
87
- }
91
+ };
92
+ return Logger;
93
+ }());
88
94
  exports.Logger = Logger;
89
- const clearLine = (stream) => {
95
+ var clearLine = function (stream) {
90
96
  if (stream.clearLine) {
91
97
  stream.clearLine(0);
92
98
  }
@@ -94,7 +100,7 @@ const clearLine = (stream) => {
94
100
  node_process_1.default.stdout.write('\r' + ' '.repeat(node_process_1.default.stdout.columns || 80) + '\r');
95
101
  }
96
102
  };
97
- const moveCursor = (stream, x) => {
103
+ var moveCursor = function (stream, x) {
98
104
  if (stream.cursorTo) {
99
105
  stream.cursorTo(x);
100
106
  }
package/dist/io/RealFS.js CHANGED
@@ -1,4 +1,19 @@
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
+ })();
2
17
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
18
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
19
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,65 +23,107 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
23
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
24
  });
10
25
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
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
+ }
13
52
  };
14
53
  Object.defineProperty(exports, "__esModule", { value: true });
15
54
  exports.RealFS = void 0;
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;
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;
23
64
  }
24
- isDirectory() {
65
+ RealFSDirent.prototype.isDirectory = function () {
25
66
  return this.nodeFSDirent.isDirectory();
26
- }
27
- isSymbolicLink() {
67
+ };
68
+ RealFSDirent.prototype.isSymbolicLink = function () {
28
69
  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;
29
91
  }
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) {
92
+ RealFS.prototype.existsSync = function (path) {
39
93
  return node_fs_1.default.existsSync(path.toString());
40
- }
41
- readTextSync(path) {
94
+ };
95
+ RealFS.prototype.readTextSync = function (path) {
42
96
  return node_fs_1.default.readFileSync(path.toString()).toString();
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
- });
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
+ })];
54
110
  });
55
111
  });
56
- }
57
- writeTextSync(path, data) {
112
+ };
113
+ RealFS.prototype.writeTextSync = function (path, data) {
58
114
  node_fs_1.default.writeFileSync(path.toString(), data);
59
- }
60
- readDirentsSync(path, options) {
115
+ };
116
+ RealFS.prototype.readDirentsSync = function (path, options) {
61
117
  return node_fs_1.default
62
118
  .readdirSync(path.toString(), {
63
119
  withFileTypes: true,
64
120
  recursive: options === null || options === void 0 ? void 0 : options.recursive,
65
121
  })
66
- .map((rawDirent) => new RealFSDirent(rawDirent));
67
- }
68
- renameSync(oldPath, newPath) {
122
+ .map(function (rawDirent) { return new RealFSDirent(rawDirent); });
123
+ };
124
+ RealFS.prototype.renameSync = function (oldPath, newPath) {
69
125
  node_fs_1.default.renameSync(oldPath.toString(), newPath.toString());
70
- }
71
- }
126
+ };
127
+ return RealFS;
128
+ }(FileSystem_1.FS));
72
129
  exports.RealFS = RealFS;
package/dist/io/TarGz.js CHANGED
@@ -1,26 +1,23 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.unpackTarGz = unpackTarGz;
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"));
4
+ var node_fs_1 = require("node:fs");
5
+ var node_zlib_1 = require("node:zlib");
6
+ var tar_1 = require("tar");
10
7
  function unpackTarGz(archivePath, outputDirPath) {
11
8
  if (!node_fs_1.default.existsSync(outputDirPath.getValue())) {
12
9
  node_fs_1.default.mkdirSync(outputDirPath.getValue(), { recursive: true });
13
10
  }
14
- const readStream = node_fs_1.default.createReadStream(archivePath.getValue());
15
- const writeStream = tar_1.default.extract({
11
+ var readStream = node_fs_1.default.createReadStream(archivePath.getValue());
12
+ var writeStream = tar_1.default.extract({
16
13
  cwd: outputDirPath.getValue(),
17
14
  });
18
15
  readStream.pipe(node_zlib_1.default.createGunzip()).pipe(writeStream);
19
- return new Promise((resolve, reject) => {
20
- writeStream.on('finish', () => {
16
+ return new Promise(function (resolve, reject) {
17
+ writeStream.on('finish', function () {
21
18
  resolve(undefined);
22
19
  });
23
- writeStream.on('error', (err) => {
20
+ writeStream.on('error', function (err) {
24
21
  reject(err);
25
22
  });
26
23
  });