@barefootjs/router 0.30.6 → 0.31.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
@@ -372,7 +372,7 @@ function regionHasIslands(region) {
372
372
  function warnIfIslandsUnreachable(region, op) {
373
373
  if (!regionHasIslands(region))
374
374
  return;
375
- console.error(`[barefootjs/router] could not load @barefootjs/client/runtime to ${op} a region that contains islands. ` + `The swapped content may leak handlers or not be interactive — ensure the runtime is served and mapped in the page's import map.`);
375
+ console.error(`[barefootjs/router] could not load @barefootjs/client/runtime to ${op} a region that contains islands. ` + `The swapped content may leak handlers or not be interactive — call setupStreaming() from ` + `@barefootjs/client/runtime in your client entry, before startRouter().`);
376
376
  }
377
377
  function hardNavigate(url) {
378
378
  window.location.assign(url);
@@ -1 +1 @@
1
- {"version":3,"file":"seams.d.ts","sourceRoot":"","sources":["../src/seams.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA8BH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAMtD;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BrE;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBnE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAMzD;AAUD,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE9C"}
1
+ {"version":3,"file":"seams.d.ts","sourceRoot":"","sources":["../src/seams.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA8BH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAMtD;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCrE;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBnE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAMzD;AAWD,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE9C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/router",
3
- "version": "0.30.6",
3
+ "version": "0.31.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.30.6"
43
+ "@barefootjs/shared": "0.31.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.30.6",
54
+ "@barefootjs/client": "^0.31.0",
55
55
  "@happy-dom/global-registrator": "^20.0.11",
56
56
  "typescript": "^5.0.0"
57
57
  }
package/src/seams.ts CHANGED
@@ -65,8 +65,13 @@ export async function defaultRehydrate(region: Element): Promise<void> {
65
65
  return
66
66
  }
67
67
  // Fall back to the runtime's named exports. The specifier is a *variable* so
68
- // bundlers can't statically resolve (and thus bundle) the optional peer; the
69
- // browser resolves the bare specifier through the page's import map.
68
+ // bundlers can't statically resolve (and thus bundle) the optional peer
69
+ // that is what keeps `@barefootjs/client` optional for a static-shell site.
70
+ // The flip side is that this bare specifier reaches the browser unresolved,
71
+ // so it only loads on a page that maps it (a hand-written import map, or an
72
+ // app that marks the runtime external). Under Vite nothing maps it, and
73
+ // nothing needs to: `setupStreaming()` installs the seams above, which this
74
+ // never gets past. This branch exists for the page that skipped that call.
70
75
  try {
71
76
  const spec = '@barefootjs/client/runtime'
72
77
  const mod = (await import(spec)) as {
@@ -120,7 +125,8 @@ function warnIfIslandsUnreachable(region: Element, op: 'dispose' | 're-hydrate')
120
125
  if (!regionHasIslands(region)) return
121
126
  console.error(
122
127
  `[barefootjs/router] could not load @barefootjs/client/runtime to ${op} a region that contains islands. ` +
123
- `The swapped content may leak handlers or not be interactive — ensure the runtime is served and mapped in the page's import map.`,
128
+ `The swapped content may leak handlers or not be interactive — call setupStreaming() from ` +
129
+ `@barefootjs/client/runtime in your client entry, before startRouter().`,
124
130
  )
125
131
  }
126
132