@sigil-dev/grimoire 0.9.3 → 0.9.5

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 (78) hide show
  1. package/index.ts +37 -35
  2. package/package.json +9 -12
  3. package/preload.js +3 -3
  4. package/server.ts +19 -19
  5. package/src/client/deps.ts +36 -19
  6. package/src/client/enhance.ts +102 -98
  7. package/src/client/head.ts +30 -30
  8. package/src/client/index.ts +2 -2
  9. package/src/client/router.ts +174 -68
  10. package/src/client/scope.ts +22 -22
  11. package/src/dev/compile-module.ts +215 -163
  12. package/src/dev/effect-registry.ts +23 -23
  13. package/src/dev/graph.ts +109 -114
  14. package/src/dev/hmr-client.ts +202 -185
  15. package/src/dev/hmr-server.ts +261 -187
  16. package/src/dev/loader.ts +120 -47
  17. package/src/dev/paths.ts +14 -14
  18. package/src/dev/resolve.ts +70 -0
  19. package/src/dev/runtime-bundle.ts +52 -52
  20. package/src/dev/scan.ts +78 -0
  21. package/src/dev/watcher.ts +69 -47
  22. package/src/env/dynamic-private.ts +19 -19
  23. package/src/env/dynamic-public.ts +22 -22
  24. package/src/env/index.ts +25 -25
  25. package/src/env/plugin.ts +19 -19
  26. package/src/env/private.ts +5 -5
  27. package/src/env/public.ts +7 -7
  28. package/src/env/typegen.ts +61 -61
  29. package/src/headers.ts +114 -114
  30. package/src/integrations/vite.ts +73 -73
  31. package/src/logger/index.ts +4 -4
  32. package/src/logger/instance.ts +6 -6
  33. package/src/logger/logger.ts +113 -113
  34. package/src/logger/request-middleware.ts +24 -24
  35. package/src/logger/transports.ts +117 -117
  36. package/src/logger/types.ts +39 -39
  37. package/src/rendering/head.ts +52 -47
  38. package/src/rendering/hydrate.ts +159 -138
  39. package/src/rendering/index.ts +140 -18
  40. package/src/rendering/ssrPlugin.ts +78 -69
  41. package/src/routing/manifest-gen.ts +13 -1
  42. package/src/routing/router.ts +135 -109
  43. package/src/routing/scanner.ts +196 -141
  44. package/src/routing/transform-routes.ts +102 -102
  45. package/src/sentinels/error.ts +52 -52
  46. package/src/sentinels/fail.ts +41 -41
  47. package/src/sentinels/redirect.ts +35 -35
  48. package/src/server/build.ts +250 -243
  49. package/src/server/context.ts +10 -10
  50. package/src/server/cookie-utils.ts +66 -66
  51. package/src/server/coordinator.ts +364 -364
  52. package/src/server/hooks.ts +114 -114
  53. package/src/server/index.ts +711 -655
  54. package/src/server/interactive.ts +56 -56
  55. package/src/server/plugins.ts +121 -121
  56. package/src/server/worker.ts +58 -58
  57. package/src/typegen/index.ts +389 -356
  58. package/src/types.ts +286 -282
  59. package/test/client-router.test.ts +295 -44
  60. package/test/context.test.ts +52 -52
  61. package/test/env.test.ts +90 -90
  62. package/test/exports.test.ts +37 -37
  63. package/test/fail.test.ts +46 -46
  64. package/test/headers.test.ts +100 -100
  65. package/test/hmr.test.ts +426 -0
  66. package/test/hydration.test.ts +119 -119
  67. package/test/middleware.test.ts +223 -223
  68. package/test/preload.ts +5 -5
  69. package/test/redirect-error.test.ts +112 -112
  70. package/test/rendering.test.ts +719 -615
  71. package/test/routing.test.ts +197 -81
  72. package/test/scanning.test.ts +314 -200
  73. package/test/scope.test.ts +195 -195
  74. package/test/server.test.ts +360 -249
  75. package/test/streaming.test.ts +242 -125
  76. package/test/transform-routes.test.ts +87 -84
  77. package/test/typegen.test.ts +697 -682
  78. package/tsconfig.json +10 -10
@@ -1,200 +1,314 @@
1
- import { afterAll, beforeAll, describe, expect, test } from "bun:test";
2
- import { mkdir, rm, writeFile } from "node:fs/promises";
3
- import { tmpdir } from "node:os";
4
- import { join } from "node:path";
5
- import { filePathToRoutePath, scanRoutes } from "../src/routing/scanner";
6
-
7
- describe("File scanning", () => {
8
- test("index.tsx → /", () => {
9
- expect(filePathToRoutePath("/app/routes/index.tsx", "/app/routes")).toEqual(
10
- { pattern: "/", params: [], restParams: [] },
11
- );
12
- });
13
-
14
- test("about.tsx → /about", () => {
15
- expect(filePathToRoutePath("/app/routes/about.tsx", "/app/routes")).toEqual(
16
- { pattern: "/about", params: [], restParams: [] },
17
- );
18
- });
19
-
20
- test("[slug].tsx → /:slug", () => {
21
- expect(
22
- filePathToRoutePath("/app/routes/[slug].tsx", "/app/routes"),
23
- ).toEqual({ pattern: "/:slug", params: ["slug"], restParams: [] });
24
- });
25
-
26
- test("blog/+page.tsx → /blog", () => {
27
- expect(
28
- filePathToRoutePath("/app/routes/blog/+page.tsx", "/app/routes"),
29
- ).toEqual({ pattern: "/blog", params: [], restParams: [] });
30
- });
31
-
32
- test("blog/[slug]/+page.tsx → /blog/:slug", () => {
33
- expect(
34
- filePathToRoutePath("/app/routes/blog/[slug]/+page.tsx", "/app/routes"),
35
- ).toEqual({ pattern: "/blog/:slug", params: ["slug"], restParams: [] });
36
- });
37
-
38
- test("blog/[slug]/+page.server.ts → /blog/:slug", () => {
39
- expect(
40
- filePathToRoutePath(
41
- "/app/routes/blog/[slug]/+page.server.ts",
42
- "/app/routes",
43
- ),
44
- ).toEqual({ pattern: "/blog/:slug", params: ["slug"], restParams: [] });
45
- });
46
-
47
- test("+layout.tsx → /", () => {
48
- expect(
49
- filePathToRoutePath("/app/routes/+layout.tsx", "/app/routes"),
50
- ).toEqual({ pattern: "/", params: [], restParams: [] });
51
- });
52
-
53
- test("nested +layout.tsx → /blog", () => {
54
- expect(
55
- filePathToRoutePath("/app/routes/blog/+layout.tsx", "/app/routes"),
56
- ).toEqual({ pattern: "/blog", params: [], restParams: [] });
57
- });
58
-
59
- test("[...rest].tsx → /*rest (catch-all)", () => {
60
- expect(
61
- filePathToRoutePath("/app/routes/[...rest].tsx", "/app/routes"),
62
- ).toEqual({ pattern: "/*rest", params: [], restParams: ["rest"] });
63
- });
64
-
65
- test("docs/[...path]/+server.ts → /docs/*path (nested catch-all)", () => {
66
- expect(
67
- filePathToRoutePath(
68
- "/app/routes/docs/[...path]/+server.ts",
69
- "/app/routes",
70
- ),
71
- ).toEqual({ pattern: "/docs/*path", params: [], restParams: ["path"] });
72
- });
73
-
74
- test("about/index.tsx, about/+page.tsx, and about.tsx all resolve to /about", () => {
75
- const index = filePathToRoutePath(
76
- "/app/routes/about/index.tsx",
77
- "/app/routes",
78
- );
79
- const page = filePathToRoutePath(
80
- "/app/routes/about/+page.tsx",
81
- "/app/routes",
82
- );
83
- const bare = filePathToRoutePath("/app/routes/about.tsx", "/app/routes");
84
- expect(index.pattern).toBe("/about");
85
- expect(page.pattern).toBe("/about");
86
- expect(bare.pattern).toBe("/about");
87
- });
88
-
89
- test("+server.ts resolves to the same path as +page.tsx", () => {
90
- const server = filePathToRoutePath(
91
- "/app/routes/api/items/+server.ts",
92
- "/app/routes",
93
- );
94
- expect(server.pattern).toBe("/api/items");
95
- });
96
-
97
- test("+error.tsx resolves to its directory path", () => {
98
- const root = filePathToRoutePath("/app/routes/+error.tsx", "/app/routes");
99
- const nested = filePathToRoutePath(
100
- "/app/routes/blog/+error.tsx",
101
- "/app/routes",
102
- );
103
- expect(root.pattern).toBe("/");
104
- expect(nested.pattern).toBe("/blog");
105
- });
106
-
107
- test("(group)/page/+page.tsx → /page", () => {
108
- const { pattern } = filePathToRoutePath(
109
- "/routes/(marketing)/about/+page.tsx",
110
- "/routes",
111
- );
112
- expect(pattern).toBe("/about");
113
- });
114
-
115
- test("nested groups collapse correctly", () => {
116
- const { pattern } = filePathToRoutePath(
117
- "/routes/(app)/(auth)/login/+page.tsx",
118
- "/routes",
119
- );
120
- expect(pattern).toBe("/login");
121
- });
122
- });
123
-
124
- describe("Duplicate route detection", () => {
125
- let tmpDir: string;
126
-
127
- beforeAll(async () => {
128
- tmpDir = join(tmpdir(), `grimoire-scan-${Date.now()}`);
129
- await mkdir(tmpDir, { recursive: true });
130
- });
131
-
132
- afterAll(async () => {
133
- await rm(tmpDir, { recursive: true });
134
- });
135
-
136
- test("throws when two page files resolve to the same path", async () => {
137
- const dir = join(tmpDir, "dup-pages");
138
- await mkdir(join(dir, "about"), { recursive: true });
139
- await writeFile(join(dir, "about.tsx"), "export default () => null");
140
- await writeFile(
141
- join(dir, "about", "index.tsx"),
142
- "export default () => null",
143
- );
144
- await expect(scanRoutes(dir)).rejects.toThrow('Duplicate page at "/about"');
145
- });
146
-
147
- test("+page.tsx and +page.server.ts at the same path do NOT conflict", async () => {
148
- const dir = join(tmpDir, "no-conflict");
149
- await mkdir(join(dir, "blog"), { recursive: true });
150
- await writeFile(
151
- join(dir, "blog", "+page.tsx"),
152
- "export default () => null",
153
- );
154
- await writeFile(
155
- join(dir, "blog", "+page.server.ts"),
156
- "export async function load() {}",
157
- );
158
- await expect(scanRoutes(dir)).resolves.toBeDefined();
159
- });
160
-
161
- test("throws when two API routes resolve to the same path", async () => {
162
- const dir = join(tmpDir, "dup-server");
163
- await mkdir(join(dir, "api", "items"), { recursive: true });
164
- // Bun glob finds all files; we simulate two +server files at same path via subdirs
165
- // Use two different nesting depths that produce the same URL
166
- await mkdir(join(dir, "api2"), { recursive: true });
167
- await writeFile(
168
- join(dir, "api2", "+server.ts"),
169
- "export async function GET() {}",
170
- );
171
- await mkdir(join(dir, "api2", "index"), { recursive: true });
172
- // Can't easily duplicate +server.ts via nesting — test the named-file vs +server collision instead
173
- // Two +server.ts under different folder structures that map to same URL isn't possible without
174
- // [param] collisions, so verify a simple valid tree is fine
175
- await expect(scanRoutes(dir)).resolves.toBeDefined();
176
- });
177
-
178
- test("throws when two error pages resolve to the same path", async () => {
179
- const dir = join(tmpDir, "dup-error");
180
- await mkdir(join(dir, "blog"), { recursive: true });
181
- // Two +error.tsx at root level isn't possible via filesystem (same filename).
182
- // The real collision scenario is two dynamic segments mapping to the same pattern.
183
- // Test that a single error page is accepted without error.
184
- await writeFile(join(dir, "+error.tsx"), "export default () => null");
185
- await expect(scanRoutes(dir)).resolves.toBeDefined();
186
- });
187
-
188
- test("throws when a simple file and +page.tsx both resolve to the same path", async () => {
189
- const dir = join(tmpDir, "dup-mixed");
190
- await mkdir(join(dir, "contact"), { recursive: true });
191
- await writeFile(join(dir, "contact.tsx"), "export default () => null");
192
- await writeFile(
193
- join(dir, "contact", "+page.tsx"),
194
- "export default () => null",
195
- );
196
- await expect(scanRoutes(dir)).rejects.toThrow(
197
- 'Duplicate page at "/contact"',
198
- );
199
- });
200
- });
1
+ import { afterAll, beforeAll, describe, expect, test } from "bun:test";
2
+ import { mkdir, rm, writeFile } from "node:fs/promises";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ import { filePathToRoutePath, scanRoutes } from "../src/routing/scanner";
6
+
7
+ describe("File scanning", () => {
8
+ test("index.tsx → /", () => {
9
+ expect(filePathToRoutePath("/app/routes/index.tsx", "/app/routes")).toEqual(
10
+ {
11
+ pattern: "/",
12
+ params: [],
13
+ optionalParams: [],
14
+ paramMatchers: {},
15
+ restParams: [],
16
+ },
17
+ );
18
+ });
19
+
20
+ test("about.tsx → /about", () => {
21
+ expect(filePathToRoutePath("/app/routes/about.tsx", "/app/routes")).toEqual(
22
+ {
23
+ pattern: "/about",
24
+ params: [],
25
+ optionalParams: [],
26
+ paramMatchers: {},
27
+ restParams: [],
28
+ },
29
+ );
30
+ });
31
+
32
+ test("[slug].tsx → /:slug", () => {
33
+ expect(
34
+ filePathToRoutePath("/app/routes/[slug].tsx", "/app/routes"),
35
+ ).toEqual({
36
+ pattern: "/:slug",
37
+ params: ["slug"],
38
+ optionalParams: [],
39
+ paramMatchers: {},
40
+ restParams: [],
41
+ });
42
+ });
43
+
44
+ test("blog/+page.tsx → /blog", () => {
45
+ expect(
46
+ filePathToRoutePath("/app/routes/blog/+page.tsx", "/app/routes"),
47
+ ).toEqual({
48
+ pattern: "/blog",
49
+ params: [],
50
+ optionalParams: [],
51
+ paramMatchers: {},
52
+ restParams: [],
53
+ });
54
+ });
55
+
56
+ test("blog/[slug]/+page.tsx → /blog/:slug", () => {
57
+ expect(
58
+ filePathToRoutePath("/app/routes/blog/[slug]/+page.tsx", "/app/routes"),
59
+ ).toEqual({
60
+ pattern: "/blog/:slug",
61
+ params: ["slug"],
62
+ optionalParams: [],
63
+ paramMatchers: {},
64
+ restParams: [],
65
+ });
66
+ });
67
+
68
+ test("blog/[slug]/+page.server.ts → /blog/:slug", () => {
69
+ expect(
70
+ filePathToRoutePath(
71
+ "/app/routes/blog/[slug]/+page.server.ts",
72
+ "/app/routes",
73
+ ),
74
+ ).toEqual({
75
+ pattern: "/blog/:slug",
76
+ params: ["slug"],
77
+ optionalParams: [],
78
+ paramMatchers: {},
79
+ restParams: [],
80
+ });
81
+ });
82
+
83
+ test("+layout.tsx → /", () => {
84
+ expect(
85
+ filePathToRoutePath("/app/routes/+layout.tsx", "/app/routes"),
86
+ ).toEqual({
87
+ pattern: "/",
88
+ params: [],
89
+ optionalParams: [],
90
+ paramMatchers: {},
91
+ restParams: [],
92
+ });
93
+ });
94
+
95
+ test("nested +layout.tsx → /blog", () => {
96
+ expect(
97
+ filePathToRoutePath("/app/routes/blog/+layout.tsx", "/app/routes"),
98
+ ).toEqual({
99
+ pattern: "/blog",
100
+ params: [],
101
+ optionalParams: [],
102
+ paramMatchers: {},
103
+ restParams: [],
104
+ });
105
+ });
106
+
107
+ test("[...rest].tsx → /*rest (catch-all)", () => {
108
+ expect(
109
+ filePathToRoutePath("/app/routes/[...rest].tsx", "/app/routes"),
110
+ ).toEqual({
111
+ pattern: "/*rest",
112
+ params: [],
113
+ optionalParams: [],
114
+ paramMatchers: {},
115
+ restParams: ["rest"],
116
+ });
117
+ });
118
+
119
+ test("docs/[...path]/+server.ts → /docs/*path (nested catch-all)", () => {
120
+ expect(
121
+ filePathToRoutePath(
122
+ "/app/routes/docs/[...path]/+server.ts",
123
+ "/app/routes",
124
+ ),
125
+ ).toEqual({
126
+ pattern: "/docs/*path",
127
+ params: [],
128
+ optionalParams: [],
129
+ paramMatchers: {},
130
+ restParams: ["path"],
131
+ });
132
+ });
133
+
134
+ test("about/index.tsx, about/+page.tsx, and about.tsx all resolve to /about", () => {
135
+ const index = filePathToRoutePath(
136
+ "/app/routes/about/index.tsx",
137
+ "/app/routes",
138
+ );
139
+ const page = filePathToRoutePath(
140
+ "/app/routes/about/+page.tsx",
141
+ "/app/routes",
142
+ );
143
+ const bare = filePathToRoutePath("/app/routes/about.tsx", "/app/routes");
144
+ expect(index.pattern).toBe("/about");
145
+ expect(page.pattern).toBe("/about");
146
+ expect(bare.pattern).toBe("/about");
147
+ });
148
+
149
+ test("+server.ts resolves to the same path as +page.tsx", () => {
150
+ const server = filePathToRoutePath(
151
+ "/app/routes/api/items/+server.ts",
152
+ "/app/routes",
153
+ );
154
+ expect(server.pattern).toBe("/api/items");
155
+ });
156
+
157
+ test("+error.tsx resolves to its directory path", () => {
158
+ const root = filePathToRoutePath("/app/routes/+error.tsx", "/app/routes");
159
+ const nested = filePathToRoutePath(
160
+ "/app/routes/blog/+error.tsx",
161
+ "/app/routes",
162
+ );
163
+ expect(root.pattern).toBe("/");
164
+ expect(nested.pattern).toBe("/blog");
165
+ });
166
+
167
+ test("(group)/page/+page.tsx → /page", () => {
168
+ const { pattern } = filePathToRoutePath(
169
+ "/routes/(marketing)/about/+page.tsx",
170
+ "/routes",
171
+ );
172
+ expect(pattern).toBe("/about");
173
+ });
174
+
175
+ test("nested groups collapse correctly", () => {
176
+ const { pattern } = filePathToRoutePath(
177
+ "/routes/(app)/(auth)/login/+page.tsx",
178
+ "/routes",
179
+ );
180
+ expect(pattern).toBe("/login");
181
+ });
182
+
183
+ test("[[lang]]/index.tsx → /:lang? (optional)", () => {
184
+ const result = filePathToRoutePath(
185
+ "/app/routes/[[lang]]/index.tsx",
186
+ "/app/routes",
187
+ );
188
+ expect(result.pattern).toBe("/:lang?");
189
+ expect(result.optionalParams).toEqual(["lang"]);
190
+ expect(result.params).toEqual([]);
191
+ });
192
+
193
+ test("optional and required params are collected separately", () => {
194
+ const result = filePathToRoutePath(
195
+ "/app/routes/[[lang]]/blog/[slug]/+page.tsx",
196
+ "/app/routes",
197
+ );
198
+ expect(result.pattern).toBe("/:lang?/blog/:slug");
199
+ expect(result.optionalParams).toEqual(["lang"]);
200
+ expect(result.params).toEqual(["slug"]);
201
+ });
202
+ });
203
+
204
+ describe("Custom param matchers", () => {
205
+ test("[id=int].tsx → /:id with matcher recorded", () => {
206
+ const result = filePathToRoutePath(
207
+ "/app/routes/post/[id=int].tsx",
208
+ "/app/routes",
209
+ );
210
+ expect(result.pattern).toBe("/post/:id");
211
+ expect(result.paramMatchers).toEqual({ id: "int" });
212
+ expect(result.params).toEqual(["id"]);
213
+ });
214
+
215
+ test("scanRoutes picks up src/params/*.ts beside src/routes", async () => {
216
+ const root = join(tmpdir(), `grimoire-matchers-${Date.now()}`);
217
+ const routesDir = join(root, "routes");
218
+ const paramsDir = join(root, "params");
219
+ await mkdir(join(routesDir, "post"), { recursive: true });
220
+ await mkdir(paramsDir, { recursive: true });
221
+ await writeFile(
222
+ join(routesDir, "post", "[id=int].tsx"),
223
+ "export default () => null",
224
+ );
225
+ await writeFile(
226
+ join(paramsDir, "int.ts"),
227
+ "export function match(v: string) { return /^\\d+$/.test(v); }",
228
+ );
229
+ const tree = await scanRoutes(routesDir);
230
+ expect(tree.paramMatcherFiles).toEqual([
231
+ { name: "int", filePath: join(paramsDir, "int.ts") },
232
+ ]);
233
+ expect(tree.routes[0]?.paramMatchers).toEqual({ id: "int" });
234
+ await rm(root, { recursive: true });
235
+ });
236
+ });
237
+
238
+ describe("Duplicate route detection", () => {
239
+ let tmpDir: string;
240
+
241
+ beforeAll(async () => {
242
+ tmpDir = join(tmpdir(), `grimoire-scan-${Date.now()}`);
243
+ await mkdir(tmpDir, { recursive: true });
244
+ });
245
+
246
+ afterAll(async () => {
247
+ await rm(tmpDir, { recursive: true });
248
+ });
249
+
250
+ test("throws when two page files resolve to the same path", async () => {
251
+ const dir = join(tmpDir, "dup-pages");
252
+ await mkdir(join(dir, "about"), { recursive: true });
253
+ await writeFile(join(dir, "about.tsx"), "export default () => null");
254
+ await writeFile(
255
+ join(dir, "about", "index.tsx"),
256
+ "export default () => null",
257
+ );
258
+ await expect(scanRoutes(dir)).rejects.toThrow('Duplicate page at "/about"');
259
+ });
260
+
261
+ test("+page.tsx and +page.server.ts at the same path do NOT conflict", async () => {
262
+ const dir = join(tmpDir, "no-conflict");
263
+ await mkdir(join(dir, "blog"), { recursive: true });
264
+ await writeFile(
265
+ join(dir, "blog", "+page.tsx"),
266
+ "export default () => null",
267
+ );
268
+ await writeFile(
269
+ join(dir, "blog", "+page.server.ts"),
270
+ "export async function load() {}",
271
+ );
272
+ await expect(scanRoutes(dir)).resolves.toBeDefined();
273
+ });
274
+
275
+ test("throws when two API routes resolve to the same path", async () => {
276
+ const dir = join(tmpDir, "dup-server");
277
+ await mkdir(join(dir, "api", "items"), { recursive: true });
278
+ // Bun glob finds all files; we simulate two +server files at same path via subdirs
279
+ // Use two different nesting depths that produce the same URL
280
+ await mkdir(join(dir, "api2"), { recursive: true });
281
+ await writeFile(
282
+ join(dir, "api2", "+server.ts"),
283
+ "export async function GET() {}",
284
+ );
285
+ await mkdir(join(dir, "api2", "index"), { recursive: true });
286
+ // Can't easily duplicate +server.ts via nesting — test the named-file vs +server collision instead
287
+ // Two +server.ts under different folder structures that map to same URL isn't possible without
288
+ // [param] collisions, so verify a simple valid tree is fine
289
+ await expect(scanRoutes(dir)).resolves.toBeDefined();
290
+ });
291
+
292
+ test("throws when two error pages resolve to the same path", async () => {
293
+ const dir = join(tmpDir, "dup-error");
294
+ await mkdir(join(dir, "blog"), { recursive: true });
295
+ // Two +error.tsx at root level isn't possible via filesystem (same filename).
296
+ // The real collision scenario is two dynamic segments mapping to the same pattern.
297
+ // Test that a single error page is accepted without error.
298
+ await writeFile(join(dir, "+error.tsx"), "export default () => null");
299
+ await expect(scanRoutes(dir)).resolves.toBeDefined();
300
+ });
301
+
302
+ test("throws when a simple file and +page.tsx both resolve to the same path", async () => {
303
+ const dir = join(tmpDir, "dup-mixed");
304
+ await mkdir(join(dir, "contact"), { recursive: true });
305
+ await writeFile(join(dir, "contact.tsx"), "export default () => null");
306
+ await writeFile(
307
+ join(dir, "contact", "+page.tsx"),
308
+ "export default () => null",
309
+ );
310
+ await expect(scanRoutes(dir)).rejects.toThrow(
311
+ 'Duplicate page at "/contact"',
312
+ );
313
+ });
314
+ });