MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / resolveLocalAssetCandidates

Function resolveLocalAssetCandidates

packages/lint/src/project.ts:129–150  ·  view source on GitHub ↗
(projectDir: string, url: string)

Source from the content-addressed store, hash-verified

127}
128
129function resolveLocalAssetCandidates(projectDir: string, url: string): string[] {
130 const cleanUrl = cleanAssetUrl(url);
131 const projectRoot = resolve(projectDir);
132 const candidates: string[] = [];
133
134 for (const variant of decodeUrlPathVariants(cleanUrl)) {
135 const projectRelative = variant.startsWith("/") ? variant.slice(1) : variant;
136 const resolved = resolve(projectRoot, projectRelative);
137 if (isWithinProjectRoot(projectRoot, resolved)) {
138 addCandidate(candidates, resolved);
139 continue;
140 }
141
142 const normalized = posix.normalize(projectRelative.replace(/\\/g, "/"));
143 const clamped = normalized.replace(/^(\.\.\/)+/, "");
144 if (clamped && !clamped.startsWith("..")) {
145 addCandidate(candidates, resolve(projectRoot, clamped));
146 }
147 }
148
149 return candidates;
150}
151
152function resolveExistingLocalAsset(
153 projectDir: string,

Callers 3

lintAudioSrcNotFoundFunction · 0.85

Calls 5

cleanAssetUrlFunction · 0.85
resolveFunction · 0.85
decodeUrlPathVariantsFunction · 0.85
isWithinProjectRootFunction · 0.85
addCandidateFunction · 0.70

Tested by

no test coverage detected