@glassly/miniapp-cli 0.1.15 → 0.1.16-dev.0
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/package.json +1 -1
- package/src/sim/background-worker.ts +13 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glassly/miniapp-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16-dev.0",
|
|
4
4
|
"description": "Build tooling for Glassly miniapps: dev server, packer, manifest validation, and JSON Schema. The `glassly` command that drives it ships in @glassly/cli.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -4,13 +4,24 @@
|
|
|
4
4
|
interface WorkerScope {
|
|
5
5
|
postMessage(message: unknown): void
|
|
6
6
|
onmessage: ((event: {data: Inbound}) => void) | null
|
|
7
|
-
addEventListener(type: string, listener: (event:
|
|
7
|
+
addEventListener(type: string, listener: (event: WorkerEvent | undefined) => void): void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type WorkerEvent = {error?: unknown; message?: unknown; reason?: unknown; preventDefault?: () => void}
|
|
11
|
+
|
|
12
|
+
// The hooks the phone's polyfill and the miniapp bundle set on the JS context's global object.
|
|
13
|
+
type WorkerGlobals = {
|
|
14
|
+
__dispatch?: (iface: string, method: string, argsJson: string) => string | null
|
|
15
|
+
__hostError?: (payloadJson: string) => void
|
|
16
|
+
localStorage?: unknown
|
|
17
|
+
__deliverBridgeRaw?: (raw: string) => void
|
|
18
|
+
__initCallback?: (host: string) => void
|
|
8
19
|
}
|
|
9
20
|
|
|
10
21
|
type Inbound = {type: "run"; code: string; sourceUrl: string} | {type: "bridge"; raw: string}
|
|
11
22
|
|
|
12
23
|
const scope = globalThis as unknown as WorkerScope
|
|
13
|
-
const g = globalThis as
|
|
24
|
+
const g = globalThis as unknown as WorkerGlobals
|
|
14
25
|
|
|
15
26
|
function serialize(arg: unknown): unknown {
|
|
16
27
|
if (arg instanceof Error) return {__error: true, message: arg.message, stack: arg.stack}
|