create-rsc-kit 0.22.6 → 0.22.8
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 +4 -1
- package/dist/templates.js +8 -0
- package/package.json +1 -1
package/dist/templates.d.ts
CHANGED
|
@@ -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
|
@@ -343,6 +343,9 @@ preload = ["./tests/preload.ts"]
|
|
|
343
343
|
* nothing on the server. Under bun test it is the real package, which throws
|
|
344
344
|
* on import, so an action or a route that carries the line would not be a
|
|
345
345
|
* function a test can call. Stubbed here, once.
|
|
346
|
+
*
|
|
347
|
+
* next/headers is answered the way the build answers it, so a flag read in
|
|
348
|
+
* an action or a page evaluates in a test as it does in the app.
|
|
346
349
|
*/
|
|
347
350
|
export const testPreload = `import { mock } from 'bun:test'
|
|
348
351
|
|
|
@@ -350,6 +353,11 @@ export const testPreload = `import { mock } from 'bun:test'
|
|
|
350
353
|
// the real package throws when imported, which is what a test would hit.
|
|
351
354
|
mock.module('server-only', () => ({}))
|
|
352
355
|
mock.module('client-only', () => ({}))
|
|
356
|
+
|
|
357
|
+
// The build answers next/headers with @rsc-kit/core/request, so a library
|
|
358
|
+
// written for Next - Vercel's flags/next - runs without Next. A test is not
|
|
359
|
+
// built: without this it finds Next's own, or nothing, and throws.
|
|
360
|
+
mock.module('next/headers', () => import('@rsc-kit/core/request'))
|
|
353
361
|
`;
|
|
354
362
|
export function smokeTest(o) {
|
|
355
363
|
const runner = o.host === 'node'
|