| author | |
| committer | |
| log | 044a6e168ad1eb213c2c7c277034e65c638cc937 |
| tree | 567d05a4ef93af1fa9b1b4103a9ed7a1d60fc7eb |
| parent | eda0cec92398a4097958b55accaa59fdd178a977 |
| signature | Signed by PGP key B5690EEEBB952194 |
2 files changed, 0 insertions(+), 19 deletions(-)
packages/client-runtime/src/markdownLinks.test.ts-10| ... | ... | @@ -3,7 +3,6 @@ import { describe, expect, it } from "vite-plus/test"; |
| 3 | 3 | import { |
| 4 | 4 | fileBasename, |
| 5 | 5 | inlineCodeFilePathCandidate, |
| 6 | isConventionalFilePosition, | |
| 7 | 6 | parseFileUrlHref, |
| 8 | 7 | parseMarkdownFileLink, |
| 9 | 8 | splitFilePathPosition, |
| ... | ... | @@ -28,15 +27,6 @@ describe("inlineCodeFilePathCandidate", () => { |
| 28 | 27 | }); |
| 29 | 28 | }); |
| 30 | 29 | |
| 31 | describe("isConventionalFilePosition", () => { | |
| 32 | it("distinguishes extensionless file locations from labels and ports", () => { | |
| 33 | expect(isConventionalFilePosition("Dockerfile:8:2")).toBe(true); | |
| 34 | expect(isConventionalFilePosition("Makefile")).toBe(false); | |
| 35 | expect(isConventionalFilePosition("TODO:12")).toBe(false); | |
| 36 | expect(isConventionalFilePosition("port:3000")).toBe(false); | |
| 37 | }); | |
| 38 | }); | |
| 39 | ||
| 40 | 30 | describe("parseFileUrlHref", () => { |
| 41 | 31 | it.each([ |
| 42 | 32 | ["file:///Users/julius/project/src/main.ts#L42", "/Users/julius/project/src/main.ts", "#L42"], |
packages/client-runtime/src/markdownLinks.ts-9| ... | ... | @@ -15,7 +15,6 @@ const INLINE_CODE_DISQUALIFIER_PATTERN = /[\s`]/; |
| 15 | 15 | const PATH_SEPARATOR_PATTERN = /[\\/]/; |
| 16 | 16 | const FILE_EXTENSION_PATTERN = /\.[A-Za-z0-9_-]+$/; |
| 17 | 17 | const NUMERIC_DOTTED_PATTERN = /^\d+(?:\.\d+)+$/; |
| 18 | const BARE_EXTENSIONLESS_POSITION_PATTERN = /^[A-Za-z0-9_-]+(?::\d+){1,2}$/; | |
| 19 | 18 | // Standard OS and dev-container roots; deliberately excludes app-route-ish |
| 20 | 19 | // prefixes like /app/ or /chat/ so SPA routes never read as files. |
| 21 | 20 | const POSIX_FILE_ROOT_PREFIXES = [ |
| ... | ... | @@ -152,14 +151,6 @@ function looksLikeHostname(segment: string, hasPosition: boolean): boolean { |
| 152 | 151 | return !hasPosition && COUNTRY_HOSTNAME_TLDS.has(lastLabel); |
| 153 | 152 | } |
| 154 | 153 | |
| 155 | /** Recognizes conventional extensionless filenames with an explicit line position. */ | |
| 156 | export function isConventionalFilePosition(path: string): boolean { | |
| 157 | return ( | |
| 158 | BARE_EXTENSIONLESS_POSITION_PATTERN.test(path) && | |
| 159 | EXTENSIONLESS_FILE_NAMES.has(path.replace(POSITION_SUFFIX_PATTERN, "")) | |
| 160 | ); | |
| 161 | } | |
| 162 | ||
| 163 | 154 | /** |
| 164 | 155 | * Picks path-shaped inline code for the client's markdown file-link resolver. |
| 165 | 156 | * It does not resolve paths or turn plain prose and fenced code into links. |