first commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# @wrnexus/mobile
|
||||
|
||||
SSR-safe access to Capacitor plugins from WrNexus browser code.
|
||||
|
||||
```bash
|
||||
wrnexus mobile add @capacitor/camera
|
||||
```
|
||||
|
||||
```ts
|
||||
import { Camera } from "@capacitor/camera";
|
||||
import { mobile } from "@wrnexus/mobile";
|
||||
|
||||
if (mobile.isNative()) {
|
||||
mobile.registerPlugin("Camera", Camera);
|
||||
const photo = await mobile.invoke("Camera", "getPhoto", { resultType: "uri" });
|
||||
}
|
||||
```
|
||||
|
||||
`isNative()` is false and `platform()` is `web` during SSR. `plugin()` returns
|
||||
`undefined` when unavailable; `requirePlugin()` and `invoke()` throw an
|
||||
actionable `MobileUnavailableError`.
|
||||
|
||||
Import and register Capacitor packages only from browser-owned code. Do not
|
||||
import them in server routes, SSR helpers, or other Bun-only modules.
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "@wrnexus/mobile",
|
||||
"version": "0.2.12",
|
||||
"type": "module",
|
||||
"description": "@wrnexus/mobile — part of the WrNexus framework.",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"engines": {
|
||||
"bun": ">=1.1.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npmjs.org/",
|
||||
"access": "restricted"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@wrnexus/native": "^0.2.12"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user