MCPcopy Create free account
hub / github.com/TanStack/router / getProgramPath

Function getProgramPath

packages/router-plugin/tests/utils.test.ts:20–36  ·  view source on GitHub ↗
(code: string)

Source from the content-addressed store, hash-verified

18}
19
20function getProgramPath(code: string): NodePath<t.Program> {
21 const ast = parseAst({ code })
22 let programPath: NodePath<t.Program> | undefined
23
24 babel.traverse(ast, {
25 Program(path: NodePath<t.Program>) {
26 programPath = path
27 path.stop()
28 },
29 })
30
31 if (!programPath) {
32 throw new Error('Program path not found')
33 }
34
35 return programPath
36}
37
38describe('normalizePath', () => {
39 it('should convert Windows backslashes to forward slashes', () => {

Callers 1

utils.test.tsFile · 0.85

Calls 1

parseAstFunction · 0.90

Tested by

no test coverage detected