MCPcopy Create free account
hub / github.com/TanStack/cli / resolveSourceImport

Function resolveSourceImport

packages/create/tests/worker-manifest.test.ts:31–43  ·  view source on GitHub ↗
(from: string, specifier: string)

Source from the content-addressed store, hash-verified

29const packageDir = resolve(dirname(fileURLToPath(import.meta.url)), '..')
30
31function resolveSourceImport(from: string, specifier: string) {
32 const resolved = resolve(dirname(from), specifier)
33 const withoutJsExtension = specifier.endsWith('.js')
34 ? resolved.slice(0, -'.js'.length)
35 : resolved
36 const candidates = [
37 resolved,
38 `${withoutJsExtension}.ts`,
39 resolve(withoutJsExtension, 'index.ts'),
40 ]
41
42 return candidates.find((candidate) => existsSync(candidate))
43}
44
45function collectStaticImportGraph(entry: string) {
46 const visited = new Set<string>()

Callers 1

collectStaticImportGraphFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected