MCPcopy
hub / github.com/code-hike/codehike / compileAST

Function compileAST

packages/codehike/tests/utils.ast.tsx:20–41  ·  view source on GitHub ↗
(
  file: MDFile,
  config: (X: Pluggable) => CompileOptions,
)

Source from the content-addressed store, hash-verified

18const ignoreProperties = ["start", "end", "position", "loc", "range"]
19
20export async function compileAST(
21 file: MDFile,
22 config: (X: Pluggable) => CompileOptions,
23) {
24 let ast: any
25
26 const options = config(() => (tree) => {
27 ast = tree
28 })
29
30 await compile(file, options)
31
32 return await prettier.format(
33 JSON.stringify(ast, (key, value) =>
34 ignoreProperties.includes(key) ? undefined : value,
35 ),
36 {
37 semi: false,
38 parser: "json",
39 },
40 )
41}
42
43export async function compileJS(file: MDFile, options: CompileOptions) {
44 const r = await compile(file, options)

Callers 1

getStepOutputFunction · 0.90

Calls

no outgoing calls

Tested by 1

getStepOutputFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…