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

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 (65) hide show
  1. package/README.md +11 -11
  2. package/dist/assetResolver.js +74 -77
  3. package/dist/autolinking/Autolinking.js +179 -179
  4. package/dist/autolinking/JSON5Writer.js +61 -0
  5. package/dist/codegen/core/CodegenError.js +3 -23
  6. package/dist/codegen/core/EventUtils.js +3 -3
  7. package/dist/codegen/core/TypeAnnotationToTS.js +24 -28
  8. package/dist/codegen/core/UberSchema.js +57 -96
  9. package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +28 -41
  10. package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +27 -34
  11. package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +25 -33
  12. package/dist/codegen/generators/CppComponentCodeGenerator.js +23 -28
  13. package/dist/codegen/generators/LibGlueCodeGenerator.js +26 -29
  14. package/dist/codegen/generators/NativeModuleCodeGenerator.js +25 -30
  15. package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
  16. package/dist/codegen/generators/UberGeneratorV1.js +24 -23
  17. package/dist/codegen/generators/UberGeneratorV2.js +34 -35
  18. package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +50 -24
  19. package/dist/codegen/templates/BasePackageHTemplate.js +120 -21
  20. package/dist/codegen/templates/ComponentDescriptorHTemplate.js +53 -8
  21. package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +75 -27
  22. package/dist/codegen/templates/ComponentUtilsTSTemplate.js +162 -29
  23. package/dist/codegen/templates/IndexTSTemplate.js +37 -17
  24. package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +119 -24
  25. package/dist/codegen/templates/TurboModuleCppTemplate.js +38 -15
  26. package/dist/codegen/templates/TurboModuleHTemplate.js +32 -11
  27. package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +52 -19
  28. package/dist/commands/bundle-harmony.js +65 -138
  29. package/dist/commands/codegen-harmony.js +105 -165
  30. package/dist/commands/codegen-lib-harmony.js +76 -116
  31. package/dist/commands/create-metro-host-constants.js +18 -47
  32. package/dist/commands/init.js +537 -961
  33. package/dist/commands/link-harmony.js +33 -71
  34. package/dist/commands/pack-harmony.js +47 -108
  35. package/dist/commands/run-harmony.js +372 -518
  36. package/dist/commands/unpack-harmony.js +105 -198
  37. package/dist/commands/verify-package-harmony.js +54 -108
  38. package/dist/core/AbsolutePath.js +31 -47
  39. package/dist/core/CodegenConfig.js +24 -22
  40. package/dist/core/DescriptiveError.js +18 -37
  41. package/dist/core/FileSystem.js +14 -18
  42. package/dist/core/OHPackageJSON5.js +17 -23
  43. package/dist/core/PackageJSON.js +26 -42
  44. package/dist/core/ProjectDependenciesManager.js +40 -92
  45. package/dist/core/ValidationError.js +2 -22
  46. package/dist/core/fs.js +9 -6
  47. package/dist/index.js +1 -1
  48. package/dist/io/CliExecutor.js +46 -98
  49. package/dist/io/Logger.js +40 -46
  50. package/dist/io/RealFS.js +35 -88
  51. package/dist/io/TarGz.js +11 -8
  52. package/dist/io/__fixtures__.js +79 -141
  53. package/dist/io/fsUtils.js +13 -12
  54. package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +19 -47
  55. package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +13 -41
  56. package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +8 -38
  57. package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +22 -54
  58. package/dist/package-verifier/verify-package.js +55 -132
  59. package/dist/simulator/LaunchSimulator.js +224 -301
  60. package/harmony/rnoh-hvigor-plugin-0.3.0.tgz +0 -0
  61. package/jest.config.js +12 -12
  62. package/package.json +79 -78
  63. package/react-native.config.js +17 -17
  64. package/tsconfig.build.json +6 -6
  65. package/tsconfig.json +2 -2
@@ -14,57 +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
- }
43
- };
44
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
45
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
46
- if (ar || !(i in from)) {
47
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
48
- ar[i] = from[i];
49
- }
50
- }
51
- return to.concat(ar || Array.prototype.slice.call(from));
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
52
19
  };
53
20
  Object.defineProperty(exports, "__esModule", { value: true });
54
21
  exports.commandRunHarmony = void 0;
55
- var core_1 = require("../core");
56
- var io_1 = require("../io");
57
- var CliExecutor_1 = require("../io/CliExecutor");
58
- var fs_extra_1 = require("fs-extra");
59
- var node_crypto_1 = require("node:crypto");
60
- var json5_1 = require("json5");
61
- var inquirer_1 = require("inquirer");
62
- var path_1 = require("path");
63
- var cli_tools_1 = require("@react-native-community/cli-tools");
64
- var simulator_1 = require("../simulator");
65
- var COMMAND_NAME = 'run-harmony';
66
- var LOOPBACK_IP = '127.0.0.1';
67
- var DEFAULT_SIMULATOR_NAME = "".concat(LOOPBACK_IP, ":5555");
22
+ const core_1 = require("../core");
23
+ const io_1 = require("../io");
24
+ const CliExecutor_1 = require("../io/CliExecutor");
25
+ const fs_extra_1 = __importDefault(require("fs-extra"));
26
+ const node_crypto_1 = __importDefault(require("node:crypto"));
27
+ const json5_1 = __importDefault(require("json5"));
28
+ const inquirer_1 = __importDefault(require("inquirer"));
29
+ const path_1 = __importDefault(require("path"));
30
+ const cli_tools_1 = require("@react-native-community/cli-tools");
31
+ const simulator_1 = require("../simulator");
32
+ const COMMAND_NAME = 'run-harmony';
33
+ const LOOPBACK_IP = '127.0.0.1';
34
+ const DEFAULT_SIMULATOR_NAME = `${LOOPBACK_IP}:5555`;
68
35
  exports.commandRunHarmony = {
69
36
  name: COMMAND_NAME,
70
37
  description: 'Builds your app and starts it on your phone.',
@@ -109,498 +76,385 @@ exports.commandRunHarmony = {
109
76
  description: 'Do not launch packager while running the app.',
110
77
  },
111
78
  ],
112
- func: function (_argv, _config, rawArgs) { return __awaiter(void 0, void 0, void 0, function () {
113
- var logger, DEVECO_SDK_HOME, fs_1, sdkPath, sdkDirectoryNames, sdkToolchainsPath_1, cli_1, harmonyProjectPath_1, productName_1, buildMode_1, moduleName_1, abilityName_1, simulatorName_1, defaultPort, packager, devEcoStudioToolsPath_1, bundleName_1, currentPort_1, root, reactNativePath, _a, newPort, startPackager, selectDevice, deviceAndSimulatorInfo, deviceOrSimulatorName_1, runJob, err_1;
114
- return __generator(this, function (_b) {
115
- switch (_b.label) {
116
- case 0:
117
- logger = new io_1.Logger();
118
- _b.label = 1;
119
- case 1:
120
- _b.trys.push([1, 11, , 12]);
121
- DEVECO_SDK_HOME = process.env.DEVECO_SDK_HOME;
122
- if (!DEVECO_SDK_HOME) {
79
+ func: (_argv, _config, rawArgs) => __awaiter(void 0, void 0, void 0, function* () {
80
+ const logger = new io_1.Logger();
81
+ try {
82
+ const DEVECO_SDK_HOME = process.env.DEVECO_SDK_HOME;
83
+ if (!DEVECO_SDK_HOME) {
84
+ throw new core_1.DescriptiveError({
85
+ whatHappened: 'DEVECO_SDK_HOME environment variable is not set',
86
+ whatCanUserDo: [
87
+ process.platform === 'darwin'
88
+ ? 'On MacOS, the contents directory is typically located at: /Applications/DevEco-Studio.app/Contents/sdk. Set this path as the value of DEVECO_SDK_HOME'
89
+ : "Locate the installation directory of DevEco Studio, and set its 'sdk' subdirectory as the value of DEVECO_SDK_HOME environment variable.",
90
+ ],
91
+ });
92
+ }
93
+ const fs = new io_1.RealFS();
94
+ const sdkPath = new core_1.AbsolutePath(DEVECO_SDK_HOME);
95
+ const sdkDirectoryNames = fs
96
+ .readDirentsSync(sdkPath)
97
+ .flatMap((dirent) => {
98
+ if (dirent.isDirectory()) {
99
+ return [dirent.name];
100
+ }
101
+ else {
102
+ return [];
103
+ }
104
+ });
105
+ if (sdkDirectoryNames.length === 0) {
106
+ throw new core_1.DescriptiveError({
107
+ whatHappened: `${sdkPath.toString()} has no directories`,
108
+ unexpected: true,
109
+ });
110
+ }
111
+ const sdkToolchainsPath = sdkPath.copyWithNewSegment(sdkDirectoryNames[0], 'openharmony', 'toolchains');
112
+ const cli = new CliExecutor_1.RealCliExecutor();
113
+ const harmonyProjectPath = new core_1.AbsolutePath(rawArgs.harmonyProjectPath);
114
+ const productName = rawArgs.product;
115
+ const buildMode = rawArgs.buildMode;
116
+ const moduleName = rawArgs.module;
117
+ const abilityName = rawArgs.ability;
118
+ let simulatorName = rawArgs.simulator;
119
+ const defaultPort = rawArgs.port;
120
+ const packager = rawArgs.packager;
121
+ const devEcoStudioToolsPath = new core_1.AbsolutePath(DEVECO_SDK_HOME).copyWithNewSegment('..', 'tools');
122
+ if (!fs.existsSync(devEcoStudioToolsPath)) {
123
+ throw new core_1.DescriptiveError({
124
+ whatHappened: `${devEcoStudioToolsPath.toString()} doesn't exist`,
125
+ });
126
+ }
127
+ const bundleName = json5_1.default.parse(fs.readTextSync(harmonyProjectPath.copyWithNewSegment('AppScope', 'app.json5'))).app.bundleName;
128
+ let currentPort = defaultPort;
129
+ if (packager) {
130
+ const root = _config.root || '.';
131
+ const reactNativePath = _config.reactNativePath || path_1.default.dirname(require.resolve('react-native', { paths: [root] }));
132
+ const { port: newPort, startPackager } = yield (0, cli_tools_1.findDevServerPort)(defaultPort, root);
133
+ if (newPort !== 8081) {
134
+ yield trySetMetroPort(harmonyProjectPath.copyWithNewSegment('entry', 'src', 'main', 'ets', 'pages', 'Index.ets').toString(), newPort);
135
+ }
136
+ if (startPackager) {
137
+ (0, cli_tools_1.startServerInNewWindow)(newPort, root, reactNativePath, (0, cli_tools_1.getDefaultUserTerminal)());
138
+ }
139
+ currentPort = newPort;
140
+ }
141
+ const selectDevice = (deviceAndSimulatorInfos) => __awaiter(void 0, void 0, void 0, function* () {
142
+ const lines = deviceAndSimulatorInfos.trim().split('\n');
143
+ const availableDevices = lines.map((line) => {
144
+ const parts = line.split(/\s+/);
145
+ return {
146
+ name: parts[0],
147
+ method: parts[1],
148
+ state: parts[2],
149
+ locate: parts[3],
150
+ connectTool: parts[4]
151
+ };
152
+ });
153
+ if (simulatorName !== 'undefined') {
154
+ const isRequestedDeviceAvailable = availableDevices.some((deviceOrSimulator) => deviceOrSimulator.name === simulatorName);
155
+ if (!isRequestedDeviceAvailable) {
123
156
  throw new core_1.DescriptiveError({
124
- whatHappened: 'DEVECO_SDK_HOME environment variable is not set',
157
+ whatHappened: `Simulator with name "${simulatorName}" not found.`,
125
158
  whatCanUserDo: [
126
- process.platform === 'darwin'
127
- ? 'On MacOS, the contents directory is typically located at: /Applications/DevEco-Studio.app/Contents/sdk. Set this path as the value of DEVECO_SDK_HOME'
128
- : "Locate the installation directory of DevEco Studio, and set its 'sdk' subdirectory as the value of DEVECO_SDK_HOME environment variable.",
129
- ],
159
+ 'Please confirm whether the entered simulator name has been activated.',
160
+ ]
130
161
  });
131
162
  }
132
- fs_1 = new io_1.RealFS();
133
- sdkPath = new core_1.AbsolutePath(DEVECO_SDK_HOME);
134
- sdkDirectoryNames = fs_1
135
- .readDirentsSync(sdkPath)
136
- .flatMap(function (dirent) {
137
- if (dirent.isDirectory()) {
138
- return [dirent.name];
139
- }
140
- else {
141
- return [];
163
+ return simulatorName;
164
+ }
165
+ const connectedDevices = availableDevices.filter((deviceOrSimulator) => deviceOrSimulator.state === 'Connected');
166
+ if (connectedDevices.length === 1) {
167
+ return connectedDevices[0].name;
168
+ }
169
+ if (connectedDevices.length > 1) {
170
+ const answers = yield inquirer_1.default.prompt([
171
+ {
172
+ type: 'list',
173
+ name: 'selectedDeviceIndex',
174
+ message: 'Please select a device:',
175
+ choices: connectedDevices.map((deviceOrSimulator, index) => `${index + 1}. ${deviceOrSimulator.name}`)
142
176
  }
177
+ ]);
178
+ return connectedDevices[parseInt(answers.selectedDeviceIndex) - 1].name;
179
+ }
180
+ try {
181
+ yield (0, simulator_1.launchHarmonySimulator)({
182
+ devEcoStudioToolsPath,
183
+ sdkToolchainsPath,
184
+ cli,
185
+ logger,
186
+ env: process.env,
143
187
  });
144
- if (sdkDirectoryNames.length === 0) {
188
+ simulatorName = DEFAULT_SIMULATOR_NAME;
189
+ return simulatorName;
190
+ }
191
+ catch (e) {
192
+ if (e instanceof core_1.DescriptiveError) {
145
193
  throw new core_1.DescriptiveError({
146
- whatHappened: "".concat(sdkPath.toString(), " has no directories"),
147
- unexpected: true,
194
+ whatHappened: `${e.getMessage()} \n No devices are connected. Failed to auto-launch simulator.`,
195
+ whatCanUserDo: [...e.getSuggestions()],
196
+ extraData: e.getRawData().extraData,
148
197
  });
149
198
  }
150
- sdkToolchainsPath_1 = sdkPath.copyWithNewSegment(sdkDirectoryNames[0], 'openharmony', 'toolchains');
151
- cli_1 = new CliExecutor_1.RealCliExecutor();
152
- harmonyProjectPath_1 = new core_1.AbsolutePath(rawArgs.harmonyProjectPath);
153
- productName_1 = rawArgs.product;
154
- buildMode_1 = rawArgs.buildMode;
155
- moduleName_1 = rawArgs.module;
156
- abilityName_1 = rawArgs.ability;
157
- simulatorName_1 = rawArgs.simulator;
158
- defaultPort = rawArgs.port;
159
- packager = rawArgs.packager;
160
- devEcoStudioToolsPath_1 = new core_1.AbsolutePath(DEVECO_SDK_HOME).copyWithNewSegment('..', 'tools');
161
- if (!fs_1.existsSync(devEcoStudioToolsPath_1)) {
162
- throw new core_1.DescriptiveError({
163
- whatHappened: "".concat(devEcoStudioToolsPath_1.toString(), " doesn't exist"),
164
- });
165
- }
166
- bundleName_1 = json5_1.default.parse(fs_1.readTextSync(harmonyProjectPath_1.copyWithNewSegment('AppScope', 'app.json5'))).app.bundleName;
167
- currentPort_1 = defaultPort;
168
- if (!packager) return [3 /*break*/, 5];
169
- root = _config.root || '.';
170
- reactNativePath = _config.reactNativePath || path_1.default.dirname(require.resolve('react-native', { paths: [root] }));
171
- return [4 /*yield*/, (0, cli_tools_1.findDevServerPort)(defaultPort, root)];
172
- case 2:
173
- _a = _b.sent(), newPort = _a.port, startPackager = _a.startPackager;
174
- if (!(newPort !== 8081)) return [3 /*break*/, 4];
175
- return [4 /*yield*/, trySetMetroPort(harmonyProjectPath_1.copyWithNewSegment('entry', 'src', 'main', 'ets', 'pages', 'Index.ets').toString(), newPort)];
176
- case 3:
177
- _b.sent();
178
- _b.label = 4;
179
- case 4:
180
- if (startPackager) {
181
- (0, cli_tools_1.startServerInNewWindow)(newPort, root, reactNativePath, (0, cli_tools_1.getDefaultUserTerminal)());
199
+ throw new core_1.DescriptiveError({
200
+ whatHappened: `No devices are connected in the current environment (auto-launch attempt failed).`,
201
+ whatCanUserDo: [
202
+ 'Connect a HarmonyOS device via USB or start the simulator manually.',
203
+ 'Re-run the command after a device is listed by: hdc list targets -v',
204
+ ],
205
+ extraData: e,
206
+ });
207
+ }
208
+ });
209
+ const deviceAndSimulatorInfo = yield cli.run(sdkToolchainsPath.copyWithNewSegment('hdc').toString(), {
210
+ args: ['list', 'targets', '-v'],
211
+ cwd: harmonyProjectPath,
212
+ });
213
+ const deviceOrSimulatorName = yield selectDevice(deviceAndSimulatorInfo);
214
+ if (deviceOrSimulatorName.includes(`${LOOPBACK_IP}:`)) {
215
+ simulatorName = deviceOrSimulatorName;
216
+ }
217
+ const runJob = (name, job) => __awaiter(void 0, void 0, void 0, function* () {
218
+ const stop = logger.start((s) => s.bold(name));
219
+ logger.info((s) => s.bold(`${name} started`));
220
+ try {
221
+ yield job();
222
+ logger.succeed((s) => s.bold(`${name} finished`));
223
+ }
224
+ catch (err) {
225
+ if (err instanceof core_1.DescriptiveError) {
226
+ throw err;
182
227
  }
183
- currentPort_1 = newPort;
184
- _b.label = 5;
185
- case 5:
186
- selectDevice = function (deviceAndSimulatorInfos) { return __awaiter(void 0, void 0, void 0, function () {
187
- var lines, availableDevices, isRequestedDeviceAvailable, connectedDevices, answers, e_1;
188
- return __generator(this, function (_a) {
189
- switch (_a.label) {
190
- case 0:
191
- lines = deviceAndSimulatorInfos.trim().split('\n');
192
- availableDevices = lines.map(function (line) {
193
- var parts = line.split(/\s+/);
194
- return {
195
- name: parts[0],
196
- method: parts[1],
197
- state: parts[2],
198
- locate: parts[3],
199
- connectTool: parts[4]
200
- };
201
- });
202
- if (simulatorName_1 !== 'undefined') {
203
- isRequestedDeviceAvailable = availableDevices.some(function (deviceOrSimulator) { return deviceOrSimulator.name === simulatorName_1; });
204
- if (!isRequestedDeviceAvailable) {
205
- throw new core_1.DescriptiveError({
206
- whatHappened: "Simulator with name \"".concat(simulatorName_1, "\" not found."),
207
- whatCanUserDo: [
208
- 'Please confirm whether the entered simulator name has been activated.',
209
- ]
210
- });
211
- }
212
- return [2 /*return*/, simulatorName_1];
213
- }
214
- connectedDevices = availableDevices.filter(function (deviceOrSimulator) { return deviceOrSimulator.state === 'Connected'; });
215
- if (connectedDevices.length === 1) {
216
- return [2 /*return*/, connectedDevices[0].name];
217
- }
218
- if (!(connectedDevices.length > 1)) return [3 /*break*/, 2];
219
- return [4 /*yield*/, inquirer_1.default.prompt([
220
- {
221
- type: 'list',
222
- name: 'selectedDeviceIndex',
223
- message: 'Please select a device:',
224
- choices: connectedDevices.map(function (deviceOrSimulator, index) { return "".concat(index + 1, ". ").concat(deviceOrSimulator.name); })
225
- }
226
- ])];
227
- case 1:
228
- answers = _a.sent();
229
- return [2 /*return*/, connectedDevices[parseInt(answers.selectedDeviceIndex) - 1].name];
230
- case 2:
231
- _a.trys.push([2, 4, , 5]);
232
- return [4 /*yield*/, (0, simulator_1.launchHarmonySimulator)({
233
- devEcoStudioToolsPath: devEcoStudioToolsPath_1,
234
- sdkToolchainsPath: sdkToolchainsPath_1,
235
- cli: cli_1,
236
- logger: logger,
237
- env: process.env,
238
- })];
239
- case 3:
240
- _a.sent();
241
- simulatorName_1 = DEFAULT_SIMULATOR_NAME;
242
- return [2 /*return*/, simulatorName_1];
243
- case 4:
244
- e_1 = _a.sent();
245
- if (e_1 instanceof core_1.DescriptiveError) {
246
- throw new core_1.DescriptiveError({
247
- whatHappened: "".concat(e_1.getMessage(), " \n No devices are connected. Failed to auto-launch simulator."),
248
- whatCanUserDo: __spreadArray([], e_1.getSuggestions(), true),
249
- extraData: e_1.getRawData().extraData,
250
- });
251
- }
252
- throw new core_1.DescriptiveError({
253
- whatHappened: "No devices are connected in the current environment (auto-launch attempt failed).",
254
- whatCanUserDo: [
255
- 'Connect a HarmonyOS device via USB or start the simulator manually.',
256
- 'Re-run the command after a device is listed by: hdc list targets -v',
257
- ],
258
- extraData: e_1,
259
- });
260
- case 5: return [2 /*return*/];
261
- }
262
- });
263
- }); };
264
- return [4 /*yield*/, cli_1.run(sdkToolchainsPath_1.copyWithNewSegment('hdc').toString(), {
265
- args: ['list', 'targets', '-v'],
266
- cwd: harmonyProjectPath_1,
267
- })];
268
- case 6:
269
- deviceAndSimulatorInfo = _b.sent();
270
- return [4 /*yield*/, selectDevice(deviceAndSimulatorInfo)];
271
- case 7:
272
- deviceOrSimulatorName_1 = _b.sent();
273
- if (deviceOrSimulatorName_1.includes("".concat(LOOPBACK_IP, ":"))) {
274
- simulatorName_1 = deviceOrSimulatorName_1;
228
+ throw new core_1.DescriptiveError({
229
+ whatHappened: `${name} failed`,
230
+ extraData: err,
231
+ });
232
+ }
233
+ finally {
234
+ stop();
235
+ }
236
+ });
237
+ yield runJob('[1/3] installing dependencies', () => __awaiter(void 0, void 0, void 0, function* () {
238
+ let ohpmPath = devEcoStudioToolsPath
239
+ .copyWithNewSegment('ohpm', 'bin', 'ohpm');
240
+ if (process.platform === 'win32') {
241
+ ohpmPath = devEcoStudioToolsPath
242
+ .copyWithNewSegment('ohpm', 'bin', 'ohpm.bat');
243
+ }
244
+ yield cli.run(`"${ohpmPath.toString()}"`, {
245
+ args: [
246
+ 'install',
247
+ '--all',
248
+ ],
249
+ cwd: harmonyProjectPath,
250
+ shell: true,
251
+ onArgsStringified: (commandWithArgs) => {
252
+ logger.debug((s) => s.bold(s.gray(commandWithArgs)));
253
+ },
254
+ onStdout: (msg) => {
255
+ logger.debug((s) => s.gray(msg.trimEnd()));
256
+ },
257
+ onStderr(msg) {
258
+ logger.debug(() => msg.trimEnd());
259
+ },
260
+ });
261
+ }));
262
+ yield runJob('[2/3] building app', () => __awaiter(void 0, void 0, void 0, function* () {
263
+ let nodePath = devEcoStudioToolsPath
264
+ .copyWithNewSegment('node', 'bin', 'node');
265
+ if (!fs.existsSync(nodePath)) {
266
+ nodePath = devEcoStudioToolsPath.copyWithNewSegment('node', 'node');
267
+ }
268
+ let hvigorPathRaw = devEcoStudioToolsPath.copyWithNewSegment('hvigor', 'bin', 'hvigorw.js').toString();
269
+ const hvigorPath = `"${hvigorPathRaw}"`;
270
+ yield cli.run(`"${nodePath.toString()}"`, {
271
+ args: [
272
+ hvigorPath,
273
+ `-p`,
274
+ `module=${moduleName}@default`,
275
+ `-p`,
276
+ `product=${productName}`,
277
+ `-p`,
278
+ `buildMode=${buildMode}`,
279
+ `-p`,
280
+ `requiredDeviceType=phone`,
281
+ `assembleHap`,
282
+ ],
283
+ cwd: harmonyProjectPath,
284
+ shell: true,
285
+ onArgsStringified: (commandWithArgs) => {
286
+ logger.debug((s) => s.bold(s.gray(commandWithArgs)));
287
+ },
288
+ onStdout: (msg) => {
289
+ logger.debug((s) => s.gray(msg.trimEnd()));
290
+ },
291
+ onStderr(msg) {
292
+ logger.debug(() => msg.trimEnd());
293
+ },
294
+ });
295
+ }));
296
+ yield runJob('[3/3] installing and opening app', () => __awaiter(void 0, void 0, void 0, function* () {
297
+ const tmpDirName = generateRandomString();
298
+ const ohosTmpDirPath = `data/local/tmp/${tmpDirName}`;
299
+ const exec = (command, args) => __awaiter(void 0, void 0, void 0, function* () {
300
+ const result = yield cli.run(command, {
301
+ args: args,
302
+ shell: true,
303
+ onArgsStringified: (commandWithArgs) => logger.debug((s) => s.bold(s.gray(commandWithArgs))),
304
+ });
305
+ if (result.startsWith('[Fail]')) {
306
+ throw new core_1.DescriptiveError({ whatHappened: result });
275
307
  }
276
- runJob = function (name, job) { return __awaiter(void 0, void 0, void 0, function () {
277
- var stop, err_2;
278
- return __generator(this, function (_a) {
279
- switch (_a.label) {
280
- case 0:
281
- stop = logger.start(function (s) { return s.bold(name); });
282
- logger.info(function (s) { return s.bold("".concat(name, " started")); });
283
- _a.label = 1;
284
- case 1:
285
- _a.trys.push([1, 3, 4, 5]);
286
- return [4 /*yield*/, job()];
287
- case 2:
288
- _a.sent();
289
- logger.succeed(function (s) { return s.bold("".concat(name, " finished")); });
290
- return [3 /*break*/, 5];
291
- case 3:
292
- err_2 = _a.sent();
293
- if (err_2 instanceof core_1.DescriptiveError) {
294
- throw err_2;
295
- }
296
- throw new core_1.DescriptiveError({
297
- whatHappened: "".concat(name, " failed"),
298
- extraData: err_2,
299
- });
300
- case 4:
301
- stop();
302
- return [7 /*endfinally*/];
303
- case 5: return [2 /*return*/];
304
- }
305
- });
306
- }); };
307
- return [4 /*yield*/, runJob('[1/3] installing dependencies', function () { return __awaiter(void 0, void 0, void 0, function () {
308
- var ohpmPath;
309
- return __generator(this, function (_a) {
310
- switch (_a.label) {
311
- case 0:
312
- ohpmPath = devEcoStudioToolsPath_1
313
- .copyWithNewSegment('ohpm', 'bin', 'ohpm');
314
- if (process.platform === 'win32') {
315
- ohpmPath = devEcoStudioToolsPath_1
316
- .copyWithNewSegment('ohpm', 'bin', 'ohpm.bat');
317
- }
318
- return [4 /*yield*/, cli_1.run("\"".concat(ohpmPath.toString(), "\""), {
319
- args: [
320
- 'install',
321
- '--all',
322
- ],
323
- cwd: harmonyProjectPath_1,
324
- shell: true,
325
- onArgsStringified: function (commandWithArgs) {
326
- logger.debug(function (s) { return s.bold(s.gray(commandWithArgs)); });
327
- },
328
- onStdout: function (msg) {
329
- logger.debug(function (s) { return s.gray(msg.trimEnd()); });
330
- },
331
- onStderr: function (msg) {
332
- logger.debug(function () { return msg.trimEnd(); });
333
- },
334
- })];
335
- case 1:
336
- _a.sent();
337
- return [2 /*return*/];
338
- }
339
- });
340
- }); })];
341
- case 8:
342
- _b.sent();
343
- return [4 /*yield*/, runJob('[2/3] building app', function () { return __awaiter(void 0, void 0, void 0, function () {
344
- var nodePath, hvigorPathRaw, hvigorPath;
345
- return __generator(this, function (_a) {
346
- switch (_a.label) {
347
- case 0:
348
- nodePath = devEcoStudioToolsPath_1
349
- .copyWithNewSegment('node', 'bin', 'node');
350
- if (!fs_1.existsSync(nodePath)) {
351
- nodePath = devEcoStudioToolsPath_1.copyWithNewSegment('node', 'node');
352
- }
353
- hvigorPathRaw = devEcoStudioToolsPath_1.copyWithNewSegment('hvigor', 'bin', 'hvigorw.js').toString();
354
- hvigorPath = "\"".concat(hvigorPathRaw, "\"");
355
- return [4 /*yield*/, cli_1.run("\"".concat(nodePath.toString(), "\""), {
356
- args: [
357
- hvigorPath,
358
- "-p",
359
- "module=".concat(moduleName_1, "@default"),
360
- "-p",
361
- "product=".concat(productName_1),
362
- "-p",
363
- "buildMode=".concat(buildMode_1),
364
- "-p",
365
- "requiredDeviceType=phone",
366
- "assembleHap",
367
- ],
368
- cwd: harmonyProjectPath_1,
369
- shell: true,
370
- onArgsStringified: function (commandWithArgs) {
371
- logger.debug(function (s) { return s.bold(s.gray(commandWithArgs)); });
372
- },
373
- onStdout: function (msg) {
374
- logger.debug(function (s) { return s.gray(msg.trimEnd()); });
375
- },
376
- onStderr: function (msg) {
377
- logger.debug(function () { return msg.trimEnd(); });
378
- },
379
- })];
380
- case 1:
381
- _a.sent();
382
- return [2 /*return*/];
383
- }
384
- });
385
- }); })];
386
- case 9:
387
- _b.sent();
388
- return [4 /*yield*/, runJob('[3/3] installing and opening app', function () { return __awaiter(void 0, void 0, void 0, function () {
389
- var tmpDirName, ohosTmpDirPath, exec, hdcPathStrRaw, hdcPathStr, tryRemoveForwardPorting, hapName, installationResult;
390
- return __generator(this, function (_a) {
391
- switch (_a.label) {
392
- case 0:
393
- tmpDirName = generateRandomString();
394
- ohosTmpDirPath = "data/local/tmp/".concat(tmpDirName);
395
- exec = function (command, args) { return __awaiter(void 0, void 0, void 0, function () {
396
- var result;
397
- return __generator(this, function (_a) {
398
- switch (_a.label) {
399
- case 0: return [4 /*yield*/, cli_1.run(command, {
400
- args: args,
401
- shell: true,
402
- onArgsStringified: function (commandWithArgs) {
403
- return logger.debug(function (s) { return s.bold(s.gray(commandWithArgs)); });
404
- },
405
- })];
406
- case 1:
407
- result = _a.sent();
408
- if (result.startsWith('[Fail]')) {
409
- throw new core_1.DescriptiveError({ whatHappened: result });
410
- }
411
- if (result) {
412
- logger.debug(function (s) { return s.gray(result.trimEnd() + '\n'); });
413
- }
414
- else {
415
- logger.debug(function () { return ''; });
416
- }
417
- return [2 /*return*/, result];
418
- }
419
- });
420
- }); };
421
- hdcPathStrRaw = sdkToolchainsPath_1
422
- .copyWithNewSegment('hdc')
423
- .toString();
424
- hdcPathStr = "\"".concat(hdcPathStrRaw.toString(), "\"");
425
- tryRemoveForwardPorting = function () { return __awaiter(void 0, void 0, void 0, function () {
426
- var fportInfo;
427
- return __generator(this, function (_a) {
428
- switch (_a.label) {
429
- case 0:
430
- fportInfo = '';
431
- return [4 /*yield*/, cli_1.run(hdcPathStrRaw, {
432
- args: ['fport', 'ls'],
433
- cwd: harmonyProjectPath_1,
434
- onStdout: function (msg) {
435
- fportInfo += msg;
436
- },
437
- onStderr: function (msg) {
438
- logger.debug(function (s) { return s.gray(msg.trimEnd()); });
439
- },
440
- })];
441
- case 1:
442
- _a.sent();
443
- if (!fportInfo.includes("tcp:".concat(currentPort_1, " tcp:").concat(currentPort_1))) return [3 /*break*/, 3];
444
- return [4 /*yield*/, exec(hdcPathStr, [
445
- 'fport',
446
- 'rm',
447
- "tcp:".concat(currentPort_1),
448
- "tcp:".concat(currentPort_1)
449
- ])];
450
- case 2:
451
- _a.sent();
452
- _a.label = 3;
453
- case 3: return [2 /*return*/];
454
- }
455
- });
456
- }); };
457
- return [4 /*yield*/, exec(hdcPathStr, ['-t', deviceOrSimulatorName_1, 'shell', 'aa', 'force-stop', bundleName_1])];
458
- case 1:
459
- _a.sent();
460
- _a.label = 2;
461
- case 2:
462
- _a.trys.push([2, , 6, 8]);
463
- return [4 /*yield*/, exec(hdcPathStr, ['-t', deviceOrSimulatorName_1, 'shell', 'mkdir', ohosTmpDirPath])];
464
- case 3:
465
- _a.sent();
466
- hapName = "".concat(moduleName_1, "-default-signed.hap");
467
- if (simulatorName_1 !== 'undefined') {
468
- hapName = "".concat(moduleName_1, "-default-unsigned.hap");
469
- }
470
- return [4 /*yield*/, exec(hdcPathStr, [
471
- '-t',
472
- deviceOrSimulatorName_1,
473
- 'file',
474
- 'send',
475
- harmonyProjectPath_1
476
- .copyWithNewSegment(moduleName_1, 'build', 'default', 'outputs', 'default', hapName)
477
- .toString(),
478
- ohosTmpDirPath,
479
- ])];
480
- case 4:
481
- _a.sent();
482
- return [4 /*yield*/, exec(hdcPathStr, [
483
- '-t',
484
- deviceOrSimulatorName_1,
485
- 'shell',
486
- 'bm',
487
- 'install',
488
- '-p',
489
- ohosTmpDirPath,
490
- ])];
491
- case 5:
492
- installationResult = _a.sent();
493
- if (installationResult.includes('failed to install')) {
494
- throw new core_1.DescriptiveError({
495
- whatHappened: 'Installation failed.',
496
- whatCanUserDo: [
497
- "If an application with the same bundle name is already installed, try uninstalling it:\n".concat(hdcPathStr, " shell bm uninstall -n ").concat(bundleName_1),
498
- ],
499
- });
500
- }
501
- return [3 /*break*/, 8];
502
- case 6: return [4 /*yield*/, exec(hdcPathStr, ['-t', deviceOrSimulatorName_1, 'shell', 'rm', '-rf', ohosTmpDirPath])];
503
- case 7:
504
- _a.sent();
505
- return [7 /*endfinally*/];
506
- case 8: return [4 /*yield*/, exec(hdcPathStr, [
507
- '-t',
508
- deviceOrSimulatorName_1,
509
- 'shell',
510
- 'aa',
511
- 'start',
512
- '-a',
513
- abilityName_1,
514
- '-b',
515
- bundleName_1,
516
- ])];
517
- case 9:
518
- _a.sent();
519
- return [4 /*yield*/, tryRemoveForwardPorting()];
520
- case 10:
521
- _a.sent();
522
- return [4 /*yield*/, exec(hdcPathStr, [
523
- '-t',
524
- deviceOrSimulatorName_1,
525
- 'rport',
526
- "tcp:".concat(currentPort_1),
527
- "tcp:".concat(currentPort_1)
528
- ])];
529
- case 11:
530
- _a.sent();
531
- return [2 /*return*/];
532
- }
533
- });
534
- }); })];
535
- case 10:
536
- _b.sent();
537
- return [3 /*break*/, 12];
538
- case 11:
539
- err_1 = _b.sent();
540
- if (err_1 instanceof core_1.DescriptiveError) {
541
- logger.descriptiveError(new core_1.DescriptiveError({
542
- whatHappened: err_1.getMessage(),
543
- whatCanUserDo: __spreadArray(__spreadArray([], err_1.getSuggestions(), true), [
544
- 'Try building and running the app from DevEco studio.',
545
- ], false),
546
- extraData: err_1.getRawData().extraData,
547
- }));
308
+ if (result) {
309
+ logger.debug((s) => s.gray(result.trimEnd() + '\n'));
548
310
  }
549
311
  else {
550
- throw err_1;
312
+ logger.debug(() => '');
313
+ }
314
+ return result;
315
+ });
316
+ const hdcPathStrRaw = sdkToolchainsPath
317
+ .copyWithNewSegment('hdc')
318
+ .toString();
319
+ const hdcPathStr = `"${hdcPathStrRaw.toString()}"`;
320
+ const tryRemoveForwardPorting = () => __awaiter(void 0, void 0, void 0, function* () {
321
+ let fportInfo = '';
322
+ yield cli.run(hdcPathStrRaw, {
323
+ args: ['fport', 'ls'],
324
+ cwd: harmonyProjectPath,
325
+ onStdout: (msg) => {
326
+ fportInfo += msg;
327
+ },
328
+ onStderr: (msg) => {
329
+ logger.debug((s) => s.gray(msg.trimEnd()));
330
+ },
331
+ });
332
+ if (fportInfo.includes(`tcp:${currentPort} tcp:${currentPort}`)) {
333
+ yield exec(hdcPathStr, [
334
+ 'fport',
335
+ 'rm',
336
+ `tcp:${currentPort}`,
337
+ `tcp:${currentPort}`
338
+ ]);
339
+ }
340
+ });
341
+ yield exec(hdcPathStr, ['-t', deviceOrSimulatorName, 'shell', 'aa', 'force-stop', bundleName]);
342
+ try {
343
+ yield exec(hdcPathStr, ['-t', deviceOrSimulatorName, 'shell', 'mkdir', ohosTmpDirPath]);
344
+ let hapName = `${moduleName}-default-signed.hap`;
345
+ if (simulatorName !== 'undefined') {
346
+ hapName = `${moduleName}-default-unsigned.hap`;
551
347
  }
552
- return [3 /*break*/, 12];
553
- case 12: return [2 /*return*/];
348
+ yield exec(hdcPathStr, [
349
+ '-t',
350
+ deviceOrSimulatorName,
351
+ 'file',
352
+ 'send',
353
+ harmonyProjectPath
354
+ .copyWithNewSegment(moduleName, 'build', 'default', 'outputs', 'default', hapName)
355
+ .toString(),
356
+ ohosTmpDirPath,
357
+ ]);
358
+ const installationResult = yield exec(hdcPathStr, [
359
+ '-t',
360
+ deviceOrSimulatorName,
361
+ 'shell',
362
+ 'bm',
363
+ 'install',
364
+ '-p',
365
+ ohosTmpDirPath,
366
+ ]);
367
+ if (installationResult.includes('failed to install')) {
368
+ throw new core_1.DescriptiveError({
369
+ whatHappened: 'Installation failed.',
370
+ whatCanUserDo: [
371
+ `If an application with the same bundle name is already installed, try uninstalling it:\n${hdcPathStr} shell bm uninstall -n ${bundleName}`,
372
+ ],
373
+ });
374
+ }
375
+ }
376
+ finally {
377
+ yield exec(hdcPathStr, ['-t', deviceOrSimulatorName, 'shell', 'rm', '-rf', ohosTmpDirPath]);
378
+ }
379
+ yield exec(hdcPathStr, [
380
+ '-t',
381
+ deviceOrSimulatorName,
382
+ 'shell',
383
+ 'aa',
384
+ 'start',
385
+ '-a',
386
+ abilityName,
387
+ '-b',
388
+ bundleName,
389
+ ]);
390
+ yield tryRemoveForwardPorting();
391
+ yield exec(hdcPathStr, [
392
+ '-t',
393
+ deviceOrSimulatorName,
394
+ 'rport',
395
+ `tcp:${currentPort}`,
396
+ `tcp:${currentPort}`
397
+ ]);
398
+ }));
399
+ }
400
+ catch (err) {
401
+ if (err instanceof core_1.DescriptiveError) {
402
+ logger.descriptiveError(new core_1.DescriptiveError({
403
+ whatHappened: err.getMessage(),
404
+ whatCanUserDo: [
405
+ ...err.getSuggestions(),
406
+ 'Try building and running the app from DevEco studio.',
407
+ ],
408
+ extraData: err.getRawData().extraData,
409
+ }));
554
410
  }
555
- });
556
- }); },
411
+ else {
412
+ throw err;
413
+ }
414
+ }
415
+ }),
557
416
  };
558
- function generateRandomString(length) {
559
- if (length === void 0) { length = 32; }
560
- var chars = '0123456789abcdefghijklmnopqrstuvwxyz';
561
- var result = '';
562
- var randomValues = new Uint8Array(length);
417
+ function generateRandomString(length = 32) {
418
+ const chars = '0123456789abcdefghijklmnopqrstuvwxyz';
419
+ let result = '';
420
+ const randomValues = new Uint8Array(length);
563
421
  node_crypto_1.default.getRandomValues(randomValues);
564
- for (var i = 0; i < length; i++) {
565
- var randomIndex = randomValues[i] % chars.length;
422
+ for (let i = 0; i < length; i++) {
423
+ const randomIndex = randomValues[i] % chars.length;
566
424
  result += chars[randomIndex];
567
425
  }
568
426
  return result;
569
427
  }
570
428
  function trySetMetroPort(filePath, port) {
571
- return __awaiter(this, void 0, void 0, function () {
572
- var content, reFromServerIp, reNewProvider;
573
- return __generator(this, function (_a) {
574
- switch (_a.label) {
575
- case 0: return [4 /*yield*/, fs_extra_1.default.readFile(filePath, 'utf-8')];
576
- case 1:
577
- content = _a.sent();
578
- reFromServerIp = /MetroJSBundleProvider\.fromServerIp\(\s*"([^"]+)"\s*,\s*(\d+)\s*\)/;
579
- if (!reFromServerIp.test(content)) return [3 /*break*/, 3];
580
- content = content.replace(reFromServerIp, function (_match, host) {
581
- return "MetroJSBundleProvider.fromServerIp(\"".concat(host, "\", ").concat(port, ")");
582
- });
583
- return [4 /*yield*/, fs_extra_1.default.writeFile(filePath, content, 'utf-8')];
584
- case 2:
585
- _a.sent();
586
- return [2 /*return*/];
587
- case 3:
588
- reNewProvider = /new\s+MetroJSBundleProvider\s*\(\s*\)/;
589
- if (!reNewProvider.test(content)) return [3 /*break*/, 5];
590
- content = content.replace(reNewProvider, function () {
591
- return "MetroJSBundleProvider.fromServerIp(\"localhost\", ".concat(port, "),\n new MetroJSBundleProvider()");
592
- });
593
- return [4 /*yield*/, fs_extra_1.default.writeFile(filePath, content, 'utf-8')];
594
- case 4:
595
- _a.sent();
596
- return [2 /*return*/];
597
- case 5: throw new core_1.DescriptiveError({
598
- whatHappened: "Unable to set the specified port [".concat(port, "] for the Metro server automatically."),
599
- whatCanUserDo: [
600
- "Please manually add \"MetroJSBundleProvider.fromServerIp(\"localhost\", ".concat(port, ")\" in the \"new AnyJSBundleProvider\" section of your ").concat(filePath, " file.\ne.g:\n new AnyJSBundleProvider([\n MetroJSBundleProvider.fromServerIp(\"localhost\", ").concat(port, "),\n new MetroJSBundleProvider(),\n new ResourceJSBundleProvider(this.rnohCoreContext.uiAbilityContext.resourceManager, 'hermes_bundle.hbc'),\n ])")
601
- ],
602
- });
603
- }
429
+ return __awaiter(this, void 0, void 0, function* () {
430
+ let content = yield fs_extra_1.default.readFile(filePath, 'utf-8');
431
+ const reFromServerIp = /MetroJSBundleProvider\.fromServerIp\(\s*"([^"]+)"\s*,\s*(\d+)\s*\)/;
432
+ if (reFromServerIp.test(content)) {
433
+ content = content.replace(reFromServerIp, (_match, host) => {
434
+ return `MetroJSBundleProvider.fromServerIp("${host}", ${port})`;
435
+ });
436
+ yield fs_extra_1.default.writeFile(filePath, content, 'utf-8');
437
+ return;
438
+ }
439
+ const reNewProvider = /new\s+MetroJSBundleProvider\s*\(\s*\)/;
440
+ if (reNewProvider.test(content)) {
441
+ content = content.replace(reNewProvider, () => {
442
+ return `MetroJSBundleProvider.fromServerIp("localhost", ${port}),\n new MetroJSBundleProvider()`;
443
+ });
444
+ yield fs_extra_1.default.writeFile(filePath, content, 'utf-8');
445
+ return;
446
+ }
447
+ throw new core_1.DescriptiveError({
448
+ whatHappened: `Unable to set the specified port [${port}] for the Metro server automatically.`,
449
+ whatCanUserDo: [
450
+ `Please manually add "MetroJSBundleProvider.fromServerIp("localhost", ${port})" in the "new AnyJSBundleProvider" section of your ${filePath} file.
451
+ e.g:
452
+ new AnyJSBundleProvider([
453
+ MetroJSBundleProvider.fromServerIp("localhost", ${port}),
454
+ new MetroJSBundleProvider(),
455
+ new ResourceJSBundleProvider(this.rnohCoreContext.uiAbilityContext.resourceManager, 'hermes_bundle.hbc'),
456
+ ])`
457
+ ],
604
458
  });
605
459
  });
606
460
  }