@tanstack/router-vite-plugin 1.20.2 → 1.20.3-alpha.1

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/README.md ADDED
@@ -0,0 +1,5 @@
1
+ <img src="https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188" />
2
+
3
+ # TanStack Router Vite Plugin
4
+
5
+ See https://tanstack.com/router/latest/docs/framework/react/routing/file-based-routing
@@ -1,37 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const path = require("path");
4
- const routerGenerator = require("@tanstack/router-generator");
5
- const CONFIG_FILE_NAME = "tsr.config.json";
6
- function TanStackRouterVite(inlineConfig = {}) {
7
- const ROOT = process.cwd();
8
- let userConfig;
9
- const generate = async () => {
10
- try {
11
- await routerGenerator.generator(userConfig);
12
- } catch (err) {
13
- console.error(err);
14
- console.info();
15
- }
16
- };
17
- return {
18
- name: "vite-plugin-tanstack-router",
19
- configResolved: async () => {
20
- userConfig = await routerGenerator.getConfig(inlineConfig, ROOT);
21
- await generate();
22
- },
23
- handleHotUpdate: async ({ file }) => {
24
- const filePath = path.normalize(file);
25
- if (filePath === path.join(ROOT, CONFIG_FILE_NAME)) {
26
- userConfig = await routerGenerator.getConfig(inlineConfig, ROOT);
27
- return;
28
- }
29
- const routesDirectoryPath = path.isAbsolute(userConfig.routesDirectory) ? userConfig.routesDirectory : path.join(ROOT, userConfig.routesDirectory);
30
- if (filePath.startsWith(routesDirectoryPath)) {
31
- await generate();
32
- }
33
- }
34
- };
35
- }
36
- exports.TanStackRouterVite = TanStackRouterVite;
3
+ const vite = require("@tanstack/router-plugin/vite");
4
+ Object.keys(vite).forEach((k) => {
5
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
6
+ enumerable: true,
7
+ get: () => vite[k]
8
+ });
9
+ });
37
10
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import { Plugin } from 'vite'\nimport { join, normalize, isAbsolute } from 'path'\nimport { type Config, getConfig, generator } from '@tanstack/router-generator'\n\nconst CONFIG_FILE_NAME = 'tsr.config.json'\n\nexport function TanStackRouterVite(inlineConfig: Partial<Config> = {}): Plugin {\n const ROOT: string = process.cwd()\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 () => {\n userConfig = await getConfig(inlineConfig, ROOT)\n await generate()\n },\n handleHotUpdate: async ({ file }) => {\n const filePath = normalize(file)\n if (filePath === join(ROOT, CONFIG_FILE_NAME)) {\n userConfig = await getConfig(inlineConfig, ROOT)\n return\n }\n const routesDirectoryPath = isAbsolute(userConfig.routesDirectory)\n ? userConfig.routesDirectory\n : join(ROOT, userConfig.routesDirectory)\n if (filePath.startsWith(routesDirectoryPath)) {\n await generate()\n }\n },\n }\n}\n"],"names":["generator","getConfig","normalize","join","isAbsolute"],"mappings":";;;;AAIA,MAAM,mBAAmB;AAET,SAAA,mBAAmB,eAAgC,IAAY;AACvE,QAAA,OAAe,QAAQ;AACzB,MAAA;AAEJ,QAAM,WAAW,YAAY;AACvB,QAAA;AACF,YAAMA,gBAAAA,UAAU,UAAU;AAAA,aACnB,KAAK;AACZ,cAAQ,MAAM,GAAG;AACjB,cAAQ,KAAK;AAAA,IACf;AAAA,EAAA;AAGK,SAAA;AAAA,IACL,MAAM;AAAA,IACN,gBAAgB,YAAY;AACb,mBAAA,MAAMC,gBAAAA,UAAU,cAAc,IAAI;AAC/C,YAAM,SAAS;AAAA,IACjB;AAAA,IACA,iBAAiB,OAAO,EAAE,WAAW;AAC7B,YAAA,WAAWC,eAAU,IAAI;AAC/B,UAAI,aAAaC,KAAAA,KAAK,MAAM,gBAAgB,GAAG;AAChC,qBAAA,MAAMF,gBAAAA,UAAU,cAAc,IAAI;AAC/C;AAAA,MACF;AACM,YAAA,sBAAsBG,KAAAA,WAAW,WAAW,eAAe,IAC7D,WAAW,kBACXD,UAAK,MAAM,WAAW,eAAe;AACrC,UAAA,SAAS,WAAW,mBAAmB,GAAG;AAC5C,cAAM,SAAS;AAAA,MACjB;AAAA,IACF;AAAA,EAAA;AAEJ;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -1,3 +1,2 @@
1
- import { Plugin } from 'vite';
2
- import { type Config } from '@tanstack/router-generator';
3
- export declare function TanStackRouterVite(inlineConfig?: Partial<Config>): Plugin;
1
+ export * from '@tanstack/router-plugin/vite';
2
+ export type * from '@tanstack/router-plugin/vite';
@@ -1,3 +1,2 @@
1
- import { Plugin } from 'vite';
2
- import { type Config } from '@tanstack/router-generator';
3
- export declare function TanStackRouterVite(inlineConfig?: Partial<Config>): Plugin;
1
+ export * from '@tanstack/router-plugin/vite';
2
+ export type * from '@tanstack/router-plugin/vite';
package/dist/esm/index.js CHANGED
@@ -1,37 +1,2 @@
1
- import { normalize, join, isAbsolute } from "path";
2
- import { getConfig, generator } from "@tanstack/router-generator";
3
- const CONFIG_FILE_NAME = "tsr.config.json";
4
- function TanStackRouterVite(inlineConfig = {}) {
5
- const ROOT = process.cwd();
6
- let userConfig;
7
- const generate = async () => {
8
- try {
9
- await generator(userConfig);
10
- } catch (err) {
11
- console.error(err);
12
- console.info();
13
- }
14
- };
15
- return {
16
- name: "vite-plugin-tanstack-router",
17
- configResolved: async () => {
18
- userConfig = await getConfig(inlineConfig, ROOT);
19
- await generate();
20
- },
21
- handleHotUpdate: async ({ file }) => {
22
- const filePath = normalize(file);
23
- if (filePath === join(ROOT, CONFIG_FILE_NAME)) {
24
- userConfig = await getConfig(inlineConfig, ROOT);
25
- return;
26
- }
27
- const routesDirectoryPath = isAbsolute(userConfig.routesDirectory) ? userConfig.routesDirectory : join(ROOT, userConfig.routesDirectory);
28
- if (filePath.startsWith(routesDirectoryPath)) {
29
- await generate();
30
- }
31
- }
32
- };
33
- }
34
- export {
35
- TanStackRouterVite
36
- };
1
+ export * from "@tanstack/router-plugin/vite";
37
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { Plugin } from 'vite'\nimport { join, normalize, isAbsolute } from 'path'\nimport { type Config, getConfig, generator } from '@tanstack/router-generator'\n\nconst CONFIG_FILE_NAME = 'tsr.config.json'\n\nexport function TanStackRouterVite(inlineConfig: Partial<Config> = {}): Plugin {\n const ROOT: string = process.cwd()\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 () => {\n userConfig = await getConfig(inlineConfig, ROOT)\n await generate()\n },\n handleHotUpdate: async ({ file }) => {\n const filePath = normalize(file)\n if (filePath === join(ROOT, CONFIG_FILE_NAME)) {\n userConfig = await getConfig(inlineConfig, ROOT)\n return\n }\n const routesDirectoryPath = isAbsolute(userConfig.routesDirectory)\n ? userConfig.routesDirectory\n : join(ROOT, userConfig.routesDirectory)\n if (filePath.startsWith(routesDirectoryPath)) {\n await generate()\n }\n },\n }\n}\n"],"names":[],"mappings":";;AAIA,MAAM,mBAAmB;AAET,SAAA,mBAAmB,eAAgC,IAAY;AACvE,QAAA,OAAe,QAAQ;AACzB,MAAA;AAEJ,QAAM,WAAW,YAAY;AACvB,QAAA;AACF,YAAM,UAAU,UAAU;AAAA,aACnB,KAAK;AACZ,cAAQ,MAAM,GAAG;AACjB,cAAQ,KAAK;AAAA,IACf;AAAA,EAAA;AAGK,SAAA;AAAA,IACL,MAAM;AAAA,IACN,gBAAgB,YAAY;AACb,mBAAA,MAAM,UAAU,cAAc,IAAI;AAC/C,YAAM,SAAS;AAAA,IACjB;AAAA,IACA,iBAAiB,OAAO,EAAE,WAAW;AAC7B,YAAA,WAAW,UAAU,IAAI;AAC/B,UAAI,aAAa,KAAK,MAAM,gBAAgB,GAAG;AAChC,qBAAA,MAAM,UAAU,cAAc,IAAI;AAC/C;AAAA,MACF;AACM,YAAA,sBAAsB,WAAW,WAAW,eAAe,IAC7D,WAAW,kBACX,KAAK,MAAM,WAAW,eAAe;AACrC,UAAA,SAAS,WAAW,mBAAmB,GAAG;AAC5C,cAAM,SAAS;AAAA,MACjB;AAAA,IACF;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/router-vite-plugin",
3
- "version": "1.20.2",
4
- "description": "",
3
+ "version": "1.20.3-alpha.1",
4
+ "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -14,6 +14,15 @@
14
14
  "type": "github",
15
15
  "url": "https://github.com/sponsors/tannerlinsley"
16
16
  },
17
+ "keywords": [
18
+ "react",
19
+ "location",
20
+ "router",
21
+ "routing",
22
+ "async",
23
+ "async router",
24
+ "typescript"
25
+ ],
17
26
  "type": "module",
18
27
  "types": "dist/esm/index.d.ts",
19
28
  "main": "dist/cjs/index.cjs",
@@ -32,29 +41,15 @@
32
41
  "./package.json": "./package.json"
33
42
  },
34
43
  "sideEffects": false,
35
- "keywords": [
36
- "react",
37
- "location",
38
- "router",
39
- "routing",
40
- "async",
41
- "async router",
42
- "typescript"
44
+ "files": [
45
+ "dist",
46
+ "src"
43
47
  ],
44
48
  "engines": {
45
49
  "node": ">=12"
46
50
  },
47
- "files": [
48
- "dist",
49
- "src/**"
50
- ],
51
51
  "dependencies": {
52
- "@tanstack/router-generator": "1.20.0"
52
+ "@tanstack/router-plugin": "^1.20.3-alpha.1"
53
53
  },
54
- "scripts": {
55
- "clean": "rimraf ./dist && rimraf ./coverage",
56
- "test:types": "tsc",
57
- "test:build": "publint --strict",
58
- "build": "vite build"
59
- }
54
+ "scripts": {}
60
55
  }
package/src/index.ts CHANGED
@@ -1,40 +1,2 @@
1
- import { Plugin } from 'vite'
2
- import { join, normalize, isAbsolute } from 'path'
3
- import { type Config, getConfig, generator } from '@tanstack/router-generator'
4
-
5
- const CONFIG_FILE_NAME = 'tsr.config.json'
6
-
7
- export function TanStackRouterVite(inlineConfig: Partial<Config> = {}): Plugin {
8
- const ROOT: string = process.cwd()
9
- let userConfig: Config
10
-
11
- const generate = async () => {
12
- try {
13
- await generator(userConfig)
14
- } catch (err) {
15
- console.error(err)
16
- console.info()
17
- }
18
- }
19
-
20
- return {
21
- name: 'vite-plugin-tanstack-router',
22
- configResolved: async () => {
23
- userConfig = await getConfig(inlineConfig, ROOT)
24
- await generate()
25
- },
26
- handleHotUpdate: async ({ file }) => {
27
- const filePath = normalize(file)
28
- if (filePath === join(ROOT, CONFIG_FILE_NAME)) {
29
- userConfig = await getConfig(inlineConfig, ROOT)
30
- return
31
- }
32
- const routesDirectoryPath = isAbsolute(userConfig.routesDirectory)
33
- ? userConfig.routesDirectory
34
- : join(ROOT, userConfig.routesDirectory)
35
- if (filePath.startsWith(routesDirectoryPath)) {
36
- await generate()
37
- }
38
- },
39
- }
40
- }
1
+ export * from '@tanstack/router-plugin/vite'
2
+ export type * from '@tanstack/router-plugin/vite'