module
Analyzer::Specification::GraphqlTypedefs
Overview
Shared extractor for inline typeDefs template literals, used by the
Apollo Server and GraphQL Yoga analyzers. Returns (SDL, line_offset)
pairs — the SDL string carried by each typeDefs backtick template and
the 0-based source line where it begins.
The whole scan runs over an Array(Char) rather than indexing the
String directly. String#[](Int) is O(n) whenever the source is not
single-byte-optimizable, so a single multi-byte char (an emoji in a
JS comment or a """description""") would otherwise make the per-char
template walk quadratic — ~6 s on a 120 KB file vs ~0.2 ms here.
Extended Modules
Defined in:
analyzer/analyzers/specification/graphql_typedefs.crConstant Summary
-
TYPEDEFS_PATTERN =
/\btypeDefs\s*[:=]\s*/
Instance Method Summary
-
#extract(content : String, skip_js_comments : Bool = false) : Array(Tuple(String, Int32))
skip_js_commentsskips/* GraphQL *//// ...between the assignment and the value — Yoga idiomatically annotates the literal that way; Apollo does not, so it opts out.
Instance Method Detail
skip_js_comments skips /* GraphQL */ / // ... between the
assignment and the value — Yoga idiomatically annotates the literal
that way; Apollo does not, so it opts out.