@react-native-oh/react-native-harmony-cli 0.77.18 → 0.77.33

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 (106) hide show
  1. package/dist/assetResolver.js +74 -43
  2. package/dist/autolinking/Autolinking.js +179 -178
  3. package/dist/codegen/core/CodegenError.js +23 -3
  4. package/dist/codegen/core/EventUtils.js +3 -3
  5. package/dist/codegen/core/TypeAnnotationToTS.js +28 -24
  6. package/dist/codegen/core/UberSchema.js +97 -55
  7. package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +41 -28
  8. package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +34 -27
  9. package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +33 -25
  10. package/dist/codegen/generators/CppComponentCodeGenerator.js +28 -23
  11. package/dist/codegen/generators/LibGlueCodeGenerator.js +29 -26
  12. package/dist/codegen/generators/NativeModuleCodeGenerator.js +30 -25
  13. package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
  14. package/dist/codegen/generators/UberGeneratorV1.js +24 -18
  15. package/dist/codegen/generators/UberGeneratorV2.js +36 -28
  16. package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +24 -50
  17. package/dist/codegen/templates/BasePackageHTemplate.js +21 -120
  18. package/dist/codegen/templates/ComponentDescriptorHTemplate.js +8 -54
  19. package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +27 -75
  20. package/dist/codegen/templates/ComponentUtilsTSTemplate.js +29 -162
  21. package/dist/codegen/templates/IndexTSTemplate.js +17 -37
  22. package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +24 -119
  23. package/dist/codegen/templates/TurboModuleCppTemplate.js +15 -38
  24. package/dist/codegen/templates/TurboModuleHTemplate.js +11 -32
  25. package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +19 -52
  26. package/dist/commands/bundle-harmony.js +221 -118
  27. package/dist/commands/clean-harmony.js +63 -58
  28. package/dist/commands/codegen-harmony.js +175 -104
  29. package/dist/commands/codegen-lib-harmony.js +116 -76
  30. package/dist/commands/init-harmony.js +196 -151
  31. package/dist/commands/init.js +961 -537
  32. package/dist/commands/link-harmony.js +82 -35
  33. package/dist/commands/run-harmony.js +520 -352
  34. package/dist/commands/verify-package-harmony.js +117 -54
  35. package/dist/core/AbsolutePath.js +49 -33
  36. package/dist/core/CodegenConfig.js +22 -24
  37. package/dist/core/DescriptiveError.js +37 -18
  38. package/dist/core/FileSystem.js +18 -14
  39. package/dist/core/OHPackageJSON5.js +23 -17
  40. package/dist/core/PackageJSON.js +42 -26
  41. package/dist/core/ProjectDependenciesManager.js +92 -40
  42. package/dist/core/ValidationError.js +22 -2
  43. package/dist/core/fs.js +7 -10
  44. package/dist/index.js +1 -1
  45. package/dist/init/templates/AppScopeAppJSON5Template.js +8 -21
  46. package/dist/init/templates/AppScopeStringVarTemplate.js +8 -19
  47. package/dist/init/templates/EntryIndexTemplate.js +8 -56
  48. package/dist/init/templates/EntryStringVarTemplate.js +8 -27
  49. package/dist/init/templates/HvigorConfigJson5Template.js +8 -33
  50. package/dist/init/templates/MetroConfigTemplate.js +8 -38
  51. package/dist/init/templates/OhPackageJson5Template.js +8 -28
  52. package/dist/io/CliExecutor.js +98 -46
  53. package/dist/io/Logger.js +46 -40
  54. package/dist/io/RealFS.js +100 -43
  55. package/dist/io/TarGz.js +8 -11
  56. package/dist/io/__fixtures__.js +141 -79
  57. package/dist/io/fsUtils.js +12 -13
  58. package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +47 -19
  59. package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +41 -13
  60. package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +38 -8
  61. package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +54 -22
  62. package/dist/package-verifier/verify-package.js +133 -56
  63. package/dist/simulator/LaunchSimulator.js +395 -0
  64. package/dist/simulator/index.js +23 -0
  65. package/package.json +2 -11
  66. package/scripts/sync-hvigor.js +27 -0
  67. package/src/autolinking/Autolinking.ts +1 -1
  68. package/src/codegen/generators/UberGeneratorV1.ts +7 -2
  69. package/src/codegen/generators/UberGeneratorV2.ts +6 -1
  70. package/src/commands/codegen-harmony.ts +17 -7
  71. package/src/commands/run-harmony.ts +67 -41
  72. package/src/init/templates/harmony/entry/src/main/module.json5 +7 -0
  73. package/src/simulator/LaunchSimulator.ts +359 -0
  74. package/src/simulator/index.ts +8 -0
  75. package/dist/init/templates/harmony/AppScope/app.json5 +0 -10
  76. package/dist/init/templates/harmony/AppScope/resources/base/element/string.json +0 -8
  77. package/dist/init/templates/harmony/AppScope/resources/base/media/app_icon.png +0 -0
  78. package/dist/init/templates/harmony/build-profile.json5 +0 -36
  79. package/dist/init/templates/harmony/codelinter.json +0 -32
  80. package/dist/init/templates/harmony/entry/build-profile.json5 +0 -18
  81. package/dist/init/templates/harmony/entry/gitignore +0 -7
  82. package/dist/init/templates/harmony/entry/hvigorfile.ts +0 -13
  83. package/dist/init/templates/harmony/entry/oh-package.json5 +0 -9
  84. package/dist/init/templates/harmony/entry/src/main/cpp/CMakeLists.txt +0 -27
  85. package/dist/init/templates/harmony/entry/src/main/cpp/PackageProvider.cpp +0 -13
  86. package/dist/init/templates/harmony/entry/src/main/cpp/gitignore +0 -4
  87. package/dist/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +0 -8
  88. package/dist/init/templates/harmony/entry/src/main/ets/codegen/gitignore +0 -2
  89. package/dist/init/templates/harmony/entry/src/main/ets/entryability/EntryAbility.ets +0 -11
  90. package/dist/init/templates/harmony/entry/src/main/ets/gitignore +0 -1
  91. package/dist/init/templates/harmony/entry/src/main/ets/pages/.gitkeep +0 -0
  92. package/dist/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +0 -16
  93. package/dist/init/templates/harmony/entry/src/main/module.json5 +0 -58
  94. package/dist/init/templates/harmony/entry/src/main/resources/base/element/color.json +0 -8
  95. package/dist/init/templates/harmony/entry/src/main/resources/base/element/string.json +0 -16
  96. package/dist/init/templates/harmony/entry/src/main/resources/base/media/background.png +0 -0
  97. package/dist/init/templates/harmony/entry/src/main/resources/base/media/foreground.png +0 -0
  98. package/dist/init/templates/harmony/entry/src/main/resources/base/media/layered_image.json +0 -7
  99. package/dist/init/templates/harmony/entry/src/main/resources/base/media/startIcon.png +0 -0
  100. package/dist/init/templates/harmony/entry/src/main/resources/base/profile/main_pages.json +0 -5
  101. package/dist/init/templates/harmony/entry/src/main/resources/gitignore +0 -1
  102. package/dist/init/templates/harmony/entry/src/ohosTest/ets/test/List.test.ets +0 -2
  103. package/dist/init/templates/harmony/entry/src/ohosTest/module.json5 +0 -13
  104. package/dist/init/templates/harmony/gitignore +0 -16
  105. package/dist/init/templates/harmony/hvigor/hvigor-config.json5 +0 -22
  106. package/dist/init/templates/harmony/hvigorfile.ts +0 -7
@@ -8,12 +8,48 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ 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);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ 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;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
39
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
40
+ if (ar || !(i in from)) {
41
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
42
+ ar[i] = from[i];
43
+ }
44
+ }
45
+ return to.concat(ar || Array.prototype.slice.call(from));
46
+ };
11
47
  Object.defineProperty(exports, "__esModule", { value: true });
12
48
  exports.commandLinkHarmony = void 0;
13
- const core_1 = require("../core");
14
- const io_1 = require("../io");
15
- const autolinking_1 = require("../autolinking");
16
- const COMMAND_NAME = 'link-harmony';
49
+ var core_1 = require("../core");
50
+ var io_1 = require("../io");
51
+ var autolinking_1 = require("../autolinking");
52
+ var COMMAND_NAME = 'link-harmony';
17
53
  exports.commandLinkHarmony = {
18
54
  name: COMMAND_NAME,
19
55
  description: 'Handles the automatic linking of RNOH libraries. This command is meant to be used by the RNOH HvigorPlugin.',
@@ -51,43 +87,54 @@ exports.commandLinkHarmony = {
51
87
  {
52
88
  name: '--exclude-npm-packages [string...]',
53
89
  description: "Lists npm package names to be excluded from the autolinking process. By default every library is included. Can't be used with --included-npm-packages.",
54
- parse: (val, prev) => (prev ? [...prev, val] : [val]),
90
+ parse: function (val, prev) { return (prev ? __spreadArray(__spreadArray([], prev, true), [val], false) : [val]); },
55
91
  },
56
92
  {
57
93
  name: '--include-npm-packages [string...]',
58
94
  description: "Lists npm package names to be included from the autolinking process. By default every library is included. Can't be used with --excluded-npm-packages.",
59
- parse: (val, prev) => (prev ? [...prev, val] : [val]),
95
+ parse: function (val, prev) { return (prev ? __spreadArray(__spreadArray([], prev, true), [val], false) : [val]); },
60
96
  },
61
97
  ],
62
- func: (_argv, _config, rawArgs) => __awaiter(void 0, void 0, void 0, function* () {
98
+ func: function (_argv, _config, rawArgs) { return __awaiter(void 0, void 0, void 0, function () {
99
+ var logger, fs, autolinking, config, result, err_1;
63
100
  var _a, _b;
64
- const logger = new io_1.Logger();
65
- const fs = new io_1.RealFS();
66
- const autolinking = new autolinking_1.Autolinking(fs, logger);
67
- try {
68
- const config = yield autolinking.prepareInput({
69
- harmonyProjectPath: new core_1.AbsolutePath(rawArgs.harmonyProjectPath),
70
- nodeModulesPath: new core_1.AbsolutePath(rawArgs.nodeModulesPath),
71
- cmakeAutolinkPathRelativeToHarmony: rawArgs.cmakeAutolinkPathRelativeToHarmony,
72
- cppRNOHPackagesFactoryPathRelativeToHarmony: rawArgs.cppRnohPackagesFactoryPathRelativeToHarmony,
73
- etsRNOHPackagesFactoryPathRelativeToHarmony: rawArgs.etsRnohPackagesFactoryPathRelativeToHarmony,
74
- ohPackagePathRelativeToHarmony: rawArgs.ohPackagePathRelativeToHarmony,
75
- excludedNpmPackageNames: new Set(((_a = rawArgs.excludeNpmPackages) === null || _a === void 0 ? void 0 : _a.length) === 1
76
- ? rawArgs.excludeNpmPackages[0].split(';')
77
- : rawArgs.excludeNpmPackages),
78
- includedNpmPackageNames: new Set(((_b = rawArgs.includeNpmPackages) === null || _b === void 0 ? void 0 : _b.length) === 1
79
- ? rawArgs.includeNpmPackages[0].split(';')
80
- : rawArgs.includeNpmPackages),
81
- });
82
- const result = autolinking.evaluate(config);
83
- autolinking.saveAndLogOutput(result);
84
- }
85
- catch (err) {
86
- if (err instanceof core_1.DescriptiveError && !err.isUnexpected()) {
87
- logger.descriptiveError(err);
88
- return;
101
+ return __generator(this, function (_c) {
102
+ switch (_c.label) {
103
+ case 0:
104
+ logger = new io_1.Logger();
105
+ fs = new io_1.RealFS();
106
+ autolinking = new autolinking_1.Autolinking(fs, logger);
107
+ _c.label = 1;
108
+ case 1:
109
+ _c.trys.push([1, 3, , 4]);
110
+ return [4 /*yield*/, autolinking.prepareInput({
111
+ harmonyProjectPath: new core_1.AbsolutePath(rawArgs.harmonyProjectPath),
112
+ nodeModulesPath: new core_1.AbsolutePath(rawArgs.nodeModulesPath),
113
+ cmakeAutolinkPathRelativeToHarmony: rawArgs.cmakeAutolinkPathRelativeToHarmony,
114
+ cppRNOHPackagesFactoryPathRelativeToHarmony: rawArgs.cppRnohPackagesFactoryPathRelativeToHarmony,
115
+ etsRNOHPackagesFactoryPathRelativeToHarmony: rawArgs.etsRnohPackagesFactoryPathRelativeToHarmony,
116
+ ohPackagePathRelativeToHarmony: rawArgs.ohPackagePathRelativeToHarmony,
117
+ excludedNpmPackageNames: new Set(((_a = rawArgs.excludeNpmPackages) === null || _a === void 0 ? void 0 : _a.length) === 1
118
+ ? rawArgs.excludeNpmPackages[0].split(';')
119
+ : rawArgs.excludeNpmPackages),
120
+ includedNpmPackageNames: new Set(((_b = rawArgs.includeNpmPackages) === null || _b === void 0 ? void 0 : _b.length) === 1
121
+ ? rawArgs.includeNpmPackages[0].split(';')
122
+ : rawArgs.includeNpmPackages),
123
+ })];
124
+ case 2:
125
+ config = _c.sent();
126
+ result = autolinking.evaluate(config);
127
+ autolinking.saveAndLogOutput(result);
128
+ return [3 /*break*/, 4];
129
+ case 3:
130
+ err_1 = _c.sent();
131
+ if (err_1 instanceof core_1.DescriptiveError && !err_1.isUnexpected()) {
132
+ logger.descriptiveError(err_1);
133
+ return [2 /*return*/];
134
+ }
135
+ throw err_1;
136
+ case 4: return [2 /*return*/];
89
137
  }
90
- throw err;
91
- }
92
- }),
138
+ });
139
+ }); },
93
140
  };