class
Analyzer::Javascript::Fastify
Defined in:
analyzer/analyzers/javascript/fastify.crConstant Summary
-
AUTO_PREFIX_RE =
/\bautoPrefix\s*=\s*['"]([^'"]+)['"]/ -
export const autoPrefix = '/x'(or CJSmodule.exports.autoPrefix = '/x') lets a route file declare its own autoload prefix. The\bautoPrefix\s*=\s*<string>shape matches the assignment but not a read likereply.redirect(autoPrefix). -
AUTOLOAD_MARKERS =
["@fastify/autoload", "fastify-autoload"] -
Markers that a file configures
@fastify/autoload. Both the scoped package and the legacy bare name are matched so older projects work. -
HTTP_METHODS =
["get", "post", "put", "delete", "patch", "options", "head"] of ::String -
ROUTE_CALL_RES =
HTTP_METHODS.map do |m| {m, /\b(?:fastify|app|server)\s*\.\s*#{m}\s*\(\s*['"]([^'"]+)['"]/} end.to_h -
Compiled once — an interpolated regex literal would otherwise be rebuilt (full PCRE2 compile) for every method on every line.
Instance Method Summary
- #analyze
- #extract_path_from_route_handler(line : String) : String
- #line_to_endpoint(line : String) : Endpoint
- #line_to_param(line : String) : Param