MCPcopy Create free account
hub / github.com/arktypeio/arktype / parseModule

Function parseModule

ark/aot/module.ts:143–151  ·  view source on GitHub ↗
(id: string, source: string)

Source from the content-addressed store, hash-verified

141
142// a module's tree, read in the language its id names
143export const parseModule = (id: string, source: string): ParseResult => {
144 const result = parse(id, source, langOf(id))
145 // Next and other tools allow JSX in a .js module
146 if (result.errors.length && id.endsWith(".js")) {
147 const jsx = parse(id, source, "jsx")
148 if (!jsx.errors.length) return jsx
149 }
150 return result
151}
152
153// oxc's raw transfer reads a tree several times faster than its JSON, through
154// a buffer reserving 6 GiB of address space, which Windows commits

Callers 2

tokensOfFunction · 0.90
constructorMethod · 0.85

Calls 2

langOfFunction · 0.85
parseFunction · 0.70

Tested by

no test coverage detected