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

Function getProgramPath

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

Source from the content-addressed store, hash-verified

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