module

Noir::JSHandlerTable

The handler functions of one JS/TS module, read off the syntax tree: what it exports (export function GET, export const GET = ..., export { local as GET }, CommonJS exports.GET = ...), what it default-exports, the top-level functions it declares, and the inline config object. Each function carries its parameter text, its body (block contents or a bare expression), its lines and, on request, its callees.

One parse per file serves every lookup, so the file-routed adapters (Next.js, Cloudflare Pages, Vercel, Netlify, Medusa) do not slice bodies with brace counting: a return type Promise<{ ok: true }>, a ${ { a: 1 } } template or a } inside a regex literal cannot move a body boundary on a tree.

Constants

EMPTY_CALLEES = [] of JSCalleeExtractor::Entry
EMPTY_METHODS = [] of String
FUNCTION_TYPES = Set {"function_declaration", "generator_function_declaration", "function_expression", "generator_function", "arrow_function"}
KNOWN_METHODS = Set {"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"}
MAX_RESOLVE = 4
METHOD_PROPERTIES = Set {"method", "httpMethod"}

Instance methods

for(source : String, path : String, callees : Bool = false) : Table

The module's table. callees also records each function's callees (a separate cache entry, so scans that do not want them do not pay).

Source

Nested types