MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / toProjectAbsolutePath

Function toProjectAbsolutePath

packages/studio/src/utils/studioHelpers.ts:59–73  ·  view source on GitHub ↗
(
  projectDir: string | null,
  sourceFile: string,
)

Source from the content-addressed store, hash-verified

57}
58
59export function toProjectAbsolutePath(
60 projectDir: string | null,
61 sourceFile: string,
62): string | undefined {
63 const trimmedSource = sourceFile.trim();
64 if (!trimmedSource) return undefined;
65
66 const normalizedSource = trimmedSource.replace(/\\/g, "/");
67 if (isAbsoluteFilePath(normalizedSource)) return normalizedSource;
68
69 const normalizedRoot = projectDir?.trim().replace(/\\/g, "/").replace(/\/+$/, "");
70 if (!normalizedRoot) return undefined;
71
72 return `${normalizedRoot}/${normalizedSource.replace(/^\.?\//, "")}`;
73}
74
75export function normalizeDomEditStyleValue(property: string, value: string): string {
76 const trimmed = value.trim();

Callers 1

useAskAgentModalFunction · 0.90

Calls 1

isAbsoluteFilePathFunction · 0.85

Tested by

no test coverage detected