@react-native-oh/react-native-harmony-cli 0.0.30 → 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/assetResolver.js +105 -10
- package/dist/autolinking/Autolinking.js +21 -26
- 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 +4 -13
- package/dist/codegen/core/TypeAnnotationToTS.js +3 -9
- package/dist/codegen/core/UberSchema.js +8 -21
- package/dist/codegen/core/index.js +0 -6
- package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +2 -7
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +3 -6
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +3 -6
- package/dist/codegen/generators/CppComponentCodeGenerator.js +3 -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 +15 -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 +133 -101
- package/dist/commands/clean-harmony.js +84 -0
- package/dist/commands/codegen-harmony.js +12 -22
- package/dist/commands/codegen-lib-harmony.js +15 -25
- package/dist/commands/index.js +3 -9
- package/dist/commands/init-harmony.js +226 -0
- package/dist/commands/init.js +703 -0
- package/dist/commands/link-harmony.js +12 -16
- package/dist/commands/run-harmony.js +438 -0
- package/dist/commands/types.js +2 -0
- package/dist/commands/verify-package-harmony.js +7 -11
- package/dist/core/AbsolutePath.js +3 -6
- package/dist/core/CodegenConfig.js +3 -11
- package/dist/core/DescriptiveError.js +7 -9
- package/dist/core/FileSystem.js +0 -6
- package/dist/core/OHPackageJSON5.js +0 -6
- package/dist/core/PackageJSON.js +4 -7
- 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 +16 -10
- package/dist/core/index.js +0 -6
- package/dist/index.js +3 -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 +56 -29
- package/dist/io/Logger.js +71 -47
- package/dist/io/RealFS.js +10 -6
- package/dist/io/TarGz.js +3 -10
- package/dist/io/__fixtures__.js +8 -8
- package/dist/io/fsUtils.js +1 -8
- package/dist/io/index.js +1 -6
- package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +1 -8
- package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +1 -8
- package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +1 -8
- package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +1 -8
- 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 +5 -14
- package/harmony/rnoh-hvigor-plugin-0.77.18.tgz +0 -0
- package/jest.config.js +0 -7
- package/package.json +20 -16
- package/react-native.config.js +0 -7
- package/scripts/copy-template.js +18 -0
- package/src/assetResolver.ts +117 -11
- package/src/autolinking/Autolinking.test.ts +54 -18
- package/src/autolinking/Autolinking.ts +32 -31
- 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 +3 -12
- package/src/codegen/core/TypeAnnotationToTS.test.ts +0 -7
- package/src/codegen/core/TypeAnnotationToTS.ts +3 -8
- package/src/codegen/core/UberSchema.ts +9 -22
- package/src/codegen/core/index.ts +0 -7
- package/src/codegen/generators/AppBuildTimeGlueCodeGenerator.ts +5 -8
- package/src/codegen/generators/ArkTSComponentCodeGeneratorArkTS.ts +3 -7
- package/src/codegen/generators/ArkTSComponentCodeGeneratorCAPI.ts +3 -7
- package/src/codegen/generators/CppComponentCodeGenerator.ts +3 -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 +24 -8
- 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 +178 -118
- package/src/commands/clean-harmony.ts +54 -0
- package/src/commands/codegen-harmony.ts +13 -25
- package/src/commands/codegen-lib-harmony.ts +16 -28
- package/src/commands/index.ts +3 -10
- package/src/commands/init-harmony.ts +299 -0
- package/src/commands/init.ts +755 -0
- package/src/commands/link-harmony.ts +14 -19
- package/src/commands/run-harmony.ts +478 -0
- package/src/commands/types.ts +14 -0
- package/src/commands/verify-package-harmony.ts +9 -12
- package/src/core/AbsolutePath.ts +4 -7
- package/src/core/CodegenConfig.ts +3 -12
- package/src/core/DescriptiveError.ts +8 -15
- package/src/core/FileSystem.ts +5 -8
- package/src/core/OHPackageJSON5.ts +0 -7
- package/src/core/PackageJSON.ts +4 -13
- 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 +14 -8
- package/src/core/index.ts +0 -7
- package/src/index.ts +8 -15
- 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 +55 -40
- package/src/io/Logger.ts +77 -51
- package/src/io/RealFS.ts +15 -8
- package/src/io/TarGz.ts +1 -8
- package/src/io/__fixtures__.ts +15 -18
- 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 +4 -13
- 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 -191
- 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 -240
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)
|
package/dist/assetResolver.js
CHANGED
|
@@ -1,25 +1,120 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.copyAssets = copyAssets;
|
|
2
16
|
/**
|
|
3
17
|
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
4
18
|
*
|
|
5
19
|
* This source code is licensed under the MIT license found in the
|
|
6
20
|
* LICENSE-MIT file in the root directory of this source tree.
|
|
7
21
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
22
|
+
const fs_1 = __importDefault(require("fs"));
|
|
23
|
+
const path_1 = __importDefault(require("path"));
|
|
24
|
+
const ALLOWED_SCALES = [1, 2, 3, 4];
|
|
25
|
+
function filterAssetScales(scales) {
|
|
26
|
+
const result = scales.filter(scale => ALLOWED_SCALES.includes(scale));
|
|
27
|
+
if (result.length === 0 && scales.length > 0) {
|
|
28
|
+
// No matching scale found, but there are some available. Ideally we don't
|
|
29
|
+
// want to be in this situation and should throw, but for now as a fallback
|
|
30
|
+
// let's just use the closest larger image
|
|
31
|
+
const maxScale = ALLOWED_SCALES[ALLOWED_SCALES.length - 1];
|
|
32
|
+
for (const scale of scales) {
|
|
33
|
+
if (scale > maxScale) {
|
|
34
|
+
result.push(scale);
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// There is no larger scales available, use the largest we have
|
|
39
|
+
if (result.length === 0) {
|
|
40
|
+
result.push(scales[scales.length - 1]);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
function copyAssets(logger, assetsData, assetsDest) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
if (assetsDest == null) {
|
|
48
|
+
logger.warn((s) => 'Assets destination folder is not set, skipping...');
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const filesToCopy = {};
|
|
52
|
+
const addAssetToCopy = (asset) => {
|
|
53
|
+
const validScales = filterAssetScales(asset.scales);
|
|
54
|
+
asset.scales.forEach((scale, idx) => {
|
|
55
|
+
if (!validScales.includes(scale)) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const src = asset.files[idx];
|
|
59
|
+
const dest = path_1.default.join(assetsDest, getAssetDestRelativePath(asset, scale));
|
|
60
|
+
filesToCopy[src] = dest;
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
assetsData.forEach(addAssetToCopy);
|
|
64
|
+
return copyFiles(logger, filesToCopy);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function getAssetDestRelativePath(asset, scale = 1) {
|
|
68
|
+
const suffix = scale === 1 ? '' : `@${scale}x`;
|
|
11
69
|
const fileName = getResourceIdentifier(asset);
|
|
12
|
-
|
|
70
|
+
// Assets can have relative paths outside of the project root.
|
|
71
|
+
// Replace `../` with `_` to make sure they don't end up outside of
|
|
72
|
+
// the expected assets directory.
|
|
73
|
+
return `${fileName + suffix}.${asset.type}`.replace(/\.\.\//g, '_');
|
|
13
74
|
}
|
|
14
|
-
exports.getAssetDestRelativePath = getAssetDestRelativePath;
|
|
15
75
|
function getResourceIdentifier(asset) {
|
|
16
76
|
const folderPath = getBasePath(asset);
|
|
17
|
-
return `${folderPath}/${asset.name}`.
|
|
77
|
+
return `${folderPath}/${asset.name}`.replace(/^assets\//, '');
|
|
18
78
|
}
|
|
19
79
|
function getBasePath(asset) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
80
|
+
const basePath = asset.httpServerLocation;
|
|
81
|
+
return basePath.startsWith('/') ? basePath.slice(1) : basePath;
|
|
82
|
+
}
|
|
83
|
+
function copyFiles(logger, fileDestBySrc) {
|
|
84
|
+
const fileSources = Object.keys(fileDestBySrc);
|
|
85
|
+
if (fileSources.length === 0) {
|
|
86
|
+
return Promise.resolve();
|
|
23
87
|
}
|
|
24
|
-
|
|
88
|
+
const assetFilesCount = fileSources.length;
|
|
89
|
+
return new Promise((resolve, reject) => {
|
|
90
|
+
const copyNext = (error) => {
|
|
91
|
+
if (error) {
|
|
92
|
+
reject(error);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (fileSources.length === 0) {
|
|
96
|
+
logger.info(() => `Copied ${assetFilesCount} ${assetFilesCount === 1 ? 'asset' : 'assets'}`);
|
|
97
|
+
resolve();
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
// fileSources.length === 0 is checked in previous branch, so this is string
|
|
101
|
+
const src = fileSources.shift();
|
|
102
|
+
const dest = fileDestBySrc[src];
|
|
103
|
+
copyFile(src, dest, copyNext);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
copyNext();
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function copyFile(src, dest, onFinished) {
|
|
110
|
+
const destDir = path_1.default.dirname(dest);
|
|
111
|
+
fs_1.default.mkdir(destDir, { recursive: true }, (err) => {
|
|
112
|
+
if (err) {
|
|
113
|
+
onFinished(err);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
fs_1.default.createReadStream(src)
|
|
117
|
+
.pipe(fs_1.default.createWriteStream(dest))
|
|
118
|
+
.on('finish', onFinished);
|
|
119
|
+
});
|
|
25
120
|
}
|
|
@@ -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 __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}})
|
|
@@ -95,9 +90,7 @@ class Autolinking {
|
|
|
95
90
|
config.excludedNpmPackageNames.size > 0) {
|
|
96
91
|
throw new core_1.DescriptiveError({
|
|
97
92
|
whatHappened: 'Tried to exclude and include npm packages.',
|
|
98
|
-
whatCanUserDo:
|
|
99
|
-
default: ['Include or exclude npm packages, but not both.'],
|
|
100
|
-
},
|
|
93
|
+
whatCanUserDo: ['Include or exclude npm packages, but not both.'],
|
|
101
94
|
extraData: {
|
|
102
95
|
includedNpmPackageNamesCount: config.includedNpmPackageNames.size,
|
|
103
96
|
excludedNpmPackageNamesCount: config.excludedNpmPackageNames.size,
|
|
@@ -113,11 +106,11 @@ class Autolinking {
|
|
|
113
106
|
const skippedLibraryNpmPackageNames = [];
|
|
114
107
|
yield new core_1.ProjectDependenciesManager(this.fs, projectRootPath).forEachAsync((dependency) => {
|
|
115
108
|
var _a;
|
|
116
|
-
const
|
|
117
|
-
if (
|
|
109
|
+
const harFilePaths = dependency.getHarFilePaths();
|
|
110
|
+
if (harFilePaths.length === 0) {
|
|
118
111
|
return;
|
|
119
112
|
}
|
|
120
|
-
nodeModuleHarPaths.push(
|
|
113
|
+
nodeModuleHarPaths.push(...harFilePaths);
|
|
121
114
|
const packageJson = dependency.readPackageJSON();
|
|
122
115
|
const providedAutolinkingConfig = (_a = packageJson.harmony) === null || _a === void 0 ? void 0 : _a.autolinking;
|
|
123
116
|
if (providedAutolinkingConfig === undefined ||
|
|
@@ -125,7 +118,8 @@ class Autolinking {
|
|
|
125
118
|
(config.excludedNpmPackageNames.has(packageJson.name) &&
|
|
126
119
|
config.excludedNpmPackageNames.size > 0) ||
|
|
127
120
|
(!config.includedNpmPackageNames.has(packageJson.name) &&
|
|
128
|
-
config.includedNpmPackageNames.size > 0)
|
|
121
|
+
config.includedNpmPackageNames.size > 0) ||
|
|
122
|
+
harFilePaths.length !== 1) {
|
|
129
123
|
skippedLibraryNpmPackageNames.push(packageJson.name);
|
|
130
124
|
return;
|
|
131
125
|
}
|
|
@@ -136,7 +130,7 @@ class Autolinking {
|
|
|
136
130
|
cppRNOHPackageClassName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.cppPackageClassName,
|
|
137
131
|
cmakeLibraryTargetName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.cmakeLibraryTargetName,
|
|
138
132
|
ohPackageName: autolinkingConfig === null || autolinkingConfig === void 0 ? void 0 : autolinkingConfig.ohPackageName,
|
|
139
|
-
harFilePathRelativeToHarmony:
|
|
133
|
+
harFilePathRelativeToHarmony: harFilePaths[0]
|
|
140
134
|
.relativeTo(harmonyProjectPath)
|
|
141
135
|
.toString(),
|
|
142
136
|
});
|
|
@@ -173,13 +167,14 @@ class Autolinking {
|
|
|
173
167
|
const autolinkableHarFilePathsRelativeToHarmony = autolinkableLibraries.map((lib) => lib.harFilePathRelativeToHarmony);
|
|
174
168
|
const unmanagedNativeDependencySpecifierByName = {};
|
|
175
169
|
Object.entries(ohPackage.dependencies).forEach(([name, dependencySpecifier]) => {
|
|
176
|
-
if (!dependencySpecifier.includes('file:')
|
|
170
|
+
if (!(dependencySpecifier.includes('file:') &&
|
|
171
|
+
dependencySpecifier.includes('node_modules'))) {
|
|
177
172
|
unmanagedNativeDependencySpecifierByName[name] = dependencySpecifier;
|
|
178
173
|
}
|
|
179
174
|
else {
|
|
180
175
|
const harFilePathRelativeToHarmony = dependencySpecifier.replace('file:', '');
|
|
181
|
-
if (!autolinkableHarFilePathsRelativeToHarmony.includes(harFilePathRelativeToHarmony) &&
|
|
182
|
-
input.nodeModuleHarFilePathsRelativeToHarmony.includes(harFilePathRelativeToHarmony)) {
|
|
176
|
+
if (!autolinkableHarFilePathsRelativeToHarmony.includes(node_path_1.default.normalize(harFilePathRelativeToHarmony)) &&
|
|
177
|
+
input.nodeModuleHarFilePathsRelativeToHarmony.includes(node_path_1.default.normalize(harFilePathRelativeToHarmony))) {
|
|
183
178
|
unmanagedNativeDependencySpecifierByName[name] =
|
|
184
179
|
dependencySpecifier;
|
|
185
180
|
}
|
|
@@ -255,21 +250,21 @@ class Autolinking {
|
|
|
255
250
|
this.fs.writeTextSync(path, content);
|
|
256
251
|
});
|
|
257
252
|
output.linkedLibraryNpmPackageNames.forEach((npmPackageName) => {
|
|
258
|
-
this.logger.
|
|
253
|
+
this.logger.debug((styles) => `[${styles.green(styles.bold('link'))}] ${npmPackageName}`);
|
|
259
254
|
});
|
|
260
255
|
output.skippedLibraryNpmPackageNames.forEach((npmPackageName) => {
|
|
261
|
-
this.logger.
|
|
256
|
+
this.logger.debug((styles) => `[${styles.yellow(styles.bold('skip'))}] ${npmPackageName}`);
|
|
262
257
|
});
|
|
263
|
-
this.logger.
|
|
258
|
+
this.logger.debug(() => '');
|
|
264
259
|
const sortedPathsRelativeToRoot = pathAndContentPairs
|
|
265
260
|
.map(([path]) => path.relativeTo(output.projectRootPath).toString())
|
|
266
261
|
.sort();
|
|
267
262
|
sortedPathsRelativeToRoot.forEach((pathStr) => {
|
|
268
|
-
this.logger.
|
|
263
|
+
this.logger.debug((styles) => styles.gray(`• ${pathStr}`));
|
|
269
264
|
});
|
|
270
|
-
this.logger.
|
|
271
|
-
this.logger.info((styles) => `updated ${styles.green(styles.bold(sortedPathsRelativeToRoot.length))} file(s), linked ${styles.green(styles.bold(output.linkedLibraryNpmPackageNames.length))} libraries, skipped ${styles.yellow(styles.bold(output.skippedLibraryNpmPackageNames.length))} libraries
|
|
272
|
-
this.logger.
|
|
265
|
+
this.logger.debug(() => '');
|
|
266
|
+
this.logger.info((styles) => `updated ${styles.green(styles.bold(sortedPathsRelativeToRoot.length))} file(s), linked ${styles.green(styles.bold(output.linkedLibraryNpmPackageNames.length))} libraries, skipped ${styles.yellow(styles.bold(output.skippedLibraryNpmPackageNames.length))} libraries`);
|
|
267
|
+
this.logger.debug(() => '');
|
|
273
268
|
}
|
|
274
269
|
}
|
|
275
270
|
exports.Autolinking = Autolinking;
|
|
@@ -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,25 +1,16 @@
|
|
|
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
|
-
exports.createEventNameFromEventHandlerName =
|
|
3
|
+
exports.createEventNameFromEventHandlerName = createEventNameFromEventHandlerName;
|
|
10
4
|
const CodegenError_1 = require("./CodegenError");
|
|
11
5
|
function createEventNameFromEventHandlerName(eventHandlerName) {
|
|
12
6
|
const eventName = eventHandlerName.replace('on', '');
|
|
13
7
|
if (eventName.length === 0) {
|
|
14
8
|
throw new CodegenError_1.CodegenError({
|
|
15
9
|
whatHappened: `Received invalid event handler name: ${eventHandlerName}`,
|
|
16
|
-
whatCanUserDo:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
],
|
|
20
|
-
},
|
|
10
|
+
whatCanUserDo: [
|
|
11
|
+
'Change your event listener name to match naming convention "onEventName" e.g. "onPress"',
|
|
12
|
+
],
|
|
21
13
|
});
|
|
22
14
|
}
|
|
23
15
|
return eventName.charAt(0).toLowerCase() + eventName.slice(1);
|
|
24
16
|
}
|
|
25
|
-
exports.createEventNameFromEventHandlerName = createEventNameFromEventHandlerName;
|
|
@@ -1,12 +1,8 @@
|
|
|
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
|
-
exports.
|
|
3
|
+
exports.TypeAnnotationToTS = void 0;
|
|
4
|
+
exports.getStringifiedTSDefaultValueFromPropTypeAnnotation = getStringifiedTSDefaultValueFromPropTypeAnnotation;
|
|
5
|
+
exports.wrapWithQuotes = wrapWithQuotes;
|
|
10
6
|
class TypeAnnotationToTS {
|
|
11
7
|
constructor(aliasPrefix = '') {
|
|
12
8
|
this.aliasPrefix = aliasPrefix;
|
|
@@ -126,7 +122,6 @@ function getStringifiedTSDefaultValueFromPropTypeAnnotation(propTypeAnnotation)
|
|
|
126
122
|
}
|
|
127
123
|
return null;
|
|
128
124
|
}
|
|
129
|
-
exports.getStringifiedTSDefaultValueFromPropTypeAnnotation = getStringifiedTSDefaultValueFromPropTypeAnnotation;
|
|
130
125
|
function wrapWithQuotes(str) {
|
|
131
126
|
if (str.includes("'")) {
|
|
132
127
|
return `"${str}"`;
|
|
@@ -135,4 +130,3 @@ function wrapWithQuotes(str) {
|
|
|
135
130
|
return `'${str}'`;
|
|
136
131
|
}
|
|
137
132
|
}
|
|
138
|
-
exports.wrapWithQuotes = wrapWithQuotes;
|
|
@@ -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 __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.
|
|
@@ -41,11 +32,9 @@ class UberSchema {
|
|
|
41
32
|
if (err instanceof Error) {
|
|
42
33
|
throw new CodegenError_1.CodegenError({
|
|
43
34
|
whatHappened: "Couldn't create the schema",
|
|
44
|
-
whatCanUserDo:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
],
|
|
48
|
-
},
|
|
35
|
+
whatCanUserDo: [
|
|
36
|
+
`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}`,
|
|
37
|
+
],
|
|
49
38
|
});
|
|
50
39
|
}
|
|
51
40
|
throw err;
|
|
@@ -77,11 +66,9 @@ class UberSchema {
|
|
|
77
66
|
if (err instanceof Error) {
|
|
78
67
|
throw new CodegenError_1.CodegenError({
|
|
79
68
|
whatHappened: "Couldn't create the schema",
|
|
80
|
-
whatCanUserDo:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
],
|
|
84
|
-
},
|
|
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
|
+
],
|
|
85
72
|
});
|
|
86
73
|
}
|
|
87
74
|
throw err;
|
|
@@ -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");
|
|
@@ -46,6 +40,9 @@ class ArkTSComponentCodeGeneratorArkTS {
|
|
|
46
40
|
});
|
|
47
41
|
});
|
|
48
42
|
shape.commands.forEach((command) => {
|
|
43
|
+
componentJSIBinderHTemplate.addCommand({
|
|
44
|
+
name: command.name,
|
|
45
|
+
});
|
|
49
46
|
componentUtilsTSTemplate.addCommand({
|
|
50
47
|
name: command.name,
|
|
51
48
|
argsTSType: '[' +
|
|
@@ -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");
|
|
@@ -44,6 +38,9 @@ class ArkTSComponentCodeGeneratorCAPI {
|
|
|
44
38
|
});
|
|
45
39
|
});
|
|
46
40
|
shape.commands.forEach((command) => {
|
|
41
|
+
componentJSIBinderHTemplate.addCommand({
|
|
42
|
+
name: command.name,
|
|
43
|
+
});
|
|
47
44
|
componentUtilsTSTemplate.addCommand({
|
|
48
45
|
name: command.name,
|
|
49
46
|
argsTSType: '[' +
|
|
@@ -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");
|
|
@@ -39,6 +33,9 @@ class CppComponentCodeGenerator {
|
|
|
39
33
|
});
|
|
40
34
|
});
|
|
41
35
|
shape.commands.forEach((command) => {
|
|
36
|
+
componentJSIBinderHTemplate.addCommand({
|
|
37
|
+
name: command.name,
|
|
38
|
+
});
|
|
42
39
|
componentInstanceSpecHTemplate.addCommand({
|
|
43
40
|
name: command.name,
|
|
44
41
|
args: command.typeAnnotation.params.map((param) => ({
|
|
@@ -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);
|