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

Function createPrecompiler

ark/aot/driver.ts:53–69  ·  view source on GitHub ↗
(
	opts?: PrecompilePluginOptions
)

Source from the content-addressed store, hash-verified

51 NodeHostOptions {}
52
53export const createPrecompiler = (
54 opts?: PrecompilePluginOptions
55): Precompiler => {
56 const cwd = realPathOf(opts?.cwd ?? process.cwd())
57 // a key matching no file would choose for nothing. Read here, where a
58 // build first asks of a module, as only then is cwd the bundler's root
59 if (opts?.runtime !== "arktype")
60 new SchemaStrategies(opts ?? {}, "speed", cwd).checkFiles()
61 return new Precompiler(createNodeHost(opts), {
62 ...opts,
63 cwd,
64 config:
65 typeof opts?.config === "string" ?
66 realPathOf(resolve(cwd, opts.config))
67 : opts?.config
68 })
69}
70
71export interface RenderedDiagnostics {
72 errors: string[]

Callers 2

createTrackedPrecompilerFunction · 0.85
cache.test.tsFile · 0.85

Calls 4

realPathOfFunction · 0.90
createNodeHostFunction · 0.90
checkFilesMethod · 0.80
resolveFunction · 0.70

Tested by

no test coverage detected