@tanstack/router-generator
Advanced tools
Comparing version 1.16.5 to 1.18.0
@@ -6,2 +6,3 @@ import { z } from 'zod'; | ||
routesDirectory: z.ZodDefault<z.ZodOptional<z.ZodString>>; | ||
routeGroupPattern: z.ZodDefault<z.ZodOptional<z.ZodString>>; | ||
generatedRouteTree: z.ZodDefault<z.ZodOptional<z.ZodString>>; | ||
@@ -14,2 +15,3 @@ quoteStyle: z.ZodDefault<z.ZodOptional<z.ZodEnum<["single", "double"]>>>; | ||
routesDirectory: string; | ||
routeGroupPattern: string; | ||
generatedRouteTree: string; | ||
@@ -24,2 +26,3 @@ quoteStyle: "single" | "double"; | ||
routesDirectory?: string | undefined; | ||
routeGroupPattern?: string | undefined; | ||
generatedRouteTree?: string | undefined; | ||
@@ -26,0 +29,0 @@ quoteStyle?: "single" | "double" | undefined; |
@@ -8,2 +8,3 @@ import path from "path"; | ||
routesDirectory: z.string().optional().default("./src/routes"), | ||
routeGroupPattern: z.string().optional().default("\\(.+\\)"), | ||
generatedRouteTree: z.string().optional().default("./src/routeTree.gen.ts"), | ||
@@ -10,0 +11,0 @@ quoteStyle: z.enum(["single", "double"]).optional().default("single"), |
@@ -142,2 +142,3 @@ import path from "path"; | ||
let routeNodes = []; | ||
const routeGroupPatternRegex = new RegExp(config.routeGroupPattern, "g"); | ||
const handleNode = async (node) => { | ||
@@ -154,3 +155,6 @@ var _a, _b; | ||
node.isNonLayout = first2.endsWith("_"); | ||
node.cleanedPath = removeUnderscores(node.path) ?? ""; | ||
node.cleanedPath = removeGroups( | ||
removeUnderscores(node.path) ?? "", | ||
routeGroupPatternRegex | ||
); | ||
const routeCode = fs.readFileSync(node.fullPath, "utf-8"); | ||
@@ -448,2 +452,5 @@ const escapedRoutePath = removeTrailingUnderscores( | ||
} | ||
function removeGroups(s, rx) { | ||
return s.replaceAll(rx, "").replaceAll("//", "/"); | ||
} | ||
function hasParentRoute(routes, routePathToCheck) { | ||
@@ -450,0 +457,0 @@ if (!routePathToCheck || routePathToCheck === "/") { |
{ | ||
"name": "@tanstack/router-generator", | ||
"version": "1.16.5", | ||
"version": "1.18.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "Tanner Linsley", |
@@ -9,2 +9,3 @@ import path from 'path' | ||
routesDirectory: z.string().optional().default('./src/routes'), | ||
routeGroupPattern: z.string().optional().default('\\(.+\\)'), | ||
generatedRouteTree: z.string().optional().default('./src/routeTree.gen.ts'), | ||
@@ -11,0 +12,0 @@ quoteStyle: z.enum(['single', 'double']).optional().default('single'), |
@@ -204,2 +204,4 @@ import path from 'path' | ||
const routeGroupPatternRegex = new RegExp(config.routeGroupPattern, 'g') | ||
const handleNode = async (node: RouteNode) => { | ||
@@ -220,3 +222,6 @@ const parentRoute = hasParentRoute(routeNodes, node.routePath) | ||
node.isNonLayout = first.endsWith('_') | ||
node.cleanedPath = removeUnderscores(node.path) ?? '' | ||
node.cleanedPath = removeGroups( | ||
removeUnderscores(node.path) ?? '', | ||
routeGroupPatternRegex, | ||
) | ||
@@ -635,2 +640,6 @@ // Ensure the boilerplate for the route exists | ||
function removeGroups(s: string, rx: RegExp) { | ||
return s.replaceAll(rx, '').replaceAll('//', '/') | ||
} | ||
export function hasParentRoute( | ||
@@ -637,0 +646,0 @@ routes: RouteNode[], |
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
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
137584
1794