Skip to main content

Module resolve

Module resolve 

Source
Expand description

Import specifier resolution using oxc_resolver.

Orchestrates the resolution pipeline: for every extracted module, resolves all import specifiers in parallel (via rayon) to an ResolveResult — internal file, npm package, external file, or unresolvable. The entry point is resolve_all_imports.

Resolution is split into submodules by import kind:

  • static_imports — ES import declarations
  • dynamic_importsimport() expressions and glob-based dynamic patterns
  • require_imports — CommonJS require() calls
  • re_exportsexport { x } from './y' re-export sources
  • upgrades — post-resolution pass fixing non-deterministic bare specifier results

Handles tsconfig path aliases (auto-discovered per file), pnpm virtual store paths, React Native platform extensions, and package.json exports subpath resolution with output-to-source directory fallback.

Structs§

ResolvedImport
A resolved import with its target.
ResolvedModule
Fully resolved module with all imports mapped to targets.
ResolvedReExport
A resolved re-export with its target.

Enums§

ResolveResult
Result of resolving an import specifier.

Functions§

extract_package_name
Extract the npm package name from a specifier. @scope/pkg/foo/bar -> @scope/pkg lodash/merge -> lodash
is_bare_specifier
Check if a specifier is a bare specifier (npm package or Node.js imports map entry).
is_path_alias
Check if a bare specifier looks like a path alias rather than an npm package.
resolve_all_imports
Resolve all imports across all modules in parallel.