create-rsc-kit 0.27.0 → 0.27.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 CHANGED
@@ -217,7 +217,7 @@ function write(o) {
217
217
  // secret the backend is given once. The scaffold's .gitignore already
218
218
  // keeps .env out of git.
219
219
  if (o.backend) {
220
- files.push(['.env', t.backendEnv(o.backend, randomBytes(32).toString('base64url'))]);
220
+ files.push(['.env', t.backendEnv(o.backend, randomBytes(32).toString('base64url'), randomBytes(32).toString('base64url'))]);
221
221
  if (!o.env)
222
222
  files.push(['.env.example', t.backendEnvExample(o.backend)]);
223
223
  }
package/dist/init.js CHANGED
@@ -603,17 +603,20 @@ function backend(o, found, dir) {
603
603
  if (!/^\s*RSC_HOST_CALL_SECRET=/m.test(current)) {
604
604
  missing.push(`RSC_HOST_CALL_SECRET=${randomBytes(32).toString('base64url')}`);
605
605
  }
606
+ if (!/^\s*RSC_SIGNING_SECRET=/m.test(current)) {
607
+ missing.push(`RSC_SIGNING_SECRET=${randomBytes(32).toString('base64url')}`);
608
+ }
606
609
  if (missing.length === 0) {
607
- steps.push({ kind: 'skipped', what: '.env', detail: 'already has RSC_BACKEND and RSC_HOST_CALL_SECRET' });
610
+ steps.push({ kind: 'skipped', what: '.env', detail: 'already has RSC_BACKEND, RSC_HOST_CALL_SECRET and RSC_SIGNING_SECRET' });
608
611
  }
609
612
  else {
610
613
  writeFileSync(env, current.replace(/\s*$/, '\n\n') + missing.join('\n') + '\n');
611
- steps.push({ kind: 'merged', what: '.env', detail: `added ${missing.map((line) => line.split('=')[0]).join(' and ')}` });
614
+ steps.push({ kind: 'merged', what: '.env', detail: `added ${missing.map((line) => line.split('=')[0]).join(', ')}` });
612
615
  }
613
616
  }
614
617
  else {
615
- writeFileSync(env, t.backendEnv(o.backend, randomBytes(32).toString('base64url')));
616
- steps.push({ kind: 'wrote', what: '.env', detail: 'RSC_BACKEND and a generated RSC_HOST_CALL_SECRET' });
618
+ writeFileSync(env, t.backendEnv(o.backend, randomBytes(32).toString('base64url'), randomBytes(32).toString('base64url')));
619
+ steps.push({ kind: 'wrote', what: '.env', detail: 'RSC_BACKEND, and a generated RSC_HOST_CALL_SECRET and RSC_SIGNING_SECRET' });
617
620
  }
618
621
  const example = join(dir, '.env.example');
619
622
  if (!existsSync(example)) {
@@ -160,7 +160,7 @@ export declare function instrumentation(_o: Options): string;
160
160
  * configuring in development or in production. A Laravel app has both in
161
161
  * its .env already, under APP_URL.
162
162
  */
163
- export declare function backendEnv(backend: string, secret: string): string;
163
+ export declare function backendEnv(backend: string, secret: string, signing: string): string;
164
164
  export declare function backendEnvExample(backend: string): string;
165
165
  /**
166
166
  * What the backend has to do, said once at the end. Go gets its own, because
package/dist/templates.js CHANGED
@@ -990,12 +990,16 @@ export async function register() {}
990
990
  * configuring in development or in production. A Laravel app has both in
991
991
  * its .env already, under APP_URL.
992
992
  */
993
- export function backendEnv(backend, secret) {
993
+ export function backendEnv(backend, secret, signing) {
994
994
  return `# Where rpc() goes: a backend answering POST /__rsc/host-call. The renderer
995
995
  # reads both of these, in development (vite) and in production (the built
996
996
  # server). The backend checks the secret on every call; keep it out of git.
997
997
  RSC_BACKEND=${backend}
998
998
  RSC_HOST_CALL_SECRET=${secret}
999
+
1000
+ # Signs the names a page refreshes on (refreshOn), for the renderer alone.
1001
+ # Its own key, not the one above; the same on every instance in production.
1002
+ RSC_SIGNING_SECRET=${signing}
999
1003
  `;
1000
1004
  }
1001
1005
  export function backendEnvExample(backend) {
@@ -1003,6 +1007,10 @@ export function backendEnvExample(backend) {
1003
1007
  # generate one: openssl rand -base64 32
1004
1008
  RSC_BACKEND=${backend}
1005
1009
  RSC_HOST_CALL_SECRET=
1010
+
1011
+ # Signs refreshOn names; its own key, the same on every instance in
1012
+ # production - generate one the same way.
1013
+ RSC_SIGNING_SECRET=
1006
1014
  `;
1007
1015
  }
1008
1016
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rsc-kit",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
4
4
  "type": "module",
5
5
  "description": "Scaffold an RSC app on Bun, Hono, Elysia or Node.",
6
6
  "bin": {