create-rsc-kit 0.18.0 → 0.18.1
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/index.js +1 -1
- package/dist/init.js +1 -1
- package/dist/templates.d.ts +1 -1
- package/dist/templates.js +22 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -152,7 +152,7 @@ function write(o) {
|
|
|
152
152
|
['.gitignore', t.gitignore],
|
|
153
153
|
['README.md', t.readme(o)],
|
|
154
154
|
['AGENTS.md', t.agents(o)],
|
|
155
|
-
['.mcp.json', t.mcp()],
|
|
155
|
+
['.mcp.json', t.mcp(o)],
|
|
156
156
|
['src/app/layout.tsx', t.layout(o)],
|
|
157
157
|
['src/app/page.tsx', t.page(o)],
|
|
158
158
|
['src/components/Counter.tsx', t.counter(o)],
|
package/dist/init.js
CHANGED
|
@@ -326,7 +326,7 @@ function routes(o, dir) {
|
|
|
326
326
|
// file of someone else's instructions is not one to append to blind, and
|
|
327
327
|
// the loop below skips it if it is already there.
|
|
328
328
|
['AGENTS.md', t.agents(o)],
|
|
329
|
-
['.mcp.json', t.mcp()],
|
|
329
|
+
['.mcp.json', t.mcp(o)],
|
|
330
330
|
];
|
|
331
331
|
if (o.tailwind)
|
|
332
332
|
files.push([join(o.sourceDir, 'app/styles.css'), t.styles]);
|
package/dist/templates.d.ts
CHANGED
|
@@ -112,7 +112,7 @@ export declare function agents(o: Options): string;
|
|
|
112
112
|
* the server the first time an agent starts it. Other clients want the same
|
|
113
113
|
* four lines in their own file.
|
|
114
114
|
*/
|
|
115
|
-
export declare function mcp(): string;
|
|
115
|
+
export declare function mcp(o?: Options): string;
|
|
116
116
|
export declare function readme(o: Options): string;
|
|
117
117
|
/**
|
|
118
118
|
* Typed environment variables, read once at startup.
|
package/dist/templates.js
CHANGED
|
@@ -61,9 +61,16 @@ export function scripts(o) {
|
|
|
61
61
|
start: 'bun .output/server/index.mjs',
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
+
// On Bun, Vite itself runs on Bun. `vite` is a bin with a node shebang, so
|
|
65
|
+
// `bun run dev` alone still started it under Node - and a project that
|
|
66
|
+
// imports `bun` or `bun:sqlite` failed at the first render with "Cannot
|
|
67
|
+
// find package 'bun'", in a scaffold that had just said it was a Bun app.
|
|
68
|
+
// `bun --bun` runs the bin on Bun's runtime; the dev server, the build and
|
|
69
|
+
// the prerender then see the same runtime the server will.
|
|
70
|
+
const vite = o.host === 'bun' ? 'bun --bun vite' : 'vite';
|
|
64
71
|
return {
|
|
65
|
-
dev:
|
|
66
|
-
build:
|
|
72
|
+
dev: vite,
|
|
73
|
+
build: `${vite} build`,
|
|
67
74
|
// The two that produce something you ship build first, rather than reading
|
|
68
75
|
// whatever .output happens to hold. Run on a project that has never been
|
|
69
76
|
// built, they failed with `ENOENT opening root directory ".output/server"`
|
|
@@ -90,7 +97,7 @@ export function scripts(o) {
|
|
|
90
97
|
// nothing in .gitignore covering it.
|
|
91
98
|
...(o.host === 'bun'
|
|
92
99
|
? {
|
|
93
|
-
compile:
|
|
100
|
+
compile: `${vite} build && bun build --compile .output/server/index.mjs --outfile dist/app`,
|
|
94
101
|
}
|
|
95
102
|
: {}),
|
|
96
103
|
}),
|
|
@@ -584,6 +591,11 @@ export async function createPost(input) { … } // callable from a client comp
|
|
|
584
591
|
Do not put \`"use server"\` at the top of a page to make it a server component.
|
|
585
592
|
It already is one.
|
|
586
593
|
|
|
594
|
+
A callback that a timer, a subscription or a listener calls and that must see
|
|
595
|
+
the latest props is \`useEffectEvent\` from React, not a ref you assign every
|
|
596
|
+
render. An Effect Event is never a dependency: leave it out of the array. The
|
|
597
|
+
engine's own hooks are written this way.
|
|
598
|
+
|
|
587
599
|
## Reading the request
|
|
588
600
|
|
|
589
601
|
\`cookies()\`, \`headers()\` and \`searchParams()\` come from
|
|
@@ -700,10 +712,15 @@ from the request is answered from disk.
|
|
|
700
712
|
* the server the first time an agent starts it. Other clients want the same
|
|
701
713
|
* four lines in their own file.
|
|
702
714
|
*/
|
|
703
|
-
export function mcp() {
|
|
715
|
+
export function mcp(o) {
|
|
716
|
+
// bunx on a Bun project, npx elsewhere: the same server either way, but an
|
|
717
|
+
// editor launching it should not need npm on a machine that has Bun.
|
|
718
|
+
const launcher = o && o.host !== 'node'
|
|
719
|
+
? { command: 'bunx', args: ['@rsc-kit/mcp'] }
|
|
720
|
+
: { command: 'npx', args: ['-y', '@rsc-kit/mcp'] };
|
|
704
721
|
return (JSON.stringify({
|
|
705
722
|
mcpServers: {
|
|
706
|
-
'rsc-kit':
|
|
723
|
+
'rsc-kit': launcher,
|
|
707
724
|
},
|
|
708
725
|
}, null, 2) + '\n');
|
|
709
726
|
}
|