@react-native-oh/react-native-harmony-cli 0.0.36 → 0.77.18-1
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/LICENSE +21 -0
- package/README.md +4 -4
- package/dist/autolinking/Autolinking.js +13 -16
- package/dist/autolinking/index.js +0 -6
- package/dist/codegen/core/CodeGenerator.js +0 -6
- package/dist/codegen/core/CodegenError.js +0 -6
- package/dist/codegen/core/EventUtils.js +0 -6
- package/dist/codegen/core/TypeAnnotationToTS.js +0 -6
- package/dist/codegen/core/UberSchema.js +2 -11
- package/dist/codegen/core/index.js +0 -6
- package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +2 -7
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +0 -6
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +0 -6
- package/dist/codegen/generators/CppComponentCodeGenerator.js +0 -6
- package/dist/codegen/generators/LibGlueCodeGenerator.js +2 -8
- package/dist/codegen/generators/NativeModuleCodeGenerator.js +1 -7
- package/dist/codegen/generators/SharedComponentCodeGenerator.js +0 -6
- package/dist/codegen/generators/UberGeneratorV1.js +0 -6
- package/dist/codegen/generators/UberGeneratorV2.js +0 -6
- package/dist/codegen/generators/index.js +0 -6
- package/dist/codegen/index.js +0 -6
- package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +0 -6
- package/dist/codegen/templates/BasePackageHTemplate.js +12 -7
- package/dist/codegen/templates/ComponentDescriptorHTemplate.js +1 -6
- package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +0 -6
- package/dist/codegen/templates/ComponentUtilsTSTemplate.js +0 -6
- package/dist/codegen/templates/IndexTSTemplate.js +0 -6
- package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +12 -7
- package/dist/codegen/templates/TurboModuleCppTemplate.js +0 -6
- package/dist/codegen/templates/TurboModuleHTemplate.js +0 -6
- package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +0 -6
- package/dist/codegen/templates/index.js +0 -6
- package/dist/commands/bundle-harmony.js +131 -36
- package/dist/commands/clean-harmony.js +84 -0
- package/dist/commands/codegen-harmony.js +0 -6
- package/dist/commands/codegen-lib-harmony.js +6 -12
- package/dist/commands/index.js +2 -9
- package/dist/commands/init-harmony.js +226 -0
- package/dist/commands/init.js +0 -0
- package/dist/commands/link-harmony.js +12 -16
- package/dist/commands/types.js +0 -6
- package/dist/commands/verify-package-harmony.js +6 -10
- package/dist/core/AbsolutePath.js +3 -6
- package/dist/core/CodegenConfig.js +0 -6
- package/dist/core/DescriptiveError.js +0 -6
- package/dist/core/FileSystem.js +0 -6
- package/dist/core/OHPackageJSON5.js +0 -6
- package/dist/core/ProjectDependenciesManager.js +6 -14
- package/dist/core/ValidationError.js +0 -6
- package/dist/core/ValueObject.js +0 -6
- package/dist/core/fs.js +13 -6
- package/dist/core/index.js +0 -6
- package/dist/index.js +2 -9
- package/dist/init/templates/AppScopeAppJSON5Template.js +30 -0
- package/dist/init/templates/AppScopeStringVarTemplate.js +28 -0
- package/dist/init/templates/EntryIndexTemplate.js +65 -0
- package/dist/init/templates/EntryStringVarTemplate.js +38 -0
- package/dist/init/templates/HvigorConfigJson5Template.js +44 -0
- package/dist/init/templates/MetroConfigTemplate.js +47 -0
- package/dist/init/templates/OhPackageJson5Template.js +37 -0
- 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 +58 -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/init/templates/index.js +21 -0
- package/dist/io/CliExecutor.js +0 -6
- package/dist/io/Logger.js +0 -6
- package/dist/io/RealFS.js +10 -6
- package/dist/io/TarGz.js +2 -8
- package/dist/io/__fixtures__.js +0 -6
- package/dist/io/fsUtils.js +0 -6
- package/dist/io/index.js +1 -6
- package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +0 -6
- package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +0 -6
- package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +0 -6
- package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +0 -6
- package/dist/package-verifier/checks/index.js +0 -6
- package/dist/package-verifier/index.js +0 -6
- package/dist/package-verifier/types.js +0 -6
- package/dist/package-verifier/verify-package.js +1 -7
- package/harmony/rnoh-hvigor-plugin-0.77.18.tgz +0 -0
- package/jest.config.js +0 -7
- package/package.json +15 -18
- package/react-native.config.js +0 -7
- package/scripts/copy-template.js +18 -0
- package/src/autolinking/Autolinking.test.ts +54 -18
- package/src/autolinking/Autolinking.ts +23 -20
- package/src/autolinking/index.ts +1 -8
- package/src/codegen/core/CodeGenerator.ts +0 -7
- package/src/codegen/core/CodegenError.ts +0 -7
- package/src/codegen/core/EventUtils.ts +0 -7
- package/src/codegen/core/TypeAnnotationToTS.test.ts +0 -7
- package/src/codegen/core/TypeAnnotationToTS.ts +3 -8
- package/src/codegen/core/UberSchema.ts +3 -12
- package/src/codegen/core/index.ts +0 -7
- package/src/codegen/generators/AppBuildTimeGlueCodeGenerator.ts +5 -8
- package/src/codegen/generators/ArkTSComponentCodeGeneratorArkTS.ts +0 -7
- package/src/codegen/generators/ArkTSComponentCodeGeneratorCAPI.ts +0 -7
- package/src/codegen/generators/CppComponentCodeGenerator.ts +0 -7
- package/src/codegen/generators/LibGlueCodeGenerator.ts +2 -9
- package/src/codegen/generators/NativeModuleCodeGenerator.ts +1 -8
- package/src/codegen/generators/SharedComponentCodeGenerator.ts +0 -7
- package/src/codegen/generators/UberGeneratorV1.ts +0 -7
- package/src/codegen/generators/UberGeneratorV2.ts +0 -7
- package/src/codegen/generators/index.ts +0 -7
- package/src/codegen/index.ts +0 -7
- package/src/codegen/templates/BaseComponentInstanceHTemplate.ts +0 -7
- package/src/codegen/templates/BasePackageHTemplate.ts +13 -8
- package/src/codegen/templates/ComponentDescriptorHTemplate.ts +1 -7
- package/src/codegen/templates/ComponentJSIBinderHTemplate.ts +0 -7
- package/src/codegen/templates/ComponentUtilsTSTemplate.ts +0 -7
- package/src/codegen/templates/IndexTSTemplate.ts +0 -7
- package/src/codegen/templates/RNOHGeneratedPackageHTemplate.ts +13 -8
- package/src/codegen/templates/TurboModuleCppTemplate.ts +0 -7
- package/src/codegen/templates/TurboModuleHTemplate.ts +0 -7
- package/src/codegen/templates/TurboModuleSpecTSTemplate.ts +0 -7
- package/src/codegen/templates/index.ts +0 -7
- package/src/commands/bundle-harmony.ts +174 -39
- package/src/commands/clean-harmony.ts +54 -0
- package/src/commands/codegen-harmony.ts +0 -7
- package/src/commands/codegen-lib-harmony.ts +6 -13
- package/src/commands/index.ts +2 -10
- package/src/commands/init-harmony.ts +299 -0
- package/src/commands/link-harmony.ts +13 -18
- package/src/commands/types.ts +0 -7
- package/src/commands/verify-package-harmony.ts +7 -10
- package/src/core/AbsolutePath.ts +4 -7
- package/src/core/CodegenConfig.ts +0 -7
- package/src/core/DescriptiveError.ts +0 -7
- package/src/core/FileSystem.ts +5 -8
- package/src/core/OHPackageJSON5.ts +0 -7
- package/src/core/PackageJSON.ts +0 -6
- package/src/core/ProjectDependenciesManager.ts +14 -22
- package/src/core/ValidationError.ts +0 -7
- package/src/core/ValueObject.ts +0 -7
- package/src/core/fs.ts +13 -7
- package/src/core/index.ts +0 -7
- package/src/index.ts +4 -13
- package/src/init/templates/AppScopeAppJSON5Template.ts +24 -0
- package/src/init/templates/AppScopeStringVarTemplate.ts +22 -0
- package/src/init/templates/EntryIndexTemplate.ts +59 -0
- package/src/init/templates/EntryStringVarTemplate.ts +31 -0
- package/src/init/templates/HvigorConfigJson5Template.ts +40 -0
- package/src/init/templates/MetroConfigTemplate.ts +41 -0
- package/src/init/templates/OhPackageJson5Template.ts +31 -0
- package/src/init/templates/harmony/AppScope/app.json5 +10 -0
- package/src/init/templates/harmony/AppScope/resources/base/element/string.json +8 -0
- package/src/init/templates/harmony/AppScope/resources/base/media/app_icon.png +0 -0
- package/src/init/templates/harmony/build-profile.json5 +36 -0
- package/src/init/templates/harmony/codelinter.json +32 -0
- package/src/init/templates/harmony/entry/build-profile.json5 +18 -0
- package/src/init/templates/harmony/entry/gitignore +7 -0
- package/src/init/templates/harmony/entry/hvigorfile.ts +13 -0
- package/src/init/templates/harmony/entry/oh-package.json5 +9 -0
- package/src/init/templates/harmony/entry/src/main/cpp/CMakeLists.txt +27 -0
- package/src/init/templates/harmony/entry/src/main/cpp/PackageProvider.cpp +13 -0
- package/src/init/templates/harmony/entry/src/main/cpp/gitignore +4 -0
- package/src/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +8 -0
- package/src/init/templates/harmony/entry/src/main/ets/codegen/gitignore +2 -0
- package/src/init/templates/harmony/entry/src/main/ets/entryability/EntryAbility.ets +11 -0
- package/src/init/templates/harmony/entry/src/main/ets/gitignore +1 -0
- package/src/init/templates/harmony/entry/src/main/ets/pages/.gitkeep +0 -0
- package/src/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +16 -0
- package/src/init/templates/harmony/entry/src/main/module.json5 +58 -0
- package/src/init/templates/harmony/entry/src/main/resources/base/element/color.json +8 -0
- package/src/init/templates/harmony/entry/src/main/resources/base/element/string.json +16 -0
- package/src/init/templates/harmony/entry/src/main/resources/base/media/background.png +0 -0
- package/src/init/templates/harmony/entry/src/main/resources/base/media/foreground.png +0 -0
- package/src/init/templates/harmony/entry/src/main/resources/base/media/layered_image.json +7 -0
- package/src/init/templates/harmony/entry/src/main/resources/base/media/startIcon.png +0 -0
- package/src/init/templates/harmony/entry/src/main/resources/base/profile/main_pages.json +5 -0
- package/src/init/templates/harmony/entry/src/main/resources/gitignore +1 -0
- package/src/init/templates/harmony/entry/src/ohosTest/ets/test/List.test.ets +2 -0
- package/src/init/templates/harmony/entry/src/ohosTest/module.json5 +13 -0
- package/src/init/templates/harmony/gitignore +16 -0
- package/src/init/templates/harmony/hvigor/hvigor-config.json5 +22 -0
- package/src/init/templates/harmony/hvigorfile.ts +7 -0
- package/src/init/templates/index.ts +5 -0
- package/src/io/CliExecutor.ts +1 -8
- package/src/io/Logger.ts +0 -7
- package/src/io/RealFS.ts +15 -8
- package/src/io/TarGz.ts +1 -8
- package/src/io/__fixtures__.ts +1 -8
- package/src/io/fsUtils.ts +1 -7
- package/src/io/index.ts +1 -7
- package/src/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.ts +0 -7
- package/src/package-verifier/checks/HarmonyDirExistsCheck.ts +0 -7
- package/src/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.ts +0 -7
- package/src/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.ts +0 -7
- package/src/package-verifier/checks/index.ts +0 -7
- package/src/package-verifier/index.ts +0 -7
- package/src/package-verifier/types.ts +0 -7
- package/src/package-verifier/verify-package.ts +0 -7
- package/tsconfig.build.json +2 -5
- package/tsconfig.json +4 -0
- package/dist/commands/create-metro-host-constants.js +0 -67
- package/dist/commands/pack-harmony.js +0 -106
- package/dist/commands/unpack-harmony.js +0 -189
- package/src/commands/create-metro-host-constants.ts +0 -55
- package/src/commands/pack-harmony.ts +0 -128
- package/src/commands/unpack-harmony.ts +0 -238
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# @react-native-oh/react-native-harmony-cli
|
|
2
2
|
|
|
3
|
-
Please refer to: [RNOH repo](https://
|
|
3
|
+
Please refer to: [RNOH repo](https://gitcode.com/openharmony-sig/ohos_react_native) for more detail.
|
|
4
4
|
|
|
5
5
|
# Documentation
|
|
6
6
|
|
|
7
|
-
- [中文](https://
|
|
8
|
-
- [English](https://
|
|
7
|
+
- [中文](https://gitcode.com/openharmony-sig/ohos_react_native/blob/0.77.1-rc.1-ohos/docs/zh-cn/README.md)
|
|
8
|
+
- [English](https://gitcode.com/openharmony-sig/ohos_react_native/blob/0.77.1-rc.1-ohos/docs/en/README.md)
|
|
9
9
|
|
|
10
10
|
# License
|
|
11
11
|
|
|
12
|
-
This library is licensed under The [MIT License (MIT)](https://
|
|
12
|
+
This library is licensed under The [MIT License (MIT)](https://gitcode.com/openharmony-sig/ohos_react_native)
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024-2025 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -23,6 +17,7 @@ const json5_1 = __importDefault(require("json5"));
|
|
|
23
17
|
const core_1 = require("../core");
|
|
24
18
|
const mustache_1 = __importDefault(require("mustache"));
|
|
25
19
|
const case_1 = __importDefault(require("case"));
|
|
20
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
26
21
|
const ETS_RNOH_PACKAGES_FACTORY_TEMPLATE = `
|
|
27
22
|
/*
|
|
28
23
|
* This file was generated by RNOH autolinking.
|
|
@@ -50,7 +45,7 @@ const CPP_RNOH_PACKAGES_FACTORY_TEMPLATE = `
|
|
|
50
45
|
#pragma once
|
|
51
46
|
#include "RNOH/Package.h"
|
|
52
47
|
{{#libraries}}
|
|
53
|
-
#include "{{
|
|
48
|
+
#include "{{cppRNOHPackageClassName}}.h"
|
|
54
49
|
{{/libraries}}
|
|
55
50
|
|
|
56
51
|
std::vector<rnoh::Package::Shared> createRNOHPackages(const rnoh::Package::Context &ctx) {
|
|
@@ -66,7 +61,7 @@ const CMAKE_AUTOLINKING_TEMPLATE = `
|
|
|
66
61
|
# DO NOT modify it manually, your changes WILL be overwritten.
|
|
67
62
|
cmake_minimum_required(VERSION 3.5)
|
|
68
63
|
|
|
69
|
-
# @
|
|
64
|
+
# @actor RNOH_APP
|
|
70
65
|
function(autolink_libraries target)
|
|
71
66
|
{{#libraries}}
|
|
72
67
|
add_subdirectory("\${OH_MODULES_DIR}/{{{ohPackageName}}}/src/main/cpp" ./{{cmakeLibraryTargetName}})
|
|
@@ -111,11 +106,11 @@ class Autolinking {
|
|
|
111
106
|
const skippedLibraryNpmPackageNames = [];
|
|
112
107
|
yield new core_1.ProjectDependenciesManager(this.fs, projectRootPath).forEachAsync((dependency) => {
|
|
113
108
|
var _a;
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
109
|
+
const harFilePaths = dependency.getHarFilePaths();
|
|
110
|
+
if (harFilePaths.length === 0) {
|
|
116
111
|
return;
|
|
117
112
|
}
|
|
118
|
-
nodeModuleHarPaths.push(
|
|
113
|
+
nodeModuleHarPaths.push(...harFilePaths);
|
|
119
114
|
const packageJson = dependency.readPackageJSON();
|
|
120
115
|
const providedAutolinkingConfig = (_a = packageJson.harmony) === null || _a === void 0 ? void 0 : _a.autolinking;
|
|
121
116
|
if (providedAutolinkingConfig === undefined ||
|
|
@@ -123,7 +118,8 @@ class Autolinking {
|
|
|
123
118
|
(config.excludedNpmPackageNames.has(packageJson.name) &&
|
|
124
119
|
config.excludedNpmPackageNames.size > 0) ||
|
|
125
120
|
(!config.includedNpmPackageNames.has(packageJson.name) &&
|
|
126
|
-
config.includedNpmPackageNames.size > 0)
|
|
121
|
+
config.includedNpmPackageNames.size > 0) ||
|
|
122
|
+
harFilePaths.length !== 1) {
|
|
127
123
|
skippedLibraryNpmPackageNames.push(packageJson.name);
|
|
128
124
|
return;
|
|
129
125
|
}
|
|
@@ -134,7 +130,7 @@ class Autolinking {
|
|
|
134
130
|
cppRNOHPackageClassName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.cppPackageClassName,
|
|
135
131
|
cmakeLibraryTargetName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.cmakeLibraryTargetName,
|
|
136
132
|
ohPackageName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.ohPackageName,
|
|
137
|
-
harFilePathRelativeToHarmony:
|
|
133
|
+
harFilePathRelativeToHarmony: harFilePaths[0]
|
|
138
134
|
.relativeTo(harmonyProjectPath)
|
|
139
135
|
.toString(),
|
|
140
136
|
});
|
|
@@ -171,13 +167,14 @@ class Autolinking {
|
|
|
171
167
|
const autolinkableHarFilePathsRelativeToHarmony = autolinkableLibraries.map((lib) => lib.harFilePathRelativeToHarmony);
|
|
172
168
|
const unmanagedNativeDependencySpecifierByName = {};
|
|
173
169
|
Object.entries(ohPackage.dependencies).forEach(([name, dependencySpecifier]) => {
|
|
174
|
-
if (!dependencySpecifier.includes('file:')
|
|
170
|
+
if (!(dependencySpecifier.includes('file:') &&
|
|
171
|
+
dependencySpecifier.includes('node_modules'))) {
|
|
175
172
|
unmanagedNativeDependencySpecifierByName[name] = dependencySpecifier;
|
|
176
173
|
}
|
|
177
174
|
else {
|
|
178
175
|
const harFilePathRelativeToHarmony = dependencySpecifier.replace('file:', '');
|
|
179
|
-
if (!autolinkableHarFilePathsRelativeToHarmony.includes(harFilePathRelativeToHarmony) &&
|
|
180
|
-
input.nodeModuleHarFilePathsRelativeToHarmony.includes(harFilePathRelativeToHarmony)) {
|
|
176
|
+
if (!autolinkableHarFilePathsRelativeToHarmony.includes(node_path_1.default.normalize(harFilePathRelativeToHarmony)) &&
|
|
177
|
+
input.nodeModuleHarFilePathsRelativeToHarmony.includes(node_path_1.default.normalize(harFilePathRelativeToHarmony))) {
|
|
181
178
|
unmanagedNativeDependencySpecifierByName[name] =
|
|
182
179
|
dependencySpecifier;
|
|
183
180
|
}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
3
|
if (k2 === undefined) k2 = k;
|
|
10
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.CodegenError = void 0;
|
|
10
4
|
const core_1 = require("../../core");
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024-2025 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.createEventNameFromEventHandlerName = createEventNameFromEventHandlerName;
|
|
10
4
|
const CodegenError_1 = require("./CodegenError");
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.TypeAnnotationToTS = void 0;
|
|
10
4
|
exports.getStringifiedTSDefaultValueFromPropTypeAnnotation = getStringifiedTSDefaultValueFromPropTypeAnnotation;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024-2025 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -14,17 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
9
|
});
|
|
16
10
|
};
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
12
|
exports.UberSchema = void 0;
|
|
22
13
|
const core_1 = require("../../core");
|
|
23
14
|
// @ts-expect-error
|
|
24
|
-
const combine_js_to_schema_js_1 =
|
|
15
|
+
const combine_js_to_schema_js_1 = require("@react-native/codegen/lib/cli/combine/combine-js-to-schema.js");
|
|
25
16
|
const CodegenError_1 = require("./CodegenError");
|
|
26
17
|
function createRawUberSchemaFromSpecFilePaths(projectSourceFilePaths) {
|
|
27
|
-
return (0, combine_js_to_schema_js_1.
|
|
18
|
+
return (0, combine_js_to_schema_js_1.combineSchemas)(projectSourceFilePaths.map((p) => p.getValue()));
|
|
28
19
|
}
|
|
29
20
|
/**
|
|
30
21
|
* Contains component and turbo module (NativeModule) schemas. The "Uber" word is used here to highlight that SpecSchemas don't extend this class.
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
3
|
if (k2 === undefined) k2 = k;
|
|
10
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
@@ -35,6 +29,7 @@ class AppBuildTimeGlueCodeGenerator {
|
|
|
35
29
|
generatedPackageH_v1.addComponent({
|
|
36
30
|
name,
|
|
37
31
|
supportedEventNames: eventNames,
|
|
32
|
+
isArkTSComponent: true,
|
|
38
33
|
});
|
|
39
34
|
});
|
|
40
35
|
v1.turboModules.forEach((turboModule) => {
|
|
@@ -45,7 +40,7 @@ class AppBuildTimeGlueCodeGenerator {
|
|
|
45
40
|
const basePackageClassName = `Base${case_1.default.pascal(libraryName)}Package`;
|
|
46
41
|
const generatedPackageH_v2 = new BasePackageHTemplate_1.BasePackageHTemplate(basePackageClassName, this.codegenNoticeLines);
|
|
47
42
|
components.forEach((component) => {
|
|
48
|
-
generatedPackageH_v2.addComponent(component);
|
|
43
|
+
generatedPackageH_v2.addComponent(Object.assign(Object.assign({}, component), { isArkTSComponent: false }));
|
|
49
44
|
});
|
|
50
45
|
turboModules.forEach((turboModule) => {
|
|
51
46
|
turboModules_indexTS.addReexport({ from: `./${turboModule.name}` });
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.ArkTSComponentCodeGeneratorArkTS = void 0;
|
|
10
4
|
const core_1 = require("../core");
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.ArkTSComponentCodeGeneratorCAPI = void 0;
|
|
10
4
|
const core_1 = require("../core");
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.CppComponentCodeGenerator = void 0;
|
|
10
4
|
const templates_1 = require("../templates");
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
@@ -35,11 +29,11 @@ class LibGlueCodeGenerator {
|
|
|
35
29
|
});
|
|
36
30
|
arkTSComponents.forEach(({ componentName, eventNames }) => {
|
|
37
31
|
components_indexTS.addReexport({ from: `./${componentName}` });
|
|
38
|
-
basePackageTemplate.addComponent({ name: componentName, libraryCppName });
|
|
32
|
+
basePackageTemplate.addComponent({ name: componentName, libraryCppName, isArkTSComponent: true });
|
|
39
33
|
eventNames.forEach((eventName) => basePackageTemplate.addArkTSEvent({ name: eventName }));
|
|
40
34
|
});
|
|
41
35
|
cppComponents.forEach(({ componentName }) => {
|
|
42
|
-
basePackageTemplate.addComponent({ name: componentName, libraryCppName });
|
|
36
|
+
basePackageTemplate.addComponent({ name: componentName, libraryCppName, isArkTSComponent: false });
|
|
43
37
|
});
|
|
44
38
|
fileContentByPath.set(this.cppOutputPath.copyWithNewSegment('RNOH', 'generated', `${basePackageClassName}.h`), basePackageTemplate.build());
|
|
45
39
|
fileContentByPath.set(this.etsOutputPath.copyWithNewSegment('components', 'ts.ts'), components_indexTS.build());
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.NativeModuleCodeGenerator = void 0;
|
|
10
4
|
const templates_1 = require("../templates");
|
|
@@ -53,7 +47,7 @@ class NativeModuleCodeGenerator {
|
|
|
53
47
|
})),
|
|
54
48
|
});
|
|
55
49
|
});
|
|
56
|
-
schema.spec.
|
|
50
|
+
schema.spec.methods.map((prop) => {
|
|
57
51
|
if (prop.typeAnnotation.type === 'FunctionTypeAnnotation') {
|
|
58
52
|
turboModuleCpp.addMethod({
|
|
59
53
|
name: prop.name,
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.UberGeneratorV1 = void 0;
|
|
10
4
|
const core_1 = require("../core");
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.UberGeneratorV2 = void 0;
|
|
10
4
|
const CppComponentCodeGenerator_1 = require("./CppComponentCodeGenerator");
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
3
|
if (k2 === undefined) k2 = k;
|
|
10
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
package/dist/codegen/index.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
3
|
if (k2 === undefined) k2 = k;
|
|
10
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
@@ -50,16 +44,26 @@ class {{name}}EventEmitRequestHandler : public EventEmitRequestHandler {
|
|
|
50
44
|
public:
|
|
51
45
|
void handleEvent(Context const &ctx) override {
|
|
52
46
|
auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
|
|
47
|
+
auto componentName = ctx.shadowViewRegistry->getComponentName(ctx.tag);
|
|
48
|
+
|
|
53
49
|
if (eventEmitter == nullptr) {
|
|
54
50
|
return;
|
|
55
51
|
}
|
|
56
52
|
|
|
53
|
+
std::vector<std::string> supportedComponentNames = {
|
|
54
|
+
{{#arkTSComponents}}
|
|
55
|
+
"{{name}}",
|
|
56
|
+
{{/arkTSComponents}}
|
|
57
|
+
};
|
|
58
|
+
|
|
57
59
|
std::vector<std::string> supportedEventNames = {
|
|
58
60
|
{{#arkTSEvents}}
|
|
59
61
|
"{{name}}",
|
|
60
62
|
{{/arkTSEvents}}
|
|
61
63
|
};
|
|
62
|
-
|
|
64
|
+
|
|
65
|
+
if (std::find(supportedComponentNames.begin(), supportedComponentNames.end(), componentName) != supportedComponentNames.end() &&
|
|
66
|
+
std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
|
|
63
67
|
eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
|
|
64
68
|
}
|
|
65
69
|
}
|
|
@@ -126,6 +130,7 @@ class BasePackageHTemplate {
|
|
|
126
130
|
name: this.name,
|
|
127
131
|
turboModules: this.turboModules,
|
|
128
132
|
components: this.components,
|
|
133
|
+
arkTSComponents: this.components.filter((component) => component.isArkTSComponent),
|
|
129
134
|
arkTSEvents: this.arkTSEvents,
|
|
130
135
|
libraries: Array.from(this.libraryCppNames).map((name) => ({
|
|
131
136
|
name,
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
@@ -30,6 +24,7 @@ const TEMPLATE = `
|
|
|
30
24
|
namespace facebook {
|
|
31
25
|
namespace react {
|
|
32
26
|
|
|
27
|
+
// RNOH patch
|
|
33
28
|
constexpr char {{name}}ComponentName[] = "{{name}}";
|
|
34
29
|
|
|
35
30
|
class {{name}}Props : public ViewProps {
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
@@ -53,16 +47,26 @@ class GeneratedEventEmitRequestHandler : public EventEmitRequestHandler {
|
|
|
53
47
|
public:
|
|
54
48
|
void handleEvent(Context const &ctx) override {
|
|
55
49
|
auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
|
|
50
|
+
auto componentName = ctx.shadowViewRegistry->getComponentName(ctx.tag);
|
|
51
|
+
|
|
56
52
|
if (eventEmitter == nullptr) {
|
|
57
53
|
return;
|
|
58
54
|
}
|
|
59
55
|
|
|
56
|
+
std::vector<std::string> supportedComponentNames = {
|
|
57
|
+
{{#arkTSComponents}}
|
|
58
|
+
"{{name}}",
|
|
59
|
+
{{/arkTSComponents}}
|
|
60
|
+
};
|
|
61
|
+
|
|
60
62
|
std::vector<std::string> supportedEventNames = {
|
|
61
63
|
{{#supportedEvents}}
|
|
62
64
|
"{{name}}",
|
|
63
65
|
{{/supportedEvents}}
|
|
64
66
|
};
|
|
65
|
-
|
|
67
|
+
|
|
68
|
+
if (std::find(supportedComponentNames.begin(), supportedComponentNames.end(), componentName) != supportedComponentNames.end() &&
|
|
69
|
+
std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
|
|
66
70
|
eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
|
|
67
71
|
}
|
|
68
72
|
}
|
|
@@ -121,6 +125,7 @@ class RNOHGeneratedPackageHTemplate {
|
|
|
121
125
|
return mustache_1.default.render(TEMPLATE.trimStart(), {
|
|
122
126
|
turboModules: this.turboModules,
|
|
123
127
|
components: this.components,
|
|
128
|
+
arkTSComponents: this.components.filter((component) => component.isArkTSComponent),
|
|
124
129
|
supportedEvents: this.supportedEventNames.map((eventName) => ({
|
|
125
130
|
name: eventName,
|
|
126
131
|
})),
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
3
|
if (k2 === undefined) k2 = k;
|
|
10
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|