dom-expressions 0.35.18 → 0.35.19

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dom-expressions",
3
3
  "description": "A Fine-Grained Runtime for Performant DOM Rendering",
4
- "version": "0.35.18",
4
+ "version": "0.35.19",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -23,8 +23,8 @@
23
23
  "csstype": "^3.0"
24
24
  },
25
25
  "devDependencies": {
26
- "babel-plugin-jsx-dom-expressions": "^0.35.18",
26
+ "babel-plugin-jsx-dom-expressions": "^0.35.19",
27
27
  "csstype": "^3.1"
28
28
  },
29
- "gitHead": "5e21b8cb58fbccc1f635bfdfd8904094e46edfea"
29
+ "gitHead": "cd607bb1bc035812f1b8bfae3c75d60c5c52143c"
30
30
  }
package/src/client.js CHANGED
@@ -357,7 +357,7 @@ function eventHandler(e) {
357
357
  if (sharedConfig.registry && !sharedConfig.done) {
358
358
  sharedConfig.done = true;
359
359
  document.querySelectorAll("[id^=pl-]").forEach(elem => {
360
- while(elem && elem.nodeType !== 8 && elem.nodeValue !== "pl-"+e) {
360
+ while (elem && elem.nodeType !== 8 && elem.nodeValue !== "pl-" + e) {
361
361
  let x = elem.nextSibling;
362
362
  elem.remove();
363
363
  elem = x;
@@ -477,7 +477,10 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
477
477
  } else {
478
478
  // NOTE: is String better than `item + ''`, ``${item}``, `item.toString()` and `item.valueOf()`?
479
479
  const value = String(item);
480
- if (prev && prev.nodeType === 3 && prev.data === value) {
480
+ if (value === "<!>") {
481
+ if (prev && prev.nodeType === 8) normalized.push(prev);
482
+ } else if (prev && prev.nodeType === 3) {
483
+ prev.data = value;
481
484
  normalized.push(prev);
482
485
  } else normalized.push(document.createTextNode(value));
483
486
  }
@@ -523,7 +526,7 @@ export function getHydrationKey() {
523
526
  }
524
527
 
525
528
  export function NoHydration(props) {
526
- return sharedConfig.context ? undefined : props.children
529
+ return sharedConfig.context ? undefined : props.children;
527
530
  }
528
531
 
529
532
  export function Hydration(props) {
package/src/server.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Aliases, BooleanAttributes, ChildProperties } from "./constants";
2
- import { sharedConfig } from "rxcore";
2
+ import { sharedConfig, root } from "rxcore";
3
3
  import stringify from "./serializer";
4
4
  export { stringify };
5
5
  export { createComponent } from "rxcore";
@@ -23,7 +23,11 @@ export function renderToString(code, options = {}) {
23
23
  scripts += `_$HY.set("${id}", ${stringify(p)});`;
24
24
  }
25
25
  };
26
- let html = resolveSSRNode(escape(code()));
26
+ let html = root((d) => {
27
+ resolveSSRNode(escape(code()))
28
+ d();
29
+ return r;
30
+ });
27
31
  sharedConfig.context.noHydrate = true;
28
32
  html = injectAssets(sharedConfig.context.assets, html);
29
33
  if (scripts.length) html = injectScripts(html, scripts, options.nonce);
@@ -44,6 +48,7 @@ export function renderToStringAsync(code, options = {}) {
44
48
 
45
49
  export function renderToStream(code, options = {}) {
46
50
  let { nonce, onCompleteShell, onCompleteAll, renderId } = options;
51
+ let dispose;
47
52
  const blockingResources = [];
48
53
  const registry = new Map();
49
54
  const dedupe = new WeakMap();
@@ -58,6 +63,7 @@ export function renderToStream(code, options = {}) {
58
63
  });
59
64
  writable && writable.end();
60
65
  completed = true;
66
+ dispose();
61
67
  }
62
68
  };
63
69
  const pushTask = task => {
@@ -160,7 +166,10 @@ export function renderToStream(code, options = {}) {
160
166
  }
161
167
  };
162
168
 
163
- let html = resolveSSRNode(escape(code()));
169
+ let html = root((d) => {
170
+ dispose = d;
171
+ return resolveSSRNode(escape(code()))
172
+ });
164
173
  function doShell() {
165
174
  sharedConfig.context = context;
166
175
  context.noHydrate = true;