@react-native-oh/react-native-harmony-cli 0.0.36 → 0.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +42 -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 -109
- 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 -108
- 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 +520 -352
- 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 +395 -0
- package/dist/simulator/index.js +23 -0
- 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 -120
- 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 -147
- 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 -138
- 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 -478
- 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/dist/io/__fixtures__.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,120 +29,167 @@ 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.MockedLogger = exports.MemFS = exports.FakeCliExecutor = void 0;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
61
|
+
var core_1 = require("../core");
|
|
62
|
+
var CliExecutor_1 = require("./CliExecutor");
|
|
63
|
+
var memfs_1 = require("memfs");
|
|
64
|
+
var Dirent_1 = require("memfs/lib/Dirent");
|
|
65
|
+
var Logger_1 = require("./Logger");
|
|
66
|
+
var chalk_1 = require("chalk");
|
|
67
|
+
var FakeCliExecutor = /** @class */ (function (_super) {
|
|
68
|
+
__extends(FakeCliExecutor, _super);
|
|
69
|
+
function FakeCliExecutor(onRun) {
|
|
70
|
+
var _this = _super.call(this) || this;
|
|
71
|
+
_this.onRun = onRun;
|
|
72
|
+
_this.commands = [];
|
|
73
|
+
return _this;
|
|
74
|
+
}
|
|
75
|
+
FakeCliExecutor.prototype.run = function (command, options) {
|
|
76
|
+
var commandWithArgs = command;
|
|
36
77
|
if (options.args) {
|
|
37
78
|
commandWithArgs += options.args.join(' ');
|
|
38
79
|
}
|
|
39
80
|
this.commands.push(commandWithArgs);
|
|
40
81
|
return this.onRun(commandWithArgs);
|
|
41
|
-
}
|
|
42
|
-
getCommands() {
|
|
82
|
+
};
|
|
83
|
+
FakeCliExecutor.prototype.getCommands = function () {
|
|
43
84
|
return this.commands;
|
|
44
|
-
}
|
|
45
|
-
|
|
85
|
+
};
|
|
86
|
+
return FakeCliExecutor;
|
|
87
|
+
}(CliExecutor_1.CliExecutor));
|
|
46
88
|
exports.FakeCliExecutor = FakeCliExecutor;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
89
|
+
var MemFSDirent = /** @class */ (function (_super) {
|
|
90
|
+
__extends(MemFSDirent, _super);
|
|
91
|
+
function MemFSDirent(rawDirent) {
|
|
92
|
+
var _this = _super.call(this) || this;
|
|
93
|
+
_this.rawDirent = rawDirent;
|
|
94
|
+
return _this;
|
|
95
|
+
}
|
|
96
|
+
MemFSDirent.prototype.isDirectory = function () {
|
|
53
97
|
return this.rawDirent.isDirectory();
|
|
54
|
-
}
|
|
55
|
-
isSymbolicLink() {
|
|
98
|
+
};
|
|
99
|
+
MemFSDirent.prototype.isSymbolicLink = function () {
|
|
56
100
|
return false;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
101
|
+
};
|
|
102
|
+
Object.defineProperty(MemFSDirent.prototype, "name", {
|
|
103
|
+
get: function () {
|
|
104
|
+
return this.rawDirent.name.toString();
|
|
105
|
+
},
|
|
106
|
+
enumerable: false,
|
|
107
|
+
configurable: true
|
|
108
|
+
});
|
|
109
|
+
Object.defineProperty(MemFSDirent.prototype, "path", {
|
|
110
|
+
get: function () {
|
|
111
|
+
return new core_1.AbsolutePath(this.rawDirent.path).copyWithNewSegment(this.rawDirent.name.toString());
|
|
112
|
+
},
|
|
113
|
+
enumerable: false,
|
|
114
|
+
configurable: true
|
|
115
|
+
});
|
|
116
|
+
return MemFSDirent;
|
|
117
|
+
}(core_1.Dirent));
|
|
118
|
+
var MemFS = /** @class */ (function (_super) {
|
|
119
|
+
__extends(MemFS, _super);
|
|
120
|
+
function MemFS(initialFileStructure) {
|
|
121
|
+
var _this = _super.call(this) || this;
|
|
122
|
+
_this.fs = (0, memfs_1.memfs)(initialFileStructure, './').fs;
|
|
123
|
+
return _this;
|
|
124
|
+
}
|
|
125
|
+
MemFS.prototype.existsSync = function (path) {
|
|
71
126
|
return this.fs.existsSync(path.toString());
|
|
72
|
-
}
|
|
73
|
-
readTextSync(path) {
|
|
127
|
+
};
|
|
128
|
+
MemFS.prototype.readTextSync = function (path) {
|
|
74
129
|
return this.fs.readFileSync(path.toString()).toString();
|
|
75
|
-
}
|
|
76
|
-
readText(path) {
|
|
77
|
-
return __awaiter(this, void 0, void 0, function
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
130
|
+
};
|
|
131
|
+
MemFS.prototype.readText = function (path) {
|
|
132
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133
|
+
var _this = this;
|
|
134
|
+
return __generator(this, function (_a) {
|
|
135
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
136
|
+
_this.fs.readFile(path.toString(), {}, function (err, data) {
|
|
137
|
+
var _a;
|
|
138
|
+
if (err) {
|
|
139
|
+
reject(err);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
resolve((_a = data === null || data === void 0 ? void 0 : data.toString()) !== null && _a !== void 0 ? _a : '');
|
|
143
|
+
});
|
|
144
|
+
})];
|
|
87
145
|
});
|
|
88
146
|
});
|
|
89
|
-
}
|
|
90
|
-
writeTextSync(path, data) {
|
|
147
|
+
};
|
|
148
|
+
MemFS.prototype.writeTextSync = function (path, data) {
|
|
91
149
|
return this.fs.writeFileSync(path.toString(), data);
|
|
92
|
-
}
|
|
93
|
-
readDirentsSync(path, options) {
|
|
150
|
+
};
|
|
151
|
+
MemFS.prototype.readDirentsSync = function (path, options) {
|
|
94
152
|
return this.fs
|
|
95
153
|
.readdirSync(path.toString(), {
|
|
96
154
|
withFileTypes: true,
|
|
97
155
|
recursive: options === null || options === void 0 ? void 0 : options.recursive,
|
|
98
156
|
})
|
|
99
|
-
.flatMap((dataOutOrDirent)
|
|
157
|
+
.flatMap(function (dataOutOrDirent) {
|
|
100
158
|
if (!(dataOutOrDirent instanceof Dirent_1.default)) {
|
|
101
159
|
return [];
|
|
102
160
|
}
|
|
103
161
|
return [new MemFSDirent(dataOutOrDirent)];
|
|
104
162
|
});
|
|
105
|
-
}
|
|
106
|
-
|
|
163
|
+
};
|
|
164
|
+
return MemFS;
|
|
165
|
+
}(core_1.FS));
|
|
107
166
|
exports.MemFS = MemFS;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
167
|
+
var MockedLogger = /** @class */ (function (_super) {
|
|
168
|
+
__extends(MockedLogger, _super);
|
|
169
|
+
function MockedLogger() {
|
|
170
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
171
|
+
_this.logs = [];
|
|
172
|
+
return _this;
|
|
173
|
+
}
|
|
174
|
+
MockedLogger.prototype.debug = function (prepareMsg) {
|
|
114
175
|
chalk_1.default.level = 0;
|
|
115
176
|
this.logs.push({ type: 'debug', msg: prepareMsg(chalk_1.default) });
|
|
116
|
-
}
|
|
117
|
-
info(prepareMsg, options) {
|
|
177
|
+
};
|
|
178
|
+
MockedLogger.prototype.info = function (prepareMsg, options) {
|
|
118
179
|
chalk_1.default.level = 0;
|
|
119
180
|
this.logs.push({ type: 'info', msg: prepareMsg(chalk_1.default) });
|
|
120
|
-
}
|
|
121
|
-
warn(prepareMsg) {
|
|
181
|
+
};
|
|
182
|
+
MockedLogger.prototype.warn = function (prepareMsg) {
|
|
122
183
|
chalk_1.default.level = 0;
|
|
123
184
|
this.logs.push({ type: 'warn', msg: prepareMsg(chalk_1.default) });
|
|
124
|
-
}
|
|
125
|
-
descriptiveError(error) {
|
|
185
|
+
};
|
|
186
|
+
MockedLogger.prototype.descriptiveError = function (error) {
|
|
126
187
|
chalk_1.default.level = 0;
|
|
127
188
|
this.logs.push({ type: 'error', msg: error.getMessage() });
|
|
128
|
-
}
|
|
129
|
-
getLogs() {
|
|
189
|
+
};
|
|
190
|
+
MockedLogger.prototype.getLogs = function () {
|
|
130
191
|
return this.logs;
|
|
131
|
-
}
|
|
132
|
-
|
|
192
|
+
};
|
|
193
|
+
return MockedLogger;
|
|
194
|
+
}(Logger_1.Logger));
|
|
133
195
|
exports.MockedLogger = MockedLogger;
|
package/dist/io/fsUtils.js
CHANGED
|
@@ -5,26 +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.findFilePathsWithExtensions = findFilePathsWithExtensions;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function findFilePathsWithExtensions(dirPath, fileExtensions, options
|
|
10
|
+
var node_path_1 = require("node:path");
|
|
11
|
+
var Dirent_1 = require("memfs/lib/Dirent");
|
|
12
|
+
var node_fs_1 = require("node:fs");
|
|
13
|
+
var node_fs_2 = require("node:fs");
|
|
14
|
+
function findFilePathsWithExtensions(dirPath, fileExtensions, options) {
|
|
18
15
|
var _a;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
if (options === void 0) { options = {}; }
|
|
17
|
+
var fs = ((_a = options === null || options === void 0 ? void 0 : options.fs) !== null && _a !== void 0 ? _a : node_fs_1.default);
|
|
18
|
+
var results = [];
|
|
19
|
+
var files = fs.readdirSync(dirPath.getValue(), { withFileTypes: true });
|
|
20
|
+
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
21
|
+
var file = files_1[_i];
|
|
23
22
|
if (!(file instanceof node_fs_2.Dirent) &&
|
|
24
23
|
!(file instanceof Dirent_1.default)) {
|
|
25
24
|
continue;
|
|
26
25
|
}
|
|
27
|
-
|
|
26
|
+
var path = dirPath.copyWithNewSegment(file.name.toString());
|
|
28
27
|
if (fs.lstatSync(path.toString()).isDirectory()) {
|
|
29
28
|
results = results.concat(findFilePathsWithExtensions(path, fileExtensions, options));
|
|
30
29
|
}
|
|
@@ -14,30 +14,58 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
|
|
17
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
18
|
+
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);
|
|
19
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
20
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
21
|
+
function step(op) {
|
|
22
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
23
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
24
|
+
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;
|
|
25
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
26
|
+
switch (op[0]) {
|
|
27
|
+
case 0: case 1: t = op; break;
|
|
28
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
29
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
30
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
31
|
+
default:
|
|
32
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
33
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
34
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
35
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
36
|
+
if (t[2]) _.ops.pop();
|
|
37
|
+
_.trys.pop(); continue;
|
|
38
|
+
}
|
|
39
|
+
op = body.call(thisArg, _);
|
|
40
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
41
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
42
|
+
}
|
|
19
43
|
};
|
|
20
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
45
|
exports.createHarmonyDirContainsOnlyHarsCheck = createHarmonyDirContainsOnlyHarsCheck;
|
|
22
|
-
|
|
46
|
+
var node_fs_1 = require("node:fs");
|
|
23
47
|
function createHarmonyDirContainsOnlyHarsCheck(npmPackagePath, hasNpmPackageNativeCode) {
|
|
48
|
+
var _this = this;
|
|
24
49
|
return {
|
|
25
50
|
checkIf: 'harmony_directory_contains_only_one_har_file',
|
|
26
|
-
run: ()
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
run: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
52
|
+
var harmonyPath, fileOrDirNames;
|
|
53
|
+
return __generator(this, function (_a) {
|
|
54
|
+
if (!hasNpmPackageNativeCode) {
|
|
55
|
+
return [2 /*return*/, 'skip'];
|
|
56
|
+
}
|
|
57
|
+
harmonyPath = npmPackagePath
|
|
58
|
+
.copyWithNewSegment('harmony')
|
|
59
|
+
.getValue();
|
|
60
|
+
fileOrDirNames = node_fs_1.default.readdirSync(harmonyPath);
|
|
61
|
+
if (fileOrDirNames.length !== 1) {
|
|
62
|
+
return [2 /*return*/, { status: 'fail', message: JSON.stringify(fileOrDirNames) }];
|
|
63
|
+
}
|
|
64
|
+
if (!fileOrDirNames[0].endsWith('.har')) {
|
|
65
|
+
return [2 /*return*/, 'fail'];
|
|
66
|
+
}
|
|
67
|
+
return [2 /*return*/, 'pass'];
|
|
68
|
+
});
|
|
69
|
+
}); },
|
|
42
70
|
};
|
|
43
71
|
}
|
|
@@ -14,24 +14,52 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
|
|
17
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
18
|
+
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);
|
|
19
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
20
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
21
|
+
function step(op) {
|
|
22
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
23
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
24
|
+
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;
|
|
25
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
26
|
+
switch (op[0]) {
|
|
27
|
+
case 0: case 1: t = op; break;
|
|
28
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
29
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
30
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
31
|
+
default:
|
|
32
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
33
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
34
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
35
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
36
|
+
if (t[2]) _.ops.pop();
|
|
37
|
+
_.trys.pop(); continue;
|
|
38
|
+
}
|
|
39
|
+
op = body.call(thisArg, _);
|
|
40
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
41
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
42
|
+
}
|
|
19
43
|
};
|
|
20
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
45
|
exports.createHarmonyDirExistsCheck = createHarmonyDirExistsCheck;
|
|
22
|
-
|
|
46
|
+
var node_fs_1 = require("node:fs");
|
|
23
47
|
function createHarmonyDirExistsCheck(packagePath, hasNativeCode) {
|
|
48
|
+
var _this = this;
|
|
24
49
|
return {
|
|
25
50
|
checkIf: 'package_has_harmony_dir',
|
|
26
|
-
run: ()
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
51
|
+
run: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
52
|
+
var harmonyDirExist;
|
|
53
|
+
return __generator(this, function (_a) {
|
|
54
|
+
harmonyDirExist = node_fs_1.default.existsSync(packagePath.copyWithNewSegment('harmony').getValue());
|
|
55
|
+
if (!hasNativeCode) {
|
|
56
|
+
return [2 /*return*/, 'skip'];
|
|
57
|
+
}
|
|
58
|
+
if (!harmonyDirExist) {
|
|
59
|
+
return [2 /*return*/, 'fail'];
|
|
60
|
+
}
|
|
61
|
+
return [2 /*return*/, 'pass'];
|
|
62
|
+
});
|
|
63
|
+
}); },
|
|
36
64
|
};
|
|
37
65
|
}
|
|
@@ -14,18 +14,48 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
18
|
+
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);
|
|
19
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
20
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
21
|
+
function step(op) {
|
|
22
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
23
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
24
|
+
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;
|
|
25
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
26
|
+
switch (op[0]) {
|
|
27
|
+
case 0: case 1: t = op; break;
|
|
28
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
29
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
30
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
31
|
+
default:
|
|
32
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
33
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
34
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
35
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
36
|
+
if (t[2]) _.ops.pop();
|
|
37
|
+
_.trys.pop(); continue;
|
|
38
|
+
}
|
|
39
|
+
op = body.call(thisArg, _);
|
|
40
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
41
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
42
|
+
}
|
|
43
|
+
};
|
|
17
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
45
|
exports.createNpmAndOhPackageVersionsAreEqualCheck = createNpmAndOhPackageVersionsAreEqualCheck;
|
|
19
46
|
function createNpmAndOhPackageVersionsAreEqualCheck(npmPackageVersion, ohPackageVersion) {
|
|
47
|
+
var _this = this;
|
|
20
48
|
return {
|
|
21
49
|
checkIf: 'npm_and_oh_package_versions_are_equal',
|
|
22
|
-
run: ()
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
50
|
+
run: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
return [2 /*return*/, npmPackageVersion === ohPackageVersion
|
|
53
|
+
? 'pass'
|
|
54
|
+
: {
|
|
55
|
+
status: 'fail',
|
|
56
|
+
message: "expected OH package version (".concat(ohPackageVersion, ") to match NPM version (").concat(npmPackageVersion, ")"),
|
|
57
|
+
}];
|
|
58
|
+
});
|
|
59
|
+
}); },
|
|
30
60
|
};
|
|
31
61
|
}
|
|
@@ -14,37 +14,69 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
18
|
+
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);
|
|
19
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
20
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
21
|
+
function step(op) {
|
|
22
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
23
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
24
|
+
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;
|
|
25
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
26
|
+
switch (op[0]) {
|
|
27
|
+
case 0: case 1: t = op; break;
|
|
28
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
29
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
30
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
31
|
+
default:
|
|
32
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
33
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
34
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
35
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
36
|
+
if (t[2]) _.ops.pop();
|
|
37
|
+
_.trys.pop(); continue;
|
|
38
|
+
}
|
|
39
|
+
op = body.call(thisArg, _);
|
|
40
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
41
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
42
|
+
}
|
|
43
|
+
};
|
|
17
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
45
|
exports.createOhPackageNameFollowsNamingConventionCheck = createOhPackageNameFollowsNamingConventionCheck;
|
|
19
46
|
function createOhPackageNameFollowsNamingConventionCheck(npmPackageName, ohPackageName) {
|
|
20
|
-
|
|
47
|
+
var _this = this;
|
|
48
|
+
var npmPackageNameInfo = getPackageNameInfo(npmPackageName);
|
|
21
49
|
return {
|
|
22
50
|
checkIf: 'oh_package_name_is_derived_from_npm_package_name',
|
|
23
|
-
run: ()
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
run: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
52
|
+
var expectedOHPackageName, expectedOHPackageName;
|
|
53
|
+
return __generator(this, function (_a) {
|
|
54
|
+
if (npmPackageNameInfo.organizationName) {
|
|
55
|
+
expectedOHPackageName = "@rnoh/".concat(npmPackageNameInfo.organizationName, "--").concat(npmPackageNameInfo.unscopedName);
|
|
56
|
+
return [2 /*return*/, expectedOHPackageName === ohPackageName
|
|
57
|
+
? 'pass'
|
|
58
|
+
: {
|
|
59
|
+
status: 'fail',
|
|
60
|
+
message: "expected '".concat(expectedOHPackageName, "', got: ").concat(ohPackageName),
|
|
61
|
+
}];
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
expectedOHPackageName = "@rnoh/".concat(npmPackageNameInfo.unscopedName);
|
|
65
|
+
return [2 /*return*/, expectedOHPackageName === ohPackageName
|
|
66
|
+
? 'pass'
|
|
67
|
+
: {
|
|
68
|
+
status: 'fail',
|
|
69
|
+
message: "expected '".concat(expectedOHPackageName, "', got: ").concat(ohPackageName),
|
|
70
|
+
}];
|
|
71
|
+
}
|
|
72
|
+
return [2 /*return*/];
|
|
73
|
+
});
|
|
74
|
+
}); },
|
|
43
75
|
};
|
|
44
76
|
}
|
|
45
77
|
function getPackageNameInfo(packageName) {
|
|
46
78
|
if (packageName.startsWith('@') && packageName.includes('/')) {
|
|
47
|
-
|
|
79
|
+
var _a = packageName.split('/'), part1 = _a[0], part2 = _a[1];
|
|
48
80
|
return {
|
|
49
81
|
organizationName: part1.replace('@', ''),
|
|
50
82
|
unscopedName: part2,
|