@tanstack/router-generator 1.121.15 → 1.121.17
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.
- package/package.json +5 -5
- package/dist/cjs/config.cjs +0 -140
- package/dist/cjs/config.cjs.map +0 -1
- package/dist/cjs/config.d.cts +0 -155
- package/dist/cjs/filesystem/physical/getRouteNodes.cjs +0 -204
- package/dist/cjs/filesystem/physical/getRouteNodes.cjs.map +0 -1
- package/dist/cjs/filesystem/physical/getRouteNodes.d.cts +0 -15
- package/dist/cjs/filesystem/physical/rootPathId.cjs +0 -5
- package/dist/cjs/filesystem/physical/rootPathId.cjs.map +0 -1
- package/dist/cjs/filesystem/physical/rootPathId.d.cts +0 -1
- package/dist/cjs/filesystem/virtual/config.cjs +0 -37
- package/dist/cjs/filesystem/virtual/config.cjs.map +0 -1
- package/dist/cjs/filesystem/virtual/config.d.cts +0 -3
- package/dist/cjs/filesystem/virtual/getRouteNodes.cjs +0 -192
- package/dist/cjs/filesystem/virtual/getRouteNodes.cjs.map +0 -1
- package/dist/cjs/filesystem/virtual/getRouteNodes.d.cts +0 -8
- package/dist/cjs/filesystem/virtual/loadConfigFile.cjs +0 -11
- package/dist/cjs/filesystem/virtual/loadConfigFile.cjs.map +0 -1
- package/dist/cjs/filesystem/virtual/loadConfigFile.d.cts +0 -1
- package/dist/cjs/generator.cjs +0 -970
- package/dist/cjs/generator.cjs.map +0 -1
- package/dist/cjs/generator.d.cts +0 -76
- package/dist/cjs/index.cjs +0 -35
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/index.d.cts +0 -12
- package/dist/cjs/logger.cjs +0 -37
- package/dist/cjs/logger.cjs.map +0 -1
- package/dist/cjs/logger.d.cts +0 -10
- package/dist/cjs/plugin/default-generator-plugin.cjs +0 -101
- package/dist/cjs/plugin/default-generator-plugin.cjs.map +0 -1
- package/dist/cjs/plugin/default-generator-plugin.d.cts +0 -2
- package/dist/cjs/plugin/types.d.cts +0 -46
- package/dist/cjs/template.cjs +0 -110
- package/dist/cjs/template.cjs.map +0 -1
- package/dist/cjs/template.d.cts +0 -33
- package/dist/cjs/transform/default-transform-plugin.cjs +0 -95
- package/dist/cjs/transform/default-transform-plugin.cjs.map +0 -1
- package/dist/cjs/transform/default-transform-plugin.d.cts +0 -2
- package/dist/cjs/transform/transform.cjs +0 -374
- package/dist/cjs/transform/transform.cjs.map +0 -1
- package/dist/cjs/transform/transform.d.cts +0 -4
- package/dist/cjs/transform/types.d.cts +0 -43
- package/dist/cjs/transform/utils.cjs +0 -36
- package/dist/cjs/transform/utils.cjs.map +0 -1
- package/dist/cjs/transform/utils.d.cts +0 -2
- package/dist/cjs/types.d.cts +0 -47
- package/dist/cjs/utils.cjs +0 -438
- package/dist/cjs/utils.cjs.map +0 -1
- package/dist/cjs/utils.d.cts +0 -133
- package/dist/esm/config.d.ts +0 -155
- package/dist/esm/config.js +0 -140
- package/dist/esm/config.js.map +0 -1
- package/dist/esm/filesystem/physical/getRouteNodes.d.ts +0 -15
- package/dist/esm/filesystem/physical/getRouteNodes.js +0 -187
- package/dist/esm/filesystem/physical/getRouteNodes.js.map +0 -1
- package/dist/esm/filesystem/physical/rootPathId.d.ts +0 -1
- package/dist/esm/filesystem/physical/rootPathId.js +0 -5
- package/dist/esm/filesystem/physical/rootPathId.js.map +0 -1
- package/dist/esm/filesystem/virtual/config.d.ts +0 -3
- package/dist/esm/filesystem/virtual/config.js +0 -37
- package/dist/esm/filesystem/virtual/config.js.map +0 -1
- package/dist/esm/filesystem/virtual/getRouteNodes.d.ts +0 -8
- package/dist/esm/filesystem/virtual/getRouteNodes.js +0 -192
- package/dist/esm/filesystem/virtual/getRouteNodes.js.map +0 -1
- package/dist/esm/filesystem/virtual/loadConfigFile.d.ts +0 -1
- package/dist/esm/filesystem/virtual/loadConfigFile.js +0 -11
- package/dist/esm/filesystem/virtual/loadConfigFile.js.map +0 -1
- package/dist/esm/generator.d.ts +0 -76
- package/dist/esm/generator.js +0 -953
- package/dist/esm/generator.js.map +0 -1
- package/dist/esm/index.d.ts +0 -12
- package/dist/esm/index.js +0 -35
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/logger.d.ts +0 -10
- package/dist/esm/logger.js +0 -37
- package/dist/esm/logger.js.map +0 -1
- package/dist/esm/plugin/default-generator-plugin.d.ts +0 -2
- package/dist/esm/plugin/default-generator-plugin.js +0 -101
- package/dist/esm/plugin/default-generator-plugin.js.map +0 -1
- package/dist/esm/plugin/types.d.ts +0 -46
- package/dist/esm/template.d.ts +0 -33
- package/dist/esm/template.js +0 -110
- package/dist/esm/template.js.map +0 -1
- package/dist/esm/transform/default-transform-plugin.d.ts +0 -2
- package/dist/esm/transform/default-transform-plugin.js +0 -95
- package/dist/esm/transform/default-transform-plugin.js.map +0 -1
- package/dist/esm/transform/transform.d.ts +0 -4
- package/dist/esm/transform/transform.js +0 -374
- package/dist/esm/transform/transform.js.map +0 -1
- package/dist/esm/transform/types.d.ts +0 -43
- package/dist/esm/transform/utils.d.ts +0 -2
- package/dist/esm/transform/utils.js +0 -36
- package/dist/esm/transform/utils.js.map +0 -1
- package/dist/esm/types.d.ts +0 -47
- package/dist/esm/utils.d.ts +0 -133
- package/dist/esm/utils.js +0 -420
- package/dist/esm/utils.js.map +0 -1
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const path = require("node:path");
|
|
4
|
-
const utils = require("../../utils.cjs");
|
|
5
|
-
const getRouteNodes$1 = require("../physical/getRouteNodes.cjs");
|
|
6
|
-
const rootPathId = require("../physical/rootPathId.cjs");
|
|
7
|
-
const config = require("./config.cjs");
|
|
8
|
-
const loadConfigFile = require("./loadConfigFile.cjs");
|
|
9
|
-
function ensureLeadingUnderScore(id) {
|
|
10
|
-
if (id.startsWith("_")) {
|
|
11
|
-
return id;
|
|
12
|
-
}
|
|
13
|
-
return `_${id}`;
|
|
14
|
-
}
|
|
15
|
-
function flattenTree(node) {
|
|
16
|
-
const result = [node];
|
|
17
|
-
if (node.children) {
|
|
18
|
-
for (const child of node.children) {
|
|
19
|
-
result.push(...flattenTree(child));
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
delete node.children;
|
|
23
|
-
return result;
|
|
24
|
-
}
|
|
25
|
-
async function getRouteNodes(tsrConfig, root) {
|
|
26
|
-
const fullDir = path.resolve(tsrConfig.routesDirectory);
|
|
27
|
-
if (tsrConfig.virtualRouteConfig === void 0) {
|
|
28
|
-
throw new Error(`virtualRouteConfig is undefined`);
|
|
29
|
-
}
|
|
30
|
-
let virtualRouteConfig;
|
|
31
|
-
if (typeof tsrConfig.virtualRouteConfig === "string") {
|
|
32
|
-
virtualRouteConfig = await getVirtualRouteConfigFromFileExport(
|
|
33
|
-
tsrConfig,
|
|
34
|
-
root
|
|
35
|
-
);
|
|
36
|
-
} else {
|
|
37
|
-
virtualRouteConfig = tsrConfig.virtualRouteConfig;
|
|
38
|
-
}
|
|
39
|
-
const { children, physicalDirectories } = await getRouteNodesRecursive(
|
|
40
|
-
tsrConfig,
|
|
41
|
-
root,
|
|
42
|
-
fullDir,
|
|
43
|
-
virtualRouteConfig.children
|
|
44
|
-
);
|
|
45
|
-
const allNodes = flattenTree({
|
|
46
|
-
children,
|
|
47
|
-
filePath: virtualRouteConfig.file,
|
|
48
|
-
fullPath: utils.replaceBackslash(path.join(fullDir, virtualRouteConfig.file)),
|
|
49
|
-
variableName: "root",
|
|
50
|
-
routePath: `/${rootPathId.rootPathId}`,
|
|
51
|
-
_fsRouteType: "__root"
|
|
52
|
-
});
|
|
53
|
-
const rootRouteNode = allNodes[0];
|
|
54
|
-
const routeNodes = allNodes.slice(1);
|
|
55
|
-
return { rootRouteNode, routeNodes, physicalDirectories };
|
|
56
|
-
}
|
|
57
|
-
async function getVirtualRouteConfigFromFileExport(tsrConfig, root) {
|
|
58
|
-
if (tsrConfig.virtualRouteConfig === void 0 || typeof tsrConfig.virtualRouteConfig !== "string" || tsrConfig.virtualRouteConfig === "") {
|
|
59
|
-
throw new Error(`virtualRouteConfig is undefined or empty`);
|
|
60
|
-
}
|
|
61
|
-
const exports2 = await loadConfigFile.loadConfigFile(path.join(root, tsrConfig.virtualRouteConfig));
|
|
62
|
-
if (!("routes" in exports2) && !("default" in exports2)) {
|
|
63
|
-
throw new Error(
|
|
64
|
-
`routes not found in ${tsrConfig.virtualRouteConfig}. The routes export must be named like 'export const routes = ...' or done using 'export default ...'`
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
const virtualRouteConfig = "routes" in exports2 ? exports2.routes : exports2.default;
|
|
68
|
-
return config.virtualRootRouteSchema.parse(virtualRouteConfig);
|
|
69
|
-
}
|
|
70
|
-
async function getRouteNodesRecursive(tsrConfig, root, fullDir, nodes, parent) {
|
|
71
|
-
if (nodes === void 0) {
|
|
72
|
-
return { children: [], physicalDirectories: [] };
|
|
73
|
-
}
|
|
74
|
-
const allPhysicalDirectories = [];
|
|
75
|
-
const children = await Promise.all(
|
|
76
|
-
nodes.map(async (node) => {
|
|
77
|
-
if (node.type === "physical") {
|
|
78
|
-
const { routeNodes, physicalDirectories } = await getRouteNodes$1.getRouteNodes(
|
|
79
|
-
{
|
|
80
|
-
...tsrConfig,
|
|
81
|
-
routesDirectory: path.resolve(fullDir, node.directory)
|
|
82
|
-
},
|
|
83
|
-
root
|
|
84
|
-
);
|
|
85
|
-
allPhysicalDirectories.push(node.directory);
|
|
86
|
-
routeNodes.forEach((subtreeNode) => {
|
|
87
|
-
subtreeNode.variableName = utils.routePathToVariable(
|
|
88
|
-
`${node.pathPrefix}/${utils.removeExt(subtreeNode.filePath)}`
|
|
89
|
-
);
|
|
90
|
-
subtreeNode.routePath = `${(parent == null ? void 0 : parent.routePath) ?? ""}${node.pathPrefix}${subtreeNode.routePath}`;
|
|
91
|
-
subtreeNode.filePath = `${node.directory}/${subtreeNode.filePath}`;
|
|
92
|
-
});
|
|
93
|
-
return routeNodes;
|
|
94
|
-
}
|
|
95
|
-
function getFile(file) {
|
|
96
|
-
const filePath = file;
|
|
97
|
-
const variableName = utils.routePathToVariable(utils.removeExt(filePath));
|
|
98
|
-
const fullPath = utils.replaceBackslash(path.join(fullDir, filePath));
|
|
99
|
-
return { filePath, variableName, fullPath };
|
|
100
|
-
}
|
|
101
|
-
const parentRoutePath = utils.removeTrailingSlash((parent == null ? void 0 : parent.routePath) ?? "/");
|
|
102
|
-
switch (node.type) {
|
|
103
|
-
case "index": {
|
|
104
|
-
const { filePath, variableName, fullPath } = getFile(node.file);
|
|
105
|
-
const routePath = `${parentRoutePath}/`;
|
|
106
|
-
return {
|
|
107
|
-
filePath,
|
|
108
|
-
fullPath,
|
|
109
|
-
variableName,
|
|
110
|
-
routePath,
|
|
111
|
-
_fsRouteType: "static"
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
case "route": {
|
|
115
|
-
const lastSegment = node.path;
|
|
116
|
-
let routeNode;
|
|
117
|
-
const routePath = `${parentRoutePath}/${utils.removeLeadingSlash(lastSegment)}`;
|
|
118
|
-
if (node.file) {
|
|
119
|
-
const { filePath, variableName, fullPath } = getFile(node.file);
|
|
120
|
-
routeNode = {
|
|
121
|
-
filePath,
|
|
122
|
-
fullPath,
|
|
123
|
-
variableName,
|
|
124
|
-
routePath,
|
|
125
|
-
_fsRouteType: "static"
|
|
126
|
-
};
|
|
127
|
-
} else {
|
|
128
|
-
routeNode = {
|
|
129
|
-
filePath: "",
|
|
130
|
-
fullPath: "",
|
|
131
|
-
variableName: utils.routePathToVariable(routePath),
|
|
132
|
-
routePath,
|
|
133
|
-
isVirtual: true,
|
|
134
|
-
_fsRouteType: "static"
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
if (node.children !== void 0) {
|
|
138
|
-
const { children: children2, physicalDirectories } = await getRouteNodesRecursive(
|
|
139
|
-
tsrConfig,
|
|
140
|
-
root,
|
|
141
|
-
fullDir,
|
|
142
|
-
node.children,
|
|
143
|
-
routeNode
|
|
144
|
-
);
|
|
145
|
-
routeNode.children = children2;
|
|
146
|
-
allPhysicalDirectories.push(...physicalDirectories);
|
|
147
|
-
routeNode._fsRouteType = "layout";
|
|
148
|
-
}
|
|
149
|
-
return routeNode;
|
|
150
|
-
}
|
|
151
|
-
case "layout": {
|
|
152
|
-
const { filePath, variableName, fullPath } = getFile(node.file);
|
|
153
|
-
if (node.id !== void 0) {
|
|
154
|
-
node.id = ensureLeadingUnderScore(node.id);
|
|
155
|
-
} else {
|
|
156
|
-
const baseName = path.basename(filePath);
|
|
157
|
-
const fileNameWithoutExt = path.parse(baseName).name;
|
|
158
|
-
node.id = ensureLeadingUnderScore(fileNameWithoutExt);
|
|
159
|
-
}
|
|
160
|
-
const lastSegment = node.id;
|
|
161
|
-
const routePath = `${parentRoutePath}/${utils.removeLeadingSlash(lastSegment)}`;
|
|
162
|
-
const routeNode = {
|
|
163
|
-
fullPath,
|
|
164
|
-
filePath,
|
|
165
|
-
variableName,
|
|
166
|
-
routePath,
|
|
167
|
-
_fsRouteType: "pathless_layout"
|
|
168
|
-
};
|
|
169
|
-
if (node.children !== void 0) {
|
|
170
|
-
const { children: children2, physicalDirectories } = await getRouteNodesRecursive(
|
|
171
|
-
tsrConfig,
|
|
172
|
-
root,
|
|
173
|
-
fullDir,
|
|
174
|
-
node.children,
|
|
175
|
-
routeNode
|
|
176
|
-
);
|
|
177
|
-
routeNode.children = children2;
|
|
178
|
-
allPhysicalDirectories.push(...physicalDirectories);
|
|
179
|
-
}
|
|
180
|
-
return routeNode;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
})
|
|
184
|
-
);
|
|
185
|
-
return {
|
|
186
|
-
children: children.flat(),
|
|
187
|
-
physicalDirectories: allPhysicalDirectories
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
exports.getRouteNodes = getRouteNodes;
|
|
191
|
-
exports.getRouteNodesRecursive = getRouteNodesRecursive;
|
|
192
|
-
//# sourceMappingURL=getRouteNodes.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getRouteNodes.cjs","sources":["../../../../src/filesystem/virtual/getRouteNodes.ts"],"sourcesContent":["import path, { join, resolve } from 'node:path'\nimport {\n removeExt,\n removeLeadingSlash,\n removeTrailingSlash,\n replaceBackslash,\n routePathToVariable,\n} from '../../utils'\nimport { getRouteNodes as getRouteNodesPhysical } from '../physical/getRouteNodes'\nimport { rootPathId } from '../physical/rootPathId'\nimport { virtualRootRouteSchema } from './config'\nimport { loadConfigFile } from './loadConfigFile'\nimport type {\n VirtualRootRoute,\n VirtualRouteNode,\n} 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: Pick<\n Config,\n | 'routesDirectory'\n | 'virtualRouteConfig'\n | 'routeFileIgnorePrefix'\n | 'disableLogging'\n | 'indexToken'\n | 'routeToken'\n >,\n root: string,\n): Promise<GetRouteNodesResult> {\n const fullDir = resolve(tsrConfig.routesDirectory)\n if (tsrConfig.virtualRouteConfig === undefined) {\n throw new Error(`virtualRouteConfig is undefined`)\n }\n let virtualRouteConfig: VirtualRootRoute\n if (typeof tsrConfig.virtualRouteConfig === 'string') {\n virtualRouteConfig = await getVirtualRouteConfigFromFileExport(\n tsrConfig,\n root,\n )\n } else {\n virtualRouteConfig = tsrConfig.virtualRouteConfig\n }\n const { children, physicalDirectories } = await getRouteNodesRecursive(\n tsrConfig,\n root,\n fullDir,\n virtualRouteConfig.children,\n )\n const allNodes = flattenTree({\n children,\n filePath: virtualRouteConfig.file,\n fullPath: replaceBackslash(join(fullDir, virtualRouteConfig.file)),\n variableName: 'root',\n routePath: `/${rootPathId}`,\n _fsRouteType: '__root',\n })\n\n const rootRouteNode = allNodes[0]\n const routeNodes = allNodes.slice(1)\n\n return { rootRouteNode, routeNodes, physicalDirectories }\n}\n\n/**\n * Get the virtual route config from a file export\n *\n * @example\n * ```ts\n * // routes.ts\n * import { rootRoute } from '@tanstack/virtual-file-routes'\n *\n * export const routes = rootRoute({ ... })\n * // or\n * export default rootRoute({ ... })\n * ```\n *\n */\nasync function getVirtualRouteConfigFromFileExport(\n tsrConfig: Pick<Config, 'virtualRouteConfig'>,\n root: string,\n): Promise<VirtualRootRoute> {\n if (\n tsrConfig.virtualRouteConfig === undefined ||\n typeof tsrConfig.virtualRouteConfig !== 'string' ||\n tsrConfig.virtualRouteConfig === ''\n ) {\n throw new Error(`virtualRouteConfig is undefined or empty`)\n }\n const exports = await loadConfigFile(join(root, tsrConfig.virtualRouteConfig))\n\n if (!('routes' in exports) && !('default' in exports)) {\n throw new Error(\n `routes not found in ${tsrConfig.virtualRouteConfig}. The routes export must be named like 'export const routes = ...' or done using 'export default ...'`,\n )\n }\n\n const virtualRouteConfig =\n 'routes' in exports ? exports.routes : exports.default\n\n return virtualRootRouteSchema.parse(virtualRouteConfig)\n}\n\nexport async function getRouteNodesRecursive(\n tsrConfig: Pick<\n Config,\n | 'routesDirectory'\n | 'routeFileIgnorePrefix'\n | 'disableLogging'\n | 'indexToken'\n | 'routeToken'\n >,\n root: string,\n fullDir: string,\n nodes?: Array<VirtualRouteNode>,\n parent?: RouteNode,\n): Promise<{ children: Array<RouteNode>; physicalDirectories: Array<string> }> {\n if (nodes === undefined) {\n return { children: [], physicalDirectories: [] }\n }\n const allPhysicalDirectories: Array<string> = []\n const children = await Promise.all(\n nodes.map(async (node) => {\n if (node.type === 'physical') {\n const { routeNodes, physicalDirectories } = await getRouteNodesPhysical(\n {\n ...tsrConfig,\n routesDirectory: resolve(fullDir, node.directory),\n },\n root,\n )\n allPhysicalDirectories.push(node.directory)\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 function getFile(file: string) {\n const filePath = file\n const variableName = routePathToVariable(removeExt(filePath))\n const fullPath = replaceBackslash(join(fullDir, filePath))\n return { filePath, variableName, fullPath }\n }\n const parentRoutePath = removeTrailingSlash(parent?.routePath ?? '/')\n\n switch (node.type) {\n case 'index': {\n const { filePath, variableName, fullPath } = getFile(node.file)\n const routePath = `${parentRoutePath}/`\n return {\n filePath,\n fullPath,\n variableName,\n routePath,\n _fsRouteType: 'static',\n } satisfies RouteNode\n }\n\n case 'route': {\n const lastSegment = node.path\n let routeNode: RouteNode\n\n const routePath = `${parentRoutePath}/${removeLeadingSlash(lastSegment)}`\n if (node.file) {\n const { filePath, variableName, fullPath } = getFile(node.file)\n routeNode = {\n filePath,\n fullPath,\n variableName,\n routePath,\n _fsRouteType: 'static',\n }\n } else {\n routeNode = {\n filePath: '',\n fullPath: '',\n variableName: routePathToVariable(routePath),\n routePath,\n isVirtual: true,\n _fsRouteType: 'static',\n }\n }\n\n if (node.children !== undefined) {\n const { children, physicalDirectories } =\n await getRouteNodesRecursive(\n tsrConfig,\n root,\n fullDir,\n node.children,\n routeNode,\n )\n routeNode.children = children\n allPhysicalDirectories.push(...physicalDirectories)\n\n // If the route has children, it should be a layout\n routeNode._fsRouteType = 'layout'\n }\n return routeNode\n }\n case 'layout': {\n const { filePath, variableName, fullPath } = getFile(node.file)\n\n if (node.id !== undefined) {\n node.id = ensureLeadingUnderScore(node.id)\n } else {\n const baseName = path.basename(filePath)\n const fileNameWithoutExt = path.parse(baseName).name\n node.id = ensureLeadingUnderScore(fileNameWithoutExt)\n }\n const lastSegment = node.id\n const routePath = `${parentRoutePath}/${removeLeadingSlash(lastSegment)}`\n\n const routeNode: RouteNode = {\n fullPath,\n filePath,\n variableName,\n routePath,\n _fsRouteType: 'pathless_layout',\n }\n\n if (node.children !== undefined) {\n const { children, physicalDirectories } =\n await getRouteNodesRecursive(\n tsrConfig,\n root,\n fullDir,\n node.children,\n routeNode,\n )\n routeNode.children = children\n allPhysicalDirectories.push(...physicalDirectories)\n }\n return routeNode\n }\n }\n }),\n )\n return {\n children: children.flat(),\n physicalDirectories: allPhysicalDirectories,\n }\n}\n"],"names":["resolve","replaceBackslash","join","rootPathId","exports","loadConfigFile","virtualRootRouteSchema","getRouteNodesPhysical","routePathToVariable","removeExt","removeTrailingSlash","removeLeadingSlash","children"],"mappings":";;;;;;;;AAmBA,SAAS,wBAAwB,IAAY;AACvC,MAAA,GAAG,WAAW,GAAG,GAAG;AACf,WAAA;AAAA,EAAA;AAET,SAAO,IAAI,EAAE;AACf;AAEA,SAAS,YAAY,MAAmC;AAChD,QAAA,SAAS,CAAC,IAAI;AAEpB,MAAI,KAAK,UAAU;AACN,eAAA,SAAS,KAAK,UAAU;AACjC,aAAO,KAAK,GAAG,YAAY,KAAK,CAAC;AAAA,IAAA;AAAA,EACnC;AAEF,SAAO,KAAK;AAEL,SAAA;AACT;AAEsB,eAAA,cACpB,WASA,MAC8B;AACxB,QAAA,UAAUA,KAAAA,QAAQ,UAAU,eAAe;AAC7C,MAAA,UAAU,uBAAuB,QAAW;AACxC,UAAA,IAAI,MAAM,iCAAiC;AAAA,EAAA;AAE/C,MAAA;AACA,MAAA,OAAO,UAAU,uBAAuB,UAAU;AACpD,yBAAqB,MAAM;AAAA,MACzB;AAAA,MACA;AAAA,IACF;AAAA,EAAA,OACK;AACL,yBAAqB,UAAU;AAAA,EAAA;AAEjC,QAAM,EAAE,UAAU,oBAAoB,IAAI,MAAM;AAAA,IAC9C;AAAA,IACA;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,EACrB;AACA,QAAM,WAAW,YAAY;AAAA,IAC3B;AAAA,IACA,UA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import { VirtualRouteNode } from '@tanstack/virtual-file-routes';
|
|
2
|
-
import { GetRouteNodesResult, RouteNode } from '../../types.cjs';
|
|
3
|
-
import { Config } from '../../config.cjs';
|
|
4
|
-
export declare function getRouteNodes(tsrConfig: Pick<Config, 'routesDirectory' | 'virtualRouteConfig' | 'routeFileIgnorePrefix' | 'disableLogging' | 'indexToken' | 'routeToken'>, root: string): Promise<GetRouteNodesResult>;
|
|
5
|
-
export declare function getRouteNodesRecursive(tsrConfig: Pick<Config, 'routesDirectory' | 'routeFileIgnorePrefix' | 'disableLogging' | 'indexToken' | 'routeToken'>, root: string, fullDir: string, nodes?: Array<VirtualRouteNode>, parent?: RouteNode): Promise<{
|
|
6
|
-
children: Array<RouteNode>;
|
|
7
|
-
physicalDirectories: Array<string>;
|
|
8
|
-
}>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const node_url = require("node:url");
|
|
4
|
-
const api = require("tsx/esm/api");
|
|
5
|
-
async function loadConfigFile(filePath) {
|
|
6
|
-
const fileURL = node_url.pathToFileURL(filePath).href;
|
|
7
|
-
const loaded = await api.tsImport(fileURL, "./");
|
|
8
|
-
return loaded;
|
|
9
|
-
}
|
|
10
|
-
exports.loadConfigFile = loadConfigFile;
|
|
11
|
-
//# sourceMappingURL=loadConfigFile.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadConfigFile.cjs","sources":["../../../../src/filesystem/virtual/loadConfigFile.ts"],"sourcesContent":["import { pathToFileURL } from 'node:url'\nimport { tsImport } from 'tsx/esm/api'\n\nexport async function loadConfigFile(filePath: string) {\n const fileURL = pathToFileURL(filePath).href\n const loaded = await tsImport(fileURL, './')\n return loaded\n}\n"],"names":["pathToFileURL","tsImport"],"mappings":";;;;AAGA,eAAsB,eAAe,UAAkB;AAC/C,QAAA,UAAUA,SAAAA,cAAc,QAAQ,EAAE;AACxC,QAAM,SAAS,MAAMC,aAAS,SAAS,IAAI;AACpC,SAAA;AACT;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function loadConfigFile(filePath: string): Promise<any>;
|