@react-native-oh/react-native-harmony-cli 0.77.33 → 0.77.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assetResolver.js +43 -74
- package/dist/autolinking/Autolinking.js +178 -179
- package/dist/codegen/core/CodegenError.js +3 -23
- package/dist/codegen/core/EventUtils.js +3 -3
- package/dist/codegen/core/TypeAnnotationToTS.js +24 -28
- package/dist/codegen/core/UberSchema.js +55 -97
- package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +28 -41
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +27 -34
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +25 -33
- package/dist/codegen/generators/CppComponentCodeGenerator.js +23 -28
- package/dist/codegen/generators/LibGlueCodeGenerator.js +26 -29
- package/dist/codegen/generators/NativeModuleCodeGenerator.js +25 -30
- package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
- package/dist/codegen/generators/UberGeneratorV1.js +24 -23
- package/dist/codegen/generators/UberGeneratorV2.js +34 -35
- package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +50 -24
- package/dist/codegen/templates/BasePackageHTemplate.js +120 -21
- package/dist/codegen/templates/ComponentDescriptorHTemplate.js +54 -8
- package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +75 -27
- package/dist/codegen/templates/ComponentUtilsTSTemplate.js +162 -29
- package/dist/codegen/templates/IndexTSTemplate.js +37 -17
- package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +119 -24
- package/dist/codegen/templates/TurboModuleCppTemplate.js +38 -15
- package/dist/codegen/templates/TurboModuleHTemplate.js +32 -11
- package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +52 -19
- package/dist/commands/bundle-harmony.js +118 -221
- package/dist/commands/clean-harmony.js +58 -63
- package/dist/commands/codegen-harmony.js +105 -165
- package/dist/commands/codegen-lib-harmony.js +76 -116
- package/dist/commands/init-harmony.js +151 -196
- package/dist/commands/init.js +537 -961
- package/dist/commands/link-harmony.js +35 -82
- package/dist/commands/run-harmony.js +372 -518
- package/dist/commands/verify-package-harmony.js +54 -117
- package/dist/core/AbsolutePath.js +33 -49
- package/dist/core/CodegenConfig.js +24 -22
- package/dist/core/DescriptiveError.js +18 -37
- package/dist/core/FileSystem.js +14 -18
- package/dist/core/OHPackageJSON5.js +17 -23
- package/dist/core/PackageJSON.js +26 -42
- package/dist/core/ProjectDependenciesManager.js +40 -92
- package/dist/core/ValidationError.js +2 -22
- package/dist/core/fs.js +10 -7
- package/dist/index.js +1 -1
- package/dist/init/templates/AppScopeAppJSON5Template.js +21 -8
- package/dist/init/templates/AppScopeStringVarTemplate.js +19 -8
- package/dist/init/templates/EntryIndexTemplate.js +56 -8
- package/dist/init/templates/EntryStringVarTemplate.js +27 -8
- package/dist/init/templates/HvigorConfigJson5Template.js +33 -8
- package/dist/init/templates/MetroConfigTemplate.js +38 -8
- package/dist/init/templates/OhPackageJson5Template.js +28 -8
- package/dist/init/templates/harmony/AppScope/app.json5 +10 -0
- package/dist/init/templates/harmony/AppScope/resources/base/element/string.json +8 -0
- package/dist/init/templates/harmony/AppScope/resources/base/media/app_icon.png +0 -0
- package/dist/init/templates/harmony/build-profile.json5 +36 -0
- package/dist/init/templates/harmony/codelinter.json +32 -0
- package/dist/init/templates/harmony/entry/build-profile.json5 +18 -0
- package/dist/init/templates/harmony/entry/gitignore +7 -0
- package/dist/init/templates/harmony/entry/hvigorfile.ts +13 -0
- package/dist/init/templates/harmony/entry/oh-package.json5 +9 -0
- package/dist/init/templates/harmony/entry/src/main/cpp/CMakeLists.txt +27 -0
- package/dist/init/templates/harmony/entry/src/main/cpp/PackageProvider.cpp +13 -0
- package/dist/init/templates/harmony/entry/src/main/cpp/gitignore +4 -0
- package/dist/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +8 -0
- package/dist/init/templates/harmony/entry/src/main/ets/codegen/gitignore +2 -0
- package/dist/init/templates/harmony/entry/src/main/ets/entryability/EntryAbility.ets +11 -0
- package/dist/init/templates/harmony/entry/src/main/ets/gitignore +1 -0
- package/dist/init/templates/harmony/entry/src/main/ets/pages/.gitkeep +0 -0
- package/dist/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +16 -0
- package/dist/init/templates/harmony/entry/src/main/module.json5 +65 -0
- package/dist/init/templates/harmony/entry/src/main/resources/base/element/color.json +8 -0
- package/dist/init/templates/harmony/entry/src/main/resources/base/element/string.json +16 -0
- package/dist/init/templates/harmony/entry/src/main/resources/base/media/background.png +0 -0
- package/dist/init/templates/harmony/entry/src/main/resources/base/media/foreground.png +0 -0
- package/dist/init/templates/harmony/entry/src/main/resources/base/media/layered_image.json +7 -0
- package/dist/init/templates/harmony/entry/src/main/resources/base/media/startIcon.png +0 -0
- package/dist/init/templates/harmony/entry/src/main/resources/base/profile/main_pages.json +5 -0
- package/dist/init/templates/harmony/entry/src/main/resources/gitignore +1 -0
- package/dist/init/templates/harmony/entry/src/ohosTest/ets/test/List.test.ets +2 -0
- package/dist/init/templates/harmony/entry/src/ohosTest/module.json5 +13 -0
- package/dist/init/templates/harmony/gitignore +16 -0
- package/dist/init/templates/harmony/hvigor/hvigor-config.json5 +22 -0
- package/dist/init/templates/harmony/hvigorfile.ts +7 -0
- package/dist/io/CliExecutor.js +46 -98
- package/dist/io/Logger.js +40 -46
- package/dist/io/RealFS.js +43 -100
- package/dist/io/TarGz.js +11 -8
- package/dist/io/__fixtures__.js +79 -141
- package/dist/io/fsUtils.js +13 -12
- package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +19 -47
- package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +13 -41
- package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +8 -38
- package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +22 -54
- package/dist/package-verifier/verify-package.js +56 -133
- package/dist/simulator/LaunchSimulator.js +224 -301
- package/harmony/rnoh-hvigor-plugin-0.77.40.tgz +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0271b9dd +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/07ba0208 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/082dd09d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0a9e1b0b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0c3d528a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1014d3ff +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1184678c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/12621366 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/126d3e66 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/19262852 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/203fac53 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/237b660a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2528002d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2587d041 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2893bd11 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2af6ff9d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2bf31f33 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/333648cc +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/386f6df0 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3b8c270e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3bcc34ba +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/444808bd +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/44a775e2 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/46da3ccd +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/51f80e35 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5203a2ca +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/52795646 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/577f8208 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5c2aafe7 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5c69bcfe +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/62695b92 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/62698102 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6411ab00 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6569ba92 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/65e5133c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/66029655 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/69e85d0d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6afcb99e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6de07367 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/72498307 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7babd1de +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7fe56d21 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/810cbd72 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/812386d2 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8448897d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/84ab0a41 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/853825e2 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/862ad93a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/86b14da6 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/87f0fe62 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/88ee8f74 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8c5237c9 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8c725800 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8e83cbe1 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8f4085b9 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/931f0b2e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/940c8f92 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/968191a3 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/970780c0 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/98bc4394 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/99a3b0b0 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/9c0ffa6b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/9d9b42c2 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a04266ef +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a18f78c5 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a642fb0e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a97edf40 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/aa672a20 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ae25c61a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b2bebae6 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ba492422 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/bd3e6c21 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/be9e564e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c342b18e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c3993e7e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c52ffd54 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c7079ad4 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c8eb01c1 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/caee5d30 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cf039161 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d0377c40 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d262bc85 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d287cb5c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d64bff57 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d716a608 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d751012b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e0873711 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e1fcf77b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e8548d8a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/eaedd71d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/eca0019e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f7189953 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f75cb201 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f888164b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/fdb9eb5a +0 -0
- package/package.json +1 -1
package/dist/io/Logger.js
CHANGED
|
@@ -1,54 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.Logger = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const cli_tools_1 = require("@react-native-community/cli-tools");
|
|
9
|
+
const node_process_1 = __importDefault(require("node:process"));
|
|
10
|
+
class Logger {
|
|
11
|
+
constructor() {
|
|
9
12
|
this.loader = (0, cli_tools_1.getLoader)({
|
|
10
13
|
interval: node_process_1.default.stdout.isTTY ? undefined : 0,
|
|
11
14
|
});
|
|
12
15
|
this.logger = cli_tools_1.logger;
|
|
13
16
|
this.isLoaderActive = false;
|
|
14
17
|
}
|
|
15
|
-
|
|
16
|
-
var _this = this;
|
|
18
|
+
start(prepareMsg) {
|
|
17
19
|
this.loader.start(prepareMsg(chalk_1.default));
|
|
18
20
|
this.isLoaderActive = true;
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
+
return (options) => {
|
|
22
|
+
this.isLoaderActive = false;
|
|
21
23
|
if (options === null || options === void 0 ? void 0 : options.persist) {
|
|
22
|
-
console.log({ loader:
|
|
23
|
-
|
|
24
|
+
console.log({ loader: this.loader });
|
|
25
|
+
this.loader.stopAndPersist();
|
|
24
26
|
}
|
|
25
27
|
else {
|
|
26
|
-
|
|
28
|
+
this.loader.stop();
|
|
27
29
|
}
|
|
28
30
|
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
_this.isLoaderActive ? _this.loader.info(msg) : _this.logger.info(msg);
|
|
31
|
+
}
|
|
32
|
+
info(prepareMsg) {
|
|
33
|
+
const info = (msg) => {
|
|
34
|
+
this.isLoaderActive ? this.loader.info(msg) : this.logger.info(msg);
|
|
34
35
|
};
|
|
35
36
|
info(prepareMsg(chalk_1.default));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var succeed = function (msg) {
|
|
40
|
-
return _this.isLoaderActive ? _this.loader.succeed(msg) : _this.logger.success(msg);
|
|
41
|
-
};
|
|
37
|
+
}
|
|
38
|
+
succeed(prepareMsg) {
|
|
39
|
+
const succeed = (msg) => this.isLoaderActive ? this.loader.succeed(msg) : this.logger.success(msg);
|
|
42
40
|
succeed(prepareMsg(chalk_1.default));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var warn = function (msg) {
|
|
47
|
-
return _this.isLoaderActive ? _this.loader.warn(msg) : _this.logger.warn(msg);
|
|
48
|
-
};
|
|
41
|
+
}
|
|
42
|
+
warn(prepareMsg) {
|
|
43
|
+
const warn = (msg) => this.isLoaderActive ? this.loader.warn(msg) : this.logger.warn(msg);
|
|
49
44
|
warn(prepareMsg(chalk_1.default));
|
|
50
|
-
}
|
|
51
|
-
|
|
45
|
+
}
|
|
46
|
+
debug(prepareMsg) {
|
|
52
47
|
if (this.isLoaderActive) {
|
|
53
48
|
clearLine(node_process_1.default.stdout);
|
|
54
49
|
moveCursor(node_process_1.default.stdout, 0);
|
|
@@ -58,27 +53,27 @@ var Logger = /** @class */ (function () {
|
|
|
58
53
|
else {
|
|
59
54
|
console.debug(prepareMsg(chalk_1.default));
|
|
60
55
|
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
}
|
|
57
|
+
descriptiveError(error) {
|
|
58
|
+
const lines = [];
|
|
64
59
|
if (error.isUnexpected() && error.stack) {
|
|
65
60
|
lines.push('');
|
|
66
61
|
lines.push(chalk_1.default.bold('Stack'));
|
|
67
|
-
error.stack.split('\n').forEach(
|
|
62
|
+
error.stack.split('\n').forEach((line) => lines.push(chalk_1.default.gray(line)));
|
|
68
63
|
}
|
|
69
|
-
|
|
64
|
+
const details = error.getDetails();
|
|
70
65
|
if (details) {
|
|
71
66
|
lines.push('');
|
|
72
67
|
lines.push(chalk_1.default.bold('Details'));
|
|
73
|
-
details.split('\n').forEach(
|
|
68
|
+
details.split('\n').forEach((line) => lines.push(line));
|
|
74
69
|
}
|
|
75
70
|
lines.push('');
|
|
76
|
-
lines.push(
|
|
77
|
-
|
|
71
|
+
lines.push(`${error.getMessage()}`);
|
|
72
|
+
const suggestions = error.getSuggestions();
|
|
78
73
|
if (suggestions.length > 0) {
|
|
79
74
|
lines.push('');
|
|
80
|
-
lines.push(chalk_1.default.bold(
|
|
81
|
-
suggestions.forEach(
|
|
75
|
+
lines.push(chalk_1.default.bold(`Suggestions`));
|
|
76
|
+
suggestions.forEach((suggestion) => {
|
|
82
77
|
lines.push('• ' + suggestion);
|
|
83
78
|
});
|
|
84
79
|
}
|
|
@@ -88,11 +83,10 @@ var Logger = /** @class */ (function () {
|
|
|
88
83
|
else {
|
|
89
84
|
this.logger.error(lines.join('\n').trim());
|
|
90
85
|
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
}());
|
|
86
|
+
}
|
|
87
|
+
}
|
|
94
88
|
exports.Logger = Logger;
|
|
95
|
-
|
|
89
|
+
const clearLine = (stream) => {
|
|
96
90
|
if (stream.clearLine) {
|
|
97
91
|
stream.clearLine(0);
|
|
98
92
|
}
|
|
@@ -100,7 +94,7 @@ var clearLine = function (stream) {
|
|
|
100
94
|
node_process_1.default.stdout.write('\r' + ' '.repeat(node_process_1.default.stdout.columns || 80) + '\r');
|
|
101
95
|
}
|
|
102
96
|
};
|
|
103
|
-
|
|
97
|
+
const moveCursor = (stream, x) => {
|
|
104
98
|
if (stream.cursorTo) {
|
|
105
99
|
stream.cursorTo(x);
|
|
106
100
|
}
|
package/dist/io/RealFS.js
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -23,107 +8,65 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
23
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
9
|
});
|
|
25
10
|
};
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
52
13
|
};
|
|
53
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
15
|
exports.RealFS = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
_this.nodeFSDirent = nodeFSDirent;
|
|
63
|
-
return _this;
|
|
16
|
+
const core_1 = require("../core");
|
|
17
|
+
const FileSystem_1 = require("../core/FileSystem");
|
|
18
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
19
|
+
class RealFSDirent extends FileSystem_1.Dirent {
|
|
20
|
+
constructor(nodeFSDirent) {
|
|
21
|
+
super();
|
|
22
|
+
this.nodeFSDirent = nodeFSDirent;
|
|
64
23
|
}
|
|
65
|
-
|
|
24
|
+
isDirectory() {
|
|
66
25
|
return this.nodeFSDirent.isDirectory();
|
|
67
|
-
}
|
|
68
|
-
|
|
26
|
+
}
|
|
27
|
+
isSymbolicLink() {
|
|
69
28
|
return this.nodeFSDirent.isSymbolicLink();
|
|
70
|
-
};
|
|
71
|
-
Object.defineProperty(RealFSDirent.prototype, "name", {
|
|
72
|
-
get: function () {
|
|
73
|
-
return this.nodeFSDirent.name;
|
|
74
|
-
},
|
|
75
|
-
enumerable: false,
|
|
76
|
-
configurable: true
|
|
77
|
-
});
|
|
78
|
-
Object.defineProperty(RealFSDirent.prototype, "path", {
|
|
79
|
-
get: function () {
|
|
80
|
-
return new core_1.AbsolutePath(this.nodeFSDirent.path).copyWithNewSegment(this.nodeFSDirent.name);
|
|
81
|
-
},
|
|
82
|
-
enumerable: false,
|
|
83
|
-
configurable: true
|
|
84
|
-
});
|
|
85
|
-
return RealFSDirent;
|
|
86
|
-
}(FileSystem_1.Dirent));
|
|
87
|
-
var RealFS = /** @class */ (function (_super) {
|
|
88
|
-
__extends(RealFS, _super);
|
|
89
|
-
function RealFS() {
|
|
90
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
91
29
|
}
|
|
92
|
-
|
|
30
|
+
get name() {
|
|
31
|
+
return this.nodeFSDirent.name;
|
|
32
|
+
}
|
|
33
|
+
get path() {
|
|
34
|
+
return new core_1.AbsolutePath(this.nodeFSDirent.path).copyWithNewSegment(this.nodeFSDirent.name);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
class RealFS extends FileSystem_1.FS {
|
|
38
|
+
existsSync(path) {
|
|
93
39
|
return node_fs_1.default.existsSync(path.toString());
|
|
94
|
-
}
|
|
95
|
-
|
|
40
|
+
}
|
|
41
|
+
readTextSync(path) {
|
|
96
42
|
return node_fs_1.default.readFileSync(path.toString()).toString();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
-
return
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
});
|
|
109
|
-
})];
|
|
43
|
+
}
|
|
44
|
+
readText(path) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
node_fs_1.default.readFile(path.toString(), undefined, (err, data) => {
|
|
48
|
+
if (err) {
|
|
49
|
+
reject(err);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
resolve(data.toString());
|
|
53
|
+
});
|
|
110
54
|
});
|
|
111
55
|
});
|
|
112
|
-
}
|
|
113
|
-
|
|
56
|
+
}
|
|
57
|
+
writeTextSync(path, data) {
|
|
114
58
|
node_fs_1.default.writeFileSync(path.toString(), data);
|
|
115
|
-
}
|
|
116
|
-
|
|
59
|
+
}
|
|
60
|
+
readDirentsSync(path, options) {
|
|
117
61
|
return node_fs_1.default
|
|
118
62
|
.readdirSync(path.toString(), {
|
|
119
63
|
withFileTypes: true,
|
|
120
64
|
recursive: options === null || options === void 0 ? void 0 : options.recursive,
|
|
121
65
|
})
|
|
122
|
-
.map(
|
|
123
|
-
}
|
|
124
|
-
|
|
66
|
+
.map((rawDirent) => new RealFSDirent(rawDirent));
|
|
67
|
+
}
|
|
68
|
+
renameSync(oldPath, newPath) {
|
|
125
69
|
node_fs_1.default.renameSync(oldPath.toString(), newPath.toString());
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
}(FileSystem_1.FS));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
129
72
|
exports.RealFS = RealFS;
|
package/dist/io/TarGz.js
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.unpackTarGz = unpackTarGz;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_zlib_1 = __importDefault(require("node:zlib"));
|
|
9
|
+
const tar_1 = __importDefault(require("tar"));
|
|
7
10
|
function unpackTarGz(archivePath, outputDirPath) {
|
|
8
11
|
if (!node_fs_1.default.existsSync(outputDirPath.getValue())) {
|
|
9
12
|
node_fs_1.default.mkdirSync(outputDirPath.getValue(), { recursive: true });
|
|
10
13
|
}
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
const readStream = node_fs_1.default.createReadStream(archivePath.getValue());
|
|
15
|
+
const writeStream = tar_1.default.extract({
|
|
13
16
|
cwd: outputDirPath.getValue(),
|
|
14
17
|
});
|
|
15
18
|
readStream.pipe(node_zlib_1.default.createGunzip()).pipe(writeStream);
|
|
16
|
-
return new Promise(
|
|
17
|
-
writeStream.on('finish',
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
writeStream.on('finish', () => {
|
|
18
21
|
resolve(undefined);
|
|
19
22
|
});
|
|
20
|
-
writeStream.on('error',
|
|
23
|
+
writeStream.on('error', (err) => {
|
|
21
24
|
reject(err);
|
|
22
25
|
});
|
|
23
26
|
});
|
package/dist/io/__fixtures__.js
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -23,167 +8,120 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
23
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
9
|
});
|
|
25
10
|
};
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
52
13
|
};
|
|
53
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
15
|
exports.MockedLogger = exports.MemFS = exports.FakeCliExecutor = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
FakeCliExecutor.prototype.run = function (command, options) {
|
|
70
|
-
var commandWithArgs = command;
|
|
16
|
+
const core_1 = require("../core");
|
|
17
|
+
const CliExecutor_1 = require("./CliExecutor");
|
|
18
|
+
const memfs_1 = require("memfs");
|
|
19
|
+
const Dirent_1 = __importDefault(require("memfs/lib/Dirent"));
|
|
20
|
+
const Logger_1 = require("./Logger");
|
|
21
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
22
|
+
class FakeCliExecutor extends CliExecutor_1.CliExecutor {
|
|
23
|
+
constructor(onRun) {
|
|
24
|
+
super();
|
|
25
|
+
this.onRun = onRun;
|
|
26
|
+
this.commands = [];
|
|
27
|
+
}
|
|
28
|
+
run(command, options) {
|
|
29
|
+
let commandWithArgs = command;
|
|
71
30
|
if (options.args) {
|
|
72
31
|
commandWithArgs += options.args.join(' ');
|
|
73
32
|
}
|
|
74
33
|
this.commands.push(commandWithArgs);
|
|
75
34
|
return this.onRun(commandWithArgs);
|
|
76
|
-
}
|
|
77
|
-
|
|
35
|
+
}
|
|
36
|
+
getCommands() {
|
|
78
37
|
return this.commands;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
}(CliExecutor_1.CliExecutor));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
82
40
|
exports.FakeCliExecutor = FakeCliExecutor;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
MemFSDirent.prototype.isDirectory = function () {
|
|
41
|
+
class MemFSDirent extends core_1.Dirent {
|
|
42
|
+
constructor(rawDirent) {
|
|
43
|
+
super();
|
|
44
|
+
this.rawDirent = rawDirent;
|
|
45
|
+
}
|
|
46
|
+
isDirectory() {
|
|
91
47
|
return this.rawDirent.isDirectory();
|
|
92
|
-
}
|
|
93
|
-
|
|
48
|
+
}
|
|
49
|
+
isSymbolicLink() {
|
|
94
50
|
return false;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
return MemFSDirent;
|
|
111
|
-
}(core_1.Dirent));
|
|
112
|
-
var MemFS = /** @class */ (function (_super) {
|
|
113
|
-
__extends(MemFS, _super);
|
|
114
|
-
function MemFS(initialFileStructure) {
|
|
115
|
-
var _this = _super.call(this) || this;
|
|
116
|
-
_this.fs = (0, memfs_1.memfs)(initialFileStructure, './').fs;
|
|
117
|
-
return _this;
|
|
118
|
-
}
|
|
119
|
-
MemFS.prototype.existsSync = function (path) {
|
|
51
|
+
}
|
|
52
|
+
get name() {
|
|
53
|
+
return this.rawDirent.name.toString();
|
|
54
|
+
}
|
|
55
|
+
get path() {
|
|
56
|
+
return new core_1.AbsolutePath(this.rawDirent.path).copyWithNewSegment(this.rawDirent.name.toString());
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
class MemFS extends core_1.FS {
|
|
60
|
+
constructor(initialFileStructure) {
|
|
61
|
+
super();
|
|
62
|
+
this.fs = (0, memfs_1.memfs)(initialFileStructure, './').fs;
|
|
63
|
+
}
|
|
64
|
+
existsSync(path) {
|
|
120
65
|
return this.fs.existsSync(path.toString());
|
|
121
|
-
}
|
|
122
|
-
|
|
66
|
+
}
|
|
67
|
+
readTextSync(path) {
|
|
123
68
|
return this.fs.readFileSync(path.toString()).toString();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
resolve((_a = data === null || data === void 0 ? void 0 : data.toString()) !== null && _a !== void 0 ? _a : '');
|
|
137
|
-
});
|
|
138
|
-
})];
|
|
69
|
+
}
|
|
70
|
+
readText(path) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
return new Promise((resolve, reject) => {
|
|
73
|
+
this.fs.readFile(path.toString(), {}, (err, data) => {
|
|
74
|
+
var _a;
|
|
75
|
+
if (err) {
|
|
76
|
+
reject(err);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
resolve((_a = data === null || data === void 0 ? void 0 : data.toString()) !== null && _a !== void 0 ? _a : '');
|
|
80
|
+
});
|
|
139
81
|
});
|
|
140
82
|
});
|
|
141
|
-
}
|
|
142
|
-
|
|
83
|
+
}
|
|
84
|
+
writeTextSync(path, data) {
|
|
143
85
|
return this.fs.writeFileSync(path.toString(), data);
|
|
144
|
-
}
|
|
145
|
-
|
|
86
|
+
}
|
|
87
|
+
readDirentsSync(path, options) {
|
|
146
88
|
return this.fs
|
|
147
89
|
.readdirSync(path.toString(), {
|
|
148
90
|
withFileTypes: true,
|
|
149
91
|
recursive: options === null || options === void 0 ? void 0 : options.recursive,
|
|
150
92
|
})
|
|
151
|
-
.flatMap(
|
|
93
|
+
.flatMap((dataOutOrDirent) => {
|
|
152
94
|
if (!(dataOutOrDirent instanceof Dirent_1.default)) {
|
|
153
95
|
return [];
|
|
154
96
|
}
|
|
155
97
|
return [new MemFSDirent(dataOutOrDirent)];
|
|
156
98
|
});
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
}(core_1.FS));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
160
101
|
exports.MemFS = MemFS;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
MockedLogger.prototype.debug = function (prepareMsg) {
|
|
102
|
+
class MockedLogger extends Logger_1.Logger {
|
|
103
|
+
constructor() {
|
|
104
|
+
super(...arguments);
|
|
105
|
+
this.logs = [];
|
|
106
|
+
}
|
|
107
|
+
debug(prepareMsg) {
|
|
169
108
|
chalk_1.default.level = 0;
|
|
170
109
|
this.logs.push({ type: 'debug', msg: prepareMsg(chalk_1.default) });
|
|
171
|
-
}
|
|
172
|
-
|
|
110
|
+
}
|
|
111
|
+
info(prepareMsg, options) {
|
|
173
112
|
chalk_1.default.level = 0;
|
|
174
113
|
this.logs.push({ type: 'info', msg: prepareMsg(chalk_1.default) });
|
|
175
|
-
}
|
|
176
|
-
|
|
114
|
+
}
|
|
115
|
+
warn(prepareMsg) {
|
|
177
116
|
chalk_1.default.level = 0;
|
|
178
117
|
this.logs.push({ type: 'warn', msg: prepareMsg(chalk_1.default) });
|
|
179
|
-
}
|
|
180
|
-
|
|
118
|
+
}
|
|
119
|
+
descriptiveError(error) {
|
|
181
120
|
chalk_1.default.level = 0;
|
|
182
121
|
this.logs.push({ type: 'error', msg: error.getMessage() });
|
|
183
|
-
}
|
|
184
|
-
|
|
122
|
+
}
|
|
123
|
+
getLogs() {
|
|
185
124
|
return this.logs;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
}(Logger_1.Logger));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
189
127
|
exports.MockedLogger = MockedLogger;
|
package/dist/io/fsUtils.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.findFilePathsWithExtensions = findFilePathsWithExtensions;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function findFilePathsWithExtensions(dirPath, fileExtensions, options) {
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const Dirent_1 = __importDefault(require("memfs/lib/Dirent"));
|
|
9
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
+
const node_fs_2 = require("node:fs");
|
|
11
|
+
function findFilePathsWithExtensions(dirPath, fileExtensions, options = {}) {
|
|
9
12
|
var _a;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
15
|
-
var file = files_1[_i];
|
|
13
|
+
const fs = ((_a = options === null || options === void 0 ? void 0 : options.fs) !== null && _a !== void 0 ? _a : node_fs_1.default);
|
|
14
|
+
let results = [];
|
|
15
|
+
const files = fs.readdirSync(dirPath.getValue(), { withFileTypes: true });
|
|
16
|
+
for (const file of files) {
|
|
16
17
|
if (!(file instanceof node_fs_2.Dirent) &&
|
|
17
18
|
!(file instanceof Dirent_1.default)) {
|
|
18
19
|
continue;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
const path = dirPath.copyWithNewSegment(file.name.toString());
|
|
21
22
|
if (fs.lstatSync(path.toString()).isDirectory()) {
|
|
22
23
|
results = results.concat(findFilePathsWithExtensions(path, fileExtensions, options));
|
|
23
24
|
}
|