@tanstack/router-generator 1.52.0 → 1.55.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.
Files changed (53) hide show
  1. package/dist/cjs/config.cjs +21 -19
  2. package/dist/cjs/config.cjs.map +1 -1
  3. package/dist/cjs/config.d.cts +3 -0
  4. package/dist/cjs/filesystem/physical/getRouteNodes.cjs +125 -0
  5. package/dist/cjs/filesystem/physical/getRouteNodes.cjs.map +1 -0
  6. package/dist/cjs/filesystem/physical/getRouteNodes.d.cts +3 -0
  7. package/dist/cjs/filesystem/physical/rootPathId.cjs +5 -0
  8. package/dist/cjs/filesystem/physical/rootPathId.cjs.map +1 -0
  9. package/dist/cjs/filesystem/physical/rootPathId.d.cts +1 -0
  10. package/dist/cjs/filesystem/virtual/config.cjs +37 -0
  11. package/dist/cjs/filesystem/virtual/config.cjs.map +1 -0
  12. package/dist/cjs/filesystem/virtual/config.d.cts +3 -0
  13. package/dist/cjs/filesystem/virtual/getRouteNodes.cjs +119 -0
  14. package/dist/cjs/filesystem/virtual/getRouteNodes.cjs.map +1 -0
  15. package/dist/cjs/filesystem/virtual/getRouteNodes.d.cts +5 -0
  16. package/dist/cjs/generator.cjs +46 -191
  17. package/dist/cjs/generator.cjs.map +1 -1
  18. package/dist/cjs/generator.d.cts +1 -27
  19. package/dist/cjs/types.d.cts +27 -0
  20. package/dist/cjs/utils.cjs +54 -0
  21. package/dist/cjs/utils.cjs.map +1 -1
  22. package/dist/cjs/utils.d.cts +9 -0
  23. package/dist/esm/config.d.ts +3 -0
  24. package/dist/esm/config.js +2 -0
  25. package/dist/esm/config.js.map +1 -1
  26. package/dist/esm/filesystem/physical/getRouteNodes.d.ts +3 -0
  27. package/dist/esm/filesystem/physical/getRouteNodes.js +108 -0
  28. package/dist/esm/filesystem/physical/getRouteNodes.js.map +1 -0
  29. package/dist/esm/filesystem/physical/rootPathId.d.ts +1 -0
  30. package/dist/esm/filesystem/physical/rootPathId.js +5 -0
  31. package/dist/esm/filesystem/physical/rootPathId.js.map +1 -0
  32. package/dist/esm/filesystem/virtual/config.d.ts +3 -0
  33. package/dist/esm/filesystem/virtual/config.js +37 -0
  34. package/dist/esm/filesystem/virtual/config.js.map +1 -0
  35. package/dist/esm/filesystem/virtual/getRouteNodes.d.ts +5 -0
  36. package/dist/esm/filesystem/virtual/getRouteNodes.js +119 -0
  37. package/dist/esm/filesystem/virtual/getRouteNodes.js.map +1 -0
  38. package/dist/esm/generator.d.ts +1 -27
  39. package/dist/esm/generator.js +29 -174
  40. package/dist/esm/generator.js.map +1 -1
  41. package/dist/esm/types.d.ts +27 -0
  42. package/dist/esm/utils.d.ts +9 -0
  43. package/dist/esm/utils.js +54 -0
  44. package/dist/esm/utils.js.map +1 -1
  45. package/package.json +3 -2
  46. package/src/config.ts +2 -0
  47. package/src/filesystem/physical/getRouteNodes.ts +151 -0
  48. package/src/filesystem/physical/rootPathId.ts +1 -0
  49. package/src/filesystem/virtual/config.ts +45 -0
  50. package/src/filesystem/virtual/getRouteNodes.ts +141 -0
  51. package/src/generator.ts +46 -269
  52. package/src/types.ts +28 -0
  53. package/src/utils.ts +73 -0
@@ -1,32 +1,6 @@
1
+ import { RouteNode } from './types.cjs';
1
2
  import { Config } from './config.cjs';
2
- export declare const rootPathId = "__root";
3
- export type RouteNode = {
4
- filePath: string;
5
- fullPath: string;
6
- variableName: string;
7
- routePath?: string;
8
- cleanedPath?: string;
9
- path?: string;
10
- isNonPath?: boolean;
11
- isNonLayout?: boolean;
12
- isLayout?: boolean;
13
- isVirtualParentRequired?: boolean;
14
- isVirtualParentRoute?: boolean;
15
- isRoute?: boolean;
16
- isAPIRoute?: boolean;
17
- isLoader?: boolean;
18
- isComponent?: boolean;
19
- isErrorComponent?: boolean;
20
- isPendingComponent?: boolean;
21
- isVirtual?: boolean;
22
- isLazy?: boolean;
23
- isRoot?: boolean;
24
- children?: Array<RouteNode>;
25
- parent?: RouteNode;
26
- };
27
3
  export declare function generator(config: Config): Promise<void>;
28
- export declare function removeExt(d: string, keepExtension?: boolean): string;
29
- export declare function multiSortBy<T>(arr: Array<T>, accessors?: Array<(item: T) => any>): Array<T>;
30
4
  /**
31
5
  * Removes the last segment from a given path. Segments are considered to be separated by a '/'.
32
6
  *
@@ -0,0 +1,27 @@
1
+ export type RouteNode = {
2
+ filePath: string;
3
+ fullPath: string;
4
+ variableName: string;
5
+ routePath?: string;
6
+ cleanedPath?: string;
7
+ path?: string;
8
+ isNonPath?: boolean;
9
+ isLayout?: boolean;
10
+ isVirtualParentRequired?: boolean;
11
+ isVirtualParentRoute?: boolean;
12
+ isRoute?: boolean;
13
+ isAPIRoute?: boolean;
14
+ isLoader?: boolean;
15
+ isComponent?: boolean;
16
+ isErrorComponent?: boolean;
17
+ isPendingComponent?: boolean;
18
+ isVirtual?: boolean;
19
+ isLazy?: boolean;
20
+ isRoot?: boolean;
21
+ children?: Array<RouteNode>;
22
+ parent?: RouteNode;
23
+ };
24
+ export interface GetRouteNodesResult {
25
+ rootRouteNode?: RouteNode;
26
+ routeNodes: Array<RouteNode>;
27
+ }
@@ -1,5 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ function multiSortBy(arr, accessors = [(d) => d]) {
4
+ return arr.map((d, i) => [d, i]).sort(([a, ai], [b, bi]) => {
5
+ for (const accessor of accessors) {
6
+ const ao = accessor(a);
7
+ const bo = accessor(b);
8
+ if (typeof ao === "undefined") {
9
+ if (typeof bo === "undefined") {
10
+ continue;
11
+ }
12
+ return 1;
13
+ }
14
+ if (ao === bo) {
15
+ continue;
16
+ }
17
+ return ao > bo ? 1 : -1;
18
+ }
19
+ return ai - bi;
20
+ }).map(([d]) => d);
21
+ }
3
22
  function cleanPath(path) {
4
23
  return path.replace(/\/{2,}/g, "/");
5
24
  }
@@ -25,7 +44,42 @@ function logging(config) {
25
44
  }
26
45
  };
27
46
  }
47
+ function removeLeadingSlash(path) {
48
+ return path.replace(/^\//, "");
49
+ }
50
+ function removeTrailingSlash(s) {
51
+ return s.replace(/\/$/, "");
52
+ }
53
+ function determineInitialRoutePath(routePath) {
54
+ return cleanPath(`/${routePath.split(".").join("/")}`) || "";
55
+ }
56
+ function replaceBackslash(s) {
57
+ return s.replaceAll(/\\/gi, "/");
58
+ }
59
+ function routePathToVariable(routePath) {
60
+ var _a;
61
+ return ((_a = removeUnderscores(routePath)) == null ? void 0 : _a.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, "").replace(/^(\d)/g, "R$1")) ?? "";
62
+ }
63
+ function removeUnderscores(s) {
64
+ return s == null ? void 0 : s.replaceAll(/(^_|_$)/gi, "").replaceAll(/(\/_|_\/)/gi, "/");
65
+ }
66
+ function capitalize(s) {
67
+ if (typeof s !== "string") return "";
68
+ return s.charAt(0).toUpperCase() + s.slice(1);
69
+ }
70
+ function removeExt(d, keepExtension = false) {
71
+ return keepExtension ? d : d.substring(0, d.lastIndexOf(".")) || d;
72
+ }
73
+ exports.capitalize = capitalize;
28
74
  exports.cleanPath = cleanPath;
75
+ exports.determineInitialRoutePath = determineInitialRoutePath;
29
76
  exports.logging = logging;
77
+ exports.multiSortBy = multiSortBy;
78
+ exports.removeExt = removeExt;
79
+ exports.removeLeadingSlash = removeLeadingSlash;
80
+ exports.removeTrailingSlash = removeTrailingSlash;
81
+ exports.removeUnderscores = removeUnderscores;
82
+ exports.replaceBackslash = replaceBackslash;
83
+ exports.routePathToVariable = routePathToVariable;
30
84
  exports.trimPathLeft = trimPathLeft;
31
85
  //# sourceMappingURL=utils.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","sources":["../../src/utils.ts"],"sourcesContent":["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\nexport function logging(config: { disabled: boolean }) {\n return {\n log: (...args: Array<any>) => {\n if (!config.disabled) console['log'](...args)\n },\n debug: (...args: Array<any>) => {\n if (!config.disabled) console.debug(...args)\n },\n info: (...args: Array<any>) => {\n if (!config.disabled) console.info(...args)\n },\n warn: (...args: Array<any>) => {\n if (!config.disabled) console.warn(...args)\n },\n error: (...args: Array<any>) => {\n if (!config.disabled) console.error(...args)\n },\n }\n}\n"],"names":[],"mappings":";;AAAO,SAAS,UAAU,MAAc;AAE/B,SAAA,KAAK,QAAQ,WAAW,GAAG;AACpC;AAEO,SAAS,aAAa,MAAc;AACzC,SAAO,SAAS,MAAM,OAAO,KAAK,QAAQ,WAAW,EAAE;AACzD;AAEO,SAAS,QAAQ,QAA+B;AAC9C,SAAA;AAAA,IACL,KAAK,IAAI,SAAqB;AAC5B,UAAI,CAAC,OAAO,kBAAkB,KAAK,EAAE,GAAG,IAAI;AAAA,IAC9C;AAAA,IACA,OAAO,IAAI,SAAqB;AAC9B,UAAI,CAAC,OAAO,SAAkB,SAAA,MAAM,GAAG,IAAI;AAAA,IAC7C;AAAA,IACA,MAAM,IAAI,SAAqB;AAC7B,UAAI,CAAC,OAAO,SAAkB,SAAA,KAAK,GAAG,IAAI;AAAA,IAC5C;AAAA,IACA,MAAM,IAAI,SAAqB;AAC7B,UAAI,CAAC,OAAO,SAAkB,SAAA,KAAK,GAAG,IAAI;AAAA,IAC5C;AAAA,IACA,OAAO,IAAI,SAAqB;AAC9B,UAAI,CAAC,OAAO,SAAkB,SAAA,MAAM,GAAG,IAAI;AAAA,IAC7C;AAAA,EAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"utils.cjs","sources":["../../src/utils.ts"],"sourcesContent":["export function multiSortBy<T>(\n arr: Array<T>,\n accessors: Array<(item: T) => any> = [(d) => d],\n): Array<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\nexport 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\nexport function logging(config: { disabled: boolean }) {\n return {\n log: (...args: Array<any>) => {\n if (!config.disabled) console['log'](...args)\n },\n debug: (...args: Array<any>) => {\n if (!config.disabled) console.debug(...args)\n },\n info: (...args: Array<any>) => {\n if (!config.disabled) console.info(...args)\n },\n warn: (...args: Array<any>) => {\n if (!config.disabled) console.warn(...args)\n },\n error: (...args: Array<any>) => {\n if (!config.disabled) console.error(...args)\n },\n }\n}\n\nexport function removeLeadingSlash(path: string): string {\n return path.replace(/^\\//, '')\n}\n\nexport function removeTrailingSlash(s: string) {\n return s.replace(/\\/$/, '')\n}\n\nexport function determineInitialRoutePath(routePath: string) {\n return cleanPath(`/${routePath.split('.').join('/')}`) || ''\n}\n\nexport function replaceBackslash(s: string) {\n return s.replaceAll(/\\\\/gi, '/')\n}\n\nexport function routePathToVariable(routePath: string): string {\n return (\n removeUnderscores(routePath)\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 .replace(/^(\\d)/g, 'R$1') ?? ''\n )\n}\n\nexport function removeUnderscores(s?: string) {\n return s?.replaceAll(/(^_|_$)/gi, '').replaceAll(/(\\/_|_\\/)/gi, '/')\n}\n\nexport function capitalize(s: string) {\n if (typeof s !== 'string') return ''\n return s.charAt(0).toUpperCase() + s.slice(1)\n}\n\nexport function removeExt(d: string, keepExtension: boolean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B;AAC9B,UAAI,CAAC,OAAO,SAAkB,SAAA,MAAM,GAAG,IAAI;AAAA,IAC7C;AAAA,EAAA;AAEJ;AAEO,SAAS,mBAAmB,MAAsB;AAChD,SAAA,KAAK,QAAQ,OAAO,EAAE;AAC/B;AAEO,SAAS,oBAAoB,GAAW;AACtC,SAAA,EAAE,QAAQ,OAAO,EAAE;AAC5B;AAEO,SAAS,0BAA0B,WAAmB;AACpD,SAAA,UAAU,IAAI,UAAU,MAAM,GAAG,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK;AAC5D;AAEO,SAAS,iBAAiB,GAAW;AACnC,SAAA,EAAE,WAAW,QAAQ,GAAG;AACjC;AAEO,SAAS,oBAAoB,WAA2B;;AAC7D,WACE,uBAAkB,SAAS,MAA3B,mBACI,QAAQ,WAAW,WACpB,QAAQ,QAAQ,SAChB,QAAQ,OAAO,IACf,MAAM,SACN,IAAI,CAAC,GAAG,MAAO,IAAI,IAAI,WAAW,CAAC,IAAI,GACvC,KAAK,IACL,QAAQ,wBAAwB,IAChC,QAAQ,UAAU,WAAU;AAEnC;AAEO,SAAS,kBAAkB,GAAY;AAC5C,SAAO,uBAAG,WAAW,aAAa,IAAI,WAAW,eAAe;AAClE;AAEO,SAAS,WAAW,GAAW;AAChC,MAAA,OAAO,MAAM,SAAiB,QAAA;AAC3B,SAAA,EAAE,OAAO,CAAC,EAAE,gBAAgB,EAAE,MAAM,CAAC;AAC9C;AAEgB,SAAA,UAAU,GAAW,gBAAyB,OAAO;AAC5D,SAAA,gBAAgB,IAAI,EAAE,UAAU,GAAG,EAAE,YAAY,GAAG,CAAC,KAAK;AACnE;;;;;;;;;;;;;"}
@@ -1,3 +1,4 @@
1
+ export declare function multiSortBy<T>(arr: Array<T>, accessors?: Array<(item: T) => any>): Array<T>;
1
2
  export declare function cleanPath(path: string): string;
2
3
  export declare function trimPathLeft(path: string): string;
3
4
  export declare function logging(config: {
@@ -9,3 +10,11 @@ export declare function logging(config: {
9
10
  warn: (...args: Array<any>) => void;
10
11
  error: (...args: Array<any>) => void;
11
12
  };
13
+ export declare function removeLeadingSlash(path: string): string;
14
+ export declare function removeTrailingSlash(s: string): string;
15
+ export declare function determineInitialRoutePath(routePath: string): string;
16
+ export declare function replaceBackslash(s: string): string;
17
+ export declare function routePathToVariable(routePath: string): string;
18
+ export declare function removeUnderscores(s?: string): string | undefined;
19
+ export declare function capitalize(s: string): string;
20
+ export declare function removeExt(d: string, keepExtension?: boolean): string;
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const configSchema: z.ZodObject<{
3
+ virtualRouteConfig: z.ZodOptional<z.ZodType<import('@tanstack/virtual-file-routes').VirtualRootRoute, z.ZodTypeDef, import('@tanstack/virtual-file-routes').VirtualRootRoute>>;
3
4
  routeFilePrefix: z.ZodOptional<z.ZodString>;
4
5
  routeFileIgnorePrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
5
6
  routeFileIgnorePattern: z.ZodOptional<z.ZodString>;
@@ -39,6 +40,7 @@ export declare const configSchema: z.ZodObject<{
39
40
  routeTreeFileFooter: string[];
40
41
  indexToken: string;
41
42
  routeToken: string;
43
+ virtualRouteConfig?: import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
42
44
  routeFilePrefix?: string | undefined;
43
45
  routeFileIgnorePattern?: string | undefined;
44
46
  autoCodeSplitting?: boolean | undefined;
@@ -46,6 +48,7 @@ export declare const configSchema: z.ZodObject<{
46
48
  enableCodeSplitting?: boolean | undefined;
47
49
  } | undefined;
48
50
  }, {
51
+ virtualRouteConfig?: import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
49
52
  routeFilePrefix?: string | undefined;
50
53
  routeFileIgnorePrefix?: string | undefined;
51
54
  routeFileIgnorePattern?: string | undefined;
@@ -1,7 +1,9 @@
1
1
  import path from "node:path";
2
2
  import { existsSync, readFileSync } from "node:fs";
3
3
  import { z } from "zod";
4
+ import { virtualRootRouteSchema } from "./filesystem/virtual/config.js";
4
5
  const configSchema = z.object({
6
+ virtualRouteConfig: virtualRootRouteSchema.optional(),
5
7
  routeFilePrefix: z.string().optional(),
6
8
  routeFileIgnorePrefix: z.string().optional().default("-"),
7
9
  routeFileIgnorePattern: z.string().optional(),
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../src/config.ts"],"sourcesContent":["import path from 'node:path'\nimport { existsSync, readFileSync } from 'node:fs'\nimport { z } from 'zod'\n\nexport const configSchema = z.object({\n routeFilePrefix: z.string().optional(),\n routeFileIgnorePrefix: z.string().optional().default('-'),\n routeFileIgnorePattern: z.string().optional(),\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 semicolons: z.boolean().optional().default(false),\n disableTypes: z.boolean().optional().default(false),\n addExtensions: z.boolean().optional().default(false),\n disableLogging: z.boolean().optional().default(false),\n disableManifestGeneration: z.boolean().optional().default(false),\n apiBase: z.string().optional().default('/api'),\n routeTreeFileHeader: z\n .array(z.string())\n .optional()\n .default([\n '/* prettier-ignore-start */',\n '/* eslint-disable */',\n '// @ts-nocheck',\n '// noinspection JSUnusedGlobalSymbols',\n ]),\n routeTreeFileFooter: z\n .array(z.string())\n .optional()\n .default(['/* prettier-ignore-end */']),\n autoCodeSplitting: z.boolean().optional(),\n indexToken: z.string().optional().default('index'),\n routeToken: z.string().optional().default('route'),\n experimental: z\n .object({\n // TODO: Remove this option in the next major release (v2).\n enableCodeSplitting: z.boolean().optional(),\n })\n .optional(),\n})\n\nexport type Config = z.infer<typeof configSchema>\n\nexport function getConfig(\n inlineConfig: Partial<Config> = {},\n configDirectory?: string,\n): Config {\n if (configDirectory === undefined) {\n configDirectory = process.cwd()\n }\n const configFilePathJson = path.resolve(configDirectory, 'tsr.config.json')\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 ...inlineConfig,\n })\n } else {\n config = configSchema.parse(inlineConfig)\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 // if a configDirectory is used, paths should be relative to that directory\n if (configDirectory) {\n // if absolute configDirectory is provided, use it as the root\n if (path.isAbsolute(configDirectory)) {\n config.routesDirectory = path.resolve(\n configDirectory,\n config.routesDirectory,\n )\n config.generatedRouteTree = path.resolve(\n configDirectory,\n config.generatedRouteTree,\n )\n } else {\n config.routesDirectory = path.resolve(\n process.cwd(),\n configDirectory,\n config.routesDirectory,\n )\n config.generatedRouteTree = path.resolve(\n process.cwd(),\n configDirectory,\n config.generatedRouteTree,\n )\n }\n }\n\n validateConfig(config)\n return config\n}\n\nfunction validateConfig(config: Config) {\n if (typeof config.experimental?.enableCodeSplitting !== 'undefined') {\n const message = `\n------\n⚠️ ⚠️ ⚠️\nERROR: The \"experimental.enableCodeSplitting\" flag has been made stable and is now \"autoCodeSplitting\". Please update your configuration file to use \"autoCodeSplitting\" instead of \"experimental.enableCodeSplitting\".\n------\n`\n console.error(message)\n throw new Error(message)\n }\n\n if (config.indexToken === config.routeToken) {\n throw new Error(\n `The \"indexToken\" and \"routeToken\" options must be different.`,\n )\n }\n return config\n}\n"],"names":[],"mappings":";;;AAIa,MAAA,eAAe,EAAE,OAAO;AAAA,EACnC,iBAAiB,EAAE,OAAO,EAAE,SAAS;AAAA,EACrC,uBAAuB,EAAE,OAAA,EAAS,SAAS,EAAE,QAAQ,GAAG;AAAA,EACxD,wBAAwB,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5C,iBAAiB,EAAE,OAAA,EAAS,SAAS,EAAE,QAAQ,cAAc;AAAA,EAC7D,oBAAoB,EAAE,OAAA,EAAS,SAAS,EAAE,QAAQ,wBAAwB;AAAA,EAC1E,YAAY,EAAE,KAAK,CAAC,UAAU,QAAQ,CAAC,EAAE,SAAA,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AAAA,EAAA,OACI;AACI,aAAA,aAAa,MAAM,YAAY;AAAA,EAC1C;AAGA,MAAI,OAAO,cAAc;AAChB,WAAA,qBAAqB,OAAO,mBAAmB;AAAA,MACpD;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAGA,MAAI,iBAAiB;AAEf,QAAA,KAAK,WAAW,eAAe,GAAG;AACpC,aAAO,kBAAkB,KAAK;AAAA,QAC5B;AAAA,QACA,OAAO;AAAA,MAAA;AAET,aAAO,qBAAqB,KAAK;AAAA,QAC/B;AAAA,QACA,OAAO;AAAA,MAAA;AAAA,IACT,OACK;AACL,aAAO,kBAAkB,KAAK;AAAA,QAC5B,QAAQ,IAAI;AAAA,QACZ;AAAA,QACA,OAAO;AAAA,MAAA;AAET,aAAO,qBAAqB,KAAK;AAAA,QAC/B,QAAQ,IAAI;AAAA,QACZ;AAAA,QACA,OAAO;AAAA,MAAA;AAAA,IAEX;AAAA,EACF;AAEA,iBAAe,MAAM;AACd,SAAA;AACT;AAEA,SAAS,eAAe,QAAgB;;AACtC,MAAI,SAAO,YAAO,iBAAP,mBAAqB,yBAAwB,aAAa;AACnE,UAAM,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAMhB,YAAQ,MAAM,OAAO;AACf,UAAA,IAAI,MAAM,OAAO;AAAA,EACzB;AAEI,MAAA,OAAO,eAAe,OAAO,YAAY;AAC3C,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACO,SAAA;AACT;"}
1
+ {"version":3,"file":"config.js","sources":["../../src/config.ts"],"sourcesContent":["import path from 'node:path'\nimport { existsSync, readFileSync } from 'node:fs'\nimport { z } from 'zod'\nimport { virtualRootRouteSchema } from './filesystem/virtual/config'\n\nexport const configSchema = z.object({\n virtualRouteConfig: virtualRootRouteSchema.optional(),\n routeFilePrefix: z.string().optional(),\n routeFileIgnorePrefix: z.string().optional().default('-'),\n routeFileIgnorePattern: z.string().optional(),\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 semicolons: z.boolean().optional().default(false),\n disableTypes: z.boolean().optional().default(false),\n addExtensions: z.boolean().optional().default(false),\n disableLogging: z.boolean().optional().default(false),\n disableManifestGeneration: z.boolean().optional().default(false),\n apiBase: z.string().optional().default('/api'),\n routeTreeFileHeader: z\n .array(z.string())\n .optional()\n .default([\n '/* prettier-ignore-start */',\n '/* eslint-disable */',\n '// @ts-nocheck',\n '// noinspection JSUnusedGlobalSymbols',\n ]),\n routeTreeFileFooter: z\n .array(z.string())\n .optional()\n .default(['/* prettier-ignore-end */']),\n autoCodeSplitting: z.boolean().optional(),\n indexToken: z.string().optional().default('index'),\n routeToken: z.string().optional().default('route'),\n experimental: z\n .object({\n // TODO: Remove this option in the next major release (v2).\n enableCodeSplitting: z.boolean().optional(),\n })\n .optional(),\n})\n\nexport type Config = z.infer<typeof configSchema>\n\nexport function getConfig(\n inlineConfig: Partial<Config> = {},\n configDirectory?: string,\n): Config {\n if (configDirectory === undefined) {\n configDirectory = process.cwd()\n }\n const configFilePathJson = path.resolve(configDirectory, 'tsr.config.json')\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 ...inlineConfig,\n })\n } else {\n config = configSchema.parse(inlineConfig)\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 // if a configDirectory is used, paths should be relative to that directory\n if (configDirectory) {\n // if absolute configDirectory is provided, use it as the root\n if (path.isAbsolute(configDirectory)) {\n config.routesDirectory = path.resolve(\n configDirectory,\n config.routesDirectory,\n )\n config.generatedRouteTree = path.resolve(\n configDirectory,\n config.generatedRouteTree,\n )\n } else {\n config.routesDirectory = path.resolve(\n process.cwd(),\n configDirectory,\n config.routesDirectory,\n )\n config.generatedRouteTree = path.resolve(\n process.cwd(),\n configDirectory,\n config.generatedRouteTree,\n )\n }\n }\n\n validateConfig(config)\n return config\n}\n\nfunction validateConfig(config: Config) {\n if (typeof config.experimental?.enableCodeSplitting !== 'undefined') {\n const message = `\n------\n⚠️ ⚠️ ⚠️\nERROR: The \"experimental.enableCodeSplitting\" flag has been made stable and is now \"autoCodeSplitting\". Please update your configuration file to use \"autoCodeSplitting\" instead of \"experimental.enableCodeSplitting\".\n------\n`\n console.error(message)\n throw new Error(message)\n }\n\n if (config.indexToken === config.routeToken) {\n throw new Error(\n `The \"indexToken\" and \"routeToken\" options must be different.`,\n )\n }\n return config\n}\n"],"names":[],"mappings":";;;;AAKa,MAAA,eAAe,EAAE,OAAO;AAAA,EACnC,oBAAoB,uBAAuB,SAAS;AAAA,EACpD,iBAAiB,EAAE,OAAO,EAAE,SAAS;AAAA,EACrC,uBAAuB,EAAE,OAAA,EAAS,SAAS,EAAE,QAAQ,GAAG;AAAA,EACxD,wBAAwB,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5C,iBAAiB,EAAE,OAAA,EAAS,SAAS,EAAE,QAAQ,cAAc;AAAA,EAC7D,oBAAoB,EAAE,OAAA,EAAS,SAAS,EAAE,QAAQ,wBAAwB;AAAA,EAC1E,YAAY,EAAE,KAAK,CAAC,UAAU,QAAQ,CAAC,EAAE,SAAA,EAAW,QAAQ,QAAQ;AAAA,EACpE,YAAY,EAAE,QAAA,EAAU,SAAS,EAAE,QAAQ,KAAK;AAAA,EAChD,cAAc,EAAE,QAAA,EAAU,SAAS,EAAE,QAAQ,KAAK;AAAA,EAClD,eAAe,EAAE,QAAA,EAAU,SAAS,EAAE,QAAQ,KAAK;AAAA,EACnD,gBAAgB,EAAE,QAAA,EAAU,SAAS,EAAE,QAAQ,KAAK;AAAA,EACpD,2BAA2B,EAAE,QAAA,EAAU,SAAS,EAAE,QAAQ,KAAK;AAAA,EAC/D,SAAS,EAAE,O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AAAA,IACT,OACK;AACL,aAAO,kBAAkB,KAAK;AAAA,QAC5B,QAAQ,IAAI;AAAA,QACZ;AAAA,QACA,OAAO;AAAA,MAAA;AAET,aAAO,qBAAqB,KAAK;AAAA,QAC/B,QAAQ,IAAI;AAAA,QACZ;AAAA,QACA,OAAO;AAAA,MAAA;AAAA,IAEX;AAAA,EACF;AAEA,iBAAe,MAAM;AACd,SAAA;AACT;AAEA,SAAS,eAAe,QAAgB;;AACtC,MAAI,SAAO,YAAO,iBAAP,mBAAqB,yBAAwB,aAAa;AACnE,UAAM,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAMhB,YAAQ,MAAM,OAAO;AACf,UAAA,IAAI,MAAM,OAAO;AAAA,EACzB;AAEI,MAAA,OAAO,eAAe,OAAO,YAAY;AAC3C,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACO,SAAA;AACT;"}
@@ -0,0 +1,3 @@
1
+ import { GetRouteNodesResult } from '../../types';
2
+ import { Config } from '../../config';
3
+ export declare function getRouteNodes(config: Config): Promise<GetRouteNodesResult>;
@@ -0,0 +1,108 @@
1
+ import path from "node:path";
2
+ import * as fsp from "node:fs/promises";
3
+ import { logging, replaceBackslash, removeExt, determineInitialRoutePath, routePathToVariable, removeTrailingSlash } from "../../utils.js";
4
+ import { rootPathId } from "./rootPathId.js";
5
+ const disallowedRouteGroupConfiguration = /\(([^)]+)\).(ts|js|tsx|jsx)/;
6
+ async function getRouteNodes(config) {
7
+ const { routeFilePrefix, routeFileIgnorePrefix, routeFileIgnorePattern } = config;
8
+ const logger = logging({ disabled: config.disableLogging });
9
+ const routeFileIgnoreRegExp = new RegExp(routeFileIgnorePattern ?? "", "g");
10
+ const routeNodes = [];
11
+ async function recurse(dir) {
12
+ const fullDir = path.resolve(config.routesDirectory, dir);
13
+ let dirList = await fsp.readdir(fullDir, { withFileTypes: true });
14
+ dirList = dirList.filter((d) => {
15
+ if (d.name.startsWith(".") || routeFileIgnorePrefix && d.name.startsWith(routeFileIgnorePrefix)) {
16
+ return false;
17
+ }
18
+ if (routeFilePrefix) {
19
+ return d.name.startsWith(routeFilePrefix);
20
+ }
21
+ if (routeFileIgnorePattern) {
22
+ return !d.name.match(routeFileIgnoreRegExp);
23
+ }
24
+ return true;
25
+ });
26
+ await Promise.all(
27
+ dirList.map(async (dirent) => {
28
+ const fullPath = path.join(fullDir, dirent.name);
29
+ const relativePath = path.join(dir, dirent.name);
30
+ if (dirent.isDirectory()) {
31
+ await recurse(relativePath);
32
+ } else if (fullPath.match(/\.(tsx|ts|jsx|js)$/)) {
33
+ const filePath = replaceBackslash(path.join(dir, dirent.name));
34
+ const filePathNoExt = removeExt(filePath);
35
+ let routePath = determineInitialRoutePath(filePathNoExt);
36
+ if (routeFilePrefix) {
37
+ routePath = routePath.replaceAll(routeFilePrefix, "");
38
+ }
39
+ if (disallowedRouteGroupConfiguration.test(dirent.name)) {
40
+ const errorMessage = `A route configuration for a route group was found at \`${filePath}\`. This is not supported. Did you mean to use a layout/pathless route instead?`;
41
+ logger.error(`ERROR: ${errorMessage}`);
42
+ throw new Error(errorMessage);
43
+ }
44
+ const variableName = routePathToVariable(routePath);
45
+ const isLazy = routePath.endsWith("/lazy");
46
+ if (isLazy) {
47
+ routePath = routePath.replace(/\/lazy$/, "");
48
+ }
49
+ const isRoute = routePath.endsWith(`/${config.routeToken}`);
50
+ const isComponent = routePath.endsWith("/component");
51
+ const isErrorComponent = routePath.endsWith("/errorComponent");
52
+ const isPendingComponent = routePath.endsWith("/pendingComponent");
53
+ const isLoader = routePath.endsWith("/loader");
54
+ const isAPIRoute = routePath.startsWith(
55
+ `${removeTrailingSlash(config.apiBase)}/`
56
+ );
57
+ const segments = routePath.split("/");
58
+ const lastRouteSegment = segments[segments.length - 1];
59
+ const isLayout = lastRouteSegment !== config.indexToken && lastRouteSegment !== config.routeToken && (lastRouteSegment == null ? void 0 : lastRouteSegment.startsWith("_")) || false;
60
+ [
61
+ [isComponent, "component"],
62
+ [isErrorComponent, "errorComponent"],
63
+ [isPendingComponent, "pendingComponent"],
64
+ [isLoader, "loader"]
65
+ ].forEach(([isType, type]) => {
66
+ if (isType) {
67
+ logger.warn(
68
+ `WARNING: The \`.${type}.tsx\` suffix used for the ${filePath} file is deprecated. Use the new \`.lazy.tsx\` suffix instead.`
69
+ );
70
+ }
71
+ });
72
+ routePath = routePath.replace(
73
+ new RegExp(
74
+ `/(component|errorComponent|pendingComponent|loader|${config.routeToken}|lazy)$`
75
+ ),
76
+ ""
77
+ );
78
+ if (routePath === config.indexToken) {
79
+ routePath = "/";
80
+ }
81
+ routePath = routePath.replace(new RegExp(`/${config.indexToken}$`), "/") || "/";
82
+ routeNodes.push({
83
+ filePath,
84
+ fullPath,
85
+ routePath,
86
+ variableName,
87
+ isRoute,
88
+ isComponent,
89
+ isErrorComponent,
90
+ isPendingComponent,
91
+ isLoader,
92
+ isLazy,
93
+ isLayout,
94
+ isAPIRoute
95
+ });
96
+ }
97
+ })
98
+ );
99
+ return routeNodes;
100
+ }
101
+ await recurse("./");
102
+ const rootRouteNode = routeNodes.find((d) => d.routePath === `/${rootPathId}`);
103
+ return { rootRouteNode, routeNodes };
104
+ }
105
+ export {
106
+ getRouteNodes
107
+ };
108
+ //# sourceMappingURL=getRouteNodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRouteNodes.js","sources":["../../../../src/filesystem/physical/getRouteNodes.ts"],"sourcesContent":["import path from 'node:path'\nimport * as fsp from 'node:fs/promises'\nimport {\n determineInitialRoutePath,\n logging,\n removeExt,\n removeTrailingSlash,\n replaceBackslash,\n routePathToVariable,\n} from '../../utils'\nimport { rootPathId } from './rootPathId'\nimport type { GetRouteNodesResult, RouteNode } from '../../types'\nimport type { Config } from '../../config'\n\nconst disallowedRouteGroupConfiguration = /\\(([^)]+)\\).(ts|js|tsx|jsx)/\n\nexport async function getRouteNodes(\n config: Config,\n): Promise<GetRouteNodesResult> {\n const { routeFilePrefix, routeFileIgnorePrefix, routeFileIgnorePattern } =\n config\n const logger = logging({ disabled: config.disableLogging })\n const routeFileIgnoreRegExp = new RegExp(routeFileIgnorePattern ?? '', 'g')\n\n const routeNodes: Array<RouteNode> = []\n\n async function recurse(dir: string) {\n const fullDir = path.resolve(config.routesDirectory, dir)\n let dirList = await fsp.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 if (routeFileIgnorePattern) {\n return !d.name.match(routeFileIgnoreRegExp)\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 = determineInitialRoutePath(filePathNoExt)\n\n if (routeFilePrefix) {\n routePath = routePath.replaceAll(routeFilePrefix, '')\n }\n\n if (disallowedRouteGroupConfiguration.test(dirent.name)) {\n const errorMessage = `A route configuration for a route group was found at \\`${filePath}\\`. This is not supported. Did you mean to use a layout/pathless route instead?`\n logger.error(`ERROR: ${errorMessage}`)\n throw new Error(errorMessage)\n }\n\n const variableName = routePathToVariable(routePath)\n\n const isLazy = routePath.endsWith('/lazy')\n\n if (isLazy) {\n routePath = routePath.replace(/\\/lazy$/, '')\n }\n\n const isRoute = routePath.endsWith(`/${config.routeToken}`)\n const isComponent = routePath.endsWith('/component')\n const isErrorComponent = routePath.endsWith('/errorComponent')\n const isPendingComponent = routePath.endsWith('/pendingComponent')\n const isLoader = routePath.endsWith('/loader')\n const isAPIRoute = routePath.startsWith(\n `${removeTrailingSlash(config.apiBase)}/`,\n )\n\n const segments = routePath.split('/')\n const lastRouteSegment = segments[segments.length - 1]\n const isLayout =\n (lastRouteSegment !== config.indexToken &&\n lastRouteSegment !== config.routeToken &&\n lastRouteSegment?.startsWith('_')) ||\n false\n\n ;(\n [\n [isComponent, 'component'],\n [isErrorComponent, 'errorComponent'],\n [isPendingComponent, 'pendingComponent'],\n [isLoader, 'loader'],\n ] as const\n ).forEach(([isType, type]) => {\n if (isType) {\n logger.warn(\n `WARNING: The \\`.${type}.tsx\\` suffix used for the ${filePath} file is deprecated. Use the new \\`.lazy.tsx\\` suffix instead.`,\n )\n }\n })\n\n routePath = routePath.replace(\n new RegExp(\n `/(component|errorComponent|pendingComponent|loader|${config.routeToken}|lazy)$`,\n ),\n '',\n )\n\n if (routePath === config.indexToken) {\n routePath = '/'\n }\n\n routePath =\n routePath.replace(new RegExp(`/${config.indexToken}$`), '/') || '/'\n\n routeNodes.push({\n filePath,\n fullPath,\n routePath,\n variableName,\n isRoute,\n isComponent,\n isErrorComponent,\n isPendingComponent,\n isLoader,\n isLazy,\n isLayout,\n isAPIRoute,\n })\n }\n }),\n )\n\n return routeNodes\n }\n\n await recurse('./')\n\n const rootRouteNode = routeNodes.find((d) => d.routePath === `/${rootPathId}`)\n return { rootRouteNode, routeNodes }\n}\n"],"names":[],"mappings":";;;;AAcA,MAAM,oCAAoC;AAE1C,eAAsB,cACpB,QAC8B;AAC9B,QAAM,EAAE,iBAAiB,uBAAuB,uBAAA,IAC9C;AACF,QAAM,SAAS,QAAQ,EAAE,UAAU,OAAO,gBAAgB;AAC1D,QAAM,wBAAwB,IAAI,OAAO,0BAA0B,IAAI,GAAG;AAE1E,QAAM,aAA+B,CAAA;AAErC,iBAAe,QAAQ,KAAa;AAClC,UAAM,UAAU,KAAK,QAAQ,OAAO,iBAAiB,GAAG;AACpD,QAAA,UAAU,MAAM,IAAI,QAAQ,SAAS,EAAE,eAAe,MAAM;AAEtD,cAAA,QAAQ,OAAO,CAAC,MAAM;AAE5B,UAAA,EAAE,KAAK,WAAW,GAAG,K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export {
3
+ rootPathId
4
+ };
5
+ //# sourceMappingURL=rootPathId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rootPathId.js","sources":["../../../../src/filesystem/physical/rootPathId.ts"],"sourcesContent":["export const rootPathId = '__root'\n"],"names":[],"mappings":"AAAO,MAAM,aAAa;"}
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ import { VirtualRootRoute } from '@tanstack/virtual-file-routes';
3
+ export declare const virtualRootRouteSchema: z.ZodType<VirtualRootRoute>;
@@ -0,0 +1,37 @@
1
+ import { z } from "zod";
2
+ const indexRouteSchema = z.object({
3
+ type: z.literal("index"),
4
+ file: z.string()
5
+ });
6
+ const layoutRouteSchema = z.object({
7
+ type: z.literal("layout"),
8
+ id: z.string(),
9
+ file: z.string(),
10
+ children: z.array(z.lazy(() => virtualRouteNodeSchema)).optional()
11
+ });
12
+ const routeSchema = z.object({
13
+ type: z.literal("route"),
14
+ file: z.string(),
15
+ path: z.string(),
16
+ children: z.array(z.lazy(() => virtualRouteNodeSchema)).optional()
17
+ });
18
+ const physicalSubTreeSchema = z.object({
19
+ type: z.literal("physical"),
20
+ directory: z.string(),
21
+ pathPrefix: z.string()
22
+ });
23
+ const virtualRouteNodeSchema = z.union([
24
+ indexRouteSchema,
25
+ layoutRouteSchema,
26
+ routeSchema,
27
+ physicalSubTreeSchema
28
+ ]);
29
+ const virtualRootRouteSchema = z.object({
30
+ type: z.literal("root"),
31
+ file: z.string(),
32
+ children: z.array(virtualRouteNodeSchema).optional()
33
+ });
34
+ export {
35
+ virtualRootRouteSchema
36
+ };
37
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sources":["../../../../src/filesystem/virtual/config.ts"],"sourcesContent":["import { z } from 'zod'\nimport type {\n LayoutRoute,\n PhysicalSubtree,\n Route,\n VirtualRootRoute,\n} from '@tanstack/virtual-file-routes'\n\nconst indexRouteSchema = z.object({\n type: z.literal('index'),\n file: z.string(),\n})\n\nconst layoutRouteSchema: z.ZodType<LayoutRoute> = z.object({\n type: z.literal('layout'),\n id: z.string(),\n file: z.string(),\n children: z.array(z.lazy(() => virtualRouteNodeSchema)).optional(),\n})\n\nconst routeSchema: z.ZodType<Route> = z.object({\n type: z.literal('route'),\n file: z.string(),\n path: z.string(),\n children: z.array(z.lazy(() => virtualRouteNodeSchema)).optional(),\n})\n\nconst physicalSubTreeSchema: z.ZodType<PhysicalSubtree> = z.object({\n type: z.literal('physical'),\n directory: z.string(),\n pathPrefix: z.string(),\n})\n\nconst virtualRouteNodeSchema = z.union([\n indexRouteSchema,\n layoutRouteSchema,\n routeSchema,\n physicalSubTreeSchema,\n])\n\nexport const virtualRootRouteSchema: z.ZodType<VirtualRootRoute> = z.object({\n type: z.literal('root'),\n file: z.string(),\n children: z.array(virtualRouteNodeSchema).optional(),\n})\n"],"names":[],"mappings":";AAQA,MAAM,mBAAmB,EAAE,OAAO;AAAA,EAChC,MAAM,EAAE,QAAQ,OAAO;AAAA,EACvB,MAAM,EAAE,OAAO;AACjB,CAAC;AAED,MAAM,oBAA4C,EAAE,OAAO;AAAA,EACzD,MAAM,EAAE,QAAQ,QAAQ;AAAA,EACxB,IAAI,EAAE,OAAO;AAAA,EACb,MAAM,EAAE,OAAO;AAAA,EACf,UAAU,EAAE,MAAM,EAAE,KAAK,MAAM,sBAAsB,CAAC,EAAE,SAAS;AACnE,CAAC;AAED,MAAM,cAAgC,EAAE,OAAO;AAAA,EAC7C,MAAM,EAAE,QAAQ,OAAO;AAAA,EACvB,MAAM,EAAE,OAAO;AAAA,EACf,MAAM,EAAE,OAAO;AAAA,EACf,UAAU,EAAE,MAAM,EAAE,KAAK,MAAM,sBAAsB,CAAC,EAAE,SAAS;AACnE,CAAC;AAED,MAAM,wBAAoD,EAAE,OAAO;AAAA,EACjE,MAAM,EAAE,QAAQ,UAAU;AAAA,EAC1B,WAAW,EAAE,OAAO;AAAA,EACpB,YAAY,EAAE,OAAO;AACvB,CAAC;AAED,MAAM,yBAAyB,EAAE,MAAM;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEY,MAAA,yBAAsD,EAAE,OAAO;AAAA,EAC1E,MAAM,EAAE,QAAQ,MAAM;AAAA,EACtB,MAAM,EAAE,OAAO;AAAA,EACf,UAAU,EAAE,MAAM,sBAAsB,EAAE,SAAS;AACrD,CAAC;"}
@@ -0,0 +1,5 @@
1
+ import { VirtualRouteNode } from '@tanstack/virtual-file-routes';
2
+ import { GetRouteNodesResult, RouteNode } from '../../types';
3
+ import { Config } from '../../config';
4
+ export declare function getRouteNodes(tsrConfig: Config): Promise<GetRouteNodesResult>;
5
+ export declare function getRouteNodesRecursive(tsrConfig: Config, fullDir: string, nodes?: Array<VirtualRouteNode>, parent?: RouteNode): Promise<Array<RouteNode>>;
@@ -0,0 +1,119 @@
1
+ import { resolve, join } from "node:path";
2
+ import { routePathToVariable, removeExt, removeTrailingSlash, removeLeadingSlash } from "../../utils.js";
3
+ import { getRouteNodes as getRouteNodes$1 } from "../physical/getRouteNodes.js";
4
+ function ensureLeadingUnderScore(id) {
5
+ if (id.startsWith("_")) {
6
+ return id;
7
+ }
8
+ return `_${id}`;
9
+ }
10
+ function flattenTree(node) {
11
+ const result = [node];
12
+ if (node.children) {
13
+ for (const child of node.children) {
14
+ result.push(...flattenTree(child));
15
+ }
16
+ }
17
+ delete node.children;
18
+ return result;
19
+ }
20
+ async function getRouteNodes(tsrConfig) {
21
+ const fullDir = resolve(tsrConfig.routesDirectory);
22
+ if (tsrConfig.virtualRouteConfig === void 0) {
23
+ throw new Error(`virtualRouteConfig is undefined`);
24
+ }
25
+ const children = await getRouteNodesRecursive(
26
+ tsrConfig,
27
+ fullDir,
28
+ tsrConfig.virtualRouteConfig.children
29
+ );
30
+ const allNodes = flattenTree({
31
+ children,
32
+ filePath: tsrConfig.virtualRouteConfig.file,
33
+ fullPath: join(fullDir, tsrConfig.virtualRouteConfig.file),
34
+ variableName: "rootRoute",
35
+ routePath: "/",
36
+ isRoot: true
37
+ });
38
+ const rootRouteNode = allNodes[0];
39
+ const routeNodes = allNodes.slice(1);
40
+ return { rootRouteNode, routeNodes };
41
+ }
42
+ async function getRouteNodesRecursive(tsrConfig, fullDir, nodes, parent) {
43
+ if (nodes === void 0) {
44
+ return [];
45
+ }
46
+ const children = await Promise.all(
47
+ nodes.map(async (node) => {
48
+ if (node.type === "physical") {
49
+ const { routeNodes } = await getRouteNodes$1({
50
+ ...tsrConfig,
51
+ routesDirectory: resolve(fullDir, node.directory)
52
+ });
53
+ routeNodes.forEach((subtreeNode) => {
54
+ subtreeNode.variableName = routePathToVariable(
55
+ `${node.pathPrefix}/${removeExt(subtreeNode.filePath)}`
56
+ );
57
+ subtreeNode.routePath = `${(parent == null ? void 0 : parent.routePath) ?? ""}${node.pathPrefix}${subtreeNode.routePath}`;
58
+ subtreeNode.filePath = `${node.directory}/${subtreeNode.filePath}`;
59
+ });
60
+ return routeNodes;
61
+ }
62
+ const filePath = node.file;
63
+ const variableName = routePathToVariable(removeExt(filePath));
64
+ const fullPath = join(fullDir, filePath);
65
+ const parentRoutePath = removeTrailingSlash((parent == null ? void 0 : parent.routePath) ?? "/");
66
+ const isLayout = node.type === "layout";
67
+ switch (node.type) {
68
+ case "index": {
69
+ const routePath = `${parentRoutePath}/`;
70
+ return {
71
+ filePath,
72
+ fullPath,
73
+ variableName,
74
+ routePath,
75
+ isLayout
76
+ };
77
+ }
78
+ case "route":
79
+ case "layout": {
80
+ let lastSegment;
81
+ if (node.type === "layout") {
82
+ if (node.id !== void 0) {
83
+ node.id = ensureLeadingUnderScore(node.id);
84
+ } else {
85
+ node.id = "_layout";
86
+ }
87
+ lastSegment = node.id;
88
+ } else {
89
+ lastSegment = node.path;
90
+ }
91
+ const routePath = `${parentRoutePath}/${removeLeadingSlash(lastSegment)}`;
92
+ const routeNode = {
93
+ fullPath,
94
+ isLayout,
95
+ filePath,
96
+ variableName,
97
+ routePath
98
+ };
99
+ if (node.children !== void 0) {
100
+ const children2 = await getRouteNodesRecursive(
101
+ tsrConfig,
102
+ fullDir,
103
+ node.children,
104
+ routeNode
105
+ );
106
+ routeNode.children = children2;
107
+ }
108
+ return routeNode;
109
+ }
110
+ }
111
+ })
112
+ );
113
+ return children.flat();
114
+ }
115
+ export {
116
+ getRouteNodes,
117
+ getRouteNodesRecursive
118
+ };
119
+ //# sourceMappingURL=getRouteNodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRouteNodes.js","sources":["../../../../src/filesystem/virtual/getRouteNodes.ts"],"sourcesContent":["import { join, resolve } from 'node:path'\nimport {\n removeExt,\n removeLeadingSlash,\n removeTrailingSlash,\n routePathToVariable,\n} from '../../utils'\nimport { getRouteNodes as getRouteNodesPhysical } from '../physical/getRouteNodes'\nimport type { VirtualRouteNode } from '@tanstack/virtual-file-routes'\nimport type { GetRouteNodesResult, RouteNode } from '../../types'\nimport type { Config } from '../../config'\n\nfunction ensureLeadingUnderScore(id: string) {\n if (id.startsWith('_')) {\n return id\n }\n return `_${id}`\n}\n\nfunction flattenTree(node: RouteNode): Array<RouteNode> {\n const result = [node]\n\n if (node.children) {\n for (const child of node.children) {\n result.push(...flattenTree(child))\n }\n }\n delete node.children\n\n return result\n}\n\nexport async function getRouteNodes(\n tsrConfig: Config,\n): Promise<GetRouteNodesResult> {\n const fullDir = resolve(tsrConfig.routesDirectory)\n if (tsrConfig.virtualRouteConfig === undefined) {\n throw new Error(`virtualRouteConfig is undefined`)\n }\n const children = await getRouteNodesRecursive(\n tsrConfig,\n fullDir,\n tsrConfig.virtualRouteConfig.children,\n )\n const allNodes = flattenTree({\n children,\n filePath: tsrConfig.virtualRouteConfig.file,\n fullPath: join(fullDir, tsrConfig.virtualRouteConfig.file),\n variableName: 'rootRoute',\n routePath: '/',\n isRoot: true,\n })\n\n const rootRouteNode = allNodes[0]\n const routeNodes = allNodes.slice(1)\n\n return { rootRouteNode, routeNodes }\n}\n\nexport async function getRouteNodesRecursive(\n tsrConfig: Config,\n fullDir: string,\n nodes?: Array<VirtualRouteNode>,\n parent?: RouteNode,\n): Promise<Array<RouteNode>> {\n if (nodes === undefined) {\n return []\n }\n const children = await Promise.all(\n nodes.map(async (node) => {\n if (node.type === 'physical') {\n const { routeNodes } = await getRouteNodesPhysical({\n ...tsrConfig,\n routesDirectory: resolve(fullDir, node.directory),\n })\n routeNodes.forEach((subtreeNode) => {\n subtreeNode.variableName = routePathToVariable(\n `${node.pathPrefix}/${removeExt(subtreeNode.filePath)}`,\n )\n subtreeNode.routePath = `${parent?.routePath ?? ''}${node.pathPrefix}${subtreeNode.routePath}`\n subtreeNode.filePath = `${node.directory}/${subtreeNode.filePath}`\n })\n return routeNodes\n }\n\n const filePath = node.file\n const variableName = routePathToVariable(removeExt(filePath))\n const fullPath = join(fullDir, filePath)\n const parentRoutePath = removeTrailingSlash(parent?.routePath ?? '/')\n const isLayout = node.type === 'layout'\n switch (node.type) {\n case 'index': {\n const routePath = `${parentRoutePath}/`\n return {\n filePath,\n fullPath,\n variableName,\n routePath,\n isLayout,\n } satisfies RouteNode\n }\n\n case 'route':\n case 'layout': {\n let lastSegment: string\n if (node.type === 'layout') {\n if (node.id !== undefined) {\n node.id = ensureLeadingUnderScore(node.id)\n } else {\n node.id = '_layout'\n }\n lastSegment = node.id\n } else {\n lastSegment = node.path\n }\n const routePath = `${parentRoutePath}/${removeLeadingSlash(lastSegment)}`\n\n const routeNode: RouteNode = {\n fullPath,\n isLayout,\n filePath,\n variableName,\n routePath,\n }\n\n if (node.children !== undefined) {\n const children = await getRouteNodesRecursive(\n tsrConfig,\n fullDir,\n node.children,\n routeNode,\n )\n routeNode.children = children\n }\n return routeNode\n }\n }\n }),\n )\n return children.flat()\n}\n"],"names":["getRouteNodesPhysical","children"],"mappings":";;;AAYA,SAAS,wBAAwB,IAAY;AACvC,MAAA,GAAG,WAAW,GAAG,GAAG;AACf,WAAA;AAAA,EACT;AACA,SAAO,IAAI,EAAE;AACf;AAEA,SAAS,YAAY,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Y,WAAW,GAAG,KAAK,SAAS,IAAI,YAAY,QAAQ;AAAA,QAAA,CACjE;AACM,eAAA;AAAA,MACT;AAEA,YAAM,WAAW,KAAK;AACtB,YAAM,eAAe,oBAAoB,UAAU,QAAQ,CAAC;AACtD,YAAA,WAAW,KAAK,SAAS,QAAQ;AACvC,YAAM,kBAAkB,qBAAoB,iCAAQ,cAAa,GAAG;AAC9D,YAAA,WAAW,KAAK,SAAS;AAC/B,cAAQ,KAAK,MAAM;AAAA,QACjB,KAAK,SAAS;AACN,gBAAA,YAAY,GAAG,eAAe;AAC7B,iBAAA;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAEJ;AAAA,QAEA,KAAK;AAAA,QACL,KAAK,UAAU;AACT,cAAA;AACA,cAAA,KAAK,SAAS,UAAU;AACtB,gBAAA,KAAK,OAAO,QAAW;AACpB,mBAAA,KAAK,wBAAwB,KAAK,EAAE;AAAA,YAAA,OACpC;AACL,mBAAK,KAAK;AAAA,YACZ;AACA,0BAAc,KAAK;AAAA,UAAA,OACd;AACL,0BAAc,KAAK;AAAA,UACrB;AACA,gBAAM,YAAY,GAAG,eAAe,IAAI,mBAAmB,WAAW,CAAC;AAEvE,gBAAM,YAAuB;AAAA,YAC3B;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAGE,cAAA,KAAK,aAAa,QAAW;AAC/B,kBAAMC,YAAW,MAAM;AAAA,cACrB;AAAA,cACA;AAAA,cACA,KAAK;AAAA,cACL;AAAA,YAAA;AAEF,sBAAU,WAAWA;AAAAA,UACvB;AACO,iBAAA;AAAA,QACT;AAAA,MACF;AAAA,IAAA,CACD;AAAA,EAAA;AAEH,SAAO,SAAS;AAClB;"}
@@ -1,32 +1,6 @@
1
+ import { RouteNode } from './types.js';
1
2
  import { Config } from './config.js';
2
- export declare const rootPathId = "__root";
3
- export type RouteNode = {
4
- filePath: string;
5
- fullPath: string;
6
- variableName: string;
7
- routePath?: string;
8
- cleanedPath?: string;
9
- path?: string;
10
- isNonPath?: boolean;
11
- isNonLayout?: boolean;
12
- isLayout?: boolean;
13
- isVirtualParentRequired?: boolean;
14
- isVirtualParentRoute?: boolean;
15
- isRoute?: boolean;
16
- isAPIRoute?: boolean;
17
- isLoader?: boolean;
18
- isComponent?: boolean;
19
- isErrorComponent?: boolean;
20
- isPendingComponent?: boolean;
21
- isVirtual?: boolean;
22
- isLazy?: boolean;
23
- isRoot?: boolean;
24
- children?: Array<RouteNode>;
25
- parent?: RouteNode;
26
- };
27
3
  export declare function generator(config: Config): Promise<void>;
28
- export declare function removeExt(d: string, keepExtension?: boolean): string;
29
- export declare function multiSortBy<T>(arr: Array<T>, accessors?: Array<(item: T) => any>): Array<T>;
30
4
  /**
31
5
  * Removes the last segment from a given path. Segments are considered to be separated by a '/'.
32
6
  *