create-rsc-kit 0.46.0 → 0.46.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/templates.d.ts +7 -0
- package/dist/templates.js +14 -6
- package/package.json +1 -1
package/dist/templates.d.ts
CHANGED
|
@@ -60,6 +60,13 @@ export declare function packageJson(o: Options): string;
|
|
|
60
60
|
* Netlify, Azure, Deno and the rest, and none of them need anything here — a
|
|
61
61
|
* preset is a string in a config file, not a server we write and keep working.
|
|
62
62
|
*/
|
|
63
|
+
/**
|
|
64
|
+
* Whether the server this app builds runs on Node: a Node app, and a Laravel
|
|
65
|
+
* app unless its runtime is Bun. Everything that names a runtime - the types,
|
|
66
|
+
* the MCP launcher - asks this, not the host: a Laravel app on Node was given
|
|
67
|
+
* Bun's types and a `bunx` that a machine without Bun cannot start.
|
|
68
|
+
*/
|
|
69
|
+
export declare const runsOnNode: (o: Pick<Options, 'host' | 'runtime'>) => boolean;
|
|
63
70
|
export declare const preset: (host: Host, runtime?: Runtime) => string;
|
|
64
71
|
/** @deprecated Nothing generates a server file. Kept until callers are gone. */
|
|
65
72
|
export declare const serverFile: (_host: Host) => string;
|
package/dist/templates.js
CHANGED
|
@@ -191,10 +191,10 @@ export function packageJson(o) {
|
|
|
191
191
|
// upgrading rsc-kit upgrades all three together.
|
|
192
192
|
dev['rsc-kit'] = sibling(o.core, 'cli');
|
|
193
193
|
dev['@rsc-kit/mcp'] = sibling(o.core, 'mcp');
|
|
194
|
-
if (o
|
|
195
|
-
dev['@types/bun'] = '^1.4.0';
|
|
196
|
-
else
|
|
194
|
+
if (runsOnNode(o))
|
|
197
195
|
dev['@types/node'] = '^24.0.0';
|
|
196
|
+
else
|
|
197
|
+
dev['@types/bun'] = '^1.4.0';
|
|
198
198
|
// Always, not only for the compiler: this is also what gives a client
|
|
199
199
|
// component Fast Refresh, so without it every edit to one is a full reload
|
|
200
200
|
// and any state it held is gone.
|
|
@@ -240,6 +240,13 @@ const sorted = (o) => Object.fromEntries(Object.entries(o).sort(([a], [b]) => a.
|
|
|
240
240
|
* Netlify, Azure, Deno and the rest, and none of them need anything here — a
|
|
241
241
|
* preset is a string in a config file, not a server we write and keep working.
|
|
242
242
|
*/
|
|
243
|
+
/**
|
|
244
|
+
* Whether the server this app builds runs on Node: a Node app, and a Laravel
|
|
245
|
+
* app unless its runtime is Bun. Everything that names a runtime - the types,
|
|
246
|
+
* the MCP launcher - asks this, not the host: a Laravel app on Node was given
|
|
247
|
+
* Bun's types and a `bunx` that a machine without Bun cannot start.
|
|
248
|
+
*/
|
|
249
|
+
export const runsOnNode = (o) => o.host === 'node' || (o.host === 'laravel' && o.runtime !== 'bun');
|
|
243
250
|
export const preset = (host, runtime = 'node') => host === 'worker' ? 'cloudflare_module' : host === 'laravel' ? runtime : host === 'node' ? 'node' : 'bun';
|
|
244
251
|
/** @deprecated Nothing generates a server file. Kept until callers are gone. */
|
|
245
252
|
export const serverFile = (_host) => 'server.ts';
|
|
@@ -349,7 +356,7 @@ export const tsconfig = (o) => JSON.stringify({
|
|
|
349
356
|
// vite/client for import.meta.env. Bun's as well, because the
|
|
350
357
|
// tests run under bun:test - the two sets coexist.
|
|
351
358
|
['@cloudflare/workers-types', 'vite/client', '@types/bun']
|
|
352
|
-
: o
|
|
359
|
+
: runsOnNode(o)
|
|
353
360
|
? ['node', 'vite/client']
|
|
354
361
|
: ['@types/bun', 'vite/client'],
|
|
355
362
|
},
|
|
@@ -987,8 +994,9 @@ needs a shared store, and production needs \`RSC_SIGNING_SECRET\` - ${o.host ===
|
|
|
987
994
|
*/
|
|
988
995
|
export function mcp(o) {
|
|
989
996
|
// bunx on a Bun project, npx elsewhere: the same server either way, but an
|
|
990
|
-
// editor launching it should not need npm on a machine that has Bun
|
|
991
|
-
|
|
997
|
+
// editor launching it should not need npm on a machine that has Bun, nor
|
|
998
|
+
// Bun on one that runs the app on Node.
|
|
999
|
+
const launcher = o && !runsOnNode(o)
|
|
992
1000
|
? { command: 'bunx', args: ['@rsc-kit/mcp'] }
|
|
993
1001
|
: { command: 'npx', args: ['-y', '@rsc-kit/mcp'] };
|
|
994
1002
|
return (JSON.stringify({
|