@tanstack/router-generator
Advanced tools
Comparing version 1.16.0 to 1.16.1
@@ -24,4 +24,4 @@ import { Config } from './config.js'; | ||
export declare function generator(config: Config): Promise<void>; | ||
export declare function removeExt(d: string, enabled?: boolean): string; | ||
export declare function removeExt(d: string, keepExtension?: boolean): string; | ||
export declare function multiSortBy<T>(arr: T[], accessors?: ((item: T) => any)[]): T[]; | ||
export declare function hasParentRoute(routes: RouteNode[], routePathToCheck: string | undefined): RouteNode | null; |
@@ -109,3 +109,5 @@ import path from "path"; | ||
const routePathIdPrefix = config.routeFilePrefix ?? ""; | ||
const preRouteNodes = multiSortBy(await getRouteNodes(config), [ | ||
const beforeRouteNodes = await getRouteNodes(config); | ||
const rootRouteNode = beforeRouteNodes.find((d) => d.routePath === `/${rootPathId}`); | ||
const preRouteNodes = multiSortBy(beforeRouteNodes, [ | ||
(d) => d.routePath === "/" ? -1 : 1, | ||
@@ -261,9 +263,3 @@ (d) => { | ||
const virtualRouteNodes = sortedRouteNodes.filter((d) => d.isVirtual); | ||
const rootPath = routeNodes.find( | ||
(d) => { | ||
var _a; | ||
return (_a = d.routePath) == null ? void 0 : _a.includes(`/${rootPathId}`); | ||
} | ||
); | ||
const rootPathIdExtension = config.addExtensions ? rootPath == null ? void 0 : rootPath.filePath.substring(rootPath == null ? void 0 : rootPath.filePath.lastIndexOf(".")) : ""; | ||
const rootPathIdExtension = config.addExtensions && rootRouteNode ? path.extname(rootRouteNode.filePath) : ""; | ||
const routeImports = [ | ||
@@ -411,4 +407,4 @@ "/* prettier-ignore-start */", | ||
} | ||
function removeExt(d, enabled = true) { | ||
return enabled ? d.substring(0, d.lastIndexOf(".")) || d : d; | ||
function removeExt(d, keepExtension = false) { | ||
return keepExtension ? d : d.substring(0, d.lastIndexOf(".")) || d; | ||
} | ||
@@ -415,0 +411,0 @@ function spaces(d) { |
{ | ||
"name": "@tanstack/router-generator", | ||
"version": "1.16.0", | ||
"version": "1.16.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "Tanner Linsley", |
@@ -177,4 +177,6 @@ import path from 'path' | ||
const routePathIdPrefix = config.routeFilePrefix ?? '' | ||
const beforeRouteNodes = await getRouteNodes(config) | ||
const rootRouteNode = beforeRouteNodes.find((d) => d.routePath === `/${rootPathId}`) | ||
const preRouteNodes = multiSortBy(await getRouteNodes(config), [ | ||
const preRouteNodes = multiSortBy(beforeRouteNodes, [ | ||
(d) => (d.routePath === '/' ? -1 : 1), | ||
@@ -369,10 +371,7 @@ (d) => d.routePath?.split('/').length, | ||
const rootPath = routeNodes.find((d) => | ||
d.routePath?.includes(`/${rootPathId}`), | ||
) | ||
const rootPathIdExtension = | ||
config.addExtensions && rootRouteNode | ||
? path.extname(rootRouteNode.filePath) | ||
: '' | ||
const rootPathIdExtension = config.addExtensions | ||
? rootPath?.filePath.substring(rootPath?.filePath.lastIndexOf('.')) | ||
: '' | ||
const routeImports = [ | ||
@@ -577,4 +576,4 @@ '/* prettier-ignore-start */', | ||
export function removeExt(d: string, enabled: boolean = true) { | ||
return enabled ? d.substring(0, d.lastIndexOf('.')) || d : d | ||
export function removeExt(d: string, keepExtension: boolean = false) { | ||
return keepExtension ? d : d.substring(0, d.lastIndexOf('.')) || d | ||
} | ||
@@ -581,0 +580,0 @@ |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
135364
1761