@react-native-oh/react-native-harmony-cli 0.77.18 → 0.77.33

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.
Files changed (106) hide show
  1. package/dist/assetResolver.js +74 -43
  2. package/dist/autolinking/Autolinking.js +179 -178
  3. package/dist/codegen/core/CodegenError.js +23 -3
  4. package/dist/codegen/core/EventUtils.js +3 -3
  5. package/dist/codegen/core/TypeAnnotationToTS.js +28 -24
  6. package/dist/codegen/core/UberSchema.js +97 -55
  7. package/dist/codegen/generators/AppBuildTimeGlueCodeGenerator.js +41 -28
  8. package/dist/codegen/generators/ArkTSComponentCodeGeneratorArkTS.js +34 -27
  9. package/dist/codegen/generators/ArkTSComponentCodeGeneratorCAPI.js +33 -25
  10. package/dist/codegen/generators/CppComponentCodeGenerator.js +28 -23
  11. package/dist/codegen/generators/LibGlueCodeGenerator.js +29 -26
  12. package/dist/codegen/generators/NativeModuleCodeGenerator.js +30 -25
  13. package/dist/codegen/generators/SharedComponentCodeGenerator.js +15 -15
  14. package/dist/codegen/generators/UberGeneratorV1.js +24 -18
  15. package/dist/codegen/generators/UberGeneratorV2.js +36 -28
  16. package/dist/codegen/templates/BaseComponentInstanceHTemplate.js +24 -50
  17. package/dist/codegen/templates/BasePackageHTemplate.js +21 -120
  18. package/dist/codegen/templates/ComponentDescriptorHTemplate.js +8 -54
  19. package/dist/codegen/templates/ComponentJSIBinderHTemplate.js +27 -75
  20. package/dist/codegen/templates/ComponentUtilsTSTemplate.js +29 -162
  21. package/dist/codegen/templates/IndexTSTemplate.js +17 -37
  22. package/dist/codegen/templates/RNOHGeneratedPackageHTemplate.js +24 -119
  23. package/dist/codegen/templates/TurboModuleCppTemplate.js +15 -38
  24. package/dist/codegen/templates/TurboModuleHTemplate.js +11 -32
  25. package/dist/codegen/templates/TurboModuleSpecTSTemplate.js +19 -52
  26. package/dist/commands/bundle-harmony.js +221 -118
  27. package/dist/commands/clean-harmony.js +63 -58
  28. package/dist/commands/codegen-harmony.js +175 -104
  29. package/dist/commands/codegen-lib-harmony.js +116 -76
  30. package/dist/commands/init-harmony.js +196 -151
  31. package/dist/commands/init.js +961 -537
  32. package/dist/commands/link-harmony.js +82 -35
  33. package/dist/commands/run-harmony.js +520 -352
  34. package/dist/commands/verify-package-harmony.js +117 -54
  35. package/dist/core/AbsolutePath.js +49 -33
  36. package/dist/core/CodegenConfig.js +22 -24
  37. package/dist/core/DescriptiveError.js +37 -18
  38. package/dist/core/FileSystem.js +18 -14
  39. package/dist/core/OHPackageJSON5.js +23 -17
  40. package/dist/core/PackageJSON.js +42 -26
  41. package/dist/core/ProjectDependenciesManager.js +92 -40
  42. package/dist/core/ValidationError.js +22 -2
  43. package/dist/core/fs.js +7 -10
  44. package/dist/index.js +1 -1
  45. package/dist/init/templates/AppScopeAppJSON5Template.js +8 -21
  46. package/dist/init/templates/AppScopeStringVarTemplate.js +8 -19
  47. package/dist/init/templates/EntryIndexTemplate.js +8 -56
  48. package/dist/init/templates/EntryStringVarTemplate.js +8 -27
  49. package/dist/init/templates/HvigorConfigJson5Template.js +8 -33
  50. package/dist/init/templates/MetroConfigTemplate.js +8 -38
  51. package/dist/init/templates/OhPackageJson5Template.js +8 -28
  52. package/dist/io/CliExecutor.js +98 -46
  53. package/dist/io/Logger.js +46 -40
  54. package/dist/io/RealFS.js +100 -43
  55. package/dist/io/TarGz.js +8 -11
  56. package/dist/io/__fixtures__.js +141 -79
  57. package/dist/io/fsUtils.js +12 -13
  58. package/dist/package-verifier/checks/HarmonyDirContainsOnlyHarsCheck.js +47 -19
  59. package/dist/package-verifier/checks/HarmonyDirExistsCheck.js +41 -13
  60. package/dist/package-verifier/checks/NpmAnAndOhPackageVersionsAreEqual.js +38 -8
  61. package/dist/package-verifier/checks/OhPackageNameFollowsNamingConventionCheck.js +54 -22
  62. package/dist/package-verifier/verify-package.js +133 -56
  63. package/dist/simulator/LaunchSimulator.js +395 -0
  64. package/dist/simulator/index.js +23 -0
  65. package/package.json +2 -11
  66. package/scripts/sync-hvigor.js +27 -0
  67. package/src/autolinking/Autolinking.ts +1 -1
  68. package/src/codegen/generators/UberGeneratorV1.ts +7 -2
  69. package/src/codegen/generators/UberGeneratorV2.ts +6 -1
  70. package/src/commands/codegen-harmony.ts +17 -7
  71. package/src/commands/run-harmony.ts +67 -41
  72. package/src/init/templates/harmony/entry/src/main/module.json5 +7 -0
  73. package/src/simulator/LaunchSimulator.ts +359 -0
  74. package/src/simulator/index.ts +8 -0
  75. package/dist/init/templates/harmony/AppScope/app.json5 +0 -10
  76. package/dist/init/templates/harmony/AppScope/resources/base/element/string.json +0 -8
  77. package/dist/init/templates/harmony/AppScope/resources/base/media/app_icon.png +0 -0
  78. package/dist/init/templates/harmony/build-profile.json5 +0 -36
  79. package/dist/init/templates/harmony/codelinter.json +0 -32
  80. package/dist/init/templates/harmony/entry/build-profile.json5 +0 -18
  81. package/dist/init/templates/harmony/entry/gitignore +0 -7
  82. package/dist/init/templates/harmony/entry/hvigorfile.ts +0 -13
  83. package/dist/init/templates/harmony/entry/oh-package.json5 +0 -9
  84. package/dist/init/templates/harmony/entry/src/main/cpp/CMakeLists.txt +0 -27
  85. package/dist/init/templates/harmony/entry/src/main/cpp/PackageProvider.cpp +0 -13
  86. package/dist/init/templates/harmony/entry/src/main/cpp/gitignore +0 -4
  87. package/dist/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +0 -8
  88. package/dist/init/templates/harmony/entry/src/main/ets/codegen/gitignore +0 -2
  89. package/dist/init/templates/harmony/entry/src/main/ets/entryability/EntryAbility.ets +0 -11
  90. package/dist/init/templates/harmony/entry/src/main/ets/gitignore +0 -1
  91. package/dist/init/templates/harmony/entry/src/main/ets/pages/.gitkeep +0 -0
  92. package/dist/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +0 -16
  93. package/dist/init/templates/harmony/entry/src/main/module.json5 +0 -58
  94. package/dist/init/templates/harmony/entry/src/main/resources/base/element/color.json +0 -8
  95. package/dist/init/templates/harmony/entry/src/main/resources/base/element/string.json +0 -16
  96. package/dist/init/templates/harmony/entry/src/main/resources/base/media/background.png +0 -0
  97. package/dist/init/templates/harmony/entry/src/main/resources/base/media/foreground.png +0 -0
  98. package/dist/init/templates/harmony/entry/src/main/resources/base/media/layered_image.json +0 -7
  99. package/dist/init/templates/harmony/entry/src/main/resources/base/media/startIcon.png +0 -0
  100. package/dist/init/templates/harmony/entry/src/main/resources/base/profile/main_pages.json +0 -5
  101. package/dist/init/templates/harmony/entry/src/main/resources/gitignore +0 -1
  102. package/dist/init/templates/harmony/entry/src/ohosTest/ets/test/List.test.ets +0 -2
  103. package/dist/init/templates/harmony/entry/src/ohosTest/module.json5 +0 -13
  104. package/dist/init/templates/harmony/gitignore +0 -16
  105. package/dist/init/templates/harmony/hvigor/hvigor-config.json5 +0 -22
  106. package/dist/init/templates/harmony/hvigorfile.ts +0 -7
@@ -8,18 +8,51 @@ 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 __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
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
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
39
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
40
+ if (ar || !(i in from)) {
41
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
42
+ ar[i] = from[i];
43
+ }
44
+ }
45
+ return to.concat(ar || Array.prototype.slice.call(from));
13
46
  };
14
47
  Object.defineProperty(exports, "__esModule", { value: true });
15
48
  exports.commandCodegenLibHarmony = void 0;
16
- const core_1 = require("../core");
17
- const io_1 = require("../io");
18
- const node_fs_1 = __importDefault(require("node:fs"));
19
- const codegen_1 = require("../codegen");
20
- const case_1 = __importDefault(require("case"));
21
- const LibGlueCodeGenerator_1 = require("../codegen/generators/LibGlueCodeGenerator");
22
- const COMMAND_NAME = 'codegen-lib-harmony';
49
+ var core_1 = require("../core");
50
+ var io_1 = require("../io");
51
+ var node_fs_1 = require("node:fs");
52
+ var codegen_1 = require("../codegen");
53
+ var case_1 = require("case");
54
+ var LibGlueCodeGenerator_1 = require("../codegen/generators/LibGlueCodeGenerator");
55
+ var COMMAND_NAME = 'codegen-lib-harmony';
23
56
  exports.commandCodegenLibHarmony = {
24
57
  name: COMMAND_NAME,
25
58
  description: 'Generates boilerplate, types, and utilities from Turbo Module and Fabric Component specifications. Designed for library developers who want to include generated code in their libraries.',
@@ -31,17 +64,17 @@ exports.commandCodegenLibHarmony = {
31
64
  {
32
65
  name: '--turbo-modules-spec-paths [path...]',
33
66
  description: 'Path or paths to Turbo Module spec files. Each path can point to a spec file or a directory containing spec files.',
34
- parse: (val, prev) => (prev ? [...prev, val] : [val]),
67
+ parse: function (val, prev) { return (prev ? __spreadArray(__spreadArray([], prev, true), [val], false) : [val]); },
35
68
  },
36
69
  {
37
70
  name: '--arkts-components-spec-paths [path...]',
38
71
  description: 'Path or paths to component spec files used to generate code for components to be implemented on the ArkTS side. Each path can point to a spec file or a directory containing spec files.',
39
- parse: (val, prev) => (prev ? [...prev, val] : [val]),
72
+ parse: function (val, prev) { return (prev ? __spreadArray(__spreadArray([], prev, true), [val], false) : [val]); },
40
73
  },
41
74
  {
42
75
  name: '--cpp-components-spec-paths [path...]',
43
76
  description: 'Path or paths to component spec files used to generate code for components to be implemented on the C++ side. Each path can point to a spec file or a directory containing spec files.',
44
- parse: (val, prev) => (prev ? [...prev, val] : [val]),
77
+ parse: function (val, prev) { return (prev ? __spreadArray(__spreadArray([], prev, true), [val], false) : [val]); },
45
78
  },
46
79
  {
47
80
  name: '--cpp-output-path <path>',
@@ -56,43 +89,44 @@ exports.commandCodegenLibHarmony = {
56
89
  description: 'Skips the check that prevents file operations outside the current working directory. This command permanently deletes previously generated files. Files are generated in the path specified by cpp-output-path.',
57
90
  },
58
91
  ],
59
- func: (_argv, _config, rawArgs) => __awaiter(void 0, void 0, void 0, function* () {
60
- const logger = new io_1.Logger();
61
- try {
62
- const { args, uberSchemaByType } = validateArgsAndRetrieveUberSchemaByType(rawArgs);
63
- const fileContentByPath = generateCodeInMemory({
64
- args,
65
- uberSchemaByType,
66
- });
67
- saveAndLogCodegenResult(args, logger, fileContentByPath);
68
- }
69
- catch (err) {
70
- if (err instanceof core_1.DescriptiveError && !err.isUnexpected()) {
71
- logger.descriptiveError(err);
72
- return;
92
+ func: function (_argv, _config, rawArgs) { return __awaiter(void 0, void 0, void 0, function () {
93
+ var logger, _a, args, uberSchemaByType, fileContentByPath;
94
+ return __generator(this, function (_b) {
95
+ logger = new io_1.Logger();
96
+ try {
97
+ _a = validateArgsAndRetrieveUberSchemaByType(rawArgs), args = _a.args, uberSchemaByType = _a.uberSchemaByType;
98
+ fileContentByPath = generateCodeInMemory({
99
+ args: args,
100
+ uberSchemaByType: uberSchemaByType,
101
+ });
102
+ saveAndLogCodegenResult(args, logger, fileContentByPath);
73
103
  }
74
- throw err;
75
- }
76
- }),
104
+ catch (err) {
105
+ if (err instanceof core_1.DescriptiveError && !err.isUnexpected()) {
106
+ logger.descriptiveError(err);
107
+ return [2 /*return*/];
108
+ }
109
+ throw err;
110
+ }
111
+ return [2 /*return*/];
112
+ });
113
+ }); },
77
114
  };
78
115
  function validateArgsAndRetrieveUberSchemaByType(rawArgs) {
79
- const args = validateRawArgs(rawArgs);
80
- const arkTSComponentSpecPaths = specPathsToSpecFilePaths(args.arkTSComponentsSpecPaths);
81
- const turboModulesUberSchema = codegen_1.UberSchema.fromSpecFilePaths(specPathsToSpecFilePaths(args.tmSpecPaths));
82
- const arkTSComponentsUberSchema = codegen_1.UberSchema.fromSpecFilePaths(arkTSComponentSpecPaths);
83
- const cppComponentSpecPaths = specPathsToSpecFilePaths(args.cppComponentsSpecPaths);
84
- const cppComponentsUberSchema = codegen_1.UberSchema.fromSpecFilePaths(cppComponentSpecPaths);
85
- const componentsUberSchema = codegen_1.UberSchema.fromSpecFilePaths([
86
- ...arkTSComponentSpecPaths,
87
- ...cppComponentSpecPaths,
88
- ]);
116
+ var args = validateRawArgs(rawArgs);
117
+ var arkTSComponentSpecPaths = specPathsToSpecFilePaths(args.arkTSComponentsSpecPaths);
118
+ var turboModulesUberSchema = codegen_1.UberSchema.fromSpecFilePaths(specPathsToSpecFilePaths(args.tmSpecPaths));
119
+ var arkTSComponentsUberSchema = codegen_1.UberSchema.fromSpecFilePaths(arkTSComponentSpecPaths);
120
+ var cppComponentSpecPaths = specPathsToSpecFilePaths(args.cppComponentsSpecPaths);
121
+ var cppComponentsUberSchema = codegen_1.UberSchema.fromSpecFilePaths(cppComponentSpecPaths);
122
+ var componentsUberSchema = codegen_1.UberSchema.fromSpecFilePaths(__spreadArray(__spreadArray([], arkTSComponentSpecPaths, true), cppComponentSpecPaths, true));
89
123
  return {
90
- args,
124
+ args: args,
91
125
  uberSchemaByType: {
92
- turboModulesUberSchema,
93
- arkTSComponentsUberSchema,
94
- cppComponentsUberSchema,
95
- componentsUberSchema,
126
+ turboModulesUberSchema: turboModulesUberSchema,
127
+ arkTSComponentsUberSchema: arkTSComponentsUberSchema,
128
+ cppComponentsUberSchema: cppComponentsUberSchema,
129
+ componentsUberSchema: componentsUberSchema,
96
130
  },
97
131
  };
98
132
  }
@@ -118,28 +152,28 @@ function validateRawArgs(rawArgs) {
118
152
  }
119
153
  return {
120
154
  npmPackageName: rawArgs.npmPackageName,
121
- tmSpecPaths: ((_a = rawArgs.turboModulesSpecPaths) !== null && _a !== void 0 ? _a : []).map((path) => new core_1.AbsolutePath(path)),
122
- arkTSComponentsSpecPaths: ((_b = rawArgs.arktsComponentsSpecPaths) !== null && _b !== void 0 ? _b : []).map((path) => new core_1.AbsolutePath(path)),
123
- cppComponentsSpecPaths: ((_c = rawArgs.cppComponentsSpecPaths) !== null && _c !== void 0 ? _c : []).map((path) => new core_1.AbsolutePath(path)),
155
+ tmSpecPaths: ((_a = rawArgs.turboModulesSpecPaths) !== null && _a !== void 0 ? _a : []).map(function (path) { return new core_1.AbsolutePath(path); }),
156
+ arkTSComponentsSpecPaths: ((_b = rawArgs.arktsComponentsSpecPaths) !== null && _b !== void 0 ? _b : []).map(function (path) { return new core_1.AbsolutePath(path); }),
157
+ cppComponentsSpecPaths: ((_c = rawArgs.cppComponentsSpecPaths) !== null && _c !== void 0 ? _c : []).map(function (path) { return new core_1.AbsolutePath(path); }),
124
158
  etsOutputPath: new core_1.AbsolutePath(rawArgs.etsOutputPath),
125
159
  cppOutputPath: new core_1.AbsolutePath(rawArgs.cppOutputPath),
126
160
  safetyCheck: !!rawArgs.safetyCheck,
127
161
  };
128
162
  }
129
163
  function specPathsToSpecFilePaths(specPaths) {
130
- const SUPPORTED_SPEC_EXTENSIONS = ['js', 'jsx', 'ts', 'tsx'];
131
- return specPaths.flatMap((specPath) => {
164
+ var SUPPORTED_SPEC_EXTENSIONS = ['js', 'jsx', 'ts', 'tsx'];
165
+ return specPaths.flatMap(function (specPath) {
132
166
  if (!node_fs_1.default.existsSync(specPath.getValue())) {
133
167
  throw new core_1.DescriptiveError({
134
- whatHappened: `No such file or directory: ${specPath.getValue()}`,
135
- whatCanUserDo: [`Are you sure provided specPath exists?`],
168
+ whatHappened: "No such file or directory: ".concat(specPath.getValue()),
169
+ whatCanUserDo: ["Are you sure provided specPath exists?"],
136
170
  });
137
171
  }
138
172
  if (node_fs_1.default.lstatSync(specPath.getValue()).isDirectory()) {
139
173
  return (0, io_1.findFilePathsWithExtensions)(specPath, SUPPORTED_SPEC_EXTENSIONS);
140
174
  }
141
175
  else {
142
- const ext = specPath.getExtension();
176
+ var ext = specPath.getExtension();
143
177
  if (ext && SUPPORTED_SPEC_EXTENSIONS.includes(ext)) {
144
178
  return [specPath];
145
179
  }
@@ -147,30 +181,31 @@ function specPathsToSpecFilePaths(specPaths) {
147
181
  }
148
182
  });
149
183
  }
150
- function generateCodeInMemory({ args, uberSchemaByType: { arkTSComponentsUberSchema, componentsUberSchema, cppComponentsUberSchema, turboModulesUberSchema, }, }) {
151
- const CODEGEN_NOTICE_LINES = [
152
- `This code was generated by "react-native ${COMMAND_NAME}"`,
184
+ function generateCodeInMemory(_a) {
185
+ var args = _a.args, _b = _a.uberSchemaByType, arkTSComponentsUberSchema = _b.arkTSComponentsUberSchema, componentsUberSchema = _b.componentsUberSchema, cppComponentsUberSchema = _b.cppComponentsUberSchema, turboModulesUberSchema = _b.turboModulesUberSchema;
186
+ var CODEGEN_NOTICE_LINES = [
187
+ "This code was generated by \"react-native ".concat(COMMAND_NAME, "\""),
153
188
  ];
154
- const fileContentByPath = new Map();
155
- const appendToFileContentByPath = (fileContent, path) => {
189
+ var fileContentByPath = new Map();
190
+ var appendToFileContentByPath = function (fileContent, path) {
156
191
  fileContentByPath.set(path, fileContent);
157
192
  };
158
- const turboModuleGlueCodeData = turboModulesUberSchema
193
+ var turboModuleGlueCodeData = turboModulesUberSchema
159
194
  .findAllSpecSchemasByType('NativeModule')
160
- .map((specSchema) => {
161
- const nativeModuleCodeGenerator = new codegen_1.NativeModuleCodeGenerator(args.cppOutputPath.copyWithNewSegment('RNOH', 'generated', 'turbo_modules'), args.etsOutputPath.copyWithNewSegment('turboModules'), CODEGEN_NOTICE_LINES, '@rnoh/react-native-openharmony/ts');
195
+ .map(function (specSchema) {
196
+ var nativeModuleCodeGenerator = new codegen_1.NativeModuleCodeGenerator(args.cppOutputPath.copyWithNewSegment('RNOH', 'generated', 'turbo_modules'), args.etsOutputPath.copyWithNewSegment('turboModules'), CODEGEN_NOTICE_LINES, '@rnoh/react-native-openharmony/ts');
162
197
  nativeModuleCodeGenerator
163
198
  .generate(specSchema)
164
199
  .forEach(appendToFileContentByPath);
165
200
  return nativeModuleCodeGenerator.getGlueCodeData();
166
201
  })
167
202
  .flat();
168
- const arkTSComponentCodeGeneratorCAPI = new codegen_1.ArkTSComponentCodeGeneratorCAPI(args.cppOutputPath.copyWithNewSegment('RNOH', 'generated', 'components'), args.etsOutputPath.copyWithNewSegment('components'), CODEGEN_NOTICE_LINES, '@rnoh/react-native-openharmony/ts');
203
+ var arkTSComponentCodeGeneratorCAPI = new codegen_1.ArkTSComponentCodeGeneratorCAPI(args.cppOutputPath.copyWithNewSegment('RNOH', 'generated', 'components'), args.etsOutputPath.copyWithNewSegment('components'), CODEGEN_NOTICE_LINES, '@rnoh/react-native-openharmony/ts');
169
204
  arkTSComponentCodeGeneratorCAPI
170
205
  .generate(arkTSComponentsUberSchema)
171
206
  .forEach(appendToFileContentByPath);
172
- const libraryCppName = deriveLibraryCppNameFromNpmPackageName(args.npmPackageName);
173
- const cppComponentCodeGenerator = new codegen_1.CppComponentCodeGenerator((filename) => {
207
+ var libraryCppName = deriveLibraryCppNameFromNpmPackageName(args.npmPackageName);
208
+ var cppComponentCodeGenerator = new codegen_1.CppComponentCodeGenerator(function (filename) {
174
209
  return args.cppOutputPath.copyWithNewSegment('RNOH', 'generated', 'components', filename);
175
210
  }, CODEGEN_NOTICE_LINES);
176
211
  cppComponentCodeGenerator
@@ -179,7 +214,7 @@ function generateCodeInMemory({ args, uberSchemaByType: { arkTSComponentsUberSch
179
214
  uberSchema: cppComponentsUberSchema,
180
215
  })
181
216
  .forEach(appendToFileContentByPath);
182
- new codegen_1.SharedComponentCodeGenerator((filename) => {
217
+ new codegen_1.SharedComponentCodeGenerator(function (filename) {
183
218
  return args.cppOutputPath.copyWithNewSegment('react', 'renderer', 'components', libraryCppName, filename);
184
219
  })
185
220
  .generate({
@@ -189,18 +224,21 @@ function generateCodeInMemory({ args, uberSchemaByType: { arkTSComponentsUberSch
189
224
  .forEach(appendToFileContentByPath);
190
225
  new LibGlueCodeGenerator_1.LibGlueCodeGenerator(args.cppOutputPath, args.etsOutputPath, CODEGEN_NOTICE_LINES)
191
226
  .generate({
192
- libraryCppName,
227
+ libraryCppName: libraryCppName,
193
228
  arkTSComponents: arkTSComponentCodeGeneratorCAPI.getLibGlueCodeData(),
194
229
  cppComponents: cppComponentCodeGenerator
195
230
  .getGlueCodeData()
196
- .map(({ name }) => ({ componentName: name })),
231
+ .map(function (_a) {
232
+ var name = _a.name;
233
+ return ({ componentName: name });
234
+ }),
197
235
  turboModules: turboModuleGlueCodeData,
198
236
  })
199
237
  .forEach(appendToFileContentByPath);
200
238
  return fileContentByPath;
201
239
  }
202
240
  function deriveLibraryCppNameFromNpmPackageName(npmPackageName) {
203
- let result = npmPackageName;
241
+ var result = npmPackageName;
204
242
  if (npmPackageName.includes('/')) {
205
243
  result.replace('@', '');
206
244
  result = npmPackageName.replace('/', '__');
@@ -217,10 +255,10 @@ function saveCodegenResultToFileSystem(fileContentByPath, cppOutputPath, etsOutp
217
255
  prepareDirectory(etsOutputPath, enableSafetyCheck);
218
256
  prepareDirectory(etsOutputPath.copyWithNewSegment('components'), enableSafetyCheck);
219
257
  prepareDirectory(etsOutputPath.copyWithNewSegment('turboModules'), enableSafetyCheck);
220
- fileContentByPath.forEach((_fileContent, path) => {
258
+ fileContentByPath.forEach(function (_fileContent, path) {
221
259
  prepareDirectory(path.getDirectoryPath(), enableSafetyCheck);
222
260
  });
223
- fileContentByPath.forEach((fileContent, path) => {
261
+ fileContentByPath.forEach(function (fileContent, path) {
224
262
  node_fs_1.default.writeFileSync(path.getValue(), fileContent);
225
263
  });
226
264
  }
@@ -228,7 +266,7 @@ function prepareDirectory(path, enableSafetyCheck) {
228
266
  (0, core_1.maybeMakeDirectories)(path);
229
267
  if (enableSafetyCheck && !path.getValue().startsWith(process.cwd())) {
230
268
  throw new core_1.DescriptiveError({
231
- whatHappened: `Tried to remove files in ${path.getValue()}\nand that path is outside current working directory`,
269
+ whatHappened: "Tried to remove files in ".concat(path.getValue(), "\nand that path is outside current working directory"),
232
270
  whatCanUserDo: [
233
271
  'Run this command with --no-safety-check flag',
234
272
  'Run codegen from different location',
@@ -238,12 +276,14 @@ function prepareDirectory(path, enableSafetyCheck) {
238
276
  (0, core_1.maybeRemoveFilesInDirectory)(path);
239
277
  }
240
278
  function logCodegenResult(logger, fileContentByPath, rootPath) {
241
- const sortedRelativePathStrings = Array.from(fileContentByPath.keys()).map((path) => path.relativeTo(rootPath).getValue());
279
+ var sortedRelativePathStrings = Array.from(fileContentByPath.keys()).map(function (path) { return path.relativeTo(rootPath).getValue(); });
242
280
  sortedRelativePathStrings.sort();
243
- sortedRelativePathStrings.forEach((pathStr) => {
244
- logger.info((styles) => styles.gray(`• ${pathStr}`));
281
+ sortedRelativePathStrings.forEach(function (pathStr) {
282
+ logger.info(function (styles) { return styles.gray("\u2022 ".concat(pathStr)); });
283
+ });
284
+ logger.info(function () { return ''; });
285
+ logger.info(function (styles) {
286
+ return "Generated ".concat(styles.green(styles.bold(fileContentByPath.size)), " file(s)");
245
287
  });
246
- logger.info(() => '');
247
- logger.info((styles) => `Generated ${styles.green(styles.bold(fileContentByPath.size))} file(s)`);
248
- logger.info(() => '');
288
+ logger.info(function () { return ''; });
249
289
  }