@tanstack/router-generator 1.7.0 → 1.8.0

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.
@@ -1,324 +0,0 @@
1
- /**
2
- * @tanstack/router-generator/src/index.ts
3
- *
4
- * Copyright (c) TanStack
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
- import path from 'path';
12
- import { existsSync, readFileSync } from 'fs';
13
- import { z } from 'zod';
14
- import * as fs from 'fs/promises';
15
- import * as prettier from 'prettier';
16
-
17
- const configSchema = z.object({
18
- routeFilePrefix: z.string().optional(),
19
- routeFileIgnorePrefix: z.string().optional().default('-'),
20
- routesDirectory: z.string().optional().default('./src/routes'),
21
- generatedRouteTree: z.string().optional().default('./src/routeTree.gen.ts'),
22
- quoteStyle: z.enum(['single', 'double']).optional().default('single'),
23
- disableTypes: z.boolean().optional().default(false)
24
- });
25
- const configFilePathJson = path.resolve(process.cwd(), 'tsr.config.json');
26
- async function getConfig() {
27
- const exists = existsSync(configFilePathJson);
28
- let config;
29
- if (exists) {
30
- config = configSchema.parse(JSON.parse(readFileSync(configFilePathJson, 'utf-8')));
31
- } else {
32
- config = configSchema.parse({});
33
- }
34
-
35
- // If typescript is disabled, make sure the generated route tree is a .js file
36
- if (config.disableTypes) {
37
- config.generatedRouteTree = config.generatedRouteTree.replace(/\.(ts|tsx)$/, '.js');
38
- }
39
- return config;
40
- }
41
-
42
- function cleanPath(path) {
43
- // remove double slashes
44
- return path.replace(/\/{2,}/g, '/');
45
- }
46
- function trimPathLeft(path) {
47
- return path === '/' ? path : path.replace(/^\/{1,}/, '');
48
- }
49
-
50
- let latestTask = 0;
51
- const rootPathId = '__root';
52
- async function getRouteNodes(config) {
53
- const {
54
- routeFilePrefix,
55
- routeFileIgnorePrefix
56
- } = config;
57
- let routeNodes = [];
58
- async function recurse(dir) {
59
- const fullDir = path.resolve(config.routesDirectory, dir);
60
- let dirList = await fs.readdir(fullDir, {
61
- withFileTypes: true
62
- });
63
- dirList = dirList.filter(d => {
64
- if (d.name.startsWith('.') || routeFileIgnorePrefix && d.name.startsWith(routeFileIgnorePrefix)) {
65
- return false;
66
- }
67
- if (routeFilePrefix) {
68
- return d.name.startsWith(routeFilePrefix);
69
- }
70
- return true;
71
- });
72
- await Promise.all(dirList.map(async dirent => {
73
- const fullPath = path.join(fullDir, dirent.name);
74
- const relativePath = path.join(dir, dirent.name);
75
- if (dirent.isDirectory()) {
76
- await recurse(relativePath);
77
- } else if (fullPath.match(/\.(tsx|ts|jsx|js)$/)) {
78
- const filePath = replaceBackslash(path.join(dir, dirent.name));
79
- const filePathNoExt = removeExt(filePath);
80
- let routePath = cleanPath(`/${filePathNoExt.split('.').join('/')}`) || '';
81
- const variableName = routePathToVariable(routePath);
82
-
83
- // Remove the index from the route path and
84
- // if the route path is empty, use `/'
85
-
86
- let isRoute = routePath?.endsWith('/route');
87
- let isComponent = routePath?.endsWith('/component');
88
- let isErrorComponent = routePath?.endsWith('/errorComponent');
89
- let isPendingComponent = routePath?.endsWith('/pendingComponent');
90
- let isLoader = routePath?.endsWith('/loader');
91
- routePath = routePath?.replace(/\/(component|errorComponent|pendingComponent|loader|route)$/, '');
92
- if (routePath === 'index') {
93
- routePath = '/';
94
- }
95
- routePath = routePath.replace(/\/index$/, '/') || '/';
96
- routeNodes.push({
97
- filePath,
98
- fullPath,
99
- routePath,
100
- variableName,
101
- isRoute,
102
- isComponent,
103
- isErrorComponent,
104
- isPendingComponent,
105
- isLoader
106
- });
107
- }
108
- }));
109
- return routeNodes;
110
- }
111
- await recurse('./');
112
- return routeNodes;
113
- }
114
- let first = false;
115
- let skipMessage = false;
116
- async function generator(config) {
117
- console.log();
118
- if (!first) {
119
- console.log('🔄 Generating routes...');
120
- first = true;
121
- } else if (skipMessage) {
122
- skipMessage = false;
123
- } else {
124
- console.log('♻️ Regenerating routes...');
125
- }
126
- const taskId = latestTask + 1;
127
- latestTask = taskId;
128
- const checkLatest = () => {
129
- if (latestTask !== taskId) {
130
- skipMessage = true;
131
- return false;
132
- }
133
- return true;
134
- };
135
- const start = Date.now();
136
- const routePathIdPrefix = config.routeFilePrefix ?? '';
137
- const preRouteNodes = multiSortBy(await getRouteNodes(config), [d => d.routePath === '/' ? -1 : 1, d => d.routePath?.split('/').length, d => d.filePath?.match(/[./]index[.]/) ? 1 : -1, d => d.filePath?.match(/[./](component|errorComponent|pendingComponent|loader)[.]/) ? 1 : -1, d => d.filePath?.match(/[./]route[.]/) ? -1 : 1, d => d.routePath?.endsWith('/') ? -1 : 1, d => d.routePath]).filter(d => ![`/${routePathIdPrefix + rootPathId}`].includes(d.routePath || ''));
138
- const routeTree = [];
139
- const routePiecesByPath = {};
140
-
141
- // Loop over the flat list of routeNodes and
142
- // build up a tree based on the routeNodes' routePath
143
- let routeNodes = [];
144
- const handleNode = node => {
145
- const parentRoute = hasParentRoute(routeNodes, node.routePath);
146
- if (parentRoute) node.parent = parentRoute;
147
- node.path = node.parent ? node.routePath?.replace(node.parent.routePath, '') || '/' : node.routePath;
148
- const trimmedPath = trimPathLeft(node.path ?? '');
149
- const split = trimmedPath?.split('/') ?? [];
150
- let first = split[0] ?? trimmedPath ?? '';
151
- node.isNonPath = first.startsWith('_');
152
- node.isNonLayout = first.endsWith('_');
153
- node.cleanedPath = removeUnderscores(node.path) ?? '';
154
- if (!node.isVirtual && (node.isLoader || node.isComponent || node.isErrorComponent || node.isPendingComponent)) {
155
- routePiecesByPath[node.routePath] = routePiecesByPath[node.routePath] || {};
156
- routePiecesByPath[node.routePath][node.isLoader ? 'loader' : node.isErrorComponent ? 'errorComponent' : node.isPendingComponent ? 'pendingComponent' : 'component'] = node;
157
- const anchorRoute = routeNodes.find(d => d.routePath === node.routePath);
158
- if (!anchorRoute) {
159
- handleNode({
160
- ...node,
161
- isVirtual: true,
162
- isLoader: false,
163
- isComponent: false,
164
- isErrorComponent: false,
165
- isPendingComponent: false
166
- });
167
- }
168
- return;
169
- }
170
- if (node.parent) {
171
- node.parent.children = node.parent.children ?? [];
172
- node.parent.children.push(node);
173
- } else {
174
- routeTree.push(node);
175
- }
176
- routeNodes.push(node);
177
- };
178
- preRouteNodes.forEach(node => handleNode(node));
179
- async function buildRouteConfig(nodes, depth = 1) {
180
- const children = nodes.map(async node => {
181
- const routeCode = await fs.readFile(node.fullPath, 'utf-8');
182
-
183
- // Ensure the boilerplate for the route exists
184
- if (node.isRoot) {
185
- return;
186
- }
187
-
188
- // Ensure that new FileRoute(anything?) is replaced with FileRoute(${node.routePath})
189
- // routePath can contain $ characters, which have special meaning when used in replace
190
- // so we have to escape it by turning all $ into $$. But since we do it through a replace call
191
- // we have to double escape it into $$$$. For more information, see
192
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_the_replacement
193
- const escapedRoutePath = removeTrailingUnderscores(node.routePath?.replaceAll('$', '$$') ?? '');
194
- config.quoteStyle === 'single' ? `'` : `"`;
195
- const replaced = routeCode.replace(/(FileRoute\(\s*['"])([^\s]+)(['"](?:,?)\s*\))/g, (match, p1, p2, p3) => `${p1}${escapedRoutePath}${p3}`);
196
- if (replaced !== routeCode) {
197
- await fs.writeFile(node.fullPath, replaced);
198
- }
199
- const route = `${node.variableName}Route`;
200
- if (node.children?.length) {
201
- const childConfigs = await buildRouteConfig(node.children, depth + 1);
202
- return `${route}.addChildren([${spaces(depth * 4)}${childConfigs}])`;
203
- }
204
- return route;
205
- });
206
- return (await Promise.all(children)).filter(Boolean).join(`,`);
207
- }
208
- const routeConfigChildrenText = await buildRouteConfig(routeTree);
209
- const sortedRouteNodes = multiSortBy(routeNodes, [d => d.routePath?.includes(`/${routePathIdPrefix + rootPathId}`) ? -1 : 1, d => d.routePath?.split('/').length, d => d.routePath?.endsWith("index'") ? -1 : 1, d => d]);
210
- const imports = Object.entries({
211
- FileRoute: sortedRouteNodes.some(d => d.isVirtual),
212
- lazyFn: sortedRouteNodes.some(node => routePiecesByPath[node.routePath]?.loader),
213
- lazyRouteComponent: sortedRouteNodes.some(node => routePiecesByPath[node.routePath]?.component || routePiecesByPath[node.routePath]?.errorComponent || routePiecesByPath[node.routePath]?.pendingComponent)
214
- }).filter(d => d[1]).map(d => d[0]);
215
- const virtualRouteNodes = sortedRouteNodes.filter(d => d.isVirtual);
216
- const routeImports = ['// This file is auto-generated by TanStack Router', imports.length ? `import { ${imports.join(', ')} } from '@tanstack/react-router'\n` : '', '// Import Routes', [`import { Route as rootRoute } from './${replaceBackslash(path.relative(path.dirname(config.generatedRouteTree), path.resolve(config.routesDirectory, routePathIdPrefix + rootPathId)))}'`, ...sortedRouteNodes.filter(d => !d.isVirtual).map(node => {
217
- return `import { Route as ${node.variableName}Import } from './${replaceBackslash(removeExt(path.relative(path.dirname(config.generatedRouteTree), path.resolve(config.routesDirectory, node.filePath))))}'`;
218
- })].join('\n'), virtualRouteNodes.length ? '// Create Virtual Routes' : '', virtualRouteNodes.map(node => {
219
- return `const ${node.variableName}Import = new FileRoute('${removeTrailingUnderscores(node.routePath)}').createRoute()`;
220
- }).join('\n'), '// Create/Update Routes', sortedRouteNodes.map(node => {
221
- const loaderNode = routePiecesByPath[node.routePath]?.loader;
222
- const componentNode = routePiecesByPath[node.routePath]?.component;
223
- const errorComponentNode = routePiecesByPath[node.routePath]?.errorComponent;
224
- const pendingComponentNode = routePiecesByPath[node.routePath]?.pendingComponent;
225
- return [`const ${node.variableName}Route = ${node.variableName}Import.update({
226
- ${[node.isNonPath ? `id: '${node.path}'` : `path: '${node.cleanedPath}'`, `getParentRoute: () => ${node.parent?.variableName ?? 'root'}Route`].filter(Boolean).join(',')}
227
- }${config.disableTypes ? '' : 'as any'})`, loaderNode ? `.updateLoader({ loader: lazyFn(() => import('./${replaceBackslash(removeExt(path.relative(path.dirname(config.generatedRouteTree), path.resolve(config.routesDirectory, loaderNode.filePath))))}'), 'loader') })` : '', componentNode || errorComponentNode || pendingComponentNode ? `.update({
228
- ${[['component', componentNode], ['errorComponent', errorComponentNode], ['pendingComponent', pendingComponentNode]].filter(d => d[1]).map(d => {
229
- return `${d[0]}: lazyRouteComponent(() => import('./${replaceBackslash(removeExt(path.relative(path.dirname(config.generatedRouteTree), path.resolve(config.routesDirectory, d[1].filePath))))}'), '${d[0]}')`;
230
- }).join('\n,')}
231
- })` : ''].join('');
232
- }).join('\n\n'), ...(config.disableTypes ? [] : ['// Populate the FileRoutesByPath interface', `declare module '@tanstack/react-router' {
233
- interface FileRoutesByPath {
234
- ${routeNodes.map(routeNode => {
235
- return `'${removeTrailingUnderscores(routeNode.routePath)}': {
236
- preLoaderRoute: typeof ${routeNode.variableName}Import
237
- parentRoute: typeof ${routeNode.parent?.variableName ? `${routeNode.parent?.variableName}Import` : 'rootRoute'}
238
- }`;
239
- }).join('\n')}
240
- }
241
- }`]), '// Create and export the route tree', `export const routeTree = rootRoute.addChildren([${routeConfigChildrenText}])`].filter(Boolean).join('\n\n');
242
- const routeConfigFileContent = await prettier.format(routeImports, {
243
- semi: false,
244
- singleQuote: config.quoteStyle === 'single',
245
- parser: 'typescript'
246
- });
247
- const routeTreeContent = await fs.readFile(path.resolve(config.generatedRouteTree), 'utf-8').catch(err => {
248
- if (err.code === 'ENOENT') {
249
- return undefined;
250
- }
251
- throw err;
252
- });
253
- if (!checkLatest()) return;
254
- if (routeTreeContent !== routeConfigFileContent) {
255
- await fs.mkdir(path.dirname(path.resolve(config.generatedRouteTree)), {
256
- recursive: true
257
- });
258
- if (!checkLatest()) return;
259
- await fs.writeFile(path.resolve(config.generatedRouteTree), routeConfigFileContent);
260
- }
261
- console.log(`🌲 Processed ${routeNodes.length} routes in ${Date.now() - start}ms`);
262
- }
263
- function routePathToVariable(d) {
264
- return removeUnderscores(d)?.replace(/\/\$\//g, '/splat/')?.replace(/\$$/g, 'splat')?.replace(/\$/g, '')?.split(/[/-]/g).map((d, i) => i > 0 ? capitalize(d) : d).join('').replace(/([^a-zA-Z0-9]|[\.])/gm, '') ?? '';
265
- }
266
- function removeExt(d) {
267
- return d.substring(0, d.lastIndexOf('.')) || d;
268
- }
269
- function spaces(d) {
270
- return Array.from({
271
- length: d
272
- }).map(() => ' ').join('');
273
- }
274
- function multiSortBy(arr, accessors = [d => d]) {
275
- return arr.map((d, i) => [d, i]).sort(([a, ai], [b, bi]) => {
276
- for (const accessor of accessors) {
277
- const ao = accessor(a);
278
- const bo = accessor(b);
279
- if (typeof ao === 'undefined') {
280
- if (typeof bo === 'undefined') {
281
- continue;
282
- }
283
- return 1;
284
- }
285
- if (ao === bo) {
286
- continue;
287
- }
288
- return ao > bo ? 1 : -1;
289
- }
290
- return ai - bi;
291
- }).map(([d]) => d);
292
- }
293
- function capitalize(s) {
294
- if (typeof s !== 'string') return '';
295
- return s.charAt(0).toUpperCase() + s.slice(1);
296
- }
297
- function removeUnderscores(s) {
298
- return s?.replace(/(^_|_$)/, '').replace(/(\/_|_\/)/, '/');
299
- }
300
- function removeTrailingUnderscores(s) {
301
- return s?.replace(/(_$)/, '').replace(/(_\/)/, '/');
302
- }
303
- function replaceBackslash(s) {
304
- return s.replace(/\\/gi, '/');
305
- }
306
- function hasParentRoute(routes, routePathToCheck) {
307
- if (!routePathToCheck || routePathToCheck === '/') {
308
- return null;
309
- }
310
- const sortedNodes = multiSortBy(routes, [d => d.routePath.length * -1, d => d.variableName]).filter(d => d.routePath !== `/${rootPathId}`);
311
- for (const route of sortedNodes) {
312
- if (route.routePath === '/') continue;
313
- if (routePathToCheck.startsWith(`${route.routePath}/`) && route.routePath !== routePathToCheck) {
314
- return route;
315
- }
316
- }
317
- const segments = routePathToCheck.split('/');
318
- segments.pop(); // Remove the last segment
319
- const parentRoutePath = segments.join('/');
320
- return hasParentRoute(routes, parentRoutePath);
321
- }
322
-
323
- export { configSchema, generator, getConfig };
324
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../src/config.ts","../../src/utils.ts","../../src/generator.ts"],"sourcesContent":["import path from 'path'\nimport { readFileSync, existsSync } from 'fs'\nimport { z } from 'zod'\n\nexport const configSchema = z.object({\n routeFilePrefix: z.string().optional(),\n routeFileIgnorePrefix: z.string().optional().default('-'),\n routesDirectory: z.string().optional().default('./src/routes'),\n generatedRouteTree: z.string().optional().default('./src/routeTree.gen.ts'),\n quoteStyle: z.enum(['single', 'double']).optional().default('single'),\n disableTypes: z.boolean().optional().default(false),\n})\n\nexport type Config = z.infer<typeof configSchema>\n\nconst configFilePathJson = path.resolve(process.cwd(), 'tsr.config.json')\n\nexport async function getConfig(): Promise<Config> {\n const exists = existsSync(configFilePathJson)\n\n let config: Config\n\n if (exists) {\n config = configSchema.parse(\n JSON.parse(readFileSync(configFilePathJson, 'utf-8')),\n )\n } else {\n config = configSchema.parse({})\n }\n\n // If typescript is disabled, make sure the generated route tree is a .js file\n if (config.disableTypes) {\n config.generatedRouteTree = config.generatedRouteTree.replace(\n /\\.(ts|tsx)$/,\n '.js',\n )\n }\n\n return config\n}\n","export function cleanPath(path: string) {\n // remove double slashes\n return path.replace(/\\/{2,}/g, '/')\n}\n\nexport function trimPathLeft(path: string) {\n return path === '/' ? path : path.replace(/^\\/{1,}/, '')\n}\n","import path from 'path'\nimport * as fs from 'fs/promises'\nimport * as prettier from 'prettier'\nimport { Config } from './config'\nimport { cleanPath, trimPathLeft } from './utils'\n\nlet latestTask = 0\nexport const rootPathId = '__root'\n\nexport type RouteNode = {\n filePath: string\n fullPath: string\n variableName: string\n routePath?: string\n cleanedPath?: string\n path?: string\n isNonPath?: boolean\n isNonLayout?: boolean\n isRoute?: boolean\n isLoader?: boolean\n isComponent?: boolean\n isErrorComponent?: boolean\n isPendingComponent?: boolean\n isVirtual?: boolean\n isRoot?: boolean\n children?: RouteNode[]\n parent?: RouteNode\n}\n\nasync function getRouteNodes(config: Config) {\n const { routeFilePrefix, routeFileIgnorePrefix } = config\n\n let routeNodes: RouteNode[] = []\n\n async function recurse(dir: string) {\n const fullDir = path.resolve(config.routesDirectory, dir)\n let dirList = await fs.readdir(fullDir, { withFileTypes: true })\n\n dirList = dirList.filter((d) => {\n if (\n d.name.startsWith('.') ||\n (routeFileIgnorePrefix && d.name.startsWith(routeFileIgnorePrefix))\n ) {\n return false\n }\n\n if (routeFilePrefix) {\n return d.name.startsWith(routeFilePrefix)\n }\n\n return true\n })\n\n await Promise.all(\n dirList.map(async (dirent) => {\n const fullPath = path.join(fullDir, dirent.name)\n const relativePath = path.join(dir, dirent.name)\n\n if (dirent.isDirectory()) {\n await recurse(relativePath)\n } else if (fullPath.match(/\\.(tsx|ts|jsx|js)$/)) {\n const filePath = replaceBackslash(path.join(dir, dirent.name))\n const filePathNoExt = removeExt(filePath)\n let routePath =\n cleanPath(`/${filePathNoExt.split('.').join('/')}`) || ''\n const variableName = routePathToVariable(routePath)\n\n // Remove the index from the route path and\n // if the route path is empty, use `/'\n\n let isRoute = routePath?.endsWith('/route')\n let isComponent = routePath?.endsWith('/component')\n let isErrorComponent = routePath?.endsWith('/errorComponent')\n let isPendingComponent = routePath?.endsWith('/pendingComponent')\n let isLoader = routePath?.endsWith('/loader')\n\n routePath = routePath?.replace(\n /\\/(component|errorComponent|pendingComponent|loader|route)$/,\n '',\n )\n\n if (routePath === 'index') {\n routePath = '/'\n }\n\n routePath = routePath.replace(/\\/index$/, '/') || '/'\n\n routeNodes.push({\n filePath,\n fullPath,\n routePath,\n variableName,\n isRoute,\n isComponent,\n isErrorComponent,\n isPendingComponent,\n isLoader,\n })\n }\n }),\n )\n\n return routeNodes\n }\n\n await recurse('./')\n\n return routeNodes\n}\n\nlet first = false\nlet skipMessage = false\n\ntype RouteSubNode = {\n component?: RouteNode\n errorComponent?: RouteNode\n pendingComponent?: RouteNode\n loader?: RouteNode\n}\n\nexport async function generator(config: Config) {\n console.log()\n\n if (!first) {\n console.log('🔄 Generating routes...')\n first = true\n } else if (skipMessage) {\n skipMessage = false\n } else {\n console.log('♻️ Regenerating routes...')\n }\n\n const taskId = latestTask + 1\n latestTask = taskId\n\n const checkLatest = () => {\n if (latestTask !== taskId) {\n skipMessage = true\n return false\n }\n\n return true\n }\n\n const start = Date.now()\n const routePathIdPrefix = config.routeFilePrefix ?? ''\n\n const preRouteNodes = multiSortBy(await getRouteNodes(config), [\n (d) => (d.routePath === '/' ? -1 : 1),\n (d) => d.routePath?.split('/').length,\n (d) => (d.filePath?.match(/[./]index[.]/) ? 1 : -1),\n (d) =>\n d.filePath?.match(\n /[./](component|errorComponent|pendingComponent|loader)[.]/,\n )\n ? 1\n : -1,\n (d) => (d.filePath?.match(/[./]route[.]/) ? -1 : 1),\n (d) => (d.routePath?.endsWith('/') ? -1 : 1),\n (d) => d.routePath,\n ]).filter(\n (d) => ![`/${routePathIdPrefix + rootPathId}`].includes(d.routePath || ''),\n )\n\n const routeTree: RouteNode[] = []\n const routePiecesByPath: Record<string, RouteSubNode> = {}\n\n // Loop over the flat list of routeNodes and\n // build up a tree based on the routeNodes' routePath\n let routeNodes: RouteNode[] = []\n\n const handleNode = (node: RouteNode) => {\n const parentRoute = hasParentRoute(routeNodes, node.routePath)\n if (parentRoute) node.parent = parentRoute\n\n node.path = node.parent\n ? node.routePath?.replace(node.parent.routePath!, '') || '/'\n : node.routePath\n\n const trimmedPath = trimPathLeft(node.path ?? '')\n\n const split = trimmedPath?.split('/') ?? []\n let first = split[0] ?? trimmedPath ?? ''\n\n node.isNonPath = first.startsWith('_')\n node.isNonLayout = first.endsWith('_')\n\n node.cleanedPath = removeUnderscores(node.path) ?? ''\n\n if (\n !node.isVirtual &&\n (node.isLoader ||\n node.isComponent ||\n node.isErrorComponent ||\n node.isPendingComponent)\n ) {\n routePiecesByPath[node.routePath!] =\n routePiecesByPath[node.routePath!] || {}\n\n routePiecesByPath[node.routePath!]![\n node.isLoader\n ? 'loader'\n : node.isErrorComponent\n ? 'errorComponent'\n : node.isPendingComponent\n ? 'pendingComponent'\n : 'component'\n ] = node\n\n const anchorRoute = routeNodes.find((d) => d.routePath === node.routePath)\n\n if (!anchorRoute) {\n handleNode({\n ...node,\n isVirtual: true,\n isLoader: false,\n isComponent: false,\n isErrorComponent: false,\n isPendingComponent: false,\n })\n }\n return\n }\n\n if (node.parent) {\n node.parent.children = node.parent.children ?? []\n node.parent.children.push(node)\n } else {\n routeTree.push(node)\n }\n\n routeNodes.push(node)\n }\n\n preRouteNodes.forEach((node) => handleNode(node))\n\n async function buildRouteConfig(\n nodes: RouteNode[],\n depth = 1,\n ): Promise<string> {\n const children = nodes.map(async (node) => {\n const routeCode = await fs.readFile(node.fullPath, 'utf-8')\n\n // Ensure the boilerplate for the route exists\n if (node.isRoot) {\n return\n }\n\n // Ensure that new FileRoute(anything?) is replaced with FileRoute(${node.routePath})\n // routePath can contain $ characters, which have special meaning when used in replace\n // so we have to escape it by turning all $ into $$. But since we do it through a replace call\n // we have to double escape it into $$$$. For more information, see\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_the_replacement\n const escapedRoutePath = removeTrailingUnderscores(\n node.routePath?.replaceAll('$', '$$') ?? '',\n )\n const quote = config.quoteStyle === 'single' ? `'` : `\"`\n const replaced = routeCode.replace(\n /(FileRoute\\(\\s*['\"])([^\\s]+)(['\"](?:,?)\\s*\\))/g,\n (match, p1, p2, p3) => `${p1}${escapedRoutePath}${p3}`,\n )\n\n if (replaced !== routeCode) {\n await fs.writeFile(node.fullPath, replaced)\n }\n\n const route = `${node.variableName}Route`\n\n if (node.children?.length) {\n const childConfigs = await buildRouteConfig(node.children, depth + 1)\n return `${route}.addChildren([${spaces(depth * 4)}${childConfigs}])`\n }\n\n return route\n })\n\n return (await Promise.all(children)).filter(Boolean).join(`,`)\n }\n\n const routeConfigChildrenText = await buildRouteConfig(routeTree)\n\n const sortedRouteNodes = multiSortBy(routeNodes, [\n (d) =>\n d.routePath?.includes(`/${routePathIdPrefix + rootPathId}`) ? -1 : 1,\n (d) => d.routePath?.split('/').length,\n (d) => (d.routePath?.endsWith(\"index'\") ? -1 : 1),\n (d) => d,\n ])\n\n const imports = Object.entries({\n FileRoute: sortedRouteNodes.some((d) => d.isVirtual),\n lazyFn: sortedRouteNodes.some(\n (node) => routePiecesByPath[node.routePath!]?.loader,\n ),\n lazyRouteComponent: sortedRouteNodes.some(\n (node) =>\n routePiecesByPath[node.routePath!]?.component ||\n routePiecesByPath[node.routePath!]?.errorComponent ||\n routePiecesByPath[node.routePath!]?.pendingComponent,\n ),\n })\n .filter((d) => d[1])\n .map((d) => d[0])\n\n const virtualRouteNodes = sortedRouteNodes.filter((d) => d.isVirtual)\n\n const routeImports = [\n '// This file is auto-generated by TanStack Router',\n imports.length\n ? `import { ${imports.join(', ')} } from '@tanstack/react-router'\\n`\n : '',\n '// Import Routes',\n [\n `import { Route as rootRoute } from './${replaceBackslash(\n path.relative(\n path.dirname(config.generatedRouteTree),\n path.resolve(config.routesDirectory, routePathIdPrefix + rootPathId),\n ),\n )}'`,\n ...sortedRouteNodes\n .filter((d) => !d.isVirtual)\n .map((node) => {\n return `import { Route as ${\n node.variableName\n }Import } from './${replaceBackslash(\n removeExt(\n path.relative(\n path.dirname(config.generatedRouteTree),\n path.resolve(config.routesDirectory, node.filePath),\n ),\n ),\n )}'`\n }),\n ].join('\\n'),\n virtualRouteNodes.length ? '// Create Virtual Routes' : '',\n virtualRouteNodes\n .map((node) => {\n return `const ${\n node.variableName\n }Import = new FileRoute('${removeTrailingUnderscores(\n node.routePath,\n )}').createRoute()`\n })\n .join('\\n'),\n '// Create/Update Routes',\n sortedRouteNodes\n .map((node) => {\n const loaderNode = routePiecesByPath[node.routePath!]?.loader\n const componentNode = routePiecesByPath[node.routePath!]?.component\n const errorComponentNode =\n routePiecesByPath[node.routePath!]?.errorComponent\n const pendingComponentNode =\n routePiecesByPath[node.routePath!]?.pendingComponent\n\n return [\n `const ${node.variableName}Route = ${node.variableName}Import.update({\n ${[\n node.isNonPath\n ? `id: '${node.path}'`\n : `path: '${node.cleanedPath}'`,\n `getParentRoute: () => ${node.parent?.variableName ?? 'root'}Route`,\n ]\n .filter(Boolean)\n .join(',')}\n }${config.disableTypes ? '' : 'as any'})`,\n loaderNode\n ? `.updateLoader({ loader: lazyFn(() => import('./${replaceBackslash(\n removeExt(\n path.relative(\n path.dirname(config.generatedRouteTree),\n path.resolve(config.routesDirectory, loaderNode.filePath),\n ),\n ),\n )}'), 'loader') })`\n : '',\n componentNode || errorComponentNode || pendingComponentNode\n ? `.update({\n ${(\n [\n ['component', componentNode],\n ['errorComponent', errorComponentNode],\n ['pendingComponent', pendingComponentNode],\n ] as const\n )\n .filter((d) => d[1])\n .map((d) => {\n return `${\n d[0]\n }: lazyRouteComponent(() => import('./${replaceBackslash(\n removeExt(\n path.relative(\n path.dirname(config.generatedRouteTree),\n path.resolve(config.routesDirectory, d[1]!.filePath),\n ),\n ),\n )}'), '${d[0]}')`\n })\n .join('\\n,')}\n })`\n : '',\n ].join('')\n })\n .join('\\n\\n'),\n ...(config.disableTypes\n ? []\n : [\n '// Populate the FileRoutesByPath interface',\n `declare module '@tanstack/react-router' {\n interface FileRoutesByPath {\n ${routeNodes\n .map((routeNode) => {\n return `'${removeTrailingUnderscores(routeNode.routePath)}': {\n preLoaderRoute: typeof ${routeNode.variableName}Import\n parentRoute: typeof ${\n routeNode.parent?.variableName\n ? `${routeNode.parent?.variableName}Import`\n : 'rootRoute'\n }\n }`\n })\n .join('\\n')}\n }\n}`,\n ]),\n '// Create and export the route tree',\n `export const routeTree = rootRoute.addChildren([${routeConfigChildrenText}])`,\n ]\n .filter(Boolean)\n .join('\\n\\n')\n\n const routeConfigFileContent = await prettier.format(routeImports, {\n semi: false,\n singleQuote: config.quoteStyle === 'single',\n parser: 'typescript',\n })\n\n const routeTreeContent = await fs\n .readFile(path.resolve(config.generatedRouteTree), 'utf-8')\n .catch((err: any) => {\n if (err.code === 'ENOENT') {\n return undefined\n }\n throw err\n })\n\n if (!checkLatest()) return\n\n if (routeTreeContent !== routeConfigFileContent) {\n await fs.mkdir(path.dirname(path.resolve(config.generatedRouteTree)), {\n recursive: true,\n })\n if (!checkLatest()) return\n await fs.writeFile(\n path.resolve(config.generatedRouteTree),\n routeConfigFileContent,\n )\n }\n\n console.log(\n `🌲 Processed ${routeNodes.length} routes in ${Date.now() - start}ms`,\n )\n}\n\nfunction routePathToVariable(d: string): string {\n return (\n removeUnderscores(d)\n ?.replace(/\\/\\$\\//g, '/splat/')\n ?.replace(/\\$$/g, 'splat')\n ?.replace(/\\$/g, '')\n ?.split(/[/-]/g)\n .map((d, i) => (i > 0 ? capitalize(d) : d))\n .join('')\n .replace(/([^a-zA-Z0-9]|[\\.])/gm, '') ?? ''\n )\n}\n\nexport function removeExt(d: string) {\n return d.substring(0, d.lastIndexOf('.')) || d\n}\n\nfunction spaces(d: number): string {\n return Array.from({ length: d })\n .map(() => ' ')\n .join('')\n}\n\nexport function multiSortBy<T>(\n arr: T[],\n accessors: ((item: T) => any)[] = [(d) => d],\n): T[] {\n return arr\n .map((d, i) => [d, i] as const)\n .sort(([a, ai], [b, bi]) => {\n for (const accessor of accessors) {\n const ao = accessor(a)\n const bo = accessor(b)\n\n if (typeof ao === 'undefined') {\n if (typeof bo === 'undefined') {\n continue\n }\n return 1\n }\n\n if (ao === bo) {\n continue\n }\n\n return ao > bo ? 1 : -1\n }\n\n return ai - bi\n })\n .map(([d]) => d)\n}\n\nfunction capitalize(s: string) {\n if (typeof s !== 'string') return ''\n return s.charAt(0).toUpperCase() + s.slice(1)\n}\n\nfunction removeUnderscores(s?: string) {\n return s?.replace(/(^_|_$)/, '').replace(/(\\/_|_\\/)/, '/')\n}\n\nfunction removeTrailingUnderscores(s?: string) {\n return s?.replace(/(_$)/, '').replace(/(_\\/)/, '/')\n}\n\nfunction replaceBackslash(s: string) {\n return s.replace(/\\\\/gi, '/')\n}\n\nexport function hasParentRoute(\n routes: RouteNode[],\n routePathToCheck: string | undefined,\n): RouteNode | null {\n if (!routePathToCheck || routePathToCheck === '/') {\n return null\n }\n\n const sortedNodes = multiSortBy(routes, [\n (d) => d.routePath!.length * -1,\n (d) => d.variableName,\n ]).filter((d) => d.routePath !== `/${rootPathId}`)\n\n for (const route of sortedNodes) {\n if (route.routePath === '/') continue\n\n if (\n routePathToCheck.startsWith(`${route.routePath}/`) &&\n route.routePath !== routePathToCheck\n ) {\n return route\n }\n }\n const segments = routePathToCheck.split('/')\n segments.pop() // Remove the last segment\n const parentRoutePath = segments.join('/')\n\n return hasParentRoute(routes, parentRoutePath)\n}\n"],"names":["configSchema","z","object","routeFilePrefix","string","optional","routeFileIgnorePrefix","default","routesDirectory","generatedRouteTree","quoteStyle","enum","disableTypes","boolean","configFilePathJson","path","resolve","process","cwd","getConfig","exists","existsSync","config","parse","JSON","readFileSync","replace","cleanPath","trimPathLeft","latestTask","rootPathId","getRouteNodes","routeNodes","recurse","dir","fullDir","dirList","fs","readdir","withFileTypes","filter","d","name","startsWith","Promise","all","map","dirent","fullPath","join","relativePath","isDirectory","match","filePath","replaceBackslash","filePathNoExt","removeExt","routePath","split","variableName","routePathToVariable","isRoute","endsWith","isComponent","isErrorComponent","isPendingComponent","isLoader","push","first","skipMessage","generator","console","log","taskId","checkLatest","start","Date","now","routePathIdPrefix","preRouteNodes","multiSortBy","length","includes","routeTree","routePiecesByPath","handleNode","node","parentRoute","hasParentRoute","parent","trimmedPath","isNonPath","isNonLayout","cleanedPath","removeUnderscores","isVirtual","anchorRoute","find","children","forEach","buildRouteConfig","nodes","depth","routeCode","readFile","isRoot","escapedRoutePath","removeTrailingUnderscores","replaceAll","replaced","p1","p2","p3","writeFile","route","childConfigs","spaces","Boolean","routeConfigChildrenText","sortedRouteNodes","imports","Object","entries","FileRoute","some","lazyFn","loader","lazyRouteComponent","component","errorComponent","pendingComponent","virtualRouteNodes","routeImports","relative","dirname","loaderNode","componentNode","errorComponentNode","pendingComponentNode","routeNode","routeConfigFileContent","prettier","format","semi","singleQuote","parser","routeTreeContent","catch","err","code","undefined","mkdir","recursive","i","capitalize","substring","lastIndexOf","Array","from","arr","accessors","sort","a","ai","b","bi","accessor","ao","bo","s","charAt","toUpperCase","slice","routes","routePathToCheck","sortedNodes","segments","pop","parentRoutePath"],"mappings":";;;;;;;;;;;;;;;;MAIaA,YAAY,GAAGC,CAAC,CAACC,MAAM,CAAC;EACnCC,eAAe,EAAEF,CAAC,CAACG,MAAM,EAAE,CAACC,QAAQ,EAAE;AACtCC,EAAAA,qBAAqB,EAAEL,CAAC,CAACG,MAAM,EAAE,CAACC,QAAQ,EAAE,CAACE,OAAO,CAAC,GAAG,CAAC;AACzDC,EAAAA,eAAe,EAAEP,CAAC,CAACG,MAAM,EAAE,CAACC,QAAQ,EAAE,CAACE,OAAO,CAAC,cAAc,CAAC;AAC9DE,EAAAA,kBAAkB,EAAER,CAAC,CAACG,MAAM,EAAE,CAACC,QAAQ,EAAE,CAACE,OAAO,CAAC,wBAAwB,CAAC;AAC3EG,EAAAA,UAAU,EAAET,CAAC,CAACU,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAACN,QAAQ,EAAE,CAACE,OAAO,CAAC,QAAQ,CAAC;AACrEK,EAAAA,YAAY,EAAEX,CAAC,CAACY,OAAO,EAAE,CAACR,QAAQ,EAAE,CAACE,OAAO,CAAC,KAAK,CAAA;AACpD,CAAC,EAAC;AAIF,MAAMO,kBAAkB,GAAGC,IAAI,CAACC,OAAO,CAACC,OAAO,CAACC,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAA;AAElE,eAAeC,SAASA,GAAoB;AACjD,EAAA,MAAMC,MAAM,GAAGC,UAAU,CAACP,kBAAkB,CAAC,CAAA;AAE7C,EAAA,IAAIQ,MAAc,CAAA;AAElB,EAAA,IAAIF,MAAM,EAAE;AACVE,IAAAA,MAAM,GAAGtB,YAAY,CAACuB,KAAK,CACzBC,IAAI,CAACD,KAAK,CAACE,YAAY,CAACX,kBAAkB,EAAE,OAAO,CAAC,CACtD,CAAC,CAAA;AACH,GAAC,MAAM;AACLQ,IAAAA,MAAM,GAAGtB,YAAY,CAACuB,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