@tanstack/router-cli 1.45.2 → 1.45.7
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/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/watch.cjs +3 -3
- package/dist/cjs/watch.cjs.map +1 -1
- package/dist/cjs/watch.d.cts +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/watch.d.ts +1 -1
- package/dist/esm/watch.js +3 -3
- package/dist/esm/watch.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +2 -2
- package/src/watch.ts +3 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -24,12 +24,12 @@ const yargs__namespace = /* @__PURE__ */ _interopNamespaceDefault(yargs);
|
|
|
24
24
|
main();
|
|
25
25
|
function main() {
|
|
26
26
|
yargs__namespace.scriptName("tsr").usage("$0 <cmd> [args]").command("generate", "Generate the routes for a project", async () => {
|
|
27
|
-
const config =
|
|
27
|
+
const config = routerGenerator.getConfig();
|
|
28
28
|
await generate.generate(config);
|
|
29
29
|
}).command(
|
|
30
30
|
"watch",
|
|
31
31
|
"Continuously watch and generate the routes for a project",
|
|
32
|
-
|
|
32
|
+
() => {
|
|
33
33
|
watch.watch();
|
|
34
34
|
}
|
|
35
35
|
).help().argv;
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import * as yargs from 'yargs'\nimport { getConfig } from '@tanstack/router-generator'\nimport { generate } from './generate'\nimport { watch } from './watch'\n\nmain()\n\nexport function main() {\n yargs\n // @ts-expect-error\n .scriptName('tsr')\n .usage('$0 <cmd> [args]')\n .command('generate', 'Generate the routes for a project', async () => {\n const config =
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import * as yargs from 'yargs'\nimport { getConfig } from '@tanstack/router-generator'\nimport { generate } from './generate'\nimport { watch } from './watch'\n\nmain()\n\nexport function main() {\n yargs\n // @ts-expect-error\n .scriptName('tsr')\n .usage('$0 <cmd> [args]')\n .command('generate', 'Generate the routes for a project', async () => {\n const config = getConfig()\n await generate(config)\n })\n .command(\n 'watch',\n 'Continuously watch and generate the routes for a project',\n () => {\n watch()\n },\n )\n .help().argv\n}\n"],"names":["yargs","getConfig","generate","watch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKA;AAEO,SAAS,OAAO;AAGlBA,mBAAA,WAAW,KAAK,EAChB,MAAM,iBAAiB,EACvB,QAAQ,YAAY,qCAAqC,YAAY;AACpE,UAAM,SAASC,gBAAAA;AACf,UAAMC,SAAAA,SAAS,MAAM;AAAA,EACtB,CAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,IACA,MAAM;AACEC,YAAAA;IACR;AAAA,EAAA,EAED,KAAO,EAAA;AACZ;;"}
|
package/dist/cjs/watch.cjs
CHANGED
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const path = require("node:path");
|
|
4
4
|
const chokidar = require("chokidar");
|
|
5
5
|
const routerGenerator = require("@tanstack/router-generator");
|
|
6
|
-
|
|
6
|
+
function watch() {
|
|
7
7
|
const configWatcher = chokidar.watch(
|
|
8
8
|
path.resolve(process.cwd(), "tsr.config.json")
|
|
9
9
|
);
|
|
10
10
|
let watcher = new chokidar.FSWatcher({});
|
|
11
|
-
const generatorWatcher =
|
|
12
|
-
const config =
|
|
11
|
+
const generatorWatcher = () => {
|
|
12
|
+
const config = routerGenerator.getConfig();
|
|
13
13
|
watcher.close();
|
|
14
14
|
console.info(`TSR: Watching routes (${config.routesDirectory})...`);
|
|
15
15
|
watcher = chokidar.watch(config.routesDirectory);
|
package/dist/cjs/watch.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.cjs","sources":["../../src/watch.ts"],"sourcesContent":["import path from 'node:path'\nimport chokidar from 'chokidar'\nimport { generator, getConfig } from '@tanstack/router-generator'\n\nexport
|
|
1
|
+
{"version":3,"file":"watch.cjs","sources":["../../src/watch.ts"],"sourcesContent":["import path from 'node:path'\nimport chokidar from 'chokidar'\nimport { generator, getConfig } from '@tanstack/router-generator'\n\nexport function watch() {\n const configWatcher = chokidar.watch(\n path.resolve(process.cwd(), 'tsr.config.json'),\n )\n\n let watcher = new chokidar.FSWatcher({})\n\n const generatorWatcher = () => {\n const config = getConfig()\n\n watcher.close()\n\n console.info(`TSR: Watching routes (${config.routesDirectory})...`)\n watcher = chokidar.watch(config.routesDirectory)\n\n watcher.on('ready', async () => {\n const handle = async () => {\n try {\n await generator(config)\n } catch (err) {\n console.error(err)\n console.info()\n }\n }\n\n await handle()\n\n let timeout: ReturnType<typeof setTimeout> | undefined\n\n const deduped = (file: string) => {\n if (timeout) {\n clearTimeout(timeout)\n }\n\n timeout = setTimeout(handle, 10)\n }\n\n watcher.on('change', deduped)\n watcher.on('add', deduped)\n watcher.on('unlink', deduped)\n })\n }\n\n configWatcher.on('ready', generatorWatcher)\n configWatcher.on('change', generatorWatcher)\n}\n"],"names":["getConfig","generator"],"mappings":";;;;;AAIO,SAAS,QAAQ;AACtB,QAAM,gBAAgB,SAAS;AAAA,IAC7B,KAAK,QAAQ,QAAQ,IAAA,GAAO,iBAAiB;AAAA,EAAA;AAG/C,MAAI,UAAU,IAAI,SAAS,UAAU,CAAE,CAAA;AAEvC,QAAM,mBAAmB,MAAM;AAC7B,UAAM,SAASA,gBAAAA;AAEf,YAAQ,MAAM;AAEd,YAAQ,KAAK,yBAAyB,OAAO,eAAe,MAAM;AACxD,cAAA,SAAS,MAAM,OAAO,eAAe;AAEvC,YAAA,GAAG,SAAS,YAAY;AAC9B,YAAM,SAAS,YAAY;AACrB,YAAA;AACF,gBAAMC,gBAAAA,UAAU,MAAM;AAAA,iBACf,KAAK;AACZ,kBAAQ,MAAM,GAAG;AACjB,kBAAQ,KAAK;AAAA,QACf;AAAA,MAAA;AAGF,YAAM,OAAO;AAET,UAAA;AAEE,YAAA,UAAU,CAAC,SAAiB;AAChC,YAAI,SAAS;AACX,uBAAa,OAAO;AAAA,QACtB;AAEU,kBAAA,WAAW,QAAQ,EAAE;AAAA,MAAA;AAGzB,cAAA,GAAG,UAAU,OAAO;AACpB,cAAA,GAAG,OAAO,OAAO;AACjB,cAAA,GAAG,UAAU,OAAO;AAAA,IAAA,CAC7B;AAAA,EAAA;AAGW,gBAAA,GAAG,SAAS,gBAAgB;AAC5B,gBAAA,GAAG,UAAU,gBAAgB;AAC7C;;"}
|
package/dist/cjs/watch.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function watch():
|
|
1
|
+
export declare function watch(): void;
|
package/dist/esm/index.js
CHANGED
|
@@ -5,12 +5,12 @@ import { watch } from "./watch.js";
|
|
|
5
5
|
main();
|
|
6
6
|
function main() {
|
|
7
7
|
yargs.scriptName("tsr").usage("$0 <cmd> [args]").command("generate", "Generate the routes for a project", async () => {
|
|
8
|
-
const config =
|
|
8
|
+
const config = getConfig();
|
|
9
9
|
await generate(config);
|
|
10
10
|
}).command(
|
|
11
11
|
"watch",
|
|
12
12
|
"Continuously watch and generate the routes for a project",
|
|
13
|
-
|
|
13
|
+
() => {
|
|
14
14
|
watch();
|
|
15
15
|
}
|
|
16
16
|
).help().argv;
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import * as yargs from 'yargs'\nimport { getConfig } from '@tanstack/router-generator'\nimport { generate } from './generate'\nimport { watch } from './watch'\n\nmain()\n\nexport function main() {\n yargs\n // @ts-expect-error\n .scriptName('tsr')\n .usage('$0 <cmd> [args]')\n .command('generate', 'Generate the routes for a project', async () => {\n const config =
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import * as yargs from 'yargs'\nimport { getConfig } from '@tanstack/router-generator'\nimport { generate } from './generate'\nimport { watch } from './watch'\n\nmain()\n\nexport function main() {\n yargs\n // @ts-expect-error\n .scriptName('tsr')\n .usage('$0 <cmd> [args]')\n .command('generate', 'Generate the routes for a project', async () => {\n const config = getConfig()\n await generate(config)\n })\n .command(\n 'watch',\n 'Continuously watch and generate the routes for a project',\n () => {\n watch()\n },\n )\n .help().argv\n}\n"],"names":[],"mappings":";;;;AAKA;AAEO,SAAS,OAAO;AAGlB,QAAA,WAAW,KAAK,EAChB,MAAM,iBAAiB,EACvB,QAAQ,YAAY,qCAAqC,YAAY;AACpE,UAAM,SAAS;AACf,UAAM,SAAS,MAAM;AAAA,EACtB,CAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,IACA,MAAM;AACE;IACR;AAAA,EAAA,EAED,KAAO,EAAA;AACZ;"}
|
package/dist/esm/watch.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function watch():
|
|
1
|
+
export declare function watch(): void;
|
package/dist/esm/watch.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import chokidar from "chokidar";
|
|
3
3
|
import { getConfig, generator } from "@tanstack/router-generator";
|
|
4
|
-
|
|
4
|
+
function watch() {
|
|
5
5
|
const configWatcher = chokidar.watch(
|
|
6
6
|
path.resolve(process.cwd(), "tsr.config.json")
|
|
7
7
|
);
|
|
8
8
|
let watcher = new chokidar.FSWatcher({});
|
|
9
|
-
const generatorWatcher =
|
|
10
|
-
const config =
|
|
9
|
+
const generatorWatcher = () => {
|
|
10
|
+
const config = getConfig();
|
|
11
11
|
watcher.close();
|
|
12
12
|
console.info(`TSR: Watching routes (${config.routesDirectory})...`);
|
|
13
13
|
watcher = chokidar.watch(config.routesDirectory);
|
package/dist/esm/watch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.js","sources":["../../src/watch.ts"],"sourcesContent":["import path from 'node:path'\nimport chokidar from 'chokidar'\nimport { generator, getConfig } from '@tanstack/router-generator'\n\nexport
|
|
1
|
+
{"version":3,"file":"watch.js","sources":["../../src/watch.ts"],"sourcesContent":["import path from 'node:path'\nimport chokidar from 'chokidar'\nimport { generator, getConfig } from '@tanstack/router-generator'\n\nexport function watch() {\n const configWatcher = chokidar.watch(\n path.resolve(process.cwd(), 'tsr.config.json'),\n )\n\n let watcher = new chokidar.FSWatcher({})\n\n const generatorWatcher = () => {\n const config = getConfig()\n\n watcher.close()\n\n console.info(`TSR: Watching routes (${config.routesDirectory})...`)\n watcher = chokidar.watch(config.routesDirectory)\n\n watcher.on('ready', async () => {\n const handle = async () => {\n try {\n await generator(config)\n } catch (err) {\n console.error(err)\n console.info()\n }\n }\n\n await handle()\n\n let timeout: ReturnType<typeof setTimeout> | undefined\n\n const deduped = (file: string) => {\n if (timeout) {\n clearTimeout(timeout)\n }\n\n timeout = setTimeout(handle, 10)\n }\n\n watcher.on('change', deduped)\n watcher.on('add', deduped)\n watcher.on('unlink', deduped)\n })\n }\n\n configWatcher.on('ready', generatorWatcher)\n configWatcher.on('change', generatorWatcher)\n}\n"],"names":[],"mappings":";;;AAIO,SAAS,QAAQ;AACtB,QAAM,gBAAgB,SAAS;AAAA,IAC7B,KAAK,QAAQ,QAAQ,IAAA,GAAO,iBAAiB;AAAA,EAAA;AAG/C,MAAI,UAAU,IAAI,SAAS,UAAU,CAAE,CAAA;AAEvC,QAAM,mBAAmB,MAAM;AAC7B,UAAM,SAAS;AAEf,YAAQ,MAAM;AAEd,YAAQ,KAAK,yBAAyB,OAAO,eAAe,MAAM;AACxD,cAAA,SAAS,MAAM,OAAO,eAAe;AAEvC,YAAA,GAAG,SAAS,YAAY;AAC9B,YAAM,SAAS,YAAY;AACrB,YAAA;AACF,gBAAM,UAAU,MAAM;AAAA,iBACf,KAAK;AACZ,kBAAQ,MAAM,GAAG;AACjB,kBAAQ,KAAK;AAAA,QACf;AAAA,MAAA;AAGF,YAAM,OAAO;AAET,UAAA;AAEE,YAAA,UAAU,CAAC,SAAiB;AAChC,YAAI,SAAS;AACX,uBAAa,OAAO;AAAA,QACtB;AAEU,kBAAA,WAAW,QAAQ,EAAE;AAAA,MAAA;AAGzB,cAAA,GAAG,UAAU,OAAO;AACpB,cAAA,GAAG,OAAO,OAAO;AACjB,cAAA,GAAG,UAAU,OAAO;AAAA,IAAA,CAC7B;AAAA,EAAA;AAGW,gBAAA,GAAG,SAAS,gBAAgB;AAC5B,gBAAA,GAAG,UAAU,gBAAgB;AAC7C;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/router-cli",
|
|
3
|
-
"version": "1.45.
|
|
3
|
+
"version": "1.45.7",
|
|
4
4
|
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"chokidar": "^3.6.0",
|
|
56
56
|
"yargs": "^17.7.2",
|
|
57
|
-
"@tanstack/router-generator": "1.45.
|
|
57
|
+
"@tanstack/router-generator": "1.45.7"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/yargs": "^17.0.32",
|
package/src/index.ts
CHANGED
|
@@ -11,13 +11,13 @@ export function main() {
|
|
|
11
11
|
.scriptName('tsr')
|
|
12
12
|
.usage('$0 <cmd> [args]')
|
|
13
13
|
.command('generate', 'Generate the routes for a project', async () => {
|
|
14
|
-
const config =
|
|
14
|
+
const config = getConfig()
|
|
15
15
|
await generate(config)
|
|
16
16
|
})
|
|
17
17
|
.command(
|
|
18
18
|
'watch',
|
|
19
19
|
'Continuously watch and generate the routes for a project',
|
|
20
|
-
|
|
20
|
+
() => {
|
|
21
21
|
watch()
|
|
22
22
|
},
|
|
23
23
|
)
|
package/src/watch.ts
CHANGED
|
@@ -2,15 +2,15 @@ import path from 'node:path'
|
|
|
2
2
|
import chokidar from 'chokidar'
|
|
3
3
|
import { generator, getConfig } from '@tanstack/router-generator'
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export function watch() {
|
|
6
6
|
const configWatcher = chokidar.watch(
|
|
7
7
|
path.resolve(process.cwd(), 'tsr.config.json'),
|
|
8
8
|
)
|
|
9
9
|
|
|
10
10
|
let watcher = new chokidar.FSWatcher({})
|
|
11
11
|
|
|
12
|
-
const generatorWatcher =
|
|
13
|
-
const config =
|
|
12
|
+
const generatorWatcher = () => {
|
|
13
|
+
const config = getConfig()
|
|
14
14
|
|
|
15
15
|
watcher.close()
|
|
16
16
|
|