@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,17 +1,37 @@
|
|
|
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.OhPackageJson5Template = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
const mustache_1 = __importDefault(require("mustache"));
|
|
8
|
+
const TEMPLATE = `
|
|
9
|
+
{
|
|
10
|
+
name: "example-name",
|
|
11
|
+
description: "example description",
|
|
12
|
+
version: "1.0.0",
|
|
13
|
+
modelVersion: "5.0.0",
|
|
14
|
+
license: "ISC",
|
|
15
|
+
repository: {},
|
|
16
|
+
dependencies: {
|
|
17
|
+
"@rnoh/react-native-openharmony": "file:../node_modules/{{{rnohNpmPackageName}}}/react_native_openharmony.har",
|
|
18
|
+
},
|
|
19
|
+
devDependencies: {
|
|
20
|
+
"@ohos/hypium": "1.0.6",
|
|
21
|
+
},
|
|
22
|
+
overrides: {
|
|
23
|
+
"@rnoh/react-native-openharmony": "file:../node_modules/{{{rnohNpmPackageName}}}/react_native_openharmony.har",
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
class OhPackageJson5Template {
|
|
28
|
+
constructor(rnohNpmPackageName) {
|
|
8
29
|
this.rnohNpmPackageName = rnohNpmPackageName;
|
|
9
30
|
}
|
|
10
|
-
|
|
31
|
+
build() {
|
|
11
32
|
return mustache_1.default.render(TEMPLATE.trimStart(), {
|
|
12
33
|
rnohNpmPackageName: this.rnohNpmPackageName,
|
|
13
34
|
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
}());
|
|
35
|
+
}
|
|
36
|
+
}
|
|
17
37
|
exports.OhPackageJson5Template = OhPackageJson5Template;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
app: {
|
|
3
|
+
products: [
|
|
4
|
+
{
|
|
5
|
+
name: 'default',
|
|
6
|
+
signingConfig: 'default',
|
|
7
|
+
compatibleSdkVersion: '5.0.0(12)',
|
|
8
|
+
runtimeOS: 'HarmonyOS',
|
|
9
|
+
buildOption: {
|
|
10
|
+
nativeCompiler: 'BiSheng'
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
buildModeSet: [
|
|
15
|
+
{
|
|
16
|
+
name: 'debug',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'release',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
signingConfigs: [],
|
|
23
|
+
},
|
|
24
|
+
modules: [
|
|
25
|
+
{
|
|
26
|
+
name: 'entry',
|
|
27
|
+
srcPath: './entry',
|
|
28
|
+
targets: [
|
|
29
|
+
{
|
|
30
|
+
name: 'default',
|
|
31
|
+
applyToProducts: ['default'],
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": ["**/*.ts", "**/*.ets"],
|
|
3
|
+
"ignore": [
|
|
4
|
+
"**/ohosTest/**/*",
|
|
5
|
+
"**/node_modules/**/*",
|
|
6
|
+
"**/hvigorfile.ts",
|
|
7
|
+
"**/node_modules/**/*",
|
|
8
|
+
"**/oh_modules/**/*",
|
|
9
|
+
"**/build/**/*",
|
|
10
|
+
"**/.preview/**/*"
|
|
11
|
+
],
|
|
12
|
+
"plugins": ["@typescript-eslint"],
|
|
13
|
+
"ruleSet": [],
|
|
14
|
+
"rules": {
|
|
15
|
+
"@typescript-eslint/await-thenable": "warn",
|
|
16
|
+
"@typescript-eslint/consistent-type-imports": "warn",
|
|
17
|
+
"@typescript-eslint/explicit-function-return-type": "warn",
|
|
18
|
+
"@typescript-eslint/explicit-module-boundary-types": "warn",
|
|
19
|
+
"@typescript-eslint/no-dynamic-delete": "warn",
|
|
20
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
21
|
+
"@typescript-eslint/no-for-in-array": "warn",
|
|
22
|
+
"@typescript-eslint/no-this-alias": "warn",
|
|
23
|
+
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
|
|
24
|
+
"@typescript-eslint/no-unsafe-argument": "warn",
|
|
25
|
+
"@typescript-eslint/no-unsafe-assignment": "warn",
|
|
26
|
+
"@typescript-eslint/no-unsafe-call": "warn",
|
|
27
|
+
"@typescript-eslint/no-unsafe-member-access": "warn",
|
|
28
|
+
"@typescript-eslint/no-unsafe-return": "warn",
|
|
29
|
+
"@typescript-eslint/prefer-literal-enum-member": "warn"
|
|
30
|
+
},
|
|
31
|
+
"overrides": []
|
|
32
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiType": 'stageMode',
|
|
3
|
+
"buildOption": {
|
|
4
|
+
"externalNativeOptions": {
|
|
5
|
+
"path": "./src/main/cpp/CMakeLists.txt",
|
|
6
|
+
"arguments": "",
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
"targets": [
|
|
10
|
+
{
|
|
11
|
+
"name": "default",
|
|
12
|
+
"runtimeOS": "HarmonyOS"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "ohosTest",
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
|
|
2
|
+
import { createRNOHModulePlugin } from '@rnoh/hvigor-plugin';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
system: hapTasks,
|
|
6
|
+
plugins: [
|
|
7
|
+
createRNOHModulePlugin({
|
|
8
|
+
codegen: {
|
|
9
|
+
rnohModulePath: './oh_modules/@rnoh/react-native-openharmony',
|
|
10
|
+
},
|
|
11
|
+
}),
|
|
12
|
+
],
|
|
13
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.11)
|
|
2
|
+
project(rnapp)
|
|
3
|
+
|
|
4
|
+
set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
5
|
+
set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules")
|
|
6
|
+
set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../oh_modules/@rnoh/react-native-openharmony/src/main/cpp")
|
|
7
|
+
set(RNOH_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/generated")
|
|
8
|
+
set(LOG_VERBOSITY_LEVEL 1)
|
|
9
|
+
set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments")
|
|
10
|
+
set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie")
|
|
11
|
+
set(WITH_HITRACE_SYSTRACE ON)
|
|
12
|
+
set(WITH_HITRACE_REACT_MARKER ON)
|
|
13
|
+
set(OH_MODULES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../oh_modules") # required by 'autolink_libraries'
|
|
14
|
+
|
|
15
|
+
add_subdirectory("${RNOH_CPP_DIR}" ./rn)
|
|
16
|
+
|
|
17
|
+
include("${CMAKE_CURRENT_SOURCE_DIR}/autolinking.cmake")
|
|
18
|
+
|
|
19
|
+
file(GLOB GENERATED_CPP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/generated/*.cpp") # this line is needed by codegen v1
|
|
20
|
+
add_library(rnoh_app SHARED
|
|
21
|
+
${GENERATED_CPP_FILES}
|
|
22
|
+
"./PackageProvider.cpp"
|
|
23
|
+
"${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
|
|
24
|
+
)
|
|
25
|
+
target_link_libraries(rnoh_app PUBLIC rnoh)
|
|
26
|
+
|
|
27
|
+
autolink_libraries(rnoh_app)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#include "RNOH/PackageProvider.h"
|
|
2
|
+
#include "RNOHPackagesFactory.h"
|
|
3
|
+
#include "generated/RNOHGeneratedPackage.h"
|
|
4
|
+
|
|
5
|
+
using namespace rnoh;
|
|
6
|
+
|
|
7
|
+
std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(
|
|
8
|
+
Package::Context ctx) {
|
|
9
|
+
auto packages = createRNOHPackages(ctx); // <= autolinking
|
|
10
|
+
packages.push_back(std::make_shared<RNOHGeneratedPackage>(
|
|
11
|
+
ctx)); // generated by codegen-harmony v1 on app preBuilt stage)
|
|
12
|
+
return packages;
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RNPackageContext, RNOHPackage } from '@rnoh/react-native-openharmony';
|
|
2
|
+
import { createRNOHPackages as createRNOHPackagesAutolinking } from "./RNOHPackagesFactory"
|
|
3
|
+
|
|
4
|
+
export function getRNOHPackages(ctx: RNPackageContext): RNOHPackage[] {
|
|
5
|
+
return [
|
|
6
|
+
...createRNOHPackagesAutolinking(ctx)
|
|
7
|
+
]
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {RNAbility} from '@rnoh/react-native-openharmony';
|
|
2
|
+
|
|
3
|
+
export default class EntryAbility extends RNAbility {
|
|
4
|
+
override getPagePath() {
|
|
5
|
+
return 'pages/Index';
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
override getRNOHWorkerScriptUrl() {
|
|
9
|
+
return "entry/ets/workers/RNOHWorker.ets"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/RNOHPackagesFactory.ets
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Importing some ets files in the following way results in runtime errors e.g.
|
|
3
|
+
* import { setupRNOHWorker } from "@rnoh/react-native-openharmony"
|
|
4
|
+
*
|
|
5
|
+
* It looks like this is ArkTS problem and it may be fixed in the future.
|
|
6
|
+
* For the time being, use direct imports.
|
|
7
|
+
*/
|
|
8
|
+
import { setupRNOHWorker } from "@rnoh/react-native-openharmony/src/main/ets/setupRNOHWorker"
|
|
9
|
+
import { getRNOHPackages } from "../PackageProvider"
|
|
10
|
+
|
|
11
|
+
setupRNOHWorker({
|
|
12
|
+
createWorkerRNInstanceConfig: (_rnInstanceName) => {
|
|
13
|
+
return { thirdPartyPackagesFactory: getRNOHPackages }
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"module": {
|
|
3
|
+
"name": "entry",
|
|
4
|
+
"type": "entry",
|
|
5
|
+
"description": "$string:module_desc",
|
|
6
|
+
"mainElement": "EntryAbility",
|
|
7
|
+
"deviceTypes": [
|
|
8
|
+
"default"
|
|
9
|
+
],
|
|
10
|
+
"deliveryWithInstall": true,
|
|
11
|
+
"installationFree": false,
|
|
12
|
+
"pages": "$profile:main_pages",
|
|
13
|
+
// This is needed by bundleManager.canOpenLink to check if the app can open some url
|
|
14
|
+
"querySchemes": [
|
|
15
|
+
"maps",
|
|
16
|
+
"http",
|
|
17
|
+
"https",
|
|
18
|
+
"customDomain"
|
|
19
|
+
],
|
|
20
|
+
"requestPermissions": [
|
|
21
|
+
{
|
|
22
|
+
"name": "ohos.permission.INTERNET"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "ohos.permission.VIBRATE"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"metadata": [
|
|
29
|
+
{
|
|
30
|
+
"name": "OPTLazyForEach",
|
|
31
|
+
"value": "true",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "can_preview_text",
|
|
35
|
+
"value": "true",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "halfLeading",
|
|
39
|
+
"value": "true",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
"abilities": [
|
|
43
|
+
{
|
|
44
|
+
"name": "EntryAbility",
|
|
45
|
+
"srcEntry": "./ets/entryability/EntryAbility.ets",
|
|
46
|
+
"description": "$string:EntryAbility_desc",
|
|
47
|
+
"icon": "$media:layered_image",
|
|
48
|
+
"label": "$string:EntryAbility_label",
|
|
49
|
+
"startWindowIcon": "$media:startIcon",
|
|
50
|
+
"startWindowBackground": "$color:start_window_background",
|
|
51
|
+
"visible": true,
|
|
52
|
+
"skills": [
|
|
53
|
+
{
|
|
54
|
+
"entities": [
|
|
55
|
+
"entity.system.home"
|
|
56
|
+
],
|
|
57
|
+
"actions": [
|
|
58
|
+
"action.system.home"
|
|
59
|
+
],
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rawfile/assets
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
modelVersion: '5.0.0',
|
|
3
|
+
dependencies: {
|
|
4
|
+
// "@rnoh/hvigor-plugin": "../../node_modules/<RNOH_CLI>/harmony/rnoh-hvigor-plugin-X.X.X.tgz",
|
|
5
|
+
},
|
|
6
|
+
execution: {
|
|
7
|
+
// "analyze": "default", /* Define the build analyze mode. Value: [ "default" | "verbose" | false ]. Default: "default" */
|
|
8
|
+
// "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
|
|
9
|
+
// "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
|
|
10
|
+
// "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
|
|
11
|
+
// "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
|
|
12
|
+
},
|
|
13
|
+
logging: {
|
|
14
|
+
// "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
|
|
15
|
+
},
|
|
16
|
+
debugging: {
|
|
17
|
+
// "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
|
|
18
|
+
},
|
|
19
|
+
nodeOptions: {
|
|
20
|
+
// "maxOldSpaceSize": 4096 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process */
|
|
21
|
+
},
|
|
22
|
+
}
|
package/dist/io/CliExecutor.js
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -23,92 +8,55 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
23
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
9
|
});
|
|
25
10
|
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
28
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
12
|
exports.RealCliExecutor = exports.CliExecutor = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
return CliExecutor;
|
|
60
|
-
}());
|
|
13
|
+
const node_child_process_1 = require("node:child_process");
|
|
14
|
+
class CliExecutor {
|
|
15
|
+
}
|
|
61
16
|
exports.CliExecutor = CliExecutor;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
reject(new Error("Command failed with code ".concat(code, "\nStderr: ").concat(stderr)));
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
})];
|
|
17
|
+
class RealCliExecutor extends CliExecutor {
|
|
18
|
+
run(command, options) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
let commandWithArgs = command;
|
|
23
|
+
let argStrings = [];
|
|
24
|
+
if (options === null || options === void 0 ? void 0 : options.args) {
|
|
25
|
+
argStrings = options.args;
|
|
26
|
+
commandWithArgs += ' ' + argStrings.join(' ');
|
|
27
|
+
}
|
|
28
|
+
(_a = options === null || options === void 0 ? void 0 : options.onArgsStringified) === null || _a === void 0 ? void 0 : _a.call(options, commandWithArgs);
|
|
29
|
+
const process = (0, node_child_process_1.spawn)(command, argStrings, {
|
|
30
|
+
cwd: (_b = options === null || options === void 0 ? void 0 : options.cwd) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
31
|
+
shell: (options === null || options === void 0 ? void 0 : options.shell) ? true : false,
|
|
32
|
+
});
|
|
33
|
+
let stdout = '';
|
|
34
|
+
let stderr = '';
|
|
35
|
+
process.stdout.on('data', (data) => {
|
|
36
|
+
var _a;
|
|
37
|
+
const output = data.toString();
|
|
38
|
+
stdout += output;
|
|
39
|
+
(_a = options === null || options === void 0 ? void 0 : options.onStdout) === null || _a === void 0 ? void 0 : _a.call(options, output);
|
|
40
|
+
});
|
|
41
|
+
process.stderr.on('data', (data) => {
|
|
42
|
+
var _a;
|
|
43
|
+
const output = data.toString();
|
|
44
|
+
stderr += output;
|
|
45
|
+
(_a = options === null || options === void 0 ? void 0 : options.onStderr) === null || _a === void 0 ? void 0 : _a.call(options, output);
|
|
46
|
+
});
|
|
47
|
+
process.on('error', (error) => {
|
|
48
|
+
reject(error);
|
|
49
|
+
});
|
|
50
|
+
process.on('close', (code) => {
|
|
51
|
+
if (code === 0) {
|
|
52
|
+
resolve(stdout);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
reject(new Error(`Command failed with code ${code}\nStderr: ${stderr}`));
|
|
56
|
+
}
|
|
57
|
+
});
|
|
109
58
|
});
|
|
110
59
|
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
}(CliExecutor));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
114
62
|
exports.RealCliExecutor = RealCliExecutor;
|