@react-native-oh/react-native-harmony-cli 0.0.40 → 0.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +11 -11
  2. package/dist/assetResolver.js +43 -74
  3. package/dist/autolinking/Autolinking.js +178 -179
  4. package/dist/codegen/core/CodegenError.js +3 -23
  5. package/dist/codegen/core/EventUtils.js +3 -3
  6. package/dist/codegen/core/TypeAnnotationToTS.js +24 -28
  7. package/dist/codegen/core/UberSchema.js +57 -96
  8. package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +28 -41
  9. package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +27 -34
  10. package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +25 -33
  11. package/dist/codegen/generators/CppComponentCodeGenerator.js +23 -28
  12. package/dist/codegen/generators/LibGlueCodeGenerator.js +26 -29
  13. package/dist/codegen/generators/NativeModuleCodeGenerator.js +25 -30
  14. package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
  15. package/dist/codegen/generators/UberGeneratorV1.js +24 -23
  16. package/dist/codegen/generators/UberGeneratorV2.js +34 -35
  17. package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +50 -24
  18. package/dist/codegen/templates/BasePackageHTemplate.js +120 -21
  19. package/dist/codegen/templates/ComponentDescriptorHTemplate.js +53 -8
  20. package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +75 -27
  21. package/dist/codegen/templates/ComponentUtilsTSTemplate.js +162 -29
  22. package/dist/codegen/templates/IndexTSTemplate.js +37 -17
  23. package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +119 -24
  24. package/dist/codegen/templates/TurboModuleCppTemplate.js +38 -15
  25. package/dist/codegen/templates/TurboModuleHTemplate.js +32 -11
  26. package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +52 -19
  27. package/dist/commands/bundle-harmony.js +53 -138
  28. package/dist/commands/codegen-harmony.js +105 -165
  29. package/dist/commands/codegen-lib-harmony.js +76 -116
  30. package/dist/commands/create-metro-host-constants.js +18 -47
  31. package/dist/commands/init.js +537 -961
  32. package/dist/commands/link-harmony.js +33 -71
  33. package/dist/commands/pack-harmony.js +47 -108
  34. package/dist/commands/run-harmony.js +372 -518
  35. package/dist/commands/unpack-harmony.js +105 -198
  36. package/dist/commands/verify-package-harmony.js +54 -108
  37. package/dist/core/AbsolutePath.js +31 -47
  38. package/dist/core/CodegenConfig.js +24 -22
  39. package/dist/core/DescriptiveError.js +18 -37
  40. package/dist/core/FileSystem.js +14 -18
  41. package/dist/core/OHPackageJSON5.js +17 -23
  42. package/dist/core/PackageJSON.js +26 -42
  43. package/dist/core/ProjectDependenciesManager.js +40 -92
  44. package/dist/core/ValidationError.js +2 -22
  45. package/dist/core/fs.js +9 -6
  46. package/dist/index.js +1 -1
  47. package/dist/io/CliExecutor.js +46 -98
  48. package/dist/io/Logger.js +40 -46
  49. package/dist/io/RealFS.js +35 -88
  50. package/dist/io/TarGz.js +11 -8
  51. package/dist/io/__fixtures__.js +79 -141
  52. package/dist/io/fsUtils.js +13 -12
  53. package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +19 -47
  54. package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +13 -41
  55. package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +8 -38
  56. package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +22 -54
  57. package/dist/package-verifier/verify-package.js +55 -132
  58. package/dist/simulator/LaunchSimulator.js +224 -301
  59. package/harmony/rnoh-hvigor-plugin-0.3.0.tgz +0 -0
  60. package/jest.config.js +12 -12
  61. package/package.json +78 -78
  62. package/react-native.config.js +17 -17
  63. package/tsconfig.build.json +6 -6
  64. package/tsconfig.json +2 -2
@@ -5,21 +5,6 @@
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
- })();
23
8
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
24
9
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
25
10
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -29,167 +14,120 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
29
14
  step((generator = generator.apply(thisArg, _arguments || [])).next());
30
15
  });
31
16
  };
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
- }
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
58
19
  };
59
20
  Object.defineProperty(exports, "__esModule", { value: true });
60
21
  exports.MockedLogger = exports.MemFS = exports.FakeCliExecutor = void 0;
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;
22
+ const core_1 = require("../core");
23
+ const CliExecutor_1 = require("./CliExecutor");
24
+ const memfs_1 = require("memfs");
25
+ const Dirent_1 = __importDefault(require("memfs/lib/Dirent"));
26
+ const Logger_1 = require("./Logger");
27
+ const chalk_1 = __importDefault(require("chalk"));
28
+ class FakeCliExecutor extends CliExecutor_1.CliExecutor {
29
+ constructor(onRun) {
30
+ super();
31
+ this.onRun = onRun;
32
+ this.commands = [];
33
+ }
34
+ run(command, options) {
35
+ let commandWithArgs = command;
77
36
  if (options.args) {
78
37
  commandWithArgs += options.args.join(' ');
79
38
  }
80
39
  this.commands.push(commandWithArgs);
81
40
  return this.onRun(commandWithArgs);
82
- };
83
- FakeCliExecutor.prototype.getCommands = function () {
41
+ }
42
+ getCommands() {
84
43
  return this.commands;
85
- };
86
- return FakeCliExecutor;
87
- }(CliExecutor_1.CliExecutor));
44
+ }
45
+ }
88
46
  exports.FakeCliExecutor = FakeCliExecutor;
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 () {
47
+ class MemFSDirent extends core_1.Dirent {
48
+ constructor(rawDirent) {
49
+ super();
50
+ this.rawDirent = rawDirent;
51
+ }
52
+ isDirectory() {
97
53
  return this.rawDirent.isDirectory();
98
- };
99
- MemFSDirent.prototype.isSymbolicLink = function () {
54
+ }
55
+ isSymbolicLink() {
100
56
  return false;
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) {
57
+ }
58
+ get name() {
59
+ return this.rawDirent.name.toString();
60
+ }
61
+ get path() {
62
+ return new core_1.AbsolutePath(this.rawDirent.path).copyWithNewSegment(this.rawDirent.name.toString());
63
+ }
64
+ }
65
+ class MemFS extends core_1.FS {
66
+ constructor(initialFileStructure) {
67
+ super();
68
+ this.fs = (0, memfs_1.memfs)(initialFileStructure, './').fs;
69
+ }
70
+ existsSync(path) {
126
71
  return this.fs.existsSync(path.toString());
127
- };
128
- MemFS.prototype.readTextSync = function (path) {
72
+ }
73
+ readTextSync(path) {
129
74
  return this.fs.readFileSync(path.toString()).toString();
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
- })];
75
+ }
76
+ readText(path) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ return new Promise((resolve, reject) => {
79
+ this.fs.readFile(path.toString(), {}, (err, data) => {
80
+ var _a;
81
+ if (err) {
82
+ reject(err);
83
+ return;
84
+ }
85
+ resolve((_a = data === null || data === void 0 ? void 0 : data.toString()) !== null && _a !== void 0 ? _a : '');
86
+ });
145
87
  });
146
88
  });
147
- };
148
- MemFS.prototype.writeTextSync = function (path, data) {
89
+ }
90
+ writeTextSync(path, data) {
149
91
  return this.fs.writeFileSync(path.toString(), data);
150
- };
151
- MemFS.prototype.readDirentsSync = function (path, options) {
92
+ }
93
+ readDirentsSync(path, options) {
152
94
  return this.fs
153
95
  .readdirSync(path.toString(), {
154
96
  withFileTypes: true,
155
97
  recursive: options === null || options === void 0 ? void 0 : options.recursive,
156
98
  })
157
- .flatMap(function (dataOutOrDirent) {
99
+ .flatMap((dataOutOrDirent) => {
158
100
  if (!(dataOutOrDirent instanceof Dirent_1.default)) {
159
101
  return [];
160
102
  }
161
103
  return [new MemFSDirent(dataOutOrDirent)];
162
104
  });
163
- };
164
- return MemFS;
165
- }(core_1.FS));
105
+ }
106
+ }
166
107
  exports.MemFS = MemFS;
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) {
108
+ class MockedLogger extends Logger_1.Logger {
109
+ constructor() {
110
+ super(...arguments);
111
+ this.logs = [];
112
+ }
113
+ debug(prepareMsg) {
175
114
  chalk_1.default.level = 0;
176
115
  this.logs.push({ type: 'debug', msg: prepareMsg(chalk_1.default) });
177
- };
178
- MockedLogger.prototype.info = function (prepareMsg, options) {
116
+ }
117
+ info(prepareMsg, options) {
179
118
  chalk_1.default.level = 0;
180
119
  this.logs.push({ type: 'info', msg: prepareMsg(chalk_1.default) });
181
- };
182
- MockedLogger.prototype.warn = function (prepareMsg) {
120
+ }
121
+ warn(prepareMsg) {
183
122
  chalk_1.default.level = 0;
184
123
  this.logs.push({ type: 'warn', msg: prepareMsg(chalk_1.default) });
185
- };
186
- MockedLogger.prototype.descriptiveError = function (error) {
124
+ }
125
+ descriptiveError(error) {
187
126
  chalk_1.default.level = 0;
188
127
  this.logs.push({ type: 'error', msg: error.getMessage() });
189
- };
190
- MockedLogger.prototype.getLogs = function () {
128
+ }
129
+ getLogs() {
191
130
  return this.logs;
192
- };
193
- return MockedLogger;
194
- }(Logger_1.Logger));
131
+ }
132
+ }
195
133
  exports.MockedLogger = MockedLogger;
@@ -5,25 +5,26 @@
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
+ };
8
11
  Object.defineProperty(exports, "__esModule", { value: true });
9
12
  exports.findFilePathsWithExtensions = findFilePathsWithExtensions;
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) {
13
+ const node_path_1 = __importDefault(require("node:path"));
14
+ const Dirent_1 = __importDefault(require("memfs/lib/Dirent"));
15
+ const node_fs_1 = __importDefault(require("node:fs"));
16
+ const node_fs_2 = require("node:fs");
17
+ function findFilePathsWithExtensions(dirPath, fileExtensions, options = {}) {
15
18
  var _a;
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];
19
+ const fs = ((_a = options === null || options === void 0 ? void 0 : options.fs) !== null && _a !== void 0 ? _a : node_fs_1.default);
20
+ let results = [];
21
+ const files = fs.readdirSync(dirPath.getValue(), { withFileTypes: true });
22
+ for (const file of files) {
22
23
  if (!(file instanceof node_fs_2.Dirent) &&
23
24
  !(file instanceof Dirent_1.default)) {
24
25
  continue;
25
26
  }
26
- var path = dirPath.copyWithNewSegment(file.name.toString());
27
+ const path = dirPath.copyWithNewSegment(file.name.toString());
27
28
  if (fs.lstatSync(path.toString()).isDirectory()) {
28
29
  results = results.concat(findFilePathsWithExtensions(path, fileExtensions, options));
29
30
  }
@@ -14,58 +14,30 @@ 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
- }
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
43
19
  };
44
20
  Object.defineProperty(exports, "__esModule", { value: true });
45
21
  exports.createHarmonyDirContainsOnlyHarsCheck = createHarmonyDirContainsOnlyHarsCheck;
46
- var node_fs_1 = require("node:fs");
22
+ const node_fs_1 = __importDefault(require("node:fs"));
47
23
  function createHarmonyDirContainsOnlyHarsCheck(npmPackagePath, hasNpmPackageNativeCode) {
48
- var _this = this;
49
24
  return {
50
25
  checkIf: 'harmony_directory_contains_only_one_har_file',
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
- }); },
26
+ run: () => __awaiter(this, void 0, void 0, function* () {
27
+ if (!hasNpmPackageNativeCode) {
28
+ return 'skip';
29
+ }
30
+ const harmonyPath = npmPackagePath
31
+ .copyWithNewSegment('harmony')
32
+ .getValue();
33
+ const fileOrDirNames = node_fs_1.default.readdirSync(harmonyPath);
34
+ if (fileOrDirNames.length !== 1) {
35
+ return { status: 'fail', message: JSON.stringify(fileOrDirNames) };
36
+ }
37
+ if (!fileOrDirNames[0].endsWith('.har')) {
38
+ return 'fail';
39
+ }
40
+ return 'pass';
41
+ }),
70
42
  };
71
43
  }
@@ -14,52 +14,24 @@ 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
- }
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
43
19
  };
44
20
  Object.defineProperty(exports, "__esModule", { value: true });
45
21
  exports.createHarmonyDirExistsCheck = createHarmonyDirExistsCheck;
46
- var node_fs_1 = require("node:fs");
22
+ const node_fs_1 = __importDefault(require("node:fs"));
47
23
  function createHarmonyDirExistsCheck(packagePath, hasNativeCode) {
48
- var _this = this;
49
24
  return {
50
25
  checkIf: 'package_has_harmony_dir',
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
- }); },
26
+ run: () => __awaiter(this, void 0, void 0, function* () {
27
+ const harmonyDirExist = node_fs_1.default.existsSync(packagePath.copyWithNewSegment('harmony').getValue());
28
+ if (!hasNativeCode) {
29
+ return 'skip';
30
+ }
31
+ if (!harmonyDirExist) {
32
+ return 'fail';
33
+ }
34
+ return 'pass';
35
+ }),
64
36
  };
65
37
  }
@@ -14,48 +14,18 @@ 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
- };
44
17
  Object.defineProperty(exports, "__esModule", { value: true });
45
18
  exports.createNpmAndOhPackageVersionsAreEqualCheck = createNpmAndOhPackageVersionsAreEqualCheck;
46
19
  function createNpmAndOhPackageVersionsAreEqualCheck(npmPackageVersion, ohPackageVersion) {
47
- var _this = this;
48
20
  return {
49
21
  checkIf: 'npm_and_oh_package_versions_are_equal',
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
- }); },
22
+ run: () => __awaiter(this, void 0, void 0, function* () {
23
+ return npmPackageVersion === ohPackageVersion
24
+ ? 'pass'
25
+ : {
26
+ status: 'fail',
27
+ message: `expected OH package version (${ohPackageVersion}) to match NPM version (${npmPackageVersion})`,
28
+ };
29
+ }),
60
30
  };
61
31
  }
@@ -14,69 +14,37 @@ 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
- };
44
17
  Object.defineProperty(exports, "__esModule", { value: true });
45
18
  exports.createOhPackageNameFollowsNamingConventionCheck = createOhPackageNameFollowsNamingConventionCheck;
46
19
  function createOhPackageNameFollowsNamingConventionCheck(npmPackageName, ohPackageName) {
47
- var _this = this;
48
- var npmPackageNameInfo = getPackageNameInfo(npmPackageName);
20
+ const npmPackageNameInfo = getPackageNameInfo(npmPackageName);
49
21
  return {
50
22
  checkIf: 'oh_package_name_is_derived_from_npm_package_name',
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
- }); },
23
+ run: () => __awaiter(this, void 0, void 0, function* () {
24
+ if (npmPackageNameInfo.organizationName) {
25
+ const expectedOHPackageName = `@rnoh/${npmPackageNameInfo.organizationName}--${npmPackageNameInfo.unscopedName}`;
26
+ return expectedOHPackageName === ohPackageName
27
+ ? 'pass'
28
+ : {
29
+ status: 'fail',
30
+ message: `expected '${expectedOHPackageName}', got: ${ohPackageName}`,
31
+ };
32
+ }
33
+ else {
34
+ const expectedOHPackageName = `@rnoh/${npmPackageNameInfo.unscopedName}`;
35
+ return expectedOHPackageName === ohPackageName
36
+ ? 'pass'
37
+ : {
38
+ status: 'fail',
39
+ message: `expected '${expectedOHPackageName}', got: ${ohPackageName}`,
40
+ };
41
+ }
42
+ }),
75
43
  };
76
44
  }
77
45
  function getPackageNameInfo(packageName) {
78
46
  if (packageName.startsWith('@') && packageName.includes('/')) {
79
- var _a = packageName.split('/'), part1 = _a[0], part2 = _a[1];
47
+ const [part1, part2] = packageName.split('/');
80
48
  return {
81
49
  organizationName: part1.replace('@', ''),
82
50
  unscopedName: part2,