MCPcopy
hub / github.com/formatjs/formatjs / labelToPath

Function labelToPath

tools/generate-package-tsconfigs.ts:39–50  ·  view source on GitHub ↗
(label: string)

Source from the content-addressed store, hash-verified

37}
38
39function labelToPath(label: string): string {
40 const trimmed = label.startsWith('//') ? label.slice(2) : label
41 const colonIdx = trimmed.indexOf(':')
42 const packageName = colonIdx >= 0 ? trimmed.slice(0, colonIdx) : ''
43 const targetName = colonIdx >= 0 ? trimmed.slice(colonIdx + 1) : ''
44
45 if (!packageName || targetName !== 'tsconfig_json_unformatted') {
46 throw new Error(`Unexpected tsconfig rule label: ${label}`)
47 }
48
49 return join(packageName, 'tsconfig.json')
50}
51
52function parseTsconfigLine(
53 line: string

Callers 1

parseTsconfigLineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected