Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tanstack/react-router

Package Overview
Dependencies
Maintainers
2
Versions
635
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/react-router - npm Package Compare versions

Comparing version 1.78.3 to 1.79.0

3

dist/esm/path.d.ts

@@ -28,4 +28,5 @@ import { MatchLocation } from './RouterProvider.js';

leaveParams?: boolean;
decodeCharMap?: Map<string, string>;
}
export declare function interpolatePath({ path, params, leaveWildcards, leaveParams, }: InterpolatePathOptions): string;
export declare function interpolatePath({ path, params, leaveWildcards, leaveParams, decodeCharMap, }: InterpolatePathOptions): string;
export declare function matchPathname(basepath: string, currentPathname: string, matchLocation: Pick<MatchLocation, 'to' | 'fuzzy' | 'caseSensitive'>): AnyPathParams | undefined;

@@ -32,0 +33,0 @@ export declare function removeBasepath(basepath: string, pathname: string, caseSensitive?: boolean): string;

@@ -121,3 +121,4 @@ import { last } from "./utils.js";

leaveWildcards,
leaveParams
leaveParams,
decodeCharMap
}) {

@@ -131,3 +132,3 @@ const interpolatedPathSegments = parsePathname(path);

} else {
encodedParams[key] = isValueString ? encodeURIComponent(value) : value;
encodedParams[key] = isValueString ? encodePathParam(value, decodeCharMap) : value;
}

@@ -153,2 +154,11 @@ }

}
function encodePathParam(value, decodeCharMap) {
let encoded = encodeURIComponent(value);
if (decodeCharMap) {
for (const [encodedChar, char] of decodeCharMap) {
encoded = encoded.replaceAll(encodedChar, char);
}
}
return encoded;
}
function matchPathname(basepath, currentPathname, matchLocation) {

@@ -155,0 +165,0 @@ const pathParams = matchByPath(basepath, currentPathname, matchLocation);

@@ -355,2 +355,9 @@ import { Store, NoInfer } from '@tanstack/react-store';

};
/**
* Configures which URI characters are allowed in path params that would ordinarily be escaped by encodeURIComponent.
*
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#pathparamsallowedcharacters-property)
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/path-params#allowed-characters)
*/
pathParamsAllowedCharacters?: Array<';' | ':' | '@' | '&' | '=' | '+' | '$' | ','>;
}

@@ -479,2 +486,3 @@ export interface RouterErrorSerializer<TSerializedError> {

isServer: boolean;
pathParamsDecodeCharMap?: Map<string, string>;
/**

@@ -481,0 +489,0 @@ * @deprecated Use the `createRouter` function instead

@@ -69,2 +69,8 @@ import { createMemoryHistory, createBrowserHistory, parseHref } from "@tanstack/history";

this.isServer = this.options.isServer ?? typeof document === "undefined";
this.pathParamsDecodeCharMap = this.options.pathParamsAllowedCharacters ? new Map(
this.options.pathParamsAllowedCharacters.map((char) => [
encodeURIComponent(char),
char
])
) : void 0;
if (!this.basepath || newOptions.basepath && newOptions.basepath !== previousOptions.basepath) {

@@ -315,3 +321,4 @@ if (newOptions.basepath === void 0 || newOptions.basepath === "" || newOptions.basepath === "/") {

path: route.fullPath,
params: (matchedRoutesResult == null ? void 0 : matchedRoutesResult.routeParams) ?? {}
params: (matchedRoutesResult == null ? void 0 : matchedRoutesResult.routeParams) ?? {},
decodeCharMap: this.pathParamsDecodeCharMap
});

@@ -340,3 +347,4 @@ const pathname2 = joinPaths([this.basepath, interpolatedPath]);

leaveWildcards: false,
leaveParams: opts.leaveParams
leaveParams: opts.leaveParams,
decodeCharMap: this.pathParamsDecodeCharMap
});

@@ -1519,3 +1527,4 @@ let search = fromSearch;

path: route.fullPath,
params: routeParams
params: routeParams,
decodeCharMap: this.pathParamsDecodeCharMap
});

@@ -1525,3 +1534,4 @@ const matchId = interpolatePath({

params: routeParams,
leaveWildcards: true
leaveWildcards: true,
decodeCharMap: this.pathParamsDecodeCharMap
}) + loaderDepsHash;

@@ -1528,0 +1538,0 @@ const existingMatch = this.getMatch(matchId);

{
"name": "@tanstack/react-router",
"version": "1.78.3",
"version": "1.79.0",
"description": "Modern and scalable routing for React applications",

@@ -58,3 +58,3 @@ "author": "Tanner Linsley",

"devDependencies": {
"@testing-library/jest-dom": "^6.6.2",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",

@@ -70,3 +70,3 @@ "@vitejs/plugin-react": "^4.3.3",

"react-dom": ">=18",
"@tanstack/router-generator": "1.78.3"
"@tanstack/router-generator": "1.79.0"
},

@@ -73,0 +73,0 @@ "peerDependenciesMeta": {

@@ -207,2 +207,4 @@ import { last } from './utils'

leaveParams?: boolean
// Map of encoded chars to decoded chars (e.g. '%40' -> '@') that should remain decoded in path params
decodeCharMap?: Map<string, string>
}

@@ -215,2 +217,3 @@

leaveParams,
decodeCharMap,
}: InterpolatePathOptions) {

@@ -227,3 +230,5 @@ const interpolatedPathSegments = parsePathname(path)

} else {
encodedParams[key] = isValueString ? encodeURIComponent(value) : value
encodedParams[key] = isValueString
? encodePathParam(value, decodeCharMap)
: value
}

@@ -253,2 +258,12 @@ }

function encodePathParam(value: string, decodeCharMap?: Map<string, string>) {
let encoded = encodeURIComponent(value)
if (decodeCharMap) {
for (const [encodedChar, char] of decodeCharMap) {
encoded = encoded.replaceAll(encodedChar, char)
}
}
return encoded
}
export function matchPathname(

@@ -255,0 +270,0 @@ basepath: string,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc