Skip to content

reactant-analyzer v0.3.0

Choose a tag to compare

@rboudrouss rboudrouss released this 27 Aug 11:44
· 127 commits to main since this release

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 when src/app or src/pages is
    there), tsconfig paths, and TypeScript's baseUrl last resort for a
    bare specifier — the vercel/commerce shape, "baseUrl": "." with no
    paths at all. --project next forces 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
    ModuleTable carried from lowering to the analysis result. Value
    imports only: import type is 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
    (a page.tsx that 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/router and next/compat/router hooks are
    known to the analyzer instead of reported as unknown; usePathname is
    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.