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

Method add

ark/aot/graph.ts:1236–1245  ·  view source on GitHub ↗
(id: string, source: string, mappings?: string)

Source from the content-addressed store, hash-verified

1234 }
1235
1236 add(id: string, source: string, mappings?: string): SourceModule {
1237 const existing = this.modulesById[id]
1238 // a program evaluates a module once, so it stays as the graph holds it
1239 if (existing instanceof SourceModule && existing.source === source)
1240 return existing
1241 if (existing) this.forget([id])
1242 const module = new SourceModule(id, source, this.pathOf(id), mappings)
1243 this.modulesById[id] = module
1244 return module
1245 }
1246
1247 // modules read again, as each importer read the previous version, so it's
1248 // evaluated again: the modules it held of them and their importers

Callers 15

interpretFunction · 0.95
dependenciesOfMethod · 0.45
exportOfMethod · 0.45
kindOfKeyMethod · 0.45
declaredTypeKindOfMethod · 0.45
findExportedTypeMethod · 0.45
propTypesOfMethod · 0.45
targetKindOfMethod · 0.45
holderKindOfMethod · 0.45
memberKindInMethod · 0.45
alternativesOfMethod · 0.45
mayDeclareMethod · 0.45

Calls 6

forgetMethod · 0.95
pathOfMethod · 0.95
resolveMethod · 0.65
getMethod · 0.65
pushMethod · 0.45
setMethod · 0.45

Tested by 1

interpretFunction · 0.76