@expo-harmony/template 55.0.0-harmony.4 → 55.0.0-harmony.5
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/harmony/build-profile.json5 +1 -1
- package/harmony/entry/src/main/ets/PackageProvider.ets +17 -3
- package/harmony/entry/src/main/ets/abilitystage/EntryAbilityStage.ets +14 -0
- package/harmony/entry/src/main/ets/entryability/EntryAbility.ets +2 -2
- package/harmony/entry/src/main/ets/pages/Index.ets +14 -33
- package/harmony/entry/src/main/module.json5 +1 -0
- package/harmony/hvigorfile.ts +6 -2
- package/package.json +4 -3
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ExpoReactHostFactory } from '@expo-harmony/expo';
|
|
2
|
+
import { ExpoRuntimeConfig } from '@expo-harmony/expo-modules-core';
|
|
3
|
+
import type { RNInstanceOptions, RNPackage, RNPackageContext } from '@rnoh/react-native-openharmony';
|
|
2
4
|
import { createRNOHPackages } from './RNOHPackagesFactory';
|
|
5
|
+
import { expoHarmonyHostProvider } from './generated/ExpoHarmonyHostProvider';
|
|
3
6
|
|
|
4
|
-
export function getRNOHPackages(context: RNPackageContext): RNPackage[] {
|
|
5
|
-
return createRNOHPackages(context);
|
|
7
|
+
export function getRNOHPackages(context: RNPackageContext, runtimeConfig?: ExpoRuntimeConfig): RNPackage[] {
|
|
8
|
+
return createRNOHPackages(context, runtimeConfig);
|
|
6
9
|
}
|
|
10
|
+
|
|
11
|
+
export const expoReactHost = ExpoReactHostFactory.getDefaultReactHost({
|
|
12
|
+
bundlePath: 'hermes_bundle.hbc',
|
|
13
|
+
workerScriptUrl: 'entry/ets/workers/RNOHWorker.ets',
|
|
14
|
+
provider: expoHarmonyHostProvider,
|
|
15
|
+
createRNInstanceOptions: (headless: boolean): RNInstanceOptions => ({
|
|
16
|
+
name: "__EXPO_HARMONY_APP_LABEL__",
|
|
17
|
+
createRNPackages: (context: RNPackageContext): RNPackage[] => getRNOHPackages(context, new ExpoRuntimeConfig({ isHeadless: headless })),
|
|
18
|
+
fontResourceByFontFamily: {},
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ExpoAbilityStage } from '@expo-harmony/expo';
|
|
2
|
+
import type { ExpoHarmonyHostProvider, ExpoReactHost } from '@expo-harmony/expo';
|
|
3
|
+
import { expoReactHost } from '../PackageProvider';
|
|
4
|
+
import { expoHarmonyHostProvider } from '../generated/ExpoHarmonyHostProvider';
|
|
5
|
+
|
|
6
|
+
export default class EntryAbilityStage extends ExpoAbilityStage {
|
|
7
|
+
protected override getExpoReactHost(): ExpoReactHost {
|
|
8
|
+
return expoReactHost;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
protected override getExpoHarmonyHostProvider(): ExpoHarmonyHostProvider {
|
|
12
|
+
return expoHarmonyHostProvider;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Automatically generated by @expo-harmony/prebuild-config.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { ExpoHarmonyHostProvider } from '@expo-harmony/expo
|
|
6
|
-
import { ExpoRNAbility } from '@expo-harmony/expo
|
|
5
|
+
import type { ExpoHarmonyHostProvider } from '@expo-harmony/expo';
|
|
6
|
+
import { ExpoRNAbility } from '@expo-harmony/expo';
|
|
7
7
|
import { expoHarmonyHostProvider } from '../generated/ExpoHarmonyHostProvider';
|
|
8
8
|
|
|
9
9
|
export default class __EXPO_HARMONY_ABILITY_NAME__ extends ExpoRNAbility {
|
|
@@ -2,38 +2,25 @@
|
|
|
2
2
|
* Automatically generated by @expo-harmony/prebuild-config.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type resmgr from '@ohos.resourceManager';
|
|
6
5
|
import {
|
|
7
|
-
MetroJSBundleProvider,
|
|
8
6
|
RNOHCoreContext,
|
|
9
7
|
RNOHErrorDialog,
|
|
10
|
-
ResourceJSBundleProvider,
|
|
11
8
|
} from '@rnoh/react-native-openharmony';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
9
|
+
import type { RNInstanceOptions } from '@rnoh/react-native-openharmony';
|
|
10
|
+
import { ExpoRNApp } from '@expo-harmony/expo';
|
|
11
|
+
import { expoReactHost } from '../PackageProvider';
|
|
14
12
|
import { ExpoHarmonyRootView } from '../generated/ExpoHarmonyHostProvider';
|
|
15
13
|
|
|
16
|
-
class InMemoryResourceJSBundleProvider extends ResourceJSBundleProvider {
|
|
17
|
-
private readonly ownedResourceManager: resmgr.ResourceManager;
|
|
18
|
-
private readonly ownedResourcePath: string;
|
|
19
|
-
|
|
20
|
-
constructor(resourceManager: resmgr.ResourceManager, resourcePath: string) {
|
|
21
|
-
super(resourceManager, resourcePath);
|
|
22
|
-
this.ownedResourceManager = resourceManager;
|
|
23
|
-
this.ownedResourcePath = resourcePath;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
override async getBundle(): Promise<ArrayBuffer> {
|
|
27
|
-
const bytes = await this.ownedResourceManager.getRawFileContent(this.ownedResourcePath);
|
|
28
|
-
return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
14
|
@Entry
|
|
33
15
|
@Component
|
|
34
16
|
struct Index {
|
|
35
17
|
@StorageLink('RNOHCoreContext') private rnohCoreContext: RNOHCoreContext | undefined = undefined;
|
|
36
18
|
|
|
19
|
+
private instanceOptions(): RNInstanceOptions {
|
|
20
|
+
const options = expoReactHost.createRNInstanceOptions();
|
|
21
|
+
return options;
|
|
22
|
+
}
|
|
23
|
+
|
|
37
24
|
build(): void {
|
|
38
25
|
Stack() {
|
|
39
26
|
ExpoHarmonyRootView()
|
|
@@ -43,19 +30,13 @@ struct Index {
|
|
|
43
30
|
RNOHErrorDialog({ ctx: this.rnohCoreContext });
|
|
44
31
|
}
|
|
45
32
|
ExpoRNApp({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
createRNPackages: getRNOHPackages,
|
|
49
|
-
fontResourceByFontFamily: {},
|
|
50
|
-
enableDebugger: this.rnohCoreContext.isDebugModeEnabled,
|
|
51
|
-
},
|
|
33
|
+
reactHost: expoReactHost,
|
|
34
|
+
rnInstanceConfig: this.instanceOptions(),
|
|
52
35
|
appKey: 'main',
|
|
53
|
-
jsBundleProvider:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
'hermes_bundle.hbc',
|
|
58
|
-
),
|
|
36
|
+
jsBundleProvider: expoReactHost.createJSBundleProvider(
|
|
37
|
+
this.rnohCoreContext.uiAbilityContext,
|
|
38
|
+
this.rnohCoreContext.isDebugModeEnabled,
|
|
39
|
+
),
|
|
59
40
|
});
|
|
60
41
|
}
|
|
61
42
|
}
|
package/harmony/hvigorfile.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { createRequire } from 'node:module';
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { hvigor } from '@ohos/hvigor';
|
|
6
6
|
import { appTasks, OhosPluginId } from '@ohos/hvigor-ohos-plugin';
|
|
7
|
+
import { publishHarmonyNativeRuntime } from '@expo-harmony/cli/native-build';
|
|
7
8
|
import { createRNOHProjectPlugin } from '@rnoh/hvigor-plugin';
|
|
8
9
|
|
|
9
10
|
import { writeStamp } from './native-inputs-stamp';
|
|
@@ -190,8 +191,11 @@ const BundlerPlugin = {
|
|
|
190
191
|
hvigor.nodesEvaluated(() => {
|
|
191
192
|
const appContext = node.getContext(OhosPluginId.OHOS_APP_PLUGIN);
|
|
192
193
|
const buildMode = appContext.getBuildMode();
|
|
194
|
+
publishHarmonyNativeRuntime(ProjectRoot, buildMode === 'release' ? 'release' : 'debug');
|
|
193
195
|
|
|
194
|
-
|
|
196
|
+
const config = JSON.parse(fs.readFileSync(path.join(path.dirname(EmbeddedBundle), 'expo-updates/config.json'), 'utf8'));
|
|
197
|
+
const embedded = buildMode === 'release' || config.useNativeDebug === true;
|
|
198
|
+
if (!embedded) stashBundle();
|
|
195
199
|
|
|
196
200
|
node.subNodes((moduleNode) => {
|
|
197
201
|
const hapContext = moduleNode.getContext(OhosPluginId.OHOS_HAP_PLUGIN);
|
|
@@ -202,7 +206,7 @@ const BundlerPlugin = {
|
|
|
202
206
|
moduleNode.registerTask({
|
|
203
207
|
name: `${targetName}@ExpoHarmonyBundle`,
|
|
204
208
|
run: () => {
|
|
205
|
-
if (
|
|
209
|
+
if (embedded) bundleRelease();
|
|
206
210
|
},
|
|
207
211
|
dependencies: [`${targetName}@ProcessResource`],
|
|
208
212
|
postDependencies: [`${targetName}@CompileResource`],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo-harmony/template",
|
|
3
|
-
"version": "55.0.0-harmony.
|
|
3
|
+
"version": "55.0.0-harmony.5",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"react-native",
|
|
6
6
|
"expo",
|
|
@@ -26,8 +26,9 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@babel/core": "7.29.7",
|
|
29
|
-
"@expo-harmony/config-plugins": "55.0.10-harmony.
|
|
30
|
-
"@expo-harmony/expo
|
|
29
|
+
"@expo-harmony/config-plugins": "55.0.10-harmony.4",
|
|
30
|
+
"@expo-harmony/expo": "55.0.26-harmony.1",
|
|
31
|
+
"@expo-harmony/expo-modules-core": "55.0.25-harmony.3",
|
|
31
32
|
"@expo/metro-config": "55.0.26",
|
|
32
33
|
"@expo/metro-runtime": "55.0.12",
|
|
33
34
|
"@react-native-oh/react-native-harmony": "0.84.1",
|