@tanstack/router-plugin 1.134.4 → 1.134.6
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.
|
@@ -32,7 +32,10 @@ function handleRouteUpdate(oldRoute, newRoute) {
|
|
|
32
32
|
if (oldRouteIndex > -1) {
|
|
33
33
|
router.flatRoutes[oldRouteIndex] = newRoute;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
const filter = (m) => m.routeId === oldRoute.id;
|
|
36
|
+
if (router.state.matches.find(filter) || router.state.pendingMatches?.find(filter)) {
|
|
37
|
+
router.invalidate({ filter });
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
const routeHmrStatement = template__namespace.statement(
|
|
38
41
|
`
|
|
@@ -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 } 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 const oldRouteIndex = router.flatRoutes.indexOf(oldRoute)\n if (oldRouteIndex > -1) {\n router.flatRoutes[oldRouteIndex] = newRoute\n }\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 } 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 const oldRouteIndex = router.flatRoutes.indexOf(oldRoute)\n if (oldRouteIndex > -1) {\n router.flatRoutes[oldRouteIndex] = newRoute\n }\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}\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,QAAM,gBAAgB,OAAO,WAAW,QAAQ,QAAQ;AACxD,MAAI,gBAAgB,IAAI;AACtB,WAAO,WAAW,aAAa,IAAI;AAAA,EACrC;AACA,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;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;;"}
|
|
@@ -13,7 +13,10 @@ function handleRouteUpdate(oldRoute, newRoute) {
|
|
|
13
13
|
if (oldRouteIndex > -1) {
|
|
14
14
|
router.flatRoutes[oldRouteIndex] = newRoute;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
const filter = (m) => m.routeId === oldRoute.id;
|
|
17
|
+
if (router.state.matches.find(filter) || router.state.pendingMatches?.find(filter)) {
|
|
18
|
+
router.invalidate({ filter });
|
|
19
|
+
}
|
|
17
20
|
}
|
|
18
21
|
const routeHmrStatement = template.statement(
|
|
19
22
|
`
|
|
@@ -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 } 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 const oldRouteIndex = router.flatRoutes.indexOf(oldRoute)\n if (oldRouteIndex > -1) {\n router.flatRoutes[oldRouteIndex] = newRoute\n }\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 } 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 const oldRouteIndex = router.flatRoutes.indexOf(oldRoute)\n if (oldRouteIndex > -1) {\n router.flatRoutes[oldRouteIndex] = newRoute\n }\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}\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,QAAM,gBAAgB,OAAO,WAAW,QAAQ,QAAQ;AACxD,MAAI,gBAAgB,IAAI;AACtB,WAAO,WAAW,aAAa,IAAI;AAAA,EACrC;AACA,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;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.134.
|
|
3
|
+
"version": "1.134.6",
|
|
4
4
|
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -99,8 +99,8 @@
|
|
|
99
99
|
"zod": "^3.24.2",
|
|
100
100
|
"@tanstack/router-core": "1.134.4",
|
|
101
101
|
"@tanstack/router-generator": "1.134.4",
|
|
102
|
-
"@tanstack/
|
|
103
|
-
"@tanstack/
|
|
102
|
+
"@tanstack/virtual-file-routes": "1.133.19",
|
|
103
|
+
"@tanstack/router-utils": "1.133.19"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"@types/babel__core": "^7.20.5",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as template from '@babel/template'
|
|
2
|
-
import type { AnyRoute } from '@tanstack/router-core'
|
|
2
|
+
import type { AnyRoute, AnyRouteMatch } from '@tanstack/router-core'
|
|
3
3
|
|
|
4
4
|
type AnyRouteWithPrivateProps = AnyRoute & {
|
|
5
5
|
_path: string
|
|
@@ -26,7 +26,13 @@ function handleRouteUpdate(
|
|
|
26
26
|
if (oldRouteIndex > -1) {
|
|
27
27
|
router.flatRoutes[oldRouteIndex] = newRoute
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
const filter = (m: AnyRouteMatch) => m.routeId === oldRoute.id
|
|
30
|
+
if (
|
|
31
|
+
router.state.matches.find(filter) ||
|
|
32
|
+
router.state.pendingMatches?.find(filter)
|
|
33
|
+
) {
|
|
34
|
+
router.invalidate({ filter })
|
|
35
|
+
}
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
export const routeHmrStatement = template.statement(
|