@tanstack/router-plugin 1.43.8 → 1.43.9
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.
|
@@ -87,19 +87,27 @@ const unpluginRouterGeneratorFactory = (options = {}) => {
|
|
|
87
87
|
},
|
|
88
88
|
async rspack(compiler) {
|
|
89
89
|
userConfig = await config.getConfig(options, ROOT);
|
|
90
|
-
|
|
91
|
-
compiler.hooks.watchRun.tap(PLUGIN_NAME, async () => {
|
|
90
|
+
if (compiler.options.mode === "production") {
|
|
92
91
|
await run(generate);
|
|
93
|
-
}
|
|
92
|
+
} else {
|
|
93
|
+
const routesDirectoryPath = getRoutesDirectoryPath();
|
|
94
|
+
const chokidar = await import("chokidar");
|
|
95
|
+
chokidar.watch(routesDirectoryPath).on("add", async () => {
|
|
96
|
+
await run(generate);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
94
99
|
},
|
|
95
100
|
async webpack(compiler) {
|
|
96
101
|
userConfig = await config.getConfig(options, ROOT);
|
|
97
|
-
|
|
98
|
-
const routesDirectoryPath = getRoutesDirectoryPath();
|
|
99
|
-
const chokidar = await import("chokidar");
|
|
100
|
-
chokidar.watch(routesDirectoryPath).on("add", async () => {
|
|
102
|
+
if (compiler.options.mode === "production") {
|
|
101
103
|
await run(generate);
|
|
102
|
-
}
|
|
104
|
+
} else {
|
|
105
|
+
const routesDirectoryPath = getRoutesDirectoryPath();
|
|
106
|
+
const chokidar = await import("chokidar");
|
|
107
|
+
chokidar.watch(routesDirectoryPath).on("add", async () => {
|
|
108
|
+
await run(generate);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
103
111
|
if (compiler.options.mode === "production") {
|
|
104
112
|
compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {
|
|
105
113
|
console.log("✅ " + PLUGIN_NAME + ": route-tree generation done");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router-generator.cjs","sources":["../../src/router-generator.ts"],"sourcesContent":["import { isAbsolute, join, normalize, resolve } from 'node:path'\nimport { generator } from '@tanstack/router-generator'\n\nimport { getConfig } from './config'\nimport { CONFIG_FILE_NAME } from './constants'\nimport type { UnpluginFactory } from 'unplugin'\nimport type { Config } from './config'\n\nlet lock = false\nconst checkLock = () => lock\nconst setLock = (bool: boolean) => {\n lock = bool\n}\n\nconst PLUGIN_NAME = 'unplugin:router-generator'\n\nexport const unpluginRouterGeneratorFactory: UnpluginFactory<\n Partial<Config> | undefined\n> = (options = {}) => {\n let ROOT: string = process.cwd()\n let userConfig = options as Config\n\n const getRoutesDirectoryPath = () => {\n return isAbsolute(userConfig.routesDirectory)\n ? userConfig.routesDirectory\n : join(ROOT, userConfig.routesDirectory)\n }\n\n const generate = async () => {\n if (checkLock()) {\n return\n }\n\n setLock(true)\n\n try {\n await generator(userConfig)\n } catch (err) {\n console.error(err)\n console.info()\n } finally {\n setLock(false)\n }\n }\n\n const handleFile = async (\n file: string,\n event: 'create' | 'update' | 'delete',\n ) => {\n const filePath = normalize(file)\n\n if (filePath === join(ROOT, CONFIG_FILE_NAME)) {\n userConfig = await getConfig(options, ROOT)\n return\n }\n\n if (\n event === 'update' &&\n filePath === resolve(userConfig.generatedRouteTree)\n ) {\n // skip generating routes if the generated route tree is updated\n return\n }\n\n const routesDirectoryPath = getRoutesDirectoryPath()\n if (filePath.startsWith(routesDirectoryPath)) {\n await generate()\n }\n }\n\n const run: (cb: () => Promise<void> | void) => Promise<void> = async (cb) => {\n if (userConfig.enableRouteGeneration ?? true) {\n await cb()\n }\n }\n\n return {\n name: 'router-generator-plugin',\n async watchChange(id, { event }) {\n await run(async () => {\n await handleFile(id, event)\n })\n },\n vite: {\n async configResolved(config) {\n ROOT = config.root\n userConfig = await getConfig(options, ROOT)\n\n await run(generate)\n },\n },\n async rspack(compiler) {\n userConfig = await getConfig(options, ROOT)\n\n await run(generate)\n\n
|
|
1
|
+
{"version":3,"file":"router-generator.cjs","sources":["../../src/router-generator.ts"],"sourcesContent":["import { isAbsolute, join, normalize, resolve } from 'node:path'\nimport { generator } from '@tanstack/router-generator'\n\nimport { getConfig } from './config'\nimport { CONFIG_FILE_NAME } from './constants'\nimport type { UnpluginFactory } from 'unplugin'\nimport type { Config } from './config'\n\nlet lock = false\nconst checkLock = () => lock\nconst setLock = (bool: boolean) => {\n lock = bool\n}\n\nconst PLUGIN_NAME = 'unplugin:router-generator'\n\nexport const unpluginRouterGeneratorFactory: UnpluginFactory<\n Partial<Config> | undefined\n> = (options = {}) => {\n let ROOT: string = process.cwd()\n let userConfig = options as Config\n\n const getRoutesDirectoryPath = () => {\n return isAbsolute(userConfig.routesDirectory)\n ? userConfig.routesDirectory\n : join(ROOT, userConfig.routesDirectory)\n }\n\n const generate = async () => {\n if (checkLock()) {\n return\n }\n\n setLock(true)\n\n try {\n await generator(userConfig)\n } catch (err) {\n console.error(err)\n console.info()\n } finally {\n setLock(false)\n }\n }\n\n const handleFile = async (\n file: string,\n event: 'create' | 'update' | 'delete',\n ) => {\n const filePath = normalize(file)\n\n if (filePath === join(ROOT, CONFIG_FILE_NAME)) {\n userConfig = await getConfig(options, ROOT)\n return\n }\n\n if (\n event === 'update' &&\n filePath === resolve(userConfig.generatedRouteTree)\n ) {\n // skip generating routes if the generated route tree is updated\n return\n }\n\n const routesDirectoryPath = getRoutesDirectoryPath()\n if (filePath.startsWith(routesDirectoryPath)) {\n await generate()\n }\n }\n\n const run: (cb: () => Promise<void> | void) => Promise<void> = async (cb) => {\n if (userConfig.enableRouteGeneration ?? true) {\n await cb()\n }\n }\n\n return {\n name: 'router-generator-plugin',\n async watchChange(id, { event }) {\n await run(async () => {\n await handleFile(id, event)\n })\n },\n vite: {\n async configResolved(config) {\n ROOT = config.root\n userConfig = await getConfig(options, ROOT)\n\n await run(generate)\n },\n },\n async rspack(compiler) {\n userConfig = await getConfig(options, ROOT)\n\n // rspack watcher doesn't register newly created files\n if (compiler.options.mode === 'production') {\n await run(generate)\n } else {\n const routesDirectoryPath = getRoutesDirectoryPath()\n const chokidar = await import('chokidar')\n chokidar.watch(routesDirectoryPath).on('add', async () => {\n await run(generate)\n })\n }\n },\n async webpack(compiler) {\n userConfig = await getConfig(options, ROOT)\n\n // webpack watcher doesn't register newly created files\n if (compiler.options.mode === 'production') {\n await run(generate)\n } else {\n const routesDirectoryPath = getRoutesDirectoryPath()\n const chokidar = await import('chokidar')\n chokidar.watch(routesDirectoryPath).on('add', async () => {\n await run(generate)\n })\n }\n\n if (compiler.options.mode === 'production') {\n compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {\n console.log('✅ ' + PLUGIN_NAME + ': route-tree generation done')\n setTimeout(() => {\n process.exit(0)\n })\n })\n }\n },\n }\n}\n"],"names":["isAbsolute","join","generator","normalize","CONFIG_FILE_NAME","getConfig","resolve","config"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,IAAI,OAAO;AACX,MAAM,YAAY,MAAM;AACxB,MAAM,UAAU,CAAC,SAAkB;AAC1B,SAAA;AACT;AAEA,MAAM,cAAc;AAEb,MAAM,iCAET,CAAC,UAAU,OAAO;AAChB,MAAA,OAAe,QAAQ;AAC3B,MAAI,aAAa;AAEjB,QAAM,yBAAyB,MAAM;AAC5B,WAAAA,qBAAW,WAAW,eAAe,IACxC,WAAW,kBACXC,UAAAA,KAAK,MAAM,WAAW,eAAe;AAAA,EAAA;AAG3C,QAAM,WAAW,YAAY;AAC3B,QAAI,aAAa;AACf;AAAA,IACF;AAEA,YAAQ,IAAI;AAER,QAAA;AACF,YAAMC,gBAAAA,UAAU,UAAU;AAAA,aACnB,KAAK;AACZ,cAAQ,MAAM,GAAG;AACjB,cAAQ,KAAK;AAAA,IAAA,UACb;AACA,cAAQ,KAAK;AAAA,IACf;AAAA,EAAA;AAGI,QAAA,aAAa,OACjB,MACA,UACG;AACG,UAAA,WAAWC,oBAAU,IAAI;AAE/B,QAAI,aAAaF,UAAAA,KAAK,MAAMG,UAAgB,gBAAA,GAAG;AAChC,mBAAA,MAAMC,OAAAA,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Y;AACxD,gBAAM,IAAI,QAAQ;AAAA,QAAA,CACnB;AAAA,MACH;AAEI,UAAA,SAAS,QAAQ,SAAS,cAAc;AAC1C,iBAAS,MAAM,KAAK,IAAI,aAAa,CAAC,UAAU;AACtC,kBAAA,IAAI,OAAO,cAAc,8BAA8B;AAC/D,qBAAW,MAAM;AACf,oBAAQ,KAAK,CAAC;AAAA,UAAA,CACf;AAAA,QAAA,CACF;AAAA,MACH;AAAA,IACF;AAAA,EAAA;AAEJ;;"}
|
|
@@ -63,19 +63,27 @@ const unpluginRouterGeneratorFactory = (options = {}) => {
|
|
|
63
63
|
},
|
|
64
64
|
async rspack(compiler) {
|
|
65
65
|
userConfig = await getConfig(options, ROOT);
|
|
66
|
-
|
|
67
|
-
compiler.hooks.watchRun.tap(PLUGIN_NAME, async () => {
|
|
66
|
+
if (compiler.options.mode === "production") {
|
|
68
67
|
await run(generate);
|
|
69
|
-
}
|
|
68
|
+
} else {
|
|
69
|
+
const routesDirectoryPath = getRoutesDirectoryPath();
|
|
70
|
+
const chokidar = await import("chokidar");
|
|
71
|
+
chokidar.watch(routesDirectoryPath).on("add", async () => {
|
|
72
|
+
await run(generate);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
70
75
|
},
|
|
71
76
|
async webpack(compiler) {
|
|
72
77
|
userConfig = await getConfig(options, ROOT);
|
|
73
|
-
|
|
74
|
-
const routesDirectoryPath = getRoutesDirectoryPath();
|
|
75
|
-
const chokidar = await import("chokidar");
|
|
76
|
-
chokidar.watch(routesDirectoryPath).on("add", async () => {
|
|
78
|
+
if (compiler.options.mode === "production") {
|
|
77
79
|
await run(generate);
|
|
78
|
-
}
|
|
80
|
+
} else {
|
|
81
|
+
const routesDirectoryPath = getRoutesDirectoryPath();
|
|
82
|
+
const chokidar = await import("chokidar");
|
|
83
|
+
chokidar.watch(routesDirectoryPath).on("add", async () => {
|
|
84
|
+
await run(generate);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
79
87
|
if (compiler.options.mode === "production") {
|
|
80
88
|
compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {
|
|
81
89
|
console.log("✅ " + PLUGIN_NAME + ": route-tree generation done");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router-generator.js","sources":["../../src/router-generator.ts"],"sourcesContent":["import { isAbsolute, join, normalize, resolve } from 'node:path'\nimport { generator } from '@tanstack/router-generator'\n\nimport { getConfig } from './config'\nimport { CONFIG_FILE_NAME } from './constants'\nimport type { UnpluginFactory } from 'unplugin'\nimport type { Config } from './config'\n\nlet lock = false\nconst checkLock = () => lock\nconst setLock = (bool: boolean) => {\n lock = bool\n}\n\nconst PLUGIN_NAME = 'unplugin:router-generator'\n\nexport const unpluginRouterGeneratorFactory: UnpluginFactory<\n Partial<Config> | undefined\n> = (options = {}) => {\n let ROOT: string = process.cwd()\n let userConfig = options as Config\n\n const getRoutesDirectoryPath = () => {\n return isAbsolute(userConfig.routesDirectory)\n ? userConfig.routesDirectory\n : join(ROOT, userConfig.routesDirectory)\n }\n\n const generate = async () => {\n if (checkLock()) {\n return\n }\n\n setLock(true)\n\n try {\n await generator(userConfig)\n } catch (err) {\n console.error(err)\n console.info()\n } finally {\n setLock(false)\n }\n }\n\n const handleFile = async (\n file: string,\n event: 'create' | 'update' | 'delete',\n ) => {\n const filePath = normalize(file)\n\n if (filePath === join(ROOT, CONFIG_FILE_NAME)) {\n userConfig = await getConfig(options, ROOT)\n return\n }\n\n if (\n event === 'update' &&\n filePath === resolve(userConfig.generatedRouteTree)\n ) {\n // skip generating routes if the generated route tree is updated\n return\n }\n\n const routesDirectoryPath = getRoutesDirectoryPath()\n if (filePath.startsWith(routesDirectoryPath)) {\n await generate()\n }\n }\n\n const run: (cb: () => Promise<void> | void) => Promise<void> = async (cb) => {\n if (userConfig.enableRouteGeneration ?? true) {\n await cb()\n }\n }\n\n return {\n name: 'router-generator-plugin',\n async watchChange(id, { event }) {\n await run(async () => {\n await handleFile(id, event)\n })\n },\n vite: {\n async configResolved(config) {\n ROOT = config.root\n userConfig = await getConfig(options, ROOT)\n\n await run(generate)\n },\n },\n async rspack(compiler) {\n userConfig = await getConfig(options, ROOT)\n\n await run(generate)\n\n
|
|
1
|
+
{"version":3,"file":"router-generator.js","sources":["../../src/router-generator.ts"],"sourcesContent":["import { isAbsolute, join, normalize, resolve } from 'node:path'\nimport { generator } from '@tanstack/router-generator'\n\nimport { getConfig } from './config'\nimport { CONFIG_FILE_NAME } from './constants'\nimport type { UnpluginFactory } from 'unplugin'\nimport type { Config } from './config'\n\nlet lock = false\nconst checkLock = () => lock\nconst setLock = (bool: boolean) => {\n lock = bool\n}\n\nconst PLUGIN_NAME = 'unplugin:router-generator'\n\nexport const unpluginRouterGeneratorFactory: UnpluginFactory<\n Partial<Config> | undefined\n> = (options = {}) => {\n let ROOT: string = process.cwd()\n let userConfig = options as Config\n\n const getRoutesDirectoryPath = () => {\n return isAbsolute(userConfig.routesDirectory)\n ? userConfig.routesDirectory\n : join(ROOT, userConfig.routesDirectory)\n }\n\n const generate = async () => {\n if (checkLock()) {\n return\n }\n\n setLock(true)\n\n try {\n await generator(userConfig)\n } catch (err) {\n console.error(err)\n console.info()\n } finally {\n setLock(false)\n }\n }\n\n const handleFile = async (\n file: string,\n event: 'create' | 'update' | 'delete',\n ) => {\n const filePath = normalize(file)\n\n if (filePath === join(ROOT, CONFIG_FILE_NAME)) {\n userConfig = await getConfig(options, ROOT)\n return\n }\n\n if (\n event === 'update' &&\n filePath === resolve(userConfig.generatedRouteTree)\n ) {\n // skip generating routes if the generated route tree is updated\n return\n }\n\n const routesDirectoryPath = getRoutesDirectoryPath()\n if (filePath.startsWith(routesDirectoryPath)) {\n await generate()\n }\n }\n\n const run: (cb: () => Promise<void> | void) => Promise<void> = async (cb) => {\n if (userConfig.enableRouteGeneration ?? true) {\n await cb()\n }\n }\n\n return {\n name: 'router-generator-plugin',\n async watchChange(id, { event }) {\n await run(async () => {\n await handleFile(id, event)\n })\n },\n vite: {\n async configResolved(config) {\n ROOT = config.root\n userConfig = await getConfig(options, ROOT)\n\n await run(generate)\n },\n },\n async rspack(compiler) {\n userConfig = await getConfig(options, ROOT)\n\n // rspack watcher doesn't register newly created files\n if (compiler.options.mode === 'production') {\n await run(generate)\n } else {\n const routesDirectoryPath = getRoutesDirectoryPath()\n const chokidar = await import('chokidar')\n chokidar.watch(routesDirectoryPath).on('add', async () => {\n await run(generate)\n })\n }\n },\n async webpack(compiler) {\n userConfig = await getConfig(options, ROOT)\n\n // webpack watcher doesn't register newly created files\n if (compiler.options.mode === 'production') {\n await run(generate)\n } else {\n const routesDirectoryPath = getRoutesDirectoryPath()\n const chokidar = await import('chokidar')\n chokidar.watch(routesDirectoryPath).on('add', async () => {\n await run(generate)\n })\n }\n\n if (compiler.options.mode === 'production') {\n compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {\n console.log('✅ ' + PLUGIN_NAME + ': route-tree generation done')\n setTimeout(() => {\n process.exit(0)\n })\n })\n }\n },\n }\n}\n"],"names":[],"mappings":";;;;AAQA,IAAI,OAAO;AACX,MAAM,YAAY,MAAM;AACxB,MAAM,UAAU,CAAC,SAAkB;AAC1B,SAAA;AACT;AAEA,MAAM,cAAc;AAEb,MAAM,iCAET,CAAC,UAAU,OAAO;AAChB,MAAA,OAAe,QAAQ;AAC3B,MAAI,aAAa;AAEjB,QAAM,yBAAyB,MAAM;AAC5B,WAAA,WAAW,WAAW,eAAe,IACxC,WAAW,kBACX,KAAK,MAAM,WAAW,eAAe;AAAA,EAAA;AAG3C,QAAM,WAAW,YAAY;AAC3B,QAAI,aAAa;AACf;AAAA,IACF;AAEA,YAAQ,IAAI;AAER,QAAA;AACF,YAAM,UAAU,UAAU;AAAA,aACnB,KAAK;AACZ,cAAQ,MAAM,GAAG;AACjB,cAAQ,KAAK;AAAA,IAAA,UACb;AACA,cAAQ,KAAK;AAAA,IACf;AAAA,EAAA;AAGI,QAAA,aAAa,OACjB,MACA,UACG;AACG,UAAA,WAAW,UAAU,IAAI;A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AAmB,EAAE,GAAG,OAAO,YAAY;AACxD,gBAAM,IAAI,QAAQ;AAAA,QAAA,CACnB;AAAA,MACH;AAEI,UAAA,SAAS,QAAQ,SAAS,cAAc;AAC1C,iBAAS,MAAM,KAAK,IAAI,aAAa,CAAC,UAAU;AACtC,kBAAA,IAAI,OAAO,cAAc,8BAA8B;AAC/D,qBAAW,MAAM;AACf,oBAAQ,KAAK,CAAC;AAAA,UAAA,CACf;AAAA,QAAA,CACF;AAAA,MACH;AAAA,IACF;AAAA,EAAA;AAEJ;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/router-plugin",
|
|
3
|
-
"version": "1.43.
|
|
3
|
+
"version": "1.43.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"@types/babel__traverse": "^7.20.6",
|
|
107
107
|
"babel-dead-code-elimination": "^1.0.6",
|
|
108
108
|
"chokidar": "^3.5.3",
|
|
109
|
-
"unplugin": "^1.
|
|
109
|
+
"unplugin": "^1.11.0",
|
|
110
110
|
"zod": "^3.22.4",
|
|
111
111
|
"@tanstack/router-generator": "^1.43.1"
|
|
112
112
|
},
|
package/src/router-generator.ts
CHANGED
|
@@ -92,23 +92,30 @@ export const unpluginRouterGeneratorFactory: UnpluginFactory<
|
|
|
92
92
|
async rspack(compiler) {
|
|
93
93
|
userConfig = await getConfig(options, ROOT)
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
compiler.hooks.watchRun.tap(PLUGIN_NAME, async () => {
|
|
95
|
+
// rspack watcher doesn't register newly created files
|
|
96
|
+
if (compiler.options.mode === 'production') {
|
|
98
97
|
await run(generate)
|
|
99
|
-
}
|
|
98
|
+
} else {
|
|
99
|
+
const routesDirectoryPath = getRoutesDirectoryPath()
|
|
100
|
+
const chokidar = await import('chokidar')
|
|
101
|
+
chokidar.watch(routesDirectoryPath).on('add', async () => {
|
|
102
|
+
await run(generate)
|
|
103
|
+
})
|
|
104
|
+
}
|
|
100
105
|
},
|
|
101
106
|
async webpack(compiler) {
|
|
102
107
|
userConfig = await getConfig(options, ROOT)
|
|
103
108
|
|
|
104
|
-
await run(generate)
|
|
105
|
-
|
|
106
109
|
// webpack watcher doesn't register newly created files
|
|
107
|
-
|
|
108
|
-
const chokidar = await import('chokidar')
|
|
109
|
-
chokidar.watch(routesDirectoryPath).on('add', async () => {
|
|
110
|
+
if (compiler.options.mode === 'production') {
|
|
110
111
|
await run(generate)
|
|
111
|
-
}
|
|
112
|
+
} else {
|
|
113
|
+
const routesDirectoryPath = getRoutesDirectoryPath()
|
|
114
|
+
const chokidar = await import('chokidar')
|
|
115
|
+
chokidar.watch(routesDirectoryPath).on('add', async () => {
|
|
116
|
+
await run(generate)
|
|
117
|
+
})
|
|
118
|
+
}
|
|
112
119
|
|
|
113
120
|
if (compiler.options.mode === 'production') {
|
|
114
121
|
compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {
|