@timber-js/app 0.2.0-alpha.206 → 0.2.0-alpha.208
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/_chunks/{cli-check-BqOylm-3.js → cli-check-G8o30ldg.js} +2 -2
- package/dist/_chunks/{cli-check-BqOylm-3.js.map → cli-check-G8o30ldg.js.map} +1 -1
- package/dist/_chunks/{convention-lint-BnO5TyHD.js → convention-lint-5KzoMg_A.js} +35 -1
- package/dist/_chunks/convention-lint-5KzoMg_A.js.map +1 -0
- package/dist/_chunks/{error-boundary-BndF-3Td.js → error-boundary-BrHmG-2X.js} +2 -2
- package/dist/_chunks/{error-boundary-BndF-3Td.js.map → error-boundary-BrHmG-2X.js.map} +1 -1
- package/dist/_chunks/schema-bridge-C83xa9lT.js.map +1 -1
- package/dist/_chunks/{status-page-marker-DwQBrLBz.js → status-page-marker-CNbpUOPB.js} +88 -9
- package/dist/_chunks/status-page-marker-CNbpUOPB.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -1
- package/dist/client/error-boundary.js +1 -1
- package/dist/client/history.d.ts +8 -0
- package/dist/client/history.d.ts.map +1 -1
- package/dist/client/internal.js +30 -7
- package/dist/client/internal.js.map +1 -1
- package/dist/client/navigation-commit.d.ts +4 -0
- package/dist/client/navigation-commit.d.ts.map +1 -1
- package/dist/client/router-pipeline.d.ts +2 -2
- package/dist/client/router-pipeline.d.ts.map +1 -1
- package/dist/client/router.d.ts.map +1 -1
- package/dist/client/segment-cache.d.ts +44 -4
- package/dist/client/segment-cache.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +103 -2
- package/dist/index.js.map +1 -1
- package/dist/plugins/react-resolve.d.ts +49 -0
- package/dist/plugins/react-resolve.d.ts.map +1 -0
- package/dist/routing/convention-lint.d.ts.map +1 -1
- package/dist/schema-bridge.d.ts +2 -2
- package/dist/schema-bridge.d.ts.map +1 -1
- package/dist/server/action-client.d.ts +2 -2
- package/dist/server/action-client.d.ts.map +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/internal.js +1 -1
- package/package.json +3 -3
- package/src/client/browser-entry/action-dispatch.ts +8 -2
- package/src/client/history.ts +17 -0
- package/src/client/navigation-commit.ts +6 -0
- package/src/client/router-pipeline.ts +31 -4
- package/src/client/router.ts +22 -2
- package/src/client/segment-cache.ts +110 -11
- package/src/index.ts +2 -0
- package/src/plugins/react-resolve.ts +149 -0
- package/src/plugins/routing.ts +1 -1
- package/src/routing/convention-lint.ts +60 -0
- package/src/schema-bridge.ts +4 -2
- package/src/server/action-client.ts +4 -2
- package/dist/_chunks/convention-lint-BnO5TyHD.js.map +0 -1
- package/dist/_chunks/status-page-marker-DwQBrLBz.js.map +0 -1
|
@@ -74,6 +74,16 @@ export interface SegmentNode {
|
|
|
74
74
|
*/
|
|
75
75
|
export class SegmentCache {
|
|
76
76
|
private root: SegmentNode | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Monotonic counter. Bumped by `invalidateReuse()` (TIM-1466).
|
|
79
|
+
* `serializeStateTree` suppresses `segments` and `slots` when
|
|
80
|
+
* `reuseInvalidatedAt > reuseRestoredAt`. Only `restoreReuse()`
|
|
81
|
+
* advances `reuseRestoredAt` — `set()` does not, because a
|
|
82
|
+
* pre-invalidation navigation's commit thunk would lift suppression
|
|
83
|
+
* before a post-invalidation request has been sent (codex on #1167).
|
|
84
|
+
*/
|
|
85
|
+
private reuseInvalidatedAt = 0;
|
|
86
|
+
private reuseRestoredAt = 0;
|
|
77
87
|
|
|
78
88
|
get(segment: string): SegmentNode | undefined {
|
|
79
89
|
if (segment === '/' || segment === this.root?.segment) {
|
|
@@ -90,6 +100,33 @@ export class SegmentCache {
|
|
|
90
100
|
|
|
91
101
|
clear(): void {
|
|
92
102
|
this.root = undefined;
|
|
103
|
+
this.reuseRestoredAt = this.reuseInvalidatedAt;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Suppress segment and slot reuse without destroying the tree
|
|
108
|
+
* structure (TIM-1466). `serializeStateTree` sends empty
|
|
109
|
+
* `segments`/`slots` (forcing a full render) while `treePaths`
|
|
110
|
+
* still reflects the mounted tree for interception scoping.
|
|
111
|
+
* Call `restoreReuse()` once post-invalidation data has been
|
|
112
|
+
* fetched and committed.
|
|
113
|
+
*/
|
|
114
|
+
invalidateReuse(): void {
|
|
115
|
+
this.reuseInvalidatedAt++;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Lift reuse suppression. Called after the segment cache has been
|
|
120
|
+
* rebuilt from a response that was fetched with suppression active
|
|
121
|
+
* (i.e. the server sent a full render). Safe to call idempotently.
|
|
122
|
+
*/
|
|
123
|
+
restoreReuse(): void {
|
|
124
|
+
this.reuseRestoredAt = this.reuseInvalidatedAt;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Whether segment/slot reuse is currently suppressed (TIM-1466). */
|
|
128
|
+
isReuseSuppressed(): boolean {
|
|
129
|
+
return this.reuseInvalidatedAt > this.reuseRestoredAt;
|
|
93
130
|
}
|
|
94
131
|
|
|
95
132
|
/**
|
|
@@ -116,9 +153,12 @@ export class SegmentCache {
|
|
|
116
153
|
const segments: string[] = [];
|
|
117
154
|
const slots: string[] = [];
|
|
118
155
|
const treePaths: string[] = [];
|
|
156
|
+
const suppressed = this.reuseInvalidatedAt > this.reuseRestoredAt;
|
|
119
157
|
if (this.root) {
|
|
120
|
-
|
|
121
|
-
|
|
158
|
+
if (!suppressed) {
|
|
159
|
+
collectSyncSegments(this.root, segments, mergeableFilter);
|
|
160
|
+
collectSyncSlots(this.root, slots);
|
|
161
|
+
}
|
|
122
162
|
collectTreePaths(this.root, treePaths);
|
|
123
163
|
}
|
|
124
164
|
const tree: StateTree = { segments };
|
|
@@ -324,6 +364,27 @@ function prefetchMapKey(key: PrefetchKey): string {
|
|
|
324
364
|
return `${key.from.length}:${key.from}:${key.scope.length}:${key.scope}:${key.url}`;
|
|
325
365
|
}
|
|
326
366
|
|
|
367
|
+
/**
|
|
368
|
+
* Extract the destination URL from a length-prefixed map key.
|
|
369
|
+
* Key format: `${from.length}:${from}:${scope.length}:${scope}:${url}`
|
|
370
|
+
*/
|
|
371
|
+
function extractUrlFromMapKey(mapKey: string): string | null {
|
|
372
|
+
// Parse from-length prefix
|
|
373
|
+
const firstColon = mapKey.indexOf(':');
|
|
374
|
+
if (firstColon === -1) return null;
|
|
375
|
+
const fromLen = parseInt(mapKey.slice(0, firstColon), 10);
|
|
376
|
+
if (Number.isNaN(fromLen)) return null;
|
|
377
|
+
// Skip past `from.length:from:`
|
|
378
|
+
const scopeStart = firstColon + 1 + fromLen + 1;
|
|
379
|
+
// Parse scope-length prefix
|
|
380
|
+
const secondColon = mapKey.indexOf(':', scopeStart);
|
|
381
|
+
if (secondColon === -1) return null;
|
|
382
|
+
const scopeLen = parseInt(mapKey.slice(scopeStart, secondColon), 10);
|
|
383
|
+
if (Number.isNaN(scopeLen)) return null;
|
|
384
|
+
// Skip past `scope.length:scope:` — remainder is the URL
|
|
385
|
+
return mapKey.slice(secondColon + 1 + scopeLen + 1);
|
|
386
|
+
}
|
|
387
|
+
|
|
327
388
|
/**
|
|
328
389
|
* The `scope` half of a `PrefetchKey`, derived from the state tree that will
|
|
329
390
|
* actually be sent. Taking it from the header value rather than re-walking the
|
|
@@ -334,8 +395,12 @@ export function prefetchScopeOf(stateTree: StateTree | undefined): string {
|
|
|
334
395
|
}
|
|
335
396
|
|
|
336
397
|
/** Outcome of a prefetch flight — discriminated so NonRscResponse is a
|
|
337
|
-
* success (stores a negative entry) rather than a rejection.
|
|
338
|
-
|
|
398
|
+
* success (stores a negative entry) rather than a rejection.
|
|
399
|
+
* `startGen` is the eviction generation at flight start — joiners that
|
|
400
|
+
* started after a gen bump must reject pre-invalidation results (TIM-1464). */
|
|
401
|
+
export type FlightOutcome =
|
|
402
|
+
| { kind: 'ready'; result: PrefetchResult; startGen: number }
|
|
403
|
+
| { kind: 'non-route'; startGen: number };
|
|
339
404
|
|
|
340
405
|
/**
|
|
341
406
|
* Short-lived cache for hover-triggered prefetches. Entries expire after
|
|
@@ -410,16 +475,19 @@ export class PrefetchCache {
|
|
|
410
475
|
// Capture the eviction generation before the flight starts. If an
|
|
411
476
|
// action evicts caches while this flight is in progress, the gen
|
|
412
477
|
// will have bumped and the stale result is discarded (TIM-1476).
|
|
478
|
+
// The starting gen is also included in the outcome so joiners
|
|
479
|
+
// that started after a gen bump can detect pre-invalidation
|
|
480
|
+
// results (TIM-1464).
|
|
413
481
|
const genAtStart = this.evictionGen;
|
|
414
482
|
return this.flights.do(prefetchMapKey(key), async (signal) => {
|
|
415
483
|
try {
|
|
416
484
|
const result = await doFetch(signal);
|
|
417
485
|
if (!signal.aborted && this.evictionGen === genAtStart) this.set(key, result);
|
|
418
|
-
return { kind: 'ready' as const, result };
|
|
486
|
+
return { kind: 'ready' as const, result, startGen: genAtStart };
|
|
419
487
|
} catch (err) {
|
|
420
488
|
if (isNonRoute(err)) {
|
|
421
489
|
if (!signal.aborted && this.evictionGen === genAtStart) this.setNegative(key);
|
|
422
|
-
return { kind: 'non-route' as const };
|
|
490
|
+
return { kind: 'non-route' as const, startGen: genAtStart };
|
|
423
491
|
}
|
|
424
492
|
throw err;
|
|
425
493
|
}
|
|
@@ -455,16 +523,47 @@ export class PrefetchCache {
|
|
|
455
523
|
}
|
|
456
524
|
|
|
457
525
|
/**
|
|
458
|
-
* Invalidate
|
|
459
|
-
*
|
|
460
|
-
*
|
|
526
|
+
* Invalidate entries whose destination URL matches (TIM-1454).
|
|
527
|
+
*
|
|
528
|
+
* When `url` has no search string, evicts all entries sharing that
|
|
529
|
+
* pathname — `/products` evicts `/products?page=1` too, because
|
|
530
|
+
* `revalidatePath('/products')` invalidates the route regardless of
|
|
531
|
+
* query (TIM-1465).
|
|
532
|
+
*
|
|
533
|
+
* When `url` has a search string, only the exact URL is evicted.
|
|
534
|
+
*
|
|
535
|
+
* Also bumps the eviction generation so in-flight singleflight
|
|
536
|
+
* flights for the invalidated URL(s) discard their results on
|
|
537
|
+
* completion (TIM-1464).
|
|
461
538
|
*/
|
|
462
539
|
invalidateUrl(url: string): void {
|
|
540
|
+
const hasSearch = url.includes('?');
|
|
541
|
+
const pathname = hasSearch ? null : url;
|
|
542
|
+
|
|
463
543
|
for (const [mapKey] of this.entries) {
|
|
464
|
-
|
|
465
|
-
|
|
544
|
+
// The map key is `${from.length}:${from}:${scope.length}:${scope}:${url}`.
|
|
545
|
+
// The destination URL is the suffix after the last unescaped colon pair.
|
|
546
|
+
if (hasSearch) {
|
|
547
|
+
if (mapKey.endsWith(':' + url)) {
|
|
548
|
+
this.entries.delete(mapKey);
|
|
549
|
+
}
|
|
550
|
+
} else {
|
|
551
|
+
// Extract the URL suffix — everything after the scope block.
|
|
552
|
+
// Match any entry whose URL pathname matches.
|
|
553
|
+
const entryUrl = extractUrlFromMapKey(mapKey);
|
|
554
|
+
if (entryUrl !== null) {
|
|
555
|
+
const qIndex = entryUrl.indexOf('?');
|
|
556
|
+
const entryPathname = qIndex === -1 ? entryUrl : entryUrl.slice(0, qIndex);
|
|
557
|
+
if (entryPathname === pathname) {
|
|
558
|
+
this.entries.delete(mapKey);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
466
561
|
}
|
|
467
562
|
}
|
|
563
|
+
|
|
564
|
+
// Fence in-flight flights so a prefetch that started before
|
|
565
|
+
// invalidation cannot store its stale result (TIM-1464).
|
|
566
|
+
this.evictionGen++;
|
|
468
567
|
}
|
|
469
568
|
|
|
470
569
|
/**
|
package/src/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ import { timberBuildManifest } from './plugins/build-manifest.ts';
|
|
|
28
28
|
import { timberDevLogs, originalConsole, wrapLoggerWithOriginalConsole } from './dev-tools/logs.ts';
|
|
29
29
|
import { resolveForwardConsole } from './dev-tools/browser-logs.ts';
|
|
30
30
|
import { timberReactProd } from './plugins/react-prod.ts';
|
|
31
|
+
import { timberReactResolve } from './plugins/react-resolve.ts';
|
|
31
32
|
import { timberChunks } from './plugins/chunks.ts';
|
|
32
33
|
import { clientChunkGroup } from './plugins/client-chunks.ts';
|
|
33
34
|
import { timberServerBundle } from './plugins/server-bundle.ts';
|
|
@@ -553,6 +554,7 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
|
553
554
|
// imports manifest. See @vitejs/plugin-rsc's buildApp implementation.
|
|
554
555
|
return [
|
|
555
556
|
rootSync,
|
|
557
|
+
timberReactResolve(),
|
|
556
558
|
timberReactProd(),
|
|
557
559
|
// @vitejs/plugin-react provides React Fast Refresh (state-preserving HMR)
|
|
558
560
|
// for client components via Babel transform. Placed before @vitejs/plugin-rsc
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* timber-react-resolve — Deduplicate React across timber and user project.
|
|
3
|
+
*
|
|
4
|
+
* Without this plugin, pnpm's strict isolation can install two physical
|
|
5
|
+
* copies of React when the user's pinned version differs from timber's
|
|
6
|
+
* peer dep. Timber's 47 bare `from 'react'` imports resolve to one copy
|
|
7
|
+
* while react-dom uses the other — causing "Invalid hook call" hydration
|
|
8
|
+
* crashes with no indication of the real cause.
|
|
9
|
+
*
|
|
10
|
+
* The fix: inject `resolve.dedupe` entries so Vite always resolves React
|
|
11
|
+
* packages from the project root. Unlike `resolve.alias`, `dedupe`
|
|
12
|
+
* preserves Vite's per-environment export conditions — the RSC
|
|
13
|
+
* environment still gets the `react-server` build, SSR gets the SSR
|
|
14
|
+
* build, and the browser gets the browser build. The deduplication
|
|
15
|
+
* happens at the package level, not the file level.
|
|
16
|
+
*
|
|
17
|
+
* A `configResolved` check detects version mismatches between timber's
|
|
18
|
+
* resolved React and the project's React, and logs an actionable error.
|
|
19
|
+
*
|
|
20
|
+
* Design doc: 18-build-system.md §"Module Resolution"
|
|
21
|
+
* Task: TIM-1520
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { createRequire } from 'node:module';
|
|
25
|
+
import { dirname } from 'node:path';
|
|
26
|
+
import { fileURLToPath } from 'node:url';
|
|
27
|
+
import type { Plugin } from 'vite';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* React packages to deduplicate. Vite's `resolve.dedupe` extracts the
|
|
31
|
+
* base package name (via `deepImportRE`) before checking, so subpath
|
|
32
|
+
* specifiers like `react/jsx-runtime` are covered by the base `react`
|
|
33
|
+
* entry — listing them separately has no effect.
|
|
34
|
+
*/
|
|
35
|
+
export const REACT_DEDUPE_PACKAGES = ['react', 'react-dom'] as const;
|
|
36
|
+
|
|
37
|
+
// ANSI escape codes — match config-validation.ts style
|
|
38
|
+
const RED = '\x1b[31m';
|
|
39
|
+
const BOLD = '\x1b[1m';
|
|
40
|
+
const DIM = '\x1b[2m';
|
|
41
|
+
const RESET = '\x1b[0m';
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Read the version from a package's package.json given a resolve root.
|
|
45
|
+
*/
|
|
46
|
+
function readPackageVersion(packageName: string, resolveRoot: string): string | null {
|
|
47
|
+
try {
|
|
48
|
+
const req = createRequire(`${resolveRoot}/package.json`);
|
|
49
|
+
const pkgJsonPath = req.resolve(`${packageName}/package.json`);
|
|
50
|
+
const pkg = req(pkgJsonPath) as { version?: string };
|
|
51
|
+
return pkg.version ?? null;
|
|
52
|
+
} catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface ReactVersionMismatch {
|
|
58
|
+
specifier: string;
|
|
59
|
+
timberVersion: string;
|
|
60
|
+
projectVersion: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Check whether timber's React and the user project's React resolve to
|
|
65
|
+
* the same version. Returns mismatches if any.
|
|
66
|
+
*/
|
|
67
|
+
export function detectReactMismatch(projectRoot: string): ReactVersionMismatch[] {
|
|
68
|
+
const mismatches: ReactVersionMismatch[] = [];
|
|
69
|
+
const timberRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
70
|
+
|
|
71
|
+
for (const pkg of ['react', 'react-dom'] as const) {
|
|
72
|
+
const timberVersion = readPackageVersion(pkg, timberRoot);
|
|
73
|
+
const projectVersion = readPackageVersion(pkg, projectRoot);
|
|
74
|
+
|
|
75
|
+
if (timberVersion && projectVersion && timberVersion !== projectVersion) {
|
|
76
|
+
mismatches.push({ specifier: pkg, timberVersion, projectVersion });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return mismatches;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Format React version mismatches as an actionable warning.
|
|
85
|
+
*/
|
|
86
|
+
export function formatReactMismatch(mismatches: ReactVersionMismatch[]): string {
|
|
87
|
+
if (mismatches.length === 0) return '';
|
|
88
|
+
|
|
89
|
+
const lines: string[] = [];
|
|
90
|
+
lines.push(
|
|
91
|
+
`${RED}${BOLD}[timber]${RESET} ${RED}React version mismatch detected — this causes silent hydration crashes${RESET}`
|
|
92
|
+
);
|
|
93
|
+
lines.push('');
|
|
94
|
+
for (const m of mismatches) {
|
|
95
|
+
lines.push(
|
|
96
|
+
` ${RED}✗${RESET} ${m.specifier}: timber has ${BOLD}${m.timberVersion}${RESET}, project has ${BOLD}${m.projectVersion}${RESET}`
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
lines.push('');
|
|
100
|
+
lines.push(
|
|
101
|
+
` ${DIM}This typically causes "Invalid hook call" errors because two copies of${RESET}`
|
|
102
|
+
);
|
|
103
|
+
lines.push(` ${DIM}React are loaded. timber's resolve.dedupe should handle this, but${RESET}`);
|
|
104
|
+
lines.push(
|
|
105
|
+
` ${DIM}if you see hook errors, ensure your React version satisfies timber's peer dep.${RESET}`
|
|
106
|
+
);
|
|
107
|
+
lines.push('');
|
|
108
|
+
lines.push(` ${DIM}Fix: update React in your project to match —${RESET}`);
|
|
109
|
+
lines.push(
|
|
110
|
+
` ${BOLD}pnpm add react@${mismatches[0].timberVersion} react-dom@${mismatches[0].timberVersion}${RESET}`
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
return lines.join('\n');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Create the timber-react-resolve Vite plugin.
|
|
118
|
+
*/
|
|
119
|
+
export function timberReactResolve(): Plugin {
|
|
120
|
+
return {
|
|
121
|
+
name: 'timber-react-resolve',
|
|
122
|
+
enforce: 'pre',
|
|
123
|
+
|
|
124
|
+
config(userConfig) {
|
|
125
|
+
// Merge with any existing dedupe entries the user may have set.
|
|
126
|
+
const existing = userConfig.resolve?.dedupe ?? [];
|
|
127
|
+
const merged = [...existing];
|
|
128
|
+
|
|
129
|
+
for (const pkg of REACT_DEDUPE_PACKAGES) {
|
|
130
|
+
if (!merged.includes(pkg)) {
|
|
131
|
+
merged.push(pkg);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
resolve: {
|
|
137
|
+
dedupe: merged,
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
configResolved(resolved) {
|
|
143
|
+
const mismatches = detectReactMismatch(resolved.root);
|
|
144
|
+
if (mismatches.length > 0) {
|
|
145
|
+
process.stderr.write(`${formatReactMismatch(mismatches)}\n\n`);
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
package/src/plugins/routing.ts
CHANGED
|
@@ -45,7 +45,7 @@ const SEGMENT_PREFIX = '\0$segment:';
|
|
|
45
45
|
* File convention names we track for changes that require manifest regeneration.
|
|
46
46
|
*/
|
|
47
47
|
const ROUTE_FILE_PATTERNS =
|
|
48
|
-
/\/(page|layout|middleware|access|route|error|global-error|default|denied|schema|\d{3}|[45]xx|sitemap|robots|manifest|favicon|icon|opengraph-image|apple-icon)\./;
|
|
48
|
+
/\/(page|layout|middleware|access|route|error|global-error|default|denied|schema|proxy|\d{3}|[45]xx|sitemap|robots|manifest|favicon|icon|opengraph-image|apple-icon)\./;
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* Create the timber-routing Vite plugin.
|
|
@@ -79,6 +79,9 @@ export function lintConventions(tree: RouteTree, appDir: string): ConventionWarn
|
|
|
79
79
|
checkFileUseClientDirective(tree.globalError, 'global-error', warnings);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
// Check 8: middleware.ts inside a parallel slot subtree (silently dead)
|
|
83
|
+
checkSlotMiddleware(tree.root, warnings);
|
|
84
|
+
|
|
82
85
|
return warnings;
|
|
83
86
|
}
|
|
84
87
|
|
|
@@ -431,6 +434,63 @@ function checkFileUseClientDirective(
|
|
|
431
434
|
});
|
|
432
435
|
}
|
|
433
436
|
|
|
437
|
+
// ─── Check: Slot Middleware ─────────────────────────────────────────────────
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Error when middleware.ts appears inside a parallel slot subtree.
|
|
441
|
+
*
|
|
442
|
+
* Middleware is collected from the main matched segment chain only
|
|
443
|
+
* (route-matcher.ts `collectMiddlewareChain`). The slot resolver never
|
|
444
|
+
* walks `middleware` on its matched chain, so a middleware.ts under any
|
|
445
|
+
* `@slot/` directory silently never executes. `access.ts` in slot chains
|
|
446
|
+
* DOES run (via SlotAccessGate), making the asymmetry invisible unless
|
|
447
|
+
* you know to look.
|
|
448
|
+
*
|
|
449
|
+
* This is a build error rather than a warning: the file provably cannot
|
|
450
|
+
* run and its presence misleads the author into thinking the slot is
|
|
451
|
+
* middleware-protected.
|
|
452
|
+
*
|
|
453
|
+
* See design/07-routing.md §"Parallel Routes"
|
|
454
|
+
*/
|
|
455
|
+
function checkSlotMiddleware(node: SegmentNode, warnings: ConventionWarning[]): void {
|
|
456
|
+
for (const [slotName, slotRoot] of Object.entries(node.slots)) {
|
|
457
|
+
collectSlotMiddleware(slotRoot, slotName, warnings);
|
|
458
|
+
}
|
|
459
|
+
for (const child of node.children) {
|
|
460
|
+
checkSlotMiddleware(child, warnings);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Walk a slot subtree and report every middleware.ts found.
|
|
466
|
+
*/
|
|
467
|
+
function collectSlotMiddleware(
|
|
468
|
+
node: SegmentNode,
|
|
469
|
+
slotName: string,
|
|
470
|
+
warnings: ConventionWarning[]
|
|
471
|
+
): void {
|
|
472
|
+
if (node.middleware) {
|
|
473
|
+
warnings.push({
|
|
474
|
+
id: `SLOT_MIDDLEWARE:${node.middleware.filePath}`,
|
|
475
|
+
summary: `middleware.ts inside slot @${slotName} never executes: ${node.middleware.filePath}`,
|
|
476
|
+
details:
|
|
477
|
+
` File: ${node.middleware.filePath}\n\n` +
|
|
478
|
+
` Middleware is collected from the main route chain only.\n` +
|
|
479
|
+
` The slot resolver does not run middleware — this file is silently dead.\n` +
|
|
480
|
+
` (access.ts in slots does run via SlotAccessGate; middleware.ts does not.)\n\n` +
|
|
481
|
+
` To fix: Move the middleware logic into access.ts for slot-scoped auth,\n` +
|
|
482
|
+
` or into a middleware.ts on the main route chain outside the slot.\n`,
|
|
483
|
+
level: 'error',
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
for (const child of node.children) {
|
|
487
|
+
collectSlotMiddleware(child, slotName, warnings);
|
|
488
|
+
}
|
|
489
|
+
for (const [nestedSlotName, nestedSlot] of Object.entries(node.slots)) {
|
|
490
|
+
collectSlotMiddleware(nestedSlot, nestedSlotName, warnings);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
434
494
|
// ─── Check: App Directory Exists ────────────────────────────────────────────
|
|
435
495
|
|
|
436
496
|
/**
|
package/src/schema-bridge.ts
CHANGED
|
@@ -36,8 +36,10 @@ import type { Codec } from './codec.ts';
|
|
|
36
36
|
|
|
37
37
|
/** Minimal Standard Schema interface for auto-detection. */
|
|
38
38
|
export interface StandardSchemaV1<Output = unknown> {
|
|
39
|
-
'~standard': {
|
|
40
|
-
validate
|
|
39
|
+
readonly '~standard': {
|
|
40
|
+
readonly validate: (
|
|
41
|
+
value: unknown
|
|
42
|
+
) => StandardSchemaResult<Output> | Promise<StandardSchemaResult<Output>>;
|
|
41
43
|
};
|
|
42
44
|
}
|
|
43
45
|
|
|
@@ -44,8 +44,10 @@ export class ActionError<TCode extends string = string> extends Error {
|
|
|
44
44
|
* requiring exact structural matches on issues/path shapes.
|
|
45
45
|
*/
|
|
46
46
|
interface StandardSchemaV1<Output = unknown> {
|
|
47
|
-
'~standard': {
|
|
48
|
-
validate
|
|
47
|
+
readonly '~standard': {
|
|
48
|
+
readonly validate: (
|
|
49
|
+
value: unknown
|
|
50
|
+
) => StandardSchemaResult<Output> | Promise<StandardSchemaResult<Output>>;
|
|
49
51
|
};
|
|
50
52
|
}
|
|
51
53
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convention-lint-BnO5TyHD.js","names":[],"sources":["../../src/routing/segment-codegen.ts","../../src/routing/codegen-write.ts","../../src/routing/export-detect.ts","../../src/routing/convention-lint.ts"],"sourcesContent":["/**\n * $segment type generation and directory-to-route mapping.\n *\n * Generates per-route $segment.d.ts files in .timber/types/ that mirror\n * the app/ directory structure. TypeScript's rootDirs feature makes these\n * importable as './$segment' from route files.\n *\n * Design doc: design/41-global-params.md §The $segment Module\n */\n\nimport { writeFile, mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { RouteTree, SegmentNode } from './types.ts';\n\n/** Info carried per directory for type generation. */\nexport interface SegmentInfo {\n /** The URL route pattern (groups and slots stripped). e.g. '/[artistSlug]/[year]' */\n route: string;\n /** The full tree path including groups and slots — uniquely identifies a segment.\n * e.g. '/(browse)/[artistSlug]/@shows/[year]' */\n segmentPath: string;\n}\n\n/**\n * Build a map of absolute filesystem directory → segment info.\n * Used by resolveId to map a $segment import's importer to the correct route,\n * and by writeSegmentTypes to generate per-route $segment.d.ts files.\n *\n * Walks every segment (not just leaves) so layouts and middleware\n * at any depth can import $segment.\n */\nexport function buildDirToRouteMap(tree: RouteTree, appDir: string): Map<string, SegmentInfo> {\n const map = new Map<string, SegmentInfo>();\n\n function walk(node: SegmentNode, fsPath: string, treePath: string): void {\n map.set(fsPath, {\n route: node.urlPath || '/',\n segmentPath: treePath || '/',\n });\n\n for (const child of node.children) {\n const childDir = join(fsPath, child.segmentName);\n const childTreePath = `${treePath}/${child.segmentName}`;\n walk(child, childDir, childTreePath);\n }\n for (const [slotName, slotNode] of Object.entries(node.slots)) {\n const slotDir = join(fsPath, `@${slotName}`);\n const slotTreePath = `${treePath}/@${slotName}`;\n walk(slotNode, slotDir, slotTreePath);\n }\n }\n\n walk(tree.root, appDir, '');\n return map;\n}\n\n/**\n * Generate the full $segment.d.ts content for a segment.\n */\nexport function generateSegmentDts(info: SegmentInfo): string {\n return [\n `export const ROUTE: '${info.route}';`,\n `export const SEGMENT_PATH: '${info.segmentPath}';`,\n '',\n ].join('\\n');\n}\n\n/**\n * Generate per-route $segment.d.ts files in .timber/types/ mirroring\n * the app/ directory structure. These files are importable via TypeScript's\n * rootDirs feature.\n */\nexport async function writeSegmentTypes(\n routeTree: RouteTree,\n appDir: string,\n root: string\n): Promise<void> {\n // Compute the relative prefix from project root to appDir.\n // e.g. if appDir is /project/src/app, relative is 'src/app'\n const relative = appDir.slice(root.length + 1);\n const typesBase = join(root, '.timber', 'types', relative);\n const map = buildDirToRouteMap(routeTree, appDir);\n\n const writes: Promise<void>[] = [];\n for (const [fsDir, info] of map) {\n // Mirror the app/ structure under .timber/types/\n const relDir = fsDir.slice(appDir.length); // e.g. '/[artistSlug]/[year]'\n const segmentDir = join(typesBase, relDir);\n const segmentFile = join(segmentDir, '$segment.d.ts');\n const content = generateSegmentDts(info);\n\n writes.push(\n mkdir(segmentDir, { recursive: true }).then(() => writeFile(segmentFile, content, 'utf-8'))\n );\n }\n\n await Promise.all(writes);\n}\n","/**\n * Route-map codegen writer.\n *\n * Materializes the generated route types on disk: `.timber/timber-routes.d.ts`,\n * `.timber/segment-types.d.ts` (via `writeSegmentTypes`), and the root\n * `timber-env.d.ts` that references them.\n *\n * Lives outside `plugins/routing.ts` because it has two callers with two\n * different failure policies: the dev/build plugin starts the write off the hot\n * path and logs failures, while `timber check` awaits it and treats a failure as\n * fatal — a type check run against absent or stale route types reports errors\n * about code that is fine. One implementation, two policies, so the bytes on\n * disk cannot drift between the two commands.\n *\n * Design docs: 09-typescript.md §\"Typed Routes\", 18-build-system.md\n */\n\nimport { writeFile, mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { generateRouteMap } from './codegen.ts';\nimport { writeSegmentTypes } from './segment-codegen.ts';\nimport type { RouteTree } from './types.ts';\n\n/**\n * Path (relative to the project root) of the generated route map declaration\n * file, and the name of the root file that `/// <reference>`s it.\n *\n * Exported because `timber check` has to answer whether the user's tsconfig\n * pulls these into the program — a question about these exact paths. It derives\n * them from here rather than restating them, so a rename cannot leave the check\n * looking for a file nothing writes.\n */\nexport const CODEGEN_OUTPUT = '.timber/timber-routes.d.ts';\n\n/** Root-level file that references the generated declarations. */\nexport const ENV_DTS_FILENAME = 'timber-env.d.ts';\n\n/**\n * Content of the timber-env.d.ts file written to the project root.\n *\n * Uses a triple-slash reference so TypeScript auto-discovers the generated\n * route map without the user needing to edit tsconfig.json — same pattern\n * as Next.js's next-env.d.ts.\n *\n * Also references `vite/client` so side-effect imports like\n * `import './globals.css'` type-check without ts(2882), and so\n * `import.meta.env`, `import.meta.hot`, `import.meta.glob`, asset\n * imports (`*.png`, `*.svg`, …), CSS modules, and `?url`/`?raw`/\n * `?inline` query variants all resolve without the user editing\n * tsconfig.json themselves. Next.js's next-env.d.ts plays the same\n * role via `next/types/global`.\n *\n * `vite` is a peer dep of `@timber-js/app`, so the reference always\n * resolves in a correctly-installed project.\n */\nconst TIMBER_ENV_DTS = [\n '// This file is auto-generated by timber.js. Do not edit.',\n '// It ensures TypeScript picks up the generated route types and',\n '// Vite-provided ambient types (CSS, assets, import.meta.env, HMR).',\n '/* eslint-disable @typescript-eslint/triple-slash-reference */',\n '/// <reference path=\".timber/timber-routes.d.ts\" />',\n '/// <reference types=\"vite/client\" />',\n '/// <reference types=\"react/canary\" />',\n '/// <reference types=\"react-dom/canary\" />',\n '',\n].join('\\n');\n\n/**\n * Codegen writes that have been started but have not yet landed on disk.\n *\n * `writeRouteCodegen` is deliberately unawaited on the dev/build hot path,\n * which leaves that caller no way to know the files exist yet. Anything that\n * tears down the project root — a build process exiting, a test removing its\n * temp root — then races the writes: `rmSync` empties a directory that a\n * pending `mkdir` immediately recreates, and the removal fails with ENOTEMPTY.\n *\n * Every started write registers here and deregisters when it settles, so\n * `flushCodegenWrites()` can await them instead of guessing at a delay.\n */\nconst pendingCodegenWrites = new Set<Promise<void>>();\n\n/**\n * Resolve once every codegen write started so far has landed on disk.\n *\n * Safe to call at any time and from anywhere — writes are tracked per process,\n * not per plugin instance, so a caller does not need a handle on the plugin\n * that started them. Never rejects: the tracked copy of each write has its\n * rejection swallowed, so a failing write cannot turn a teardown barrier into\n * an unhandled rejection. Callers that care about failure await the promise\n * `writeRouteCodegen` returned instead.\n */\nexport async function flushCodegenWrites(): Promise<void> {\n // Loop rather than a single Promise.all: a write started while we were\n // awaiting would otherwise be missed, and the set would still be non-empty\n // on return.\n //\n // Each round drops what it awaited rather than trusting the per-write\n // `finally` to have run, so the two removal paths are independent — a\n // deregistration that stopped firing would leak memory in dev, but it can\n // never turn this into a spin.\n while (pendingCodegenWrites.size > 0) {\n const inFlight = [...pendingCodegenWrites];\n await Promise.all(inFlight);\n for (const write of inFlight) pendingCodegenWrites.delete(write);\n }\n}\n\n/**\n * Write the generated route map, segment types, and the timber-env.d.ts\n * reference file for `tree`.\n *\n * Returns a promise that **rejects** if any write fails. The dev/build plugin\n * does not await it (types are a developer convenience there, not a runtime\n * dependency) and logs instead; `timber check` awaits it and fails the command.\n * Either way the write is registered with `flushCodegenWrites()`.\n */\nexport function writeRouteCodegen(tree: RouteTree, appDir: string, root: string): Promise<void> {\n const timberDir = join(root, '.timber');\n const content = generateRouteMap(tree, { appDir, outputDir: timberDir });\n const routesPath = join(root, CODEGEN_OUTPUT);\n const envPath = join(root, ENV_DTS_FILENAME);\n\n const done = mkdir(timberDir, { recursive: true })\n .then(() =>\n Promise.all([\n writeFile(routesPath, content, 'utf-8'),\n writeFile(envPath, TIMBER_ENV_DTS, 'utf-8'),\n writeSegmentTypes(tree, appDir, root),\n ])\n )\n .then(() => undefined);\n\n // The tracked copy swallows rejection so `flushCodegenWrites` — a teardown\n // barrier — never rejects and never leaves an unhandled rejection behind.\n // The returned promise keeps its rejection for callers that want it.\n const tracked = done.catch(() => undefined);\n pendingCodegenWrites.add(tracked);\n void tracked.finally(() => pendingCodegenWrites.delete(tracked));\n\n return done;\n}\n","/**\n * AST-based export detection for route files.\n *\n * Uses Vite's `parseAst` (backed by oxc) to precisely detect named and\n * default exports, replacing the regex-based approach that was fragile\n * with TypeScript syntax (type exports, `as` aliases, comments, etc.).\n */\n\nimport { existsSync } from 'node:fs';\nimport { parseAst } from 'vite';\nimport { readFileCached } from './file-cache.ts';\n\ninterface AstNode {\n type: string;\n exportKind?: string;\n declaration?: AstNode;\n specifiers?: Array<{\n exported?: { name: string };\n local?: { name: string };\n exportKind?: string;\n }>;\n id?: { name: string };\n declarations?: Array<{ id?: { name: string }; init?: AstNode }>;\n /** Set on re-exports: `export { X } from './y'`. Absent on local exports. */\n source?: { value?: string } | null;\n /** Set on runtime-transparent wrappers: `X as T`, `X satisfies T`, `(X)`, `X!`. */\n expression?: AstNode;\n /** Set on `Identifier` nodes. */\n name?: string;\n}\n\ninterface ProgramNode {\n body: AstNode[];\n}\n\nfunction tryParse(source: string): ProgramNode | null {\n try {\n return parseAst(source, { lang: 'tsx' }) as unknown as ProgramNode;\n } catch {\n return null;\n }\n}\n\n/**\n * Collect all named export identifiers from a parsed program.\n * Handles: `export function X`, `export const X`, `export { X }`,\n * `export { X } from '...'`, `export { Y as X }`.\n */\nfunction collectNamedExports(program: ProgramNode): Set<string> {\n const names = new Set<string>();\n for (const stmt of program.body) {\n if (stmt.type !== 'ExportNamedDeclaration') continue;\n // Skip `export type ...` declarations — they're erased at runtime\n if (stmt.exportKind === 'type') continue;\n\n if (stmt.declaration) {\n if (stmt.declaration.id?.name) {\n names.add(stmt.declaration.id.name);\n }\n if (stmt.declaration.declarations) {\n for (const decl of stmt.declaration.declarations) {\n if (decl.id?.name) names.add(decl.id.name);\n }\n }\n }\n\n if (stmt.specifiers) {\n for (const spec of stmt.specifiers) {\n // Skip `export { type X }` — per-specifier type exports\n if (spec.exportKind === 'type') continue;\n if (spec.exported?.name && spec.exported.name !== 'default') {\n names.add(spec.exported.name);\n }\n }\n }\n }\n return names;\n}\n\n/**\n * The specifier exporting a *runtime* default from this statement, if any.\n *\n * Type-only exports erase, so they are not default exports at runtime — and\n * TypeScript spells that two ways, on two different nodes: `export type { X as\n * default }` marks the **statement**, `export { type X as default }` marks the\n * **specifier**. Both have to be checked, or a type alias reads as a component:\n * a status file whose only default is a type has nothing for the error boundary\n * to receive (the renderer's `mod?.default` skips it), so treating it as one\n * would fail a build over a file that cannot break anything.\n *\n * One implementation because two callers must agree on what \"has a default\n * export\" means: `hasDefaultExport` decides whether to warn that a page has\n * none, and `fileDefaultExportIsLocalValue` decides whether to fail the build.\n */\nfunction defaultSpecifier(stmt: AstNode): NonNullable<AstNode['specifiers']>[number] | null {\n if (stmt.type !== 'ExportNamedDeclaration' || !stmt.specifiers) return null;\n if (stmt.exportKind === 'type') return null;\n for (const spec of stmt.specifiers) {\n if (spec.exportKind === 'type') continue;\n if (spec.exported?.name === 'default') return spec;\n }\n return null;\n}\n\n/**\n * Check whether a program has a default export.\n * Handles: `export default ...`, `export { X as default }`,\n * `export { default } from '...'`. Type-only defaults do not count —\n * see `defaultSpecifier`.\n */\nfunction hasDefaultExport(program: ProgramNode): boolean {\n for (const stmt of program.body) {\n if (stmt.type === 'ExportDefaultDeclaration') return true;\n if (defaultSpecifier(stmt)) return true;\n }\n return false;\n}\n\n/**\n * Check whether a program has any bare `export * from '...'` declarations.\n * Excludes `export * as X from '...'` (namespace re-exports) since those\n * create a namespace object, not individual top-level exports.\n */\nfunction hasStarExport(program: ProgramNode): boolean {\n return program.body.some(\n (stmt) =>\n stmt.type === 'ExportAllDeclaration' && !(stmt as any).exported && stmt.exportKind !== 'type'\n );\n}\n\n/**\n * Check if a file exports a specific named export.\n * Returns false if the file doesn't exist or can't be parsed.\n */\nexport function fileHasExport(filePath: string, exportName: string): boolean {\n if (!existsSync(filePath)) return false;\n try {\n const source = readFileCached(filePath);\n const program = tryParse(source);\n if (!program) return false;\n return collectNamedExports(program).has(exportName);\n } catch {\n return false;\n }\n}\n\n/**\n * Check if a file has any of the given named exports.\n * Returns the set of matching export names.\n */\nexport function fileHasAnyExport(filePath: string, exportNames: readonly string[]): Set<string> {\n const matches = new Set<string>();\n try {\n const source = readFileCached(filePath);\n const program = tryParse(source);\n if (!program) return matches;\n const exports = collectNamedExports(program);\n for (const name of exportNames) {\n if (exports.has(name)) matches.add(name);\n }\n } catch {\n // Graceful fallback: return empty set\n }\n return matches;\n}\n\n/**\n * Check if a file has a default export.\n * Returns false if the file doesn't exist or can't be parsed.\n */\nexport function fileHasDefaultExport(filePath: string): boolean {\n if (!existsSync(filePath)) return false;\n try {\n const source = readFileCached(filePath);\n const program = tryParse(source);\n if (!program) return false;\n return hasDefaultExport(program);\n } catch {\n return false;\n }\n}\n\n/** Node types whose value is unambiguously constructed by this module. */\nconst FUNCTION_LIKE = new Set([\n 'FunctionDeclaration',\n 'FunctionExpression',\n 'ArrowFunctionExpression',\n 'ClassDeclaration',\n 'ClassExpression',\n]);\n\n/**\n * Expression wrappers that erase at runtime and so cannot change where a value\n * was constructed: `X as T`, `X satisfies T`, `<T>X`, `X!`, `X<T>`, `(X)`.\n */\nconst TRANSPARENT_WRAPPERS = new Set([\n 'TSAsExpression',\n 'TSSatisfiesExpression',\n 'TSTypeAssertion',\n 'TSNonNullExpression',\n 'TSInstantiationExpression',\n 'ParenthesizedExpression',\n]);\n\n/**\n * Strip runtime-transparent wrappers so the node underneath can be classified.\n *\n * Without this, `(() => <h1 />) satisfies React.FC` reads as a\n * `TSSatisfiesExpression` rather than the arrow function it compiles to, and a\n * provably-local component is misread as one whose origin cannot be\n * determined — turning a build error into a warning.\n */\nfunction unwrapTransparent(node: AstNode): AstNode {\n let current = node;\n while (TRANSPARENT_WRAPPERS.has(current.type) && current.expression) {\n current = current.expression;\n }\n return current;\n}\n\n/**\n * Whether `name` is bound at module top level to a function or class written\n * in this file. An imported binding can never match: imports are\n * `ImportDeclaration` specifiers, not function/class/variable declarations,\n * and a module-level name cannot be both.\n */\nfunction bindsLocalFunction(program: ProgramNode, name: string): boolean {\n for (const stmt of program.body) {\n // `export function X() {}` binds X locally too — unwrap the export.\n const decl = stmt.type === 'ExportNamedDeclaration' ? stmt.declaration : stmt;\n if (!decl) continue;\n if (\n (decl.type === 'FunctionDeclaration' || decl.type === 'ClassDeclaration') &&\n decl.id?.name === name\n ) {\n return true;\n }\n if (decl.type === 'VariableDeclaration') {\n for (const d of decl.declarations ?? []) {\n if (d.id?.name === name && d.init && FUNCTION_LIKE.has(unwrapTransparent(d.init).type)) {\n return true;\n }\n }\n }\n }\n return false;\n}\n\n/**\n * Whether the default export is *provably* a value constructed by this module:\n * `export default function/class/() => {}`, or a name bound to a function or\n * class declared here — whether it leaves via `export default Name` or\n * `export { Name as default }`. Both spellings are the same fact about where\n * the value was built, so both must answer the same way.\n *\n * This is the sound half of \"is this a server component?\". A file with no\n * `'use client'` directive whose default export is built here is a server\n * component, full stop. Everything else — `export { default } from\n * './client-thing'`, `export default Imported`, `export default memo(X)`,\n * an unparseable file — returns false, because the exported value may have\n * been minted in a module that *does* carry the directive. Callers must not\n * infer \"server component\" from a missing directive alone.\n */\nexport function fileDefaultExportIsLocalValue(filePath: string): boolean {\n if (!existsSync(filePath)) return false;\n try {\n const source = readFileCached(filePath);\n const program = tryParse(source);\n if (!program) return false;\n for (const stmt of program.body) {\n if (stmt.type === 'ExportDefaultDeclaration') {\n const decl = stmt.declaration && unwrapTransparent(stmt.declaration);\n if (!decl) return false;\n if (FUNCTION_LIKE.has(decl.type)) return true;\n if (decl.type === 'Identifier' && decl.name) {\n return bindsLocalFunction(program, decl.name);\n }\n return false;\n }\n\n // `export { Name as default }` — the same default export by another\n // spelling. `hasDefaultExport` already counts it, so an analysis that\n // skipped it here would let the exact defect this powers slip through\n // as a warning.\n const spec = defaultSpecifier(stmt);\n if (spec) {\n // `export { X as default } from './client-thing'` re-exports another\n // module's value — the directive governing it lives over there.\n if (stmt.source) return false;\n return spec.local?.name ? bindsLocalFunction(program, spec.local.name) : false;\n }\n }\n return false;\n } catch {\n return false;\n }\n}\n\n/**\n * Check if a file has any `export * from '...'` declarations.\n * Returns false if the file doesn't exist or can't be parsed.\n */\nexport function fileHasStarExport(filePath: string): boolean {\n if (!existsSync(filePath)) return false;\n try {\n const source = readFileCached(filePath);\n const program = tryParse(source);\n if (!program) return false;\n return hasStarExport(program);\n } catch {\n return false;\n }\n}\n\n/**\n * Parsed value of `export const prerender` from a route file.\n *\n * - `true` / `false` — literal boolean\n * - `{ ttl?, tags? }` — ISR options object (prerender: true is implied)\n * - `undefined` — no `export const prerender` found\n *\n * See design/45-cache-lifetimes.md §\"Route-Level Static\".\n */\nexport type PrerenderExportValue = boolean | { ttl?: number; tags?: string[] };\n\nfunction extractLiteralValue(node: AstNode): unknown {\n if (!node) return undefined;\n const n = node as any;\n if (n.type === 'Literal') return n.value;\n if (n.type === 'UnaryExpression' && n.operator === '-' && n.argument?.type === 'Literal') {\n return -(n.argument.value as number);\n }\n if (n.type === 'ArrayExpression') {\n const elements = n.elements as AstNode[] | undefined;\n if (!elements) return undefined;\n const result: unknown[] = [];\n for (const el of elements) {\n const v = extractLiteralValue(el);\n if (v === undefined) return undefined;\n result.push(v);\n }\n return result;\n }\n return undefined;\n}\n\nfunction extractObjectLiteral(node: AstNode): Record<string, unknown> | undefined {\n if ((node as any).type !== 'ObjectExpression') return undefined;\n const props = (node as any).properties as AstNode[] | undefined;\n if (!props) return undefined;\n const result: Record<string, unknown> = {};\n for (const prop of props) {\n const p = prop as any;\n if (p.type === 'SpreadElement') return undefined;\n if (p.type !== 'Property' || p.computed) return undefined;\n const key =\n p.key?.type === 'Identifier'\n ? p.key.name\n : p.key?.type === 'Literal'\n ? String(p.key.value)\n : undefined;\n if (!key) return undefined;\n const value = extractLiteralValue(p.value);\n if (value === undefined) return undefined;\n result[key] = value;\n }\n return result;\n}\n\n/**\n * Extract the value of `export const prerender` from a file.\n * Returns undefined if the file doesn't export `prerender` or can't be parsed.\n *\n * Supports:\n * export const prerender = true;\n * export const prerender = false;\n * export const prerender = { ttl: 3600, tags: ['docs'] };\n */\nexport function getPrerenderExport(filePath: string): PrerenderExportValue | undefined {\n if (!existsSync(filePath)) return undefined;\n try {\n const source = readFileCached(filePath);\n const program = tryParse(source);\n if (!program) return undefined;\n\n for (const stmt of program.body) {\n if (stmt.type !== 'ExportNamedDeclaration') continue;\n if (stmt.exportKind === 'type') continue;\n if (!stmt.declaration) continue;\n const decl = stmt.declaration;\n if (decl.type !== 'VariableDeclaration') continue;\n const declarations = decl.declarations as\n | Array<{\n id?: { name?: string };\n init?: AstNode;\n }>\n | undefined;\n if (!declarations) continue;\n for (const d of declarations) {\n if (d.id?.name !== 'prerender' || !d.init) continue;\n const init = d.init as any;\n if (init.type === 'Literal' && typeof init.value === 'boolean') {\n return init.value;\n }\n if (init.type === 'ObjectExpression') {\n const obj = extractObjectLiteral(init);\n if (!obj) return undefined;\n const result: { ttl?: number; tags?: string[] } = {};\n if ('ttl' in obj && typeof obj.ttl === 'number') result.ttl = obj.ttl;\n if (\n 'tags' in obj &&\n Array.isArray(obj.tags) &&\n obj.tags.every((t: unknown) => typeof t === 'string')\n ) {\n result.tags = obj.tags as string[];\n }\n return result;\n }\n return undefined;\n }\n }\n return undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Check if a file starts with a specific directive (e.g. \"use client\").\n * Directives are string literal expression statements at the top of the file.\n */\nexport function fileHasDirective(filePath: string, directive: string): boolean {\n if (!existsSync(filePath)) return false;\n try {\n const source = readFileCached(filePath);\n const program = tryParse(source);\n if (!program) return false;\n for (const stmt of program.body) {\n if (stmt.type !== 'ExpressionStatement') break;\n const expr = (stmt as any).expression;\n if (expr?.type !== 'Literal' || typeof expr.value !== 'string') break;\n if (expr.value === directive) return true;\n }\n return false;\n } catch {\n return false;\n }\n}\n","/**\n * Convention linter — validates common misconfigurations in the route tree.\n *\n * Runs at scan time (build and dev startup). Each check produces a warning\n * with the file path, what's wrong, and what to do about it.\n *\n * Most checks are warnings — they don't block the build. The goal is to catch\n * issues that would otherwise produce cryptic runtime behavior (silent 404s,\n * empty pages, confusing React errors).\n *\n * A check emits `level: 'error'` only when the misconfiguration is *proven*\n * (never inferred from an absence the analysis cannot see through) and fatal\n * to rendering. `plugins/routing.ts` turns those into a thrown build error,\n * so a false positive there refuses a working app — see\n * `classifyClientBoundaryFile` for how that bar is met.\n *\n * Design doc: 07-routing.md, 10-error-handling.md\n */\n\nimport { existsSync } from 'node:fs';\nimport type { RouteFile, RouteTree, SegmentNode } from './types.ts';\nimport { swallow } from '../server/logger.ts';\nimport {\n fileDefaultExportIsLocalValue,\n fileHasAnyExport,\n fileHasDefaultExport,\n fileHasDirective,\n fileHasStarExport,\n} from './export-detect.ts';\n\n// ─── Types ──────────────────────────────────────────────────────────────────\n\nexport interface ConventionWarning {\n /** Warning ID for deduplication and filtering. */\n id: string;\n /** Human-readable single-line summary. */\n summary: string;\n /** Multi-line details with file path and fix suggestion. */\n details: string;\n /** Severity: 'warn' for potential issues, 'error' for definite misconfigurations. */\n level: 'warn' | 'error';\n}\n\n// ─── Lint Rules ─────────────────────────────────────────────────────────────\n\n/**\n * Run all convention lint checks on a route tree.\n *\n * Returns an array of warnings. Empty array means everything looks good.\n */\nexport function lintConventions(tree: RouteTree, appDir: string): ConventionWarning[] {\n const warnings: ConventionWarning[] = [];\n\n // Check 1: app/ directory exists (caller should check before scanning,\n // but we validate the root has at least one routable file)\n checkEmptyApp(tree.root, appDir, warnings);\n\n // Check 2: route.ts without recognized HTTP method exports\n checkRouteExports(tree.root, warnings);\n\n // Check 3: Segments with layout but no page/route anywhere in subtree\n // (not a misconfiguration per se — layouts without pages are valid for\n // route groups. Skip this check.)\n\n // Check 4: Root segment has no layout.tsx (no HTML shell)\n checkRootLayout(tree.root, warnings);\n\n // Check 5: page.tsx / layout.tsx without default export\n checkDefaultExports(tree.root, warnings);\n\n // Check 6: Client layouts cannot suppress server children before Flight\n // serializes them. They remain valid UI boundaries, but not authorization\n // or data-hiding boundaries.\n checkClientLayouts(tree.root, warnings);\n\n // Check 7: error.tsx / 404.tsx / 4xx.tsx / … without 'use client' directive\n checkClientBoundaryFiles(tree.root, warnings);\n if (tree.globalError) {\n checkFileUseClientDirective(tree.globalError, 'global-error', warnings);\n }\n\n return warnings;\n}\n\nfunction checkClientLayouts(node: SegmentNode, warnings: ConventionWarning[]): void {\n if (node.layout && isScriptExtension(node.layout.extension)) {\n try {\n const isClient = fileHasDirective(node.layout.filePath, 'use client');\n const isProvablyServer = fileDefaultExportIsLocalValue(node.layout.filePath);\n if (isClient || !isProvablyServer) {\n const certainty = isClient\n ? `This layout is a client component.`\n : `Timber cannot prove this layout is a server component because its default export comes from another module or an opaque expression.`;\n warnings.push({\n id: `CLIENT_LAYOUT_NOT_AUTH_BOUNDARY:${node.layout.filePath}`,\n summary: isClient\n ? `Client layout cannot securely suppress server children: ${node.layout.filePath}`\n : `Layout may resolve to a client component and cannot be trusted as an auth boundary: ${node.layout.filePath}`,\n details:\n ` File: ${node.layout.filePath}\\n\\n` +\n ` ${certainty}\\n` +\n ` React Flight resolves server content passed to a client layout before the layout runs in the browser.\\n` +\n ` Conditionally omitting children here does not prevent descendant server components from executing or being serialized.\\n\\n` +\n ` To fix: Put authorization in access.ts or a provably server layout with a locally defined default component, and keep client components inside that boundary.\\n`,\n level: 'warn',\n });\n }\n } catch (err) {\n swallow(err, `convention-lint: unreadable layout file ${node.layout.filePath}`);\n }\n }\n for (const child of node.children) checkClientLayouts(child, warnings);\n for (const slot of Object.values(node.slots)) checkClientLayouts(slot, warnings);\n}\n\n// ─── Check: Empty App ───────────────────────────────────────────────────────\n\n/**\n * Warn when the app/ directory has no routable files at all.\n *\n * This catches the \"I created app/ but didn't add any pages\" case where\n * every request silently 404s with no guidance.\n */\nfunction checkEmptyApp(root: SegmentNode, appDir: string, warnings: ConventionWarning[]): void {\n if (hasAnyRoutable(root)) return;\n\n warnings.push({\n id: 'EMPTY_APP',\n summary: 'No pages or route handlers found in app/',\n details:\n ` Directory: ${appDir}\\n\\n` +\n ' Your app/ directory has no page.tsx or route.ts files.\\n' +\n ' Every request will return 404.\\n\\n' +\n ' To fix: Create app/page.tsx with a default export:\\n\\n' +\n ' export default function Home() {\\n return <h1>Hello</h1>;\\n }\\n',\n level: 'warn',\n });\n}\n\n/**\n * Check if a segment tree has any routable files (page or route) anywhere.\n */\nfunction hasAnyRoutable(node: SegmentNode): boolean {\n if (node.page || node.route) return true;\n for (const child of node.children) {\n if (hasAnyRoutable(child)) return true;\n }\n for (const slot of Object.values(node.slots)) {\n if (hasAnyRoutable(slot)) return true;\n }\n return false;\n}\n\n/**\n * Check if a segment tree has any page files (not just route handlers).\n * Used by checkRootLayout to avoid false positives for API-only apps (TIM-794).\n * API-only apps (just route.ts handlers) don't need a root layout.\n */\nfunction hasAnyPage(node: SegmentNode): boolean {\n if (node.page) return true;\n for (const child of node.children) {\n if (hasAnyPage(child)) return true;\n }\n for (const slot of Object.values(node.slots)) {\n if (hasAnyPage(slot)) return true;\n }\n return false;\n}\n\n// ─── Check: Route Exports ───────────────────────────────────────────────────\n\n/** HTTP methods that route.ts can export. */\nconst HTTP_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'] as const;\n\n/**\n * Warn when a route.ts file doesn't appear to export any recognized HTTP methods.\n *\n * Uses AST-based detection via parseAst for precise matching.\n * Falls back silently when the file can't be parsed (syntax errors produce\n * no spurious warning — the TS compiler will catch those).\n */\nfunction checkRouteExports(node: SegmentNode, warnings: ConventionWarning[]): void {\n if (node.route) {\n const filePath = node.route.filePath;\n try {\n const methods = fileHasAnyExport(filePath, HTTP_METHODS);\n if (methods.size === 0 && !fileHasStarExport(filePath)) {\n const hasDefault = fileHasDefaultExport(filePath);\n const hint = hasDefault\n ? ' It looks like you have a default export. route.ts uses named exports\\n' +\n ' for HTTP methods (GET, POST, etc.), not a default export.\\n'\n : '';\n\n warnings.push({\n id: 'ROUTE_NO_METHODS',\n summary: `route.ts has no HTTP method exports: ${filePath}`,\n details:\n ` File: ${filePath}\\n\\n` +\n ' route.ts files must export named HTTP method handlers.\\n' +\n ' Without them, the route matches but returns 405 Method Not Allowed.\\n\\n' +\n hint +\n ' Example:\\n\\n' +\n ' export function GET(ctx: RouteContext) {\\n' +\n \" return Response.json({ hello: 'world' });\\n\" +\n ' }\\n',\n level: 'warn',\n });\n }\n } catch (err) {\n swallow(err, `convention-lint: unreadable route.ts ${filePath}`);\n }\n }\n\n // Recurse\n for (const child of node.children) {\n checkRouteExports(child, warnings);\n }\n for (const slot of Object.values(node.slots)) {\n checkRouteExports(slot, warnings);\n }\n}\n\n// ─── Check: Root Layout ─────────────────────────────────────────────────────\n\n/**\n * Warn when the root segment has no layout.tsx.\n *\n * Without a root layout, there's no HTML shell (<html>, <body>).\n * The page will render but may have hydration issues or no proper document structure.\n */\nfunction checkRootLayout(root: SegmentNode, warnings: ConventionWarning[]): void {\n if (root.layout) return;\n\n // Only warn if there are pages — API-only apps (just route.ts handlers)\n // don't need a root layout (TIM-794).\n if (!hasAnyPage(root)) return;\n\n warnings.push({\n id: 'NO_ROOT_LAYOUT',\n summary: 'No root layout.tsx found',\n details:\n ' Your app has pages but no root layout.\\n' +\n ' Without app/layout.tsx, pages have no <html> or <body> wrapper.\\n\\n' +\n ' To fix: Create app/layout.tsx:\\n\\n' +\n ' export default function RootLayout({ children }: { children: React.ReactNode }) {\\n' +\n ' return (\\n' +\n ' <html lang=\"en\">\\n' +\n ' <body>{children}</body>\\n' +\n ' </html>\\n' +\n ' );\\n' +\n ' }\\n',\n level: 'warn',\n });\n}\n\n// ─── Check: Default Exports ───────────────────────────────────────────\n\n/**\n * Warn when page.tsx or layout.tsx files don't have a default export.\n *\n * Without a default export:\n * - page.tsx: the page renders nothing (empty content)\n * - layout.tsx: the layout module loads but has no component to render\n *\n * Uses AST-based detection via parseAst for precise matching. Falls back\n * silently when the file can't be parsed (no spurious warning on syntax errors).\n */\nfunction checkDefaultExports(node: SegmentNode, warnings: ConventionWarning[]): void {\n // Check page files (tsx/ts/jsx/js only — not mdx, which is default-exported by the mdx compiler)\n if (node.page && isScriptExtension(node.page.extension)) {\n checkFileDefaultExport(node.page.filePath, 'page', warnings);\n }\n\n // Check layout files\n if (node.layout && isScriptExtension(node.layout.extension)) {\n checkFileDefaultExport(node.layout.filePath, 'layout', warnings);\n }\n\n // Recurse\n for (const child of node.children) {\n checkDefaultExports(child, warnings);\n }\n for (const slot of Object.values(node.slots)) {\n checkDefaultExports(slot, warnings);\n }\n}\n\nfunction isScriptExtension(ext: string): boolean {\n return ext === 'tsx' || ext === 'ts' || ext === 'jsx' || ext === 'js';\n}\n\nfunction checkFileDefaultExport(\n filePath: string,\n fileType: string,\n warnings: ConventionWarning[]\n): void {\n try {\n if (!fileHasDefaultExport(filePath)) {\n warnings.push({\n id: `NO_DEFAULT_EXPORT:${filePath}`,\n summary: `${fileType}.tsx has no default export: ${filePath}`,\n details:\n ` File: ${filePath}\\n\\n` +\n ` ${fileType}.tsx files must export a default React component.\\n` +\n ` Without a default export, the ${fileType === 'page' ? 'page renders nothing' : 'layout has no component to wrap children'}.\\n\\n` +\n ` To fix: Add a default export:\\n\\n` +\n ` export default function My${fileType === 'page' ? 'Page' : 'Layout'}(${fileType === 'layout' ? '{ children }' : ''}) {\\n` +\n ` return ${fileType === 'layout' ? '<div>{children}</div>' : '<h1>Hello</h1>'};\\n` +\n ` }\\n`,\n level: 'warn',\n });\n }\n } catch (err) {\n swallow(err, `convention-lint: unreadable ${fileType} file ${filePath}`);\n }\n}\n\n// ─── Check: Client Boundary Directive ───────────────────────────────────────\n\n/**\n * Check every file the renderer hands to `TimberErrorBoundary` as a component\n * prop: `error.tsx`, `global-error.tsx`, and the status-code family\n * (`404.tsx`, `4xx.tsx`, `503.tsx`, …).\n *\n * `TimberErrorBoundary` is a client component, so a server component passed as\n * `fallbackComponent` is a function crossing the RSC → client boundary. React\n * Flight refuses to serialize it, and because the boundary wraps the segment's\n * *children*, the failure hits every page under that segment — not just the\n * error path. The raw message (\"Functions cannot be passed directly to Client\n * Components\") names neither the file nor the fix (TIM-1329).\n *\n * `.json` status files never reach React at all, and are not in `statusFiles`.\n */\nfunction checkClientBoundaryFiles(node: SegmentNode, warnings: ConventionWarning[]): void {\n if (node.error) {\n checkFileUseClientDirective(node.error, 'error', warnings);\n }\n\n for (const [key, file] of Object.entries(node.statusFiles ?? {})) {\n checkFileUseClientDirective(file, key, warnings);\n }\n\n for (const child of node.children) {\n checkClientBoundaryFiles(child, warnings);\n }\n for (const slot of Object.values(node.slots)) {\n checkClientBoundaryFiles(slot, warnings);\n }\n}\n\n/**\n * `'client'` — carries the directive.\n * `'server'` — proven server component: no directive, and the default export is\n * a function or class built by this very module, so no other file's directive\n * can be governing it.\n * `'unknown'` — no directive, but the exported value may come from elsewhere\n * (`export { default } from './client-thing'`), or the file could not be\n * read or parsed. Never escalated to a build error.\n */\ntype ClientBoundaryVerdict = 'client' | 'server' | 'unknown';\n\nfunction classifyClientBoundaryFile(filePath: string): ClientBoundaryVerdict {\n if (fileHasDirective(filePath, 'use client')) return 'client';\n if (fileDefaultExportIsLocalValue(filePath)) return 'server';\n return 'unknown';\n}\n\n/** Example component name for the fix snippet, keyed by convention name. */\nfunction exampleComponentName(convention: string): string {\n if (convention === 'global-error') return 'GlobalError';\n if (convention === 'error') return 'ErrorBoundary';\n if (convention === '404') return 'NotFound';\n return 'StatusPage';\n}\n\n/**\n * @param file the route file (its extension decides whether the check applies)\n * @param convention the convention name — `error`, `global-error`, `404`, `4xx`, …\n */\nfunction checkFileUseClientDirective(\n file: RouteFile,\n convention: string,\n warnings: ConventionWarning[]\n): void {\n // Only script extensions need the 'use client' check — .json status files\n // never reach React at all, and are not in `statusFiles`.\n if (!isScriptExtension(file.extension)) return;\n\n const filePath = file.filePath;\n const label = `${convention}.${file.extension}`;\n let verdict: ClientBoundaryVerdict;\n try {\n verdict = classifyClientBoundaryFile(filePath);\n } catch (err) {\n swallow(err, `convention-lint: unreadable ${label} file ${filePath}`);\n return;\n }\n if (verdict === 'client') return;\n\n const isError = verdict === 'server';\n const name = exampleComponentName(convention);\n const props =\n convention === 'error' || convention === 'global-error' ? '{ error, reset }' : '{ status }';\n\n warnings.push({\n id: `NEEDS_USE_CLIENT:${filePath}`,\n summary: isError\n ? `${label} is a server component and must be a client component: ${filePath}`\n : `${label} may be missing 'use client': ${filePath}`,\n details:\n ` File: ${filePath}\\n\\n` +\n ` ${label} is handed to timber's error boundary — a client\\n` +\n ' component — as a prop. A server component cannot cross that boundary:\\n' +\n ' React fails with \"Functions cannot be passed directly to Client\\n' +\n ' Components\", and every page under this segment fails to render.\\n\\n' +\n (isError\n ? \" To fix: Add 'use client' as the first line of the file:\\n\\n\" +\n \" 'use client';\\n\\n\" +\n ` export default function ${name}(${props}) {\\n` +\n ' return <h1>…</h1>;\\n' +\n ' }\\n'\n : // The default export comes from somewhere this analysis cannot follow\n // — a re-export, an imported binding, a wrapper call. It may well\n // already be a client component, so say what was checked rather than\n // assert a break.\n \" This file has no 'use client' directive, and its default export\\n\" +\n ' comes from elsewhere, so timber cannot tell which it is. If the\\n' +\n \" module it re-exports starts with 'use client', nothing is wrong\\n\" +\n ' and you can ignore this. Otherwise add the directive there.\\n'),\n level: isError ? 'error' : 'warn',\n });\n}\n\n// ─── Check: App Directory Exists ────────────────────────────────────────────\n\n/**\n * Check if the app/ directory exists. Called before scanning.\n * Returns a warning if missing, or null if the directory exists.\n */\nexport function checkAppDirExists(appDir: string): ConventionWarning | null {\n if (existsSync(appDir)) return null;\n\n return {\n id: 'NO_APP_DIR',\n summary: 'No app/ directory found',\n details:\n ` Expected: ${appDir}\\n\\n` +\n ' timber.js requires an app/ directory for file-system routing.\\n' +\n ' Every request will return 404 until you create it.\\n\\n' +\n ' To fix: Create the app/ directory with a page:\\n\\n' +\n ' mkdir -p app\\n' +\n ' # Create app/layout.tsx and app/page.tsx\\n',\n level: 'error',\n };\n}\n\n// ─── Formatting ─────────────────────────────────────────────────────────────\n\nimport type { InspectColor } from 'node:util';\nimport { styleText } from 'node:util';\n\ntype Format = InspectColor | readonly InspectColor[];\nconst noValidate = { validateStream: false } as const;\n\nexport interface FormatOptions {\n /**\n * Emit ANSI escapes. Off when the text becomes an `Error` message —\n * whoever prints it decides its formatting, and colored escapes inside\n * an exception leak into logs and stack traces.\n */\n color?: boolean;\n}\n\n/**\n * Format warnings for terminal output.\n *\n * Groups by severity, uses colors, and includes fix suggestions.\n */\nexport function formatConventionWarnings(\n warnings: ConventionWarning[],\n options: FormatOptions = {}\n): string {\n const { color = true } = options;\n const style = (fmt: Format, text: string) => (color ? styleText(fmt, text, noValidate) : text);\n if (warnings.length === 0) return '';\n\n const errors = warnings.filter((w) => w.level === 'error');\n const warns = warnings.filter((w) => w.level === 'warn');\n\n const lines: string[] = [];\n\n if (errors.length > 0) {\n lines.push(\n `${style(['red', 'bold'], '[timber]')} ${style('red', `${errors.length} configuration error${errors.length !== 1 ? 's' : ''}:`)}`\n );\n for (const e of errors) {\n lines.push('');\n lines.push(` ${style('red', '✗')} ${e.summary}`);\n lines.push(style('dim', e.details));\n }\n }\n\n if (warns.length > 0) {\n if (errors.length > 0) lines.push('');\n lines.push(\n `${style(['yellow', 'bold'], '[timber]')} ${style('yellow', `${warns.length} configuration warning${warns.length !== 1 ? 's' : ''}:`)}`\n );\n for (const w of warns) {\n lines.push('');\n lines.push(` ${style('yellow', '⚠')} ${w.summary}`);\n lines.push(style('dim', w.details));\n }\n }\n\n return lines.join('\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,SAAgB,mBAAmB,MAAiB,QAA0C;CAC5F,MAAM,sBAAM,IAAI,IAAyB;CAEzC,SAAS,KAAK,MAAmB,QAAgB,UAAwB;EACvE,IAAI,IAAI,QAAQ;GACd,OAAO,KAAK,WAAW;GACvB,aAAa,YAAY;EAC3B,CAAC;EAED,KAAK,MAAM,SAAS,KAAK,UAGvB,KAAK,OAFY,KAAK,QAAQ,MAAM,WAExB,GAAU,GADG,SAAS,GAAG,MAAM,aACR;EAErC,KAAK,MAAM,CAAC,UAAU,aAAa,OAAO,QAAQ,KAAK,KAAK,GAG1D,KAAK,UAFW,KAAK,QAAQ,IAAI,UAElB,GAAS,GADA,SAAS,IAAI,UACD;CAExC;CAEA,KAAK,KAAK,MAAM,QAAQ,EAAE;CAC1B,OAAO;AACT;;;;AAKA,SAAgB,mBAAmB,MAA2B;CAC5D,OAAO;EACL,wBAAwB,KAAK,MAAM;EACnC,+BAA+B,KAAK,YAAY;EAChD;CACF,CAAC,CAAC,KAAK,IAAI;AACb;;;;;;AAOA,eAAsB,kBACpB,WACA,QACA,MACe;CAGf,MAAM,WAAW,OAAO,MAAM,KAAK,SAAS,CAAC;CAC7C,MAAM,YAAY,KAAK,MAAM,WAAW,SAAS,QAAQ;CACzD,MAAM,MAAM,mBAAmB,WAAW,MAAM;CAEhD,MAAM,SAA0B,CAAC;CACjC,KAAK,MAAM,CAAC,OAAO,SAAS,KAAK;EAE/B,MAAM,SAAS,MAAM,MAAM,OAAO,MAAM;EACxC,MAAM,aAAa,KAAK,WAAW,MAAM;EACzC,MAAM,cAAc,KAAK,YAAY,eAAe;EACpD,MAAM,UAAU,mBAAmB,IAAI;EAEvC,OAAO,KACL,MAAM,YAAY,EAAE,WAAW,KAAK,CAAC,CAAC,CAAC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