MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / resolveTarget

Function resolveTarget

apps/docs/scripts/check-fragments.mjs:36–44  ·  view source on GitHub ↗

Resolve a site-absolute path ("/api/acl/") to its built HTML file.

(sitePath)

Source from the content-addressed store, hash-verified

34
35/** Resolve a site-absolute path ("/api/acl/") to its built HTML file. */
36function resolveTarget(sitePath) {
37 const rel = sitePath.replace(/^\//, "").replace(/\/$/, "");
38 const candidates =
39 rel === ""
40 ? [join(DIST, "index.html")]
41 : [join(DIST, rel, "index.html"), join(DIST, `${rel}.html`), join(DIST, rel)];
42
43 return candidates.find((file) => existsSync(file) && statSync(file).isFile());
44}
45
46const idCache = new Map();
47

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected