@tanstack/router-plugin 1.136.3 → 1.136.5
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.
|
@@ -28,14 +28,26 @@ function handleRouteUpdate(oldRoute, newRoute) {
|
|
|
28
28
|
const router = window.__TSR_ROUTER__;
|
|
29
29
|
router.routesById[newRoute.id] = newRoute;
|
|
30
30
|
router.routesByPath[newRoute.fullPath] = newRoute;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
router.processedTree.matchCache.clear();
|
|
32
|
+
router.processedTree.flatCache?.clear();
|
|
33
|
+
router.processedTree.singleCache.clear();
|
|
34
|
+
router.resolvePathCache.clear();
|
|
35
|
+
walkReplaceSegmentTree(newRoute, router.processedTree.segmentTree);
|
|
35
36
|
const filter = (m) => m.routeId === oldRoute.id;
|
|
36
37
|
if (router.state.matches.find(filter) || router.state.pendingMatches?.find(filter)) {
|
|
37
38
|
router.invalidate({ filter });
|
|
38
39
|
}
|
|
40
|
+
function walkReplaceSegmentTree(route, node) {
|
|
41
|
+
if (node.route?.id === route.id) node.route = route;
|
|
42
|
+
if (node.notFound?.id === route.id) node.notFound = route;
|
|
43
|
+
node.static?.forEach((child) => walkReplaceSegmentTree(route, child));
|
|
44
|
+
node.staticInsensitive?.forEach(
|
|
45
|
+
(child) => walkReplaceSegmentTree(route, child)
|
|
46
|
+
);
|
|
47
|
+
node.dynamic?.forEach((child) => walkReplaceSegmentTree(route, child));
|
|
48
|
+
node.optional?.forEach((child) => walkReplaceSegmentTree(route, child));
|
|
49
|
+
node.wildcard?.forEach((child) => walkReplaceSegmentTree(route, child));
|
|
50
|
+
}
|
|
39
51
|
}
|
|
40
52
|
const routeHmrStatement = template__namespace.statement(
|
|
41
53
|
`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-hmr-statement.cjs","sources":["../../../src/core/route-hmr-statement.ts"],"sourcesContent":["import * as template from '@babel/template'\nimport type { AnyRoute, AnyRouteMatch } from '@tanstack/router-core'\n\ntype AnyRouteWithPrivateProps = AnyRoute & {\n _path: string\n _id: string\n _fullPath: string\n _to: string\n}\n\nfunction handleRouteUpdate(\n oldRoute: AnyRouteWithPrivateProps,\n newRoute: AnyRouteWithPrivateProps,\n) {\n newRoute._path = oldRoute._path\n newRoute._id = oldRoute._id\n newRoute._fullPath = oldRoute._fullPath\n newRoute._to = oldRoute._to\n newRoute.children = oldRoute.children\n newRoute.parentRoute = oldRoute.parentRoute\n\n const router = window.__TSR_ROUTER__!\n router.routesById[newRoute.id] = newRoute\n router.routesByPath[newRoute.fullPath] = newRoute\n
|
|
1
|
+
{"version":3,"file":"route-hmr-statement.cjs","sources":["../../../src/core/route-hmr-statement.ts"],"sourcesContent":["import * as template from '@babel/template'\nimport type { AnyRoute, AnyRouteMatch, AnyRouter } from '@tanstack/router-core'\n\ntype AnyRouteWithPrivateProps = AnyRoute & {\n _path: string\n _id: string\n _fullPath: string\n _to: string\n}\n\nfunction handleRouteUpdate(\n oldRoute: AnyRouteWithPrivateProps,\n newRoute: AnyRouteWithPrivateProps,\n) {\n newRoute._path = oldRoute._path\n newRoute._id = oldRoute._id\n newRoute._fullPath = oldRoute._fullPath\n newRoute._to = oldRoute._to\n newRoute.children = oldRoute.children\n newRoute.parentRoute = oldRoute.parentRoute\n\n const router = window.__TSR_ROUTER__!\n router.routesById[newRoute.id] = newRoute\n router.routesByPath[newRoute.fullPath] = newRoute\n router.processedTree.matchCache.clear()\n router.processedTree.flatCache?.clear()\n router.processedTree.singleCache.clear()\n router.resolvePathCache.clear()\n // TODO: how to rebuild the tree if we add a new route?\n walkReplaceSegmentTree(newRoute, router.processedTree.segmentTree)\n const filter = (m: AnyRouteMatch) => m.routeId === oldRoute.id\n if (\n router.state.matches.find(filter) ||\n router.state.pendingMatches?.find(filter)\n ) {\n router.invalidate({ filter })\n }\n function walkReplaceSegmentTree(\n route: AnyRouteWithPrivateProps,\n node: AnyRouter['processedTree']['segmentTree'],\n ) {\n if (node.route?.id === route.id) node.route = route\n if (node.notFound?.id === route.id) node.notFound = route\n\n node.static?.forEach((child) => walkReplaceSegmentTree(route, child))\n node.staticInsensitive?.forEach((child) =>\n walkReplaceSegmentTree(route, child),\n )\n node.dynamic?.forEach((child) => walkReplaceSegmentTree(route, child))\n node.optional?.forEach((child) => walkReplaceSegmentTree(route, child))\n node.wildcard?.forEach((child) => walkReplaceSegmentTree(route, child))\n }\n}\n\nexport const routeHmrStatement = template.statement(\n `\nif (import.meta.hot) {\n import.meta.hot.accept((newModule) => {\n if (Route && newModule && newModule.Route) {\n (${handleRouteUpdate.toString()})(Route, newModule.Route)\n }\n })\n}\n`,\n // Disable placeholder parsing so identifiers like __TSR_ROUTER__ are treated as normal identifiers instead of template placeholders\n { placeholderPattern: false },\n)()\n"],"names":["template"],"mappings":";;;;;;;;;;;;;;;;;;;;AAUA,SAAS,kBACP,UACA,UACA;AACA,WAAS,QAAQ,SAAS;AAC1B,WAAS,MAAM,SAAS;AACxB,WAAS,YAAY,SAAS;AAC9B,WAAS,MAAM,SAAS;AACxB,WAAS,WAAW,SAAS;AAC7B,WAAS,cAAc,SAAS;AAEhC,QAAM,SAAS,OAAO;AACtB,SAAO,WAAW,SAAS,EAAE,IAAI;AACjC,SAAO,aAAa,SAAS,QAAQ,IAAI;AACzC,SAAO,cAAc,WAAW,MAAA;AAChC,SAAO,cAAc,WAAW,MAAA;AAChC,SAAO,cAAc,YAAY,MAAA;AACjC,SAAO,iBAAiB,MAAA;AAExB,yBAAuB,UAAU,OAAO,cAAc,WAAW;AACjE,QAAM,SAAS,CAAC,MAAqB,EAAE,YAAY,SAAS;AAC5D,MACE,OAAO,MAAM,QAAQ,KAAK,MAAM,KAChC,OAAO,MAAM,gBAAgB,KAAK,MAAM,GACxC;AACA,WAAO,WAAW,EAAE,QAAQ;AAAA,EAC9B;AACA,WAAS,uBACP,OACA,MACA;AACA,QAAI,KAAK,OAAO,OAAO,MAAM,SAAS,QAAQ;AAC9C,QAAI,KAAK,UAAU,OAAO,MAAM,SAAS,WAAW;AAEpD,SAAK,QAAQ,QAAQ,CAAC,UAAU,uBAAuB,OAAO,KAAK,CAAC;AACpE,SAAK,mBAAmB;AAAA,MAAQ,CAAC,UAC/B,uBAAuB,OAAO,KAAK;AAAA,IAAA;AAErC,SAAK,SAAS,QAAQ,CAAC,UAAU,uBAAuB,OAAO,KAAK,CAAC;AACrE,SAAK,UAAU,QAAQ,CAAC,UAAU,uBAAuB,OAAO,KAAK,CAAC;AACtE,SAAK,UAAU,QAAQ,CAAC,UAAU,uBAAuB,OAAO,KAAK,CAAC;AAAA,EACxE;AACF;AAEO,MAAM,oBAAoBA,oBAAS;AAAA,EACxC;AAAA;AAAA;AAAA;AAAA,SAIO,kBAAkB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnC,EAAE,oBAAoB,MAAA;AACxB,EAAA;;"}
|
|
@@ -9,14 +9,26 @@ function handleRouteUpdate(oldRoute, newRoute) {
|
|
|
9
9
|
const router = window.__TSR_ROUTER__;
|
|
10
10
|
router.routesById[newRoute.id] = newRoute;
|
|
11
11
|
router.routesByPath[newRoute.fullPath] = newRoute;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
router.processedTree.matchCache.clear();
|
|
13
|
+
router.processedTree.flatCache?.clear();
|
|
14
|
+
router.processedTree.singleCache.clear();
|
|
15
|
+
router.resolvePathCache.clear();
|
|
16
|
+
walkReplaceSegmentTree(newRoute, router.processedTree.segmentTree);
|
|
16
17
|
const filter = (m) => m.routeId === oldRoute.id;
|
|
17
18
|
if (router.state.matches.find(filter) || router.state.pendingMatches?.find(filter)) {
|
|
18
19
|
router.invalidate({ filter });
|
|
19
20
|
}
|
|
21
|
+
function walkReplaceSegmentTree(route, node) {
|
|
22
|
+
if (node.route?.id === route.id) node.route = route;
|
|
23
|
+
if (node.notFound?.id === route.id) node.notFound = route;
|
|
24
|
+
node.static?.forEach((child) => walkReplaceSegmentTree(route, child));
|
|
25
|
+
node.staticInsensitive?.forEach(
|
|
26
|
+
(child) => walkReplaceSegmentTree(route, child)
|
|
27
|
+
);
|
|
28
|
+
node.dynamic?.forEach((child) => walkReplaceSegmentTree(route, child));
|
|
29
|
+
node.optional?.forEach((child) => walkReplaceSegmentTree(route, child));
|
|
30
|
+
node.wildcard?.forEach((child) => walkReplaceSegmentTree(route, child));
|
|
31
|
+
}
|
|
20
32
|
}
|
|
21
33
|
const routeHmrStatement = template.statement(
|
|
22
34
|
`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-hmr-statement.js","sources":["../../../src/core/route-hmr-statement.ts"],"sourcesContent":["import * as template from '@babel/template'\nimport type { AnyRoute, AnyRouteMatch } from '@tanstack/router-core'\n\ntype AnyRouteWithPrivateProps = AnyRoute & {\n _path: string\n _id: string\n _fullPath: string\n _to: string\n}\n\nfunction handleRouteUpdate(\n oldRoute: AnyRouteWithPrivateProps,\n newRoute: AnyRouteWithPrivateProps,\n) {\n newRoute._path = oldRoute._path\n newRoute._id = oldRoute._id\n newRoute._fullPath = oldRoute._fullPath\n newRoute._to = oldRoute._to\n newRoute.children = oldRoute.children\n newRoute.parentRoute = oldRoute.parentRoute\n\n const router = window.__TSR_ROUTER__!\n router.routesById[newRoute.id] = newRoute\n router.routesByPath[newRoute.fullPath] = newRoute\n
|
|
1
|
+
{"version":3,"file":"route-hmr-statement.js","sources":["../../../src/core/route-hmr-statement.ts"],"sourcesContent":["import * as template from '@babel/template'\nimport type { AnyRoute, AnyRouteMatch, AnyRouter } from '@tanstack/router-core'\n\ntype AnyRouteWithPrivateProps = AnyRoute & {\n _path: string\n _id: string\n _fullPath: string\n _to: string\n}\n\nfunction handleRouteUpdate(\n oldRoute: AnyRouteWithPrivateProps,\n newRoute: AnyRouteWithPrivateProps,\n) {\n newRoute._path = oldRoute._path\n newRoute._id = oldRoute._id\n newRoute._fullPath = oldRoute._fullPath\n newRoute._to = oldRoute._to\n newRoute.children = oldRoute.children\n newRoute.parentRoute = oldRoute.parentRoute\n\n const router = window.__TSR_ROUTER__!\n router.routesById[newRoute.id] = newRoute\n router.routesByPath[newRoute.fullPath] = newRoute\n router.processedTree.matchCache.clear()\n router.processedTree.flatCache?.clear()\n router.processedTree.singleCache.clear()\n router.resolvePathCache.clear()\n // TODO: how to rebuild the tree if we add a new route?\n walkReplaceSegmentTree(newRoute, router.processedTree.segmentTree)\n const filter = (m: AnyRouteMatch) => m.routeId === oldRoute.id\n if (\n router.state.matches.find(filter) ||\n router.state.pendingMatches?.find(filter)\n ) {\n router.invalidate({ filter })\n }\n function walkReplaceSegmentTree(\n route: AnyRouteWithPrivateProps,\n node: AnyRouter['processedTree']['segmentTree'],\n ) {\n if (node.route?.id === route.id) node.route = route\n if (node.notFound?.id === route.id) node.notFound = route\n\n node.static?.forEach((child) => walkReplaceSegmentTree(route, child))\n node.staticInsensitive?.forEach((child) =>\n walkReplaceSegmentTree(route, child),\n )\n node.dynamic?.forEach((child) => walkReplaceSegmentTree(route, child))\n node.optional?.forEach((child) => walkReplaceSegmentTree(route, child))\n node.wildcard?.forEach((child) => walkReplaceSegmentTree(route, child))\n }\n}\n\nexport const routeHmrStatement = template.statement(\n `\nif (import.meta.hot) {\n import.meta.hot.accept((newModule) => {\n if (Route && newModule && newModule.Route) {\n (${handleRouteUpdate.toString()})(Route, newModule.Route)\n }\n })\n}\n`,\n // Disable placeholder parsing so identifiers like __TSR_ROUTER__ are treated as normal identifiers instead of template placeholders\n { placeholderPattern: false },\n)()\n"],"names":[],"mappings":";AAUA,SAAS,kBACP,UACA,UACA;AACA,WAAS,QAAQ,SAAS;AAC1B,WAAS,MAAM,SAAS;AACxB,WAAS,YAAY,SAAS;AAC9B,WAAS,MAAM,SAAS;AACxB,WAAS,WAAW,SAAS;AAC7B,WAAS,cAAc,SAAS;AAEhC,QAAM,SAAS,OAAO;AACtB,SAAO,WAAW,SAAS,EAAE,IAAI;AACjC,SAAO,aAAa,SAAS,QAAQ,IAAI;AACzC,SAAO,cAAc,WAAW,MAAA;AAChC,SAAO,cAAc,WAAW,MAAA;AAChC,SAAO,cAAc,YAAY,MAAA;AACjC,SAAO,iBAAiB,MAAA;AAExB,yBAAuB,UAAU,OAAO,cAAc,WAAW;AACjE,QAAM,SAAS,CAAC,MAAqB,EAAE,YAAY,SAAS;AAC5D,MACE,OAAO,MAAM,QAAQ,KAAK,MAAM,KAChC,OAAO,MAAM,gBAAgB,KAAK,MAAM,GACxC;AACA,WAAO,WAAW,EAAE,QAAQ;AAAA,EAC9B;AACA,WAAS,uBACP,OACA,MACA;AACA,QAAI,KAAK,OAAO,OAAO,MAAM,SAAS,QAAQ;AAC9C,QAAI,KAAK,UAAU,OAAO,MAAM,SAAS,WAAW;AAEpD,SAAK,QAAQ,QAAQ,CAAC,UAAU,uBAAuB,OAAO,KAAK,CAAC;AACpE,SAAK,mBAAmB;AAAA,MAAQ,CAAC,UAC/B,uBAAuB,OAAO,KAAK;AAAA,IAAA;AAErC,SAAK,SAAS,QAAQ,CAAC,UAAU,uBAAuB,OAAO,KAAK,CAAC;AACrE,SAAK,UAAU,QAAQ,CAAC,UAAU,uBAAuB,OAAO,KAAK,CAAC;AACtE,SAAK,UAAU,QAAQ,CAAC,UAAU,uBAAuB,OAAO,KAAK,CAAC;AAAA,EACxE;AACF;AAEO,MAAM,oBAAoB,SAAS;AAAA,EACxC;AAAA;AAAA;AAAA;AAAA,SAIO,kBAAkB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnC,EAAE,oBAAoB,MAAA;AACxB,EAAA;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/router-plugin",
|
|
3
|
-
"version": "1.136.
|
|
3
|
+
"version": "1.136.5",
|
|
4
4
|
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
"chokidar": "^3.6.0",
|
|
98
98
|
"unplugin": "^2.1.2",
|
|
99
99
|
"zod": "^3.24.2",
|
|
100
|
-
"@tanstack/router-
|
|
101
|
-
"@tanstack/router-
|
|
100
|
+
"@tanstack/router-generator": "1.136.5",
|
|
101
|
+
"@tanstack/router-core": "1.136.5",
|
|
102
102
|
"@tanstack/router-utils": "1.133.19",
|
|
103
103
|
"@tanstack/virtual-file-routes": "1.133.19"
|
|
104
104
|
},
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"vite": ">=5.0.0 || >=6.0.0 || >=7.0.0",
|
|
113
113
|
"vite-plugin-solid": "^2.11.10",
|
|
114
114
|
"webpack": ">=5.92.0",
|
|
115
|
-
"@tanstack/react-router": "^1.136.
|
|
115
|
+
"@tanstack/react-router": "^1.136.5"
|
|
116
116
|
},
|
|
117
117
|
"peerDependenciesMeta": {
|
|
118
118
|
"@rsbuild/core": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as template from '@babel/template'
|
|
2
|
-
import type { AnyRoute, AnyRouteMatch } from '@tanstack/router-core'
|
|
2
|
+
import type { AnyRoute, AnyRouteMatch, AnyRouter } from '@tanstack/router-core'
|
|
3
3
|
|
|
4
4
|
type AnyRouteWithPrivateProps = AnyRoute & {
|
|
5
5
|
_path: string
|
|
@@ -22,10 +22,12 @@ function handleRouteUpdate(
|
|
|
22
22
|
const router = window.__TSR_ROUTER__!
|
|
23
23
|
router.routesById[newRoute.id] = newRoute
|
|
24
24
|
router.routesByPath[newRoute.fullPath] = newRoute
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
router.processedTree.matchCache.clear()
|
|
26
|
+
router.processedTree.flatCache?.clear()
|
|
27
|
+
router.processedTree.singleCache.clear()
|
|
28
|
+
router.resolvePathCache.clear()
|
|
29
|
+
// TODO: how to rebuild the tree if we add a new route?
|
|
30
|
+
walkReplaceSegmentTree(newRoute, router.processedTree.segmentTree)
|
|
29
31
|
const filter = (m: AnyRouteMatch) => m.routeId === oldRoute.id
|
|
30
32
|
if (
|
|
31
33
|
router.state.matches.find(filter) ||
|
|
@@ -33,6 +35,21 @@ function handleRouteUpdate(
|
|
|
33
35
|
) {
|
|
34
36
|
router.invalidate({ filter })
|
|
35
37
|
}
|
|
38
|
+
function walkReplaceSegmentTree(
|
|
39
|
+
route: AnyRouteWithPrivateProps,
|
|
40
|
+
node: AnyRouter['processedTree']['segmentTree'],
|
|
41
|
+
) {
|
|
42
|
+
if (node.route?.id === route.id) node.route = route
|
|
43
|
+
if (node.notFound?.id === route.id) node.notFound = route
|
|
44
|
+
|
|
45
|
+
node.static?.forEach((child) => walkReplaceSegmentTree(route, child))
|
|
46
|
+
node.staticInsensitive?.forEach((child) =>
|
|
47
|
+
walkReplaceSegmentTree(route, child),
|
|
48
|
+
)
|
|
49
|
+
node.dynamic?.forEach((child) => walkReplaceSegmentTree(route, child))
|
|
50
|
+
node.optional?.forEach((child) => walkReplaceSegmentTree(route, child))
|
|
51
|
+
node.wildcard?.forEach((child) => walkReplaceSegmentTree(route, child))
|
|
52
|
+
}
|
|
36
53
|
}
|
|
37
54
|
|
|
38
55
|
export const routeHmrStatement = template.statement(
|