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

Function parseCode

ark/aot/module.ts:179–197  ·  view source on GitHub ↗
(
	id: string,
	source: string,
	options: ParserOptions
)

Source from the content-addressed store, hash-verified

177}
178
179export const parseCode = (
180 id: string,
181 source: string,
182 options: ParserOptions
183): ParseResult => {
184 if (readsRaw && importsWithinRaw(source)) {
185 try {
186 return parseSync(id, source, {
187 ...options,
188 experimentalRawTransfer: true
189 } as ParserOptions)
190 } catch (e) {
191 // a process that can't reserve the buffer reads JSON
192 if (!(e instanceof RangeError)) throw e
193 readsRaw = false
194 }
195 }
196 return parseSync(id, source, options)
197}
198
199type Lang = "js" | "jsx" | "ts" | "tsx"
200

Callers 4

parseUnitsFunction · 0.90
shapeOfCodeFunction · 0.90
parseValidatorsFunction · 0.90
parseFunction · 0.85

Calls 1

importsWithinRawFunction · 0.85

Tested by

no test coverage detected