@tanstack/react-router 1.43.6 → 1.43.12
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/cjs/router.cjs +17 -3
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +3 -1
- package/dist/esm/router.d.ts +3 -1
- package/dist/esm/router.js +17 -3
- package/dist/esm/router.js.map +1 -1
- package/package.json +15 -15
- package/src/router.ts +22 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-router",
|
|
3
|
-
"version": "1.43.
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "1.43.12",
|
|
4
|
+
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -14,6 +14,15 @@
|
|
|
14
14
|
"type": "github",
|
|
15
15
|
"url": "https://github.com/sponsors/tannerlinsley"
|
|
16
16
|
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"react",
|
|
19
|
+
"location",
|
|
20
|
+
"router",
|
|
21
|
+
"routing",
|
|
22
|
+
"async",
|
|
23
|
+
"async router",
|
|
24
|
+
"typescript"
|
|
25
|
+
],
|
|
17
26
|
"type": "module",
|
|
18
27
|
"types": "dist/esm/index.d.ts",
|
|
19
28
|
"main": "dist/cjs/index.cjs",
|
|
@@ -32,27 +41,18 @@
|
|
|
32
41
|
"./package.json": "./package.json"
|
|
33
42
|
},
|
|
34
43
|
"sideEffects": false,
|
|
35
|
-
"keywords": [
|
|
36
|
-
"react",
|
|
37
|
-
"location",
|
|
38
|
-
"router",
|
|
39
|
-
"routing",
|
|
40
|
-
"async",
|
|
41
|
-
"async router",
|
|
42
|
-
"typescript"
|
|
43
|
-
],
|
|
44
|
-
"engines": {
|
|
45
|
-
"node": ">=12"
|
|
46
|
-
},
|
|
47
44
|
"files": [
|
|
48
45
|
"dist",
|
|
49
46
|
"src"
|
|
50
47
|
],
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=12"
|
|
50
|
+
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@tanstack/react-store": "^0.2.1",
|
|
53
53
|
"tiny-invariant": "^1.3.1",
|
|
54
54
|
"tiny-warning": "^1.0.3",
|
|
55
|
-
"@tanstack/history": "1.
|
|
55
|
+
"@tanstack/history": "1.43.12"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@testing-library/jest-dom": "^6.4.5",
|
package/src/router.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createBrowserHistory, createMemoryHistory } from '@tanstack/history'
|
|
2
2
|
import { Store } from '@tanstack/react-store'
|
|
3
3
|
import invariant from 'tiny-invariant'
|
|
4
|
+
import warning from 'tiny-warning'
|
|
4
5
|
import { rootRouteId } from './root'
|
|
5
6
|
import { defaultParseSearch, defaultStringifySearch } from './searchParams'
|
|
6
7
|
import {
|
|
@@ -2402,7 +2403,16 @@ export class Router<
|
|
|
2402
2403
|
this.manifest = ctx.router.manifest
|
|
2403
2404
|
}
|
|
2404
2405
|
|
|
2405
|
-
injectedHtml: Array<string> = []
|
|
2406
|
+
injectedHtml: Array<() => string> = []
|
|
2407
|
+
injectHtml: (html: string) => void = (html) => {
|
|
2408
|
+
const cb = () => {
|
|
2409
|
+
this.injectedHtml = this.injectedHtml.filter((d) => d !== cb)
|
|
2410
|
+
return html
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2413
|
+
this.injectedHtml.push(cb)
|
|
2414
|
+
}
|
|
2415
|
+
streamedKeys: Set<string> = new Set()
|
|
2406
2416
|
|
|
2407
2417
|
getStreamedValue = <T>(key: string): T | undefined => {
|
|
2408
2418
|
if (this.isServer) {
|
|
@@ -2423,14 +2433,21 @@ export class Router<
|
|
|
2423
2433
|
}
|
|
2424
2434
|
|
|
2425
2435
|
streamValue = (key: string, value: any) => {
|
|
2426
|
-
|
|
2427
|
-
|
|
2436
|
+
warning(
|
|
2437
|
+
!this.streamedKeys.has(key),
|
|
2438
|
+
'Key has already been streamed: ' + key,
|
|
2439
|
+
)
|
|
2440
|
+
|
|
2441
|
+
this.streamedKeys.add(key)
|
|
2442
|
+
const children = `__TSR__.streamedValues['${key}'] = { value: ${this.serializer?.(this.options.transformer.stringify(value))}}`
|
|
2443
|
+
|
|
2444
|
+
this.injectHtml(
|
|
2428
2445
|
`<script class='tsr-once'>${children}${
|
|
2429
2446
|
process.env.NODE_ENV === 'development'
|
|
2430
2447
|
? `; console.info(\`Injected From Server:
|
|
2431
|
-
${children}\`)`
|
|
2448
|
+
${children}\`)`
|
|
2432
2449
|
: ''
|
|
2433
|
-
}</script>`,
|
|
2450
|
+
}; __TSR__.cleanScripts()</script>`,
|
|
2434
2451
|
)
|
|
2435
2452
|
}
|
|
2436
2453
|
|