@react-native-oh/react-native-harmony-cli 0.0.27 → 0.0.28
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/README.md +12 -0
- package/dist/assetResolver.js +6 -0
- package/dist/autolinking/Autolinking.js +275 -0
- package/dist/autolinking/index.js +23 -0
- package/dist/codegen/core/CodeGenerator.js +6 -0
- package/dist/codegen/core/CodegenError.js +6 -0
- package/dist/codegen/core/EventUtils.js +6 -0
- package/dist/codegen/core/TypeAnnotationToTS.js +6 -0
- package/dist/codegen/core/UberSchema.js +9 -3
- package/dist/codegen/core/index.js +6 -0
- package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +6 -0
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +6 -0
- package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +6 -0
- package/dist/codegen/generators/CppComponentCodeGenerator.js +6 -0
- package/dist/codegen/generators/LibGlueCodeGenerator.js +6 -0
- package/dist/codegen/generators/NativeModuleCodeGenerator.js +6 -0
- package/dist/codegen/generators/SharedComponentCodeGenerator.js +6 -0
- package/dist/codegen/generators/UberGeneratorV1.js +6 -0
- package/dist/codegen/generators/UberGeneratorV2.js +6 -0
- package/dist/codegen/generators/index.js +6 -0
- package/dist/codegen/index.js +6 -0
- package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +6 -0
- package/dist/codegen/templates/BasePackageHTemplate.js +6 -0
- package/dist/codegen/templates/ComponentDescriptorHTemplate.js +6 -0
- package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +6 -0
- package/dist/codegen/templates/ComponentUtilsTSTemplate.js +6 -0
- package/dist/codegen/templates/IndexTSTemplate.js +6 -0
- package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +6 -0
- package/dist/codegen/templates/TurboModuleCppTemplate.js +6 -0
- package/dist/codegen/templates/TurboModuleHTemplate.js +6 -0
- package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +6 -0
- package/dist/codegen/templates/index.js +6 -0
- package/dist/commands/bundle-harmony.js +6 -0
- package/dist/commands/codegen-harmony.js +16 -10
- package/dist/commands/codegen-lib-harmony.js +6 -0
- package/dist/commands/create-metro-host-constants.js +6 -0
- package/dist/commands/index.js +7 -0
- package/dist/commands/link-harmony.js +97 -0
- package/dist/commands/pack-harmony.js +6 -0
- package/dist/commands/unpack-harmony.js +10 -3
- package/dist/commands/verify-package-harmony.js +6 -0
- package/dist/core/AbsolutePath.js +12 -0
- package/dist/core/CodegenConfig.js +6 -0
- package/dist/core/DescriptiveError.js +6 -0
- package/dist/core/FileSystem.js +33 -0
- package/dist/core/OHPackageJSON5.js +6 -0
- package/dist/core/PackageJSON.js +15 -7
- package/dist/core/ProjectDependenciesManager.js +31 -18
- package/dist/core/ValidationError.js +6 -0
- package/dist/core/ValueObject.js +6 -0
- package/dist/core/fs.js +6 -0
- package/dist/core/index.js +7 -0
- package/dist/index.js +7 -0
- package/dist/io/CliExecutor.js +35 -0
- package/dist/io/Logger.js +9 -0
- package/dist/io/RealFS.js +68 -0
- package/dist/io/TarGz.js +6 -0
- package/dist/io/__fixtures__.js +127 -0
- package/dist/io/fsUtils.js +20 -6
- package/dist/io/index.js +7 -0
- package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +6 -0
- package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +6 -0
- package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +6 -0
- package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +6 -0
- package/dist/package-verifier/checks/index.js +6 -0
- package/dist/package-verifier/index.js +6 -0
- package/dist/package-verifier/types.js +6 -0
- package/dist/package-verifier/verify-package.js +7 -1
- package/jest.config.js +7 -0
- package/package.json +8 -2
- package/react-native.config.js +7 -0
- package/src/assetResolver.ts +7 -0
- package/src/autolinking/Autolinking.test.ts +483 -0
- package/src/autolinking/Autolinking.ts +384 -0
- package/src/autolinking/index.ts +8 -0
- package/src/codegen/core/CodeGenerator.ts +7 -0
- package/src/codegen/core/CodegenError.ts +7 -0
- package/src/codegen/core/EventUtils.ts +7 -0
- package/src/codegen/core/TypeAnnotationToTS.test.ts +7 -0
- package/src/codegen/core/TypeAnnotationToTS.ts +7 -0
- package/src/codegen/core/UberSchema.ts +11 -1
- package/src/codegen/core/index.ts +7 -0
- package/src/codegen/generators/AppBuildTimeGlueCodeGenerator.ts +7 -0
- package/src/codegen/generators/ArkTSComponentCodeGeneratorArkTS.ts +7 -0
- package/src/codegen/generators/ArkTSComponentCodeGeneratorCAPI.ts +7 -0
- package/src/codegen/generators/CppComponentCodeGenerator.ts +7 -0
- package/src/codegen/generators/LibGlueCodeGenerator.ts +7 -0
- package/src/codegen/generators/NativeModuleCodeGenerator.ts +7 -0
- package/src/codegen/generators/SharedComponentCodeGenerator.ts +7 -0
- package/src/codegen/generators/UberGeneratorV1.ts +7 -0
- package/src/codegen/generators/UberGeneratorV2.ts +7 -0
- package/src/codegen/generators/index.ts +7 -0
- package/src/codegen/index.ts +7 -0
- package/src/codegen/templates/BaseComponentInstanceHTemplate.ts +7 -0
- package/src/codegen/templates/BasePackageHTemplate.ts +7 -0
- package/src/codegen/templates/ComponentDescriptorHTemplate.ts +7 -0
- package/src/codegen/templates/ComponentJSIBinderHTemplate.ts +7 -0
- package/src/codegen/templates/ComponentUtilsTSTemplate.ts +7 -0
- package/src/codegen/templates/IndexTSTemplate.ts +7 -0
- package/src/codegen/templates/RNOHGeneratedPackageHTemplate.ts +7 -0
- package/src/codegen/templates/TurboModuleCppTemplate.ts +7 -0
- package/src/codegen/templates/TurboModuleHTemplate.ts +7 -0
- package/src/codegen/templates/TurboModuleSpecTSTemplate.ts +7 -0
- package/src/codegen/templates/index.ts +7 -0
- package/src/commands/bundle-harmony.ts +8 -1
- package/src/commands/codegen-harmony.ts +19 -6
- package/src/commands/codegen-lib-harmony.ts +7 -0
- package/src/commands/create-metro-host-constants.ts +7 -0
- package/src/commands/index.ts +8 -0
- package/src/commands/link-harmony.ts +102 -0
- package/src/commands/pack-harmony.ts +7 -0
- package/src/commands/unpack-harmony.ts +12 -3
- package/src/commands/verify-package-harmony.ts +7 -0
- package/src/core/AbsolutePath.ts +16 -0
- package/src/core/CodegenConfig.ts +7 -0
- package/src/core/DescriptiveError.ts +7 -0
- package/src/core/FileSystem.ts +57 -0
- package/src/core/OHPackageJSON5.ts +7 -0
- package/src/core/PackageJSON.ts +40 -8
- package/src/core/ProjectDependenciesManager.ts +40 -14
- package/src/core/ValidationError.ts +7 -0
- package/src/core/ValueObject.ts +7 -0
- package/src/core/fs.ts +7 -0
- package/src/core/index.ts +8 -0
- package/src/index.ts +9 -0
- package/src/io/CliExecutor.ts +47 -0
- package/src/io/Logger.ts +11 -0
- package/src/io/RealFS.ts +62 -0
- package/src/io/TarGz.ts +7 -0
- package/src/io/__fixtures__.ts +135 -0
- package/src/io/fsUtils.ts +26 -6
- package/src/io/index.ts +8 -0
- package/src/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.ts +7 -0
- package/src/package-verifier/checks/HarmonyDirExistsCheck.ts +7 -0
- package/src/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.ts +7 -0
- package/src/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.ts +7 -0
- package/src/package-verifier/checks/index.ts +7 -0
- package/src/package-verifier/index.ts +7 -0
- package/src/package-verifier/types.ts +7 -0
- package/src/package-verifier/verify-package.ts +9 -1
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CliExecutor = void 0;
|
|
10
|
+
class CliExecutor {
|
|
11
|
+
stringifyCliArgs(args) {
|
|
12
|
+
return Object.entries(args)
|
|
13
|
+
.filter(([_, value]) => {
|
|
14
|
+
if (typeof value === 'boolean') {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
return value !== undefined && value !== null;
|
|
18
|
+
})
|
|
19
|
+
.map(([key, value]) => {
|
|
20
|
+
const formattedKey = toKebabCase(key);
|
|
21
|
+
if (typeof value === 'boolean') {
|
|
22
|
+
return `--${formattedKey}`;
|
|
23
|
+
}
|
|
24
|
+
return `--${formattedKey} ${value}`;
|
|
25
|
+
})
|
|
26
|
+
.join(' ');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.CliExecutor = CliExecutor;
|
|
30
|
+
function toKebabCase(str) {
|
|
31
|
+
return str
|
|
32
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
33
|
+
.replace(/[\s_]+/g, '-')
|
|
34
|
+
.toLowerCase();
|
|
35
|
+
}
|
package/dist/io/Logger.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
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
|
+
*/
|
|
2
8
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
10
|
};
|
|
@@ -15,6 +21,9 @@ class Logger {
|
|
|
15
21
|
console.info(prepareMsg(chalk_1.default));
|
|
16
22
|
}
|
|
17
23
|
}
|
|
24
|
+
warn(prepareMsg) {
|
|
25
|
+
console.warn(prepareMsg(chalk_1.default));
|
|
26
|
+
}
|
|
18
27
|
debug(prepareMsg) {
|
|
19
28
|
console.debug(prepareMsg(chalk_1.default));
|
|
20
29
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.RealFS = void 0;
|
|
22
|
+
const FileSystem_1 = require("../core/FileSystem");
|
|
23
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
24
|
+
class RealFSDirent extends FileSystem_1.Dirent {
|
|
25
|
+
constructor(nodeFSDirent) {
|
|
26
|
+
super();
|
|
27
|
+
this.nodeFSDirent = nodeFSDirent;
|
|
28
|
+
}
|
|
29
|
+
isDirectory() {
|
|
30
|
+
return this.nodeFSDirent.isDirectory();
|
|
31
|
+
}
|
|
32
|
+
get name() {
|
|
33
|
+
return this.nodeFSDirent.name;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
class RealFS extends FileSystem_1.FS {
|
|
37
|
+
existsSync(path) {
|
|
38
|
+
return node_fs_1.default.existsSync(path.toString());
|
|
39
|
+
}
|
|
40
|
+
readTextSync(path) {
|
|
41
|
+
return node_fs_1.default.readFileSync(path.toString()).toString();
|
|
42
|
+
}
|
|
43
|
+
readText(path) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
node_fs_1.default.readFile(path.toString(), undefined, (err, data) => {
|
|
47
|
+
if (err) {
|
|
48
|
+
reject(err);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
resolve(data.toString());
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
writeTextSync(path, data) {
|
|
57
|
+
node_fs_1.default.writeFileSync(path.toString(), data);
|
|
58
|
+
}
|
|
59
|
+
readDirentsSync(path, options) {
|
|
60
|
+
return node_fs_1.default
|
|
61
|
+
.readdirSync(path.toString(), {
|
|
62
|
+
withFileTypes: true,
|
|
63
|
+
recursive: options === null || options === void 0 ? void 0 : options.recursive,
|
|
64
|
+
})
|
|
65
|
+
.map((rawDirent) => new RealFSDirent(rawDirent));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.RealFS = RealFS;
|
package/dist/io/TarGz.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
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
|
+
*/
|
|
2
8
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
10
|
};
|
|
@@ -0,0 +1,127 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.MockedLogger = exports.MemFS = exports.FakeCliExecutor = void 0;
|
|
22
|
+
const core_1 = require("../core");
|
|
23
|
+
const CliExecutor_1 = require("./CliExecutor");
|
|
24
|
+
const memfs_1 = require("memfs");
|
|
25
|
+
const Dirent_1 = __importDefault(require("memfs/lib/Dirent"));
|
|
26
|
+
const Logger_1 = require("./Logger");
|
|
27
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
28
|
+
class FakeCliExecutor extends CliExecutor_1.CliExecutor {
|
|
29
|
+
constructor(onRun) {
|
|
30
|
+
super();
|
|
31
|
+
this.onRun = onRun;
|
|
32
|
+
this.commands = [];
|
|
33
|
+
}
|
|
34
|
+
run(command, options = {}) {
|
|
35
|
+
let commandWithArgs = command;
|
|
36
|
+
if (options.args) {
|
|
37
|
+
commandWithArgs += ' ' + this.stringifyCliArgs(options.args);
|
|
38
|
+
}
|
|
39
|
+
this.commands.push(commandWithArgs);
|
|
40
|
+
return this.onRun(commandWithArgs);
|
|
41
|
+
}
|
|
42
|
+
getCommands() {
|
|
43
|
+
return this.commands;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.FakeCliExecutor = FakeCliExecutor;
|
|
47
|
+
class MemFSDirent extends core_1.Dirent {
|
|
48
|
+
constructor(rawDirent) {
|
|
49
|
+
super();
|
|
50
|
+
this.rawDirent = rawDirent;
|
|
51
|
+
}
|
|
52
|
+
isDirectory() {
|
|
53
|
+
return this.rawDirent.isDirectory();
|
|
54
|
+
}
|
|
55
|
+
get name() {
|
|
56
|
+
return this.rawDirent.name.toString();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
class MemFS extends core_1.FS {
|
|
60
|
+
constructor(initialFileStructure) {
|
|
61
|
+
super();
|
|
62
|
+
this.fs = (0, memfs_1.memfs)(initialFileStructure, './').fs;
|
|
63
|
+
}
|
|
64
|
+
existsSync(path) {
|
|
65
|
+
return this.fs.existsSync(path.toString());
|
|
66
|
+
}
|
|
67
|
+
readTextSync(path) {
|
|
68
|
+
return this.fs.readFileSync(path.toString()).toString();
|
|
69
|
+
}
|
|
70
|
+
readText(path) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
return new Promise((resolve, reject) => {
|
|
73
|
+
this.fs.readFile(path.toString(), {}, (err, data) => {
|
|
74
|
+
var _a;
|
|
75
|
+
if (err) {
|
|
76
|
+
reject(err);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
resolve((_a = data === null || data === void 0 ? void 0 : data.toString()) !== null && _a !== void 0 ? _a : '');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
writeTextSync(path, data) {
|
|
85
|
+
return this.fs.writeFileSync(path.toString(), data);
|
|
86
|
+
}
|
|
87
|
+
readDirentsSync(path, options) {
|
|
88
|
+
return this.fs
|
|
89
|
+
.readdirSync(path.toString(), {
|
|
90
|
+
withFileTypes: true,
|
|
91
|
+
recursive: options === null || options === void 0 ? void 0 : options.recursive,
|
|
92
|
+
})
|
|
93
|
+
.flatMap((dataOutOrDirent) => {
|
|
94
|
+
if (!(dataOutOrDirent instanceof Dirent_1.default)) {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
return [new MemFSDirent(dataOutOrDirent)];
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.MemFS = MemFS;
|
|
102
|
+
class MockedLogger extends Logger_1.Logger {
|
|
103
|
+
constructor() {
|
|
104
|
+
super(...arguments);
|
|
105
|
+
this.logs = [];
|
|
106
|
+
}
|
|
107
|
+
debug(prepareMsg) {
|
|
108
|
+
chalk_1.default.level = 0;
|
|
109
|
+
this.logs.push({ type: 'debug', msg: prepareMsg(chalk_1.default) });
|
|
110
|
+
}
|
|
111
|
+
info(prepareMsg, options) {
|
|
112
|
+
chalk_1.default.level = 0;
|
|
113
|
+
this.logs.push({ type: 'info', msg: prepareMsg(chalk_1.default) });
|
|
114
|
+
}
|
|
115
|
+
warn(prepareMsg) {
|
|
116
|
+
chalk_1.default.level = 0;
|
|
117
|
+
this.logs.push({ type: 'warn', msg: prepareMsg(chalk_1.default) });
|
|
118
|
+
}
|
|
119
|
+
descriptiveError(error) {
|
|
120
|
+
chalk_1.default.level = 0;
|
|
121
|
+
this.logs.push({ type: 'error', msg: error.getMessage() });
|
|
122
|
+
}
|
|
123
|
+
getLogs() {
|
|
124
|
+
return this.logs;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.MockedLogger = MockedLogger;
|
package/dist/io/fsUtils.js
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
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
|
+
*/
|
|
2
8
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
10
|
};
|
|
5
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
12
|
exports.findFilePathsWithExtensions = void 0;
|
|
7
13
|
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
+
const Dirent_1 = __importDefault(require("memfs/lib/Dirent"));
|
|
8
15
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
-
|
|
16
|
+
const node_fs_2 = require("node:fs");
|
|
17
|
+
function findFilePathsWithExtensions(dirPath, fileExtensions, options = {}) {
|
|
18
|
+
var _a;
|
|
19
|
+
const fs = ((_a = options === null || options === void 0 ? void 0 : options.fs) !== null && _a !== void 0 ? _a : node_fs_1.default);
|
|
10
20
|
let results = [];
|
|
11
|
-
const files =
|
|
21
|
+
const files = fs.readdirSync(dirPath.getValue(), { withFileTypes: true });
|
|
12
22
|
for (const file of files) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
23
|
+
if (!(file instanceof node_fs_2.Dirent) &&
|
|
24
|
+
!(file instanceof Dirent_1.default)) {
|
|
25
|
+
continue;
|
|
16
26
|
}
|
|
17
|
-
|
|
27
|
+
const path = dirPath.copyWithNewSegment(file.name.toString());
|
|
28
|
+
if (fs.lstatSync(path.toString()).isDirectory()) {
|
|
29
|
+
results = results.concat(findFilePathsWithExtensions(path, fileExtensions, options));
|
|
30
|
+
}
|
|
31
|
+
else if (fileExtensions.includes(node_path_1.default.extname(file.name.toString()).substring(1))) {
|
|
18
32
|
results.push(path);
|
|
19
33
|
}
|
|
20
34
|
}
|
package/dist/io/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
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
|
+
*/
|
|
2
8
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
9
|
if (k2 === undefined) k2 = k;
|
|
4
10
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -17,3 +23,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
23
|
__exportStar(require("./Logger"), exports);
|
|
18
24
|
__exportStar(require("./fsUtils"), exports);
|
|
19
25
|
__exportStar(require("./TarGz"), exports);
|
|
26
|
+
__exportStar(require("./RealFS"), exports);
|
|
@@ -1,4 +1,10 @@
|
|
|
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
|
+
*/
|
|
2
8
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
9
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
10
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -1,4 +1,10 @@
|
|
|
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
|
+
*/
|
|
2
8
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
9
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
10
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -1,4 +1,10 @@
|
|
|
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
|
+
*/
|
|
2
8
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
9
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
10
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -1,4 +1,10 @@
|
|
|
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
|
+
*/
|
|
2
8
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
9
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
10
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -1,4 +1,10 @@
|
|
|
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
|
+
*/
|
|
2
8
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
9
|
if (k2 === undefined) k2 = k;
|
|
4
10
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -1,4 +1,10 @@
|
|
|
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
|
+
*/
|
|
2
8
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
9
|
if (k2 === undefined) k2 = k;
|
|
4
10
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -1,2 +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
|
+
*/
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,4 +1,10 @@
|
|
|
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
|
+
*/
|
|
2
8
|
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
3
9
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
10
|
var m = o[Symbol.asyncIterator], i;
|
|
@@ -36,7 +42,7 @@ const checks_1 = require("./checks");
|
|
|
36
42
|
const io_1 = require("../io");
|
|
37
43
|
function verifyRNOHPackage(_a) {
|
|
38
44
|
return __asyncGenerator(this, arguments, function* verifyRNOHPackage_1({ npmPackagePath, hasHarmonyCode, checkNamesToSkip, }) {
|
|
39
|
-
const npmPackageJson = core_1.PackageJSON.fromProjectRootPath(npmPackagePath, npmPackagePath);
|
|
45
|
+
const npmPackageJson = core_1.PackageJSON.fromProjectRootPath(new io_1.RealFS(), npmPackagePath, npmPackagePath);
|
|
40
46
|
const initialChecks = [
|
|
41
47
|
(0, checks_1.createHarmonyDirExistsCheck)(npmPackagePath, hasHarmonyCode),
|
|
42
48
|
(0, checks_1.createHarmonyDirContainsOnlyHarsCheck)(npmPackagePath, hasHarmonyCode),
|
package/jest.config.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE-MIT file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
2
9
|
module.exports = {
|
|
3
10
|
preset: 'ts-jest',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-oh/react-native-harmony-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"keywords": [],
|
|
19
19
|
"author": "",
|
|
20
|
-
"license": "
|
|
20
|
+
"license": "MIT",
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"metro": "*"
|
|
23
23
|
},
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"typescript": "^5.0.4"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
+
"memfs": "^4.12.0",
|
|
43
44
|
"@react-native-community/cli-tools": "^13.6.5",
|
|
44
45
|
"@react-native/codegen": "0.74.0",
|
|
45
46
|
"@tsconfig/recommended": "^1.0.2",
|
|
@@ -53,5 +54,10 @@
|
|
|
53
54
|
"mustache": "^4.2.0",
|
|
54
55
|
"tar": "^6.1.15",
|
|
55
56
|
"tmp": "^0.2.1"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://gitee.com/openharmony-sig/ohos_react_native",
|
|
59
|
+
"repository": {
|
|
60
|
+
"type": "gitee",
|
|
61
|
+
"url": "https://gitee.com/openharmony-sig/ohos_react_native"
|
|
56
62
|
}
|
|
57
63
|
}
|
package/react-native.config.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE-MIT file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
const { config: harmonyConfig } = require('./dist');
|
|
2
9
|
|
|
3
10
|
/**
|
package/src/assetResolver.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE-MIT file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
import type { AssetData } from 'metro';
|
|
2
9
|
|
|
3
10
|
export type Asset = AssetData;
|