reroute-js 0.43.0 → 0.43.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/cli/bin.d.ts +1 -1
- package/cli/bin.js +19 -27
- package/cli/bin.js.map +4 -4
- package/cli/index.d.ts +1 -1
- package/cli/index.js +4 -4
- package/cli/index.js.map +1 -1
- package/cli/src/cli.d.ts +1 -1
- package/cli/src/commands/analyze.d.ts +1 -1
- package/cli/src/commands/build.d.ts +1 -1
- package/cli/src/commands/dev.d.ts +1 -1
- package/cli/src/commands/gen.d.ts +1 -1
- package/cli/src/commands/gen.d.ts.map +1 -1
- package/cli/src/commands/index.d.ts +1 -1
- package/cli/src/commands/init.d.ts +1 -1
- package/cli/src/commands/lib/assets.d.ts +1 -1
- package/cli/src/commands/lib/bundler.d.ts +1 -1
- package/cli/src/commands/lib/command.d.ts +1 -1
- package/cli/src/commands/lib/env.d.ts +1 -1
- package/cli/src/commands/lib/index.d.ts +1 -1
- package/cli/src/commands/lib/log.d.ts +1 -1
- package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
- package/cli/src/commands/lib/markdown/index.d.ts +1 -1
- package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
- package/cli/src/commands/lib/production.d.ts +1 -1
- package/cli/src/commands/lib/server.d.ts +1 -1
- package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
- package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
- package/cli/src/commands/lib/streaming/suspense.d.ts.map +1 -1
- package/cli/src/commands/lib/tailwind.d.ts +1 -1
- package/cli/src/commands/lib/terminal-ui.d.ts +1 -1
- package/cli/src/commands/lib/version.d.ts +1 -1
- package/cli/src/commands/og.d.ts +1 -1
- package/cli/src/commands/start.d.ts +1 -1
- package/cli/src/index.d.ts +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +2 -2
- package/core/index.js.map +1 -1
- package/core/src/bundler/hash.d.ts +1 -1
- package/core/src/bundler/index.d.ts +1 -1
- package/core/src/config.d.ts +1 -1
- package/core/src/content/discovery.d.ts +1 -1
- package/core/src/content/index.d.ts +1 -1
- package/core/src/content/metadata.d.ts +1 -1
- package/core/src/index.d.ts +1 -1
- package/core/src/llms/extractor.d.ts +1 -1
- package/core/src/llms/formatter.d.ts +1 -1
- package/core/src/llms/full-generator.d.ts +1 -1
- package/core/src/llms/index-generator.d.ts +1 -1
- package/core/src/llms/index.d.ts +1 -1
- package/core/src/og/discovery.d.ts +1 -1
- package/core/src/og/index.d.ts +1 -1
- package/core/src/og/meta.d.ts +1 -1
- package/core/src/og/render.d.ts +1 -1
- package/core/src/og/types.d.ts +1 -1
- package/core/src/robots/discovery.d.ts +1 -1
- package/core/src/robots/generator.d.ts +1 -1
- package/core/src/robots/index.d.ts +1 -1
- package/core/src/robots/policies.d.ts +1 -1
- package/core/src/rss/discovery.d.ts +1 -1
- package/core/src/rss/generator.d.ts +1 -1
- package/core/src/rss/index.d.ts +1 -1
- package/core/src/sitemap/discovery.d.ts +1 -1
- package/core/src/sitemap/generator.d.ts +1 -1
- package/core/src/sitemap/index.d.ts +1 -1
- package/core/src/ssr/index.d.ts +1 -1
- package/core/src/ssr/lib/cache.d.ts +1 -1
- package/core/src/ssr/lib/collections.d.ts +1 -1
- package/core/src/ssr/lib/compression.d.ts +1 -1
- package/core/src/ssr/lib/compute/content.d.ts +1 -1
- package/core/src/ssr/lib/compute/index.d.ts +1 -1
- package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
- package/core/src/ssr/lib/compute/routes.d.ts +1 -1
- package/core/src/ssr/lib/data.d.ts +1 -1
- package/core/src/ssr/lib/html.d.ts +1 -1
- package/core/src/ssr/lib/imports.d.ts +1 -1
- package/core/src/ssr/lib/index.d.ts +1 -1
- package/core/src/ssr/lib/layouts.d.ts +1 -1
- package/core/src/ssr/lib/metadata.d.ts +1 -1
- package/core/src/ssr/lib/mime.d.ts +1 -1
- package/core/src/ssr/lib/modules.d.ts +1 -1
- package/core/src/ssr/lib/path.d.ts +1 -1
- package/core/src/ssr/lib/preload.d.ts +1 -1
- package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
- package/core/src/ssr/lib/scripts/data.d.ts +1 -1
- package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
- package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
- package/core/src/ssr/lib/scripts/index.d.ts +1 -1
- package/core/src/ssr/lib/seed.d.ts +1 -1
- package/core/src/ssr/lib/serialize.d.ts +1 -1
- package/core/src/ssr/lib/setup.d.ts +1 -1
- package/core/src/ssr/lib/styles.d.ts +1 -1
- package/core/src/ssr/lib/template.d.ts +1 -1
- package/core/src/ssr/lib/types.d.ts +1 -1
- package/core/src/ssr/render.d.ts +1 -1
- package/core/src/ssr/stream.d.ts +1 -1
- package/elysia/index.d.ts +1 -1
- package/elysia/index.js +63 -31
- package/elysia/index.js.map +5 -5
- package/elysia/src/index.d.ts +1 -1
- package/elysia/src/libs/assets.d.ts +1 -1
- package/elysia/src/libs/cache.d.ts +1 -1
- package/elysia/src/libs/caching.d.ts +1 -1
- package/elysia/src/libs/http.d.ts +1 -1
- package/elysia/src/libs/image.d.ts +1 -1
- package/elysia/src/libs/index.d.ts +1 -1
- package/elysia/src/libs/llms.d.ts +1 -1
- package/elysia/src/libs/response.d.ts +1 -1
- package/elysia/src/libs/serving.d.ts +1 -1
- package/elysia/src/plugin.d.ts +1 -1
- package/elysia/src/routes/artifacts.d.ts +1 -1
- package/elysia/src/routes/artifacts.d.ts.map +1 -1
- package/elysia/src/routes/content.d.ts +1 -1
- package/elysia/src/routes/image.d.ts +1 -1
- package/elysia/src/routes/index.d.ts +1 -1
- package/elysia/src/routes/internal.d.ts +2 -2
- package/elysia/src/routes/internal.d.ts.map +1 -1
- package/elysia/src/routes/llms.d.ts +1 -1
- package/elysia/src/routes/og.d.ts +1 -1
- package/elysia/src/routes/og.d.ts.map +1 -1
- package/elysia/src/routes/redirects.d.ts +1 -1
- package/elysia/src/routes/robots.d.ts +1 -1
- package/elysia/src/routes/rss.d.ts +1 -1
- package/elysia/src/routes/search.d.ts +1 -1
- package/elysia/src/routes/sitemap.d.ts +1 -1
- package/elysia/src/routes/ssr.d.ts +1 -1
- package/elysia/src/routes/static.d.ts +1 -1
- package/elysia/src/types.d.ts +1 -1
- package/package.json +1 -1
- package/react/index.d.ts +1 -1
- package/react/index.js +60 -17
- package/react/index.js.map +6 -6
- package/react/src/components/ClientOnly.d.ts +1 -1
- package/react/src/components/ContentRoute.d.ts +1 -1
- package/react/src/components/Image.d.ts +1 -1
- package/react/src/components/LazyRoute.d.ts +1 -1
- package/react/src/components/Link.d.ts +3 -3
- package/react/src/components/Link.d.ts.map +1 -1
- package/react/src/components/Markdown.d.ts +1 -1
- package/react/src/components/Outlet.d.ts +1 -1
- package/react/src/components/index.d.ts +1 -1
- package/react/src/hooks/index.d.ts +1 -1
- package/react/src/hooks/useContent.d.ts +1 -1
- package/react/src/hooks/useData.d.ts +1 -1
- package/react/src/hooks/useData.d.ts.map +1 -1
- package/react/src/hooks/useFeed.d.ts +1 -1
- package/react/src/hooks/useLayoutData.d.ts +1 -1
- package/react/src/hooks/useLayoutData.d.ts.map +1 -1
- package/react/src/hooks/useLlms.d.ts +1 -1
- package/react/src/hooks/useNavigate.d.ts +1 -1
- package/react/src/hooks/useParams.d.ts +1 -1
- package/react/src/hooks/useRouter.d.ts +1 -1
- package/react/src/hooks/useSearch.d.ts +1 -1
- package/react/src/hooks/useSearchParams.d.ts +1 -1
- package/react/src/hooks/useToc.d.ts +1 -1
- package/react/src/index.d.ts +1 -1
- package/react/src/lib/collection.d.ts +1 -1
- package/react/src/lib/content.d.ts +1 -1
- package/react/src/lib/head.d.ts +1 -1
- package/react/src/lib/index.d.ts +1 -1
- package/react/src/lib/lazy-route.d.ts +1 -1
- package/react/src/lib/route-loader.d.ts +1 -1
- package/react/src/providers/ContentProvider.d.ts +1 -1
- package/react/src/providers/RerouteProvider.d.ts +1 -1
- package/react/src/providers/RouterProvider.d.ts +1 -1
- package/react/src/providers/RouterProvider.d.ts.map +1 -1
- package/react/src/providers/index.d.ts +1 -1
- package/react/src/types/any.d.ts +1 -1
- package/react/src/types/index.d.ts +1 -1
- package/react/src/types/router.d.ts +1 -1
- package/telemetry/react.d.ts +1 -1
- package/telemetry/react.js +2 -2
- package/telemetry/react.js.map +1 -1
- package/telemetry/server.d.ts +1 -1
- package/telemetry/server.js +2 -2
- package/telemetry/server.js.map +1 -1
- package/telemetry/src/react/api.d.ts +1 -1
- package/telemetry/src/react/context.d.ts +1 -1
- package/telemetry/src/react/index.d.ts +1 -1
- package/telemetry/src/react/telemetry.d.ts +1 -1
- package/telemetry/src/server/context.d.ts +1 -1
- package/telemetry/src/server/headers/extractor.d.ts +1 -1
- package/telemetry/src/server/headers/index.d.ts +1 -1
- package/telemetry/src/server/headers/presets.d.ts +1 -1
- package/telemetry/src/server/index.d.ts +1 -1
- package/telemetry/src/server/instrumentation.d.ts +1 -1
- package/telemetry/src/server/plugin.d.ts +1 -1
- package/telemetry/src/server/sourcemap.d.ts +1 -1
package/elysia/src/index.d.ts
CHANGED
package/elysia/src/plugin.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/routes/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAQ,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGtD,KAAK,gBAAgB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,OAAO,EAAE,gBAAgB,GACvB,MAAM,
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/routes/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAQ,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGtD,KAAK,gBAAgB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,OAAO,EAAE,gBAAgB,GACvB,MAAM,CA4FR"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* reroute-js v0.43.
|
|
2
|
+
* reroute-js v0.43.1
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 stewones <hi@stewan.io>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Built with Bun <3
|
|
9
9
|
*/
|
|
10
10
|
import type { Elysia } from 'elysia';
|
|
11
|
-
import {
|
|
11
|
+
import type { LRUCache } from 'reroute-js/core';
|
|
12
12
|
type InternalRouteOptions = {
|
|
13
13
|
clientDir: string;
|
|
14
14
|
cwd: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/routes/internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/routes/internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAIhD,KAAK,oBAAoB,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAmBF;;;;GAIG;AACH,wBAAgB,sBAAsB,CACrC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,oBAAoB,GACxB,MAAM,CA8OR;AAED;;GAEG;AACH,KAAK,eAAe,GAAG;IACtB,OAAO,EAAE,GAAG,CAAC,+BAA+B,CAAC,CAAC;IAC9C,aAAa,EAAE,OAAO,CAAC;CACvB,CAAC;AAuKF;;GAEG;AACH,wBAAgB,wBAAwB,CACvC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,eAAe,GACpB,MAAM,CA2DR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"og.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/routes/og.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAIN,KAAK,QAAQ,EAGb,KAAK,cAAc,EAEnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,gBAAgB,EAAc,MAAM,iBAAiB,CAAC;AAGpE,KAAK,cAAc,GAAG;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC5C,CAAC;AAmUF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"og.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/routes/og.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAIN,KAAK,QAAQ,EAGb,KAAK,cAAc,EAEnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,gBAAgB,EAAc,MAAM,iBAAiB,CAAC;AAGpE,KAAK,cAAc,GAAG;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC5C,CAAC;AAmUF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,CA6O7E"}
|
package/elysia/src/types.d.ts
CHANGED
package/package.json
CHANGED
package/react/index.d.ts
CHANGED
package/react/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* reroute-js v0.43.
|
|
2
|
+
* reroute-js v0.43.1
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 stewones <hi@stewan.io>
|
|
@@ -1277,6 +1277,9 @@ function RouterProvider({
|
|
|
1277
1277
|
useEffect4(() => {
|
|
1278
1278
|
setViewTransitionsEnabled(viewTransitions);
|
|
1279
1279
|
setScrollRestorationEnabled(scrollRestoration);
|
|
1280
|
+
if (isBrowser2 && "scrollRestoration" in window.history) {
|
|
1281
|
+
window.history.scrollRestoration = "manual";
|
|
1282
|
+
}
|
|
1280
1283
|
}, [viewTransitions, scrollRestoration]);
|
|
1281
1284
|
const serverSnapshotRef = React.useRef(null);
|
|
1282
1285
|
if (!serverSnapshotRef.current) {
|
|
@@ -1712,9 +1715,8 @@ function useData(key) {
|
|
|
1712
1715
|
if (pending[pathToFetch]) {
|
|
1713
1716
|
return;
|
|
1714
1717
|
}
|
|
1715
|
-
pending[pathToFetch] = true;
|
|
1716
1718
|
const fetchPath = pathToFetch === pathname ? pathname : pathToFetch;
|
|
1717
|
-
fetch(`/__reroute_data?path=${encodeURIComponent(fetchPath)}`, {
|
|
1719
|
+
const fetchPromise = fetch(`/__reroute_data?path=${encodeURIComponent(fetchPath)}`, {
|
|
1718
1720
|
headers: { Accept: "application/json" },
|
|
1719
1721
|
credentials: "same-origin"
|
|
1720
1722
|
}).then((r) => r.ok ? r.json() : null).then((j) => {
|
|
@@ -1725,6 +1727,7 @@ function useData(key) {
|
|
|
1725
1727
|
const keys = [];
|
|
1726
1728
|
for (const [key2, value] of Object.entries(payload)) {
|
|
1727
1729
|
if (key2 !== "__reroute_multiple__") {
|
|
1730
|
+
console.log("[useData MUTATION 1] Setting", key2, "to", value, "payload is:", payload);
|
|
1728
1731
|
w.__REROUTE_DATA__[key2] = value;
|
|
1729
1732
|
keys.push(key2);
|
|
1730
1733
|
}
|
|
@@ -1738,11 +1741,13 @@ function useData(key) {
|
|
|
1738
1741
|
const keys = [];
|
|
1739
1742
|
for (const [key2, value] of Object.entries(payload)) {
|
|
1740
1743
|
if (key2 !== "__reroute_flattened__" && key2 !== "__flatten__") {
|
|
1744
|
+
console.log("[useData MUTATION 2] Setting", key2, "to", value);
|
|
1741
1745
|
w.__REROUTE_DATA__[key2] = value;
|
|
1742
1746
|
keys.push(key2);
|
|
1743
1747
|
}
|
|
1744
1748
|
}
|
|
1745
1749
|
if (isLikelyDataKey) {
|
|
1750
|
+
console.log("[useData MUTATION 3] Setting pathname", pathname, "to payload");
|
|
1746
1751
|
w.__REROUTE_DATA__[pathname] = payload;
|
|
1747
1752
|
}
|
|
1748
1753
|
try {
|
|
@@ -1757,6 +1762,7 @@ function useData(key) {
|
|
|
1757
1762
|
const keys = [];
|
|
1758
1763
|
for (const [key2, value] of Object.entries(payload)) {
|
|
1759
1764
|
if (key2.startsWith("__layout:")) {
|
|
1765
|
+
console.log("[useData MUTATION 4] Setting layout key", key2, "to", value);
|
|
1760
1766
|
w.__REROUTE_DATA__[key2] = value;
|
|
1761
1767
|
keys.push(key2);
|
|
1762
1768
|
}
|
|
@@ -1764,6 +1770,7 @@ function useData(key) {
|
|
|
1764
1770
|
if (!isLikelyDataKey && layoutKeys.length === Object.keys(payload).length) {
|
|
1765
1771
|
if (layoutKeys.length === 1) {
|
|
1766
1772
|
const layoutValue = payload[layoutKeys[0]];
|
|
1773
|
+
console.log("[useData MUTATION 5] Setting pathname", pathname, "to layoutValue", layoutValue, "payload:", payload);
|
|
1767
1774
|
w.__REROUTE_DATA__[pathname] = layoutValue;
|
|
1768
1775
|
keys.push(pathname);
|
|
1769
1776
|
} else {
|
|
@@ -1775,6 +1782,7 @@ function useData(key) {
|
|
|
1775
1782
|
}
|
|
1776
1783
|
}
|
|
1777
1784
|
if (Object.keys(mergedLayoutData).length > 0) {
|
|
1785
|
+
console.log("[useData MUTATION 6] Setting pathname", pathname, "to mergedLayoutData", mergedLayoutData);
|
|
1778
1786
|
w.__REROUTE_DATA__[pathname] = mergedLayoutData;
|
|
1779
1787
|
keys.push(pathname);
|
|
1780
1788
|
}
|
|
@@ -1789,6 +1797,7 @@ function useData(key) {
|
|
|
1789
1797
|
}
|
|
1790
1798
|
}
|
|
1791
1799
|
const targetKey = isLikelyDataKey ? pathToFetch : k;
|
|
1800
|
+
console.log("[useData MUTATION 7] Setting targetKey", targetKey, "to payload", payload, "k:", k, "pathToFetch:", pathToFetch);
|
|
1792
1801
|
w.__REROUTE_DATA__[targetKey] = payload;
|
|
1793
1802
|
try {
|
|
1794
1803
|
w.dispatchEvent(new CustomEvent("__reroute_data__", {
|
|
@@ -1804,12 +1813,38 @@ function useData(key) {
|
|
|
1804
1813
|
delete w.__REROUTE_DATA_PENDING__[pathToFetch];
|
|
1805
1814
|
} catch {}
|
|
1806
1815
|
});
|
|
1816
|
+
pending[pathToFetch] = fetchPromise;
|
|
1807
1817
|
} catch {}
|
|
1808
1818
|
}, [k, pathname]);
|
|
1809
1819
|
return useMemo5(() => {
|
|
1810
1820
|
try {
|
|
1811
1821
|
const source = typeof window === "undefined" ? globalThis.__REROUTE_DATA__ : window.__REROUTE_DATA__;
|
|
1812
1822
|
let value = source?.[k];
|
|
1823
|
+
if (value === undefined && typeof window !== "undefined") {
|
|
1824
|
+
const w = window;
|
|
1825
|
+
const pending = w.__REROUTE_DATA_PENDING__;
|
|
1826
|
+
const pendingPromise = pending?.[k] || pending?.[pathname];
|
|
1827
|
+
if (pendingPromise && typeof pendingPromise !== "boolean") {
|
|
1828
|
+
throw pendingPromise;
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
if (typeof value === "object" && value !== null && value === source) {
|
|
1832
|
+
if (typeof source === "object" && source !== null && k in source) {
|
|
1833
|
+
value = source[k];
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
if (typeof value === "object" && value !== null && typeof k === "string" && k.startsWith("/") && typeof source === "object" && source !== null) {
|
|
1837
|
+
const valueKeys = Object.keys(value);
|
|
1838
|
+
const hasLayoutKeys = valueKeys.some((key2) => key2.startsWith("__layout:"));
|
|
1839
|
+
const hasPathnameKey = k in value;
|
|
1840
|
+
if (hasLayoutKeys && hasPathnameKey) {
|
|
1841
|
+
console.warn("[useData] BUG DETECTED: value contains both layout and pathname keys, extracting pathname data for:", k);
|
|
1842
|
+
const extractedValue = value[k];
|
|
1843
|
+
if (extractedValue !== undefined) {
|
|
1844
|
+
value = extractedValue;
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1813
1848
|
if (typeof value === "object" && value !== null && typeof window !== "undefined") {
|
|
1814
1849
|
const keys = Object.keys(value);
|
|
1815
1850
|
const layoutKeys = keys.filter((key2) => key2.startsWith("__layout:"));
|
|
@@ -1880,7 +1915,7 @@ function useData(key) {
|
|
|
1880
1915
|
}
|
|
1881
1916
|
return;
|
|
1882
1917
|
}
|
|
1883
|
-
}, [k, _tick]);
|
|
1918
|
+
}, [k, _tick, pathname]);
|
|
1884
1919
|
}
|
|
1885
1920
|
// packages/react/src/hooks/useFeed.ts
|
|
1886
1921
|
import { useMemo as useMemo6 } from "react";
|
|
@@ -2013,7 +2048,10 @@ function useLayoutData() {
|
|
|
2013
2048
|
return useMemo7(() => {
|
|
2014
2049
|
try {
|
|
2015
2050
|
const source = typeof window === "undefined" ? globalThis.__REROUTE_DATA__ : window.__REROUTE_DATA__;
|
|
2016
|
-
|
|
2051
|
+
let value = source?.[layoutKey];
|
|
2052
|
+
if (value === undefined && layoutKey !== "__layout:/") {
|
|
2053
|
+
value = source?.["__layout:/"];
|
|
2054
|
+
}
|
|
2017
2055
|
if (typeof value === "object" && value !== null && value.__lazy__ === true) {
|
|
2018
2056
|
const fetchUrl = value.__fetch__;
|
|
2019
2057
|
if (typeof fetchUrl === "string" && typeof window !== "undefined") {
|
|
@@ -2721,7 +2759,7 @@ function dispatchDataEvent(detail) {
|
|
|
2721
2759
|
window.dispatchEvent(new CustomEvent("__reroute_data__", { detail }));
|
|
2722
2760
|
} catch {}
|
|
2723
2761
|
}
|
|
2724
|
-
function storeAndDispatchData(path, payload) {
|
|
2762
|
+
function storeAndDispatchData(path, payload, silent = false) {
|
|
2725
2763
|
if (!payload || typeof payload !== "object")
|
|
2726
2764
|
return;
|
|
2727
2765
|
const store = getRerouteDataStore();
|
|
@@ -2730,17 +2768,20 @@ function storeAndDispatchData(path, payload) {
|
|
|
2730
2768
|
for (const key of keys) {
|
|
2731
2769
|
store[key] = payload[key];
|
|
2732
2770
|
}
|
|
2733
|
-
|
|
2771
|
+
if (!silent)
|
|
2772
|
+
dispatchDataEvent({ keys });
|
|
2734
2773
|
} else if (payload.__flatten__ === true || payload.__reroute_flattened__ === true) {
|
|
2735
2774
|
const keys = Object.keys(payload).filter((k) => k !== "__flatten__" && k !== "__reroute_flattened__");
|
|
2736
2775
|
for (const key of keys) {
|
|
2737
2776
|
store[key] = payload[key];
|
|
2738
2777
|
}
|
|
2739
2778
|
store[path] = payload;
|
|
2740
|
-
|
|
2779
|
+
if (!silent)
|
|
2780
|
+
dispatchDataEvent({ keys: [...keys, path] });
|
|
2741
2781
|
} else {
|
|
2742
2782
|
store[path] = payload;
|
|
2743
|
-
|
|
2783
|
+
if (!silent)
|
|
2784
|
+
dispatchDataEvent({ key: path });
|
|
2744
2785
|
}
|
|
2745
2786
|
}
|
|
2746
2787
|
function needsDataPrefetch(path, inferred, matchRoute) {
|
|
@@ -2752,8 +2793,10 @@ function needsDataPrefetch(path, inferred, matchRoute) {
|
|
|
2752
2793
|
if (store[path] !== undefined)
|
|
2753
2794
|
return false;
|
|
2754
2795
|
const route = matchRoute?.(path)?.route;
|
|
2755
|
-
const
|
|
2756
|
-
|
|
2796
|
+
const hasSSRData = !!(route?.ssr && typeof route.ssr === "object" && typeof route.ssr.data === "function");
|
|
2797
|
+
if (hasSSRData)
|
|
2798
|
+
return false;
|
|
2799
|
+
return isDynamic;
|
|
2757
2800
|
}
|
|
2758
2801
|
async function fetchRouteData(path, signal) {
|
|
2759
2802
|
try {
|
|
@@ -2782,10 +2825,10 @@ async function fetchRouteData(path, signal) {
|
|
|
2782
2825
|
return null;
|
|
2783
2826
|
}
|
|
2784
2827
|
}
|
|
2785
|
-
function prefetchRouteData(path) {
|
|
2828
|
+
function prefetchRouteData(path, silent = false) {
|
|
2786
2829
|
fetchRouteData(path).then((payload) => {
|
|
2787
2830
|
if (payload)
|
|
2788
|
-
storeAndDispatchData(path, payload);
|
|
2831
|
+
storeAndDispatchData(path, payload, silent);
|
|
2789
2832
|
});
|
|
2790
2833
|
}
|
|
2791
2834
|
async function prefetchRouteDataWithTimeout(path, timeoutMs = 350) {
|
|
@@ -2858,7 +2901,7 @@ function Link({
|
|
|
2858
2901
|
if (options?.withTimeout) {
|
|
2859
2902
|
prefetchRouteDataWithTimeout(localUrl.path);
|
|
2860
2903
|
} else {
|
|
2861
|
-
prefetchRouteData(localUrl.path);
|
|
2904
|
+
prefetchRouteData(localUrl.path, options?.silent);
|
|
2862
2905
|
}
|
|
2863
2906
|
} else if (inferred?.module) {
|
|
2864
2907
|
prefetchContent(inferred);
|
|
@@ -2899,7 +2942,7 @@ function Link({
|
|
|
2899
2942
|
if (prefetch) {
|
|
2900
2943
|
const localUrl = parseLocalUrl(String(to));
|
|
2901
2944
|
if (localUrl)
|
|
2902
|
-
triggerPrefetch(localUrl);
|
|
2945
|
+
triggerPrefetch(localUrl, { silent: true });
|
|
2903
2946
|
}
|
|
2904
2947
|
onMouseEnter?.(e);
|
|
2905
2948
|
}, [prefetch, to, triggerPrefetch, onMouseEnter]);
|
|
@@ -2907,7 +2950,7 @@ function Link({
|
|
|
2907
2950
|
if (prefetch) {
|
|
2908
2951
|
const localUrl = parseLocalUrl(String(to));
|
|
2909
2952
|
if (localUrl)
|
|
2910
|
-
triggerPrefetch(localUrl);
|
|
2953
|
+
triggerPrefetch(localUrl, { silent: true });
|
|
2911
2954
|
}
|
|
2912
2955
|
onFocus?.(e);
|
|
2913
2956
|
}, [prefetch, to, triggerPrefetch, onFocus]);
|
|
@@ -3098,4 +3141,4 @@ export {
|
|
|
3098
3141
|
ClientOnly
|
|
3099
3142
|
};
|
|
3100
3143
|
|
|
3101
|
-
//# debugId=
|
|
3144
|
+
//# debugId=4F9F3ACDEA89FC2A64756E2164756E21
|