@tanstack/router-cli 1.7.1 → 1.8.2
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/bin/tsr.cjs +3 -0
- package/dist/cjs/generate.cjs +14 -0
- package/dist/cjs/generate.cjs.map +1 -0
- package/dist/cjs/index.cjs +38 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/watch.cjs +42 -0
- package/dist/cjs/watch.cjs.map +1 -0
- package/dist/esm/generate.d.ts +2 -0
- package/dist/esm/generate.js +14 -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 +42 -0
- package/dist/esm/watch.js.map +1 -0
- package/package.json +36 -20
- package/src/index.ts +3 -2
- package/bin/tsr.js +0 -3
- package/build/cjs/generate.js +0 -26
- package/build/cjs/generate.js.map +0 -1
- package/build/cjs/index.js +0 -48
- package/build/cjs/index.js.map +0 -1
- package/build/cjs/watch.js +0 -52
- package/build/cjs/watch.js.map +0 -1
- /package/{build/types/generate.d.ts → dist/cjs/generate.d.cts} +0 -0
- /package/{build/types/index.d.ts → dist/cjs/index.d.cts} +0 -0
- /package/{build/types/watch.d.ts → dist/cjs/watch.d.cts} +0 -0
package/bin/tsr.cjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const routerGenerator = require("@tanstack/router-generator");
|
|
4
|
+
async function generate(config) {
|
|
5
|
+
try {
|
|
6
|
+
await routerGenerator.generator(config);
|
|
7
|
+
process.exit(0);
|
|
8
|
+
} catch (err) {
|
|
9
|
+
console.error(err);
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.generate = generate;
|
|
14
|
+
//# sourceMappingURL=generate.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.cjs","sources":["../../src/generate.ts"],"sourcesContent":["import { Config, generator } from '@tanstack/router-generator'\n\nexport async function generate(config: Config) {\n try {\n await generator(config)\n process.exit(0)\n } catch (err) {\n console.error(err)\n process.exit(1)\n }\n}\n"],"names":["generator"],"mappings":";;;AAEA,eAAsB,SAAS,QAAgB;AACzC,MAAA;AACF,UAAMA,gBAAAA,UAAU,MAAM;AACtB,YAAQ,KAAK,CAAC;AAAA,WACP,KAAK;AACZ,YAAQ,MAAM,GAAG;AACjB,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;;"}
|
|
@@ -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 = await routerGenerator.getConfig();
|
|
28
|
+
await generate.generate(config);
|
|
29
|
+
}).command(
|
|
30
|
+
"watch",
|
|
31
|
+
"Continuously watch and generate the routes for a project",
|
|
32
|
+
async () => {
|
|
33
|
+
watch.watch();
|
|
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 = await getConfig()\n await generate(config)\n })\n .command(\n 'watch',\n 'Continuously watch and generate the routes for a project',\n async () => {\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;AAC9D,UAAA,SAAS,MAAMC,gBAAAA;AACrB,UAAMC,SAAAA,SAAS,MAAM;AAAA,EACtB,CAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,IACA,YAAY;AACJC,YAAAA;IACR;AAAA,EAAA,EAED,KAAO,EAAA;AACZ;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const chokidar = require("chokidar");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const routerGenerator = require("@tanstack/router-generator");
|
|
6
|
+
async function watch() {
|
|
7
|
+
const configWatcher = chokidar.watch(
|
|
8
|
+
path.resolve(process.cwd(), "tsr.config.json")
|
|
9
|
+
);
|
|
10
|
+
let watcher = new chokidar.FSWatcher({});
|
|
11
|
+
const generatorWatcher = async () => {
|
|
12
|
+
const config = await routerGenerator.getConfig();
|
|
13
|
+
watcher.close();
|
|
14
|
+
console.info(`TSR: Watching routes (${config.routesDirectory})...`);
|
|
15
|
+
watcher = chokidar.watch(config.routesDirectory);
|
|
16
|
+
watcher.on("ready", async () => {
|
|
17
|
+
const handle = async () => {
|
|
18
|
+
try {
|
|
19
|
+
await routerGenerator.generator(config);
|
|
20
|
+
} catch (err) {
|
|
21
|
+
console.error(err);
|
|
22
|
+
console.info();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
await handle();
|
|
26
|
+
let timeout;
|
|
27
|
+
const deduped = (file) => {
|
|
28
|
+
if (timeout) {
|
|
29
|
+
clearTimeout(timeout);
|
|
30
|
+
}
|
|
31
|
+
timeout = setTimeout(handle, 10);
|
|
32
|
+
};
|
|
33
|
+
watcher.on("change", deduped);
|
|
34
|
+
watcher.on("add", deduped);
|
|
35
|
+
watcher.on("unlink", deduped);
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
configWatcher.on("ready", generatorWatcher);
|
|
39
|
+
configWatcher.on("change", generatorWatcher);
|
|
40
|
+
}
|
|
41
|
+
exports.watch = watch;
|
|
42
|
+
//# sourceMappingURL=watch.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.cjs","sources":["../../src/watch.ts"],"sourcesContent":["import chokidar from 'chokidar'\nimport path from 'path'\nimport { getConfig, generator } from '@tanstack/router-generator'\n\nexport async 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 = async () => {\n const config = await 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>\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":";;;;;AAIA,eAAsB,QAAQ;AAC5B,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,YAAY;AAC7B,UAAA,SAAS,MAAMA,gBAAAA;AAErB,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;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { generator } from "@tanstack/router-generator";
|
|
2
|
+
async function generate(config) {
|
|
3
|
+
try {
|
|
4
|
+
await generator(config);
|
|
5
|
+
process.exit(0);
|
|
6
|
+
} catch (err) {
|
|
7
|
+
console.error(err);
|
|
8
|
+
process.exit(1);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
generate
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sources":["../../src/generate.ts"],"sourcesContent":["import { Config, generator } from '@tanstack/router-generator'\n\nexport async function generate(config: Config) {\n try {\n await generator(config)\n process.exit(0)\n } catch (err) {\n console.error(err)\n process.exit(1)\n }\n}\n"],"names":[],"mappings":";AAEA,eAAsB,SAAS,QAAgB;AACzC,MAAA;AACF,UAAM,UAAU,MAAM;AACtB,YAAQ,KAAK,CAAC;AAAA,WACP,KAAK;AACZ,YAAQ,MAAM,GAAG;AACjB,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;"}
|
|
@@ -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 = await getConfig();
|
|
9
|
+
await generate(config);
|
|
10
|
+
}).command(
|
|
11
|
+
"watch",
|
|
12
|
+
"Continuously watch and generate the routes for a project",
|
|
13
|
+
async () => {
|
|
14
|
+
watch();
|
|
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 = await getConfig()\n await generate(config)\n })\n .command(\n 'watch',\n 'Continuously watch and generate the routes for a project',\n async () => {\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;AAC9D,UAAA,SAAS,MAAM;AACrB,UAAM,SAAS,MAAM;AAAA,EACtB,CAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,IACA,YAAY;AACJ;IACR;AAAA,EAAA,EAED,KAAO,EAAA;AACZ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function watch(): Promise<void>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import chokidar from "chokidar";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { getConfig, generator } from "@tanstack/router-generator";
|
|
4
|
+
async function watch() {
|
|
5
|
+
const configWatcher = chokidar.watch(
|
|
6
|
+
path.resolve(process.cwd(), "tsr.config.json")
|
|
7
|
+
);
|
|
8
|
+
let watcher = new chokidar.FSWatcher({});
|
|
9
|
+
const generatorWatcher = async () => {
|
|
10
|
+
const config = await getConfig();
|
|
11
|
+
watcher.close();
|
|
12
|
+
console.info(`TSR: Watching routes (${config.routesDirectory})...`);
|
|
13
|
+
watcher = chokidar.watch(config.routesDirectory);
|
|
14
|
+
watcher.on("ready", async () => {
|
|
15
|
+
const handle = async () => {
|
|
16
|
+
try {
|
|
17
|
+
await generator(config);
|
|
18
|
+
} catch (err) {
|
|
19
|
+
console.error(err);
|
|
20
|
+
console.info();
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
await handle();
|
|
24
|
+
let timeout;
|
|
25
|
+
const deduped = (file) => {
|
|
26
|
+
if (timeout) {
|
|
27
|
+
clearTimeout(timeout);
|
|
28
|
+
}
|
|
29
|
+
timeout = setTimeout(handle, 10);
|
|
30
|
+
};
|
|
31
|
+
watcher.on("change", deduped);
|
|
32
|
+
watcher.on("add", deduped);
|
|
33
|
+
watcher.on("unlink", deduped);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
configWatcher.on("ready", generatorWatcher);
|
|
37
|
+
configWatcher.on("change", generatorWatcher);
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
watch
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.js","sources":["../../src/watch.ts"],"sourcesContent":["import chokidar from 'chokidar'\nimport path from 'path'\nimport { getConfig, generator } from '@tanstack/router-generator'\n\nexport async 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 = async () => {\n const config = await 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>\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":";;;AAIA,eAAsB,QAAQ;AAC5B,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,YAAY;AAC7B,UAAA,SAAS,MAAM;AAErB,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,14 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/router-cli",
|
|
3
|
+
"version": "1.8.2",
|
|
4
|
+
"description": "",
|
|
3
5
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "1.7.1",
|
|
5
6
|
"license": "MIT",
|
|
6
|
-
"repository":
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/TanStack/router.git",
|
|
10
|
+
"directory": "packages/router-cli"
|
|
11
|
+
},
|
|
7
12
|
"homepage": "https://tanstack.com/router",
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"
|
|
13
|
+
"funding": {
|
|
14
|
+
"type": "github",
|
|
15
|
+
"url": "https://github.com/sponsors/tannerlinsley"
|
|
16
|
+
},
|
|
17
|
+
"bin": {
|
|
18
|
+
"tsr": "bin/tsr.cjs"
|
|
19
|
+
},
|
|
20
|
+
"type": "module",
|
|
21
|
+
"main": "dist/cjs/index.cjs",
|
|
22
|
+
"module": "dist/esm/index.js",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"import": {
|
|
26
|
+
"types": "./dist/esm/index.d.ts",
|
|
27
|
+
"default": "./dist/esm/index.js"
|
|
28
|
+
},
|
|
29
|
+
"require": {
|
|
30
|
+
"types": "./dist/cjs/index.d.cts",
|
|
31
|
+
"default": "./dist/cjs/index.cjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"./package.json": "./package.json"
|
|
11
35
|
},
|
|
36
|
+
"sideEffects": false,
|
|
12
37
|
"keywords": [
|
|
13
38
|
"react",
|
|
14
39
|
"location",
|
|
@@ -18,35 +43,26 @@
|
|
|
18
43
|
"async router",
|
|
19
44
|
"typescript"
|
|
20
45
|
],
|
|
21
|
-
"funding": {
|
|
22
|
-
"type": "github",
|
|
23
|
-
"url": "https://github.com/sponsors/tannerlinsley"
|
|
24
|
-
},
|
|
25
|
-
"type": "commonjs",
|
|
26
|
-
"bin": {
|
|
27
|
-
"tsr": "bin/tsr.js"
|
|
28
|
-
},
|
|
29
46
|
"engines": {
|
|
30
47
|
"node": ">=12"
|
|
31
48
|
},
|
|
32
49
|
"files": [
|
|
33
|
-
"
|
|
50
|
+
"dist",
|
|
34
51
|
"src/**",
|
|
35
52
|
"bin/**"
|
|
36
53
|
],
|
|
37
|
-
"sideEffects": false,
|
|
38
|
-
"module": "bin/tsr.js",
|
|
39
|
-
"main": "bin/tsr.js",
|
|
40
|
-
"browser": "bin/tsr.js",
|
|
41
54
|
"dependencies": {
|
|
42
55
|
"chokidar": "^3.5.3",
|
|
43
56
|
"yargs": "^17.6.2",
|
|
44
|
-
"@tanstack/router-generator": "1.
|
|
57
|
+
"@tanstack/router-generator": "1.8.2"
|
|
45
58
|
},
|
|
46
59
|
"devDependencies": {
|
|
47
60
|
"@types/yargs": "^17.0.15"
|
|
48
61
|
},
|
|
49
62
|
"scripts": {
|
|
50
|
-
"
|
|
63
|
+
"clean": "rimraf ./dist && rimraf ./coverage",
|
|
64
|
+
"test:types": "tsc",
|
|
65
|
+
"test:build": "publint --strict",
|
|
66
|
+
"build": "vite build"
|
|
51
67
|
}
|
|
52
68
|
}
|
package/src/index.ts
CHANGED
|
@@ -7,16 +7,17 @@ main()
|
|
|
7
7
|
|
|
8
8
|
export function main() {
|
|
9
9
|
yargs
|
|
10
|
+
// @ts-expect-error
|
|
10
11
|
.scriptName('tsr')
|
|
11
12
|
.usage('$0 <cmd> [args]')
|
|
12
|
-
.command('generate', 'Generate the routes for a project', async (
|
|
13
|
+
.command('generate', 'Generate the routes for a project', async () => {
|
|
13
14
|
const config = await getConfig()
|
|
14
15
|
await generate(config)
|
|
15
16
|
})
|
|
16
17
|
.command(
|
|
17
18
|
'watch',
|
|
18
19
|
'Continuously watch and generate the routes for a project',
|
|
19
|
-
async (
|
|
20
|
+
async () => {
|
|
20
21
|
watch()
|
|
21
22
|
},
|
|
22
23
|
)
|
package/bin/tsr.js
DELETED
package/build/cjs/generate.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @tanstack/router-cli/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 routerGenerator = require('@tanstack/router-generator');
|
|
14
|
-
|
|
15
|
-
async function generate(config) {
|
|
16
|
-
try {
|
|
17
|
-
await routerGenerator.generator(config);
|
|
18
|
-
process.exit(0);
|
|
19
|
-
} catch (err) {
|
|
20
|
-
console.error(err);
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
exports.generate = generate;
|
|
26
|
-
//# sourceMappingURL=generate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sources":["../../src/generate.ts"],"sourcesContent":["import { Config, generator } from '@tanstack/router-generator'\n\nexport async function generate(config: Config) {\n try {\n await generator(config)\n process.exit(0)\n } catch (err) {\n console.error(err)\n process.exit(1)\n }\n}\n"],"names":["generate","config","generator","process","exit","err","console","error"],"mappings":";;;;;;;;;;;;;;AAEO,eAAeA,QAAQA,CAACC,MAAc,EAAE;EAC7C,IAAI;IACF,MAAMC,yBAAS,CAACD,MAAM,CAAC,CAAA;AACvBE,IAAAA,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC,CAAA;GAChB,CAAC,OAAOC,GAAG,EAAE;AACZC,IAAAA,OAAO,CAACC,KAAK,CAACF,GAAG,CAAC,CAAA;AAClBF,IAAAA,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,GAAA;AACF;;;;"}
|
package/build/cjs/index.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @tanstack/router-cli/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 yargs = require('yargs');
|
|
14
|
-
var routerGenerator = require('@tanstack/router-generator');
|
|
15
|
-
var generate = require('./generate.js');
|
|
16
|
-
var watch = require('./watch.js');
|
|
17
|
-
|
|
18
|
-
function _interopNamespaceDefault(e) {
|
|
19
|
-
var n = Object.create(null);
|
|
20
|
-
if (e) {
|
|
21
|
-
Object.keys(e).forEach(function (k) {
|
|
22
|
-
if (k !== 'default') {
|
|
23
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
24
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () { return e[k]; }
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
n.default = e;
|
|
32
|
-
return Object.freeze(n);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
var yargs__namespace = /*#__PURE__*/_interopNamespaceDefault(yargs);
|
|
36
|
-
|
|
37
|
-
main();
|
|
38
|
-
function main() {
|
|
39
|
-
yargs__namespace.scriptName('tsr').usage('$0 <cmd> [args]').command('generate', 'Generate the routes for a project', async argv => {
|
|
40
|
-
const config = await routerGenerator.getConfig();
|
|
41
|
-
await generate.generate(config);
|
|
42
|
-
}).command('watch', 'Continuously watch and generate the routes for a project', async argv => {
|
|
43
|
-
watch.watch();
|
|
44
|
-
}).help().argv;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
exports.main = main;
|
|
48
|
-
//# sourceMappingURL=index.js.map
|
package/build/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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 .scriptName('tsr')\n .usage('$0 <cmd> [args]')\n .command('generate', 'Generate the routes for a project', async (argv) => {\n const config = await getConfig()\n await generate(config)\n })\n .command(\n 'watch',\n 'Continuously watch and generate the routes for a project',\n async (argv) => {\n watch()\n },\n )\n .help().argv\n}\n"],"names":["main","yargs","scriptName","usage","command","argv","config","getConfig","generate","watch","help"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKAA,IAAI,EAAE,CAAA;AAEC,SAASA,IAAIA,GAAG;AACrBC,EAAAA,gBAAK,CACFC,UAAU,CAAC,KAAK,CAAC,CACjBC,KAAK,CAAC,iBAAiB,CAAC,CACxBC,OAAO,CAAC,UAAU,EAAE,mCAAmC,EAAE,MAAOC,IAAI,IAAK;AACxE,IAAA,MAAMC,MAAM,GAAG,MAAMC,yBAAS,EAAE,CAAA;IAChC,MAAMC,iBAAQ,CAACF,MAAM,CAAC,CAAA;GACvB,CAAC,CACDF,OAAO,CACN,OAAO,EACP,0DAA0D,EAC1D,MAAOC,IAAI,IAAK;AACdI,IAAAA,WAAK,EAAE,CAAA;AACT,GACF,CAAC,CACAC,IAAI,EAAE,CAACL,IAAI,CAAA;AAChB;;;;"}
|
package/build/cjs/watch.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @tanstack/router-cli/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 chokidar = require('chokidar');
|
|
14
|
-
var path = require('path');
|
|
15
|
-
var routerGenerator = require('@tanstack/router-generator');
|
|
16
|
-
|
|
17
|
-
async function watch() {
|
|
18
|
-
const configWatcher = chokidar.watch(path.resolve(process.cwd(), 'tsr.config.json'));
|
|
19
|
-
let watcher = new chokidar.FSWatcher({});
|
|
20
|
-
const generatorWatcher = async () => {
|
|
21
|
-
const config = await routerGenerator.getConfig();
|
|
22
|
-
watcher.close();
|
|
23
|
-
console.info(`TSR: Watching routes (${config.routesDirectory})...`);
|
|
24
|
-
watcher = chokidar.watch(config.routesDirectory);
|
|
25
|
-
watcher.on('ready', async () => {
|
|
26
|
-
const handle = async () => {
|
|
27
|
-
try {
|
|
28
|
-
await routerGenerator.generator(config);
|
|
29
|
-
} catch (err) {
|
|
30
|
-
console.error(err);
|
|
31
|
-
console.info();
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
await handle();
|
|
35
|
-
let timeout;
|
|
36
|
-
const deduped = file => {
|
|
37
|
-
if (timeout) {
|
|
38
|
-
clearTimeout(timeout);
|
|
39
|
-
}
|
|
40
|
-
timeout = setTimeout(handle, 10);
|
|
41
|
-
};
|
|
42
|
-
watcher.on('change', deduped);
|
|
43
|
-
watcher.on('add', deduped);
|
|
44
|
-
watcher.on('unlink', deduped);
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
configWatcher.on('ready', generatorWatcher);
|
|
48
|
-
configWatcher.on('change', generatorWatcher);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
exports.watch = watch;
|
|
52
|
-
//# sourceMappingURL=watch.js.map
|
package/build/cjs/watch.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"watch.js","sources":["../../src/watch.ts"],"sourcesContent":["import chokidar from 'chokidar'\nimport path from 'path'\nimport { getConfig, generator } from '@tanstack/router-generator'\n\nexport async 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 = async () => {\n const config = await 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>\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":["watch","configWatcher","chokidar","path","resolve","process","cwd","watcher","FSWatcher","generatorWatcher","config","getConfig","close","console","info","routesDirectory","on","handle","generator","err","error","timeout","deduped","file","clearTimeout","setTimeout"],"mappings":";;;;;;;;;;;;;;;;AAIO,eAAeA,KAAKA,GAAG;AAC5B,EAAA,MAAMC,aAAa,GAAGC,QAAQ,CAACF,KAAK,CAClCG,IAAI,CAACC,OAAO,CAACC,OAAO,CAACC,GAAG,EAAE,EAAE,iBAAiB,CAC/C,CAAC,CAAA;EAED,IAAIC,OAAO,GAAG,IAAIL,QAAQ,CAACM,SAAS,CAAC,EAAE,CAAC,CAAA;AAExC,EAAA,MAAMC,gBAAgB,GAAG,YAAY;AACnC,IAAA,MAAMC,MAAM,GAAG,MAAMC,yBAAS,EAAE,CAAA;IAEhCJ,OAAO,CAACK,KAAK,EAAE,CAAA;IAEfC,OAAO,CAACC,IAAI,CAAE,CAAA,sBAAA,EAAwBJ,MAAM,CAACK,eAAgB,MAAK,CAAC,CAAA;IACnER,OAAO,GAAGL,QAAQ,CAACF,KAAK,CAACU,MAAM,CAACK,eAAe,CAAC,CAAA;AAEhDR,IAAAA,OAAO,CAACS,EAAE,CAAC,OAAO,EAAE,YAAY;AAC9B,MAAA,MAAMC,MAAM,GAAG,YAAY;QACzB,IAAI;UACF,MAAMC,yBAAS,CAACR,MAAM,CAAC,CAAA;SACxB,CAAC,OAAOS,GAAG,EAAE;AACZN,UAAAA,OAAO,CAACO,KAAK,CAACD,GAAG,CAAC,CAAA;UAClBN,OAAO,CAACC,IAAI,EAAE,CAAA;AAChB,SAAA;OACD,CAAA;MAED,MAAMG,MAAM,EAAE,CAAA;AAEd,MAAA,IAAII,OAAsC,CAAA;MAE1C,MAAMC,OAAO,GAAIC,IAAY,IAAK;AAChC,QAAA,IAAIF,OAAO,EAAE;UACXG,YAAY,CAACH,OAAO,CAAC,CAAA;AACvB,SAAA;AAEAA,QAAAA,OAAO,GAAGI,UAAU,CAACR,MAAM,EAAE,EAAE,CAAC,CAAA;OACjC,CAAA;AAEDV,MAAAA,OAAO,CAACS,EAAE,CAAC,QAAQ,EAAEM,OAAO,CAAC,CAAA;AAC7Bf,MAAAA,OAAO,CAACS,EAAE,CAAC,KAAK,EAAEM,OAAO,CAAC,CAAA;AAC1Bf,MAAAA,OAAO,CAACS,EAAE,CAAC,QAAQ,EAAEM,OAAO,CAAC,CAAA;AAC/B,KAAC,CAAC,CAAA;GACH,CAAA;AAEDrB,EAAAA,aAAa,CAACe,EAAE,CAAC,OAAO,EAAEP,gBAAgB,CAAC,CAAA;AAC3CR,EAAAA,aAAa,CAACe,EAAE,CAAC,QAAQ,EAAEP,gBAAgB,CAAC,CAAA;AAC9C;;;;"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|