@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
package/dist/core/PackageJSON.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PackageJSON = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.packageRootPath = packageRootPath;
|
|
10
|
-
this.projectRootPath = projectRootPath;
|
|
11
|
-
}
|
|
12
|
-
PackageJSON.fromProjectRootPath = function (fs, packageRootPath, projectRootPath) {
|
|
13
|
-
var packageJSONPath = packageRootPath.copyWithNewSegment('package.json');
|
|
4
|
+
const CodegenConfig_1 = require("./CodegenConfig");
|
|
5
|
+
const DescriptiveError_1 = require("./DescriptiveError");
|
|
6
|
+
class PackageJSON {
|
|
7
|
+
static fromProjectRootPath(fs, packageRootPath, projectRootPath) {
|
|
8
|
+
const packageJSONPath = packageRootPath.copyWithNewSegment('package.json');
|
|
14
9
|
if (!fs.existsSync(packageJSONPath)) {
|
|
15
10
|
throw new DescriptiveError_1.DescriptiveError({
|
|
16
11
|
whatHappened: "Couldn't find 'package.json'",
|
|
@@ -27,33 +22,25 @@ var PackageJSON = /** @class */ (function () {
|
|
|
27
22
|
catch (err) {
|
|
28
23
|
throw new DescriptiveError_1.DescriptiveError({
|
|
29
24
|
whatHappened: "Couldn't parse package.json",
|
|
30
|
-
extraData: { packageJSONPath
|
|
25
|
+
extraData: { packageJSONPath, err },
|
|
31
26
|
});
|
|
32
27
|
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
get: function () {
|
|
50
|
-
return this.rawPackageJSON.harmony;
|
|
51
|
-
},
|
|
52
|
-
enumerable: false,
|
|
53
|
-
configurable: true
|
|
54
|
-
});
|
|
55
|
-
PackageJSON.prototype.getCodegenConfigs = function () {
|
|
56
|
-
var _this = this;
|
|
28
|
+
}
|
|
29
|
+
constructor(rawPackageJSON, packageRootPath, projectRootPath) {
|
|
30
|
+
this.rawPackageJSON = rawPackageJSON;
|
|
31
|
+
this.packageRootPath = packageRootPath;
|
|
32
|
+
this.projectRootPath = projectRootPath;
|
|
33
|
+
}
|
|
34
|
+
get name() {
|
|
35
|
+
return this.rawPackageJSON.name;
|
|
36
|
+
}
|
|
37
|
+
get version() {
|
|
38
|
+
return this.rawPackageJSON.version;
|
|
39
|
+
}
|
|
40
|
+
get harmony() {
|
|
41
|
+
return this.rawPackageJSON.harmony;
|
|
42
|
+
}
|
|
43
|
+
getCodegenConfigs() {
|
|
57
44
|
var _a;
|
|
58
45
|
/**
|
|
59
46
|
* Shared codegenConfig is not used on purpose. Android, iOS and other platforms shouldn't
|
|
@@ -61,19 +48,16 @@ var PackageJSON = /** @class */ (function () {
|
|
|
61
48
|
* that the shape of the shared config, to allow specifying which specific turbo modules or
|
|
62
49
|
* fabric components should be code generated.
|
|
63
50
|
*/
|
|
64
|
-
|
|
51
|
+
const rawCodegenConfig = (_a = this.rawPackageJSON.harmony) === null || _a === void 0 ? void 0 : _a.codegenConfig;
|
|
65
52
|
if (!rawCodegenConfig) {
|
|
66
53
|
return [];
|
|
67
54
|
}
|
|
68
55
|
if (Array.isArray(rawCodegenConfig)) {
|
|
69
|
-
return rawCodegenConfig.map(
|
|
70
|
-
return CodegenConfig_1.CodegenConfig.fromRawCodegenConfig(config, _this.packageRootPath, _this.projectRootPath, _this.name);
|
|
71
|
-
});
|
|
56
|
+
return rawCodegenConfig.map((config) => CodegenConfig_1.CodegenConfig.fromRawCodegenConfig(config, this.packageRootPath, this.projectRootPath, this.name));
|
|
72
57
|
}
|
|
73
58
|
return [
|
|
74
59
|
CodegenConfig_1.CodegenConfig.fromRawCodegenConfig(rawCodegenConfig, this.packageRootPath, this.projectRootPath, this.name),
|
|
75
60
|
];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}());
|
|
61
|
+
}
|
|
62
|
+
}
|
|
79
63
|
exports.PackageJSON = PackageJSON;
|
|
@@ -8,120 +8,68 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
12
|
exports.ProjectDependenciesManager = exports.ProjectDependency = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
13
|
+
const PackageJSON_1 = require("./PackageJSON");
|
|
14
|
+
class ProjectDependency {
|
|
15
|
+
constructor(fs, packageRootPath, projectRootPath) {
|
|
43
16
|
this.fs = fs;
|
|
44
17
|
this.packageRootPath = packageRootPath;
|
|
45
18
|
this.projectRootPath = projectRootPath;
|
|
46
19
|
}
|
|
47
|
-
|
|
20
|
+
getRootPath() {
|
|
48
21
|
return this.packageRootPath;
|
|
49
|
-
}
|
|
50
|
-
|
|
22
|
+
}
|
|
23
|
+
getCodegenConfigs() {
|
|
51
24
|
return this.readPackageJSON().getCodegenConfigs();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
25
|
+
}
|
|
26
|
+
getHarFilePaths() {
|
|
27
|
+
const packageHarmonyPath = this.packageRootPath.copyWithNewSegment('harmony');
|
|
55
28
|
if (this.fs.existsSync(packageHarmonyPath)) {
|
|
56
29
|
return this.fs.findFilePathsWithExtensions(packageHarmonyPath, ['har']);
|
|
57
30
|
}
|
|
58
31
|
else {
|
|
59
32
|
return this.fs.findFilePathsWithExtensions(this.packageRootPath, ['har']);
|
|
60
33
|
}
|
|
61
|
-
}
|
|
62
|
-
|
|
34
|
+
}
|
|
35
|
+
readPackageJSON() {
|
|
63
36
|
return PackageJSON_1.PackageJSON.fromProjectRootPath(this.fs, this.packageRootPath, this.projectRootPath);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
}());
|
|
37
|
+
}
|
|
38
|
+
}
|
|
67
39
|
exports.ProjectDependency = ProjectDependency;
|
|
68
|
-
|
|
69
|
-
|
|
40
|
+
class ProjectDependenciesManager {
|
|
41
|
+
constructor(fs, projectRootPath) {
|
|
70
42
|
this.fs = fs;
|
|
71
43
|
this.projectRootPath = projectRootPath;
|
|
72
44
|
}
|
|
73
|
-
|
|
74
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
75
|
-
|
|
76
|
-
switch (_a.label) {
|
|
77
|
-
case 0: return [4 /*yield*/, this.forEachDependencyInDirectory(cb, this.projectRootPath.copyWithNewSegment('node_modules'))];
|
|
78
|
-
case 1:
|
|
79
|
-
_a.sent();
|
|
80
|
-
return [2 /*return*/];
|
|
81
|
-
}
|
|
82
|
-
});
|
|
45
|
+
forEachAsync(cb) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
yield this.forEachDependencyInDirectory(cb, this.projectRootPath.copyWithNewSegment('node_modules'));
|
|
83
48
|
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (!dirent.name.startsWith('.')) return [3 /*break*/, 2];
|
|
101
|
-
return [3 /*break*/, 6];
|
|
102
|
-
case 2:
|
|
103
|
-
if (!dirent.name.startsWith('@')) return [3 /*break*/, 4];
|
|
104
|
-
return [4 /*yield*/, this.forEachDependencyInDirectory(cb, directoryPath.copyWithNewSegment(dirent.name))];
|
|
105
|
-
case 3:
|
|
106
|
-
_b.sent();
|
|
107
|
-
return [3 /*break*/, 6];
|
|
108
|
-
case 4:
|
|
109
|
-
potentialDependencyRootPath = directoryPath.copyWithNewSegment(dirent.name);
|
|
49
|
+
}
|
|
50
|
+
forEachDependencyInDirectory(cb, directoryPath) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
if (!this.fs.existsSync(directoryPath)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
for (let dirent of this.fs.readDirentsSync(directoryPath)) {
|
|
56
|
+
if (dirent.isDirectory() || dirent.isSymbolicLink()) {
|
|
57
|
+
if (dirent.name.startsWith('.')) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
else if (dirent.name.startsWith('@')) {
|
|
61
|
+
yield this.forEachDependencyInDirectory(cb, directoryPath.copyWithNewSegment(dirent.name));
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const potentialDependencyRootPath = directoryPath.copyWithNewSegment(dirent.name);
|
|
110
65
|
if (!this.fs.existsSync(potentialDependencyRootPath.copyWithNewSegment('package.json'))) {
|
|
111
|
-
|
|
66
|
+
continue;
|
|
112
67
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
_b.sent();
|
|
116
|
-
_b.label = 6;
|
|
117
|
-
case 6:
|
|
118
|
-
_i++;
|
|
119
|
-
return [3 /*break*/, 1];
|
|
120
|
-
case 7: return [2 /*return*/];
|
|
68
|
+
yield cb(new ProjectDependency(this.fs, potentialDependencyRootPath, this.projectRootPath));
|
|
69
|
+
}
|
|
121
70
|
}
|
|
122
|
-
}
|
|
71
|
+
}
|
|
123
72
|
});
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
}());
|
|
73
|
+
}
|
|
74
|
+
}
|
|
127
75
|
exports.ProjectDependenciesManager = ProjectDependenciesManager;
|
|
@@ -1,26 +1,6 @@
|
|
|
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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.ValidationError = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
function ValidationError() {
|
|
22
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
23
|
-
}
|
|
24
|
-
return ValidationError;
|
|
25
|
-
}(Error));
|
|
4
|
+
class ValidationError extends Error {
|
|
5
|
+
}
|
|
26
6
|
exports.ValidationError = ValidationError;
|
package/dist/core/fs.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
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.maybeMakeDirectories = maybeMakeDirectories;
|
|
4
7
|
exports.maybeRemoveFilesInDirectory = maybeRemoveFilesInDirectory;
|
|
5
8
|
exports.maybeReadFile = maybeReadFile;
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
+
const DescriptiveError_1 = require("./DescriptiveError");
|
|
8
11
|
function maybeMakeDirectories(path) {
|
|
9
12
|
if (!node_fs_1.default.existsSync(path.getValue())) {
|
|
10
13
|
node_fs_1.default.mkdirSync(path.getValue(), { recursive: true });
|
|
@@ -17,12 +20,12 @@ function maybeRemoveFilesInDirectory(path) {
|
|
|
17
20
|
if (!node_fs_1.default.lstatSync(path.getValue()).isDirectory()) {
|
|
18
21
|
throw new DescriptiveError_1.DescriptiveError({
|
|
19
22
|
whatHappened: "Tried to remove all files from a path that doesn't point to a directory",
|
|
20
|
-
whatCanUserDo: [
|
|
23
|
+
whatCanUserDo: [`Verify path: ${path.getValue()}`],
|
|
21
24
|
});
|
|
22
25
|
}
|
|
23
|
-
|
|
24
|
-
fileOrDirNames.forEach(
|
|
25
|
-
|
|
26
|
+
const fileOrDirNames = node_fs_1.default.readdirSync(path.getValue());
|
|
27
|
+
fileOrDirNames.forEach((fileOrDirName) => {
|
|
28
|
+
const maybeFilePath = path.copyWithNewSegment(fileOrDirName);
|
|
26
29
|
if (node_fs_1.default.statSync(maybeFilePath.getValue()).isDirectory()) {
|
|
27
30
|
return;
|
|
28
31
|
}
|
|
@@ -38,7 +41,7 @@ function maybeReadFile(path) {
|
|
|
38
41
|
if (!node_fs_1.default.lstatSync(path.getValue()).isFile()) {
|
|
39
42
|
throw new DescriptiveError_1.DescriptiveError({
|
|
40
43
|
whatHappened: "Tried to read a path that doesn't point to a file",
|
|
41
|
-
whatCanUserDo: [
|
|
44
|
+
whatCanUserDo: [`Verify path: ${path.getValue()}`],
|
|
42
45
|
});
|
|
43
46
|
}
|
|
44
47
|
return node_fs_1.default.readFileSync(path.getValue(), 'utf-8');
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
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.AppScopeAppJSON5Template = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
const mustache_1 = __importDefault(require("mustache"));
|
|
8
|
+
const TEMPLATE = `
|
|
9
|
+
{
|
|
10
|
+
"app": {
|
|
11
|
+
"bundleName": "{{bundleName}}",
|
|
12
|
+
"vendor": "example",
|
|
13
|
+
"versionCode": 1000000,
|
|
14
|
+
"versionName": "1.0.0",
|
|
15
|
+
"icon": "$media:app_icon",
|
|
16
|
+
"label": "$string:app_name",
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
class AppScopeAppJSON5Template {
|
|
21
|
+
constructor(bundleName) {
|
|
8
22
|
this.bundleName = bundleName;
|
|
9
23
|
}
|
|
10
|
-
|
|
24
|
+
build() {
|
|
11
25
|
return mustache_1.default.render(TEMPLATE.trimStart(), {
|
|
12
26
|
bundleName: this.bundleName,
|
|
13
27
|
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
}());
|
|
28
|
+
}
|
|
29
|
+
}
|
|
17
30
|
exports.AppScopeAppJSON5Template = AppScopeAppJSON5Template;
|
|
@@ -1,17 +1,28 @@
|
|
|
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.AppScopeStringVarTemplate = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
const mustache_1 = __importDefault(require("mustache"));
|
|
8
|
+
const TEMPLATE = `
|
|
9
|
+
{
|
|
10
|
+
"string": [
|
|
11
|
+
{
|
|
12
|
+
"name": "app_name",
|
|
13
|
+
"value": "{{name}}"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
class AppScopeStringVarTemplate {
|
|
19
|
+
constructor(name) {
|
|
8
20
|
this.name = name;
|
|
9
21
|
}
|
|
10
|
-
|
|
22
|
+
build() {
|
|
11
23
|
return mustache_1.default.render(TEMPLATE.trimStart(), {
|
|
12
24
|
name: this.name,
|
|
13
25
|
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
}());
|
|
26
|
+
}
|
|
27
|
+
}
|
|
17
28
|
exports.AppScopeStringVarTemplate = AppScopeStringVarTemplate;
|
|
@@ -1,17 +1,65 @@
|
|
|
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.EntryIndexTemplate = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
const mustache_1 = __importDefault(require("mustache"));
|
|
8
|
+
const TEMPLATE = `
|
|
9
|
+
import {
|
|
10
|
+
AnyJSBundleProvider,
|
|
11
|
+
MetroJSBundleProvider,
|
|
12
|
+
RNApp,
|
|
13
|
+
RNOHErrorDialog,
|
|
14
|
+
ResourceJSBundleProvider,
|
|
15
|
+
RNOHCoreContext
|
|
16
|
+
} from '@rnoh/react-native-openharmony';
|
|
17
|
+
import { getRNOHPackages } from '../PackageProvider';
|
|
18
|
+
|
|
19
|
+
@Entry
|
|
20
|
+
@Component
|
|
21
|
+
struct Index {
|
|
22
|
+
@StorageLink('RNOHCoreContext') private rnohCoreContext: RNOHCoreContext | undefined = undefined
|
|
23
|
+
|
|
24
|
+
build() {
|
|
25
|
+
Column() {
|
|
26
|
+
if (this.rnohCoreContext) {
|
|
27
|
+
if (this.rnohCoreContext?.isDebugModeEnabled) {
|
|
28
|
+
RNOHErrorDialog({ ctx: this.rnohCoreContext })
|
|
29
|
+
}
|
|
30
|
+
RNApp({
|
|
31
|
+
rnInstanceConfig: {
|
|
32
|
+
name: "{{name}}",
|
|
33
|
+
createRNPackages: getRNOHPackages,
|
|
34
|
+
fontResourceByFontFamily: {},
|
|
35
|
+
enableDebugger: this.rnohCoreContext?.isDebugModeEnabled,
|
|
36
|
+
},
|
|
37
|
+
appKey: "{{name}}",
|
|
38
|
+
jsBundleProvider: this.rnohCoreContext?.isDebugModeEnabled ?
|
|
39
|
+
new AnyJSBundleProvider([
|
|
40
|
+
new MetroJSBundleProvider(),
|
|
41
|
+
new ResourceJSBundleProvider(this.rnohCoreContext.uiAbilityContext.resourceManager, 'hermes_bundle.hbc'),
|
|
42
|
+
]) :
|
|
43
|
+
/**
|
|
44
|
+
* NOTE: The HBC format is recommended for Hermes in a production environment. HBC provides better performance and loading times.
|
|
45
|
+
*/
|
|
46
|
+
new ResourceJSBundleProvider(this.rnohCoreContext.uiAbilityContext.resourceManager, 'hermes_bundle.hbc'),
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
.height('100%')
|
|
51
|
+
.width('100%')
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
class EntryIndexTemplate {
|
|
56
|
+
constructor(name) {
|
|
8
57
|
this.name = name;
|
|
9
58
|
}
|
|
10
|
-
|
|
59
|
+
build() {
|
|
11
60
|
return mustache_1.default.render(TEMPLATE.trimStart(), {
|
|
12
61
|
name: this.name,
|
|
13
62
|
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
}());
|
|
63
|
+
}
|
|
64
|
+
}
|
|
17
65
|
exports.EntryIndexTemplate = EntryIndexTemplate;
|
|
@@ -1,19 +1,38 @@
|
|
|
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.EntryStringVarTemplate = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
const mustache_1 = __importDefault(require("mustache"));
|
|
8
|
+
const TEMPLATE = `
|
|
9
|
+
{
|
|
10
|
+
"string": [
|
|
11
|
+
{
|
|
12
|
+
"name": "module_desc",
|
|
13
|
+
"value": "{{description}}"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "EntryAbility_desc",
|
|
17
|
+
"value": "{{description}}"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "EntryAbility_label",
|
|
21
|
+
"value": "{{name}}"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
class EntryStringVarTemplate {
|
|
27
|
+
constructor(name, description) {
|
|
8
28
|
this.name = name;
|
|
9
29
|
this.description = description;
|
|
10
30
|
}
|
|
11
|
-
|
|
31
|
+
build() {
|
|
12
32
|
return mustache_1.default.render(TEMPLATE.trimStart(), {
|
|
13
33
|
name: this.name,
|
|
14
34
|
description: this.description,
|
|
15
35
|
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
}());
|
|
36
|
+
}
|
|
37
|
+
}
|
|
19
38
|
exports.EntryStringVarTemplate = EntryStringVarTemplate;
|
|
@@ -1,19 +1,44 @@
|
|
|
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.HvigorConfigJson5Template = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
const mustache_1 = __importDefault(require("mustache"));
|
|
8
|
+
const TEMPLATE = `
|
|
9
|
+
{
|
|
10
|
+
"modelVersion": "5.0.0",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@rnoh/hvigor-plugin": "../../node_modules/{{{rnohCliNpmPackageName}}}/harmony/{{{rnohHvigorPluginFilename}}}", // <PROJECT_ROOT>/node_modules/<RNOH_CLI>/harmony/rnoh-hvigor-plugin-X.X.X.tgz
|
|
13
|
+
},
|
|
14
|
+
"execution": {
|
|
15
|
+
// "analyze": "default", /* Define the build analyze mode. Value: [ "default" | "verbose" | false ]. Default: "default" */
|
|
16
|
+
// "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
|
|
17
|
+
// "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
|
|
18
|
+
// "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
|
|
19
|
+
// "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
|
|
20
|
+
},
|
|
21
|
+
"logging": {
|
|
22
|
+
// "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
|
|
23
|
+
},
|
|
24
|
+
"debugging": {
|
|
25
|
+
// "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
|
|
26
|
+
},
|
|
27
|
+
"nodeOptions": {
|
|
28
|
+
// "maxOldSpaceSize": 4096 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process */
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
class HvigorConfigJson5Template {
|
|
33
|
+
constructor(rnohCliNpmPackageName, rnohHvigorPluginFilename) {
|
|
8
34
|
this.rnohCliNpmPackageName = rnohCliNpmPackageName;
|
|
9
35
|
this.rnohHvigorPluginFilename = rnohHvigorPluginFilename;
|
|
10
36
|
}
|
|
11
|
-
|
|
37
|
+
build() {
|
|
12
38
|
return mustache_1.default.render(TEMPLATE.trimStart(), {
|
|
13
39
|
rnohCliNpmPackageName: this.rnohCliNpmPackageName,
|
|
14
40
|
rnohHvigorPluginFilename: this.rnohHvigorPluginFilename,
|
|
15
41
|
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
}());
|
|
42
|
+
}
|
|
43
|
+
}
|
|
19
44
|
exports.HvigorConfigJson5Template = HvigorConfigJson5Template;
|
|
@@ -1,17 +1,47 @@
|
|
|
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.MetroConfigTemplate = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
const mustache_1 = __importDefault(require("mustache"));
|
|
8
|
+
const TEMPLATE = `
|
|
9
|
+
const {mergeConfig, getDefaultConfig} = require('@react-native/metro-config');
|
|
10
|
+
const {
|
|
11
|
+
createHarmonyMetroConfig,
|
|
12
|
+
} = require('{{{reactNativeHarmonyPackageName}}}/metro.config');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @type {import("metro-config").MetroConfig}
|
|
16
|
+
*/
|
|
17
|
+
const config = {
|
|
18
|
+
transformer: {
|
|
19
|
+
getTransformOptions: async () => ({
|
|
20
|
+
transform: {
|
|
21
|
+
experimentalImportSupport: false,
|
|
22
|
+
inlineRequires: true,
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
module.exports = mergeConfig(
|
|
29
|
+
getDefaultConfig(__dirname),
|
|
30
|
+
createHarmonyMetroConfig({
|
|
31
|
+
reactNativeHarmonyPackageName: '{{{reactNativeHarmonyPackageName}}}',
|
|
32
|
+
}),
|
|
33
|
+
config,
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
`;
|
|
37
|
+
class MetroConfigTemplate {
|
|
38
|
+
constructor(reactNativeHarmonyPackageName) {
|
|
8
39
|
this.reactNativeHarmonyPackageName = reactNativeHarmonyPackageName;
|
|
9
40
|
}
|
|
10
|
-
|
|
41
|
+
build() {
|
|
11
42
|
return mustache_1.default.render(TEMPLATE.trimStart(), {
|
|
12
43
|
reactNativeHarmonyPackageName: this.reactNativeHarmonyPackageName,
|
|
13
44
|
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
}());
|
|
45
|
+
}
|
|
46
|
+
}
|
|
17
47
|
exports.MetroConfigTemplate = MetroConfigTemplate;
|