@react-native-oh/react-native-harmony-cli 0.77.22 → 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.
- package/dist/assetResolver.js +74 -43
- package/dist/autolinking/Autolinking.js +179 -178
- 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 +97 -55
- package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +41 -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 -120
- package/dist/codegen/templates/ComponentDescriptorHTemplate.js +8 -54
- 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 -119
- 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 +221 -118
- package/dist/commands/clean-harmony.js +63 -58
- package/dist/commands/codegen-harmony.js +175 -104
- package/dist/commands/codegen-lib-harmony.js +116 -76
- package/dist/commands/init-harmony.js +196 -151
- package/dist/commands/init.js +961 -537
- package/dist/commands/link-harmony.js +82 -35
- package/dist/commands/run-harmony.js +518 -374
- package/dist/commands/verify-package-harmony.js +117 -54
- package/dist/core/AbsolutePath.js +49 -33
- 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 +92 -40
- package/dist/core/ValidationError.js +22 -2
- package/dist/core/fs.js +7 -10
- package/dist/index.js +1 -1
- package/dist/init/templates/AppScopeAppJSON5Template.js +8 -21
- package/dist/init/templates/AppScopeStringVarTemplate.js +8 -19
- package/dist/init/templates/EntryIndexTemplate.js +8 -56
- package/dist/init/templates/EntryStringVarTemplate.js +8 -27
- package/dist/init/templates/HvigorConfigJson5Template.js +8 -33
- package/dist/init/templates/MetroConfigTemplate.js +8 -38
- package/dist/init/templates/OhPackageJson5Template.js +8 -28
- package/dist/io/CliExecutor.js +98 -46
- package/dist/io/Logger.js +46 -40
- package/dist/io/RealFS.js +100 -43
- 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 +133 -56
- package/dist/simulator/LaunchSimulator.js +301 -217
- package/package.json +2 -11
- package/scripts/sync-hvigor.js +27 -0
- package/src/autolinking/Autolinking.ts +1 -1
- package/src/codegen/generators/UberGeneratorV1.ts +7 -2
- package/src/codegen/generators/UberGeneratorV2.ts +6 -1
- package/src/commands/codegen-harmony.ts +17 -7
- package/src/commands/run-harmony.ts +0 -2
- package/src/simulator/LaunchSimulator.ts +9 -2
- package/dist/init/templates/harmony/AppScope/app.json5 +0 -10
- package/dist/init/templates/harmony/AppScope/resources/base/element/string.json +0 -8
- package/dist/init/templates/harmony/AppScope/resources/base/media/app_icon.png +0 -0
- package/dist/init/templates/harmony/build-profile.json5 +0 -36
- package/dist/init/templates/harmony/codelinter.json +0 -32
- package/dist/init/templates/harmony/entry/build-profile.json5 +0 -18
- package/dist/init/templates/harmony/entry/gitignore +0 -7
- package/dist/init/templates/harmony/entry/hvigorfile.ts +0 -13
- package/dist/init/templates/harmony/entry/oh-package.json5 +0 -9
- package/dist/init/templates/harmony/entry/src/main/cpp/CMakeLists.txt +0 -27
- package/dist/init/templates/harmony/entry/src/main/cpp/PackageProvider.cpp +0 -13
- package/dist/init/templates/harmony/entry/src/main/cpp/gitignore +0 -4
- package/dist/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +0 -8
- package/dist/init/templates/harmony/entry/src/main/ets/codegen/gitignore +0 -2
- package/dist/init/templates/harmony/entry/src/main/ets/entryability/EntryAbility.ets +0 -11
- package/dist/init/templates/harmony/entry/src/main/ets/gitignore +0 -1
- package/dist/init/templates/harmony/entry/src/main/ets/pages/.gitkeep +0 -0
- package/dist/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +0 -16
- package/dist/init/templates/harmony/entry/src/main/module.json5 +0 -65
- package/dist/init/templates/harmony/entry/src/main/resources/base/element/color.json +0 -8
- package/dist/init/templates/harmony/entry/src/main/resources/base/element/string.json +0 -16
- package/dist/init/templates/harmony/entry/src/main/resources/base/media/background.png +0 -0
- package/dist/init/templates/harmony/entry/src/main/resources/base/media/foreground.png +0 -0
- package/dist/init/templates/harmony/entry/src/main/resources/base/media/layered_image.json +0 -7
- package/dist/init/templates/harmony/entry/src/main/resources/base/media/startIcon.png +0 -0
- package/dist/init/templates/harmony/entry/src/main/resources/base/profile/main_pages.json +0 -5
- package/dist/init/templates/harmony/entry/src/main/resources/gitignore +0 -1
- package/dist/init/templates/harmony/entry/src/ohosTest/ets/test/List.test.ets +0 -2
- package/dist/init/templates/harmony/entry/src/ohosTest/module.json5 +0 -13
- package/dist/init/templates/harmony/gitignore +0 -16
- package/dist/init/templates/harmony/hvigor/hvigor-config.json5 +0 -22
- package/dist/init/templates/harmony/hvigorfile.ts +0 -7
- package/harmony/rnoh-hvigor-plugin-0.77.22.tgz +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/02febc14 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0429e5b7 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/05339e68 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/070be2fe +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/07851ff1 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/12e10c06 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/12e1d696 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/14950087 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/15e87372 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/19e6ecbe +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1aac0ac4 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1b8db102 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1c181646 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/203e747c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/21ba4c08 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/259939e5 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/288ba98c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2a45461c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2d773091 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2eda89fc +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2f584eca +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/35b495ca +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/36478aed +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3844e772 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3ee777f4 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/471ac436 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4a91abcc +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4d1a5094 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4d3ef38f +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4daf5855 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4ef0389f +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4f72da28 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/59d3e924 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5a8edfaa +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5d28a510 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/61a6391d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/65921a14 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6624e7fc +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/66d28144 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6aceb8d2 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/702393d3 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/714f932b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/73f9d4a6 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/78d3adae +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7b6564b8 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7c7c3e6e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7cbc9b6a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7dd579e0 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7e0b7d06 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7e153eef +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7ee84fd7 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7f5146a4 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/844e633a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8a1af22c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/90a1680d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a15fb79a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ac288a8a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ad7a66b4 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/aee8805e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b0487ec8 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b10e16d2 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b32d42ac +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b7d8f35c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b96748af +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/bedb2fea +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c01ad640 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c0472cf5 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c102ed0f +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c1a91819 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c243857a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c407792f +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c4459bee +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c72a4dcd +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c83537a9 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c88f7498 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c8d04070 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cc44d6f1 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d4d913f6 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/da97f202 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/dc965522 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/dff6f700 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e507c001 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e52f3f2d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e5c3890d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e720074d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e7656fa7 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e80bcaac +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e8e7900e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ee8993f9 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ef8cf362 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f1405b1d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f20f0e0d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f2586978 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f53cd716 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/fe71f6bb +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/febfc20b +0 -0
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
18
|
exports.CodegenError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
19
|
+
var core_1 = require("../../core");
|
|
20
|
+
var CodegenError = /** @class */ (function (_super) {
|
|
21
|
+
__extends(CodegenError, _super);
|
|
22
|
+
function CodegenError() {
|
|
23
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
return CodegenError;
|
|
26
|
+
}(core_1.DescriptiveError));
|
|
7
27
|
exports.CodegenError = CodegenError;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createEventNameFromEventHandlerName = createEventNameFromEventHandlerName;
|
|
4
|
-
|
|
4
|
+
var CodegenError_1 = require("./CodegenError");
|
|
5
5
|
function createEventNameFromEventHandlerName(eventHandlerName) {
|
|
6
|
-
|
|
6
|
+
var eventName = eventHandlerName.replace('on', '');
|
|
7
7
|
if (eventName.length === 0) {
|
|
8
8
|
throw new CodegenError_1.CodegenError({
|
|
9
|
-
whatHappened:
|
|
9
|
+
whatHappened: "Received invalid event handler name: ".concat(eventHandlerName),
|
|
10
10
|
whatCanUserDo: [
|
|
11
11
|
'Change your event listener name to match naming convention "onEventName" e.g. "onPress"',
|
|
12
12
|
],
|
|
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TypeAnnotationToTS = void 0;
|
|
4
4
|
exports.getStringifiedTSDefaultValueFromPropTypeAnnotation = getStringifiedTSDefaultValueFromPropTypeAnnotation;
|
|
5
5
|
exports.wrapWithQuotes = wrapWithQuotes;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
var TypeAnnotationToTS = /** @class */ (function () {
|
|
7
|
+
function TypeAnnotationToTS(aliasPrefix) {
|
|
8
|
+
if (aliasPrefix === void 0) { aliasPrefix = ''; }
|
|
8
9
|
this.aliasPrefix = aliasPrefix;
|
|
9
10
|
}
|
|
10
|
-
convert(typeAnnotation) {
|
|
11
|
+
TypeAnnotationToTS.prototype.convert = function (typeAnnotation) {
|
|
12
|
+
var _this = this;
|
|
11
13
|
if (!typeAnnotation) {
|
|
12
14
|
return 'unknown';
|
|
13
15
|
}
|
|
@@ -50,7 +52,7 @@ class TypeAnnotationToTS {
|
|
|
50
52
|
}
|
|
51
53
|
case 'StringEnumTypeAnnotation':
|
|
52
54
|
return typeAnnotation.options
|
|
53
|
-
.map((option)
|
|
55
|
+
.map(function (option) {
|
|
54
56
|
if (typeof option !== 'string') {
|
|
55
57
|
return option;
|
|
56
58
|
}
|
|
@@ -60,11 +62,11 @@ class TypeAnnotationToTS {
|
|
|
60
62
|
case 'StringTypeAnnotation':
|
|
61
63
|
return 'string';
|
|
62
64
|
case 'FunctionTypeAnnotation':
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
.map((param)
|
|
65
|
+
var params = typeAnnotation.params, returnTypeAnnotation = typeAnnotation.returnTypeAnnotation;
|
|
66
|
+
var stringifiedArgs = params
|
|
67
|
+
.map(function (param) { return "".concat(param.name, ": ").concat(_this.convert(param.typeAnnotation)); })
|
|
66
68
|
.join(', ');
|
|
67
|
-
return
|
|
69
|
+
return "(".concat(stringifiedArgs, ") => ").concat(this.convert(returnTypeAnnotation));
|
|
68
70
|
case 'EnumDeclaration':
|
|
69
71
|
return typeAnnotation.name;
|
|
70
72
|
case 'GenericObjectTypeAnnotation':
|
|
@@ -76,20 +78,20 @@ class TypeAnnotationToTS {
|
|
|
76
78
|
case 'NumberTypeAnnotation':
|
|
77
79
|
return 'number';
|
|
78
80
|
case 'NullableTypeAnnotation':
|
|
79
|
-
return
|
|
81
|
+
return "null | ".concat(this.convert(typeAnnotation.typeAnnotation));
|
|
80
82
|
case 'ObjectTypeAnnotation':
|
|
81
83
|
return this.convertObjectTypeAnnotation(typeAnnotation);
|
|
82
84
|
case 'PromiseTypeAnnotation':
|
|
83
|
-
return
|
|
85
|
+
return "Promise<".concat(this.convert(typeAnnotation.elementType), ">");
|
|
84
86
|
case 'VoidTypeAnnotation':
|
|
85
87
|
return 'void';
|
|
86
88
|
case 'ArrayTypeAnnotation':
|
|
87
|
-
return
|
|
89
|
+
return "".concat(this.convert(typeAnnotation.elementType), "[]");
|
|
88
90
|
default:
|
|
89
91
|
return 'unknown';
|
|
90
92
|
}
|
|
91
|
-
}
|
|
92
|
-
convertUnionMemberAnnotation(memberAnnotation) {
|
|
93
|
+
};
|
|
94
|
+
TypeAnnotationToTS.prototype.convertUnionMemberAnnotation = function (memberAnnotation) {
|
|
93
95
|
switch (memberAnnotation) {
|
|
94
96
|
case 'NumberTypeAnnotation':
|
|
95
97
|
return 'number';
|
|
@@ -98,20 +100,22 @@ class TypeAnnotationToTS {
|
|
|
98
100
|
case 'StringTypeAnnotation':
|
|
99
101
|
return 'string';
|
|
100
102
|
}
|
|
101
|
-
}
|
|
102
|
-
convertObjectTypeAnnotation(objectTypeAnnotation) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
};
|
|
104
|
+
TypeAnnotationToTS.prototype.convertObjectTypeAnnotation = function (objectTypeAnnotation) {
|
|
105
|
+
var _this = this;
|
|
106
|
+
var props = objectTypeAnnotation.properties
|
|
107
|
+
.map(function (prop) {
|
|
108
|
+
var maybeOptionalSymbol = prop.optional ? '?' : '';
|
|
109
|
+
return "".concat(prop.name).concat(maybeOptionalSymbol, ": ").concat(_this.convert(prop.typeAnnotation));
|
|
107
110
|
})
|
|
108
111
|
.join(', ');
|
|
109
112
|
if (props.length === 0) {
|
|
110
113
|
return '{}';
|
|
111
114
|
}
|
|
112
|
-
return
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
+
return "{".concat(props, "}");
|
|
116
|
+
};
|
|
117
|
+
return TypeAnnotationToTS;
|
|
118
|
+
}());
|
|
115
119
|
exports.TypeAnnotationToTS = TypeAnnotationToTS;
|
|
116
120
|
function getStringifiedTSDefaultValueFromPropTypeAnnotation(propTypeAnnotation) {
|
|
117
121
|
if ('default' in propTypeAnnotation && propTypeAnnotation.default !== null) {
|
|
@@ -124,9 +128,9 @@ function getStringifiedTSDefaultValueFromPropTypeAnnotation(propTypeAnnotation)
|
|
|
124
128
|
}
|
|
125
129
|
function wrapWithQuotes(str) {
|
|
126
130
|
if (str.includes("'")) {
|
|
127
|
-
return
|
|
131
|
+
return "\"".concat(str, "\"");
|
|
128
132
|
}
|
|
129
133
|
else {
|
|
130
|
-
return
|
|
134
|
+
return "'".concat(str, "'");
|
|
131
135
|
}
|
|
132
136
|
}
|
|
@@ -8,23 +8,53 @@ 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
|
+
};
|
|
11
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
39
|
exports.UberSchema = void 0;
|
|
13
|
-
|
|
40
|
+
var core_1 = require("../../core");
|
|
14
41
|
// @ts-expect-error
|
|
15
|
-
|
|
16
|
-
|
|
42
|
+
var combine_js_to_schema_js_1 = require("@react-native/codegen/lib/cli/combine/combine-js-to-schema.js");
|
|
43
|
+
var CodegenError_1 = require("./CodegenError");
|
|
17
44
|
function createRawUberSchemaFromSpecFilePaths(projectSourceFilePaths) {
|
|
18
|
-
return (0, combine_js_to_schema_js_1.combineSchemas)(projectSourceFilePaths.map((p)
|
|
45
|
+
return (0, combine_js_to_schema_js_1.combineSchemas)(projectSourceFilePaths.map(function (p) { return p.getValue(); }));
|
|
19
46
|
}
|
|
20
47
|
/**
|
|
21
48
|
* Contains component and turbo module (NativeModule) schemas. The "Uber" word is used here to highlight that SpecSchemas don't extend this class.
|
|
22
49
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
50
|
+
var UberSchema = /** @class */ (function () {
|
|
51
|
+
function UberSchema(schemaValue) {
|
|
52
|
+
this.schemaValue = schemaValue;
|
|
26
53
|
}
|
|
27
|
-
|
|
54
|
+
UberSchema.fromSpecFilePaths = function (specPaths) {
|
|
55
|
+
return new UberSchema(createRawUberSchemaFromSpecFilePaths(specPaths));
|
|
56
|
+
};
|
|
57
|
+
UberSchema.fromCodegenConfig = function (codegenConfig) {
|
|
28
58
|
try {
|
|
29
59
|
return new UberSchema(createRawUberSchemaFromSpecFilePaths(codegenConfig.getSpecFilePaths()));
|
|
30
60
|
}
|
|
@@ -33,64 +63,76 @@ class UberSchema {
|
|
|
33
63
|
throw new CodegenError_1.CodegenError({
|
|
34
64
|
whatHappened: "Couldn't create the schema",
|
|
35
65
|
whatCanUserDo: [
|
|
36
|
-
|
|
66
|
+
"There's probably at least one spec file defined in your project or in a third-party package that breaks some code generation restrictions. Please check the message below. If it's ambiguous, debug the problem with divide and conquer strategy.\n\n".concat(err.message),
|
|
37
67
|
],
|
|
38
68
|
});
|
|
39
69
|
}
|
|
40
70
|
throw err;
|
|
41
71
|
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return __awaiter(this, void 0, void 0, function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
72
|
+
};
|
|
73
|
+
UberSchema.fromProject = function (fs, projectRootPath, onShouldAcceptCodegenConfig) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
75
|
+
var onShouldAcceptCodegenConfig_, packageJSON, acceptedCodegenConfigs, appCodegenConfigs, _i, appCodegenConfigs_1, codegenConfig;
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
switch (_a.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
onShouldAcceptCodegenConfig_ = onShouldAcceptCodegenConfig !== null && onShouldAcceptCodegenConfig !== void 0 ? onShouldAcceptCodegenConfig : (function (x) { return true; });
|
|
80
|
+
packageJSON = core_1.PackageJSON.fromProjectRootPath(fs, projectRootPath, projectRootPath);
|
|
81
|
+
acceptedCodegenConfigs = [];
|
|
82
|
+
appCodegenConfigs = packageJSON.getCodegenConfigs();
|
|
83
|
+
for (_i = 0, appCodegenConfigs_1 = appCodegenConfigs; _i < appCodegenConfigs_1.length; _i++) {
|
|
84
|
+
codegenConfig = appCodegenConfigs_1[_i];
|
|
85
|
+
if (onShouldAcceptCodegenConfig_(codegenConfig.getVersion(), packageJSON.name)) {
|
|
86
|
+
acceptedCodegenConfigs.push(codegenConfig);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return [4 /*yield*/, new core_1.ProjectDependenciesManager(fs, projectRootPath).forEachAsync(function (dependency) {
|
|
90
|
+
var codegenConfigs = dependency.getCodegenConfigs();
|
|
91
|
+
for (var _i = 0, codegenConfigs_1 = codegenConfigs; _i < codegenConfigs_1.length; _i++) {
|
|
92
|
+
var codegenConfig = codegenConfigs_1[_i];
|
|
93
|
+
if (onShouldAcceptCodegenConfig_(codegenConfig.getVersion(), dependency.readPackageJSON().name)) {
|
|
94
|
+
acceptedCodegenConfigs.push(codegenConfig);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
})];
|
|
98
|
+
case 1:
|
|
99
|
+
_a.sent();
|
|
100
|
+
try {
|
|
101
|
+
return [2 /*return*/, new UberSchema(createRawUberSchemaFromSpecFilePaths(acceptedCodegenConfigs.flatMap(function (codegenConfig) {
|
|
102
|
+
return codegenConfig.getSpecFilePaths();
|
|
103
|
+
})))];
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
if (err instanceof Error) {
|
|
107
|
+
throw new CodegenError_1.CodegenError({
|
|
108
|
+
whatHappened: "Couldn't create the schema",
|
|
109
|
+
whatCanUserDo: [
|
|
110
|
+
"There's probably at least one spec file defined in your project or in a third-party package that breaks some code generation restrictions. Please check the message below. If it's ambiguous, debug the problem with divide and conquer strategy.\n\n".concat(err.message),
|
|
111
|
+
],
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
throw err;
|
|
115
|
+
}
|
|
116
|
+
return [2 /*return*/];
|
|
60
117
|
}
|
|
61
118
|
});
|
|
62
|
-
try {
|
|
63
|
-
return new UberSchema(createRawUberSchemaFromSpecFilePaths(acceptedCodegenConfigs.flatMap((codegenConfig) => codegenConfig.getSpecFilePaths())));
|
|
64
|
-
}
|
|
65
|
-
catch (err) {
|
|
66
|
-
if (err instanceof Error) {
|
|
67
|
-
throw new CodegenError_1.CodegenError({
|
|
68
|
-
whatHappened: "Couldn't create the schema",
|
|
69
|
-
whatCanUserDo: [
|
|
70
|
-
`There's probably at least one spec file defined in your project or in a third-party package that breaks some code generation restrictions. Please check the message below. If it's ambiguous, debug the problem with divide and conquer strategy.\n\n${err.message}`,
|
|
71
|
-
],
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
throw err;
|
|
75
|
-
}
|
|
76
119
|
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
this.schemaValue = schemaValue;
|
|
80
|
-
}
|
|
81
|
-
getValue() {
|
|
120
|
+
};
|
|
121
|
+
UberSchema.prototype.getValue = function () {
|
|
82
122
|
return this.schemaValue;
|
|
83
|
-
}
|
|
84
|
-
findAllSpecSchemasByType(schemaType) {
|
|
123
|
+
};
|
|
124
|
+
UberSchema.prototype.findAllSpecSchemasByType = function (schemaType) {
|
|
85
125
|
return Object.values(this.schemaValue.modules)
|
|
86
|
-
.filter((module)
|
|
87
|
-
.map((module)
|
|
88
|
-
}
|
|
89
|
-
getSpecSchemaByFilenameMap() {
|
|
90
|
-
return Object.entries(this.schemaValue.modules).reduce((acc,
|
|
126
|
+
.filter(function (module) { return module.type === schemaType; })
|
|
127
|
+
.map(function (module) { return module; });
|
|
128
|
+
};
|
|
129
|
+
UberSchema.prototype.getSpecSchemaByFilenameMap = function () {
|
|
130
|
+
return Object.entries(this.schemaValue.modules).reduce(function (acc, _a) {
|
|
131
|
+
var moduleName = _a[0], moduleSchema = _a[1];
|
|
91
132
|
acc.set(moduleName, moduleSchema);
|
|
92
133
|
return acc;
|
|
93
134
|
}, new Map());
|
|
94
|
-
}
|
|
95
|
-
|
|
135
|
+
};
|
|
136
|
+
return UberSchema;
|
|
137
|
+
}());
|
|
96
138
|
exports.UberSchema = UberSchema;
|
|
@@ -1,52 +1,64 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
4
12
|
};
|
|
5
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
14
|
exports.AppBuildTimeGlueCodeGenerator = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
var case_1 = require("case");
|
|
16
|
+
var templates_1 = require("../templates");
|
|
17
|
+
var BasePackageHTemplate_1 = require("../templates/BasePackageHTemplate");
|
|
10
18
|
/**
|
|
11
19
|
* Generates code based on UberGenerators results. If UberGenerators produce "leaves" (concrete turbo module or component classes),
|
|
12
20
|
* this class generates "branches" (barrel files like index.ts) and "trunks" (package file or files).
|
|
13
21
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
var AppBuildTimeGlueCodeGenerator = /** @class */ (function () {
|
|
23
|
+
function AppBuildTimeGlueCodeGenerator(cppOutputPath, etsOutputPath, codegenNoticeLines) {
|
|
16
24
|
this.cppOutputPath = cppOutputPath;
|
|
17
25
|
this.etsOutputPath = etsOutputPath;
|
|
18
26
|
this.codegenNoticeLines = codegenNoticeLines;
|
|
19
27
|
}
|
|
20
|
-
generate
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
AppBuildTimeGlueCodeGenerator.prototype.generate = function (_a) {
|
|
29
|
+
var _this = this;
|
|
30
|
+
var v1 = _a.v1, v2 = _a.v2;
|
|
31
|
+
var fileContentByPath = new Map();
|
|
32
|
+
var generatedPackageH_v1 = new templates_1.RNOHGeneratedPackageHTemplate();
|
|
33
|
+
var components_indexTS = new templates_1.IndexTSTemplate(this.codegenNoticeLines);
|
|
34
|
+
var turboModules_indexTS = new templates_1.IndexTSTemplate(this.codegenNoticeLines);
|
|
35
|
+
var generated_indexETS = new templates_1.IndexTSTemplate(this.codegenNoticeLines);
|
|
26
36
|
generated_indexETS.addReexport({ from: './ts' });
|
|
27
|
-
v1.components.forEach((
|
|
28
|
-
|
|
37
|
+
v1.components.forEach(function (_a) {
|
|
38
|
+
var name = _a.name, eventNames = _a.eventNames;
|
|
39
|
+
components_indexTS.addReexport({ from: "./".concat(name) });
|
|
29
40
|
generatedPackageH_v1.addComponent({
|
|
30
|
-
name,
|
|
41
|
+
name: name,
|
|
31
42
|
supportedEventNames: eventNames,
|
|
32
43
|
isArkTSComponent: true,
|
|
33
44
|
});
|
|
34
45
|
});
|
|
35
|
-
v1.turboModules.forEach((turboModule)
|
|
36
|
-
turboModules_indexTS.addReexport({ from:
|
|
46
|
+
v1.turboModules.forEach(function (turboModule) {
|
|
47
|
+
turboModules_indexTS.addReexport({ from: "./".concat(turboModule.name) });
|
|
37
48
|
generatedPackageH_v1.addTurboModule(turboModule);
|
|
38
49
|
});
|
|
39
|
-
v2.forEach((
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
v2.forEach(function (_a, libraryName) {
|
|
51
|
+
var components = _a.components, turboModules = _a.turboModules;
|
|
52
|
+
var basePackageClassName = "Base".concat(case_1.default.pascal(libraryName), "Package");
|
|
53
|
+
var generatedPackageH_v2 = new BasePackageHTemplate_1.BasePackageHTemplate(basePackageClassName, _this.codegenNoticeLines);
|
|
54
|
+
components.forEach(function (component) {
|
|
55
|
+
generatedPackageH_v2.addComponent(__assign(__assign({}, component), { isArkTSComponent: false }));
|
|
44
56
|
});
|
|
45
|
-
turboModules.forEach((turboModule)
|
|
46
|
-
turboModules_indexTS.addReexport({ from:
|
|
57
|
+
turboModules.forEach(function (turboModule) {
|
|
58
|
+
turboModules_indexTS.addReexport({ from: "./".concat(turboModule.name) });
|
|
47
59
|
generatedPackageH_v2.addTurboModule(turboModule);
|
|
48
60
|
});
|
|
49
|
-
fileContentByPath.set(
|
|
61
|
+
fileContentByPath.set(_this.cppOutputPath.copyWithNewSegment(libraryName, 'RNOH', 'generated', "".concat(basePackageClassName, ".h")), generatedPackageH_v2.build());
|
|
50
62
|
});
|
|
51
63
|
fileContentByPath.set(this.cppOutputPath.copyWithNewSegment('RNOHGeneratedPackage.h'), generatedPackageH_v1.build());
|
|
52
64
|
fileContentByPath.set(this.etsOutputPath.copyWithNewSegment('ts.ts'), new templates_1.IndexTSTemplate(this.codegenNoticeLines)
|
|
@@ -57,6 +69,7 @@ class AppBuildTimeGlueCodeGenerator {
|
|
|
57
69
|
fileContentByPath.set(this.etsOutputPath.copyWithNewSegment('turboModules', 'ts.ts'), turboModules_indexTS.build());
|
|
58
70
|
fileContentByPath.set(this.etsOutputPath.copyWithNewSegment('index.ets'), generated_indexETS.build());
|
|
59
71
|
return fileContentByPath;
|
|
60
|
-
}
|
|
61
|
-
|
|
72
|
+
};
|
|
73
|
+
return AppBuildTimeGlueCodeGenerator;
|
|
74
|
+
}());
|
|
62
75
|
exports.AppBuildTimeGlueCodeGenerator = AppBuildTimeGlueCodeGenerator;
|
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ArkTSComponentCodeGeneratorArkTS = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
var core_1 = require("../core");
|
|
5
|
+
var templates_1 = require("../templates");
|
|
6
|
+
var ArkTSComponentCodeGeneratorArkTS = /** @class */ (function () {
|
|
7
|
+
function ArkTSComponentCodeGeneratorArkTS(cppOutputPath, tsOutputPath, codegenNoticeLines, rnohImport) {
|
|
8
8
|
this.cppOutputPath = cppOutputPath;
|
|
9
9
|
this.tsOutputPath = tsOutputPath;
|
|
10
10
|
this.codegenNoticeLines = codegenNoticeLines;
|
|
11
11
|
this.rnohImport = rnohImport;
|
|
12
12
|
this.glueCodeDataItems = [];
|
|
13
13
|
}
|
|
14
|
-
getGlueCodeData() {
|
|
14
|
+
ArkTSComponentCodeGeneratorArkTS.prototype.getGlueCodeData = function () {
|
|
15
15
|
return this.glueCodeDataItems;
|
|
16
|
-
}
|
|
17
|
-
generate(schema) {
|
|
16
|
+
};
|
|
17
|
+
ArkTSComponentCodeGeneratorArkTS.prototype.generate = function (schema) {
|
|
18
|
+
var _this = this;
|
|
18
19
|
if (schema.type !== 'Component') {
|
|
19
20
|
throw new core_1.CodegenError({
|
|
20
|
-
whatHappened:
|
|
21
|
+
whatHappened: "ComponentCodeGenerator can't generate code for a module type: ".concat(schema.type),
|
|
21
22
|
unexpected: true,
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Object.entries(schema.components).map((
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
var typeAnnotationToTS = new core_1.TypeAnnotationToTS();
|
|
26
|
+
var result = new Map();
|
|
27
|
+
Object.entries(schema.components).map(function (_a) {
|
|
28
|
+
var name = _a[0], shape = _a[1];
|
|
29
|
+
var componentDescriptorHTemplate = new templates_1.ComponentDescriptorHTemplate(name);
|
|
30
|
+
var componentJSIBinderHTemplate = new templates_1.ComponentJSIBinderHTemplate(name, _this.codegenNoticeLines);
|
|
31
|
+
var componentUtilsTSTemplate = new templates_1.ComponentUtilsTSTemplate(name, _this.codegenNoticeLines, _this.rnohImport);
|
|
32
|
+
shape.props.forEach(function (prop) {
|
|
31
33
|
componentJSIBinderHTemplate.addProp({
|
|
32
34
|
name: prop.name,
|
|
33
35
|
isObject: prop.typeAnnotation.type === 'ObjectTypeAnnotation',
|
|
@@ -39,7 +41,7 @@ class ArkTSComponentCodeGeneratorArkTS {
|
|
|
39
41
|
isOptional: prop.optional,
|
|
40
42
|
});
|
|
41
43
|
});
|
|
42
|
-
shape.commands.forEach((command)
|
|
44
|
+
shape.commands.forEach(function (command) {
|
|
43
45
|
componentJSIBinderHTemplate.addCommand({
|
|
44
46
|
name: command.name,
|
|
45
47
|
});
|
|
@@ -47,13 +49,15 @@ class ArkTSComponentCodeGeneratorArkTS {
|
|
|
47
49
|
name: command.name,
|
|
48
50
|
argsTSType: '[' +
|
|
49
51
|
command.typeAnnotation.params
|
|
50
|
-
.map(
|
|
51
|
-
(param.
|
|
52
|
+
.map(function (param) {
|
|
53
|
+
return typeAnnotationToTS.convert(param.typeAnnotation) +
|
|
54
|
+
(param.optional ? '?' : '');
|
|
55
|
+
})
|
|
52
56
|
.join(', ') +
|
|
53
57
|
']',
|
|
54
58
|
});
|
|
55
59
|
});
|
|
56
|
-
shape.events.forEach((event)
|
|
60
|
+
shape.events.forEach(function (event) {
|
|
57
61
|
componentUtilsTSTemplate.addEvent({
|
|
58
62
|
name: (0, core_1.createEventNameFromEventHandlerName)(event.name),
|
|
59
63
|
payloadTSType: event.typeAnnotation.argument
|
|
@@ -65,15 +69,18 @@ class ArkTSComponentCodeGeneratorArkTS {
|
|
|
65
69
|
eventHandlerName: event.name,
|
|
66
70
|
});
|
|
67
71
|
});
|
|
68
|
-
result.set(
|
|
69
|
-
result.set(
|
|
70
|
-
result.set(
|
|
71
|
-
|
|
72
|
-
name,
|
|
73
|
-
eventNames: shape.events.map((e)
|
|
72
|
+
result.set(_this.cppOutputPath.copyWithNewSegment("".concat(name, "ComponentDescriptor.h")), componentDescriptorHTemplate.build());
|
|
73
|
+
result.set(_this.cppOutputPath.copyWithNewSegment("".concat(name, "JSIBinder.h")), componentJSIBinderHTemplate.build());
|
|
74
|
+
result.set(_this.tsOutputPath.copyWithNewSegment("".concat(name, ".ts")), componentUtilsTSTemplate.build());
|
|
75
|
+
_this.glueCodeDataItems.push({
|
|
76
|
+
name: name,
|
|
77
|
+
eventNames: shape.events.map(function (e) {
|
|
78
|
+
return (0, core_1.createEventNameFromEventHandlerName)(e.name);
|
|
79
|
+
}),
|
|
74
80
|
});
|
|
75
81
|
});
|
|
76
82
|
return result;
|
|
77
|
-
}
|
|
78
|
-
|
|
83
|
+
};
|
|
84
|
+
return ArkTSComponentCodeGeneratorArkTS;
|
|
85
|
+
}());
|
|
79
86
|
exports.ArkTSComponentCodeGeneratorArkTS = ArkTSComponentCodeGeneratorArkTS;
|