@onekeyfe/react-native-split-bundle-loader 3.0.162 → 3.0.165

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 (2) hide show
  1. package/README.md +53 -0
  2. package/package.json +6 -5
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # @onekeyfe/react-native-split-bundle-loader
2
+
3
+ Native loading of OneKey split JavaScript bundles on iOS and Android. The module
4
+ reports the current runtime's bundle context, resolves a segment path and loads
5
+ the segment into that runtime. It is intended for applications with the matching
6
+ OneKey split-bundle packaging and native host integration.
7
+
8
+ ## Installation
9
+
10
+ ```sh
11
+ yarn add @onekeyfe/react-native-split-bundle-loader
12
+ ```
13
+
14
+ Install the application's iOS pods and rebuild the native application. The
15
+ package declares `@onekeyfe/react-native-bundle-update` as a peer dependency.
16
+ The native binary must include the segment loader; adding JavaScript alone cannot
17
+ enable native segment evaluation.
18
+
19
+ ## Usage
20
+
21
+ ```ts
22
+ import { SplitBundleLoader } from '@onekeyfe/react-native-split-bundle-loader';
23
+
24
+ const context = await SplitBundleLoader.getRuntimeBundleContext();
25
+ // Use this context to select the matching application-owned segment metadata.
26
+ const bundleRoot = context.bundleRoot;
27
+ ```
28
+
29
+ ## API
30
+
31
+ | Method | Purpose |
32
+ | --- | --- |
33
+ | `getRuntimeBundleContext()` | Return runtime kind, source kind, bundle root and native/bundle version information. |
34
+ | `resolveSegmentPath(relativePath, sha256)` | Resolve a segment using its expected SHA-256. |
35
+ | `loadSegment(segmentId, segmentKey, relativePath, sha256)` | Load a segment into the calling runtime. |
36
+
37
+ The application supplies IDs, keys, relative paths and expected hashes from its
38
+ own split-bundle metadata. Keep them aligned with the running native and bundle
39
+ versions. The module does not generate manifests or choose compatible module ID
40
+ tables for the caller.
41
+
42
+ Handle rejected load promises before requiring modules from the segment. A
43
+ resolved path alone does not mean segment code has been evaluated. UI and
44
+ background JavaScript runtimes have separate loading contexts; initialize and
45
+ load in the runtime that will consume the modules.
46
+
47
+ See [src/NativeSplitBundleLoader.ts](src/NativeSplitBundleLoader.ts) for the
48
+ complete TypeScript interface and the native source directories for platform
49
+ loading and failure handling.
50
+
51
+ ## License
52
+
53
+ MIT.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-split-bundle-loader",
3
- "version": "3.0.162",
4
- "description": "react-native-split-bundle-loader",
3
+ "version": "3.0.165",
4
+ "description": "Native split JavaScript bundle context and segment loading for OneKey",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
7
7
  "exports": {
@@ -45,14 +45,15 @@
45
45
  ],
46
46
  "repository": {
47
47
  "type": "git",
48
- "url": "git+https://github.com/OneKeyHQ/app-modules/react-native-split-bundle-loader.git"
48
+ "url": "git+https://github.com/OneKeyHQ/app-modules.git",
49
+ "directory": "native-modules/react-native-split-bundle-loader"
49
50
  },
50
51
  "author": "@onekeyhq <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
51
52
  "license": "MIT",
52
53
  "bugs": {
53
- "url": "https://github.com/OneKeyHQ/app-modules/react-native-split-bundle-loader/issues"
54
+ "url": "https://github.com/OneKeyHQ/app-modules/issues"
54
55
  },
55
- "homepage": "https://github.com/OneKeyHQ/app-modules/react-native-split-bundle-loader#readme",
56
+ "homepage": "https://github.com/OneKeyHQ/app-modules/tree/main/native-modules/react-native-split-bundle-loader#readme",
56
57
  "publishConfig": {
57
58
  "registry": "https://registry.npmjs.org/"
58
59
  },