@react-native-oh/react-native-harmony-cli 0.77.33 → 0.77.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assetResolver.js +43 -74
- package/dist/autolinking/Autolinking.js +178 -179
- package/dist/codegen/core/CodegenError.js +3 -23
- package/dist/codegen/core/EventUtils.js +3 -3
- package/dist/codegen/core/TypeAnnotationToTS.js +24 -28
- package/dist/codegen/core/UberSchema.js +55 -97
- package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +28 -41
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +27 -34
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +25 -33
- package/dist/codegen/generators/CppComponentCodeGenerator.js +23 -28
- package/dist/codegen/generators/LibGlueCodeGenerator.js +26 -29
- package/dist/codegen/generators/NativeModuleCodeGenerator.js +25 -30
- package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
- package/dist/codegen/generators/UberGeneratorV1.js +24 -23
- package/dist/codegen/generators/UberGeneratorV2.js +34 -35
- package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +50 -24
- package/dist/codegen/templates/BasePackageHTemplate.js +120 -21
- package/dist/codegen/templates/ComponentDescriptorHTemplate.js +54 -8
- package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +75 -27
- package/dist/codegen/templates/ComponentUtilsTSTemplate.js +162 -29
- package/dist/codegen/templates/IndexTSTemplate.js +37 -17
- package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +119 -24
- package/dist/codegen/templates/TurboModuleCppTemplate.js +38 -15
- package/dist/codegen/templates/TurboModuleHTemplate.js +32 -11
- package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +52 -19
- package/dist/commands/bundle-harmony.js +118 -221
- package/dist/commands/clean-harmony.js +58 -63
- package/dist/commands/codegen-harmony.js +105 -165
- package/dist/commands/codegen-lib-harmony.js +76 -116
- package/dist/commands/init-harmony.js +151 -196
- package/dist/commands/init.js +537 -961
- package/dist/commands/link-harmony.js +35 -82
- package/dist/commands/run-harmony.js +372 -518
- package/dist/commands/verify-package-harmony.js +54 -117
- package/dist/core/AbsolutePath.js +33 -49
- package/dist/core/CodegenConfig.js +24 -22
- package/dist/core/DescriptiveError.js +18 -37
- package/dist/core/FileSystem.js +14 -18
- package/dist/core/OHPackageJSON5.js +17 -23
- package/dist/core/PackageJSON.js +26 -42
- package/dist/core/ProjectDependenciesManager.js +40 -92
- package/dist/core/ValidationError.js +2 -22
- package/dist/core/fs.js +10 -7
- package/dist/index.js +1 -1
- package/dist/init/templates/AppScopeAppJSON5Template.js +21 -8
- package/dist/init/templates/AppScopeStringVarTemplate.js +19 -8
- package/dist/init/templates/EntryIndexTemplate.js +56 -8
- package/dist/init/templates/EntryStringVarTemplate.js +27 -8
- package/dist/init/templates/HvigorConfigJson5Template.js +33 -8
- package/dist/init/templates/MetroConfigTemplate.js +38 -8
- package/dist/init/templates/OhPackageJson5Template.js +28 -8
- package/dist/init/templates/harmony/AppScope/app.json5 +10 -0
- package/dist/init/templates/harmony/AppScope/resources/base/element/string.json +8 -0
- package/dist/init/templates/harmony/AppScope/resources/base/media/app_icon.png +0 -0
- package/dist/init/templates/harmony/build-profile.json5 +36 -0
- package/dist/init/templates/harmony/codelinter.json +32 -0
- package/dist/init/templates/harmony/entry/build-profile.json5 +18 -0
- package/dist/init/templates/harmony/entry/gitignore +7 -0
- package/dist/init/templates/harmony/entry/hvigorfile.ts +13 -0
- package/dist/init/templates/harmony/entry/oh-package.json5 +9 -0
- package/dist/init/templates/harmony/entry/src/main/cpp/CMakeLists.txt +27 -0
- package/dist/init/templates/harmony/entry/src/main/cpp/PackageProvider.cpp +13 -0
- package/dist/init/templates/harmony/entry/src/main/cpp/gitignore +4 -0
- package/dist/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +8 -0
- package/dist/init/templates/harmony/entry/src/main/ets/codegen/gitignore +2 -0
- package/dist/init/templates/harmony/entry/src/main/ets/entryability/EntryAbility.ets +11 -0
- package/dist/init/templates/harmony/entry/src/main/ets/gitignore +1 -0
- 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 +16 -0
- package/dist/init/templates/harmony/entry/src/main/module.json5 +65 -0
- package/dist/init/templates/harmony/entry/src/main/resources/base/element/color.json +8 -0
- package/dist/init/templates/harmony/entry/src/main/resources/base/element/string.json +16 -0
- 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 +7 -0
- 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 +5 -0
- package/dist/init/templates/harmony/entry/src/main/resources/gitignore +1 -0
- package/dist/init/templates/harmony/entry/src/ohosTest/ets/test/List.test.ets +2 -0
- package/dist/init/templates/harmony/entry/src/ohosTest/module.json5 +13 -0
- package/dist/init/templates/harmony/gitignore +16 -0
- package/dist/init/templates/harmony/hvigor/hvigor-config.json5 +22 -0
- package/dist/init/templates/harmony/hvigorfile.ts +7 -0
- package/dist/io/CliExecutor.js +46 -98
- package/dist/io/Logger.js +40 -46
- package/dist/io/RealFS.js +43 -100
- package/dist/io/TarGz.js +11 -8
- package/dist/io/__fixtures__.js +79 -141
- package/dist/io/fsUtils.js +13 -12
- package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +19 -47
- package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +13 -41
- package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +8 -38
- package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +22 -54
- package/dist/package-verifier/verify-package.js +56 -133
- package/dist/simulator/LaunchSimulator.js +224 -301
- package/harmony/rnoh-hvigor-plugin-0.77.40.tgz +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0271b9dd +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/07ba0208 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/082dd09d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0a9e1b0b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0c3d528a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1014d3ff +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1184678c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/12621366 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/126d3e66 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/19262852 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/203fac53 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/237b660a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2528002d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2587d041 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2893bd11 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2af6ff9d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2bf31f33 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/333648cc +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/386f6df0 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3b8c270e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3bcc34ba +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/444808bd +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/44a775e2 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/46da3ccd +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/51f80e35 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5203a2ca +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/52795646 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/577f8208 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5c2aafe7 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5c69bcfe +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/62695b92 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/62698102 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6411ab00 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6569ba92 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/65e5133c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/66029655 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/69e85d0d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6afcb99e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6de07367 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/72498307 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7babd1de +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7fe56d21 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/810cbd72 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/812386d2 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8448897d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/84ab0a41 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/853825e2 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/862ad93a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/86b14da6 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/87f0fe62 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/88ee8f74 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8c5237c9 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8c725800 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8e83cbe1 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8f4085b9 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/931f0b2e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/940c8f92 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/968191a3 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/970780c0 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/98bc4394 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/99a3b0b0 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/9c0ffa6b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/9d9b42c2 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a04266ef +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a18f78c5 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a642fb0e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a97edf40 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/aa672a20 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ae25c61a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b2bebae6 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ba492422 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/bd3e6c21 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/be9e564e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c342b18e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c3993e7e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c52ffd54 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c7079ad4 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c8eb01c1 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/caee5d30 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cf039161 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d0377c40 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d262bc85 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d287cb5c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d64bff57 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d716a608 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d751012b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e0873711 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e1fcf77b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e8548d8a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/eaedd71d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/eca0019e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f7189953 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f75cb201 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f888164b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/fdb9eb5a +0 -0
- package/package.json +1 -1
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ArkTSComponentCodeGeneratorCAPI = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const core_1 = require("../core");
|
|
5
|
+
const templates_1 = require("../templates");
|
|
6
6
|
/**
|
|
7
7
|
* Generates component code for ArkTS components used in C-API architecture.
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
class ArkTSComponentCodeGeneratorCAPI {
|
|
10
|
+
constructor(cppOutputPath, tsOutputPath, codegenNoticeLines, rnohImport) {
|
|
11
11
|
this.cppOutputPath = cppOutputPath;
|
|
12
12
|
this.tsOutputPath = tsOutputPath;
|
|
13
13
|
this.codegenNoticeLines = codegenNoticeLines;
|
|
14
14
|
this.rnohImport = rnohImport;
|
|
15
15
|
this.glueCodeDataItems = [];
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
getLibGlueCodeData() {
|
|
18
18
|
return this.glueCodeDataItems;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var componentJSIBinderHTemplate = new templates_1.ComponentJSIBinderHTemplate(name, _this.codegenNoticeLines);
|
|
30
|
-
var componentUtilsTSTemplate = new templates_1.ComponentUtilsTSTemplate(name, _this.codegenNoticeLines, _this.rnohImport);
|
|
31
|
-
shape.props.forEach(function (prop) {
|
|
19
|
+
}
|
|
20
|
+
generate(uberSchema) {
|
|
21
|
+
const typeAnnotationToTS = new core_1.TypeAnnotationToTS();
|
|
22
|
+
const result = new Map();
|
|
23
|
+
const componentSpecSchemas = uberSchema.findAllSpecSchemasByType('Component');
|
|
24
|
+
for (const componentSpecSchema of componentSpecSchemas) {
|
|
25
|
+
Object.entries(componentSpecSchema.components).map(([name, shape]) => {
|
|
26
|
+
const componentJSIBinderHTemplate = new templates_1.ComponentJSIBinderHTemplate(name, this.codegenNoticeLines);
|
|
27
|
+
const componentUtilsTSTemplate = new templates_1.ComponentUtilsTSTemplate(name, this.codegenNoticeLines, this.rnohImport);
|
|
28
|
+
shape.props.forEach((prop) => {
|
|
32
29
|
componentJSIBinderHTemplate.addProp({
|
|
33
30
|
name: prop.name,
|
|
34
31
|
isObject: prop.typeAnnotation.type === 'ObjectTypeAnnotation',
|
|
@@ -40,7 +37,7 @@ var ArkTSComponentCodeGeneratorCAPI = /** @class */ (function () {
|
|
|
40
37
|
isOptional: prop.optional,
|
|
41
38
|
});
|
|
42
39
|
});
|
|
43
|
-
shape.commands.forEach(
|
|
40
|
+
shape.commands.forEach((command) => {
|
|
44
41
|
componentJSIBinderHTemplate.addCommand({
|
|
45
42
|
name: command.name,
|
|
46
43
|
});
|
|
@@ -48,15 +45,13 @@ var ArkTSComponentCodeGeneratorCAPI = /** @class */ (function () {
|
|
|
48
45
|
name: command.name,
|
|
49
46
|
argsTSType: '[' +
|
|
50
47
|
command.typeAnnotation.params
|
|
51
|
-
.map(
|
|
52
|
-
|
|
53
|
-
(param.optional ? '?' : '');
|
|
54
|
-
})
|
|
48
|
+
.map((param) => typeAnnotationToTS.convert(param.typeAnnotation) +
|
|
49
|
+
(param.optional ? '?' : ''))
|
|
55
50
|
.join(', ') +
|
|
56
51
|
']',
|
|
57
52
|
});
|
|
58
53
|
});
|
|
59
|
-
shape.events.forEach(
|
|
54
|
+
shape.events.forEach((event) => {
|
|
60
55
|
componentUtilsTSTemplate.addEvent({
|
|
61
56
|
name: (0, core_1.createEventNameFromEventHandlerName)(event.name),
|
|
62
57
|
payloadTSType: event.typeAnnotation.argument
|
|
@@ -68,18 +63,15 @@ var ArkTSComponentCodeGeneratorCAPI = /** @class */ (function () {
|
|
|
68
63
|
eventHandlerName: event.name,
|
|
69
64
|
});
|
|
70
65
|
});
|
|
71
|
-
result.set(
|
|
72
|
-
result.set(
|
|
73
|
-
|
|
66
|
+
result.set(this.cppOutputPath.copyWithNewSegment(`${name}JSIBinder.h`), componentJSIBinderHTemplate.build());
|
|
67
|
+
result.set(this.tsOutputPath.copyWithNewSegment(`${name}.ts`), componentUtilsTSTemplate.build());
|
|
68
|
+
this.glueCodeDataItems.push({
|
|
74
69
|
componentName: name,
|
|
75
|
-
eventNames: shape.events.map(
|
|
76
|
-
return (0, core_1.createEventNameFromEventHandlerName)(event.name);
|
|
77
|
-
}),
|
|
70
|
+
eventNames: shape.events.map((event) => (0, core_1.createEventNameFromEventHandlerName)(event.name)),
|
|
78
71
|
});
|
|
79
72
|
});
|
|
80
73
|
}
|
|
81
74
|
return result;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
}());
|
|
75
|
+
}
|
|
76
|
+
}
|
|
85
77
|
exports.ArkTSComponentCodeGeneratorCAPI = ArkTSComponentCodeGeneratorCAPI;
|
|
@@ -1,64 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CppComponentCodeGenerator = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const templates_1 = require("../templates");
|
|
5
|
+
class CppComponentCodeGenerator {
|
|
6
|
+
constructor(onGetRNOHOutputPath, codegenNoticeLines) {
|
|
7
7
|
this.onGetRNOHOutputPath = onGetRNOHOutputPath;
|
|
8
8
|
this.codegenNoticeLines = codegenNoticeLines;
|
|
9
9
|
this.glueCodeComponentsData = [];
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
getGlueCodeData() {
|
|
12
12
|
return this.glueCodeComponentsData;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var fileContentByPath = new Map();
|
|
18
|
-
for (var _i = 0, _b = uberSchema
|
|
13
|
+
}
|
|
14
|
+
generate({ libraryCppName, uberSchema, }) {
|
|
15
|
+
const fileContentByPath = new Map();
|
|
16
|
+
for (const [_filename, schema] of uberSchema
|
|
19
17
|
.getSpecSchemaByFilenameMap()
|
|
20
|
-
.entries()
|
|
21
|
-
var _c = _b[_i], _filename = _c[0], schema = _c[1];
|
|
18
|
+
.entries()) {
|
|
22
19
|
if (schema.type === 'Component') {
|
|
23
|
-
Object.entries(schema.components).map(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
shape.props.forEach(function (prop) {
|
|
20
|
+
Object.entries(schema.components).map(([componentName, shape]) => {
|
|
21
|
+
const componentJSIBinderHTemplate = new templates_1.ComponentJSIBinderHTemplate(componentName, this.codegenNoticeLines);
|
|
22
|
+
const componentInstanceSpecHTemplate = new templates_1.BaseComponentInstanceHTemplate(componentName, libraryCppName, this.codegenNoticeLines);
|
|
23
|
+
shape.props.forEach((prop) => {
|
|
28
24
|
componentJSIBinderHTemplate.addProp({
|
|
29
25
|
name: prop.name,
|
|
30
26
|
isObject: prop.typeAnnotation.type === 'ObjectTypeAnnotation',
|
|
31
27
|
});
|
|
32
28
|
});
|
|
33
|
-
shape.events.forEach(
|
|
29
|
+
shape.events.forEach((event) => {
|
|
34
30
|
componentJSIBinderHTemplate.addEvent({
|
|
35
31
|
type: event.bubblingType,
|
|
36
32
|
eventHandlerName: event.name,
|
|
37
33
|
});
|
|
38
34
|
});
|
|
39
|
-
shape.commands.forEach(
|
|
35
|
+
shape.commands.forEach((command) => {
|
|
40
36
|
componentJSIBinderHTemplate.addCommand({
|
|
41
37
|
name: command.name,
|
|
42
38
|
});
|
|
43
39
|
componentInstanceSpecHTemplate.addCommand({
|
|
44
40
|
name: command.name,
|
|
45
|
-
args: command.typeAnnotation.params.map(
|
|
41
|
+
args: command.typeAnnotation.params.map((param) => ({
|
|
46
42
|
name: param.name,
|
|
47
43
|
typeAnnotation: param.typeAnnotation,
|
|
48
|
-
})
|
|
44
|
+
})),
|
|
49
45
|
});
|
|
50
46
|
});
|
|
51
|
-
fileContentByPath.set(
|
|
52
|
-
fileContentByPath.set(
|
|
53
|
-
|
|
47
|
+
fileContentByPath.set(this.onGetRNOHOutputPath(`${componentName}JSIBinder.h`), componentJSIBinderHTemplate.build());
|
|
48
|
+
fileContentByPath.set(this.onGetRNOHOutputPath(`Base${componentName}ComponentInstance.h`), componentInstanceSpecHTemplate.build());
|
|
49
|
+
this.glueCodeComponentsData.push({
|
|
54
50
|
name: componentName,
|
|
55
|
-
libraryCppName
|
|
51
|
+
libraryCppName,
|
|
56
52
|
});
|
|
57
53
|
});
|
|
58
54
|
}
|
|
59
55
|
}
|
|
60
56
|
return fileContentByPath;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
}());
|
|
57
|
+
}
|
|
58
|
+
}
|
|
64
59
|
exports.CppComponentCodeGenerator = CppComponentCodeGenerator;
|
|
@@ -1,43 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.LibGlueCodeGenerator = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
const case_1 = __importDefault(require("case"));
|
|
8
|
+
const BasePackageHTemplate_1 = require("../templates/BasePackageHTemplate");
|
|
9
|
+
const templates_1 = require("../templates");
|
|
7
10
|
/**
|
|
8
11
|
* NOTE: This class is coupled with the generated code structure defined in the codegen-harmony-lib.
|
|
9
12
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
class LibGlueCodeGenerator {
|
|
14
|
+
constructor(cppOutputPath, etsOutputPath, codegenNoticeLines) {
|
|
12
15
|
this.cppOutputPath = cppOutputPath;
|
|
13
16
|
this.etsOutputPath = etsOutputPath;
|
|
14
17
|
this.codegenNoticeLines = codegenNoticeLines;
|
|
15
18
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
turboModules.forEach(function (turboModule) {
|
|
19
|
+
generate({ libraryCppName, turboModules, arkTSComponents, cppComponents, }) {
|
|
20
|
+
const fileContentByPath = new Map();
|
|
21
|
+
const basePackageClassName = `Base${case_1.default.pascal(libraryCppName)}Package`;
|
|
22
|
+
const turboModules_indexTS = new templates_1.IndexTSTemplate(this.codegenNoticeLines);
|
|
23
|
+
const components_indexTS = new templates_1.IndexTSTemplate(this.codegenNoticeLines);
|
|
24
|
+
const generated_indexETS = new templates_1.IndexTSTemplate(this.codegenNoticeLines);
|
|
25
|
+
const basePackageTemplate = new BasePackageHTemplate_1.BasePackageHTemplate(basePackageClassName, this.codegenNoticeLines);
|
|
26
|
+
turboModules.forEach((turboModule) => {
|
|
25
27
|
basePackageTemplate.addTurboModule(turboModule);
|
|
26
|
-
turboModules_indexTS.addReexport({ from:
|
|
28
|
+
turboModules_indexTS.addReexport({ from: `./${turboModule.name}` });
|
|
27
29
|
});
|
|
28
|
-
arkTSComponents.forEach(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
basePackageTemplate.
|
|
32
|
-
eventNames.forEach(function (eventName) {
|
|
33
|
-
return basePackageTemplate.addArkTSEvent({ name: eventName });
|
|
34
|
-
});
|
|
30
|
+
arkTSComponents.forEach(({ componentName, eventNames }) => {
|
|
31
|
+
components_indexTS.addReexport({ from: `./${componentName}` });
|
|
32
|
+
basePackageTemplate.addComponent({ name: componentName, libraryCppName, isArkTSComponent: true });
|
|
33
|
+
eventNames.forEach((eventName) => basePackageTemplate.addArkTSEvent({ name: eventName }));
|
|
35
34
|
});
|
|
36
|
-
cppComponents.forEach(
|
|
37
|
-
|
|
38
|
-
basePackageTemplate.addComponent({ name: componentName, libraryCppName: libraryCppName, isArkTSComponent: false });
|
|
35
|
+
cppComponents.forEach(({ componentName }) => {
|
|
36
|
+
basePackageTemplate.addComponent({ name: componentName, libraryCppName, isArkTSComponent: false });
|
|
39
37
|
});
|
|
40
|
-
fileContentByPath.set(this.cppOutputPath.copyWithNewSegment('RNOH', 'generated',
|
|
38
|
+
fileContentByPath.set(this.cppOutputPath.copyWithNewSegment('RNOH', 'generated', `${basePackageClassName}.h`), basePackageTemplate.build());
|
|
41
39
|
fileContentByPath.set(this.etsOutputPath.copyWithNewSegment('components', 'ts.ts'), components_indexTS.build());
|
|
42
40
|
fileContentByPath.set(this.etsOutputPath.copyWithNewSegment('turboModules', 'ts.ts'), turboModules_indexTS.build());
|
|
43
41
|
fileContentByPath.set(this.etsOutputPath.copyWithNewSegment('ts.ts'), new templates_1.IndexTSTemplate(this.codegenNoticeLines)
|
|
@@ -47,7 +45,6 @@ var LibGlueCodeGenerator = /** @class */ (function () {
|
|
|
47
45
|
generated_indexETS.addReexport({ from: './ts' });
|
|
48
46
|
fileContentByPath.set(this.etsOutputPath.copyWithNewSegment('index.ets'), generated_indexETS.build());
|
|
49
47
|
return fileContentByPath;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}());
|
|
48
|
+
}
|
|
49
|
+
}
|
|
53
50
|
exports.LibGlueCodeGenerator = LibGlueCodeGenerator;
|
|
@@ -1,55 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NativeModuleCodeGenerator = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const templates_1 = require("../templates");
|
|
5
|
+
const core_1 = require("../core");
|
|
6
6
|
/**
|
|
7
7
|
* Generates boilerplate code for Turbo Modules.
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
class NativeModuleCodeGenerator {
|
|
10
|
+
constructor(cppOutputPath, etsOutputPath, codegenNoticeLines, rnohImport) {
|
|
11
11
|
this.cppOutputPath = cppOutputPath;
|
|
12
12
|
this.etsOutputPath = etsOutputPath;
|
|
13
13
|
this.codegenNoticeLines = codegenNoticeLines;
|
|
14
14
|
this.rnohImport = rnohImport;
|
|
15
15
|
this.glueCodeTurboModulesData = [];
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
getGlueCodeData() {
|
|
18
18
|
return this.glueCodeTurboModulesData;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
}
|
|
20
|
+
generate(schema) {
|
|
21
|
+
const result = new Map();
|
|
22
22
|
if (schema.type !== 'NativeModule') {
|
|
23
23
|
throw new core_1.CodegenError({
|
|
24
|
-
whatHappened:
|
|
24
|
+
whatHappened: `NativeModuleCodeGenerator can't generate code for module type: ${schema.type}`,
|
|
25
25
|
unexpected: true,
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
result.set(this.cppOutputPath.copyWithNewSegment(
|
|
32
|
-
|
|
33
|
-
Object.entries(schema.aliasMap).map(
|
|
34
|
-
var name = _a[0], typeAnnotation = _a[1];
|
|
28
|
+
const typeAnnotationToTS = new core_1.TypeAnnotationToTS();
|
|
29
|
+
const turboModuleInterfaceTS = new templates_1.TurboModuleInterfaceTS(schema.moduleName, this.codegenNoticeLines, this.rnohImport);
|
|
30
|
+
const turboModuleH = new templates_1.TurboModuleHTemplate(schema.moduleName, this.codegenNoticeLines).build();
|
|
31
|
+
result.set(this.cppOutputPath.copyWithNewSegment(`${schema.moduleName}.h`), turboModuleH);
|
|
32
|
+
const turboModuleCpp = new templates_1.TurboModuleCppTemplate(schema.moduleName, this.codegenNoticeLines);
|
|
33
|
+
Object.entries(schema.aliasMap).map(([name, typeAnnotation]) => {
|
|
35
34
|
turboModuleInterfaceTS.addAlias({
|
|
36
35
|
name: name,
|
|
37
36
|
type: typeAnnotationToTS.convert(typeAnnotation),
|
|
38
37
|
});
|
|
39
38
|
});
|
|
40
|
-
Object.entries(schema.enumMap).map(
|
|
41
|
-
var name = _a[0], enumSpec = _a[1];
|
|
39
|
+
Object.entries(schema.enumMap).map(([name, enumSpec]) => {
|
|
42
40
|
turboModuleInterfaceTS.addEnum({
|
|
43
|
-
name
|
|
44
|
-
members: enumSpec.members.map(
|
|
41
|
+
name,
|
|
42
|
+
members: enumSpec.members.map((member) => ({
|
|
45
43
|
name: member.name,
|
|
46
44
|
value: typeof member.value === 'string'
|
|
47
45
|
? (0, core_1.wrapWithQuotes)(member.value)
|
|
48
46
|
: member.value.toString(),
|
|
49
|
-
})
|
|
47
|
+
})),
|
|
50
48
|
});
|
|
51
49
|
});
|
|
52
|
-
schema.spec.methods.map(
|
|
50
|
+
schema.spec.methods.map((prop) => {
|
|
53
51
|
if (prop.typeAnnotation.type === 'FunctionTypeAnnotation') {
|
|
54
52
|
turboModuleCpp.addMethod({
|
|
55
53
|
name: prop.name,
|
|
@@ -61,18 +59,15 @@ var NativeModuleCodeGenerator = /** @class */ (function () {
|
|
|
61
59
|
name: prop.name,
|
|
62
60
|
returnType: typeAnnotationToTS.convert(prop.typeAnnotation.returnTypeAnnotation),
|
|
63
61
|
stringifiedArgs: prop.typeAnnotation.params
|
|
64
|
-
.map(
|
|
65
|
-
return "".concat(param.name, ": ").concat(typeAnnotationToTS.convert(param.typeAnnotation));
|
|
66
|
-
})
|
|
62
|
+
.map((param) => `${param.name}: ${typeAnnotationToTS.convert(param.typeAnnotation)}`)
|
|
67
63
|
.join(', '),
|
|
68
64
|
});
|
|
69
65
|
}
|
|
70
66
|
});
|
|
71
|
-
result.set(this.cppOutputPath.copyWithNewSegment(
|
|
72
|
-
result.set(this.etsOutputPath.copyWithNewSegment(
|
|
67
|
+
result.set(this.cppOutputPath.copyWithNewSegment(`${schema.moduleName}.cpp`), turboModuleCpp.build());
|
|
68
|
+
result.set(this.etsOutputPath.copyWithNewSegment(`${schema.moduleName}.ts`), turboModuleInterfaceTS.build());
|
|
73
69
|
this.glueCodeTurboModulesData.push({ name: schema.moduleName });
|
|
74
70
|
return result;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
}());
|
|
71
|
+
}
|
|
72
|
+
}
|
|
78
73
|
exports.NativeModuleCodeGenerator = NativeModuleCodeGenerator;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.SharedComponentCodeGenerator = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
const RNCodegen_1 = __importDefault(require("@react-native/codegen/lib/generators/RNCodegen"));
|
|
8
|
+
class SharedComponentCodeGenerator {
|
|
9
|
+
constructor(onGetSharedOutputPath) {
|
|
7
10
|
this.onGetSharedOutputPath = onGetSharedOutputPath;
|
|
8
11
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var fileContentByPath = new Map();
|
|
13
|
-
var generatorFns = [
|
|
12
|
+
generate({ libraryCppName, uberSchema, }) {
|
|
13
|
+
const fileContentByPath = new Map();
|
|
14
|
+
const generatorFns = [
|
|
14
15
|
RNCodegen_1.default.allGenerators.generatePropsH,
|
|
15
16
|
RNCodegen_1.default.allGenerators.generatePropsCpp,
|
|
16
17
|
RNCodegen_1.default.allGenerators.generateEventEmitterH,
|
|
@@ -21,14 +22,13 @@ var SharedComponentCodeGenerator = /** @class */ (function () {
|
|
|
21
22
|
RNCodegen_1.default.allGenerators.generateShadowNodeH,
|
|
22
23
|
RNCodegen_1.default.allGenerators.generateShadowNodeCpp,
|
|
23
24
|
];
|
|
24
|
-
generatorFns.forEach(
|
|
25
|
-
|
|
26
|
-
filesOutput.forEach(
|
|
27
|
-
fileContentByPath.set(
|
|
25
|
+
generatorFns.forEach((generate) => {
|
|
26
|
+
const filesOutput = generate(libraryCppName, uberSchema.getValue(), 'UNUSED_packageName', true);
|
|
27
|
+
filesOutput.forEach((fileContent, filename) => {
|
|
28
|
+
fileContentByPath.set(this.onGetSharedOutputPath(filename), fileContent);
|
|
28
29
|
});
|
|
29
30
|
});
|
|
30
31
|
return fileContentByPath;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
}());
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
34
|
exports.SharedComponentCodeGenerator = SharedComponentCodeGenerator;
|
|
@@ -1,47 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.UberGeneratorV1 = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const core_1 = require("../core");
|
|
9
|
+
const NativeModuleCodeGenerator_1 = require("./NativeModuleCodeGenerator");
|
|
10
|
+
const ArkTSComponentCodeGeneratorArkTS_1 = require("./ArkTSComponentCodeGeneratorArkTS");
|
|
8
11
|
// The name of rnoh OHOS module
|
|
9
|
-
|
|
12
|
+
const RNOH_OHOS_NAME = '@rnoh/react-native-openharmony';
|
|
10
13
|
/**
|
|
11
14
|
* Generates code for libraries built on top of RNOH's ArkTS architecture.
|
|
12
15
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
class UberGeneratorV1 {
|
|
17
|
+
constructor(cppOutputPath, etsOutputPath, codegenNoticeLines) {
|
|
15
18
|
this.cppOutputPath = cppOutputPath;
|
|
16
19
|
this.etsOutputPath = etsOutputPath;
|
|
17
20
|
this.codegenNoticeLines = codegenNoticeLines;
|
|
18
21
|
this.glueCodeData = { components: [], turboModules: [] };
|
|
19
22
|
}
|
|
20
|
-
|
|
23
|
+
getGlueCodeData() {
|
|
21
24
|
return this.glueCodeData;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
}
|
|
26
|
+
generate(uberSchema) {
|
|
27
|
+
const fileContentByPath = new Map();
|
|
28
|
+
const isRNOHModulePath = this.etsOutputPath.getValue().endsWith(`${RNOH_OHOS_NAME}/generated`.replace(/\//g, path_1.default.sep));
|
|
29
|
+
const componentCodeGenerator = new ArkTSComponentCodeGeneratorArkTS_1.ArkTSComponentCodeGeneratorArkTS(this.cppOutputPath, this.etsOutputPath.copyWithNewSegment('components'), this.codegenNoticeLines, isRNOHModulePath ? '../../ts' : `${RNOH_OHOS_NAME}/ts`);
|
|
30
|
+
const nativeModuleCodeGenerator = new NativeModuleCodeGenerator_1.NativeModuleCodeGenerator(this.cppOutputPath, this.etsOutputPath.copyWithNewSegment('turboModules'), this.codegenNoticeLines, isRNOHModulePath ? '../../ts' : `${RNOH_OHOS_NAME}/ts`);
|
|
31
|
+
const generatorBySpecType = {
|
|
29
32
|
Component: componentCodeGenerator,
|
|
30
33
|
NativeModule: nativeModuleCodeGenerator,
|
|
31
34
|
};
|
|
32
|
-
for (
|
|
35
|
+
for (const [_fileName, specSchema] of uberSchema
|
|
33
36
|
.getSpecSchemaByFilenameMap()
|
|
34
|
-
.entries()
|
|
35
|
-
var _b = _a[_i], _fileName = _b[0], specSchema = _b[1];
|
|
37
|
+
.entries()) {
|
|
36
38
|
if (!(specSchema.type in generatorBySpecType)) {
|
|
37
39
|
throw new core_1.CodegenError({
|
|
38
|
-
whatHappened:
|
|
40
|
+
whatHappened: `Could not find a code generator for a specification of type '${specSchema.type}'`,
|
|
39
41
|
unexpected: true,
|
|
40
42
|
});
|
|
41
43
|
}
|
|
42
44
|
generatorBySpecType[specSchema.type]
|
|
43
45
|
.generate(specSchema)
|
|
44
|
-
.forEach(
|
|
46
|
+
.forEach((fileContent, filePath) => {
|
|
45
47
|
fileContentByPath.set(filePath, fileContent);
|
|
46
48
|
});
|
|
47
49
|
}
|
|
@@ -50,7 +52,6 @@ var UberGeneratorV1 = /** @class */ (function () {
|
|
|
50
52
|
turboModules: nativeModuleCodeGenerator.getGlueCodeData(),
|
|
51
53
|
};
|
|
52
54
|
return fileContentByPath;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}());
|
|
55
|
+
}
|
|
56
|
+
}
|
|
56
57
|
exports.UberGeneratorV1 = UberGeneratorV1;
|
|
@@ -1,79 +1,78 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.UberGeneratorV2 = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const CppComponentCodeGenerator_1 = require("./CppComponentCodeGenerator");
|
|
9
|
+
const NativeModuleCodeGenerator_1 = require("./NativeModuleCodeGenerator");
|
|
10
|
+
const SharedComponentCodeGenerator_1 = require("./SharedComponentCodeGenerator");
|
|
8
11
|
// The name of rnoh OHOS module
|
|
9
|
-
|
|
12
|
+
const RNOH_OHOS_NAME = '@rnoh/react-native-openharmony';
|
|
10
13
|
/**
|
|
11
14
|
* Generates code for libraries built on top of RNOH's C-API architecture.
|
|
12
15
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
class UberGeneratorV2 {
|
|
17
|
+
constructor(cppOutputPath, etsOutputPath, codegenNoticeLines) {
|
|
15
18
|
this.cppOutputPath = cppOutputPath;
|
|
16
19
|
this.etsOutputPath = etsOutputPath;
|
|
17
20
|
this.codegenNoticeLines = codegenNoticeLines;
|
|
18
21
|
this.glueCodeData = new Map();
|
|
19
22
|
}
|
|
20
|
-
|
|
23
|
+
getGlueCodeData() {
|
|
21
24
|
return this.glueCodeData;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var libraryCppName = _a.libraryCppName, uberSchema = _a.uberSchema;
|
|
28
|
-
_this.glueCodeData.set(libraryCppName, {
|
|
25
|
+
}
|
|
26
|
+
generate(npmPackagesInfo) {
|
|
27
|
+
const fileContentByPath = new Map();
|
|
28
|
+
npmPackagesInfo.forEach(({ libraryCppName, uberSchema }) => {
|
|
29
|
+
this.glueCodeData.set(libraryCppName, {
|
|
29
30
|
components: [],
|
|
30
31
|
turboModules: [],
|
|
31
32
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const libraryGlueCodeData = this.glueCodeData.get(libraryCppName);
|
|
34
|
+
const libraryCppOutput = this.cppOutputPath.copyWithNewSegment(libraryCppName);
|
|
35
|
+
const sharedComponentCodeGenerator = new SharedComponentCodeGenerator_1.SharedComponentCodeGenerator((filename) => {
|
|
35
36
|
return libraryCppOutput.copyWithNewSegment('react', 'renderer', 'components', libraryCppName, filename);
|
|
36
37
|
});
|
|
37
|
-
|
|
38
|
+
const cppComponentCodeGenerator = new CppComponentCodeGenerator_1.CppComponentCodeGenerator((filename) => {
|
|
38
39
|
return libraryCppOutput.copyWithNewSegment('RNOH', 'generated', 'components', filename);
|
|
39
|
-
},
|
|
40
|
+
}, this.codegenNoticeLines);
|
|
40
41
|
cppComponentCodeGenerator
|
|
41
|
-
.generate({ libraryCppName
|
|
42
|
-
.forEach(
|
|
42
|
+
.generate({ libraryCppName, uberSchema })
|
|
43
|
+
.forEach((fileContent, path) => {
|
|
43
44
|
fileContentByPath.set(path, fileContent);
|
|
44
45
|
});
|
|
45
46
|
cppComponentCodeGenerator
|
|
46
47
|
.getGlueCodeData()
|
|
47
|
-
.forEach(
|
|
48
|
+
.forEach((componentGlueCodeData) => {
|
|
48
49
|
libraryGlueCodeData.components.push(componentGlueCodeData);
|
|
49
50
|
});
|
|
50
51
|
sharedComponentCodeGenerator
|
|
51
|
-
.generate({ libraryCppName
|
|
52
|
-
.forEach(
|
|
52
|
+
.generate({ libraryCppName, uberSchema })
|
|
53
|
+
.forEach((fileContent, path) => {
|
|
53
54
|
fileContentByPath.set(path, fileContent);
|
|
54
55
|
});
|
|
55
|
-
for (
|
|
56
|
+
for (const [_fileName, specSchema] of uberSchema
|
|
56
57
|
.getSpecSchemaByFilenameMap()
|
|
57
|
-
.entries()
|
|
58
|
-
var _c = _b[_i], _fileName = _c[0], specSchema = _c[1];
|
|
58
|
+
.entries()) {
|
|
59
59
|
if (specSchema.type === 'NativeModule') {
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
const isRNOHModulePath = this.etsOutputPath.getValue().endsWith(`${RNOH_OHOS_NAME}/generated`.replace(/\//g, path_1.default.sep));
|
|
61
|
+
const nativeModuleCodeGenerator = new NativeModuleCodeGenerator_1.NativeModuleCodeGenerator(libraryCppOutput.copyWithNewSegment('RNOH', 'generated', 'turbo_modules'), this.etsOutputPath.copyWithNewSegment('turboModules'), this.codegenNoticeLines, isRNOHModulePath ? '../../ts' : `${RNOH_OHOS_NAME}/ts`);
|
|
62
62
|
nativeModuleCodeGenerator
|
|
63
63
|
.generate(specSchema)
|
|
64
|
-
.forEach(
|
|
64
|
+
.forEach((fileContent, filePath) => {
|
|
65
65
|
fileContentByPath.set(filePath, fileContent);
|
|
66
66
|
});
|
|
67
67
|
nativeModuleCodeGenerator
|
|
68
68
|
.getGlueCodeData()
|
|
69
|
-
.forEach(
|
|
69
|
+
.forEach((turboModuleGlueCodeData) => {
|
|
70
70
|
libraryGlueCodeData.turboModules.push(turboModuleGlueCodeData);
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
return fileContentByPath;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}());
|
|
76
|
+
}
|
|
77
|
+
}
|
|
79
78
|
exports.UberGeneratorV2 = UberGeneratorV2;
|