@glassly/jspolyfill 0.3.5-dev.836 → 0.3.5-dev.838

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/assets/startup.js CHANGED
@@ -254,9 +254,16 @@
254
254
  let env;
255
255
  try {
256
256
  env = JSON.parse(envelopeJson);
257
- } catch {
257
+ } catch (e) {
258
258
  try {
259
- __hostError(JSON.stringify({ message: "Bad __deliver envelope JSON", source: "__deliver" }));
259
+ const reason = e instanceof Error ? `${e.name}: ${e.message}` : String(e);
260
+ const length = typeof envelopeJson === "string" ? envelopeJson.length : -1;
261
+ __hostError(
262
+ JSON.stringify({
263
+ message: `Bad __deliver envelope JSON (${reason}; length=${length}, type=${typeof envelopeJson})`,
264
+ source: "__deliver"
265
+ })
266
+ );
260
267
  } catch {
261
268
  }
262
269
  return;
package/dist/startup.js CHANGED
@@ -254,9 +254,16 @@
254
254
  let env;
255
255
  try {
256
256
  env = JSON.parse(envelopeJson);
257
- } catch {
257
+ } catch (e) {
258
258
  try {
259
- __hostError(JSON.stringify({ message: "Bad __deliver envelope JSON", source: "__deliver" }));
259
+ const reason = e instanceof Error ? `${e.name}: ${e.message}` : String(e);
260
+ const length = typeof envelopeJson === "string" ? envelopeJson.length : -1;
261
+ __hostError(
262
+ JSON.stringify({
263
+ message: `Bad __deliver envelope JSON (${reason}; length=${length}, type=${typeof envelopeJson})`,
264
+ source: "__deliver"
265
+ })
266
+ );
260
267
  } catch {
261
268
  }
262
269
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glassly/jspolyfill",
3
- "version": "0.3.5-dev.836",
3
+ "version": "0.3.5-dev.838",
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",
package/src/startup.ts CHANGED
@@ -373,9 +373,18 @@ declare const __nativeClearTimer: (token: number) => void
373
373
  }
374
374
  try {
375
375
  env = JSON.parse(envelopeJson)
376
- } catch {
376
+ } catch (e) {
377
+ // Parse failures include QuickJS memory/stack errors, so name the error and
378
+ // the size: a syntax error and an InternalError need different fixes.
377
379
  try {
378
- __hostError(JSON.stringify({message: "Bad __deliver envelope JSON", source: "__deliver"}))
380
+ const reason = e instanceof Error ? `${e.name}: ${e.message}` : String(e)
381
+ const length = typeof envelopeJson === "string" ? envelopeJson.length : -1
382
+ __hostError(
383
+ JSON.stringify({
384
+ message: `Bad __deliver envelope JSON (${reason}; length=${length}, type=${typeof envelopeJson})`,
385
+ source: "__deliver",
386
+ }),
387
+ )
379
388
  } catch {
380
389
  /* ignore */
381
390
  }