@tanstack/router-plugin 1.141.9 → 1.142.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.
@@ -39,7 +39,7 @@ function handleRouteUpdate(oldRoute, newRoute) {
39
39
  }
40
40
  function walkReplaceSegmentTree(route, node) {
41
41
  if (node.route?.id === route.id) node.route = route;
42
- if (node.notFound?.id === route.id) node.notFound = route;
42
+ if (node.index) walkReplaceSegmentTree(route, node.index);
43
43
  node.static?.forEach((child) => walkReplaceSegmentTree(route, child));
44
44
  node.staticInsensitive?.forEach(
45
45
  (child) => walkReplaceSegmentTree(route, child)
@@ -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, 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;;"}
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.index) walkReplaceSegmentTree(route, node.index)\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,MAAO,wBAAuB,OAAO,KAAK,KAAK;AACxD,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;;"}
@@ -20,7 +20,7 @@ function handleRouteUpdate(oldRoute, newRoute) {
20
20
  }
21
21
  function walkReplaceSegmentTree(route, node) {
22
22
  if (node.route?.id === route.id) node.route = route;
23
- if (node.notFound?.id === route.id) node.notFound = route;
23
+ if (node.index) walkReplaceSegmentTree(route, node.index);
24
24
  node.static?.forEach((child) => walkReplaceSegmentTree(route, child));
25
25
  node.staticInsensitive?.forEach(
26
26
  (child) => walkReplaceSegmentTree(route, child)
@@ -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, 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,W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ent":["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.index) walkReplaceSegmentTree(route, node.index)\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 inst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AAA;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.141.9",
3
+ "version": "1.142.6",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -97,10 +97,10 @@
97
97
  "chokidar": "^3.6.0",
98
98
  "unplugin": "^2.1.2",
99
99
  "zod": "^3.24.2",
100
- "@tanstack/router-core": "1.141.8",
101
- "@tanstack/router-generator": "1.141.9",
102
- "@tanstack/router-utils": "1.141.0",
103
- "@tanstack/virtual-file-routes": "1.141.0"
100
+ "@tanstack/router-core": "1.142.6",
101
+ "@tanstack/router-generator": "1.142.6",
102
+ "@tanstack/virtual-file-routes": "1.141.0",
103
+ "@tanstack/router-utils": "1.141.0"
104
104
  },
105
105
  "devDependencies": {
106
106
  "@types/babel__core": "^7.20.5",
@@ -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.141.8"
115
+ "@tanstack/react-router": "^1.142.6"
116
116
  },
117
117
  "peerDependenciesMeta": {
118
118
  "@rsbuild/core": {
@@ -40,8 +40,7 @@ function handleRouteUpdate(
40
40
  node: AnyRouter['processedTree']['segmentTree'],
41
41
  ) {
42
42
  if (node.route?.id === route.id) node.route = route
43
- if (node.notFound?.id === route.id) node.notFound = route
44
-
43
+ if (node.index) walkReplaceSegmentTree(route, node.index)
45
44
  node.static?.forEach((child) => walkReplaceSegmentTree(route, child))
46
45
  node.staticInsensitive?.forEach((child) =>
47
46
  walkReplaceSegmentTree(route, child),