reactant-analyzer v0.3.0
reactant-analyzer v0.3.0
The Next.js release (ADR-026):
-
Next.js projects are detected and analyzed with their own conventions:
router-aware discovery (src/only whensrc/apporsrc/pagesis
there), tsconfigpaths, and TypeScript'sbaseUrllast resort for a
bare specifier — the vercel/commerce shape,"baseUrl": "."with no
pathsat all.--project nextforces it; Next is detected before
Vite, since a Next app may keep a vite.config for its test runner. -
A module's directives and import edges are now IR facts.
ModuleFacts
per file (the"use client"/"use server"prologue oxc keeps apart
from the body, plus every edge the resolver mapped to a real file) in a
ModuleTablecarried from lowering to the analysis result. Value
imports only:import typeis erased before anything runs, so counting
it would drag a server module across a client boundary. -
New rule
server-component-hook: a hook called where React renders on
the server. A module is server-compiled iff it is reachable from an App
Router entry without crossing"use client"— so both the direct case
(apage.tsxthat forgot the directive) and the transitive one (a
shared component pulled into the server graph) are caught. Silent in
projects that never use the directive; one finding per component, not
per hook; other rules' findings in the same module are never
suppressed.Server Components are analyzed, not skipped. Skipping them would rest
on an import graph whose edges the resolver may have missed, turning
every misclassification into a false negative — and a Server Component
has no state, so the interpretation over-approximates it the way it
does any component whose props are unknown. -
next/navigation,next/routerandnext/compat/routerhooks are
known to the analyzer instead of reported as unknown;usePathnameis
modelled as a string, so a pathname dep never reads as unstable. -
Aliased imports now feed the cross-file relations: an aliased
import { Ctx } from "@/lib/ctx"is proven a context, which it was not
before.
Measured on eleven corpora, four of them new Next.js repositories chosen
for their resolution layouts: zero false positives from the new rule, and
every diff against v0.2.0 is either a removed unknown-hook Info (32) or a
revealed true positive (4). 1000 tests; the wasm wrapper stays
byte-identical to the native CLI.