create-rsc-kit 0.22.7 → 0.22.9

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.
@@ -76,8 +76,11 @@ export declare const bunfig = "[test]\npreload = [\"./tests/preload.ts\"]\n";
76
76
  * nothing on the server. Under bun test it is the real package, which throws
77
77
  * on import, so an action or a route that carries the line would not be a
78
78
  * function a test can call. Stubbed here, once.
79
+ *
80
+ * next/headers is answered the way the build answers it, so a flag read in
81
+ * an action or a page evaluates in a test as it does in the app.
79
82
  */
80
- export declare const testPreload = "import { mock } from 'bun:test'\n\n// The build honours this import and resolves it to nothing on the server;\n// the real package throws when imported, which is what a test would hit.\nmock.module('server-only', () => ({}))\nmock.module('client-only', () => ({}))\n";
83
+ export declare const testPreload = "import { mock } from 'bun:test'\n\n// The build honours this import and resolves it to nothing on the server;\n// the real package throws when imported, which is what a test would hit.\nmock.module('server-only', () => ({}))\nmock.module('client-only', () => ({}))\n\n// The build answers next/headers with @rsc-kit/core/request, so a library\n// written for Next - Vercel's flags/next - runs without Next. A test is not\n// built: without this it finds Next's own, or nothing, and throws.\nmock.module('next/headers', () => import('@rsc-kit/core/request'))\n";
81
84
  export declare function smokeTest(o: Options): string;
82
85
  export declare function page(o: Options): string;
83
86
  export declare function counter(o: Options): string;
package/dist/templates.js CHANGED
@@ -106,7 +106,10 @@ export function scripts(o) {
106
106
  }
107
107
  : {}),
108
108
  }),
109
- typecheck: 'tsc --noEmit',
109
+ // The route types first: they are written when Vite starts, and a
110
+ // typecheck run without one read the last start's - a route added since
111
+ // was not a Route yet.
112
+ typecheck: 'rsc-kit-typegen && tsc --noEmit',
110
113
  ...(o.lint ? { lint: 'oxlint src --fix', 'lint:check': 'oxlint src --deny-warnings' } : {}),
111
114
  // Laravel returned above: its pages call into PHP that createTestApp does
112
115
  // not run, and its tests are Pest, on the other side.
@@ -119,7 +122,7 @@ function testScripts(o) {
119
122
  test,
120
123
  // The one command an agent runs before saying it is done. Each part exists
121
124
  // on its own; this is so nothing has to remember the list.
122
- check: ['tsc --noEmit', ...(o.lint ? ['oxlint src --deny-warnings'] : []), test].join(' && '),
125
+ check: ['rsc-kit-typegen', 'tsc --noEmit', ...(o.lint ? ['oxlint src --deny-warnings'] : []), test].join(' && '),
123
126
  };
124
127
  }
125
128
  export function packageJson(o) {
@@ -343,6 +346,9 @@ preload = ["./tests/preload.ts"]
343
346
  * nothing on the server. Under bun test it is the real package, which throws
344
347
  * on import, so an action or a route that carries the line would not be a
345
348
  * function a test can call. Stubbed here, once.
349
+ *
350
+ * next/headers is answered the way the build answers it, so a flag read in
351
+ * an action or a page evaluates in a test as it does in the app.
346
352
  */
347
353
  export const testPreload = `import { mock } from 'bun:test'
348
354
 
@@ -350,6 +356,11 @@ export const testPreload = `import { mock } from 'bun:test'
350
356
  // the real package throws when imported, which is what a test would hit.
351
357
  mock.module('server-only', () => ({}))
352
358
  mock.module('client-only', () => ({}))
359
+
360
+ // The build answers next/headers with @rsc-kit/core/request, so a library
361
+ // written for Next - Vercel's flags/next - runs without Next. A test is not
362
+ // built: without this it finds Next's own, or nothing, and throws.
363
+ mock.module('next/headers', () => import('@rsc-kit/core/request'))
353
364
  `;
354
365
  export function smokeTest(o) {
355
366
  const runner = o.host === 'node'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rsc-kit",
3
- "version": "0.22.7",
3
+ "version": "0.22.9",
4
4
  "type": "module",
5
5
  "description": "Scaffold an RSC app on Bun, Hono, Elysia or Node.",
6
6
  "bin": {