Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@tanstack/router-generator

Package Overview
Dependencies
Maintainers
5
Versions
587
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/router-generator - npm Package Compare versions

Comparing version
1.167.5
to
1.167.6
+1
-1
dist/cjs/config.cjs

@@ -54,3 +54,3 @@ const require_runtime = require("./_virtual/_rolldown/runtime.cjs");

enableRouteTreeFormatting: zod.z.boolean().optional().default(true),
routeTreeFileFooter: zod.z.union([zod.z.array(zod.z.string()).optional().default([]), zod.z.function().returns(zod.z.array(zod.z.string()))]).optional(),
routeTreeFileFooter: zod.z.union([zod.z.array(zod.z.string()).optional().default([]), zod.z.custom((value) => typeof value === "function")]).optional(),
autoCodeSplitting: zod.z.boolean().optional(),

@@ -57,0 +57,0 @@ customScaffolding: zod.z.object({

@@ -1,1 +0,1 @@

{"version":3,"file":"config.cjs","names":[],"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'\nimport type { GeneratorPlugin } from './plugin/types'\n\nconst tokenJsonRegexSchema = z.object({\n regex: z.string(),\n flags: z.string().optional(),\n})\n\nconst tokenMatcherSchema = z.union([\n z.string(),\n z.instanceof(RegExp),\n tokenJsonRegexSchema,\n])\n\nexport type TokenMatcherJson = string | z.infer<typeof tokenJsonRegexSchema>\n\nexport type TokenMatcher = z.infer<typeof tokenMatcherSchema>\n\nexport const baseConfigSchema = z.object({\n target: z.enum(['react', 'solid', 'vue']).optional().default('react'),\n virtualRouteConfig: virtualRootRouteSchema.or(z.string()).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 quoteStyle: z.enum(['single', 'double']).optional().default('single'),\n semicolons: z.boolean().optional().default(false),\n disableLogging: z.boolean().optional().default(false),\n routeTreeFileHeader: z\n .array(z.string())\n .optional()\n .default([\n '/* eslint-disable */',\n '// @ts-nocheck',\n '// noinspection JSUnusedGlobalSymbols',\n ]),\n indexToken: tokenMatcherSchema.optional().default('index'),\n routeToken: tokenMatcherSchema.optional().default('route'),\n pathParamsAllowedCharacters: z\n .array(z.enum([';', ':', '@', '&', '=', '+', '$', ',']))\n .optional(),\n})\n\nexport type BaseConfig = z.infer<typeof baseConfigSchema>\n\nexport const configSchema = baseConfigSchema.extend({\n generatedRouteTree: z.string().optional().default('./src/routeTree.gen.ts'),\n disableTypes: z.boolean().optional().default(false),\n addExtensions: z\n .union([z.boolean(), z.string()])\n .optional()\n .default(false)\n .transform((v) =>\n typeof v === 'string' ? (v.startsWith('.') ? v : `.${v}`) : v,\n ),\n enableRouteTreeFormatting: z.boolean().optional().default(true),\n routeTreeFileFooter: z\n .union([\n z.array(z.string()).optional().default([]),\n z.function().returns(z.array(z.string())),\n ])\n .optional(),\n autoCodeSplitting: z.boolean().optional(),\n customScaffolding: z\n .object({\n routeTemplate: z.string().optional(),\n lazyRouteTemplate: z.string().optional(),\n })\n .optional(),\n experimental: z\n .object({\n // TODO: This has been made stable and is now \"autoCodeSplitting\". Remove in next major version.\n enableCodeSplitting: z.boolean().optional(),\n })\n .optional(),\n plugins: z.array(z.custom<GeneratorPlugin>()).optional(),\n tmpDir: z.string().optional().default(''),\n importRoutesUsingAbsolutePaths: z.boolean().optional().default(false),\n})\n\nexport type Config = z.infer<typeof configSchema>\n\ntype ResolveParams = {\n configDirectory: string\n}\n\nexport function resolveConfigPath({ configDirectory }: ResolveParams) {\n return path.resolve(configDirectory, 'tsr.config.json')\n}\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 = resolveConfigPath({ configDirectory })\n const exists = existsSync(configFilePathJson)\n\n let config: Config\n\n if (exists) {\n // Parse file config (allows JSON regex-object form)\n const fileConfigRaw = JSON.parse(readFileSync(configFilePathJson, 'utf-8'))\n\n // Merge raw configs (inline overrides file), then parse once to apply defaults\n // This ensures file config values aren't overwritten by inline defaults\n const merged = {\n ...fileConfigRaw,\n ...inlineConfig,\n }\n config = configSchema.parse(merged)\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 const resolveTmpDir = (dir: string | Array<string>) => {\n if (Array.isArray(dir)) {\n dir = path.join(...dir)\n }\n if (!path.isAbsolute(dir)) {\n dir = path.resolve(process.cwd(), dir)\n }\n return dir\n }\n\n if (config.tmpDir) {\n config.tmpDir = resolveTmpDir(config.tmpDir)\n } else if (process.env.TSR_TMP_DIR) {\n config.tmpDir = resolveTmpDir(process.env.TSR_TMP_DIR)\n } else {\n config.tmpDir = resolveTmpDir(['.tanstack', 'tmp'])\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 // Check that indexToken and routeToken are not identical\n // Works for strings, RegExp, and JSON regex objects\n if (areTokensEqual(config.indexToken, config.routeToken)) {\n throw new Error(\n `The \"indexToken\" and \"routeToken\" options must be different.`,\n )\n }\n\n if (\n config.routeFileIgnorePrefix &&\n config.routeFileIgnorePrefix.trim() === '_'\n ) {\n throw new Error(\n `The \"routeFileIgnorePrefix\" cannot be an underscore (\"_\"). This is a reserved character used to denote a pathless route. Please use a different prefix.`,\n )\n }\n\n return config\n}\n\n/**\n * Compares two token matchers for equality.\n * Handles strings, RegExp instances, and JSON regex objects.\n */\nfunction areTokensEqual(a: TokenMatcher, b: TokenMatcher): boolean {\n // Both strings\n if (typeof a === 'string' && typeof b === 'string') {\n return a === b\n }\n\n // Both RegExp instances\n if (a instanceof RegExp && b instanceof RegExp) {\n return a.source === b.source && a.flags === b.flags\n }\n\n // Both JSON regex objects\n if (\n typeof a === 'object' &&\n 'regex' in a &&\n typeof b === 'object' &&\n 'regex' in b\n ) {\n return a.regex === b.regex && (a.flags ?? '') === (b.flags ?? '')\n }\n\n // Mixed types - not equal\n return false\n}\n"],"mappings":";;;;;;;AAMA,IAAM,uBAAuB,IAAA,EAAE,OAAO;CACpC,OAAO,IAAA,EAAE,QAAQ;CACjB,OAAO,IAAA,EAAE,QAAQ,CAAC,UAAU;CAC7B,CAAC;AAEF,IAAM,qBAAqB,IAAA,EAAE,MAAM;CACjC,IAAA,EAAE,QAAQ;CACV,IAAA,EAAE,WAAW,OAAO;CACpB;CACD,CAAC;AAMF,IAAa,mBAAmB,IAAA,EAAE,OAAO;CACvC,QAAQ,IAAA,EAAE,KAAK;EAAC;EAAS;EAAS;EAAM,CAAC,CAAC,UAAU,CAAC,QAAQ,QAAQ;CACrE,oBAAoB,eAAA,uBAAuB,GAAG,IAAA,EAAE,QAAQ,CAAC,CAAC,UAAU;CACpE,iBAAiB,IAAA,EAAE,QAAQ,CAAC,UAAU;CACtC,uBAAuB,IAAA,EAAE,QAAQ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,EAEX,QAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,SAAS,EAAE,SAAS;AAIhE,QAAO"}
{"version":3,"file":"config.cjs","names":[],"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'\nimport type { GeneratorPlugin } from './plugin/types'\n\nconst tokenJsonRegexSchema = z.object({\n regex: z.string(),\n flags: z.string().optional(),\n})\n\nconst tokenMatcherSchema = z.union([\n z.string(),\n z.instanceof(RegExp),\n tokenJsonRegexSchema,\n])\n\nexport type TokenMatcherJson = string | z.infer<typeof tokenJsonRegexSchema>\n\nexport type TokenMatcher = z.infer<typeof tokenMatcherSchema>\n\nexport const baseConfigSchema = z.object({\n target: z.enum(['react', 'solid', 'vue']).optional().default('react'),\n virtualRouteConfig: virtualRootRouteSchema.or(z.string()).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 quoteStyle: z.enum(['single', 'double']).optional().default('single'),\n semicolons: z.boolean().optional().default(false),\n disableLogging: z.boolean().optional().default(false),\n routeTreeFileHeader: z\n .array(z.string())\n .optional()\n .default([\n '/* eslint-disable */',\n '// @ts-nocheck',\n '// noinspection JSUnusedGlobalSymbols',\n ]),\n indexToken: tokenMatcherSchema.optional().default('index'),\n routeToken: tokenMatcherSchema.optional().default('route'),\n pathParamsAllowedCharacters: z\n .array(z.enum([';', ':', '@', '&', '=', '+', '$', ',']))\n .optional(),\n})\n\nexport type BaseConfig = z.infer<typeof baseConfigSchema>\n\nexport const configSchema = baseConfigSchema.extend({\n generatedRouteTree: z.string().optional().default('./src/routeTree.gen.ts'),\n disableTypes: z.boolean().optional().default(false),\n addExtensions: z\n .union([z.boolean(), z.string()])\n .optional()\n .default(false)\n .transform((v) =>\n typeof v === 'string' ? (v.startsWith('.') ? v : `.${v}`) : v,\n ),\n enableRouteTreeFormatting: z.boolean().optional().default(true),\n routeTreeFileFooter: z\n .union([\n z.array(z.string()).optional().default([]),\n z.custom<() => Array<string>>((value) => typeof value === 'function'),\n ])\n .optional(),\n autoCodeSplitting: z.boolean().optional(),\n customScaffolding: z\n .object({\n routeTemplate: z.string().optional(),\n lazyRouteTemplate: z.string().optional(),\n })\n .optional(),\n experimental: z\n .object({\n // TODO: This has been made stable and is now \"autoCodeSplitting\". Remove in next major version.\n enableCodeSplitting: z.boolean().optional(),\n })\n .optional(),\n plugins: z.array(z.custom<GeneratorPlugin>()).optional(),\n tmpDir: z.string().optional().default(''),\n importRoutesUsingAbsolutePaths: z.boolean().optional().default(false),\n})\n\nexport type Config = z.infer<typeof configSchema>\n\ntype ResolveParams = {\n configDirectory: string\n}\n\nexport function resolveConfigPath({ configDirectory }: ResolveParams) {\n return path.resolve(configDirectory, 'tsr.config.json')\n}\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 = resolveConfigPath({ configDirectory })\n const exists = existsSync(configFilePathJson)\n\n let config: Config\n\n if (exists) {\n // Parse file config (allows JSON regex-object form)\n const fileConfigRaw = JSON.parse(readFileSync(configFilePathJson, 'utf-8'))\n\n // Merge raw configs (inline overrides file), then parse once to apply defaults\n // This ensures file config values aren't overwritten by inline defaults\n const merged = {\n ...fileConfigRaw,\n ...inlineConfig,\n }\n config = configSchema.parse(merged)\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 const resolveTmpDir = (dir: string | Array<string>) => {\n if (Array.isArray(dir)) {\n dir = path.join(...dir)\n }\n if (!path.isAbsolute(dir)) {\n dir = path.resolve(process.cwd(), dir)\n }\n return dir\n }\n\n if (config.tmpDir) {\n config.tmpDir = resolveTmpDir(config.tmpDir)\n } else if (process.env.TSR_TMP_DIR) {\n config.tmpDir = resolveTmpDir(process.env.TSR_TMP_DIR)\n } else {\n config.tmpDir = resolveTmpDir(['.tanstack', 'tmp'])\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 // Check that indexToken and routeToken are not identical\n // Works for strings, RegExp, and JSON regex objects\n if (areTokensEqual(config.indexToken, config.routeToken)) {\n throw new Error(\n `The \"indexToken\" and \"routeToken\" options must be different.`,\n )\n }\n\n if (\n config.routeFileIgnorePrefix &&\n config.routeFileIgnorePrefix.trim() === '_'\n ) {\n throw new Error(\n `The \"routeFileIgnorePrefix\" cannot be an underscore (\"_\"). This is a reserved character used to denote a pathless route. Please use a different prefix.`,\n )\n }\n\n return config\n}\n\n/**\n * Compares two token matchers for equality.\n * Handles strings, RegExp instances, and JSON regex objects.\n */\nfunction areTokensEqual(a: TokenMatcher, b: TokenMatcher): boolean {\n // Both strings\n if (typeof a === 'string' && typeof b === 'string') {\n return a === b\n }\n\n // Both RegExp instances\n if (a instanceof RegExp && b instanceof RegExp) {\n return a.source === b.source && a.flags === b.flags\n }\n\n // Both JSON regex objects\n if (\n typeof a === 'object' &&\n 'regex' in a &&\n typeof b === 'object' &&\n 'regex' in b\n ) {\n return a.regex === b.regex && (a.flags ?? '') === (b.flags ?? '')\n }\n\n // Mixed types - not equal\n return false\n}\n"],"mappings":";;;;;;;AAMA,IAAM,uBAAuB,IAAA,EAAE,OAAO;CACpC,OAAO,IAAA,EAAE,QAAQ;CACjB,OAAO,IAAA,EAAE,QAAQ,CAAC,UAAU;CAC7B,CAAC;AAEF,IAAM,qBAAqB,IAAA,EAAE,MAAM;CACjC,IAAA,EAAE,QAAQ;CACV,IAAA,EAAE,WAAW,OAAO;CACpB;CACD,CAAC;AAMF,IAAa,mBAAmB,IAAA,EAAE,OAAO;CACvC,QAAQ,IAAA,EAAE,KAAK;EAAC;EAAS;EAAS;EAAM,CAAC,CAAC,UAAU,CAAC,QAAQ,QAAQ;CACrE,oBAAoB,eAAA,uBAAuB,GAAG,IAAA,EAAE,QAAQ,CAAC,CAAC,UAAU;CACpE,iBAAiB,IAAA,EAAE,QAAQ,CAAC,UAAU;CACtC,uBAAuB,IAAA,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,IAAI;CACzD,wBAAwB,IAAA,EAAE,QAAQ,CAAC,UAAU;CAC7C,iBAAiB,IAAA,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,eAAe;CAC9D,YAAY,IAAA,EAAE,KAAK,CAAC,UAAU,SAAS,CAAC,CAAC,UAAU,CAAC,QAAQ,SAAS;CACrE,YAAY,IAAA,EAAE,SAAS,CAAC,UAAU,CAAC,QAAQ,MAAM;CACjD,gBAAgB,IAAA,EAAE,SAAS,CAAC,UAAU,CAAC,QAAQ,MAAM;CACrD,qBAAqB,IAAA,EAClB,MAAM,IAAA,EAAE,QAAQ,CAAC,CACjB,UAAU,CACV,QAAQ;EACP;EACA;EACA;EACD,CAAC;CACJ,YAAY,mBAAmB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O;UACnC,QAAQ,IAAI,YACrB,QAAO,SAAS,cAAc,QAAQ,IAAI,YAAY;KAEtD,QAAO,SAAS,cAAc,CAAC,aAAa,MAAM,CAAC;AAGrD,gBAAe,OAAO;AACtB,QAAO;;AAGT,SAAS,eAAe,QAAgB;AACtC,KAAI,OAAO,OAAO,cAAc,wBAAwB,aAAa;EACnE,MAAM,UAAU;;;;;;AAMhB,UAAQ,MAAM,QAAQ;AACtB,QAAM,IAAI,MAAM,QAAQ;;AAK1B,KAAI,eAAe,OAAO,YAAY,OAAO,WAAW,CACtD,OAAM,IAAI,MACR,+DACD;AAGH,KACE,OAAO,yBACP,OAAO,sBAAsB,MAAM,KAAK,IAExC,OAAM,IAAI,MACR,0JACD;AAGH,QAAO;;;;;;AAOT,SAAS,eAAe,GAAiB,GAA0B;AAEjE,KAAI,OAAO,MAAM,YAAY,OAAO,MAAM,SACxC,QAAO,MAAM;AAIf,KAAI,aAAa,UAAU,aAAa,OACtC,QAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE;AAIhD,KACE,OAAO,MAAM,YACb,WAAW,KACX,OAAO,MAAM,YACb,WAAW,EAEX,QAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,SAAS,EAAE,SAAS;AAIhE,QAAO"}

@@ -6,24 +6,16 @@ import { z } from 'zod';

flags: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
regex: string;
flags?: string | undefined;
}, {
regex: string;
flags?: string | undefined;
}>;
declare const tokenMatcherSchema: z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodObject<{
}, z.core.$strip>;
declare const tokenMatcherSchema: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodObject<{
regex: z.ZodString;
flags: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
regex: string;
flags?: string | undefined;
}, {
regex: string;
flags?: string | undefined;
}>]>;
}, z.core.$strip>]>;
export type TokenMatcherJson = string | z.infer<typeof tokenJsonRegexSchema>;
export type TokenMatcher = z.infer<typeof tokenMatcherSchema>;
export declare const baseConfigSchema: z.ZodObject<{
target: z.ZodDefault<z.ZodOptional<z.ZodEnum<["react", "solid", "vue"]>>>;
virtualRouteConfig: z.ZodOptional<z.ZodUnion<[z.ZodType<import('@tanstack/virtual-file-routes').VirtualRootRoute, z.ZodTypeDef, import('@tanstack/virtual-file-routes').VirtualRootRoute>, z.ZodString]>>;
target: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
vue: "vue";
react: "react";
solid: "solid";
}>>>;
virtualRouteConfig: z.ZodOptional<z.ZodUnion<[z.ZodType<import('@tanstack/virtual-file-routes').VirtualRootRoute, unknown, z.core.$ZodTypeInternals<import('@tanstack/virtual-file-routes').VirtualRootRoute, unknown>>, z.ZodString]>>;
routeFilePrefix: z.ZodOptional<z.ZodString>;

@@ -33,72 +25,36 @@ routeFileIgnorePrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;

routesDirectory: z.ZodDefault<z.ZodOptional<z.ZodString>>;
quoteStyle: z.ZodDefault<z.ZodOptional<z.ZodEnum<["single", "double"]>>>;
quoteStyle: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
single: "single";
double: "double";
}>>>;
semicolons: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
disableLogging: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
routeTreeFileHeader: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
indexToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodObject<{
routeTreeFileHeader: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
indexToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodObject<{
regex: z.ZodString;
flags: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
regex: string;
flags?: string | undefined;
}, {
regex: string;
flags?: string | undefined;
}>]>>>;
routeToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodObject<{
}, z.core.$strip>]>>>;
routeToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodObject<{
regex: z.ZodString;
flags: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
regex: string;
flags?: string | undefined;
}, {
regex: string;
flags?: string | undefined;
}>]>>>;
pathParamsAllowedCharacters: z.ZodOptional<z.ZodArray<z.ZodEnum<[";", ":", "@", "&", "=", "+", "$", ","]>, "many">>;
}, "strip", z.ZodTypeAny, {
target: "vue" | "react" | "solid";
routeFileIgnorePrefix: string;
routesDirectory: string;
quoteStyle: "single" | "double";
semicolons: boolean;
disableLogging: boolean;
routeTreeFileHeader: string[];
indexToken: string | RegExp | {
regex: string;
flags?: string | undefined;
};
routeToken: string | RegExp | {
regex: string;
flags?: string | undefined;
};
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
routeFilePrefix?: string | undefined;
routeFileIgnorePattern?: string | undefined;
pathParamsAllowedCharacters?: (":" | "$" | ";" | "@" | "&" | "=" | "+" | ",")[] | undefined;
}, {
target?: "vue" | "react" | "solid" | undefined;
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
routeFilePrefix?: string | undefined;
routeFileIgnorePrefix?: string | undefined;
routeFileIgnorePattern?: string | undefined;
routesDirectory?: string | undefined;
quoteStyle?: "single" | "double" | undefined;
semicolons?: boolean | undefined;
disableLogging?: boolean | undefined;
routeTreeFileHeader?: string[] | undefined;
indexToken?: string | RegExp | {
regex: string;
flags?: string | undefined;
} | undefined;
routeToken?: string | RegExp | {
regex: string;
flags?: string | undefined;
} | undefined;
pathParamsAllowedCharacters?: (":" | "$" | ";" | "@" | "&" | "=" | "+" | ",")[] | undefined;
}>;
}, z.core.$strip>]>>>;
pathParamsAllowedCharacters: z.ZodOptional<z.ZodArray<z.ZodEnum<{
":": ":";
$: "$";
";": ";";
"@": "@";
"&": "&";
"=": "=";
"+": "+";
",": ",";
}>>>;
}, z.core.$strip>;
export type BaseConfig = z.infer<typeof baseConfigSchema>;
export declare const configSchema: z.ZodObject<{
target: z.ZodDefault<z.ZodOptional<z.ZodEnum<["react", "solid", "vue"]>>>;
virtualRouteConfig: z.ZodOptional<z.ZodUnion<[z.ZodType<import('@tanstack/virtual-file-routes').VirtualRootRoute, z.ZodTypeDef, import('@tanstack/virtual-file-routes').VirtualRootRoute>, z.ZodString]>>;
target: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
vue: "vue";
react: "react";
solid: "solid";
}>>>;
virtualRouteConfig: z.ZodOptional<z.ZodUnion<[z.ZodType<import('@tanstack/virtual-file-routes').VirtualRootRoute, unknown, z.core.$ZodTypeInternals<import('@tanstack/virtual-file-routes').VirtualRootRoute, unknown>>, z.ZodString]>>;
routeFilePrefix: z.ZodOptional<z.ZodString>;

@@ -108,33 +64,32 @@ routeFileIgnorePrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;

routesDirectory: z.ZodDefault<z.ZodOptional<z.ZodString>>;
quoteStyle: z.ZodDefault<z.ZodOptional<z.ZodEnum<["single", "double"]>>>;
quoteStyle: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
single: "single";
double: "double";
}>>>;
semicolons: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
disableLogging: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
routeTreeFileHeader: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
indexToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodObject<{
routeTreeFileHeader: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
indexToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodObject<{
regex: z.ZodString;
flags: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
regex: string;
flags?: string | undefined;
}, {
regex: string;
flags?: string | undefined;
}>]>>>;
routeToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodObject<{
}, z.core.$strip>]>>>;
routeToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodObject<{
regex: z.ZodString;
flags: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
regex: string;
flags?: string | undefined;
}, {
regex: string;
flags?: string | undefined;
}>]>>>;
pathParamsAllowedCharacters: z.ZodOptional<z.ZodArray<z.ZodEnum<[";", ":", "@", "&", "=", "+", "$", ","]>, "many">>;
} & {
}, z.core.$strip>]>>>;
pathParamsAllowedCharacters: z.ZodOptional<z.ZodArray<z.ZodEnum<{
":": ":";
$: "$";
";": ";";
"@": "@";
"&": "&";
"=": "=";
"+": "+";
",": ",";
}>>>;
generatedRouteTree: z.ZodDefault<z.ZodOptional<z.ZodString>>;
disableTypes: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
addExtensions: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>>, string | boolean, string | boolean | undefined>;
addExtensions: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>, z.ZodTransform<string | boolean, string | boolean>>;
enableRouteTreeFormatting: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
routeTreeFileFooter: z.ZodOptional<z.ZodUnion<[z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodArray<z.ZodString, "many">>]>>;
routeTreeFileFooter: z.ZodOptional<z.ZodUnion<readonly [z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>, z.ZodCustom<() => Array<string>, () => Array<string>>]>>;
autoCodeSplitting: z.ZodOptional<z.ZodBoolean>;

@@ -144,92 +99,10 @@ customScaffolding: z.ZodOptional<z.ZodObject<{

lazyRouteTemplate: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
routeTemplate?: string | undefined;
lazyRouteTemplate?: string | undefined;
}, {
routeTemplate?: string | undefined;
lazyRouteTemplate?: string | undefined;
}>>;
}, z.core.$strip>>;
experimental: z.ZodOptional<z.ZodObject<{
enableCodeSplitting: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
enableCodeSplitting?: boolean | undefined;
}, {
enableCodeSplitting?: boolean | undefined;
}>>;
plugins: z.ZodOptional<z.ZodArray<z.ZodType<GeneratorPlugin, z.ZodTypeDef, GeneratorPlugin>, "many">>;
}, z.core.$strip>>;
plugins: z.ZodOptional<z.ZodArray<z.ZodCustom<GeneratorPlugin, GeneratorPlugin>>>;
tmpDir: z.ZodDefault<z.ZodOptional<z.ZodString>>;
importRoutesUsingAbsolutePaths: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
}, "strip", z.ZodTypeAny, {
target: "vue" | "react" | "solid";
routeFileIgnorePrefix: string;
routesDirectory: string;
quoteStyle: "single" | "double";
semicolons: boolean;
disableLogging: boolean;
routeTreeFileHeader: string[];
indexToken: string | RegExp | {
regex: string;
flags?: string | undefined;
};
routeToken: string | RegExp | {
regex: string;
flags?: string | undefined;
};
generatedRouteTree: string;
disableTypes: boolean;
addExtensions: string | boolean;
enableRouteTreeFormatting: boolean;
tmpDir: string;
importRoutesUsingAbsolutePaths: boolean;
plugins?: GeneratorPlugin[] | undefined;
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
routeFilePrefix?: string | undefined;
routeFileIgnorePattern?: string | undefined;
pathParamsAllowedCharacters?: (":" | "$" | ";" | "@" | "&" | "=" | "+" | ",")[] | undefined;
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
autoCodeSplitting?: boolean | undefined;
customScaffolding?: {
routeTemplate?: string | undefined;
lazyRouteTemplate?: string | undefined;
} | undefined;
experimental?: {
enableCodeSplitting?: boolean | undefined;
} | undefined;
}, {
plugins?: GeneratorPlugin[] | undefined;
target?: "vue" | "react" | "solid" | undefined;
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
routeFilePrefix?: string | undefined;
routeFileIgnorePrefix?: string | undefined;
routeFileIgnorePattern?: string | undefined;
routesDirectory?: string | undefined;
quoteStyle?: "single" | "double" | undefined;
semicolons?: boolean | undefined;
disableLogging?: boolean | undefined;
routeTreeFileHeader?: string[] | undefined;
indexToken?: string | RegExp | {
regex: string;
flags?: string | undefined;
} | undefined;
routeToken?: string | RegExp | {
regex: string;
flags?: string | undefined;
} | undefined;
pathParamsAllowedCharacters?: (":" | "$" | ";" | "@" | "&" | "=" | "+" | ",")[] | undefined;
generatedRouteTree?: string | undefined;
disableTypes?: boolean | undefined;
addExtensions?: string | boolean | undefined;
enableRouteTreeFormatting?: boolean | undefined;
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
autoCodeSplitting?: boolean | undefined;
customScaffolding?: {
routeTemplate?: string | undefined;
lazyRouteTemplate?: string | undefined;
} | undefined;
experimental?: {
enableCodeSplitting?: boolean | undefined;
} | undefined;
tmpDir?: string | undefined;
importRoutesUsingAbsolutePaths?: boolean | undefined;
}>;
}, z.core.$strip>;
export type Config = z.infer<typeof configSchema>;

@@ -236,0 +109,0 @@ type ResolveParams = {

@@ -6,24 +6,16 @@ import { z } from 'zod';

flags: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
regex: string;
flags?: string | undefined;
}, {
regex: string;
flags?: string | undefined;
}>;
declare const tokenMatcherSchema: z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodObject<{
}, z.core.$strip>;
declare const tokenMatcherSchema: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodObject<{
regex: z.ZodString;
flags: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
regex: string;
flags?: string | undefined;
}, {
regex: string;
flags?: string | undefined;
}>]>;
}, z.core.$strip>]>;
export type TokenMatcherJson = string | z.infer<typeof tokenJsonRegexSchema>;
export type TokenMatcher = z.infer<typeof tokenMatcherSchema>;
export declare const baseConfigSchema: z.ZodObject<{
target: z.ZodDefault<z.ZodOptional<z.ZodEnum<["react", "solid", "vue"]>>>;
virtualRouteConfig: z.ZodOptional<z.ZodUnion<[z.ZodType<import('@tanstack/virtual-file-routes').VirtualRootRoute, z.ZodTypeDef, import('@tanstack/virtual-file-routes').VirtualRootRoute>, z.ZodString]>>;
target: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
vue: "vue";
react: "react";
solid: "solid";
}>>>;
virtualRouteConfig: z.ZodOptional<z.ZodUnion<[z.ZodType<import('@tanstack/virtual-file-routes').VirtualRootRoute, unknown, z.core.$ZodTypeInternals<import('@tanstack/virtual-file-routes').VirtualRootRoute, unknown>>, z.ZodString]>>;
routeFilePrefix: z.ZodOptional<z.ZodString>;

@@ -33,72 +25,36 @@ routeFileIgnorePrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;

routesDirectory: z.ZodDefault<z.ZodOptional<z.ZodString>>;
quoteStyle: z.ZodDefault<z.ZodOptional<z.ZodEnum<["single", "double"]>>>;
quoteStyle: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
single: "single";
double: "double";
}>>>;
semicolons: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
disableLogging: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
routeTreeFileHeader: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
indexToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodObject<{
routeTreeFileHeader: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
indexToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodObject<{
regex: z.ZodString;
flags: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
regex: string;
flags?: string | undefined;
}, {
regex: string;
flags?: string | undefined;
}>]>>>;
routeToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodObject<{
}, z.core.$strip>]>>>;
routeToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodObject<{
regex: z.ZodString;
flags: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
regex: string;
flags?: string | undefined;
}, {
regex: string;
flags?: string | undefined;
}>]>>>;
pathParamsAllowedCharacters: z.ZodOptional<z.ZodArray<z.ZodEnum<[";", ":", "@", "&", "=", "+", "$", ","]>, "many">>;
}, "strip", z.ZodTypeAny, {
target: "vue" | "react" | "solid";
routeFileIgnorePrefix: string;
routesDirectory: string;
quoteStyle: "single" | "double";
semicolons: boolean;
disableLogging: boolean;
routeTreeFileHeader: string[];
indexToken: string | RegExp | {
regex: string;
flags?: string | undefined;
};
routeToken: string | RegExp | {
regex: string;
flags?: string | undefined;
};
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
routeFilePrefix?: string | undefined;
routeFileIgnorePattern?: string | undefined;
pathParamsAllowedCharacters?: (":" | "$" | ";" | "@" | "&" | "=" | "+" | ",")[] | undefined;
}, {
target?: "vue" | "react" | "solid" | undefined;
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
routeFilePrefix?: string | undefined;
routeFileIgnorePrefix?: string | undefined;
routeFileIgnorePattern?: string | undefined;
routesDirectory?: string | undefined;
quoteStyle?: "single" | "double" | undefined;
semicolons?: boolean | undefined;
disableLogging?: boolean | undefined;
routeTreeFileHeader?: string[] | undefined;
indexToken?: string | RegExp | {
regex: string;
flags?: string | undefined;
} | undefined;
routeToken?: string | RegExp | {
regex: string;
flags?: string | undefined;
} | undefined;
pathParamsAllowedCharacters?: (":" | "$" | ";" | "@" | "&" | "=" | "+" | ",")[] | undefined;
}>;
}, z.core.$strip>]>>>;
pathParamsAllowedCharacters: z.ZodOptional<z.ZodArray<z.ZodEnum<{
":": ":";
$: "$";
";": ";";
"@": "@";
"&": "&";
"=": "=";
"+": "+";
",": ",";
}>>>;
}, z.core.$strip>;
export type BaseConfig = z.infer<typeof baseConfigSchema>;
export declare const configSchema: z.ZodObject<{
target: z.ZodDefault<z.ZodOptional<z.ZodEnum<["react", "solid", "vue"]>>>;
virtualRouteConfig: z.ZodOptional<z.ZodUnion<[z.ZodType<import('@tanstack/virtual-file-routes').VirtualRootRoute, z.ZodTypeDef, import('@tanstack/virtual-file-routes').VirtualRootRoute>, z.ZodString]>>;
target: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
vue: "vue";
react: "react";
solid: "solid";
}>>>;
virtualRouteConfig: z.ZodOptional<z.ZodUnion<[z.ZodType<import('@tanstack/virtual-file-routes').VirtualRootRoute, unknown, z.core.$ZodTypeInternals<import('@tanstack/virtual-file-routes').VirtualRootRoute, unknown>>, z.ZodString]>>;
routeFilePrefix: z.ZodOptional<z.ZodString>;

@@ -108,33 +64,32 @@ routeFileIgnorePrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;

routesDirectory: z.ZodDefault<z.ZodOptional<z.ZodString>>;
quoteStyle: z.ZodDefault<z.ZodOptional<z.ZodEnum<["single", "double"]>>>;
quoteStyle: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
single: "single";
double: "double";
}>>>;
semicolons: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
disableLogging: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
routeTreeFileHeader: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
indexToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodObject<{
routeTreeFileHeader: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
indexToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodObject<{
regex: z.ZodString;
flags: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
regex: string;
flags?: string | undefined;
}, {
regex: string;
flags?: string | undefined;
}>]>>>;
routeToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodObject<{
}, z.core.$strip>]>>>;
routeToken: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodObject<{
regex: z.ZodString;
flags: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
regex: string;
flags?: string | undefined;
}, {
regex: string;
flags?: string | undefined;
}>]>>>;
pathParamsAllowedCharacters: z.ZodOptional<z.ZodArray<z.ZodEnum<[";", ":", "@", "&", "=", "+", "$", ","]>, "many">>;
} & {
}, z.core.$strip>]>>>;
pathParamsAllowedCharacters: z.ZodOptional<z.ZodArray<z.ZodEnum<{
":": ":";
$: "$";
";": ";";
"@": "@";
"&": "&";
"=": "=";
"+": "+";
",": ",";
}>>>;
generatedRouteTree: z.ZodDefault<z.ZodOptional<z.ZodString>>;
disableTypes: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
addExtensions: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>>, string | boolean, string | boolean | undefined>;
addExtensions: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>, z.ZodTransform<string | boolean, string | boolean>>;
enableRouteTreeFormatting: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
routeTreeFileFooter: z.ZodOptional<z.ZodUnion<[z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodArray<z.ZodString, "many">>]>>;
routeTreeFileFooter: z.ZodOptional<z.ZodUnion<readonly [z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>, z.ZodCustom<() => Array<string>, () => Array<string>>]>>;
autoCodeSplitting: z.ZodOptional<z.ZodBoolean>;

@@ -144,92 +99,10 @@ customScaffolding: z.ZodOptional<z.ZodObject<{

lazyRouteTemplate: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
routeTemplate?: string | undefined;
lazyRouteTemplate?: string | undefined;
}, {
routeTemplate?: string | undefined;
lazyRouteTemplate?: string | undefined;
}>>;
}, z.core.$strip>>;
experimental: z.ZodOptional<z.ZodObject<{
enableCodeSplitting: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
enableCodeSplitting?: boolean | undefined;
}, {
enableCodeSplitting?: boolean | undefined;
}>>;
plugins: z.ZodOptional<z.ZodArray<z.ZodType<GeneratorPlugin, z.ZodTypeDef, GeneratorPlugin>, "many">>;
}, z.core.$strip>>;
plugins: z.ZodOptional<z.ZodArray<z.ZodCustom<GeneratorPlugin, GeneratorPlugin>>>;
tmpDir: z.ZodDefault<z.ZodOptional<z.ZodString>>;
importRoutesUsingAbsolutePaths: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
}, "strip", z.ZodTypeAny, {
target: "vue" | "react" | "solid";
routeFileIgnorePrefix: string;
routesDirectory: string;
quoteStyle: "single" | "double";
semicolons: boolean;
disableLogging: boolean;
routeTreeFileHeader: string[];
indexToken: string | RegExp | {
regex: string;
flags?: string | undefined;
};
routeToken: string | RegExp | {
regex: string;
flags?: string | undefined;
};
generatedRouteTree: string;
disableTypes: boolean;
addExtensions: string | boolean;
enableRouteTreeFormatting: boolean;
tmpDir: string;
importRoutesUsingAbsolutePaths: boolean;
plugins?: GeneratorPlugin[] | undefined;
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
routeFilePrefix?: string | undefined;
routeFileIgnorePattern?: string | undefined;
pathParamsAllowedCharacters?: (":" | "$" | ";" | "@" | "&" | "=" | "+" | ",")[] | undefined;
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
autoCodeSplitting?: boolean | undefined;
customScaffolding?: {
routeTemplate?: string | undefined;
lazyRouteTemplate?: string | undefined;
} | undefined;
experimental?: {
enableCodeSplitting?: boolean | undefined;
} | undefined;
}, {
plugins?: GeneratorPlugin[] | undefined;
target?: "vue" | "react" | "solid" | undefined;
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
routeFilePrefix?: string | undefined;
routeFileIgnorePrefix?: string | undefined;
routeFileIgnorePattern?: string | undefined;
routesDirectory?: string | undefined;
quoteStyle?: "single" | "double" | undefined;
semicolons?: boolean | undefined;
disableLogging?: boolean | undefined;
routeTreeFileHeader?: string[] | undefined;
indexToken?: string | RegExp | {
regex: string;
flags?: string | undefined;
} | undefined;
routeToken?: string | RegExp | {
regex: string;
flags?: string | undefined;
} | undefined;
pathParamsAllowedCharacters?: (":" | "$" | ";" | "@" | "&" | "=" | "+" | ",")[] | undefined;
generatedRouteTree?: string | undefined;
disableTypes?: boolean | undefined;
addExtensions?: string | boolean | undefined;
enableRouteTreeFormatting?: boolean | undefined;
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
autoCodeSplitting?: boolean | undefined;
customScaffolding?: {
routeTemplate?: string | undefined;
lazyRouteTemplate?: string | undefined;
} | undefined;
experimental?: {
enableCodeSplitting?: boolean | undefined;
} | undefined;
tmpDir?: string | undefined;
importRoutesUsingAbsolutePaths?: boolean | undefined;
}>;
}, z.core.$strip>;
export type Config = z.infer<typeof configSchema>;

@@ -236,0 +109,0 @@ type ResolveParams = {

@@ -52,3 +52,3 @@ import { virtualRootRouteSchema } from "./filesystem/virtual/config.js";

enableRouteTreeFormatting: z.boolean().optional().default(true),
routeTreeFileFooter: z.union([z.array(z.string()).optional().default([]), z.function().returns(z.array(z.string()))]).optional(),
routeTreeFileFooter: z.union([z.array(z.string()).optional().default([]), z.custom((value) => typeof value === "function")]).optional(),
autoCodeSplitting: z.boolean().optional(),

@@ -55,0 +55,0 @@ customScaffolding: z.object({

@@ -1,1 +0,1 @@

{"version":3,"file":"config.js","names":[],"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'\nimport type { GeneratorPlugin } from './plugin/types'\n\nconst tokenJsonRegexSchema = z.object({\n regex: z.string(),\n flags: z.string().optional(),\n})\n\nconst tokenMatcherSchema = z.union([\n z.string(),\n z.instanceof(RegExp),\n tokenJsonRegexSchema,\n])\n\nexport type TokenMatcherJson = string | z.infer<typeof tokenJsonRegexSchema>\n\nexport type TokenMatcher = z.infer<typeof tokenMatcherSchema>\n\nexport const baseConfigSchema = z.object({\n target: z.enum(['react', 'solid', 'vue']).optional().default('react'),\n virtualRouteConfig: virtualRootRouteSchema.or(z.string()).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 quoteStyle: z.enum(['single', 'double']).optional().default('single'),\n semicolons: z.boolean().optional().default(false),\n disableLogging: z.boolean().optional().default(false),\n routeTreeFileHeader: z\n .array(z.string())\n .optional()\n .default([\n '/* eslint-disable */',\n '// @ts-nocheck',\n '// noinspection JSUnusedGlobalSymbols',\n ]),\n indexToken: tokenMatcherSchema.optional().default('index'),\n routeToken: tokenMatcherSchema.optional().default('route'),\n pathParamsAllowedCharacters: z\n .array(z.enum([';', ':', '@', '&', '=', '+', '$', ',']))\n .optional(),\n})\n\nexport type BaseConfig = z.infer<typeof baseConfigSchema>\n\nexport const configSchema = baseConfigSchema.extend({\n generatedRouteTree: z.string().optional().default('./src/routeTree.gen.ts'),\n disableTypes: z.boolean().optional().default(false),\n addExtensions: z\n .union([z.boolean(), z.string()])\n .optional()\n .default(false)\n .transform((v) =>\n typeof v === 'string' ? (v.startsWith('.') ? v : `.${v}`) : v,\n ),\n enableRouteTreeFormatting: z.boolean().optional().default(true),\n routeTreeFileFooter: z\n .union([\n z.array(z.string()).optional().default([]),\n z.function().returns(z.array(z.string())),\n ])\n .optional(),\n autoCodeSplitting: z.boolean().optional(),\n customScaffolding: z\n .object({\n routeTemplate: z.string().optional(),\n lazyRouteTemplate: z.string().optional(),\n })\n .optional(),\n experimental: z\n .object({\n // TODO: This has been made stable and is now \"autoCodeSplitting\". Remove in next major version.\n enableCodeSplitting: z.boolean().optional(),\n })\n .optional(),\n plugins: z.array(z.custom<GeneratorPlugin>()).optional(),\n tmpDir: z.string().optional().default(''),\n importRoutesUsingAbsolutePaths: z.boolean().optional().default(false),\n})\n\nexport type Config = z.infer<typeof configSchema>\n\ntype ResolveParams = {\n configDirectory: string\n}\n\nexport function resolveConfigPath({ configDirectory }: ResolveParams) {\n return path.resolve(configDirectory, 'tsr.config.json')\n}\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 = resolveConfigPath({ configDirectory })\n const exists = existsSync(configFilePathJson)\n\n let config: Config\n\n if (exists) {\n // Parse file config (allows JSON regex-object form)\n const fileConfigRaw = JSON.parse(readFileSync(configFilePathJson, 'utf-8'))\n\n // Merge raw configs (inline overrides file), then parse once to apply defaults\n // This ensures file config values aren't overwritten by inline defaults\n const merged = {\n ...fileConfigRaw,\n ...inlineConfig,\n }\n config = configSchema.parse(merged)\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 const resolveTmpDir = (dir: string | Array<string>) => {\n if (Array.isArray(dir)) {\n dir = path.join(...dir)\n }\n if (!path.isAbsolute(dir)) {\n dir = path.resolve(process.cwd(), dir)\n }\n return dir\n }\n\n if (config.tmpDir) {\n config.tmpDir = resolveTmpDir(config.tmpDir)\n } else if (process.env.TSR_TMP_DIR) {\n config.tmpDir = resolveTmpDir(process.env.TSR_TMP_DIR)\n } else {\n config.tmpDir = resolveTmpDir(['.tanstack', 'tmp'])\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 // Check that indexToken and routeToken are not identical\n // Works for strings, RegExp, and JSON regex objects\n if (areTokensEqual(config.indexToken, config.routeToken)) {\n throw new Error(\n `The \"indexToken\" and \"routeToken\" options must be different.`,\n )\n }\n\n if (\n config.routeFileIgnorePrefix &&\n config.routeFileIgnorePrefix.trim() === '_'\n ) {\n throw new Error(\n `The \"routeFileIgnorePrefix\" cannot be an underscore (\"_\"). This is a reserved character used to denote a pathless route. Please use a different prefix.`,\n )\n }\n\n return config\n}\n\n/**\n * Compares two token matchers for equality.\n * Handles strings, RegExp instances, and JSON regex objects.\n */\nfunction areTokensEqual(a: TokenMatcher, b: TokenMatcher): boolean {\n // Both strings\n if (typeof a === 'string' && typeof b === 'string') {\n return a === b\n }\n\n // Both RegExp instances\n if (a instanceof RegExp && b instanceof RegExp) {\n return a.source === b.source && a.flags === b.flags\n }\n\n // Both JSON regex objects\n if (\n typeof a === 'object' &&\n 'regex' in a &&\n typeof b === 'object' &&\n 'regex' in b\n ) {\n return a.regex === b.regex && (a.flags ?? '') === (b.flags ?? '')\n }\n\n // Mixed types - not equal\n return false\n}\n"],"mappings":";;;;;AAMA,IAAM,uBAAuB,EAAE,OAAO;CACpC,OAAO,EAAE,QAAQ;CACjB,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC7B,CAAC;AAEF,IAAM,qBAAqB,EAAE,MAAM;CACjC,EAAE,QAAQ;CACV,EAAE,WAAW,OAAO;CACpB;CACD,CAAC;AAMF,IAAa,mBAAmB,EAAE,OAAO;CACvC,QAAQ,EAAE,KAAK;EAAC;EAAS;EAAS;EAAM,CAAC,CAAC,UAAU,CAAC,QAAQ,QAAQ;CACrE,oBAAoB,uBAAuB,GAAG,EAAE,QAAQ,CAAC,CAAC,UAAU;CACpE,iBAAiB,EAAE,QAAQ,CAAC,UAAU;CACtC,uBAAuB,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,IAAI;CACzD,wBAAwB,EAAE,QAAQ,CAAC,UAAU;CAC7C,iBAAiB,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,eAAe;CAC9D,YAAY,EAAE,KAAK,CAAC,UAAU,SAAS,CAAC,CAAC,UAAU,CAAC,QAAQ,SAAS;CACrE,YAAY,EAAE,SAAS,CA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AAc,OAAO,OAAO;UACnC,QAAQ,IAAI,YACrB,QAAO,SAAS,cAAc,QAAQ,IAAI,YAAY;KAEtD,QAAO,SAAS,cAAc,CAAC,aAAa,MAAM,CAAC;AAGrD,gBAAe,OAAO;AACtB,QAAO;;AAGT,SAAS,eAAe,QAAgB;AACtC,KAAI,OAAO,OAAO,cAAc,wBAAwB,aAAa;EACnE,MAAM,UAAU;;;;;;AAMhB,UAAQ,MAAM,QAAQ;AACtB,QAAM,IAAI,MAAM,QAAQ;;AAK1B,KAAI,eAAe,OAAO,YAAY,OAAO,WAAW,CACtD,OAAM,IAAI,MACR,+DACD;AAGH,KACE,OAAO,yBACP,OAAO,sBAAsB,MAAM,KAAK,IAExC,OAAM,IAAI,MACR,0JACD;AAGH,QAAO;;;;;;AAOT,SAAS,eAAe,GAAiB,GAA0B;AAEjE,KAAI,OAAO,MAAM,YAAY,OAAO,MAAM,SACxC,QAAO,MAAM;AAIf,KAAI,aAAa,UAAU,aAAa,OACtC,QAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE;AAIhD,KACE,OAAO,MAAM,YACb,WAAW,KACX,OAAO,MAAM,YACb,WAAW,EAEX,QAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,SAAS,EAAE,SAAS;AAIhE,QAAO"}
{"version":3,"file":"config.js","names":[],"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'\nimport type { GeneratorPlugin } from './plugin/types'\n\nconst tokenJsonRegexSchema = z.object({\n regex: z.string(),\n flags: z.string().optional(),\n})\n\nconst tokenMatcherSchema = z.union([\n z.string(),\n z.instanceof(RegExp),\n tokenJsonRegexSchema,\n])\n\nexport type TokenMatcherJson = string | z.infer<typeof tokenJsonRegexSchema>\n\nexport type TokenMatcher = z.infer<typeof tokenMatcherSchema>\n\nexport const baseConfigSchema = z.object({\n target: z.enum(['react', 'solid', 'vue']).optional().default('react'),\n virtualRouteConfig: virtualRootRouteSchema.or(z.string()).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 quoteStyle: z.enum(['single', 'double']).optional().default('single'),\n semicolons: z.boolean().optional().default(false),\n disableLogging: z.boolean().optional().default(false),\n routeTreeFileHeader: z\n .array(z.string())\n .optional()\n .default([\n '/* eslint-disable */',\n '// @ts-nocheck',\n '// noinspection JSUnusedGlobalSymbols',\n ]),\n indexToken: tokenMatcherSchema.optional().default('index'),\n routeToken: tokenMatcherSchema.optional().default('route'),\n pathParamsAllowedCharacters: z\n .array(z.enum([';', ':', '@', '&', '=', '+', '$', ',']))\n .optional(),\n})\n\nexport type BaseConfig = z.infer<typeof baseConfigSchema>\n\nexport const configSchema = baseConfigSchema.extend({\n generatedRouteTree: z.string().optional().default('./src/routeTree.gen.ts'),\n disableTypes: z.boolean().optional().default(false),\n addExtensions: z\n .union([z.boolean(), z.string()])\n .optional()\n .default(false)\n .transform((v) =>\n typeof v === 'string' ? (v.startsWith('.') ? v : `.${v}`) : v,\n ),\n enableRouteTreeFormatting: z.boolean().optional().default(true),\n routeTreeFileFooter: z\n .union([\n z.array(z.string()).optional().default([]),\n z.custom<() => Array<string>>((value) => typeof value === 'function'),\n ])\n .optional(),\n autoCodeSplitting: z.boolean().optional(),\n customScaffolding: z\n .object({\n routeTemplate: z.string().optional(),\n lazyRouteTemplate: z.string().optional(),\n })\n .optional(),\n experimental: z\n .object({\n // TODO: This has been made stable and is now \"autoCodeSplitting\". Remove in next major version.\n enableCodeSplitting: z.boolean().optional(),\n })\n .optional(),\n plugins: z.array(z.custom<GeneratorPlugin>()).optional(),\n tmpDir: z.string().optional().default(''),\n importRoutesUsingAbsolutePaths: z.boolean().optional().default(false),\n})\n\nexport type Config = z.infer<typeof configSchema>\n\ntype ResolveParams = {\n configDirectory: string\n}\n\nexport function resolveConfigPath({ configDirectory }: ResolveParams) {\n return path.resolve(configDirectory, 'tsr.config.json')\n}\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 = resolveConfigPath({ configDirectory })\n const exists = existsSync(configFilePathJson)\n\n let config: Config\n\n if (exists) {\n // Parse file config (allows JSON regex-object form)\n const fileConfigRaw = JSON.parse(readFileSync(configFilePathJson, 'utf-8'))\n\n // Merge raw configs (inline overrides file), then parse once to apply defaults\n // This ensures file config values aren't overwritten by inline defaults\n const merged = {\n ...fileConfigRaw,\n ...inlineConfig,\n }\n config = configSchema.parse(merged)\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 const resolveTmpDir = (dir: string | Array<string>) => {\n if (Array.isArray(dir)) {\n dir = path.join(...dir)\n }\n if (!path.isAbsolute(dir)) {\n dir = path.resolve(process.cwd(), dir)\n }\n return dir\n }\n\n if (config.tmpDir) {\n config.tmpDir = resolveTmpDir(config.tmpDir)\n } else if (process.env.TSR_TMP_DIR) {\n config.tmpDir = resolveTmpDir(process.env.TSR_TMP_DIR)\n } else {\n config.tmpDir = resolveTmpDir(['.tanstack', 'tmp'])\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 // Check that indexToken and routeToken are not identical\n // Works for strings, RegExp, and JSON regex objects\n if (areTokensEqual(config.indexToken, config.routeToken)) {\n throw new Error(\n `The \"indexToken\" and \"routeToken\" options must be different.`,\n )\n }\n\n if (\n config.routeFileIgnorePrefix &&\n config.routeFileIgnorePrefix.trim() === '_'\n ) {\n throw new Error(\n `The \"routeFileIgnorePrefix\" cannot be an underscore (\"_\"). This is a reserved character used to denote a pathless route. Please use a different prefix.`,\n )\n }\n\n return config\n}\n\n/**\n * Compares two token matchers for equality.\n * Handles strings, RegExp instances, and JSON regex objects.\n */\nfunction areTokensEqual(a: TokenMatcher, b: TokenMatcher): boolean {\n // Both strings\n if (typeof a === 'string' && typeof b === 'string') {\n return a === b\n }\n\n // Both RegExp instances\n if (a instanceof RegExp && b instanceof RegExp) {\n return a.source === b.source && a.flags === b.flags\n }\n\n // Both JSON regex objects\n if (\n typeof a === 'object' &&\n 'regex' in a &&\n typeof b === 'object' &&\n 'regex' in b\n ) {\n return a.regex === b.regex && (a.flags ?? '') === (b.flags ?? '')\n }\n\n // Mixed types - not equal\n return false\n}\n"],"mappings":";;;;;AAMA,IAAM,uBAAuB,EAAE,OAAO;CACpC,OAAO,EAAE,QAAQ;CACjB,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC7B,CAAC;AAEF,IAAM,qBAAqB,EAAE,MAAM;CACjC,EAAE,QAAQ;CACV,EAAE,WAAW,OAAO;CACpB;CACD,CAAC;AAMF,IAAa,mBAAmB,EAAE,OAAO;CACvC,QAAQ,EAAE,KAAK;EAAC;EAAS;EAAS;EAAM,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
"description": "Modern and scalable routing for React applications",

@@ -56,11 +56,11 @@ "author": "Tanner Linsley",

"prettier": "^3.5.0",
"zod": "^3.24.2",
"@tanstack/router-core": "1.171.2",
"@tanstack/router-utils": "1.162.0",
"zod": "^4.4.3",
"@tanstack/router-core": "1.171.3",
"@tanstack/router-utils": "1.162.1",
"@tanstack/virtual-file-routes": "1.162.0"
},
"devDependencies": {
"@types/node": ">=20",
"vite": "*",
"@types/node": ">=20",
"@tanstack/react-router": "1.170.4"
"@tanstack/react-router": "1.170.5"
},

@@ -67,0 +67,0 @@ "scripts": {

@@ -63,3 +63,3 @@ import path from 'node:path'

z.array(z.string()).optional().default([]),
z.function().returns(z.array(z.string())),
z.custom<() => Array<string>>((value) => typeof value === 'function'),
])

@@ -66,0 +66,0 @@ .optional(),