pub struct PathAlias {
pub pattern: String,
pub targets: Vec<String>,
}Expand description
A single TypeScript compilerOptions.paths mapping, with each target
already joined to baseUrl and normalised to forward slashes.
pattern and targets are stored verbatim (no case-folding, no
hyphen normalisation) — TS module specifiers must match the literal text,
consistent with the JS/TS workspace-name handling elsewhere.
A pattern contains at most one * wildcard (TS’s rule). When present, the
captured substring is substituted into each target’s *.
Fields§
§pattern: StringThe import-specifier pattern, e.g. "@app/*" or "@config".
targets: Vec<String>Candidate target paths (baseUrl-joined), e.g. ["src/*"]. Tried in
declared order; the first that resolves to a real file wins.
Implementations§
Source§impl PathAlias
impl PathAlias
Sourcepub fn rewrite(&self, module: &str) -> Option<Vec<String>>
pub fn rewrite(&self, module: &str) -> Option<Vec<String>>
If module matches this alias, return its candidate target paths with
the wildcard capture substituted (in declared target order). Pure string
rewriting — the caller resolves each candidate against the real file set.
Returns None when the pattern does not match module.