Resolve a site-absolute path ("/api/acl/") to its built HTML file.
(sitePath)
| 34 | |
| 35 | /** Resolve a site-absolute path ("/api/acl/") to its built HTML file. */ |
| 36 | function 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 | |
| 46 | const idCache = new Map(); |
| 47 |