@devries-cameron20 / t3code-1 / commits / aca2afc0b5
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

refactor(shared): remove unused preview URL predicate (#9989)

Julius Marminge committed Sep 5, 2026 at 00:18 UTC aca2afc0b5400e4cf88c42d59b214240833ed9cd
2 files changed -30
packages/shared/src/preview.test.ts
-19
@@ -2,7 +2,6 @@ import { describe, expect, it } from "vite-plus/test";
2
3 import {
4 isLoopbackHost,
5 - isPreviewableUrl,
5 newPreviewTabId,
6 normalizePreviewUrl,
7 PreviewUrlNormalizationError,
@@ -27,24 +26,6 @@ describe("isLoopbackHost", () => {
26 });
27 });
28
30 -describe("isPreviewableUrl", () => {
31 - it.each([
32 - "http://localhost:5173",
33 - "http://127.0.0.1:3000/path",
34 - "http://0.0.0.0:8080",
35 - "http://[::1]:5173",
36 - ])("%s is previewable", (url) => {
37 - expect(isPreviewableUrl(url)).toBe(true);
38 - });
39 -
40 - it.each(["https://example.com", "ws://localhost:5173", "file:///etc/passwd", "not-a-url", ""])(
41 - "%s is not previewable",
42 - (url) => {
43 - expect(isPreviewableUrl(url)).toBe(false);
44 - },
45 - );
46 -});
47 -
29 describe("normalizePreviewUrl", () => {
30 it("treats bare loopback hosts as http", () => {
31 expect(normalizePreviewUrl("localhost:5173")).toBe("http://localhost:5173/");
packages/shared/src/preview.ts
-11
@@ -36,17 +36,6 @@ export function isLoopbackHost(host: string): boolean {
36 return false;
37 }
38
39 -/** True when a raw URL string looks like a loopback dev URL we can preview. */
40 -export function isPreviewableUrl(rawUrl: string): boolean {
41 - try {
42 - const parsed = new URL(rawUrl);
43 - if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return false;
44 - return isLoopbackHost(parsed.hostname);
45 - } catch {
46 - return false;
47 - }
48 -}
49 -
39 export class PreviewUrlNormalizationError extends Schema.TaggedErrorClass<PreviewUrlNormalizationError>()(
40 "PreviewUrlNormalizationError",
41 {