@tanstack/router-cli 1.121.19 → 1.121.21
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/generate.cjs +18 -0
- package/dist/cjs/generate.cjs.map +1 -0
- package/dist/cjs/generate.d.cts +2 -0
- package/dist/cjs/index.cjs +38 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.cts +1 -0
- package/dist/cjs/watch.cjs +51 -0
- package/dist/cjs/watch.cjs.map +1 -0
- package/dist/cjs/watch.d.cts +1 -0
- package/dist/esm/generate.d.ts +2 -0
- package/dist/esm/generate.js +18 -0
- package/dist/esm/generate.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +21 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/watch.d.ts +1 -0
- package/dist/esm/watch.js +51 -0
- package/dist/esm/watch.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const routerGenerator = require("@tanstack/router-generator");
|
|
4
|
+
async function generate(config, root) {
|
|
5
|
+
try {
|
|
6
|
+
const generator = new routerGenerator.Generator({
|
|
7
|
+
config,
|
|
8
|
+
root
|
|
9
|
+
});
|
|
10
|
+
await generator.run();
|
|
11
|
+
process.exit(0);
|
|
12
|
+
} catch (err) {
|
|
13
|
+
console.error(err);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.generate = generate;
|
|
18
|
+
//# sourceMappingURL=generate.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.cjs","sources":["../../src/generate.ts"],"sourcesContent":["import { Generator } from '@tanstack/router-generator'\nimport type { Config } from '@tanstack/router-generator'\n\nexport async function generate(config: Config, root: string) {\n try {\n const generator = new Generator({\n config,\n root,\n })\n await generator.run()\n process.exit(0)\n } catch (err) {\n console.error(err)\n process.exit(1)\n }\n}\n"],"names":["Generator"],"mappings":";;;AAGsB,eAAA,SAAS,QAAgB,MAAc;AACvD,MAAA;AACI,UAAA,YAAY,IAAIA,0BAAU;AAAA,MAC9B;AAAA,MACA;AAAA,IAAA,CACD;AACD,UAAM,UAAU,IAAI;AACpB,YAAQ,KAAK,CAAC;AAAA,WACP,KAAK;AACZ,YAAQ,MAAM,GAAG;AACjB,YAAQ,KAAK,CAAC;AAAA,EAAA;AAElB;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const yargs = require("yargs");
|
|
4
|
+
const routerGenerator = require("@tanstack/router-generator");
|
|
5
|
+
const generate = require("./generate.cjs");
|
|
6
|
+
const watch = require("./watch.cjs");
|
|
7
|
+
function _interopNamespaceDefault(e) {
|
|
8
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
9
|
+
if (e) {
|
|
10
|
+
for (const k in e) {
|
|
11
|
+
if (k !== "default") {
|
|
12
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: () => e[k]
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
|
+
}
|
|
23
|
+
const yargs__namespace = /* @__PURE__ */ _interopNamespaceDefault(yargs);
|
|
24
|
+
main();
|
|
25
|
+
function main() {
|
|
26
|
+
yargs__namespace.scriptName("tsr").usage("$0 <cmd> [args]").command("generate", "Generate the routes for a project", async () => {
|
|
27
|
+
const config = routerGenerator.getConfig();
|
|
28
|
+
await generate.generate(config, process.cwd());
|
|
29
|
+
}).command(
|
|
30
|
+
"watch",
|
|
31
|
+
"Continuously watch and generate the routes for a project",
|
|
32
|
+
() => {
|
|
33
|
+
watch.watch(process.cwd());
|
|
34
|
+
}
|
|
35
|
+
).help().argv;
|
|
36
|
+
}
|
|
37
|
+
exports.main = main;
|
|
38
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +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 = getConfig()\n await generate(config, process.cwd())\n })\n .command(\n 'watch',\n 'Continuously watch and generate the routes for a project',\n () => {\n watch(process.cwd())\n },\n )\n .help().argv\n}\n"],"names":["yargs","getConfig","generate","watch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKA,KAAK;AAEE,SAAS,OAAO;AAGlBA,mBAAA,WAAW,KAAK,EAChB,MAAM,iBAAiB,EACvB,QAAQ,YAAY,qCAAqC,YAAY;AACpE,UAAM,SAASC,gBAAAA,UAAU;AACzB,UAAMC,kBAAS,QAAQ,QAAQ,IAAA,CAAK;AAAA,EACrC,CAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,IACA,MAAM;AACEC,kBAAA,QAAQ,KAAK;AAAA,IAAA;AAAA,EACrB,EAED,KAAO,EAAA;AACZ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function main(): void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const chokidar = require("chokidar");
|
|
4
|
+
const routerGenerator = require("@tanstack/router-generator");
|
|
5
|
+
function watch(root) {
|
|
6
|
+
const configPath = routerGenerator.resolveConfigPath({
|
|
7
|
+
configDirectory: root
|
|
8
|
+
});
|
|
9
|
+
const configWatcher = chokidar.watch(configPath);
|
|
10
|
+
let watcher = new chokidar.FSWatcher({});
|
|
11
|
+
const generatorWatcher = () => {
|
|
12
|
+
const config = routerGenerator.getConfig();
|
|
13
|
+
const generator = new routerGenerator.Generator({ config, root });
|
|
14
|
+
watcher.close();
|
|
15
|
+
console.info(`TSR: Watching routes (${config.routesDirectory})...`);
|
|
16
|
+
watcher = chokidar.watch(config.routesDirectory);
|
|
17
|
+
watcher.on("ready", async () => {
|
|
18
|
+
const handle = async () => {
|
|
19
|
+
try {
|
|
20
|
+
await generator.run();
|
|
21
|
+
} catch (err) {
|
|
22
|
+
console.error(err);
|
|
23
|
+
console.info();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
await handle();
|
|
27
|
+
watcher.on("all", (event, path) => {
|
|
28
|
+
let type;
|
|
29
|
+
switch (event) {
|
|
30
|
+
case "add":
|
|
31
|
+
type = "create";
|
|
32
|
+
break;
|
|
33
|
+
case "change":
|
|
34
|
+
type = "update";
|
|
35
|
+
break;
|
|
36
|
+
case "unlink":
|
|
37
|
+
type = "delete";
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
if (type) {
|
|
41
|
+
return generator.run({ path, type });
|
|
42
|
+
}
|
|
43
|
+
return generator.run();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
configWatcher.on("ready", generatorWatcher);
|
|
48
|
+
configWatcher.on("change", generatorWatcher);
|
|
49
|
+
}
|
|
50
|
+
exports.watch = watch;
|
|
51
|
+
//# sourceMappingURL=watch.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.cjs","sources":["../../src/watch.ts"],"sourcesContent":["import chokidar from 'chokidar'\nimport {\n Generator,\n getConfig,\n resolveConfigPath,\n} from '@tanstack/router-generator'\nimport type { FileEventType } from '@tanstack/router-generator'\n\nexport function watch(root: string) {\n const configPath = resolveConfigPath({\n configDirectory: root,\n })\n const configWatcher = chokidar.watch(configPath)\n\n let watcher = new chokidar.FSWatcher({})\n\n const generatorWatcher = () => {\n const config = getConfig()\n const generator = new Generator({ config, root })\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.run()\n } catch (err) {\n console.error(err)\n console.info()\n }\n }\n\n await handle()\n\n watcher.on('all', (event, path) => {\n let type: FileEventType | undefined\n switch (event) {\n case 'add':\n type = 'create'\n break\n case 'change':\n type = 'update'\n break\n case 'unlink':\n type = 'delete'\n break\n }\n if (type) {\n return generator.run({ path, type })\n }\n return generator.run()\n })\n })\n }\n\n configWatcher.on('ready', generatorWatcher)\n configWatcher.on('change', generatorWatcher)\n}\n"],"names":["resolveConfigPath","getConfig","Generator"],"mappings":";;;;AAQO,SAAS,MAAM,MAAc;AAClC,QAAM,aAAaA,gBAAAA,kBAAkB;AAAA,IACnC,iBAAiB;AAAA,EAAA,CAClB;AACK,QAAA,gBAAgB,SAAS,MAAM,UAAU;AAE/C,MAAI,UAAU,IAAI,SAAS,UAAU,CAAA,CAAE;AAEvC,QAAM,mBAAmB,MAAM;AAC7B,UAAM,SAASC,gBAAAA,UAAU;AACzB,UAAM,YAAY,IAAIC,gBAAAA,UAAU,EAAE,QAAQ,MAAM;AAEhD,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,IAAI;AAAA,iBACb,KAAK;AACZ,kBAAQ,MAAM,GAAG;AACjB,kBAAQ,KAAK;AAAA,QAAA;AAAA,MAEjB;AAEA,YAAM,OAAO;AAEb,cAAQ,GAAG,OAAO,CAAC,OAAO,SAAS;AAC7B,YAAA;AACJ,gBAAQ,OAAO;AAAA,UACb,KAAK;AACI,mBAAA;AACP;AAAA,UACF,KAAK;AACI,mBAAA;AACP;AAAA,UACF,KAAK;AACI,mBAAA;AACP;AAAA,QAAA;AAEJ,YAAI,MAAM;AACR,iBAAO,UAAU,IAAI,EAAE,MAAM,MAAM;AAAA,QAAA;AAErC,eAAO,UAAU,IAAI;AAAA,MAAA,CACtB;AAAA,IAAA,CACF;AAAA,EACH;AAEc,gBAAA,GAAG,SAAS,gBAAgB;AAC5B,gBAAA,GAAG,UAAU,gBAAgB;AAC7C;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function watch(root: string): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Generator } from "@tanstack/router-generator";
|
|
2
|
+
async function generate(config, root) {
|
|
3
|
+
try {
|
|
4
|
+
const generator = new Generator({
|
|
5
|
+
config,
|
|
6
|
+
root
|
|
7
|
+
});
|
|
8
|
+
await generator.run();
|
|
9
|
+
process.exit(0);
|
|
10
|
+
} catch (err) {
|
|
11
|
+
console.error(err);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
generate
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sources":["../../src/generate.ts"],"sourcesContent":["import { Generator } from '@tanstack/router-generator'\nimport type { Config } from '@tanstack/router-generator'\n\nexport async function generate(config: Config, root: string) {\n try {\n const generator = new Generator({\n config,\n root,\n })\n await generator.run()\n process.exit(0)\n } catch (err) {\n console.error(err)\n process.exit(1)\n }\n}\n"],"names":[],"mappings":";AAGsB,eAAA,SAAS,QAAgB,MAAc;AACvD,MAAA;AACI,UAAA,YAAY,IAAI,UAAU;AAAA,MAC9B;AAAA,MACA;AAAA,IAAA,CACD;AACD,UAAM,UAAU,IAAI;AACpB,YAAQ,KAAK,CAAC;AAAA,WACP,KAAK;AACZ,YAAQ,MAAM,GAAG;AACjB,YAAQ,KAAK,CAAC;AAAA,EAAA;AAElB;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function main(): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as yargs from "yargs";
|
|
2
|
+
import { getConfig } from "@tanstack/router-generator";
|
|
3
|
+
import { generate } from "./generate.js";
|
|
4
|
+
import { watch } from "./watch.js";
|
|
5
|
+
main();
|
|
6
|
+
function main() {
|
|
7
|
+
yargs.scriptName("tsr").usage("$0 <cmd> [args]").command("generate", "Generate the routes for a project", async () => {
|
|
8
|
+
const config = getConfig();
|
|
9
|
+
await generate(config, process.cwd());
|
|
10
|
+
}).command(
|
|
11
|
+
"watch",
|
|
12
|
+
"Continuously watch and generate the routes for a project",
|
|
13
|
+
() => {
|
|
14
|
+
watch(process.cwd());
|
|
15
|
+
}
|
|
16
|
+
).help().argv;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
main
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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 = getConfig()\n await generate(config, process.cwd())\n })\n .command(\n 'watch',\n 'Continuously watch and generate the routes for a project',\n () => {\n watch(process.cwd())\n },\n )\n .help().argv\n}\n"],"names":[],"mappings":";;;;AAKA,KAAK;AAEE,SAAS,OAAO;AAGlB,QAAA,WAAW,KAAK,EAChB,MAAM,iBAAiB,EACvB,QAAQ,YAAY,qCAAqC,YAAY;AACpE,UAAM,SAAS,UAAU;AACzB,UAAM,SAAS,QAAQ,QAAQ,IAAA,CAAK;AAAA,EACrC,CAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,IACA,MAAM;AACE,YAAA,QAAQ,KAAK;AAAA,IAAA;AAAA,EACrB,EAED,KAAO,EAAA;AACZ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function watch(root: string): void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import chokidar from "chokidar";
|
|
2
|
+
import { resolveConfigPath, getConfig, Generator } from "@tanstack/router-generator";
|
|
3
|
+
function watch(root) {
|
|
4
|
+
const configPath = resolveConfigPath({
|
|
5
|
+
configDirectory: root
|
|
6
|
+
});
|
|
7
|
+
const configWatcher = chokidar.watch(configPath);
|
|
8
|
+
let watcher = new chokidar.FSWatcher({});
|
|
9
|
+
const generatorWatcher = () => {
|
|
10
|
+
const config = getConfig();
|
|
11
|
+
const generator = new Generator({ config, root });
|
|
12
|
+
watcher.close();
|
|
13
|
+
console.info(`TSR: Watching routes (${config.routesDirectory})...`);
|
|
14
|
+
watcher = chokidar.watch(config.routesDirectory);
|
|
15
|
+
watcher.on("ready", async () => {
|
|
16
|
+
const handle = async () => {
|
|
17
|
+
try {
|
|
18
|
+
await generator.run();
|
|
19
|
+
} catch (err) {
|
|
20
|
+
console.error(err);
|
|
21
|
+
console.info();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
await handle();
|
|
25
|
+
watcher.on("all", (event, path) => {
|
|
26
|
+
let type;
|
|
27
|
+
switch (event) {
|
|
28
|
+
case "add":
|
|
29
|
+
type = "create";
|
|
30
|
+
break;
|
|
31
|
+
case "change":
|
|
32
|
+
type = "update";
|
|
33
|
+
break;
|
|
34
|
+
case "unlink":
|
|
35
|
+
type = "delete";
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
if (type) {
|
|
39
|
+
return generator.run({ path, type });
|
|
40
|
+
}
|
|
41
|
+
return generator.run();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
configWatcher.on("ready", generatorWatcher);
|
|
46
|
+
configWatcher.on("change", generatorWatcher);
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
watch
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.js","sources":["../../src/watch.ts"],"sourcesContent":["import chokidar from 'chokidar'\nimport {\n Generator,\n getConfig,\n resolveConfigPath,\n} from '@tanstack/router-generator'\nimport type { FileEventType } from '@tanstack/router-generator'\n\nexport function watch(root: string) {\n const configPath = resolveConfigPath({\n configDirectory: root,\n })\n const configWatcher = chokidar.watch(configPath)\n\n let watcher = new chokidar.FSWatcher({})\n\n const generatorWatcher = () => {\n const config = getConfig()\n const generator = new Generator({ config, root })\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.run()\n } catch (err) {\n console.error(err)\n console.info()\n }\n }\n\n await handle()\n\n watcher.on('all', (event, path) => {\n let type: FileEventType | undefined\n switch (event) {\n case 'add':\n type = 'create'\n break\n case 'change':\n type = 'update'\n break\n case 'unlink':\n type = 'delete'\n break\n }\n if (type) {\n return generator.run({ path, type })\n }\n return generator.run()\n })\n })\n }\n\n configWatcher.on('ready', generatorWatcher)\n configWatcher.on('change', generatorWatcher)\n}\n"],"names":[],"mappings":";;AAQO,SAAS,MAAM,MAAc;AAClC,QAAM,aAAa,kBAAkB;AAAA,IACnC,iBAAiB;AAAA,EAAA,CAClB;AACK,QAAA,gBAAgB,SAAS,MAAM,UAAU;AAE/C,MAAI,UAAU,IAAI,SAAS,UAAU,CAAA,CAAE;AAEvC,QAAM,mBAAmB,MAAM;AAC7B,UAAM,SAAS,UAAU;AACzB,UAAM,YAAY,IAAI,UAAU,EAAE,QAAQ,MAAM;AAEhD,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,IAAI;AAAA,iBACb,KAAK;AACZ,kBAAQ,MAAM,GAAG;AACjB,kBAAQ,KAAK;AAAA,QAAA;AAAA,MAEjB;AAEA,YAAM,OAAO;AAEb,cAAQ,GAAG,OAAO,CAAC,OAAO,SAAS;AAC7B,YAAA;AACJ,gBAAQ,OAAO;AAAA,UACb,KAAK;AACI,mBAAA;AACP;AAAA,UACF,KAAK;AACI,mBAAA;AACP;AAAA,UACF,KAAK;AACI,mBAAA;AACP;AAAA,QAAA;AAEJ,YAAI,MAAM;AACR,iBAAO,UAAU,IAAI,EAAE,MAAM,MAAM;AAAA,QAAA;AAErC,eAAO,UAAU,IAAI;AAAA,MAAA,CACtB;AAAA,IAAA,CACF;AAAA,EACH;AAEc,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.121.
|
|
3
|
+
"version": "1.121.21",
|
|
4
4
|
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"chokidar": "^3.6.0",
|
|
57
57
|
"yargs": "^17.7.2",
|
|
58
|
-
"@tanstack/router-generator": "^1.121.
|
|
58
|
+
"@tanstack/router-generator": "^1.121.21"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/yargs": "^17.0.33"
|