@expo-harmony/prebuild-config 55.0.0-harmony.8 → 55.0.22-harmony.2

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 CHANGED
@@ -33,7 +33,7 @@ npm install @expo-harmony/prebuild-config
33
33
  }
34
34
  ```
35
35
 
36
- `bundleName` 必填,其余字段有默认值。完整列表见 [@expo-harmony/config-plugins](../config-plugins/README.md)。
36
+ `bundleName` 必填,其余字段有默认值。完整列表见 `@expo-harmony/config-plugins` 的 README。
37
37
 
38
38
  生成或更新原生工程:
39
39
 
@@ -48,7 +48,7 @@ npx expo-harmony prebuild
48
48
  | 文件 | 内容 |
49
49
  | -------------------------------------- | --------------------------------------------------- |
50
50
  | `AppScope/app.json5` | 包名、版本号、vendor、应用名和图标引用 |
51
- | `build-profile.json5` | product、module、SDK 版本、ABI 和签名配置 |
51
+ | `build-profile.json5` | product、module、SDK 版本、原生编译器和签名配置 |
52
52
  | `entry/build-profile.json5` | Entry 模块的 CMake 路径和 ABI |
53
53
  | `entry/src/main/module.json5` | module、Ability、设备类型、权限和 querySchemes |
54
54
  | `entry/src/main/resources/` | 字符串、颜色和 media 资源 |
@@ -31,11 +31,24 @@ function withAutolinkingMods(config, options) {
31
31
  const project = await node_fs_1.default.promises.realpath(root);
32
32
  const build = (0, buildDescriptor_1.createHarmonyBuildDescriptor)(harmony, mod._internal?.harmonySigningConfig?.name ?? null);
33
33
  const platform = (0, buildDescriptor_1.resolveHarmonyBuildPath)(project, build.harmonyRoot);
34
- const result = await (0, expo_modules_autolinking_1.linkModulesAsync)({
34
+ const moduleBuilds = harmony.moduleBuilds || {};
35
+ const moduleBuildSettings = {
36
+ compatibleSdkVersion: harmony.compatibleSdkVersionString,
37
+ targetSdkVersion: harmony.targetSdkVersionString,
38
+ abiFilters: harmony.abiFilters,
39
+ };
40
+ // Normal CLI/DevEco builds relink without evaluating Expo config; retain these inputs.
41
+ const inputs = node_path_1.default.join(project, '.expo/harmony/module-build-options.json');
42
+ const linkOptions = {
43
+ moduleBuilds,
44
+ moduleBuildSettings,
35
45
  projectRoot: project,
36
46
  harmonyProjectPath: platform,
37
47
  buildType: mode,
38
- });
48
+ };
49
+ const prepared = await (0, expo_modules_autolinking_1.prepareModulesAsync)(linkOptions);
50
+ const result = await (0, expo_modules_autolinking_1.linkPreparedModulesAsync)(linkOptions, prepared);
51
+ (0, config_plugins_1.recordManagedFile)(mod, inputs, 'autolinking');
39
52
  mod._internal ??= {};
40
53
  mod._internal.harmonyAutolinkingModules = result.modules;
41
54
  for (const relative of result.managedArtifacts) {
@@ -96,7 +96,6 @@ function resolveInputFile(root, value) {
96
96
  }
97
97
  function withEntryMods(config) {
98
98
  config = (0, config_plugins_1.withEntryBuildProfile)(config, (mod) => {
99
- const harmony = (0, config_plugins_1.normalizeHarmonyConfig)(mod.modRawConfig);
100
99
  const build = (0, reconcile_1.readRecord)(mod.modResults.buildOption);
101
100
  const native = (0, reconcile_1.readRecord)(build.externalNativeOptions);
102
101
  mod.modResults = {
@@ -107,7 +106,6 @@ function withEntryMods(config) {
107
106
  externalNativeOptions: {
108
107
  ...native,
109
108
  path: './src/main/cpp/CMakeLists.txt',
110
- abiFilters: harmony.abiFilters,
111
109
  },
112
110
  },
113
111
  targets: (0, reconcile_1.upsertNamed)((0, reconcile_1.upsertNamed)(mod.modResults.targets, 'default', existing => ({
@@ -18,6 +18,10 @@ function withPreparationMod(config) {
18
18
  const root = mod.modRequest.projectRoot;
19
19
  const platform = mod.modRequest.platformProjectRoot;
20
20
  const manifest = mod.modRequest.ignoreExistingNativeFiles ? null : await (0, stale_1.readPreviousCngManifestAsync)(root);
21
+ // Expo copies the template before mods run; use the state captured by the CLI.
22
+ const freshPrebuild = process.env.EXPO_HARMONY_PREBUILD_FRESH;
23
+ const isFreshGeneration = freshPrebuild === '1'
24
+ || (freshPrebuild === undefined && manifest === null);
21
25
  const plugins = (0, internal_1.getHarmonyConfigPlugins)(mod);
22
26
  const stale = (0, stale_1.findStaleConfigPlugins)(manifest, plugins);
23
27
  mod._internal ??= {};
@@ -35,8 +39,14 @@ function withPreparationMod(config) {
35
39
  mod._internal.harmonyStaleConfigPlugins = stale;
36
40
  mod._internal.harmonyStalePluginFiles = await (0, stale_1.removeStalePluginFilesAsync)(root, manifest, stale, plugins, mod.modRequest.introspect);
37
41
  if (harmony.signingConfigFile) {
38
- const signing = await (0, signing_1.readSigningConfigFile)(root, harmony.signingConfigFile);
39
- mod._internal.harmonySigningConfig = signing.config;
42
+ try {
43
+ const signing = await (0, signing_1.readSigningConfigFile)(root, harmony.signingConfigFile);
44
+ mod._internal.harmonySigningConfig = signing.config;
45
+ }
46
+ catch (cause) {
47
+ if (!isFreshGeneration)
48
+ throw cause;
49
+ }
40
50
  }
41
51
  if (mod.modRequest.introspect)
42
52
  return mod;
@@ -102,10 +102,7 @@ function withProjectMods(config) {
102
102
  const product = {
103
103
  ...existing,
104
104
  name: productName,
105
- compatibleSdkVersion: harmony.compatibleSdkVersionString,
106
- targetSdkVersion: harmony.targetSdkVersionString,
107
105
  runtimeOS: 'HarmonyOS',
108
- buildOption: { ...(existing.buildOption || {}), nativeCompiler: 'BiSheng' },
109
106
  ...(signing ? { signingConfig: signing.name } : {}),
110
107
  };
111
108
  if (!signing && product.signingConfig === previousSigning) {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withHarmonyPrebuildConfig = void 0;
4
4
  const config_plugins_1 = require("@expo-harmony/config-plugins");
5
+ const expo_build_properties_1 = require("@expo-harmony/expo-build-properties");
5
6
  const errors_1 = require("./errors");
6
7
  const withAutolinkingMods_1 = require("./mods/withAutolinkingMods");
7
8
  const withEntryMods_1 = require("./mods/withEntryMods");
@@ -17,6 +18,7 @@ const withDefaults = (config, props) => {
17
18
  throw new errors_1.HarmonyPrebuildError('ERR_HARMONY_CONFIG_INVALID', 'Harmony prebuild options only accept buildType: "debug" or "release".', { operation: 'configure-prebuild' });
18
19
  }
19
20
  config = (0, withPreparationMod_1.withPreparationMod)(config);
21
+ config = (0, expo_build_properties_1.withBuildPropertiesDefaults)(config);
20
22
  config = (0, withProjectMods_1.withProjectMods)(config);
21
23
  config = (0, withEntryMods_1.withEntryMods)(config);
22
24
  config = (0, withSourceMods_1.withSourceMods)(config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo-harmony/prebuild-config",
3
- "version": "55.0.0-harmony.8",
3
+ "version": "55.0.22-harmony.2",
4
4
  "keywords": [
5
5
  "react-native",
6
6
  "expo",
@@ -19,7 +19,7 @@
19
19
  "main": "build/index.js",
20
20
  "types": "build/index.d.ts",
21
21
  "scripts": {
22
- "prebuild": "yarn workspace @expo-harmony/config-plugins build && yarn workspace @expo-harmony/expo-modules-autolinking build",
22
+ "prebuild": "yarn workspace @expo-harmony/config-plugins build && yarn workspace @expo-harmony/expo-build-properties build && yarn workspace @expo-harmony/expo-modules-autolinking build",
23
23
  "build": "tsc -p tsconfig.json",
24
24
  "prepare": "yarn build",
25
25
  "typecheck": "tsc --noEmit -p tsconfig.json"
@@ -43,19 +43,23 @@
43
43
  "./package.json": "./package.json"
44
44
  },
45
45
  "dependencies": {
46
- "@expo-harmony/config-plugins": "55.0.10-harmony.4",
47
- "@expo-harmony/expo-modules-autolinking": "55.0.25-harmony.4",
48
- "@expo-harmony/template": "55.0.0-harmony.5",
46
+ "@expo-harmony/config-plugins": "55.0.11-harmony.2",
47
+ "@expo-harmony/expo-build-properties": "55.0.18-harmony.2",
48
+ "@expo-harmony/expo-modules-autolinking": "55.0.27-harmony.2",
49
+ "@expo-harmony/template": "55.0.0-harmony.9",
49
50
  "@expo/config": "55.0.17",
50
- "@expo/config-plugins": "55.0.10",
51
+ "@expo/config-plugins": "55.0.11",
51
52
  "@react-native-community/cli-config": "15.1.3",
52
53
  "json5": "2.2.3"
53
54
  },
54
55
  "peerDependencies": {
55
- "expo": "55.0.26"
56
+ "expo": "55.0.31"
56
57
  },
57
58
  "devDependencies": {
58
59
  "@types/node": "18.19.0",
60
+ "expo": "55.0.31",
61
+ "react": "19.2.3",
62
+ "react-native": "0.84.1",
59
63
  "typescript": "6.0.3"
60
64
  },
61
65
  "engines": {
@@ -1,7 +1,8 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
 
4
- import { linkModulesAsync } from '@expo-harmony/expo-modules-autolinking';
4
+ import { linkPreparedModulesAsync, prepareModulesAsync } from '@expo-harmony/expo-modules-autolinking';
5
+ import type { LinkOptions } from '@expo-harmony/expo-modules-autolinking';
5
6
  import { normalizeHarmonyConfig, recordManagedFile, stableHarmonyJson, withHarmonyAutolinking } from '@expo-harmony/config-plugins';
6
7
  import { getHarmonyConfigPlugins, withCngManifest } from '@expo-harmony/config-plugins/internal';
7
8
 
@@ -38,12 +39,26 @@ export function withAutolinkingMods(config, options: HarmonyPrebuildOptions) {
38
39
  const build = createHarmonyBuildDescriptor(harmony, mod._internal?.harmonySigningConfig?.name ?? null);
39
40
  const platform = resolveHarmonyBuildPath(project, build.harmonyRoot);
40
41
 
41
- const result = await linkModulesAsync({
42
+ const moduleBuilds = harmony.moduleBuilds || {};
43
+ const moduleBuildSettings = {
44
+ compatibleSdkVersion: harmony.compatibleSdkVersionString,
45
+ targetSdkVersion: harmony.targetSdkVersionString,
46
+ abiFilters: harmony.abiFilters,
47
+ };
48
+ // Normal CLI/DevEco builds relink without evaluating Expo config; retain these inputs.
49
+ const inputs = path.join(project, '.expo/harmony/module-build-options.json');
50
+
51
+ const linkOptions: LinkOptions = {
52
+ moduleBuilds,
53
+ moduleBuildSettings,
42
54
  projectRoot: project,
43
55
  harmonyProjectPath: platform,
44
56
  buildType: mode,
45
- });
57
+ };
58
+ const prepared = await prepareModulesAsync(linkOptions);
59
+ const result = await linkPreparedModulesAsync(linkOptions, prepared);
46
60
 
61
+ recordManagedFile(mod, inputs, 'autolinking');
47
62
  mod._internal ??= {};
48
63
  mod._internal.harmonyAutolinkingModules = result.modules;
49
64
 
@@ -103,7 +103,6 @@ function resolveInputFile(root, value) {
103
103
 
104
104
  function withEntryMods(config) {
105
105
  config = withEntryBuildProfile(config, (mod) => {
106
- const harmony = normalizeHarmonyConfig(mod.modRawConfig);
107
106
  const build = readRecord(mod.modResults.buildOption);
108
107
  const native = readRecord(build.externalNativeOptions);
109
108
 
@@ -115,7 +114,6 @@ function withEntryMods(config) {
115
114
  externalNativeOptions: {
116
115
  ...native,
117
116
  path: './src/main/cpp/CMakeLists.txt',
118
- abiFilters: harmony.abiFilters,
119
117
  },
120
118
  },
121
119
  targets: upsertNamed(
@@ -19,6 +19,10 @@ function withPreparationMod(config) {
19
19
  const root = mod.modRequest.projectRoot;
20
20
  const platform = mod.modRequest.platformProjectRoot;
21
21
  const manifest = mod.modRequest.ignoreExistingNativeFiles ? null : await readPreviousCngManifestAsync(root);
22
+ // Expo copies the template before mods run; use the state captured by the CLI.
23
+ const freshPrebuild = process.env.EXPO_HARMONY_PREBUILD_FRESH;
24
+ const isFreshGeneration = freshPrebuild === '1'
25
+ || (freshPrebuild === undefined && manifest === null);
22
26
  const plugins = getHarmonyConfigPlugins(mod);
23
27
  const stale = findStaleConfigPlugins(manifest, plugins);
24
28
 
@@ -40,8 +44,12 @@ function withPreparationMod(config) {
40
44
  );
41
45
 
42
46
  if (harmony.signingConfigFile) {
43
- const signing = await readSigningConfigFile(root, harmony.signingConfigFile);
44
- mod._internal.harmonySigningConfig = signing.config;
47
+ try {
48
+ const signing = await readSigningConfigFile(root, harmony.signingConfigFile);
49
+ mod._internal.harmonySigningConfig = signing.config;
50
+ } catch (cause) {
51
+ if (!isFreshGeneration) throw cause;
52
+ }
45
53
  }
46
54
 
47
55
  if (mod.modRequest.introspect) return mod;
@@ -109,10 +109,7 @@ export function withProjectMods(config) {
109
109
  const product = {
110
110
  ...existing,
111
111
  name: productName,
112
- compatibleSdkVersion: harmony.compatibleSdkVersionString,
113
- targetSdkVersion: harmony.targetSdkVersionString,
114
112
  runtimeOS: 'HarmonyOS',
115
- buildOption: { ...(existing.buildOption || {}), nativeCompiler: 'BiSheng' },
116
113
  ...(signing ? { signingConfig: signing.name } : {}),
117
114
  };
118
115
 
@@ -4,6 +4,8 @@ import {
4
4
  type HarmonyConfigPlugin,
5
5
  } from '@expo-harmony/config-plugins';
6
6
 
7
+ import { withBuildPropertiesDefaults } from '@expo-harmony/expo-build-properties';
8
+
7
9
  import { HarmonyPrebuildError } from './errors';
8
10
  import { withAutolinkingMods } from './mods/withAutolinkingMods';
9
11
  import { withEntryMods } from './mods/withEntryMods';
@@ -29,6 +31,7 @@ const withDefaults: HarmonyConfigPlugin<HarmonyPrebuildOptions | void> = (config
29
31
  }
30
32
 
31
33
  config = withPreparationMod(config);
34
+ config = withBuildPropertiesDefaults(config);
32
35
  config = withProjectMods(config);
33
36
  config = withEntryMods(config);
34
37
  config = withSourceMods(config);