@tanstack/react-router 1.159.14 → 1.160.2
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/Asset.cjs +33 -19
- package/dist/cjs/Asset.cjs.map +1 -1
- package/dist/cjs/index.cjs +4 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/index.dev.cjs +4 -0
- package/dist/cjs/index.dev.cjs.map +1 -1
- package/dist/cjs/link.cjs +6 -6
- package/dist/cjs/link.cjs.map +1 -1
- package/dist/esm/Asset.js +33 -19
- package/dist/esm/Asset.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.dev.js +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/link.js +6 -6
- package/dist/esm/link.js.map +1 -1
- package/dist/llms/rules/api.d.ts +1 -1
- package/dist/llms/rules/api.js +35 -0
- package/dist/llms/rules/guide.d.ts +1 -1
- package/dist/llms/rules/guide.js +2821 -253
- package/dist/llms/rules/installation.d.ts +1 -1
- package/dist/llms/rules/installation.js +376 -357
- package/dist/llms/rules/routing.d.ts +1 -1
- package/dist/llms/rules/routing.js +436 -31
- package/dist/llms/rules/setup-and-architecture.d.ts +1 -1
- package/dist/llms/rules/setup-and-architecture.js +253 -90
- package/package.json +2 -2
- package/src/Asset.tsx +45 -17
- package/src/index.tsx +6 -1
- package/src/link.tsx +7 -7
package/src/link.tsx
CHANGED
|
@@ -118,7 +118,7 @@ export function useLinkProps<
|
|
|
118
118
|
) {
|
|
119
119
|
try {
|
|
120
120
|
new URL(to)
|
|
121
|
-
if (isDangerousProtocol(to)) {
|
|
121
|
+
if (isDangerousProtocol(to, router.protocolAllowlist)) {
|
|
122
122
|
if (process.env.NODE_ENV !== 'production') {
|
|
123
123
|
console.warn(`Blocked Link with dangerous protocol: ${to}`)
|
|
124
124
|
}
|
|
@@ -170,7 +170,7 @@ export function useLinkProps<
|
|
|
170
170
|
|
|
171
171
|
const externalLink = (() => {
|
|
172
172
|
if (hrefOption?.external) {
|
|
173
|
-
if (isDangerousProtocol(hrefOption.href)) {
|
|
173
|
+
if (isDangerousProtocol(hrefOption.href, router.protocolAllowlist)) {
|
|
174
174
|
if (process.env.NODE_ENV !== 'production') {
|
|
175
175
|
console.warn(
|
|
176
176
|
`Blocked Link with dangerous protocol: ${hrefOption.href}`,
|
|
@@ -187,7 +187,7 @@ export function useLinkProps<
|
|
|
187
187
|
if (typeof to === 'string' && to.indexOf(':') > -1) {
|
|
188
188
|
try {
|
|
189
189
|
new URL(to)
|
|
190
|
-
if (isDangerousProtocol(to)) {
|
|
190
|
+
if (isDangerousProtocol(to, router.protocolAllowlist)) {
|
|
191
191
|
if (process.env.NODE_ENV !== 'production') {
|
|
192
192
|
console.warn(`Blocked Link with dangerous protocol: ${to}`)
|
|
193
193
|
}
|
|
@@ -438,7 +438,7 @@ export function useLinkProps<
|
|
|
438
438
|
const externalLink = React.useMemo(() => {
|
|
439
439
|
if (hrefOption?.external) {
|
|
440
440
|
// Block dangerous protocols for external links
|
|
441
|
-
if (isDangerousProtocol(hrefOption.href)) {
|
|
441
|
+
if (isDangerousProtocol(hrefOption.href, router.protocolAllowlist)) {
|
|
442
442
|
if (process.env.NODE_ENV !== 'production') {
|
|
443
443
|
console.warn(
|
|
444
444
|
`Blocked Link with dangerous protocol: ${hrefOption.href}`,
|
|
@@ -453,8 +453,8 @@ export function useLinkProps<
|
|
|
453
453
|
if (typeof to !== 'string' || to.indexOf(':') === -1) return undefined
|
|
454
454
|
try {
|
|
455
455
|
new URL(to as any)
|
|
456
|
-
// Block dangerous protocols like javascript:,
|
|
457
|
-
if (isDangerousProtocol(to)) {
|
|
456
|
+
// Block dangerous protocols like javascript:, blob:, data:
|
|
457
|
+
if (isDangerousProtocol(to, router.protocolAllowlist)) {
|
|
458
458
|
if (process.env.NODE_ENV !== 'production') {
|
|
459
459
|
console.warn(`Blocked Link with dangerous protocol: ${to}`)
|
|
460
460
|
}
|
|
@@ -463,7 +463,7 @@ export function useLinkProps<
|
|
|
463
463
|
return to
|
|
464
464
|
} catch {}
|
|
465
465
|
return undefined
|
|
466
|
-
}, [to, hrefOption])
|
|
466
|
+
}, [to, hrefOption, router.protocolAllowlist])
|
|
467
467
|
|
|
468
468
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
469
469
|
const isActive = useRouterState({
|