class

Analyzer::Javascript::Apollo

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

Apollo Server analyzer.

Extracts endpoints from two surfaces:

  1. Inline typeDefs declarations carried in a backtick template literal (typeDefs = gql\...`ortypeDefs = `#graphql ...``), parsed via the shared GraphQL SDL parser.
  2. The mount path — either an Express app.use('/path', expressMiddleware(...)) position or the standalone default of /graphql.

Schema-first setups that load typeDefs from a separate .graphql file (import typeDefs from './schema.graphql') are handled by the graphql_sdl analyzer, so no work is duplicated here.

Constants

APOLLO_HINTS_RE = Regex.union("@apollo/server", "apollo-server", "ApolloServer")

File-level signals that mark a JS/TS file as Apollo-relevant. The parallel_file_scan walks every JS/TS source, so we gate with a cheap substring check before doing the heavier SDL extraction. Precompiled once — a single PCRE2-JIT scan replaces three naive String#includes? substring scans. Regex.union auto-escapes each literal, so it is provably equivalent to the OR-of-includes? it replaces.

DEFAULT_GRAPHQL_PATH = "/graphql"

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