@kasperpeulen/vitest-plugin-nextjs 0.0.0-alpha.0 → 0.1.0-alpha.0

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.
Files changed (250) hide show
  1. package/README.md +249 -2
  2. package/dist/_virtual/_rolldown/runtime.js +14 -0
  3. package/dist/action-ids.d.ts +18 -0
  4. package/dist/action-ids.js +44 -0
  5. package/dist/adapter.d.ts +8 -0
  6. package/dist/adapter.js +12 -0
  7. package/dist/app-requests.d.ts +63 -0
  8. package/dist/app-requests.js +253 -0
  9. package/dist/browser-context.d.ts +24 -0
  10. package/dist/browser-context.js +157 -0
  11. package/dist/build-output.d.ts +68 -0
  12. package/dist/build-output.js +216 -0
  13. package/dist/build.d.ts +26 -0
  14. package/dist/build.js +39 -0
  15. package/dist/built-files.d.ts +9 -0
  16. package/dist/built-files.js +22 -0
  17. package/dist/cache.d.ts +44 -0
  18. package/dist/cache.js +99 -0
  19. package/dist/client-components.d.ts +3 -0
  20. package/dist/client-components.js +4 -0
  21. package/dist/client-file-key.d.ts +5 -0
  22. package/dist/client-file-key.js +5 -0
  23. package/dist/client-files.d.ts +83 -0
  24. package/dist/client-files.js +186 -0
  25. package/dist/client-graph.d.ts +94 -0
  26. package/dist/client-graph.js +266 -0
  27. package/dist/client-modules.d.ts +10 -0
  28. package/dist/client-modules.js +43 -0
  29. package/dist/client.d.ts +42 -0
  30. package/dist/client.js +263 -0
  31. package/dist/commonjs.d.ts +44 -0
  32. package/dist/commonjs.js +111 -0
  33. package/dist/compat/browser/client.d.ts +19 -0
  34. package/dist/compat/browser/client.js +13 -0
  35. package/dist/compat/build.d.ts +145 -0
  36. package/dist/compat/build.js +149 -0
  37. package/dist/compat/checks.d.ts +16 -0
  38. package/dist/compat/checks.js +148 -0
  39. package/dist/compat/patches.d.ts +13 -0
  40. package/dist/compat/patches.js +30 -0
  41. package/dist/compat/paths.d.ts +74 -0
  42. package/dist/compat/paths.js +160 -0
  43. package/dist/compat/rsc/handlers.d.ts +2 -0
  44. package/dist/compat/rsc/handlers.js +2 -0
  45. package/dist/compat/rsc/prerender.d.ts +10 -0
  46. package/dist/compat/rsc/prerender.js +9 -0
  47. package/dist/compat/server/headers.d.ts +3 -0
  48. package/dist/compat/server/headers.js +3 -0
  49. package/dist/compat/ssr/build-output.d.ts +4 -0
  50. package/dist/compat/ssr/build-output.js +3 -0
  51. package/dist/compat/ssr/cache.d.ts +6 -0
  52. package/dist/compat/ssr/cache.js +6 -0
  53. package/dist/compat/ssr/handler.d.ts +8 -0
  54. package/dist/compat/ssr/handler.js +8 -0
  55. package/dist/compat/ssr/node-server.d.ts +5 -0
  56. package/dist/compat/ssr/node-server.js +4 -0
  57. package/dist/compat/ssr/render-errors.d.ts +4 -0
  58. package/dist/compat/ssr/render-errors.js +4 -0
  59. package/dist/compat/ssr/senders.d.ts +6 -0
  60. package/dist/compat/ssr/senders.js +6 -0
  61. package/dist/compat/types.d.ts +8 -0
  62. package/dist/compat/types.js +1 -0
  63. package/dist/compile.d.ts +31 -0
  64. package/dist/compile.js +140 -0
  65. package/dist/disk.d.ts +16 -0
  66. package/dist/disk.js +13 -0
  67. package/dist/document-loads.d.ts +15 -0
  68. package/dist/document-loads.js +53 -0
  69. package/dist/document.d.ts +79 -0
  70. package/dist/document.js +328 -0
  71. package/dist/downloads.d.ts +15 -0
  72. package/dist/downloads.js +71 -0
  73. package/dist/esm-require.d.ts +11 -0
  74. package/dist/esm-require.js +32 -0
  75. package/dist/fast-crypto/index.js +1093 -0
  76. package/dist/fast-crypto.d.ts +20 -0
  77. package/dist/fast-crypto.js +151 -0
  78. package/dist/flight.d.ts +19 -0
  79. package/dist/flight.js +42 -0
  80. package/dist/form-submission.d.ts +15 -0
  81. package/dist/form-submission.js +27 -0
  82. package/dist/from-page.d.ts +5 -0
  83. package/dist/from-page.js +44 -0
  84. package/dist/globals.d.ts +1 -0
  85. package/dist/globals.js +197 -0
  86. package/dist/host-document.d.ts +26 -0
  87. package/dist/host-document.js +34 -0
  88. package/dist/index.d.ts +280 -0
  89. package/dist/index.js +281 -0
  90. package/dist/internal.d.ts +2 -0
  91. package/dist/internal.js +3 -0
  92. package/dist/leftovers.d.ts +11 -0
  93. package/dist/leftovers.js +55 -0
  94. package/dist/mode.d.ts +169 -0
  95. package/dist/mode.js +31 -0
  96. package/dist/node/LICENSES.md +3540 -0
  97. package/dist/node/assert/strict.js +29 -0
  98. package/dist/node/assert.js +3044 -0
  99. package/dist/node/buffer.js +1499 -0
  100. package/dist/node/child_process.js +45 -0
  101. package/dist/node/cluster.js +85 -0
  102. package/dist/node/console.js +96 -0
  103. package/dist/node/constants.js +495 -0
  104. package/dist/node/crypto.js +1388 -0
  105. package/dist/node/dgram.js +78 -0
  106. package/dist/node/diagnostics_channel.js +122 -0
  107. package/dist/node/dns/promises.js +129 -0
  108. package/dist/node/dns.js +137 -0
  109. package/dist/node/domain.js +43 -0
  110. package/dist/node/events.js +1155 -0
  111. package/dist/node/fs/promises.js +40 -0
  112. package/dist/node/fs.js +10375 -0
  113. package/dist/node/http.js +326 -0
  114. package/dist/node/http2.js +305 -0
  115. package/dist/node/https.js +57 -0
  116. package/dist/node/inspector/promises.js +66 -0
  117. package/dist/node/inspector.js +76 -0
  118. package/dist/node/module.js +205 -0
  119. package/dist/node/net.js +392 -0
  120. package/dist/node/os.js +259 -0
  121. package/dist/node/path/posix.js +25 -0
  122. package/dist/node/path/win32.js +25 -0
  123. package/dist/node/path.js +384 -0
  124. package/dist/node/perf_hooks.js +313 -0
  125. package/dist/node/process.js +452 -0
  126. package/dist/node/punycode.js +178 -0
  127. package/dist/node/querystring.js +934 -0
  128. package/dist/node/readline/promises.js +71 -0
  129. package/dist/node/readline.js +56 -0
  130. package/dist/node/repl.js +44 -0
  131. package/dist/node/sqlite.js +22 -0
  132. package/dist/node/stream/consumers.js +47 -0
  133. package/dist/node/stream/promises.js +6 -0
  134. package/dist/node/stream/web.js +52 -0
  135. package/dist/node/stream.js +4323 -0
  136. package/dist/node/string_decoder.js +276 -0
  137. package/dist/node/sys.js +6 -0
  138. package/dist/node/timers/promises.js +71 -0
  139. package/dist/node/timers.js +133 -0
  140. package/dist/node/tls.js +122 -0
  141. package/dist/node/trace_events.js +23 -0
  142. package/dist/node/tty.js +69 -0
  143. package/dist/node/url.js +1426 -0
  144. package/dist/node/util/types.js +1456 -0
  145. package/dist/node/util.js +4807 -0
  146. package/dist/node/v8.js +160 -0
  147. package/dist/node/vm.js +88 -0
  148. package/dist/node/wasi.js +16 -0
  149. package/dist/node/worker_threads.js +123 -0
  150. package/dist/node/zlib.js +1396 -0
  151. package/dist/node-builtins.d.ts +40 -0
  152. package/dist/node-builtins.js +74 -0
  153. package/dist/node-on-page.d.ts +46 -0
  154. package/dist/node-on-page.js +101 -0
  155. package/dist/node-platform.d.ts +36 -0
  156. package/dist/node-platform.js +152 -0
  157. package/dist/node-rendered.d.ts +21 -0
  158. package/dist/node-rendered.js +26 -0
  159. package/dist/node-server.d.ts +46 -0
  160. package/dist/node-server.js +193 -0
  161. package/dist/optimizer-cache-key.d.ts +26 -0
  162. package/dist/optimizer-cache-key.js +73 -0
  163. package/dist/own-package.d.ts +1 -0
  164. package/dist/own-package.js +6 -0
  165. package/dist/page-store.d.ts +33 -0
  166. package/dist/page-store.js +80 -0
  167. package/dist/page-timers.d.ts +22 -0
  168. package/dist/page-timers.js +47 -0
  169. package/dist/page.d.ts +112 -0
  170. package/dist/page.js +549 -0
  171. package/dist/paths.d.ts +13 -0
  172. package/dist/paths.js +47 -0
  173. package/dist/plugin.d.ts +22 -0
  174. package/dist/plugin.js +995 -0
  175. package/dist/prerender-verdict.d.ts +8 -0
  176. package/dist/prerender-verdict.js +67 -0
  177. package/dist/project/context.d.ts +546 -0
  178. package/dist/project/context.js +111 -0
  179. package/dist/project/entries.d.ts +42 -0
  180. package/dist/project/entries.js +189 -0
  181. package/dist/project/env-worker.d.ts +1 -0
  182. package/dist/project/env-worker.js +9 -0
  183. package/dist/project/env.d.ts +36 -0
  184. package/dist/project/env.js +82 -0
  185. package/dist/project/layers.d.ts +31 -0
  186. package/dist/project/layers.js +150 -0
  187. package/dist/project/loaders.d.ts +71 -0
  188. package/dist/project/loaders.js +300 -0
  189. package/dist/project/metadata.d.ts +8 -0
  190. package/dist/project/metadata.js +34 -0
  191. package/dist/project/module-exports.d.ts +29 -0
  192. package/dist/project/module-exports.js +77 -0
  193. package/dist/project/routes.d.ts +19 -0
  194. package/dist/project/routes.js +92 -0
  195. package/dist/project/routing.d.ts +46 -0
  196. package/dist/project/routing.js +280 -0
  197. package/dist/project/transform.d.ts +8 -0
  198. package/dist/project/transform.js +110 -0
  199. package/dist/project/webpack.d.ts +46 -0
  200. package/dist/project/webpack.js +160 -0
  201. package/dist/project.d.ts +264 -0
  202. package/dist/project.js +58 -0
  203. package/dist/registry-global.d.ts +5 -0
  204. package/dist/registry-global.js +5 -0
  205. package/dist/registry.d.ts +241 -0
  206. package/dist/registry.js +30 -0
  207. package/dist/route-chunks.d.ts +13 -0
  208. package/dist/route-chunks.js +32 -0
  209. package/dist/route-lookup.d.ts +34 -0
  210. package/dist/route-lookup.js +207 -0
  211. package/dist/routes-ahead-shared.d.ts +17 -0
  212. package/dist/routes-ahead-shared.js +9 -0
  213. package/dist/routes-ahead.d.ts +10 -0
  214. package/dist/routes-ahead.js +54 -0
  215. package/dist/rsc.d.ts +19 -0
  216. package/dist/rsc.js +171 -0
  217. package/dist/server-action.d.ts +9 -0
  218. package/dist/server-action.js +15 -0
  219. package/dist/server-code.d.ts +176 -0
  220. package/dist/server-code.js +357 -0
  221. package/dist/server-in-front.d.ts +37 -0
  222. package/dist/server-in-front.js +90 -0
  223. package/dist/server-layers.d.ts +22 -0
  224. package/dist/server-layers.js +33 -0
  225. package/dist/setup-browser.d.ts +1 -0
  226. package/dist/setup-browser.js +8 -0
  227. package/dist/setup-node.d.ts +1 -0
  228. package/dist/setup-node.js +6 -0
  229. package/dist/setup.d.ts +8 -0
  230. package/dist/setup.js +62 -0
  231. package/dist/speed-features.d.ts +13 -0
  232. package/dist/speed-features.js +95 -0
  233. package/dist/ssr.d.ts +70 -0
  234. package/dist/ssr.js +480 -0
  235. package/dist/static-build.d.ts +36 -0
  236. package/dist/static-build.js +92 -0
  237. package/dist/storage.d.ts +31 -0
  238. package/dist/storage.js +94 -0
  239. package/dist/styles-shared.d.ts +137 -0
  240. package/dist/styles-shared.js +124 -0
  241. package/dist/styles.d.ts +102 -0
  242. package/dist/styles.js +730 -0
  243. package/dist/stylesheet-versions.d.ts +17 -0
  244. package/dist/stylesheet-versions.js +43 -0
  245. package/dist/tester.html +10 -0
  246. package/dist/use-cache.d.ts +15 -0
  247. package/dist/use-cache.js +93 -0
  248. package/dist/vitest-version.d.ts +6 -0
  249. package/dist/vitest-version.js +12 -0
  250. package/package.json +125 -4
@@ -0,0 +1,17 @@
1
+ //#region src/stylesheet-versions.d.ts
2
+ /**
3
+ * The URLs of the versions of now, by the stylesheet they are of: see
4
+ * `stylesheetOfUrl()`.
5
+ */
6
+ type StylesheetVersions = Map<string, string>;
7
+ declare function stylesheetVersions(urls: string[]): StylesheetVersions;
8
+ /**
9
+ * Moves `link` to `url`: a link of `url` comes next to it, with the same
10
+ * attributes, and `link` goes once that one has loaded or failed, so the
11
+ * document is never without the CSS. A link that has no CSS yet, out of the
12
+ * document or still loading, gets the URL itself: what waits for its `load`
13
+ * gets that of `url`. Returns the link of `url`.
14
+ */
15
+ declare function moveLink(link: HTMLLinkElement, url: string): HTMLLinkElement;
16
+ //#endregion
17
+ export { StylesheetVersions, moveLink, stylesheetVersions };
@@ -0,0 +1,43 @@
1
+ import { stylesheetOfUrl, stylesheetsChangedEvent } from "./styles-shared.js";
2
+ //#region src/stylesheet-versions.ts
3
+ function stylesheetVersions(urls) {
4
+ return new Map(urls.flatMap((url) => {
5
+ const stylesheet = stylesheetOfUrl(url);
6
+ return stylesheet === void 0 ? [] : [[stylesheet, url]];
7
+ }));
8
+ }
9
+ const replaced = /* @__PURE__ */ new WeakSet();
10
+ /**
11
+ * Moves `link` to `url`: a link of `url` comes next to it, with the same
12
+ * attributes, and `link` goes once that one has loaded or failed, so the
13
+ * document is never without the CSS. A link that has no CSS yet, out of the
14
+ * document or still loading, gets the URL itself: what waits for its `load`
15
+ * gets that of `url`. Returns the link of `url`.
16
+ */
17
+ function moveLink(link, url) {
18
+ if (!link.isConnected || !link.sheet) {
19
+ link.href = url;
20
+ return link;
21
+ }
22
+ const moved = link.cloneNode();
23
+ moved.href = url;
24
+ replaced.add(link);
25
+ const remove = () => link.remove();
26
+ moved.addEventListener("load", remove, { once: true });
27
+ moved.addEventListener("error", remove, { once: true });
28
+ link.after(moved);
29
+ return moved;
30
+ }
31
+ /** Moves the links of the page, not the graph's, to the versions of now. */
32
+ function movePageLinks(versions) {
33
+ const links = document.querySelectorAll("link[rel~=\"stylesheet\"][href]");
34
+ for (const link of links) {
35
+ if (replaced.has(link) || link.hasAttribute("data-vitest-plugin-rsc-graph")) continue;
36
+ const stylesheet = stylesheetOfUrl(link.href);
37
+ const url = stylesheet === void 0 ? void 0 : versions.get(stylesheet);
38
+ if (url !== void 0 && new URL(url, link.href).pathname !== new URL(link.href).pathname) moveLink(link, url);
39
+ }
40
+ }
41
+ import.meta.hot?.on(stylesheetsChangedEvent, (urls) => movePageLinks(stylesheetVersions(urls)));
42
+ //#endregion
43
+ export { moveLink, stylesheetVersions };
@@ -0,0 +1,10 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" href="{__VITEST_FAVICON__}" type="image/svg+xml" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vitest Browser Tester</title>
8
+ </head>
9
+ <body></body>
10
+ </html>
@@ -0,0 +1,15 @@
1
+ import { NextLayer, NextProject } from "./project.js";
2
+ import { Plugin } from "vite";
3
+
4
+ //#region src/use-cache.d.ts
5
+ /** The module with the function that compiled code wraps a cached function in. */
6
+ declare const useCacheId = "virtual:vitest-plugin-rsc/next-use-cache";
7
+ declare const useCacheModule: (registry: string) => string;
8
+ /**
9
+ * Whether the app has `"use cache"`: what Next's compiler takes the directive
10
+ * with. Only then is the directive compiled.
11
+ */
12
+ declare function usesCache(project: NextProject): boolean;
13
+ declare function createUseCachePlugin(getProject: () => NextProject, layerOf: (environment: string) => NextLayer | undefined, isAppCode: (file: string, layer: NextLayer) => boolean): Plugin;
14
+ //#endregion
15
+ export { createUseCachePlugin, useCacheId, useCacheModule, usesCache };
@@ -0,0 +1,93 @@
1
+ import { cacheWrapper } from "./compat/paths.js";
2
+ import { parseAstAsync } from "vite";
3
+ import { transformHoistInlineDirective, transformWrapExport } from "@vitejs/plugin-rsc/transforms";
4
+ import { createHash } from "node:crypto";
5
+ import fs from "node:fs";
6
+ //#region src/use-cache.ts
7
+ /** The module with the function that compiled code wraps a cached function in. */
8
+ const useCacheId = "virtual:vitest-plugin-rsc/next-use-cache";
9
+ const useCacheModule = (registry) => `
10
+ import { cache } from ${JSON.stringify(cacheWrapper)};
11
+ import { cache as reactCache } from "react";
12
+ // One for every function: a function with the directive that closes over a
13
+ // value is wrapped where it is created, for every call of the function around
14
+ // it, and the calls of each are still one per render. Next's compiler wraps
15
+ // it once, at the top of the module.
16
+ const wrapped = new WeakMap();
17
+ export function useCache(kind, id, fn, undeclared) {
18
+ let cached = wrapped.get(fn);
19
+ if (cached) return cached;
20
+ cached = reactCache(function () {
21
+ // The arguments the function declares, as Next's compiler passes them:
22
+ // what a caller passes on top of those, like the index of a \`map()\`, is
23
+ // no part of the key. \`fn.length\` also counts what the function closes
24
+ // over, which comes first: it is passed like an argument of the call,
25
+ // not as a bound argument, and is part of the key like one.
26
+ const end = undeclared === null ? undefined : fn.length + undeclared;
27
+ const args = Array.prototype.slice.call(arguments, 0, end);
28
+ // The id is a part of the key. It changes when the caches are reset, so
29
+ // that no test finds what an earlier one cached: see cache.ts. In hex, as
30
+ // Next's id, which a cache handler sees in the key.
31
+ const generation = ${registry}.cacheGeneration().toString(16).padStart(8, "0");
32
+ return cache(kind, id + generation, 0, fn, args);
33
+ });
34
+ Object.defineProperty(cached, "name", { value: fn.name });
35
+ wrapped.set(fn, cached);
36
+ return cached;
37
+ }
38
+ `;
39
+ /**
40
+ * Whether the app has `"use cache"`: what Next's compiler takes the directive
41
+ * with. Only then is the directive compiled.
42
+ */
43
+ function usesCache(project) {
44
+ const config = project.config;
45
+ return Boolean(config.cacheComponents || config.experimental?.useCache);
46
+ }
47
+ const directive = /^use cache(?:: (.+))?$/;
48
+ function undeclaredParams(node) {
49
+ if (!node?.params || !/Function/.test(node.type)) return null;
50
+ if (node.params.some((param) => param.type === "RestElement")) return null;
51
+ const counted = node.params.findIndex((param) => param.type === "AssignmentPattern");
52
+ return counted === -1 ? 0 : node.params.length - counted;
53
+ }
54
+ function createUseCachePlugin(getProject, layerOf, isAppCode) {
55
+ return {
56
+ name: "vitest-plugin-rsc:next-use-cache",
57
+ async transform(code, id) {
58
+ if (!code.includes("use cache")) return;
59
+ if (!usesCache(getProject())) return;
60
+ const file = id.split("?")[0];
61
+ if (layerOf(this.environment.name) !== "rsc" || !isAppCode(file, "rsc")) return;
62
+ if (!fs.existsSync(file)) return;
63
+ const ast = await parseAstAsync(code);
64
+ const idOf = (name) => createHash("sha1").update(`${file}#${name}`).digest("hex");
65
+ const runtime = (kind, value, name, node) => `$$useCache(${JSON.stringify(kind ?? "default")}, ${JSON.stringify(idOf(name))}, ${value}, ${undeclaredParams(node)})`;
66
+ let moduleKind;
67
+ let ofModule = false;
68
+ for (const statement of ast.body) {
69
+ if (statement.type !== "ExpressionStatement" || !("directive" in statement)) break;
70
+ const match = directive.exec(String(statement.directive));
71
+ if (match) [ofModule, moduleKind] = [true, match[1]];
72
+ }
73
+ const { output } = ofModule ? transformWrapExport(code, ast, {
74
+ runtime: (value, name, meta) => runtime(moduleKind, value, name, meta.valueNode),
75
+ ignoreExportAllDeclaration: true,
76
+ rejectNonAsyncFunction: true
77
+ }) : transformHoistInlineDirective(code, ast, {
78
+ directive,
79
+ runtime: (value, name, meta) => runtime(meta.directiveMatch[1], value, name, meta.valueNode),
80
+ rejectNonAsyncFunction: true,
81
+ noExport: true
82
+ });
83
+ if (!output.hasChanged()) return;
84
+ output.prepend(`import { useCache as $$useCache } from ${JSON.stringify(useCacheId)};\n`);
85
+ return {
86
+ code: output.toString(),
87
+ map: output.generateMap({ hires: "boundary" })
88
+ };
89
+ }
90
+ };
91
+ }
92
+ //#endregion
93
+ export { createUseCachePlugin, useCacheId, useCacheModule, usesCache };
@@ -0,0 +1,6 @@
1
+ //#region src/vitest-version.d.ts
2
+ declare const minimumVitest = "5.0.4";
3
+ /** Throws for a Vitest that the plugin does not run in. */
4
+ declare function assertVitestVersion(version: string): void;
5
+ //#endregion
6
+ export { assertVitestVersion, minimumVitest };
@@ -0,0 +1,12 @@
1
+ //#region src/vitest-version.ts
2
+ const minimumVitest = "5.0.4";
3
+ const partsOf = (version) => version.split(/[.+-]/, 3).map((part) => Number(part) || 0);
4
+ /** Throws for a Vitest that the plugin does not run in. */
5
+ function assertVitestVersion(version) {
6
+ const [major = 0, minor = 0, patch = 0] = partsOf(version);
7
+ const [needMajor = 0, needMinor = 0, needPatch = 0] = partsOf(minimumVitest);
8
+ if (major !== needMajor ? major > needMajor : minor !== needMinor ? minor > needMinor : patch >= needPatch) return;
9
+ throw new Error(`vitest-plugin-rsc: runs in Vitest ${minimumVitest} or later, and this is Vitest ${version}. Update vitest and the @vitest packages of the project.`);
10
+ }
11
+ //#endregion
12
+ export { assertVitestVersion, minimumVitest };
package/package.json CHANGED
@@ -1,7 +1,128 @@
1
1
  {
2
2
  "name": "@kasperpeulen/vitest-plugin-nextjs",
3
- "version": "0.0.0-alpha.0",
4
- "description": "Placeholder. The first real release is 0.1.0-alpha.0.",
3
+ "version": "0.1.0-alpha.0",
4
+ "description": "Test and render Next.js App Router pages with Vite: in Vitest Browser Mode, vite dev and Storybook, with Next's own runtime.",
5
+ "keywords": [
6
+ "nextjs",
7
+ "react",
8
+ "react-server-components",
9
+ "rsc",
10
+ "storybook",
11
+ "vite",
12
+ "vitest"
13
+ ],
14
+ "homepage": "https://github.com/storybookjs/storybook-for-pages#readme",
15
+ "bugs": {
16
+ "url": "https://github.com/storybookjs/storybook-for-pages/issues"
17
+ },
5
18
  "license": "MIT",
6
- "files": ["README.md"]
7
- }
19
+ "author": "Kasper Peulen",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/storybookjs/storybook-for-pages.git",
23
+ "directory": "packages/vitest-plugin-nextjs"
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "type": "module",
29
+ "exports": {
30
+ "./package.json": "./package.json",
31
+ ".": {
32
+ "types": "./dist/plugin.d.ts",
33
+ "vitest-plugin-rsc-source": "./src/plugin.ts",
34
+ "default": "./dist/plugin.js"
35
+ },
36
+ "./testing-library": {
37
+ "types": "./dist/index.d.ts",
38
+ "vitest-plugin-rsc-source": "./src/index.ts",
39
+ "default": "./dist/index.js"
40
+ },
41
+ "./client-components": {
42
+ "types": "./dist/client-components.d.ts",
43
+ "vitest-plugin-rsc-source": "./src/client-components.ts",
44
+ "default": "./dist/client-components.js"
45
+ },
46
+ "./rsc": {
47
+ "types": "./dist/rsc.d.ts",
48
+ "vitest-plugin-rsc-source": "./src/rsc.ts",
49
+ "default": "./dist/rsc.js"
50
+ },
51
+ "./ssr": {
52
+ "types": "./dist/ssr.d.ts",
53
+ "vitest-plugin-rsc-source": "./src/ssr.ts",
54
+ "default": "./dist/ssr.js"
55
+ },
56
+ "./client": {
57
+ "types": "./dist/client.d.ts",
58
+ "vitest-plugin-rsc-source": "./src/client.tsx",
59
+ "default": "./dist/client.js"
60
+ },
61
+ "./node-rendered": {
62
+ "types": "./dist/node-rendered.d.ts",
63
+ "vitest-plugin-rsc-source": "./src/node-rendered.tsx",
64
+ "default": "./dist/node-rendered.js"
65
+ },
66
+ "./node/*": "./dist/node/*.js"
67
+ },
68
+ "publishConfig": {
69
+ "access": "public",
70
+ "tag": "latest"
71
+ },
72
+ "dependencies": {
73
+ "@vitejs/plugin-rsc": "0.5.36",
74
+ "cjs-module-lexer": "^2.3.0",
75
+ "magic-string": "^0.30.21",
76
+ "tinyglobby": "^0.2.17"
77
+ },
78
+ "devDependencies": {
79
+ "@next/routing": "16.4.0",
80
+ "@noble/hashes": "2.4.0",
81
+ "@types/node": "^24.12.4",
82
+ "@types/react": "^19.2.14",
83
+ "@types/react-dom": "^19.2.3",
84
+ "assert": "2.1.0",
85
+ "events": "3.3.0",
86
+ "fflate": "0.8.3",
87
+ "happy-dom": "^21.0.4",
88
+ "memfs": "4.80.0",
89
+ "next": "16.4.0",
90
+ "node-inspect-extracted": "3.3.4",
91
+ "path-browserify": "1.0.1",
92
+ "react": "^19.2.6",
93
+ "react-dom": "^19.2.6",
94
+ "readable-stream": "4.8.0",
95
+ "rolldown": "^1.0.0",
96
+ "string_decoder": "1.3.0",
97
+ "tsdown": "^0.22.0",
98
+ "unenv": "2.0.0-rc.24",
99
+ "util": "0.12.5",
100
+ "vite": "^8.3.1",
101
+ "@kasperpeulen/vitest-plugin-rsc": "0.1.0-alpha.0"
102
+ },
103
+ "peerDependencies": {
104
+ "@next/routing": ">=16.4.0-0",
105
+ "next": ">=16.4.0-0",
106
+ "react": "*",
107
+ "react-dom": "*",
108
+ "vite": ">=8.0.0",
109
+ "vitest": "*",
110
+ "@kasperpeulen/vitest-plugin-rsc": "0.1.0-alpha.0"
111
+ },
112
+ "peerDependenciesMeta": {
113
+ "@next/routing": {
114
+ "optional": true
115
+ },
116
+ "vitest": {
117
+ "optional": true
118
+ }
119
+ },
120
+ "//": "Not API, and they change with any version: ./rsc, ./ssr, ./client and ./node-rendered are modules that the layers of the plugin import by these ids, and ./node/* are the modules of Node.js that the server layers get for node:<name>.",
121
+ "scripts": {
122
+ "test": "vitest",
123
+ "test:run": "vitest run",
124
+ "dev": "tsdown --sourcemap --watch src",
125
+ "build": "tsdown",
126
+ "generate": "node scripts/node-modules.ts"
127
+ }
128
+ }