@glassly/crust 0.4.3-dev.1267 → 0.4.3-dev.1269

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 +74 -17
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,41 +1,98 @@
1
1
  # @glassly/crust
2
2
 
3
3
  The Glassly native runtime layer: an [Expo module](https://docs.expo.dev/modules/overview/)
4
- providing the native capabilities the Glassly Engine's miniapp runtime sits on —
4
+ providing the native capabilities the Glassly Engine's miniapp runtime sits on:
5
5
  per-miniapp JS contexts (QuickJS on Android, JavaScriptCore on iOS), the
6
6
  native side of the GlasslyJS bridge, navigation, and device utilities.
7
7
 
8
- You don't call crust directly from app code: it's a **peer dependency of
9
- [`@glassly/engine`](https://www.npmjs.com/package/@glassly/engine)**. A host app
10
- embedding the engine installs crust alongside it and Expo autolinking picks it
11
- up.
8
+ You don't call crust directly from app code. It is a dependency of
9
+ [`@glassly/engine`](https://www.npmjs.com/package/@glassly/engine), so
10
+ installing the engine installs crust. A host app also lists it in its Expo
11
+ `plugins` and as a direct dependency, as the example OEM app
12
+ (`sdk/example-oem-app` in the Glassly repository) does: Expo resolves each
13
+ plugin name from the app's project root, and a direct dependency is always
14
+ installed there. Expo autolinking links the native module.
12
15
 
13
16
  ## Install
14
17
 
15
18
  ```sh
16
- npm install @glassly/crust@dev
19
+ npm install @glassly/crust
17
20
  ```
18
21
 
19
- > Currently published on the `dev` dist-tag (prerelease channel).
20
-
21
22
  ## Config plugin
22
23
 
23
24
  The package ships an Expo config plugin (`app.plugin.js`) that carries its
24
- Android build contract — Mapbox's maven repository, protobuf exclusions, and
25
- core-library desugaring. Add it to the host app's Expo config:
25
+ Android build contract. Add it to the host app's Expo config:
26
26
 
27
27
  ```json
28
28
  {"expo": {"plugins": ["@glassly/crust"]}}
29
29
  ```
30
30
 
31
- Building with the navigation feature requires a `MAPBOX_DOWNLOADS_TOKEN` in
32
- the Android build environment (Mapbox's SDK repository is authenticated).
31
+ At prebuild the plugin makes four edits:
32
+
33
+ - adds Mapbox's authenticated Downloads Maven repository to the project
34
+ `build.gradle`;
35
+ - excludes `com.google.protobuf:protobuf-javalite` from every configuration, so
36
+ it cannot duplicate the classes of `protobuf-java`;
37
+ - turns on core-library desugaring in the app `build.gradle` (Java 17 compile
38
+ options and `desugar_jdk_libs`);
39
+ - patches `MainApplication` (`onCreate`, and `onConfigurationChanged` when the
40
+ host overrides it) to return early in the app's `:notif` process, so the
41
+ notification-listener process never initializes React Native. Prebuild fails
42
+ with "could not add the notification-process guard" when `onCreate` does not
43
+ match the generated `MainApplication` shape.
44
+
45
+ ### Mapbox
46
+
47
+ Android links Mapbox Navigation and resolves it from Mapbox's authenticated
48
+ repository, so every Android build needs `MAPBOX_DOWNLOADS_TOKEN` (a Mapbox
49
+ secret token with the `Downloads:Read` scope) as an environment variable or a
50
+ Gradle property. The artifacts are `implementation` dependencies, or
51
+ `compileOnly` when `EXPO_PUBLIC_DEPLOYMENT_REGION=china`.
52
+
53
+ On iOS, crust's Swift code imports `MapboxNavigationCore`, `MapboxDirections`
54
+ and `MapboxCommon`, which come from the Mapbox Navigation Swift package
55
+ (`mapbox-navigation-ios`). The podspec depends only on `ExpoModulesCore`, and
56
+ the config plugin makes the Android edits above only, so neither supplies the
57
+ package. The Glassly App supplies it with two config plugins in its own source,
58
+ both listed in `mobile/app.config.ts`:
59
+
60
+ - `mobile/plugins/mapbox-nav-ios.ts` adds the package (3.0.0 up to the next
61
+ major) to the app's Xcode project and links `MapboxNavigationCore`,
62
+ `MapboxDirections` and `MapboxMaps` to the app target.
63
+ - `mobile/plugins/mapbox-nav-crust-link.ts` adds a Podfile `post_install` hook.
64
+ The hook creates a throwaway static-library target, `MapboxNavOrder`, that
65
+ carries the same products, and makes the `Crust` pod target depend on it, so
66
+ the Mapbox modules are built before crust compiles. The products are not
67
+ linked into crust itself, which would duplicate their symbols in the app.
68
+ The podspec's search paths into `${PODS_CONFIGURATION_BUILD_DIR}` let crust
69
+ import the built modules.
70
+
71
+ Swift Package Manager fetches the package with the same Mapbox secret token,
72
+ read from `~/.netrc` (`machine api.mapbox.com`, `login mapbox`, `password
73
+ <token>`).
74
+
75
+ Neither plugin is published in a package, `sdk/example-oem-app/app.json` does
76
+ not use them, and no other iOS path is documented in the repository. The
77
+ `@glassly/crust` and `@glassly/bluetooth-sdk` plugins alone are therefore not a
78
+ complete iOS integration: an external iOS host must reproduce what the two
79
+ plugins do, or its crust pod fails to compile on `import MapboxNavigationCore`.
80
+
81
+ ### Polyfill bundle
82
+
83
+ At build time the Android side reads the GlasslyJS polyfill bundle from
84
+ `../../jspolyfill/assets`, relative to crust's `android/` folder, so
85
+ [`@glassly/jspolyfill`](https://www.npmjs.com/package/@glassly/jspolyfill) has
86
+ to sit next to crust in `node_modules/@glassly/`. Crust declares it as a
87
+ dependency, and the example OEM app lists it directly. The iOS pod ships a
88
+ mirror of the bundle.
89
+
90
+ ## Build and test
33
91
 
34
- At build time the Android side also reads the GlasslyJS polyfill bundle from
35
- its [`@glassly/jspolyfill`](https://www.npmjs.com/package/@glassly/jspolyfill)
36
- sibling, which is declared as a dependency.
92
+ `bun run build` compiles the module and its config plugin (`expo-module build`
93
+ and `expo-module build plugin`), writing `build/` and `plugin/build/`; the
94
+ `prepare` script runs the same build. crust has no test files.
37
95
 
38
96
  ## Part of Glassly
39
97
 
40
- Source lives in the [Glassly monorepo](https://github.com/tetramo-labs/glassly)
41
- under `mobile/modules/crust`. Issues and contributions welcome there.
98
+ Source lives in the Glassly repository under `mobile/modules/crust`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glassly/crust",
3
- "version": "0.4.3-dev.1267",
3
+ "version": "0.4.3-dev.1269",
4
4
  "description": "Glassly Native Module",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "license": "MIT",
36
36
  "homepage": "https://github.com/fossephate/crust#readme",
37
37
  "dependencies": {
38
- "@glassly/jspolyfill": "0.4.3-dev.1267"
38
+ "@glassly/jspolyfill": "0.4.3-dev.1269"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@expo/config-plugins": ">=8.0.0",