Volt.JS.TSConfig (Volt v0.9.0)

Copy Markdown View Source

Read compilerOptions.paths from tsconfig.json and convert to Volt aliases.

Automatically discovers tsconfig.json in the project root and maps TypeScript path aliases (e.g. "@/*": ["./src/*"]) to the format Volt's resolver expects.

Summary

Functions

Find and read tsconfig.json paths from the current working directory.

Read path aliases from tsconfig.json.

Functions

discover_paths()

@spec discover_paths() :: %{required(String.t()) => String.t()}

Find and read tsconfig.json paths from the current working directory.

read_paths(tsconfig_path)

@spec read_paths(String.t()) :: %{required(String.t()) => String.t()}

Read path aliases from tsconfig.json.

Returns a map of alias prefix to filesystem path, e.g.:

%{"@" => "/absolute/path/to/src"}

Glob suffixes (/*) are stripped from both keys and values. Only the first path in each mapping array is used.