class

Analyzer::Javascript::CloudflarePages

Inherits Analyzer::Javascript::ServerlessFunctionSupport < Analyzer::Javascript::JavascriptEngine < Analyzer < FileHelper < Reference < Object

Cloudflare Pages Functions: every module under a project's functions/ directory is a route, its path mirroring the file path.

functions/api/users/[id].ts -> /api/users/{id} functions/api/files/[[path]].ts -> /api/files/{path} (catch-all) functions/index.ts -> /

onRequestGet / onRequestPost / ... exports serve one method each; onRequest serves every method without a dedicated export. The _middleware modules wrap routes and aren't routes themselves. Rules follow wrangler's pages functions build (filepath-routing.ts).

Constants

CATCH_ALL_EXPORT = "onRequest"
EXTENSIONS = [".js", ".mjs", ".ts", ".tsx", ".jsx"]

The extensions wrangler routes (no .cjs / .mts).

VERB_EXPORTS = {"onRequestGet" => "GET", "onRequestPost" => "POST", "onRequestPut" => "PUT", "onRequestPatch" => "PATCH", "onRequestDelete" => "DELETE", "onRequestHead" => "HEAD", "onRequestOptions" => "OPTIONS"}

Class methods

tech_name
Source

Instance methods

analyze
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source