JavaScript Code Analysis
Comprehensive analysis of JavaScript applications from legacy ES5 codebases to modern ESM modules
What Axiom Refract Analyzes in JavaScript
CommonJS and ESM Resolution
Resolves both CommonJS require() calls and ES module import statements, including dynamic import() expressions. Handles mixed-mode codebases where CJS and ESM coexist across different files.
Framework Component Mapping
Identifies component hierarchies in React (JSX), Vue (SFC), Svelte, and Angular applications. Maps prop flow, event emission patterns, and slot/portal relationships across component trees.
Node.js Backend Analysis
Traces Express/Koa/Fastify route handlers, middleware chains, and service dependencies. Maps the architectural structure of Node.js backend services including database client usage and queue consumer patterns.
Prototype Chain Analysis
Handles legacy JavaScript patterns including prototype-based inheritance, IIFE module patterns, and revealing module patterns. Extracts structural relationships from pre-class JavaScript codebases.
How It Works
JavaScript is parsed using a hand-hardened Tree-sitter grammar supporting ECMAScript 2024, including top-level await, import assertions, record and tuple syntax proposals, and all stage 4 decorators. The parser handles JSX natively without requiring a separate grammar. CommonJS require() calls are resolved with Node.js-compatible module resolution including node_modules traversal, package.json main/exports fields, and directory index file resolution.
Common Findings in JavaScript Codebases
Mixed Module System Complexity
JavaScript codebases transitioning from CommonJS to ESM often contain both module systems simultaneously. Axiom detects mixed-mode usage and identifies files where module system boundaries create interoperability risks.
Callback Hell Dependency Chains
Legacy JavaScript codebases contain deeply nested callback patterns that create implicit dependency chains invisible to standard import analysis. Axiom traces these chains through event emitter patterns and callback registrations.
Global Scope Pollution
JavaScript files that attach properties to global/window objects create hidden dependencies between files that share no import relationship. Axiom detects global scope mutations and flags the coupling they create.
Polyglot Support
JavaScript is one of 145+ languages Axiom Refract supports through Tree-sitter AST parsing. JavaScript analysis covers package.json, package-lock.json, yarn.lock, pnpm-lock.yaml, .babelrc, webpack.config.js, vite.config.js, rollup.config.js, and browserslist configurations. Both browser and Node.js targeting is detected and handled appropriately in dependency resolution. Your entire codebase is analyzed in a single scan — regardless of how many languages it contains.