@solidjs/web 2.0.0-rc.19 → 2.0.0-rc.20

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/web.dev.js CHANGED
@@ -1049,9 +1049,9 @@ function installHydrationRuntime() {
1049
1049
  return initial;
1050
1050
  },
1051
1051
  reclaimRegion(current, parent, marker) {
1052
- if (!sharedConfig.hydrating || !current || !parent.isConnected) return current;
1052
+ if (!sharedConfig.hydrating || current == null || !parent.isConnected) return current;
1053
1053
  const first = Array.isArray(current) ? current[0] : current;
1054
- if (!first || !first.nodeType || first.isConnected) return current;
1054
+ if (first == null || first.isConnected) return current;
1055
1055
  let nodes;
1056
1056
  if (marker) {
1057
1057
  nodes = [];
package/dist/web.js CHANGED
@@ -821,9 +821,9 @@ function installHydrationRuntime() {
821
821
  return initial;
822
822
  },
823
823
  reclaimRegion(current, parent, marker) {
824
- if (!sharedConfig.hydrating || !current || !parent.isConnected) return current;
824
+ if (!sharedConfig.hydrating || current == null || !parent.isConnected) return current;
825
825
  const first = Array.isArray(current) ? current[0] : current;
826
- if (!first || !first.nodeType || first.isConnected) return current;
826
+ if (first == null || first.isConnected) return current;
827
827
  let nodes;
828
828
  if (marker) {
829
829
  nodes = [];
@@ -867,9 +867,9 @@ function installHydrationRuntime() {
867
867
  return initial;
868
868
  },
869
869
  reclaimRegion(current, parent, marker) {
870
- if (!sharedConfig.hydrating || !current || !parent.isConnected) return current;
870
+ if (!sharedConfig.hydrating || current == null || !parent.isConnected) return current;
871
871
  const first = Array.isArray(current) ? current[0] : current;
872
- if (!first || !first.nodeType || first.isConnected) return current;
872
+ if (first == null || first.isConnected) return current;
873
873
  let nodes;
874
874
  if (marker) {
875
875
  nodes = [];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@solidjs/web",
3
3
  "description": "Solid's web runtime: client rendering, hydration, SSR, and DOM-specific control flow (Portal, Dynamic).",
4
- "version": "2.0.0-rc.19",
4
+ "version": "2.0.0-rc.20",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -367,6 +367,8 @@
367
367
  "test": "vitest run && vitest run --config vite.config.server.mjs && vitest run --config vite.config.hydrate.mjs",
368
368
  "test:server": "vitest run --config vite.config.server.mjs",
369
369
  "consistency:fuzz": "CONSISTENCY_FUZZ=1 vitest run --config vite.config.hydrate.mjs test/consistency/harness",
370
+ "async-gen": "ASYNC_GEN=1 vitest run test/async-gen",
371
+ "async-gen:hydrate": "ASYNC_GEN_HY=1 vitest run --config vite.config.server.mjs test/server/async-gen.gen.spec.tsx && ASYNC_GEN_HY=1 vitest run --config vite.config.hydrate.mjs test/consistency/async-gen",
370
372
  "coverage": "vitest run --coverage",
371
373
  "bench": "vitest bench --run",
372
374
  "bench:server": "vitest bench --run --config vite.config.server-bench.mjs",
@@ -377,7 +379,7 @@
377
379
  "seroval-plugins": "1.7.0"
378
380
  },
379
381
  "peerDependencies": {
380
- "solid-js": "^2.0.0-rc.19"
382
+ "solid-js": "^2.0.0-rc.20"
381
383
  },
382
384
  "devDependencies": {
383
385
  "@codspeed/vitest-plugin": "^5.4.0",
@@ -1459,20 +1459,25 @@ function scopeDeferredResult(value, scope) {
1459
1459
  return scopeDeferredContents(value, scope);
1460
1460
  }
1461
1461
  class ScopeFrame {
1462
- constructor(value, next, keys, descriptors) {
1462
+ constructor(value, prototype, keys, descriptors) {
1463
1463
  this.value = value;
1464
- this.next = next;
1464
+ this.prototype = prototype;
1465
+ this.next = null;
1465
1466
  this.keys = keys;
1466
1467
  this.descriptors = descriptors;
1467
1468
  this.i = 0;
1468
1469
  this.changed = false;
1469
1470
  }
1470
1471
  }
1472
+ function frameShell(frame) {
1473
+ return frame.next ??= frame.keys ? Object.create(frame.prototype, frame.descriptors) : frame.value.slice();
1474
+ }
1471
1475
  function enterScopeCarrier(value, state) {
1472
1476
  if (value === null || typeof value !== "object" && typeof value !== "function") return value;
1473
1477
  if (state.seen.has(value)) {
1474
1478
  state.cyclic.add(value);
1475
- return state.seen.get(value);
1479
+ const seen = state.seen.get(value);
1480
+ return seen instanceof ScopeFrame ? frameShell(seen) : seen;
1476
1481
  }
1477
1482
  const bound = bindDeferredBody(value, state.scope);
1478
1483
  if (bound !== value) {
@@ -1485,19 +1490,18 @@ function enterScopeCarrier(value, state) {
1485
1490
  state.seen.set(value, value);
1486
1491
  return value;
1487
1492
  }
1488
- const next = value.slice();
1489
- state.seen.set(value, next);
1490
- return new ScopeFrame(value, next, null, null);
1493
+ const frame = new ScopeFrame(value, null, null, null);
1494
+ state.seen.set(value, frame);
1495
+ return frame;
1491
1496
  }
1492
1497
  const prototype = Object.getPrototypeOf(value);
1493
1498
  if (prototype !== Object.prototype && prototype !== null || Object.isFrozen(value)) {
1494
1499
  state.seen.set(value, value);
1495
1500
  return value;
1496
1501
  }
1497
- const descriptors = Object.getOwnPropertyDescriptors(value);
1498
- const next = Object.create(prototype, descriptors);
1499
- state.seen.set(value, next);
1500
- return new ScopeFrame(value, next, Object.keys(value), descriptors);
1502
+ const frame = new ScopeFrame(value, prototype, Object.keys(value), Object.getOwnPropertyDescriptors(value));
1503
+ state.seen.set(value, frame);
1504
+ return frame;
1501
1505
  }
1502
1506
  function scopeDeferredContents(root, scope) {
1503
1507
  const state = {
@@ -1540,7 +1544,7 @@ function scopeDeferredContents(root, scope) {
1540
1544
  }
1541
1545
  }
1542
1546
  if (bound !== original) {
1543
- if (top.keys) top.next[top.keys[i]] = bound;else top.next[i] = bound;
1547
+ if (top.keys) frameShell(top)[top.keys[i]] = bound;else frameShell(top)[i] = bound;
1544
1548
  top.changed = true;
1545
1549
  }
1546
1550
  top.i++;
@@ -1552,7 +1556,8 @@ function scopeDeferredContents(root, scope) {
1552
1556
  stack.pop();
1553
1557
  let out;
1554
1558
  if (top.changed || state.cyclic.has(top.value)) {
1555
- out = top.next;
1559
+ out = frameShell(top);
1560
+ state.seen.set(top.value, out);
1556
1561
  } else {
1557
1562
  state.seen.set(top.value, top.value);
1558
1563
  out = top.value;
@@ -1377,20 +1377,25 @@ function scopeDeferredResult(value, scope) {
1377
1377
  return scopeDeferredContents(value, scope);
1378
1378
  }
1379
1379
  class ScopeFrame {
1380
- constructor(value, next, keys, descriptors) {
1380
+ constructor(value, prototype, keys, descriptors) {
1381
1381
  this.value = value;
1382
- this.next = next;
1382
+ this.prototype = prototype;
1383
+ this.next = null;
1383
1384
  this.keys = keys;
1384
1385
  this.descriptors = descriptors;
1385
1386
  this.i = 0;
1386
1387
  this.changed = false;
1387
1388
  }
1388
1389
  }
1390
+ function frameShell(frame) {
1391
+ return frame.next ??= frame.keys ? Object.create(frame.prototype, frame.descriptors) : frame.value.slice();
1392
+ }
1389
1393
  function enterScopeCarrier(value, state) {
1390
1394
  if (value === null || typeof value !== "object" && typeof value !== "function") return value;
1391
1395
  if (state.seen.has(value)) {
1392
1396
  state.cyclic.add(value);
1393
- return state.seen.get(value);
1397
+ const seen = state.seen.get(value);
1398
+ return seen instanceof ScopeFrame ? frameShell(seen) : seen;
1394
1399
  }
1395
1400
  const bound = bindDeferredBody(value, state.scope);
1396
1401
  if (bound !== value) {
@@ -1403,19 +1408,18 @@ function enterScopeCarrier(value, state) {
1403
1408
  state.seen.set(value, value);
1404
1409
  return value;
1405
1410
  }
1406
- const next = value.slice();
1407
- state.seen.set(value, next);
1408
- return new ScopeFrame(value, next, null, null);
1411
+ const frame = new ScopeFrame(value, null, null, null);
1412
+ state.seen.set(value, frame);
1413
+ return frame;
1409
1414
  }
1410
1415
  const prototype = Object.getPrototypeOf(value);
1411
1416
  if (prototype !== Object.prototype && prototype !== null || Object.isFrozen(value)) {
1412
1417
  state.seen.set(value, value);
1413
1418
  return value;
1414
1419
  }
1415
- const descriptors = Object.getOwnPropertyDescriptors(value);
1416
- const next = Object.create(prototype, descriptors);
1417
- state.seen.set(value, next);
1418
- return new ScopeFrame(value, next, Object.keys(value), descriptors);
1420
+ const frame = new ScopeFrame(value, prototype, Object.keys(value), Object.getOwnPropertyDescriptors(value));
1421
+ state.seen.set(value, frame);
1422
+ return frame;
1419
1423
  }
1420
1424
  function scopeDeferredContents(root, scope) {
1421
1425
  const state = {
@@ -1458,7 +1462,7 @@ function scopeDeferredContents(root, scope) {
1458
1462
  }
1459
1463
  }
1460
1464
  if (bound !== original) {
1461
- if (top.keys) top.next[top.keys[i]] = bound;else top.next[i] = bound;
1465
+ if (top.keys) frameShell(top)[top.keys[i]] = bound;else frameShell(top)[i] = bound;
1462
1466
  top.changed = true;
1463
1467
  }
1464
1468
  top.i++;
@@ -1470,7 +1474,8 @@ function scopeDeferredContents(root, scope) {
1470
1474
  stack.pop();
1471
1475
  let out;
1472
1476
  if (top.changed || state.cyclic.has(top.value)) {
1473
- out = top.next;
1477
+ out = frameShell(top);
1478
+ state.seen.set(top.value, out);
1474
1479
  } else {
1475
1480
  state.seen.set(top.value, top.value);
1476
1481
  out = top.value;
@@ -1429,20 +1429,25 @@ function scopeDeferredResult(value, scope) {
1429
1429
  return scopeDeferredContents(value, scope);
1430
1430
  }
1431
1431
  class ScopeFrame {
1432
- constructor(value, next, keys, descriptors) {
1432
+ constructor(value, prototype, keys, descriptors) {
1433
1433
  this.value = value;
1434
- this.next = next;
1434
+ this.prototype = prototype;
1435
+ this.next = null;
1435
1436
  this.keys = keys;
1436
1437
  this.descriptors = descriptors;
1437
1438
  this.i = 0;
1438
1439
  this.changed = false;
1439
1440
  }
1440
1441
  }
1442
+ function frameShell(frame) {
1443
+ return frame.next ??= frame.keys ? Object.create(frame.prototype, frame.descriptors) : frame.value.slice();
1444
+ }
1441
1445
  function enterScopeCarrier(value, state) {
1442
1446
  if (value === null || typeof value !== "object" && typeof value !== "function") return value;
1443
1447
  if (state.seen.has(value)) {
1444
1448
  state.cyclic.add(value);
1445
- return state.seen.get(value);
1449
+ const seen = state.seen.get(value);
1450
+ return seen instanceof ScopeFrame ? frameShell(seen) : seen;
1446
1451
  }
1447
1452
  const bound = bindDeferredBody(value, state.scope);
1448
1453
  if (bound !== value) {
@@ -1455,19 +1460,18 @@ function enterScopeCarrier(value, state) {
1455
1460
  state.seen.set(value, value);
1456
1461
  return value;
1457
1462
  }
1458
- const next = value.slice();
1459
- state.seen.set(value, next);
1460
- return new ScopeFrame(value, next, null, null);
1463
+ const frame = new ScopeFrame(value, null, null, null);
1464
+ state.seen.set(value, frame);
1465
+ return frame;
1461
1466
  }
1462
1467
  const prototype = Object.getPrototypeOf(value);
1463
1468
  if (prototype !== Object.prototype && prototype !== null || Object.isFrozen(value)) {
1464
1469
  state.seen.set(value, value);
1465
1470
  return value;
1466
1471
  }
1467
- const descriptors = Object.getOwnPropertyDescriptors(value);
1468
- const next = Object.create(prototype, descriptors);
1469
- state.seen.set(value, next);
1470
- return new ScopeFrame(value, next, Object.keys(value), descriptors);
1472
+ const frame = new ScopeFrame(value, prototype, Object.keys(value), Object.getOwnPropertyDescriptors(value));
1473
+ state.seen.set(value, frame);
1474
+ return frame;
1471
1475
  }
1472
1476
  function scopeDeferredContents(root, scope) {
1473
1477
  const state = {
@@ -1510,7 +1514,7 @@ function scopeDeferredContents(root, scope) {
1510
1514
  }
1511
1515
  }
1512
1516
  if (bound !== original) {
1513
- if (top.keys) top.next[top.keys[i]] = bound;else top.next[i] = bound;
1517
+ if (top.keys) frameShell(top)[top.keys[i]] = bound;else frameShell(top)[i] = bound;
1514
1518
  top.changed = true;
1515
1519
  }
1516
1520
  top.i++;
@@ -1522,7 +1526,8 @@ function scopeDeferredContents(root, scope) {
1522
1526
  stack.pop();
1523
1527
  let out;
1524
1528
  if (top.changed || state.cyclic.has(top.value)) {
1525
- out = top.next;
1529
+ out = frameShell(top);
1530
+ state.seen.set(top.value, out);
1526
1531
  } else {
1527
1532
  state.seen.set(top.value, top.value);
1528
1533
  out = top.value;