@barefootjs/router 0.19.1 → 0.21.0

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/index.js CHANGED
@@ -61,7 +61,7 @@ function loadPage(state, url) {
61
61
  }
62
62
 
63
63
  // src/region.ts
64
- import { BF_HOST, BF_PROPS, BF_REGION, BF_SCOPE, BF_SCOPE_COMMENT_PREFIX } from "@barefootjs/shared";
64
+ import { BF_HOST, BF_PROPS, BF_REGION, BF_SCOPE, BF_SCOPE_COMMENT_PREFIX, BF_SCOPE_COMMENT_END_PREFIX } from "@barefootjs/shared";
65
65
  function parseDocument(html) {
66
66
  return new DOMParser().parseFromString(html, "text/html");
67
67
  }
@@ -115,6 +115,8 @@ function stripVolatileHydration(root) {
115
115
  normalizePropsAttr(node);
116
116
  } else if (node.data.startsWith(BF_SCOPE_COMMENT_PREFIX)) {
117
117
  node.data = normalizeScopeComment(node.data);
118
+ } else if (node.data.startsWith(BF_SCOPE_COMMENT_END_PREFIX)) {
119
+ node.data = BF_SCOPE_COMMENT_END_PREFIX;
118
120
  }
119
121
  }
120
122
  }
@@ -1 +1 @@
1
- {"version":3,"file":"region.d.ts","sourceRoot":"","sources":["../src/region.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAEpD;AAGD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAcnF;AAED,oFAAoF;AACpF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,MAAM,QAAQ;AAClB;;;;;GAKG;AACD;IAAE,IAAI,EAAE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ACrC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,GAAG,IAAI,CAIjB;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBtF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/router",
3
- "version": "0.19.1",
3
+ "version": "0.21.0",
4
4
  "description": "Backend-agnostic partial-navigation client router for BarefootJS — swaps only the page region and re-hydrates the islands inside it",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "directory": "packages/router"
41
41
  },
42
42
  "dependencies": {
43
- "@barefootjs/shared": "0.19.1"
43
+ "@barefootjs/shared": "0.21.0"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@barefootjs/client": ">=0.14.0"
@@ -51,7 +51,7 @@
51
51
  }
52
52
  },
53
53
  "devDependencies": {
54
- "@barefootjs/client": "^0.19.1",
54
+ "@barefootjs/client": "^0.21.0",
55
55
  "@happy-dom/global-registrator": "^20.0.11",
56
56
  "typescript": "^5.0.0"
57
57
  }
package/src/region.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * region, so they are collected from the whole parsed document.
11
11
  */
12
12
 
13
- import { BF_HOST, BF_PROPS, BF_REGION, BF_SCOPE, BF_SCOPE_COMMENT_PREFIX } from '@barefootjs/shared'
13
+ import { BF_HOST, BF_PROPS, BF_REGION, BF_SCOPE, BF_SCOPE_COMMENT_PREFIX, BF_SCOPE_COMMENT_END_PREFIX } from '@barefootjs/shared'
14
14
  import type { RouterState } from './types.ts'
15
15
 
16
16
  /** Parse a fetched page's HTML into a detached document. */
@@ -123,6 +123,10 @@ function stripVolatileHydration(root: Element): void {
123
123
  normalizePropsAttr(node as Element)
124
124
  } else if ((node as Comment).data.startsWith(BF_SCOPE_COMMENT_PREFIX)) {
125
125
  ;(node as Comment).data = normalizeScopeComment((node as Comment).data)
126
+ } else if ((node as Comment).data.startsWith(BF_SCOPE_COMMENT_END_PREFIX)) {
127
+ // End markers carry only the per-render-random scope id — blank it
128
+ // whole so paired begin/end comments normalize consistently.
129
+ ;(node as Comment).data = BF_SCOPE_COMMENT_END_PREFIX
126
130
  }
127
131
  }
128
132
  }