authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 00:09:44-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 00:09:44-07:00
log044a6e168ad1eb213c2c7c277034e65c638cc937
tree567d05a4ef93af1fa9b1b4103a9ed7a1d60fc7eb
parenteda0cec92398a4097958b55accaa59fdd178a977
signature Signed by PGP key B5690EEEBB952194

refactor(client-runtime): remove unused file position predicate (#9976)


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,7 +3,6 @@ import { describe, expect, it } from "vite-plus/test";
3import {3import {
4 fileBasename,4 fileBasename,
5 inlineCodeFilePathCandidate,5 inlineCodeFilePathCandidate,
6 isConventionalFilePosition,
7 parseFileUrlHref,6 parseFileUrlHref,
8 parseMarkdownFileLink,7 parseMarkdownFileLink,
9 splitFilePathPosition,8 splitFilePathPosition,
...@@ -28,15 +27,6 @@ describe("inlineCodeFilePathCandidate", () => {...@@ -28,15 +27,6 @@ describe("inlineCodeFilePathCandidate", () => {
28 });27 });
29});28});
3029
31describe("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
40describe("parseFileUrlHref", () => {30describe("parseFileUrlHref", () => {
41 it.each([31 it.each([
42 ["file:///Users/julius/project/src/main.ts#L42", "/Users/julius/project/src/main.ts", "#L42"],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,7 +15,6 @@ const INLINE_CODE_DISQUALIFIER_PATTERN = /[\s`]/;
15const PATH_SEPARATOR_PATTERN = /[\\/]/;15const PATH_SEPARATOR_PATTERN = /[\\/]/;
16const FILE_EXTENSION_PATTERN = /\.[A-Za-z0-9_-]+$/;16const FILE_EXTENSION_PATTERN = /\.[A-Za-z0-9_-]+$/;
17const NUMERIC_DOTTED_PATTERN = /^\d+(?:\.\d+)+$/;17const NUMERIC_DOTTED_PATTERN = /^\d+(?:\.\d+)+$/;
18const BARE_EXTENSIONLESS_POSITION_PATTERN = /^[A-Za-z0-9_-]+(?::\d+){1,2}$/;
19// Standard OS and dev-container roots; deliberately excludes app-route-ish18// Standard OS and dev-container roots; deliberately excludes app-route-ish
20// prefixes like /app/ or /chat/ so SPA routes never read as files.19// prefixes like /app/ or /chat/ so SPA routes never read as files.
21const POSIX_FILE_ROOT_PREFIXES = [20const POSIX_FILE_ROOT_PREFIXES = [
...@@ -152,14 +151,6 @@ function looksLikeHostname(segment: string, hasPosition: boolean): boolean {...@@ -152,14 +151,6 @@ function looksLikeHostname(segment: string, hasPosition: boolean): boolean {
152 return !hasPosition && COUNTRY_HOSTNAME_TLDS.has(lastLabel);151 return !hasPosition && COUNTRY_HOSTNAME_TLDS.has(lastLabel);
153}152}
154153
155/** Recognizes conventional extensionless filenames with an explicit line position. */
156export 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 * Picks path-shaped inline code for the client's markdown file-link resolver.155 * Picks path-shaped inline code for the client's markdown file-link resolver.
165 * It does not resolve paths or turn plain prose and fenced code into links.156 * It does not resolve paths or turn plain prose and fenced code into links.