@tanstack/router-vite-plugin 1.1.8
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/LICENSE +21 -0
- package/build/cjs/_virtual/_commonjsHelpers.js +16 -0
- package/build/cjs/_virtual/_commonjsHelpers.js.map +1 -0
- package/build/cjs/_virtual/index.js +16 -0
- package/build/cjs/_virtual/index.js.map +1 -0
- package/build/cjs/_virtual/make-dir.js +16 -0
- package/build/cjs/_virtual/make-dir.js.map +1 -0
- package/build/cjs/_virtual/utils.js +16 -0
- package/build/cjs/_virtual/utils.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/copy/copy-sync.js +188 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/copy/copy-sync.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/copy/copy.js +255 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/copy/copy.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/copy/index.js +24 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/copy/index.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/empty/index.js +59 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/empty/index.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/ensure/file.js +87 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/ensure/file.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/ensure/index.js +40 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/ensure/index.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/ensure/link.js +84 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/ensure/link.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/ensure/symlink-paths.js +116 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/ensure/symlink-paths.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/ensure/symlink-type.js +46 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/ensure/symlink-type.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/ensure/symlink.js +105 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/ensure/symlink.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/fs/index.js +146 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/fs/index.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/index.js +41 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/index.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/json/index.js +34 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/json/index.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/json/jsonfile.js +26 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/json/jsonfile.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/json/output-json-sync.js +28 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/json/output-json-sync.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/json/output-json.js +28 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/json/output-json.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/mkdirs/index.js +32 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/mkdirs/index.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/mkdirs/make-dir.js +49 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/mkdirs/make-dir.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/mkdirs/utils.js +35 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/mkdirs/utils.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/move/index.js +24 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/move/index.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/move/move-sync.js +74 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/move/move-sync.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/move/move.js +96 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/move/move.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/output-file/index.js +59 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/output-file/index.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/path-exists/index.js +30 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/path-exists/index.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/remove/index.js +39 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/remove/index.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/remove/rimraf.js +319 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/remove/rimraf.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/util/stat.js +172 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/util/stat.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/util/utimes.js +41 -0
- package/build/cjs/node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/util/utimes.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/clone.js +36 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/clone.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js +469 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/legacy-streams.js +135 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/legacy-streams.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js +372 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js +45 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js +479 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js +143 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js +380 -0
- package/build/cjs/node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js +108 -0
- package/build/cjs/node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js +29 -0
- package/build/cjs/node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/doc.js +1286 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/doc.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/index.js +21292 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/index.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/internal/internal.js +6513 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/internal/internal.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/acorn.js +31 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/acorn.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/angular.js +20 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/angular.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/babel.js +34 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/babel.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/estree.js +55 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/estree.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/flow.js +39 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/flow.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/glimmer.js +50 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/glimmer.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/graphql.js +50 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/graphql.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/html.js +40 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/html.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/markdown.js +80 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/markdown.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/meriyah.js +23 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/meriyah.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/postcss.js +73 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/postcss.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/typescript.js +43 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/typescript.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/yaml.js +182 -0
- package/build/cjs/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/plugins/yaml.js.map +1 -0
- package/build/cjs/node_modules/.pnpm/zod@3.21.4/node_modules/zod/lib/index.js +4071 -0
- package/build/cjs/node_modules/.pnpm/zod@3.21.4/node_modules/zod/lib/index.js.map +1 -0
- package/build/cjs/packages/router-cli/src/config.js +30 -0
- package/build/cjs/packages/router-cli/src/config.js.map +1 -0
- package/build/cjs/packages/router-cli/src/generator.js +291 -0
- package/build/cjs/packages/router-cli/src/generator.js.map +1 -0
- package/build/cjs/packages/router-vite-plugin/src/index.js +67 -0
- package/build/cjs/packages/router-vite-plugin/src/index.js.map +1 -0
- package/build/esm/acorn-cRrhQtA6.js +26 -0
- package/build/esm/acorn-cRrhQtA6.js.map +1 -0
- package/build/esm/angular-HROv_CFe.js +15 -0
- package/build/esm/angular-HROv_CFe.js.map +1 -0
- package/build/esm/babel-WUIEfgoi.js +29 -0
- package/build/esm/babel-WUIEfgoi.js.map +1 -0
- package/build/esm/estree-XSgQYP4a.js +48 -0
- package/build/esm/estree-XSgQYP4a.js.map +1 -0
- package/build/esm/flow-RpbLwlct.js +34 -0
- package/build/esm/flow-RpbLwlct.js.map +1 -0
- package/build/esm/glimmer-nYL0saZ4.js +43 -0
- package/build/esm/glimmer-nYL0saZ4.js.map +1 -0
- package/build/esm/graphql-w_qkTZIK.js +42 -0
- package/build/esm/graphql-w_qkTZIK.js.map +1 -0
- package/build/esm/html-4mPGSUFL.js +32 -0
- package/build/esm/html-4mPGSUFL.js.map +1 -0
- package/build/esm/index.js +33321 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/markdown-MvZ6UzH9.js +72 -0
- package/build/esm/markdown-MvZ6UzH9.js.map +1 -0
- package/build/esm/meriyah-kfEfGGMB.js +18 -0
- package/build/esm/meriyah-kfEfGGMB.js.map +1 -0
- package/build/esm/postcss-yu5rIF8w.js +65 -0
- package/build/esm/postcss-yu5rIF8w.js.map +1 -0
- package/build/esm/typescript-CETgxtB5.js +38 -0
- package/build/esm/typescript-CETgxtB5.js.map +1 -0
- package/build/esm/yaml-_aqeuMai.js +174 -0
- package/build/esm/yaml-_aqeuMai.js.map +1 -0
- package/build/types/index.d.ts +17 -0
- package/package.json +44 -0
- package/src/index.ts +58 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tanstack/router-vite-plugin/src/index.ts
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
var path = require('path');
|
|
14
|
+
require('fs');
|
|
15
|
+
var index = require('../../../node_modules/.pnpm/zod@3.21.4/node_modules/zod/lib/index.js');
|
|
16
|
+
|
|
17
|
+
const configSchema = index.default.object({
|
|
18
|
+
routeFilePrefix: index.default.string().optional(),
|
|
19
|
+
routeFileIgnorePrefix: index.default.string().optional().default('-'),
|
|
20
|
+
routesDirectory: index.default.string(),
|
|
21
|
+
generatedRouteTree: index.default.string(),
|
|
22
|
+
quoteStyle: index.default.enum(['single', 'double']).optional().default('single'),
|
|
23
|
+
future: index.default.object({
|
|
24
|
+
unstable_codeSplitting: index.default.boolean().optional()
|
|
25
|
+
}).optional()
|
|
26
|
+
});
|
|
27
|
+
path.resolve(process.cwd(), 'tsr.config.json');
|
|
28
|
+
|
|
29
|
+
exports.configSchema = configSchema;
|
|
30
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../../../../router-cli/src/config.ts"],"sourcesContent":["import path from 'path'\nimport { readFileSync } from 'fs'\nimport { z } from 'zod'\n\nexport const configSchema = z.object({\n routeFilePrefix: z.string().optional(),\n routeFileIgnorePrefix: z.string().optional().default('-'),\n routesDirectory: z.string(),\n generatedRouteTree: z.string(),\n quoteStyle: z.enum(['single', 'double']).optional().default('single'),\n future: z\n .object({\n unstable_codeSplitting: z.boolean().optional(),\n })\n .optional(),\n})\n\nexport type Config = z.infer<typeof configSchema>\n\nconst configFilePathJson = path.resolve(process.cwd(), 'tsr.config.json')\n\nexport async function getConfig(): Promise<Config> {\n return configSchema.parse(\n JSON.parse(readFileSync(configFilePathJson, 'utf-8')),\n )\n}\n"],"names":["configSchema","z","object","routeFilePrefix","string","optional","routeFileIgnorePrefix","default","routesDirectory","generatedRouteTree","quoteStyle","enum","future","unstable_codeSplitting","boolean","path","resolve","process","cwd"],"mappings":";;;;;;;;;;;;;;;;MAIaA,YAAY,GAAGC,aAAC,CAACC,MAAM,CAAC;EACnCC,eAAe,EAAEF,aAAC,CAACG,MAAM,EAAE,CAACC,QAAQ,EAAE;AACtCC,EAAAA,qBAAqB,EAAEL,aAAC,CAACG,MAAM,EAAE,CAACC,QAAQ,EAAE,CAACE,OAAO,CAAC,GAAG,CAAC;AACzDC,EAAAA,eAAe,EAAEP,aAAC,CAACG,MAAM,EAAE;AAC3BK,EAAAA,kBAAkB,EAAER,aAAC,CAACG,MAAM,EAAE;AAC9BM,EAAAA,UAAU,EAAET,aAAC,CAACU,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAACN,QAAQ,EAAE,CAACE,OAAO,CAAC,QAAQ,CAAC;AACrEK,EAAAA,MAAM,EAAEX,aAAC,CACNC,MAAM,CAAC;IACNW,sBAAsB,EAAEZ,aAAC,CAACa,OAAO,EAAE,CAACT,QAAQ,EAAC;GAC9C,CAAC,CACDA,QAAQ,EAAC;AACd,CAAC,EAAC;AAIyBU,IAAI,CAACC,OAAO,CAACC,OAAO,CAACC,GAAG,EAAE,EAAE,iBAAiB;;;;"}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tanstack/router-vite-plugin/src/index.ts
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
var path = require('path');
|
|
14
|
+
var index$1 = require('../../../node_modules/.pnpm/fs-extra@10.1.0/node_modules/fs-extra/lib/index.js');
|
|
15
|
+
var index = require('../../../node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/index.js');
|
|
16
|
+
var reactRouter = require('@tanstack/react-router');
|
|
17
|
+
|
|
18
|
+
let latestTask = 0;
|
|
19
|
+
const rootPathId = '__root';
|
|
20
|
+
const fileRouteRegex = /new\s+FileRoute\(([^)]*)\)/g;
|
|
21
|
+
async function getRouteNodes(config) {
|
|
22
|
+
const {
|
|
23
|
+
routeFilePrefix,
|
|
24
|
+
routeFileIgnorePrefix
|
|
25
|
+
} = config;
|
|
26
|
+
let routeNodes = [];
|
|
27
|
+
async function recurse(dir) {
|
|
28
|
+
const fullDir = path.resolve(config.routesDirectory, dir);
|
|
29
|
+
let dirList = await index$1.lib.readdir(fullDir);
|
|
30
|
+
dirList = dirList.filter(d => {
|
|
31
|
+
if (d.startsWith('.') || routeFileIgnorePrefix && d.startsWith(routeFileIgnorePrefix)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (routeFilePrefix) {
|
|
35
|
+
return d.startsWith(routeFilePrefix);
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
});
|
|
39
|
+
await Promise.all(dirList.map(async fileName => {
|
|
40
|
+
const fullPath = path.join(fullDir, fileName);
|
|
41
|
+
const relativePath = path.join(dir, fileName);
|
|
42
|
+
const stat = await index$1.lib.stat(fullPath);
|
|
43
|
+
if (stat.isDirectory()) {
|
|
44
|
+
await recurse(relativePath);
|
|
45
|
+
} else {
|
|
46
|
+
const filePath = path.join(dir, fileName);
|
|
47
|
+
const filePathNoExt = removeExt(filePath);
|
|
48
|
+
let routePath = replaceBackslash(reactRouter.cleanPath(`/${filePathNoExt.split('.').join('/')}`)) ?? '';
|
|
49
|
+
const variableName = fileToVariable(routePath);
|
|
50
|
+
|
|
51
|
+
// Remove the index from the route path and
|
|
52
|
+
// if the route path is empty, use `/'
|
|
53
|
+
if (routePath === 'index') {
|
|
54
|
+
routePath = '/';
|
|
55
|
+
} else if (routePath.endsWith('/index')) {
|
|
56
|
+
routePath = routePath.replace(/\/index$/, '/');
|
|
57
|
+
}
|
|
58
|
+
routeNodes.push({
|
|
59
|
+
filePath,
|
|
60
|
+
fullPath,
|
|
61
|
+
routePath,
|
|
62
|
+
variableName
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
66
|
+
return routeNodes;
|
|
67
|
+
}
|
|
68
|
+
await recurse('./');
|
|
69
|
+
return routeNodes;
|
|
70
|
+
}
|
|
71
|
+
let first = false;
|
|
72
|
+
let skipMessage = false;
|
|
73
|
+
async function generator(config) {
|
|
74
|
+
console.log();
|
|
75
|
+
if (!first) {
|
|
76
|
+
console.log('🔄 Generating routes...');
|
|
77
|
+
first = true;
|
|
78
|
+
} else if (skipMessage) {
|
|
79
|
+
skipMessage = false;
|
|
80
|
+
} else {
|
|
81
|
+
console.log('♻️ Regenerating routes...');
|
|
82
|
+
}
|
|
83
|
+
const taskId = latestTask + 1;
|
|
84
|
+
latestTask = taskId;
|
|
85
|
+
const checkLatest = () => {
|
|
86
|
+
if (latestTask !== taskId) {
|
|
87
|
+
skipMessage = true;
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
return true;
|
|
91
|
+
};
|
|
92
|
+
const start = Date.now();
|
|
93
|
+
const routePathIdPrefix = config.routeFilePrefix ?? '';
|
|
94
|
+
let preRouteNodes = await getRouteNodes(config);
|
|
95
|
+
const sortRouteNodes = nodes => {
|
|
96
|
+
return multiSortBy(nodes, [d => d.routePath === '/' ? -1 : 1, d => d.routePath?.split('/').length, d => d.filePath?.match(/[./]index[.]/) ? 1 : -1, d => d.filePath?.match(/[./]route[.]/) ? -1 : 1, d => d.routePath?.endsWith('/') ? -1 : 1, d => d.routePath]).filter(d => d.routePath !== `/${routePathIdPrefix + rootPathId}`);
|
|
97
|
+
};
|
|
98
|
+
preRouteNodes = sortRouteNodes(preRouteNodes);
|
|
99
|
+
const routeTree = [];
|
|
100
|
+
const routePiecesByPath = {};
|
|
101
|
+
|
|
102
|
+
// Loop over the flat list of routeNodes and
|
|
103
|
+
// build up a tree based on the routeNodes' routePath
|
|
104
|
+
let routeNodes = [];
|
|
105
|
+
const handleNode = node => {
|
|
106
|
+
if (config.future?.unstable_codeSplitting) {
|
|
107
|
+
node.isRoute = node.routePath?.endsWith('/route');
|
|
108
|
+
node.isComponent = node.routePath?.endsWith('/component');
|
|
109
|
+
node.isLoader = node.routePath?.endsWith('/loader');
|
|
110
|
+
if (node.isComponent || node.isLoader || node.isRoute) {
|
|
111
|
+
node.routePath = node.routePath?.replace(/\/(component|loader|route)$/, '');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const parentRoute = hasParentRoute(routeNodes, node.routePath);
|
|
115
|
+
if (parentRoute) node.parent = parentRoute;
|
|
116
|
+
node.path = node.parent ? node.routePath?.replace(node.parent.routePath, '') || '/' : node.routePath;
|
|
117
|
+
const trimmedPath = reactRouter.trimPathLeft(node.path ?? '');
|
|
118
|
+
const split = trimmedPath?.split('/') ?? [];
|
|
119
|
+
let first = split[0] ?? trimmedPath ?? '';
|
|
120
|
+
node.isNonPath = first.startsWith('_');
|
|
121
|
+
node.isNonLayout = first.endsWith('_');
|
|
122
|
+
node.cleanedPath = removeUnderscores(node.path) ?? '';
|
|
123
|
+
if (config.future?.unstable_codeSplitting) {
|
|
124
|
+
if (node.isLoader || node.isComponent) {
|
|
125
|
+
routePiecesByPath[node.routePath] = routePiecesByPath[node.routePath] || {};
|
|
126
|
+
routePiecesByPath[node.routePath][node.isLoader ? 'loader' : 'component'] = node;
|
|
127
|
+
const anchorRoute = routeNodes.find(d => d.routePath === node.routePath);
|
|
128
|
+
if (!anchorRoute) {
|
|
129
|
+
handleNode({
|
|
130
|
+
...node,
|
|
131
|
+
isVirtual: true
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
// if (!node.parent) {
|
|
135
|
+
// }
|
|
136
|
+
|
|
137
|
+
// componentOrLoader.isVirtual = true
|
|
138
|
+
// handleNode(componentOrLoader)
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (node.parent) {
|
|
143
|
+
node.parent.children = node.parent.children ?? [];
|
|
144
|
+
node.parent.children.push(node);
|
|
145
|
+
} else {
|
|
146
|
+
routeTree.push(node);
|
|
147
|
+
}
|
|
148
|
+
routeNodes.push(node);
|
|
149
|
+
};
|
|
150
|
+
preRouteNodes.forEach(node => handleNode(node));
|
|
151
|
+
async function buildRouteConfig(nodes, depth = 1) {
|
|
152
|
+
const children = nodes.map(async node => {
|
|
153
|
+
const routeCode = await index$1.lib.readFile(node.fullPath, 'utf-8');
|
|
154
|
+
|
|
155
|
+
// Ensure the boilerplate for the route exists
|
|
156
|
+
if (node.isRoot) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Ensure that new FileRoute(anything?) is replaced with FileRoute(${node.routePath})
|
|
161
|
+
// routePath can contain $ characters, which have special meaning when used in replace
|
|
162
|
+
// so we have to escape it by turning all $ into $$. But since we do it through a replace call
|
|
163
|
+
// we have to double escape it into $$$$. For more information, see
|
|
164
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_the_replacement
|
|
165
|
+
const escapedRoutePath = node.routePath?.replaceAll('$', '$$$$') ?? '';
|
|
166
|
+
const quote = config.quoteStyle === 'single' ? `'` : `"`;
|
|
167
|
+
const replaced = routeCode.replace(fileRouteRegex, `new FileRoute(${quote}${escapedRoutePath}${quote})`);
|
|
168
|
+
if (replaced !== routeCode) {
|
|
169
|
+
await index$1.lib.writeFile(node.fullPath, replaced);
|
|
170
|
+
}
|
|
171
|
+
const route = `${node.variableName}Route`;
|
|
172
|
+
if (node.children?.length) {
|
|
173
|
+
const childConfigs = await buildRouteConfig(node.children, depth + 1);
|
|
174
|
+
return `${route}.addChildren([${spaces(depth * 4)}${childConfigs}])`;
|
|
175
|
+
}
|
|
176
|
+
return route;
|
|
177
|
+
});
|
|
178
|
+
return (await Promise.all(children)).filter(Boolean).join(`,`);
|
|
179
|
+
}
|
|
180
|
+
const routeConfigChildrenText = await buildRouteConfig(routeTree);
|
|
181
|
+
const sortedRouteNodes = multiSortBy(routeNodes, [d => d.routePath?.includes(`/${routePathIdPrefix + rootPathId}`) ? -1 : 1, d => d.routePath?.split('/').length, d => d.routePath?.endsWith("index'") ? -1 : 1, d => d]);
|
|
182
|
+
const imports = Object.entries({
|
|
183
|
+
FileRoute: sortedRouteNodes.some(d => d.isVirtual),
|
|
184
|
+
lazyFn: sortedRouteNodes.some(node => routePiecesByPath[node.routePath]?.loader),
|
|
185
|
+
lazyRouteComponent: sortedRouteNodes.some(node => routePiecesByPath[node.routePath]?.component)
|
|
186
|
+
}).filter(d => d[1]).map(d => d[0]);
|
|
187
|
+
const routeImports = [imports.length ? `import { ${imports.join(', ')} } from '@tanstack/react-router'\n` : '', `import { Route as rootRoute } from './${sanitize(path.relative(path.dirname(config.generatedRouteTree), path.resolve(config.routesDirectory, routePathIdPrefix + rootPathId)))}'`, ...sortedRouteNodes.filter(d => !d.isVirtual).map(node => {
|
|
188
|
+
return `import { Route as ${node.variableName}Import } from './${sanitize(removeExt(path.relative(path.dirname(config.generatedRouteTree), path.resolve(config.routesDirectory, node.filePath))))}'`;
|
|
189
|
+
}), '\n', sortedRouteNodes.filter(d => d.isVirtual).map(node => {
|
|
190
|
+
return `const ${node.variableName}Import = new FileRoute('${node.routePath}').createRoute()`;
|
|
191
|
+
}).join('\n'), '\n', sortedRouteNodes.map(node => {
|
|
192
|
+
const loaderNode = routePiecesByPath[node.routePath]?.loader;
|
|
193
|
+
const componentNode = routePiecesByPath[node.routePath]?.component;
|
|
194
|
+
return [`const ${node.variableName}Route = ${node.variableName}Import.update({
|
|
195
|
+
${[node.isNonPath ? `id: '${node.path}'` : `path: '${node.cleanedPath}'`, `getParentRoute: () => ${node.parent?.variableName ?? 'root'}Route`].filter(Boolean).join(',')}
|
|
196
|
+
} as any)`, loaderNode ? `.updateLoader({ loader: lazyFn(() => import('./${sanitize(removeExt(path.relative(path.dirname(config.generatedRouteTree), path.resolve(config.routesDirectory, loaderNode.filePath))))}'), 'loader') })` : '', componentNode ? `.update({ component: lazyRouteComponent(() => import('./${sanitize(removeExt(path.relative(path.dirname(config.generatedRouteTree), path.resolve(config.routesDirectory, componentNode.filePath))))}'), 'component') })` : ''].join('');
|
|
197
|
+
}).join('\n\n'), `declare module '@tanstack/react-router' {
|
|
198
|
+
interface FileRoutesByPath {
|
|
199
|
+
${routeNodes.map(routeNode => {
|
|
200
|
+
return `'${routeNode.routePath}': {
|
|
201
|
+
preLoaderRoute: typeof ${routeNode.variableName}Import
|
|
202
|
+
parentRoute: typeof ${routeNode.parent?.variableName ? `${routeNode.parent?.variableName}Import` : 'rootRoute'}
|
|
203
|
+
}`;
|
|
204
|
+
}).join('\n')}
|
|
205
|
+
}
|
|
206
|
+
}`, `export const routeTree = rootRoute.addChildren([${routeConfigChildrenText}])`].join('\n');
|
|
207
|
+
const routeConfigFileContent = await index.format(routeImports, {
|
|
208
|
+
semi: false,
|
|
209
|
+
parser: 'typescript'
|
|
210
|
+
});
|
|
211
|
+
const routeTreeContent = await index$1.lib.readFile(path.resolve(config.generatedRouteTree), 'utf-8').catch(err => {
|
|
212
|
+
if (err.code === 'ENOENT') {
|
|
213
|
+
return undefined;
|
|
214
|
+
}
|
|
215
|
+
throw err;
|
|
216
|
+
});
|
|
217
|
+
if (!checkLatest()) return;
|
|
218
|
+
if (routeTreeContent !== routeConfigFileContent) {
|
|
219
|
+
await index$1.lib.ensureDir(path.dirname(path.resolve(config.generatedRouteTree)));
|
|
220
|
+
if (!checkLatest()) return;
|
|
221
|
+
await index$1.lib.writeFile(path.resolve(config.generatedRouteTree), routeConfigFileContent);
|
|
222
|
+
}
|
|
223
|
+
console.log(`🌲 Processed ${routeNodes.length} routes in ${Date.now() - start}ms`);
|
|
224
|
+
}
|
|
225
|
+
function fileToVariable(d) {
|
|
226
|
+
return removeUnderscores(d)?.replace(/\$/g, '')?.split(/[/-]/g).map((d, i) => i > 0 ? capitalize(d) : d).join('').replace(/([^a-zA-Z0-9]|[\.])/gm, '') ?? '';
|
|
227
|
+
}
|
|
228
|
+
function removeExt(d) {
|
|
229
|
+
return d.substring(0, d.lastIndexOf('.')) || d;
|
|
230
|
+
}
|
|
231
|
+
function spaces(d) {
|
|
232
|
+
return Array.from({
|
|
233
|
+
length: d
|
|
234
|
+
}).map(() => ' ').join('');
|
|
235
|
+
}
|
|
236
|
+
function multiSortBy(arr, accessors = [d => d]) {
|
|
237
|
+
return arr.map((d, i) => [d, i]).sort(([a, ai], [b, bi]) => {
|
|
238
|
+
for (const accessor of accessors) {
|
|
239
|
+
const ao = accessor(a);
|
|
240
|
+
const bo = accessor(b);
|
|
241
|
+
if (typeof ao === 'undefined') {
|
|
242
|
+
if (typeof bo === 'undefined') {
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
return 1;
|
|
246
|
+
}
|
|
247
|
+
if (ao === bo) {
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
return ao > bo ? 1 : -1;
|
|
251
|
+
}
|
|
252
|
+
return ai - bi;
|
|
253
|
+
}).map(([d]) => d);
|
|
254
|
+
}
|
|
255
|
+
function capitalize(s) {
|
|
256
|
+
if (typeof s !== 'string') return '';
|
|
257
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
258
|
+
}
|
|
259
|
+
function sanitize(s) {
|
|
260
|
+
return replaceBackslash(s?.replace(/\\index/gi, ''));
|
|
261
|
+
}
|
|
262
|
+
function removeUnderscores(s) {
|
|
263
|
+
return s?.replace(/(^_|_$)/, '').replace(/(\/_|_\/)/, '/');
|
|
264
|
+
}
|
|
265
|
+
function replaceBackslash(s) {
|
|
266
|
+
return s?.replace(/\\/gi, '/');
|
|
267
|
+
}
|
|
268
|
+
function hasParentRoute(routes, routePathToCheck) {
|
|
269
|
+
if (!routePathToCheck || routePathToCheck === '/') {
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
272
|
+
const sortedNodes = multiSortBy(routes, [d => d.routePath.length * -1, d => d.variableName]).filter(d => d.routePath !== `/${rootPathId}`);
|
|
273
|
+
for (const route of sortedNodes) {
|
|
274
|
+
if (route.routePath === '/') continue;
|
|
275
|
+
if (routePathToCheck.startsWith(`${route.routePath}/`) && route.routePath !== routePathToCheck) {
|
|
276
|
+
return route;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const segments = routePathToCheck.split('/');
|
|
280
|
+
segments.pop(); // Remove the last segment
|
|
281
|
+
const parentRoutePath = segments.join('/');
|
|
282
|
+
return hasParentRoute(routes, parentRoutePath);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
exports.fileRouteRegex = fileRouteRegex;
|
|
286
|
+
exports.generator = generator;
|
|
287
|
+
exports.hasParentRoute = hasParentRoute;
|
|
288
|
+
exports.multiSortBy = multiSortBy;
|
|
289
|
+
exports.removeExt = removeExt;
|
|
290
|
+
exports.rootPathId = rootPathId;
|
|
291
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sources":["../../../../../../router-cli/src/generator.ts"],"sourcesContent":["import path from 'path'\nimport * as fs from 'fs-extra'\nimport * as prettier from 'prettier'\nimport { Config } from './config'\nimport { cleanPath, trimPathLeft } from '@tanstack/react-router'\n\nlet latestTask = 0\nexport const rootPathId = '__root'\nexport const fileRouteRegex = /new\\s+FileRoute\\(([^)]*)\\)/g\n\nexport type RouteNode = {\n filePath: string\n fullPath: string\n variableName: string\n routePath?: string\n cleanedPath?: string\n path?: string\n isNonPath?: boolean\n isNonLayout?: boolean\n isRoute?: boolean\n isLoader?: boolean\n isComponent?: boolean\n isVirtual?: boolean\n isRoot?: boolean\n children?: RouteNode[]\n parent?: RouteNode\n}\n\nasync function getRouteNodes(config: Config) {\n const { routeFilePrefix, routeFileIgnorePrefix } = config\n\n let routeNodes: RouteNode[] = []\n\n async function recurse(dir: string) {\n const fullDir = path.resolve(config.routesDirectory, dir)\n let dirList = await fs.readdir(fullDir)\n\n dirList = dirList.filter((d) => {\n if (\n d.startsWith('.') ||\n (routeFileIgnorePrefix && d.startsWith(routeFileIgnorePrefix))\n ) {\n return false\n }\n\n if (routeFilePrefix) {\n return d.startsWith(routeFilePrefix)\n }\n\n return true\n })\n\n await Promise.all(\n dirList.map(async (fileName) => {\n const fullPath = path.join(fullDir, fileName)\n const relativePath = path.join(dir, fileName)\n const stat = await fs.stat(fullPath)\n\n if (stat.isDirectory()) {\n await recurse(relativePath)\n } else {\n const filePath = path.join(dir, fileName)\n const filePathNoExt = removeExt(filePath)\n let routePath =\n replaceBackslash(\n cleanPath(`/${filePathNoExt.split('.').join('/')}`),\n ) ?? ''\n const variableName = fileToVariable(routePath)\n\n // Remove the index from the route path and\n // if the route path is empty, use `/'\n if (routePath === 'index') {\n routePath = '/'\n } else if (routePath.endsWith('/index')) {\n routePath = routePath.replace(/\\/index$/, '/')\n }\n\n routeNodes.push({\n filePath,\n fullPath,\n routePath,\n variableName,\n })\n }\n }),\n )\n\n return routeNodes\n }\n\n await recurse('./')\n\n return routeNodes\n}\n\nlet first = false\nlet skipMessage = false\n\ntype RouteSubNode = {\n component?: RouteNode\n loader?: RouteNode\n}\n\nexport async function generator(config: Config) {\n console.log()\n\n if (!first) {\n console.log('🔄 Generating routes...')\n first = true\n } else if (skipMessage) {\n skipMessage = false\n } else {\n console.log('♻️ Regenerating routes...')\n }\n\n const taskId = latestTask + 1\n latestTask = taskId\n\n const checkLatest = () => {\n if (latestTask !== taskId) {\n skipMessage = true\n return false\n }\n\n return true\n }\n\n const start = Date.now()\n const routePathIdPrefix = config.routeFilePrefix ?? ''\n\n let preRouteNodes = await getRouteNodes(config)\n\n const sortRouteNodes = (nodes: RouteNode[]): RouteNode[] => {\n return multiSortBy(nodes, [\n (d) => (d.routePath === '/' ? -1 : 1),\n (d) => d.routePath?.split('/').length,\n (d) => (d.filePath?.match(/[./]index[.]/) ? 1 : -1),\n (d) => (d.filePath?.match(/[./]route[.]/) ? -1 : 1),\n (d) => (d.routePath?.endsWith('/') ? -1 : 1),\n (d) => d.routePath,\n ]).filter((d) => d.routePath !== `/${routePathIdPrefix + rootPathId}`)\n }\n\n preRouteNodes = sortRouteNodes(preRouteNodes)\n\n const routeTree: RouteNode[] = []\n const routePiecesByPath: Record<string, RouteSubNode> = {}\n\n // Loop over the flat list of routeNodes and\n // build up a tree based on the routeNodes' routePath\n let routeNodes: RouteNode[] = []\n\n const handleNode = (node: RouteNode) => {\n if (config.future?.unstable_codeSplitting) {\n node.isRoute = node.routePath?.endsWith('/route')\n node.isComponent = node.routePath?.endsWith('/component')\n node.isLoader = node.routePath?.endsWith('/loader')\n\n if (node.isComponent || node.isLoader || node.isRoute) {\n node.routePath = node.routePath?.replace(\n /\\/(component|loader|route)$/,\n '',\n )\n }\n }\n\n const parentRoute = hasParentRoute(routeNodes, node.routePath)\n if (parentRoute) node.parent = parentRoute\n\n node.path = node.parent\n ? node.routePath?.replace(node.parent.routePath!, '') || '/'\n : node.routePath\n\n const trimmedPath = trimPathLeft(node.path ?? '')\n\n const split = trimmedPath?.split('/') ?? []\n let first = split[0] ?? trimmedPath ?? ''\n\n node.isNonPath = first.startsWith('_')\n node.isNonLayout = first.endsWith('_')\n\n node.cleanedPath = removeUnderscores(node.path) ?? ''\n\n if (config.future?.unstable_codeSplitting) {\n if (node.isLoader || node.isComponent) {\n routePiecesByPath[node.routePath!] =\n routePiecesByPath[node.routePath!] || {}\n\n routePiecesByPath[node.routePath!]![\n node.isLoader ? 'loader' : 'component'\n ] = node\n\n const anchorRoute = routeNodes.find(\n (d) => d.routePath === node.routePath,\n )\n if (!anchorRoute) {\n handleNode({\n ...node,\n isVirtual: true,\n })\n }\n // if (!node.parent) {\n // }\n\n // componentOrLoader.isVirtual = true\n // handleNode(componentOrLoader)\n return\n }\n }\n\n if (node.parent) {\n node.parent.children = node.parent.children ?? []\n node.parent.children.push(node)\n } else {\n routeTree.push(node)\n }\n\n routeNodes.push(node)\n }\n\n preRouteNodes.forEach((node) => handleNode(node))\n\n async function buildRouteConfig(\n nodes: RouteNode[],\n depth = 1,\n ): Promise<string> {\n const children = nodes.map(async (node) => {\n const routeCode = await fs.readFile(node.fullPath, 'utf-8')\n\n // Ensure the boilerplate for the route exists\n if (node.isRoot) {\n return\n }\n\n // Ensure that new FileRoute(anything?) is replaced with FileRoute(${node.routePath})\n // routePath can contain $ characters, which have special meaning when used in replace\n // so we have to escape it by turning all $ into $$. But since we do it through a replace call\n // we have to double escape it into $$$$. For more information, see\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_the_replacement\n const escapedRoutePath = node.routePath?.replaceAll('$', '$$$$') ?? ''\n const quote = config.quoteStyle === 'single' ? `'` : `\"`\n const replaced = routeCode.replace(\n fileRouteRegex,\n `new FileRoute(${quote}${escapedRoutePath}${quote})`,\n )\n\n if (replaced !== routeCode) {\n await fs.writeFile(node.fullPath, replaced)\n }\n\n const route = `${node.variableName}Route`\n\n if (node.children?.length) {\n const childConfigs = await buildRouteConfig(node.children, depth + 1)\n return `${route}.addChildren([${spaces(depth * 4)}${childConfigs}])`\n }\n\n return route\n })\n\n return (await Promise.all(children)).filter(Boolean).join(`,`)\n }\n\n const routeConfigChildrenText = await buildRouteConfig(routeTree)\n\n const sortedRouteNodes = multiSortBy(routeNodes, [\n (d) =>\n d.routePath?.includes(`/${routePathIdPrefix + rootPathId}`) ? -1 : 1,\n (d) => d.routePath?.split('/').length,\n (d) => (d.routePath?.endsWith(\"index'\") ? -1 : 1),\n (d) => d,\n ])\n\n const imports = Object.entries({\n FileRoute: sortedRouteNodes.some((d) => d.isVirtual),\n lazyFn: sortedRouteNodes.some(\n (node) => routePiecesByPath[node.routePath!]?.loader,\n ),\n lazyRouteComponent: sortedRouteNodes.some(\n (node) => routePiecesByPath[node.routePath!]?.component,\n ),\n })\n .filter((d) => d[1])\n .map((d) => d[0])\n\n const routeImports = [\n imports.length\n ? `import { ${imports.join(', ')} } from '@tanstack/react-router'\\n`\n : '',\n `import { Route as rootRoute } from './${sanitize(\n path.relative(\n path.dirname(config.generatedRouteTree),\n path.resolve(config.routesDirectory, routePathIdPrefix + rootPathId),\n ),\n )}'`,\n ...sortedRouteNodes\n .filter((d) => !d.isVirtual)\n .map((node) => {\n return `import { Route as ${\n node.variableName\n }Import } from './${sanitize(\n removeExt(\n path.relative(\n path.dirname(config.generatedRouteTree),\n path.resolve(config.routesDirectory, node.filePath),\n ),\n ),\n )}'`\n }),\n '\\n',\n sortedRouteNodes\n .filter((d) => d.isVirtual)\n .map((node) => {\n return `const ${node.variableName}Import = new FileRoute('${node.routePath}').createRoute()`\n })\n .join('\\n'),\n '\\n',\n sortedRouteNodes\n .map((node) => {\n const loaderNode = routePiecesByPath[node.routePath!]?.loader\n const componentNode = routePiecesByPath[node.routePath!]?.component\n\n return [\n `const ${node.variableName}Route = ${node.variableName}Import.update({\n ${[\n node.isNonPath\n ? `id: '${node.path}'`\n : `path: '${node.cleanedPath}'`,\n `getParentRoute: () => ${node.parent?.variableName ?? 'root'}Route`,\n ]\n .filter(Boolean)\n .join(',')}\n } as any)`,\n loaderNode\n ? `.updateLoader({ loader: lazyFn(() => import('./${sanitize(\n removeExt(\n path.relative(\n path.dirname(config.generatedRouteTree),\n path.resolve(config.routesDirectory, loaderNode.filePath),\n ),\n ),\n )}'), 'loader') })`\n : '',\n componentNode\n ? `.update({ component: lazyRouteComponent(() => import('./${sanitize(\n removeExt(\n path.relative(\n path.dirname(config.generatedRouteTree),\n path.resolve(\n config.routesDirectory,\n componentNode.filePath,\n ),\n ),\n ),\n )}'), 'component') })`\n : '',\n ].join('')\n })\n .join('\\n\\n'),\n `declare module '@tanstack/react-router' {\n interface FileRoutesByPath {\n ${routeNodes\n .map((routeNode) => {\n return `'${routeNode.routePath}': {\n preLoaderRoute: typeof ${routeNode.variableName}Import\n parentRoute: typeof ${\n routeNode.parent?.variableName\n ? `${routeNode.parent?.variableName}Import`\n : 'rootRoute'\n }\n }`\n })\n .join('\\n')}\n }\n}`,\n `export const routeTree = rootRoute.addChildren([${routeConfigChildrenText}])`,\n ].join('\\n')\n\n const routeConfigFileContent = await prettier.format(routeImports, {\n semi: false,\n parser: 'typescript',\n })\n\n const routeTreeContent = await fs\n .readFile(path.resolve(config.generatedRouteTree), 'utf-8')\n .catch((err: any) => {\n if (err.code === 'ENOENT') {\n return undefined\n }\n throw err\n })\n\n if (!checkLatest()) return\n\n if (routeTreeContent !== routeConfigFileContent) {\n await fs.ensureDir(path.dirname(path.resolve(config.generatedRouteTree)))\n if (!checkLatest()) return\n await fs.writeFile(\n path.resolve(config.generatedRouteTree),\n routeConfigFileContent,\n )\n }\n\n console.log(\n `🌲 Processed ${routeNodes.length} routes in ${Date.now() - start}ms`,\n )\n}\n\nfunction fileToVariable(d: string): string {\n return (\n removeUnderscores(d)\n ?.replace(/\\$/g, '')\n ?.split(/[/-]/g)\n .map((d, i) => (i > 0 ? capitalize(d) : d))\n .join('')\n .replace(/([^a-zA-Z0-9]|[\\.])/gm, '') ?? ''\n )\n}\n\nexport function removeExt(d: string) {\n return d.substring(0, d.lastIndexOf('.')) || d\n}\n\nfunction spaces(d: number): string {\n return Array.from({ length: d })\n .map(() => ' ')\n .join('')\n}\n\nexport function multiSortBy<T>(\n arr: T[],\n accessors: ((item: T) => any)[] = [(d) => d],\n): T[] {\n return arr\n .map((d, i) => [d, i] as const)\n .sort(([a, ai], [b, bi]) => {\n for (const accessor of accessors) {\n const ao = accessor(a)\n const bo = accessor(b)\n\n if (typeof ao === 'undefined') {\n if (typeof bo === 'undefined') {\n continue\n }\n return 1\n }\n\n if (ao === bo) {\n continue\n }\n\n return ao > bo ? 1 : -1\n }\n\n return ai - bi\n })\n .map(([d]) => d)\n}\n\nfunction capitalize(s: string) {\n if (typeof s !== 'string') return ''\n return s.charAt(0).toUpperCase() + s.slice(1)\n}\n\nfunction sanitize(s?: string) {\n return replaceBackslash(s?.replace(/\\\\index/gi, ''))\n}\n\nfunction removeUnderscores(s?: string) {\n return s?.replace(/(^_|_$)/, '').replace(/(\\/_|_\\/)/, '/')\n}\n\nfunction replaceBackslash(s?: string) {\n return s?.replace(/\\\\/gi, '/')\n}\n\nexport function hasParentRoute(\n routes: RouteNode[],\n routePathToCheck: string | undefined,\n): RouteNode | null {\n if (!routePathToCheck || routePathToCheck === '/') {\n return null\n }\n\n const sortedNodes = multiSortBy(routes, [\n (d) => d.routePath!.length * -1,\n (d) => d.variableName,\n ]).filter((d) => d.routePath !== `/${rootPathId}`)\n\n for (const route of sortedNodes) {\n if (route.routePath === '/') continue\n\n if (\n routePathToCheck.startsWith(`${route.routePath}/`) &&\n route.routePath !== routePathToCheck\n ) {\n return route\n }\n }\n const segments = routePathToCheck.split('/')\n segments.pop() // Remove the last segment\n const parentRoutePath = segments.join('/')\n\n return hasParentRoute(routes, parentRoutePath)\n}\n"],"names":["latestTask","rootPathId","fileRouteRegex","getRouteNodes","config","routeFilePrefix","routeFileIgnorePrefix","routeNodes","recurse","dir","fullDir","path","resolve","routesDirectory","dirList","fs","filter","d","startsWith","Promise","all","map","fileName","fullPath","join","relativePath","stat","isDirectory","filePath","filePathNoExt","removeExt","routePath","replaceBackslash","cleanPath","split","variableName","fileToVariable","endsWith","replace","push","first","skipMessage","generator","console","log","taskId","checkLatest","start","Date","now","routePathIdPrefix","preRouteNodes","sortRouteNodes","nodes","multiSortBy","length","match","routeTree","routePiecesByPath","handleNode","node","future","unstable_codeSplitting","isRoute","isComponent","isLoader","parentRoute","hasParentRoute","parent","trimmedPath","trimPathLeft","isNonPath","isNonLayout","cleanedPath","removeUnderscores","anchorRoute","find","isVirtual","children","forEach","buildRouteConfig","depth","routeCode","isRoot","escapedRoutePath","replaceAll","quote","quoteStyle","replaced","route","childConfigs","spaces","Boolean","routeConfigChildrenText","sortedRouteNodes","includes","imports","Object","entries","FileRoute","some","lazyFn","loader","lazyRouteComponent","component","routeImports","sanitize","relative","dirname","generatedRouteTree","loaderNode","componentNode","routeNode","routeConfigFileContent","prettier","semi","parser","routeTreeContent","catch","err","code","undefined","i","capitalize","substring","lastIndexOf","Array","from","arr","accessors","sort","a","ai","b","bi","accessor","ao","bo","s","charAt","toUpperCase","slice","routes","routePathToCheck","sortedNodes","segments","pop","parentRoutePath"],"mappings":";;;;;;;;;;;;;;;;;AAMA,IAAIA,UAAU,GAAG,CAAC,CAAA;AACX,MAAMC,UAAU,GAAG,SAAQ;AAC3B,MAAMC,cAAc,GAAG,8BAA6B;AAoB3D,eAAeC,aAAaA,CAACC,MAAc,EAAE;EAC3C,MAAM;IAAEC,eAAe;AAAEC,IAAAA,qBAAAA;AAAsB,GAAC,GAAGF,MAAM,CAAA;EAEzD,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AAA,IAAIvD,KAAK,CAAC1D,SAAS,KAAK,GAAG,EAAE,SAAA;AAE7B,IAAA,IACEgH,gBAAgB,CAAC7H,UAAU,CAAE,CAAA,EAAEuE,KAAK,CAAC1D,SAAU,CAAE,CAAA,CAAA,CAAC,IAClD0D,KAAK,CAAC1D,SAAS,KAAKgH,gBAAgB,EACpC;AACA,MAAA,OAAOtD,KAAK,CAAA;AACd,KAAA;AACF,GAAA;AACA,EAAA,MAAMwD,QAAQ,GAAGF,gBAAgB,CAAC7G,KAAK,CAAC,GAAG,CAAC,CAAA;AAC5C+G,EAAAA,QAAQ,CAACC,GAAG,EAAE,CAAC;AACf,EAAA,MAAMC,eAAe,GAAGF,QAAQ,CAACzH,IAAI,CAAC,GAAG,CAAC,CAAA;AAE1C,EAAA,OAAO2C,cAAc,CAAC2E,MAAM,EAAEK,eAAe,CAAC,CAAA;AAChD;;;;;;;;;"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tanstack/router-vite-plugin/src/index.ts
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
var path = require('path');
|
|
14
|
+
var fs = require('fs/promises');
|
|
15
|
+
var config = require('../../router-cli/src/config.js');
|
|
16
|
+
var generator = require('../../router-cli/src/generator.js');
|
|
17
|
+
|
|
18
|
+
const CONFIG_FILE_NAME = 'tsr.config.json';
|
|
19
|
+
async function readConfigFile(path) {
|
|
20
|
+
try {
|
|
21
|
+
const raw = await fs.readFile(path, 'utf-8');
|
|
22
|
+
return JSON.parse(raw);
|
|
23
|
+
} catch {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function buildConfig(config$1, root) {
|
|
28
|
+
const fileConfig = await readConfigFile(path.join(root, CONFIG_FILE_NAME));
|
|
29
|
+
return config.configSchema.parse({
|
|
30
|
+
...fileConfig,
|
|
31
|
+
...config$1
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function TanStackRouterVite(inlineConfig = {}) {
|
|
35
|
+
let ROOT;
|
|
36
|
+
let userConfig;
|
|
37
|
+
const generate = async () => {
|
|
38
|
+
try {
|
|
39
|
+
await generator.generator(userConfig);
|
|
40
|
+
} catch (err) {
|
|
41
|
+
console.error(err);
|
|
42
|
+
console.info();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
name: 'vite-plugin-tanstack-router',
|
|
47
|
+
configResolved: async vite => {
|
|
48
|
+
ROOT = vite.root;
|
|
49
|
+
userConfig = await buildConfig(inlineConfig, ROOT);
|
|
50
|
+
await generate();
|
|
51
|
+
},
|
|
52
|
+
handleHotUpdate: async ({
|
|
53
|
+
file
|
|
54
|
+
}) => {
|
|
55
|
+
if (file === path.join(ROOT, CONFIG_FILE_NAME)) {
|
|
56
|
+
userConfig = await buildConfig(inlineConfig, ROOT);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (file.startsWith(path.join(ROOT, userConfig.routesDirectory))) {
|
|
60
|
+
await generate();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
exports.TanStackRouterVite = TanStackRouterVite;
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/index.ts"],"sourcesContent":["import { Plugin } from 'vite'\nimport { join } from 'path'\nimport { readFile } from 'fs/promises'\nimport { Config, configSchema } from '@tanstack/router-cli/src/config'\nimport { generator } from '@tanstack/router-cli/src/generator'\n\nconst CONFIG_FILE_NAME = 'tsr.config.json'\n\ntype UserConfig = Partial<Config>\n\nasync function readConfigFile(path: string): Promise<UserConfig> {\n try {\n const raw = await readFile(path, 'utf-8')\n return JSON.parse(raw) as UserConfig\n } catch {\n return {} as UserConfig\n }\n}\n\nasync function buildConfig(config: UserConfig, root: string): Promise<Config> {\n const fileConfig = await readConfigFile(join(root, CONFIG_FILE_NAME))\n return configSchema.parse({\n ...fileConfig,\n ...config,\n })\n}\n\nexport function TanStackRouterVite(inlineConfig: UserConfig = {}): Plugin {\n let ROOT: string\n let userConfig: Config\n\n const generate = async () => {\n try {\n await generator(userConfig)\n } catch (err) {\n console.error(err)\n console.info()\n }\n }\n\n return {\n name: 'vite-plugin-tanstack-router',\n configResolved: async (vite) => {\n ROOT = vite.root\n userConfig = await buildConfig(inlineConfig, ROOT)\n await generate()\n },\n handleHotUpdate: async ({ file }) => {\n if (file === join(ROOT, CONFIG_FILE_NAME)) {\n userConfig = await buildConfig(inlineConfig, ROOT)\n return\n }\n if (file.startsWith(join(ROOT, userConfig.routesDirectory))) {\n await generate()\n }\n },\n }\n}\n"],"names":["CONFIG_FILE_NAME","readConfigFile","path","raw","readFile","JSON","parse","buildConfig","config","root","fileConfig","join","configSchema","TanStackRouterVite","inlineConfig","ROOT","userConfig","generate","generator","err","console","error","info","name","configResolved","vite","handleHotUpdate","file","startsWith","routesDirectory"],"mappings":";;;;;;;;;;;;;;;;;AAMA,MAAMA,gBAAgB,GAAG,iBAAiB,CAAA;AAI1C,eAAeC,cAAcA,CAACC,IAAY,EAAuB;EAC/D,IAAI;IACF,MAAMC,GAAG,GAAG,MAAMC,WAAQ,CAACF,IAAI,EAAE,OAAO,CAAC,CAAA;AACzC,IAAA,OAAOG,IAAI,CAACC,KAAK,CAACH,GAAG,CAAC,CAAA;AACxB,GAAC,CAAC,MAAM;AACN,IAAA,OAAO,EAAE,CAAA;AACX,GAAA;AACF,CAAA;AAEA,eAAeI,WAAWA,CAACC,QAAkB,EAAEC,IAAY,EAAmB;EAC5E,MAAMC,UAAU,GAAG,MAAMT,cAAc,CAACU,SAAI,C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