@expo-oh/expo-modules-core 3.0.30 → 3.0.31

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
@@ -1,108 +1,80 @@
1
1
  # @expo-oh/expo-modules-core
2
2
 
3
- HarmonyOS adaptation of expo-modules-core@3.0.30.
3
+ Expo Modules 在 HarmonyOS 上的原生基础设施,连接 RNOH、JSI、原生模块与 JavaScript 公共入口。
4
4
 
5
- Install using the original dependency key:
5
+ 上游基线:`expo-modules-core@3.0.30`。本包由 [expo-harmony-cli](https://github.com/stonehill-2345/expo-harmony-cli) 项目维护,非 Expo 官方发行版本。
6
6
 
7
- `npm install --save-exact expo-modules-core@npm:@expo-oh/expo-modules-core@3.0.30`
7
+ [鸿蒙快速开始](https://github.com/stonehill-2345/expo-harmony-cli/blob/main/docs/harmony/getting-started.md) · [适配源码](https://github.com/stonehill-2345/expo-harmony-cli/tree/main/packages/expo-modules-core) · [验收记录](https://github.com/stonehill-2345/expo-harmony-cli/blob/main/docs/releases/2026-10-09-sdk54-expo-oh-candidate.md) · [问题反馈](https://github.com/stonehill-2345/expo-harmony-cli/issues)
8
8
 
9
- Release: sdk54-expo-oh-harmony.0. See the repository release plan for supported capabilities. Upstream documentation follows.
9
+ ## 安装
10
10
 
11
- <p>
12
- <a href="https://docs.expo.dev/modules/">
13
- <img
14
- src="../../.github/resources/expo-modules-core.svg"
15
- alt="expo-modules-core"
16
- height="64" />
17
- </a>
18
- </p>
11
+ 以下命令适用于已经配置好 `@expo-oh` SDK54 依赖组合的项目。普通 Expo 项目请先阅读[鸿蒙快速开始](https://github.com/stonehill-2345/expo-harmony-cli/blob/main/docs/harmony/getting-started.md);仅安装此包不会自动完成 RNOH 和原生工程配置。
19
12
 
20
- The core of Expo Modules architecture.
21
-
22
- # Installation in managed Expo projects
23
-
24
- For [managed](https://docs.expo.dev/archive/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](#api-documentation). If you follow the link and there is no documentation available then this library is not yet usable within managed projects &mdash; it is likely to be included in an upcoming Expo SDK release.
25
-
26
- # Installation in bare React Native projects
27
-
28
- For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
29
-
30
- ### Add the package to your npm dependencies
13
+ ```bash
14
+ # npm
15
+ npm install --save-exact expo-modules-core@npm:@expo-oh/expo-modules-core@3.0.31
31
16
 
17
+ # pnpm
18
+ pnpm add --save-exact expo-modules-core@npm:@expo-oh/expo-modules-core@3.0.31
32
19
  ```
33
- npm install expo-modules-core
34
- ```
35
-
36
- ### Configure for iOS
37
-
38
- Run `npx pod-install` after installing the npm package.
39
-
40
- ### Configure for Android
41
20
 
42
- No additional set up necessary.
21
+ 保留原依赖键:
43
22
 
44
- # Importing native dependencies - autolinking
45
-
46
- Many React Native libraries come with platform-specific (native) code. This native code has to be linked into the project and, in some cases, configured further. These actions require some modifications to the native project files. One of the steps that has to be done with the native configuration is to enable the autolinking mechanism that takes care of including any supported module's native code into the project. The following configuration is required:
47
-
48
- ### iOS
49
-
50
- > Caution! After you have made the following changes you will need to run `pod install` again.
51
-
52
- ```ruby
53
- # Podfile
23
+ ```json
24
+ {
25
+ "dependencies": {
26
+ "expo-modules-core": "npm:@expo-oh/expo-modules-core@3.0.31"
27
+ }
28
+ }
29
+ ```
54
30
 
55
- require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
56
- require File.join(File.dirname(`node --print "require.resolve('expo-modules-core/package.json')"`), "cocoapods.rb")
57
- require File.join(File.dirname(`node --print "require.resolve('expo-modules-core/package.json')"`), "scripts/autolinking")
31
+ 本包的鸿蒙适配已包含在 npm 产物中,无需额外应用本包的本地 patch。使用完整依赖组合及 overrides,保留锁文件;不要混装另一组 SDK 版本。
58
32
 
59
- # ...
33
+ ## 使用方式
60
34
 
61
- target "TargetName" do
62
- use_unimodules!
63
- config = use_native_modules!
64
- use_react_native!(:path => config["reactNativePath"])
35
+ 应用通过原包名导入;下面示例查找本组合中的 Constants 原生模块:
65
36
 
66
- # ...
67
- end
37
+ ```ts
38
+ import { requireNativeModule } from "expo-modules-core";
39
+ const constants = requireNativeModule("ExponentConstants");
68
40
  ```
69
41
 
70
- ### Android
71
-
72
- ```groovy
73
- // app/build.gradle
42
+ 业务读取应用信息优先使用 `expo-constants` 的公共 API。原生模块开发者还需要提供 Harmony C++/ArkTS 实现和模块配置,安装 Core 不会自动移植已有 Swift/Kotlin 模块。
74
43
 
75
- apply from: new File(["node", "--print", "require.resolve('expo-modules-core/package.json')"].execute(null, rootDir).text.trim(), "../gradle.groovy")
76
- apply from: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../react.gradle")
77
- apply from: new File(["node", "--print", "require.resolve('expo-updates/package.json')"].execute(null, rootDir).text.trim(), "../scripts/create-manifest-android.gradle")
44
+ ## 鸿蒙支持范围
78
45
 
79
- // ...
80
-
81
- apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
82
- applyNativeModulesAppBuildGradle(project)
83
- ```
46
+ | 能力 | HarmonyOS 行为与边界 |
47
+ | --- | --- |
48
+ | 原生模块与事件 | 实现运行时级注册、查找、EventEmitter 和订阅 |
49
+ | JSI 基础对象 | 包含 NativeModule、SharedObject、SharedRef 及资源销毁处理 |
50
+ | 异步调用 | 原生任务通过 RNOH CallInvoker 完成 Promise;取消为协作式 |
51
+ | 原生视图 | 存在 Harmony 视图适配及 Fabric 示例,不代表所有视图契约完全对齐 |
52
+ | 模块开发 | 不提供完整 Expo Modules DSL 或 Swift/Kotlin 到 ArkTS 的自动转换 |
53
+ | 支持承诺 | SDK54 模板验收不等同于全部 Core API、原生视图或生产负载验收 |
84
54
 
85
- ```groovy
86
- // settings.gradle
55
+ ## 生成和运行原生工程
87
56
 
88
- apply from: new File(["node", "--print", "require.resolve('expo-modules-core/package.json')"].execute(null, rootDir).text.trim(), "../gradle.groovy");
89
- includeUnimodulesProjects()
57
+ 从已配置项目根目录执行:
90
58
 
91
- apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
92
- applyNativeModulesSettingsGradle(settings)
59
+ ```bash
60
+ npx expo prebuild --platform harmony
61
+ npx expo run:harmony
93
62
  ```
94
63
 
95
- ### Explanation
64
+ 日常开发启动 Metro:`npx expo start`。安装或更新原生依赖、应用配置后,需要重新生成并构建;重启 Metro 不能替代原生构建。
96
65
 
97
- The scripts that are referenced in Gradle and Cocoapods are usually found the related package inside the project's `node_modules` directory. In the case of monorepos (such as Yarn workspaces) the project directory may not contain `node_modules` at all; instead, the modules are likely to be located at the root of the repository. In order to ensure that both cases are supported, we take advantage of the Node dependency resolution strategy. We invoke a subprocess that spawns the simple JavaScript snippet that tries to locate the desired npm package containing the script we need.
66
+ 兼容基线为 Expo SDK54、React 19.1.1、React Native 0.82.1、RNOH 0.82.30。设备、DevEco、签名要求见[快速开始](https://github.com/stonehill-2345/expo-harmony-cli/blob/main/docs/harmony/getting-started.md)。普通 Expo Go 不能作为本组合的鸿蒙运行容器。
98
67
 
99
- - On iOS, we use [`` ` ` `` (backtick)](https://stackoverflow.com/questions/3159945/running-command-line-commands-within-ruby-script) ([alternative reference](https://ruby-doc.org/core-3.0.2/Kernel.html#method-i-60)).
100
- - On Android, we use [String[]#execute](<http://docs.groovy-lang.org/latest/html/groovy-jdk/java/lang/String[].html#execute()>) to obtain the results from the subprocess' stdout.
68
+ ## 排查与反馈
101
69
 
102
- The Node process that is spawned runs [`require.resolve`](https://nodejs.org/dist/latest-v14.x/docs/api/modules.html#modules_require_resolve_request_options) to obtain the path to a module's `package.json`(if you look for the module location using solely module name, you'll be given the path to the file pointed by the `main` attribute from the `package.json` and we need to know the location of the module's root directory). We then assemble the path to the desired script and execute it.
70
+ - 安装后版本或功能不符:检查 package.json alias、overrides 和锁文件,使用 `npx expo install --check` 核对受管组合。
71
+ - 原生模块缺失或更新无效:确认使用同组合的 Core/Autolinking,重新 prebuild、构建并安装。
72
+ - 旧 patch 项目不会自动迁移;保留原项目,按指南新建项目后迁移业务代码,不叠加旧补丁。
103
73
 
104
- You can read more about the scripts and libraries used in the examples above in their official READMEs.
74
+ 请在[本仓库 Issues](https://github.com/stonehill-2345/expo-harmony-cli/issues) 提供包版本、RNOH/系统版本、设备类型、最小复现及日志。已记录的模板运行结果不代表全部 API 或所有设备均已验证。
105
75
 
106
- # Contributing
76
+ ## 上游与许可证
107
77
 
108
- Contributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing).
78
+ - [上游参考](https://docs.expo.dev/modules/overview/):用于通用 API 或原始包说明;HarmonyOS 支持以本文为准。
79
+ - 原始来源:[Expo 源码](https://github.com/expo/expo/tree/main/packages/expo-modules-core)。
80
+ - 保留上游许可证和来源声明,详见包内 `LICENSE`。遵循 Expo 上游 MIT 许可证。
@@ -0,0 +1,4 @@
1
+ import type { ProxyNativeModule } from './NativeModulesProxy.types';
2
+ declare const _default: Record<string, ProxyNativeModule>;
3
+ export default _default;
4
+ //# sourceMappingURL=NativeModulesProxy.harmony.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeModulesProxy.harmony.d.ts","sourceRoot":"","sources":["../src/NativeModulesProxy.harmony.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;wBAU1B,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC;AAA3E,wBAA4E"}
@@ -0,0 +1,6 @@
1
+ import { type ComponentType } from 'react';
2
+ /**
3
+ * A drop-in replacement for `requireNativeComponent`.
4
+ */
5
+ export declare function requireNativeViewManager<P>(moduleName: string, viewName?: string): ComponentType<P>;
6
+ //# sourceMappingURL=NativeViewManagerAdapter.harmony.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeViewManagerAdapter.harmony.d.ts","sourceRoot":"","sources":["../src/NativeViewManagerAdapter.harmony.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAkB,KAAK,aAAa,EAA4B,MAAM,OAAO,CAAC;AA4FrF;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EACxC,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,GAChB,aAAa,CAAC,CAAC,CAAC,CAgDlB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo-oh/expo-modules-core",
3
- "version": "3.0.30",
3
+ "version": "3.0.31",
4
4
  "private": false,
5
5
  "description": "The core of Expo Modules architecture",
6
6
  "main": "src/index.ts",
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "author": "650 Industries, Inc.",
51
51
  "license": "MIT",
52
- "homepage": "https://github.com/stonehill-2345/expo-harmony-cli#readme",
52
+ "homepage": "https://github.com/stonehill-2345/expo-harmony-cli/blob/main/packages/expo-modules-core/README.md",
53
53
  "jest": {
54
54
  "preset": "expo-module-scripts"
55
55
  },