rsc-kit 0.24.1 → 0.24.3
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 +23 -6
- package/dist/index.js +17 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# rsc-kit
|
|
2
2
|
|
|
3
3
|
The command line for [rsc-kit](https://rsc-kit.dev) — React Server Components
|
|
4
|
-
as a Vite plugin,
|
|
4
|
+
as a Vite plugin, deployed wherever Nitro deploys.
|
|
5
5
|
|
|
6
6
|
```sh
|
|
7
|
-
bunx rsc-kit@latest init # add it to
|
|
7
|
+
bunx rsc-kit@latest init # add it to the project in this directory
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
Starting from nothing instead:
|
|
@@ -13,10 +13,27 @@ Starting from nothing instead:
|
|
|
13
13
|
bun create rsc-kit@latest my-app
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
## Commands
|
|
17
|
+
|
|
18
|
+
**`rsc-kit init`** adds rsc-kit to the project in this directory, or starts
|
|
19
|
+
one there if it is empty. Nothing existing is rewritten: it writes the files
|
|
20
|
+
you do not have, adds the dependencies you are missing, adds its entry to
|
|
21
|
+
list-like files (`.mcp.json`, `AGENTS.md`, `tsconfig.json`'s `include`,
|
|
22
|
+
`.env`) with yours left as written, and for anything else already there, such
|
|
23
|
+
as your vite config, prints the exact edit for you to make. In a Go module it does the JavaScript half — `package.json`, the
|
|
24
|
+
route tree, `vite.config.ts`, `.env` with `RSC_BACKEND` and a generated
|
|
25
|
+
secret — and prints the Go half ([Go](https://docs.rsc-kit.dev/hosts/go)). A
|
|
26
|
+
Laravel app runs it through `php artisan rsc:install`
|
|
27
|
+
([Laravel](https://docs.rsc-kit.dev/hosts/laravel)). `rsc-kit init --help`
|
|
28
|
+
lists its flags.
|
|
29
|
+
|
|
30
|
+
**`rsc-kit typegen`** writes the route types without starting Vite, for a
|
|
31
|
+
typecheck after a route was added. `--check` writes nothing and exits
|
|
32
|
+
non-zero when the committed `rsc-host.json` or route types are no longer what
|
|
33
|
+
the backend and the routes produce — a CI step.
|
|
34
|
+
|
|
35
|
+
Name the tag: `bunx rsc-kit init` reuses whatever copy bunx downloaded first,
|
|
36
|
+
while `bunx rsc-kit@latest init` fetches the current one.
|
|
20
37
|
|
|
21
38
|
Installing this package also gives you [`@rsc-kit/core`](https://www.npmjs.com/package/@rsc-kit/core),
|
|
22
39
|
so `import { rscKit } from '@rsc-kit/core/vite'` works after `bun add rsc-kit`.
|
package/dist/index.js
CHANGED
|
@@ -12,8 +12,9 @@ const HELP = `
|
|
|
12
12
|
Usage
|
|
13
13
|
rsc-kit init [options] add it to the project in this directory,
|
|
14
14
|
or start one here if the directory is empty
|
|
15
|
-
rsc-kit typegen
|
|
16
|
-
for a typecheck after a route was added
|
|
15
|
+
rsc-kit typegen [--check] write the route types without starting Vite,
|
|
16
|
+
for a typecheck after a route was added;
|
|
17
|
+
--check fails if committed ones are stale
|
|
17
18
|
|
|
18
19
|
Run \`rsc-kit init --help\` for what it takes. Freezing pages is part of
|
|
19
20
|
\`vite build\` and has no command: it needs the bundle the build just wrote,
|
|
@@ -42,8 +43,20 @@ else if (command === 'typegen') {
|
|
|
42
43
|
// Loads the app's vite.config through the app's own Vite, so the types come
|
|
43
44
|
// from the plugin version and options the app builds with.
|
|
44
45
|
const { typegen } = await import('@rsc-kit/core/typegen');
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
const check = rest.includes('--check');
|
|
47
|
+
const stale = await typegen(process.cwd(), check);
|
|
48
|
+
if (!check) {
|
|
49
|
+
stdout.write('rsc-kit: route types written\n');
|
|
50
|
+
}
|
|
51
|
+
else if (stale.length === 0) {
|
|
52
|
+
stdout.write('rsc-kit: generated files are current\n');
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
stdout.write('rsc-kit typegen --check: these are committed and no longer what the backend and the routes produce:\n' +
|
|
56
|
+
stale.map((f) => ' ' + f).join('\n') +
|
|
57
|
+
'\nRun rsc-kit typegen and commit the result.\n');
|
|
58
|
+
exit(1);
|
|
59
|
+
}
|
|
47
60
|
}
|
|
48
61
|
else {
|
|
49
62
|
stdout.write(`\n Not an rsc-kit command: ${command}\n${HELP}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rsc-kit",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The rsc-kit command line: add it to a project, and freeze what can be frozen.",
|
|
6
6
|
"bin": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://rsc-kit.dev",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@rsc-kit/core": "^0.24.
|
|
31
|
-
"create-rsc-kit": "^0.24.
|
|
30
|
+
"@rsc-kit/core": "^0.24.3",
|
|
31
|
+
"create-rsc-kit": "^0.24.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^24.0.0",
|