@react-native-oh/react-native-harmony-cli 0.0.37 → 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.
- package/README.md +11 -11
- package/dist/assetResolver.js +74 -43
- package/dist/autolinking/Autolinking.js +183 -179
- package/dist/codegen/core/CodegenError.js +23 -3
- package/dist/codegen/core/EventUtils.js +3 -3
- package/dist/codegen/core/TypeAnnotationToTS.js +28 -24
- package/dist/codegen/core/UberSchema.js +96 -57
- package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +41 -28
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +34 -27
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +33 -25
- package/dist/codegen/generators/CppComponentCodeGenerator.js +28 -23
- package/dist/codegen/generators/LibGlueCodeGenerator.js +29 -26
- package/dist/codegen/generators/NativeModuleCodeGenerator.js +30 -25
- package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
- package/dist/codegen/generators/UberGeneratorV1.js +24 -18
- package/dist/codegen/generators/UberGeneratorV2.js +36 -28
- package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +24 -50
- package/dist/codegen/templates/BasePackageHTemplate.js +21 -120
- package/dist/codegen/templates/ComponentDescriptorHTemplate.js +8 -53
- package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +27 -75
- package/dist/codegen/templates/ComponentUtilsTSTemplate.js +29 -162
- package/dist/codegen/templates/IndexTSTemplate.js +17 -37
- package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +24 -119
- package/dist/codegen/templates/TurboModuleCppTemplate.js +15 -38
- package/dist/codegen/templates/TurboModuleHTemplate.js +11 -32
- package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +19 -52
- package/dist/commands/bundle-harmony.js +138 -53
- package/dist/commands/codegen-harmony.js +175 -104
- package/dist/commands/codegen-lib-harmony.js +116 -76
- package/dist/commands/create-metro-host-constants.js +47 -18
- package/dist/commands/init.js +961 -537
- package/dist/commands/link-harmony.js +71 -33
- package/dist/commands/pack-harmony.js +108 -47
- package/dist/commands/run-harmony.js +518 -374
- package/dist/commands/unpack-harmony.js +198 -105
- package/dist/commands/verify-package-harmony.js +108 -54
- package/dist/core/AbsolutePath.js +47 -31
- package/dist/core/CodegenConfig.js +22 -24
- package/dist/core/DescriptiveError.js +37 -18
- package/dist/core/FileSystem.js +18 -14
- package/dist/core/OHPackageJSON5.js +23 -17
- package/dist/core/PackageJSON.js +42 -26
- package/dist/core/ProjectDependenciesManager.js +96 -46
- package/dist/core/ValidationError.js +22 -2
- package/dist/core/fs.js +6 -9
- package/dist/index.js +1 -1
- package/dist/io/CliExecutor.js +98 -46
- package/dist/io/Logger.js +46 -40
- package/dist/io/RealFS.js +88 -35
- package/dist/io/TarGz.js +8 -11
- package/dist/io/__fixtures__.js +141 -79
- package/dist/io/fsUtils.js +12 -13
- package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +47 -19
- package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +41 -13
- package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +38 -8
- package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +54 -22
- package/dist/package-verifier/verify-package.js +132 -55
- package/dist/simulator/LaunchSimulator.js +301 -217
- package/jest.config.js +12 -12
- package/package.json +78 -70
- package/react-native.config.js +17 -17
- package/tsconfig.build.json +6 -6
- package/tsconfig.json +2 -2
- package/.prettierrc +0 -6
- package/src/assetResolver.ts +0 -134
- package/src/autolinking/Autolinking.test.ts +0 -483
- package/src/autolinking/Autolinking.ts +0 -382
- package/src/autolinking/index.ts +0 -8
- package/src/codegen/core/CodeGenerator.ts +0 -16
- package/src/codegen/core/CodegenError.ts +0 -10
- package/src/codegen/core/EventUtils.ts +0 -23
- package/src/codegen/core/TypeAnnotationToTS.test.ts +0 -82
- package/src/codegen/core/TypeAnnotationToTS.ts +0 -195
- package/src/codegen/core/UberSchema.ts +0 -152
- package/src/codegen/core/index.ts +0 -12
- package/src/codegen/generators/AppBuildTimeGlueCodeGenerator.ts +0 -124
- package/src/codegen/generators/ArkTSComponentCodeGeneratorArkTS.ts +0 -128
- package/src/codegen/generators/ArkTSComponentCodeGeneratorCAPI.ts +0 -122
- package/src/codegen/generators/CppComponentCodeGenerator.ts +0 -95
- package/src/codegen/generators/LibGlueCodeGenerator.ts +0 -98
- package/src/codegen/generators/NativeModuleCodeGenerator.ts +0 -124
- package/src/codegen/generators/SharedComponentCodeGenerator.ts +0 -57
- package/src/codegen/generators/UberGeneratorV1.ts +0 -75
- package/src/codegen/generators/UberGeneratorV2.ts +0 -114
- package/src/codegen/generators/index.ts +0 -15
- package/src/codegen/index.ts +0 -9
- package/src/codegen/templates/BaseComponentInstanceHTemplate.ts +0 -128
- package/src/codegen/templates/BasePackageHTemplate.ts +0 -159
- package/src/codegen/templates/ComponentDescriptorHTemplate.ts +0 -63
- package/src/codegen/templates/ComponentJSIBinderHTemplate.ts +0 -121
- package/src/codegen/templates/ComponentUtilsTSTemplate.ts +0 -222
- package/src/codegen/templates/IndexTSTemplate.ts +0 -62
- package/src/codegen/templates/RNOHGeneratedPackageHTemplate.ts +0 -150
- package/src/codegen/templates/TurboModuleCppTemplate.ts +0 -61
- package/src/codegen/templates/TurboModuleHTemplate.ts +0 -42
- package/src/codegen/templates/TurboModuleSpecTSTemplate.ts +0 -101
- package/src/codegen/templates/index.ts +0 -16
- package/src/commands/bundle-harmony.ts +0 -134
- package/src/commands/codegen-harmony.ts +0 -297
- package/src/commands/codegen-lib-harmony.ts +0 -389
- package/src/commands/create-metro-host-constants.ts +0 -55
- package/src/commands/index.ts +0 -16
- package/src/commands/init.ts +0 -755
- package/src/commands/link-harmony.ts +0 -102
- package/src/commands/pack-harmony.ts +0 -128
- package/src/commands/run-harmony.ts +0 -506
- package/src/commands/types.ts +0 -21
- package/src/commands/unpack-harmony.ts +0 -238
- package/src/commands/verify-package-harmony.ts +0 -113
- package/src/core/AbsolutePath.ts +0 -66
- package/src/core/CodegenConfig.ts +0 -67
- package/src/core/DescriptiveError.ts +0 -68
- package/src/core/FileSystem.ts +0 -57
- package/src/core/OHPackageJSON5.ts +0 -30
- package/src/core/PackageJSON.ts +0 -104
- package/src/core/ProjectDependenciesManager.ts +0 -103
- package/src/core/ValidationError.ts +0 -8
- package/src/core/ValueObject.ts +0 -9
- package/src/core/fs.ts +0 -38
- package/src/core/index.ts +0 -17
- package/src/index.ts +0 -33
- package/src/io/CliExecutor.ts +0 -69
- package/src/io/Logger.ts +0 -112
- package/src/io/RealFS.ts +0 -62
- package/src/io/TarGz.ts +0 -33
- package/src/io/__fixtures__.ts +0 -139
- package/src/io/fsUtils.ts +0 -44
- package/src/io/index.ts +0 -11
- package/src/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.ts +0 -35
- package/src/package-verifier/checks/HarmonyDirExistsCheck.ts +0 -31
- package/src/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.ts +0 -25
- package/src/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.ts +0 -54
- package/src/package-verifier/checks/index.ts +0 -11
- package/src/package-verifier/index.ts +0 -9
- package/src/package-verifier/types.ts +0 -19
- package/src/package-verifier/verify-package.ts +0 -123
- package/src/simulator/LaunchSimulator.ts +0 -352
- package/src/simulator/index.ts +0 -8
|
@@ -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
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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: [
|
|
25
|
+
whatCanUserDo: ["Verify path: ".concat(path.getValue())],
|
|
29
26
|
});
|
|
30
27
|
}
|
|
31
|
-
|
|
32
|
-
fileOrDirNames.forEach((fileOrDirName)
|
|
33
|
-
|
|
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
package/dist/io/CliExecutor.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,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
|
-
|
|
20
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
25
|
+
return function (options) {
|
|
26
|
+
_this.isLoaderActive = false;
|
|
29
27
|
if (options === null || options === void 0 ? void 0 : options.persist) {
|
|
30
|
-
console.log({ loader:
|
|
31
|
-
|
|
28
|
+
console.log({ loader: _this.loader });
|
|
29
|
+
_this.loader.stopAndPersist();
|
|
32
30
|
}
|
|
33
31
|
else {
|
|
34
|
-
|
|
32
|
+
_this.loader.stop();
|
|
35
33
|
}
|
|
36
34
|
};
|
|
37
|
-
}
|
|
38
|
-
info(prepareMsg) {
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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)
|
|
73
|
+
error.stack.split('\n').forEach(function (line) { return lines.push(chalk_1.default.gray(line)); });
|
|
69
74
|
}
|
|
70
|
-
|
|
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)
|
|
79
|
+
details.split('\n').forEach(function (line) { return lines.push(line); });
|
|
75
80
|
}
|
|
76
81
|
lines.push('');
|
|
77
|
-
lines.push(
|
|
78
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
18
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
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
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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)
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
21
|
-
|
|
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
|
});
|