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

Function precompiledSources

ark/repo/bundle.ts:194–223  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

192// the sources a precompiled program loads, through any package's runtime
193// entries, which keep their bytes as they're written
194const precompiledSources = (): Set<string> => {
195 const entries = Object.values(packagesByScope).flatMap(({ path, json }) =>
196 Object.entries(
197 json.exports as Record<string, { "ark-ts"?: unknown }>
198 ).flatMap(([subpath, target]) => {
199 const source = target["ark-ts"] as string | { default: string }
200 return (
201 subpath.startsWith("./runtime") ||
202 subpath.startsWith("./schema/runtime")
203 ) ?
204 [join(path, typeof source === "string" ? source : source.default)]
205 : []
206 })
207 )
208 const { metafile } = buildSync({
209 entryPoints: entries,
210 bundle: true,
211 format: "esm",
212 platform: "neutral",
213 conditions: ["ark-ts"],
214 absWorkingDir: repoDirs.root,
215 outdir: "out",
216 write: false,
217 metafile: true,
218 logLevel: "error"
219 })
220 return new Set(
221 Object.keys(metafile.inputs).map(input => join(repoDirs.root, input))
222 )
223}
224
225// the source tsc wrote an input of the bundle from
226const sourceOf = (input: string) =>

Callers 1

bundleFunction · 0.85

Calls 2

joinFunction · 0.85
mapMethod · 0.65

Tested by

no test coverage detected