@glassly/jspolyfill 0.4.3-dev.1267 → 0.4.3-dev.1268

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 +36 -17
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,30 +2,49 @@
2
2
 
3
3
  The GlasslyJS polyfill bundle. Glassly runs each miniapp in its own bare JS
4
4
  context (JavaScriptCore on iOS, QuickJS on Android); this package provides the
5
- browser-like standard library those contexts lack — `console`, timers,
6
- `fetch`, `WebSocket`, `localStorage`, `crypto.getRandomValues`, and
7
- `crypto.randomUUID` — implemented over a single `__dispatch` native bridge,
8
- plus the `__deliver` / `signalReady` plumbing the host runtime relies on.
9
- `crypto.subtle` is not implemented.
5
+ browser-like standard library those contexts lack: `console`, timers
6
+ (`setTimeout`, `setInterval`, `queueMicrotask`), `fetch`, `WebSocket`,
7
+ `localStorage`, `AbortController` and `AbortSignal`, `TextEncoder` and
8
+ `TextDecoder`, `atob` and `btoa`, `crypto.getRandomValues` and
9
+ `crypto.randomUUID`, implemented over a single `__dispatch` native bridge, plus
10
+ the `__deliver` hook and the `ready` signal the host runtime relies on.
11
+ `crypto.subtle` is a stub: every call throws an error saying it is not
12
+ implemented.
13
+
14
+ You don't import or install this package yourself: it's installed with
15
+ [`@glassly/crust`](https://www.npmjs.com/package/@glassly/crust), which
16
+ [`@glassly/engine`](https://www.npmjs.com/package/@glassly/engine) depends on.
17
+ Crust's Android build reads the bundle from `../../jspolyfill/assets`, relative
18
+ to crust's `android/` folder, so this package has to sit next to crust in
19
+ `node_modules/@glassly/`. Crust's iOS pod ships a mirror of the bundle, and the
20
+ engine passes it to each miniapp context at spawn.
21
+
22
+ ## Build
23
+
24
+ `assets/startup.js` is generated from `src/startup.ts` and committed. After
25
+ editing `src/startup.ts`, install dependencies and run this from
26
+ `mobile/modules/jspolyfill`:
10
27
 
11
- You don't import this package from app code: it's a **peer of the runtime
12
- stack**. [`@glassly/crust`](https://www.npmjs.com/package/@glassly/crust)'s
13
- Android build reads the bundle from this package's `assets/` at build time,
14
- and the engine injects it into each miniapp context at spawn.
28
+ ```sh
29
+ bun run build
30
+ ```
15
31
 
16
- ## Install
32
+ The build bundles `src/startup.ts` with esbuild into `dist/startup.js`, copies
33
+ it to `assets/startup.js` (commit this file), and mirrors it to
34
+ `../crust/ios/Resources/startup.js` (gitignored; the crust podspec reads it).
35
+ The `prepare` script runs the same build.
17
36
 
18
- Installed automatically alongside
19
- [`@glassly/engine`](https://www.npmjs.com/package/@glassly/engine) /
20
- `@glassly/crust`. For direct use:
37
+ ## Test
21
38
 
22
39
  ```sh
23
- npm install @glassly/jspolyfill@dev
40
+ bun run test
24
41
  ```
25
42
 
26
- > Currently published on the `dev` dist-tag (prerelease channel).
43
+ The suite (`src/startup.test.ts`) loads `dist/startup.js` into a Node `vm`
44
+ context, so run `bun run build` first. `bun run check` at the repo root runs
45
+ the suite when a branch changes this module, and it does not build first, so
46
+ build before you run it. Jest in `mobile/` ignores this module.
27
47
 
28
48
  ## Part of Glassly
29
49
 
30
- Source lives in the [Glassly monorepo](https://github.com/tetramo-labs/glassly)
31
- under `mobile/modules/jspolyfill`. Issues and contributions welcome there.
50
+ Source lives in the Glassly repository under `mobile/modules/jspolyfill`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glassly/jspolyfill",
3
- "version": "0.4.3-dev.1267",
3
+ "version": "0.4.3-dev.1268",
4
4
  "description": "JSRuntime polyfill bundle — installed into each per-miniapp JSContext (iOS-JSC, Android-QuickJS) at spawn time. Provides browser-like globals (console, timers, fetch, WebSocket, localStorage, crypto.subtle) over a single __dispatch native bridge, plus the __deliver / signalReady plumbing the host runtime relies on.",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",