Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

JavaScript / TypeScript

Manifest

package.json — extracts dependency names from dependencies, devDependencies, peerDependencies, and optionalDependencies.

Import scanning

Uses the OXC parser (Rust-native, faster than tree-sitter for JS/TS). Handles:

PatternConfidence
import x from 'pkg'high
const x = require('pkg')high
export { x } from 'pkg'high
export * from 'pkg'high
import('pkg') with string literalmedium
require(variable)low
import(expression)low

File extensions: .js, .jsx, .ts, .tsx, .mjs, .cjs, .mts, .cts

Normalization

  • Relative imports (./, ../, /) are skipped
  • Scoped: @scope/pkg/deep/path@scope/pkg
  • Unscoped: lodash/mergelodash
  • node:fsfs (then filtered as stdlib)

Stdlib detection

All Node.js built-in modules including the node: prefix. Covers fs, path, http, crypto, stream, child_process, etc.

Aliases

Minimal — most JS packages use their npm name directly.