@swmansion/popcorn 0.3.0 → 0.3.1

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/dist/AtomVM.mjs CHANGED
@@ -56,7 +56,7 @@ if (ENVIRONMENT_IS_PTHREAD) {
56
56
 
57
57
  // --pre-jses are emitted after the Module integration code, so that they can
58
58
  // refer to Module (if they choose; they can also define Module)
59
- // include: /tmp/atomvm-build-swm.exmKJCn/atomvm/src/platforms/emscripten/src/atomvm.pre.js
59
+ // include: /tmp/atomvm-build-swm.ItwMw6B/atomvm/src/platforms/emscripten/src/atomvm.pre.js
60
60
  /*
61
61
  * This file is part of AtomVM.
62
62
  *
@@ -128,7 +128,7 @@ function ensureValidResult(result) {
128
128
  throw new Error(message);
129
129
  }
130
130
 
131
- // end include: /tmp/atomvm-build-swm.exmKJCn/atomvm/src/platforms/emscripten/src/atomvm.pre.js
131
+ // end include: /tmp/atomvm-build-swm.ItwMw6B/atomvm/src/platforms/emscripten/src/atomvm.pre.js
132
132
  var arguments_ = [];
133
133
 
134
134
  var thisProgram = "./this.program";
package/dist/AtomVM.wasm CHANGED
Binary file
package/dist/iframe.mjs CHANGED
@@ -193,8 +193,14 @@ function ensureResultKeyList(result) {
193
193
  throw new Error("Script passed to onRunTrackedJs() returned invalid value, accepted values are arrays and undefined");
194
194
  }
195
195
  }
196
- function deserialize(message) {
197
- return JSON.parse(message, (_key, value) => {
196
+ // `json` selects the realm whose JSON.parse builds the result. By default that
197
+ // is the iframe's own JSON, but run_js passes the parent window's JSON so the
198
+ // deserialized terms (arrays/objects) belong to the parent realm — otherwise
199
+ // cross-realm arrays sent out of the iframe fail `instanceof Array` checks in
200
+ // the parent (e.g. phoenix_live_view's diff renderer). Tracked `popcorn_ref`
201
+ // values are resolved by reference and keep their own realm regardless.
202
+ function deserialize(message, json = JSON) {
203
+ return json.parse(message, (_key, value) => {
198
204
  const isRef = typeof value === "object" &&
199
205
  value !== null &&
200
206
  Object.hasOwn(value, "popcorn_ref") &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/popcorn",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "JS bindings for Popcorn",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "@eslint/js": "^9.39.0",
59
- "@playwright/test": "^1.52.0",
59
+ "@playwright/test": "^1.60.0",
60
60
  "@rollup/plugin-typescript": "^12.1.2",
61
61
  "@types/node": "^25.0.8",
62
62
  "esbuild": "^0.25.0",