expo-harmony-toolkit 1.7.2 → 1.8.0

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 (69) hide show
  1. package/README.en.md +25 -11
  2. package/README.md +27 -13
  3. package/build/core/autolinking.d.ts +10 -0
  4. package/build/core/autolinking.js +421 -0
  5. package/build/core/build/commands.d.ts +19 -0
  6. package/build/core/build/commands.js +61 -0
  7. package/build/core/build/compatibilityShims.d.ts +1 -0
  8. package/build/core/build/compatibilityShims.js +272 -0
  9. package/build/core/build/localHar.d.ts +13 -0
  10. package/build/core/build/localHar.js +337 -0
  11. package/build/core/build/reporting.d.ts +19 -0
  12. package/build/core/build/reporting.js +67 -0
  13. package/build/core/build/rnohCompatibility.d.ts +1 -0
  14. package/build/core/build/rnohCompatibility.js +38 -0
  15. package/build/core/build.d.ts +4 -12
  16. package/build/core/build.js +70 -762
  17. package/build/core/constants.d.ts +2 -1
  18. package/build/core/constants.js +3 -2
  19. package/build/core/dependencyInspection.d.ts +2 -0
  20. package/build/core/dependencyInspection.js +130 -0
  21. package/build/core/env.js +1 -1
  22. package/build/core/report.js +162 -10
  23. package/build/core/signing.d.ts +2 -0
  24. package/build/core/signing.js +30 -0
  25. package/build/core/template/capabilityRegistry.d.ts +9 -0
  26. package/build/core/template/capabilityRegistry.js +84 -0
  27. package/build/core/template/expoModulesCoreShim.d.ts +2 -0
  28. package/build/core/template/expoModulesCoreShim.js +279 -0
  29. package/build/core/template/metro.d.ts +2 -0
  30. package/build/core/template/metro.js +213 -0
  31. package/build/core/template/nativeFiles.d.ts +8 -0
  32. package/build/core/template/nativeFiles.js +333 -0
  33. package/build/core/template/renderers/camera.d.ts +4 -0
  34. package/build/core/template/renderers/camera.js +612 -0
  35. package/build/core/template/renderers/fileSystem.d.ts +4 -0
  36. package/build/core/template/renderers/fileSystem.js +814 -0
  37. package/build/core/template/renderers/imagePicker.d.ts +4 -0
  38. package/build/core/template/renderers/imagePicker.js +753 -0
  39. package/build/core/template/renderers/location.d.ts +4 -0
  40. package/build/core/template/renderers/location.js +836 -0
  41. package/build/core/template/runtimeShims.d.ts +2 -0
  42. package/build/core/template/runtimeShims.js +192 -0
  43. package/build/core/template/support.d.ts +11 -0
  44. package/build/core/template/support.js +108 -0
  45. package/build/core/template.d.ts +3 -6
  46. package/build/core/template.js +49 -4457
  47. package/build/data/capabilities.js +21 -4
  48. package/build/data/dependencyCatalog.js +10 -0
  49. package/build/data/publicDocs.d.ts +11 -0
  50. package/build/data/publicDocs.js +28 -0
  51. package/build/data/validatedMatrices.js +9 -1
  52. package/build/docs/render.d.ts +9 -0
  53. package/build/docs/render.js +250 -0
  54. package/build/types.d.ts +19 -0
  55. package/docs/cli-build.md +1 -1
  56. package/docs/npm-release.md +1 -0
  57. package/docs/official-app-shell-sample.md +2 -1
  58. package/docs/official-minimal-sample.md +2 -1
  59. package/docs/official-native-capabilities-sample.md +12 -2
  60. package/docs/official-ui-stack-sample.md +2 -1
  61. package/docs/roadmap.md +146 -51
  62. package/docs/signing-and-release.md +3 -0
  63. package/docs/support-matrix.md +59 -13
  64. package/package.json +13 -5
  65. package/docs/v1.5.1-acceptance.md +0 -385
  66. package/docs/v1.6.0-acceptance.md +0 -193
  67. package/docs/v1.7.0-acceptance.md +0 -111
  68. package/docs/v1.7.1-acceptance.md +0 -111
  69. package/docs/v1.7.2-acceptance.md +0 -37
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.renderBuildReport = renderBuildReport;
7
+ exports.getBundleOutputPath = getBundleOutputPath;
8
+ exports.getAssetsOutputPath = getAssetsOutputPath;
9
+ exports.createBuildReport = createBuildReport;
10
+ exports.createStepReport = createStepReport;
11
+ const path_1 = __importDefault(require("path"));
12
+ const constants_1 = require("../constants");
13
+ function renderBuildReport(report) {
14
+ const lines = [
15
+ 'Expo Harmony build report',
16
+ `Project: ${report.projectRoot}`,
17
+ `Command: ${report.command}`,
18
+ `Mode: ${report.mode ?? 'n/a'}`,
19
+ `Status: ${report.status}`,
20
+ `Harmony project: ${report.harmonyProjectRoot ?? 'not found'}`,
21
+ `Entry file: ${report.entryFile ?? 'n/a'}`,
22
+ `Bundle output: ${report.bundleOutputPath ?? 'n/a'}`,
23
+ `Artifacts: ${report.artifactPaths.join(', ') || 'none'}`,
24
+ '',
25
+ 'Steps:',
26
+ ...report.steps.map((step) => `- [${step.exitCode ?? 'n/a'}] ${step.label}: ${step.command} (cwd ${step.cwd})`),
27
+ ];
28
+ if (report.blockingIssues.length > 0) {
29
+ lines.push('', 'Blocking issues:', ...report.blockingIssues.map((issue) => `- ${issue.code}: ${issue.message}${issue.subject ? ` (${issue.subject})` : ''}`));
30
+ }
31
+ if (report.warnings.length > 0) {
32
+ lines.push('', 'Warnings:', ...report.warnings.map((warning) => `- ${warning}`));
33
+ }
34
+ return lines.join('\n');
35
+ }
36
+ function getBundleOutputPath(projectRoot) {
37
+ return path_1.default.join(projectRoot, 'harmony', 'entry', 'src', 'main', 'resources', 'rawfile', 'bundle.harmony.js');
38
+ }
39
+ function getAssetsOutputPath(projectRoot) {
40
+ return path_1.default.join(projectRoot, 'harmony', 'entry', 'src', 'main', 'resources', 'rawfile', 'assets');
41
+ }
42
+ function createBuildReport(input) {
43
+ return {
44
+ generatedAt: new Date().toISOString(),
45
+ projectRoot: input.projectRoot,
46
+ toolkitVersion: constants_1.TOOLKIT_VERSION,
47
+ command: input.command,
48
+ mode: input.mode,
49
+ status: input.status,
50
+ harmonyProjectRoot: input.harmonyProjectRoot ?? path_1.default.join(input.projectRoot, 'harmony'),
51
+ entryFile: input.entryFile,
52
+ bundleOutputPath: input.bundleOutputPath,
53
+ assetsDestPath: input.assetsDestPath,
54
+ artifactPaths: input.artifactPaths,
55
+ blockingIssues: input.blockingIssues,
56
+ warnings: input.warnings,
57
+ steps: input.steps,
58
+ };
59
+ }
60
+ function createStepReport(label, file, args, cwd, exitCode) {
61
+ return {
62
+ label,
63
+ command: [file, ...args].join(' '),
64
+ cwd,
65
+ exitCode,
66
+ };
67
+ }
@@ -0,0 +1 @@
1
+ export declare function normalizeProjectRnohCliAutolinkingTemplates(projectRoot: string): Promise<() => Promise<void>>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.normalizeProjectRnohCliAutolinkingTemplates = normalizeProjectRnohCliAutolinkingTemplates;
7
+ const fs_extra_1 = __importDefault(require("fs-extra"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const RNOH_CLI_AUTOLINKING_TEMPLATE_RELATIVE_PATHS = [
10
+ path_1.default.join('node_modules', '@react-native-oh', 'react-native-harmony-cli', 'dist', 'autolinking', 'Autolinking.js'),
11
+ path_1.default.join('node_modules', '@react-native-oh', 'react-native-harmony-cli', 'src', 'autolinking', 'Autolinking.ts'),
12
+ ];
13
+ async function normalizeProjectRnohCliAutolinkingTemplates(projectRoot) {
14
+ const originalContentsByPath = new Map();
15
+ for (const relativePath of RNOH_CLI_AUTOLINKING_TEMPLATE_RELATIVE_PATHS) {
16
+ const targetPath = path_1.default.join(projectRoot, relativePath);
17
+ if (!(await fs_extra_1.default.pathExists(targetPath))) {
18
+ continue;
19
+ }
20
+ const currentContents = await fs_extra_1.default.readFile(targetPath, 'utf8');
21
+ const normalizedContents = normalizeRnohCliAutolinkingTemplateContents(currentContents);
22
+ if (normalizedContents === currentContents) {
23
+ continue;
24
+ }
25
+ originalContentsByPath.set(targetPath, currentContents);
26
+ await fs_extra_1.default.writeFile(targetPath, normalizedContents);
27
+ }
28
+ return async () => {
29
+ for (const [targetPath, originalContents] of originalContentsByPath.entries()) {
30
+ await fs_extra_1.default.writeFile(targetPath, originalContents);
31
+ }
32
+ };
33
+ }
34
+ function normalizeRnohCliAutolinkingTemplateContents(contents) {
35
+ return contents
36
+ .replace(/import type \{ RNPackageContext, RNOHPackage \} from '@rnoh\/react-native-openharmony';/g, "import type { RNPackageContext, RNPackage } from '@rnoh/react-native-openharmony';")
37
+ .replace(/export function createRNOHPackages\(ctx: RNPackageContext\): RNOHPackage\[\] \{/g, 'export function createRNOHPackages(ctx: RNPackageContext): RNPackage[] {');
38
+ }
@@ -1,13 +1,7 @@
1
- import { BuildReport } from '../types';
2
- export interface CommandRunnerResult {
3
- exitCode: number;
4
- stdout: string;
5
- stderr: string;
6
- }
7
- export type CommandRunner = (file: string, args: string[], options: {
8
- cwd: string;
9
- env: NodeJS.ProcessEnv;
10
- }) => Promise<CommandRunnerResult>;
1
+ import type { BuildReport } from '../types';
2
+ import type { CommandRunner } from './build/commands';
3
+ export type { CommandRunner, CommandRunnerResult } from './build/commands';
4
+ export { renderBuildReport } from './build/reporting';
11
5
  interface BundleProjectOptions {
12
6
  env?: NodeJS.ProcessEnv;
13
7
  runner?: CommandRunner;
@@ -20,6 +14,4 @@ interface BuildHapProjectOptions {
20
14
  }
21
15
  export declare function bundleProject(projectRoot: string, options?: BundleProjectOptions): Promise<BuildReport>;
22
16
  export declare function buildHapProject(projectRoot: string, options: BuildHapProjectOptions): Promise<BuildReport>;
23
- export declare function renderBuildReport(report: BuildReport): string;
24
17
  export declare function getDesiredHarmonyScripts(projectRoot: string): Promise<Record<string, string>>;
25
- export {};