(ids: string[])
| 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 |
| 1249 | forget(ids: string[]): SourceModule[] { |
| 1250 | const dropped = [...ids] |
| 1251 | for (let i = 0; i < dropped.length; i++) { |
| 1252 | for (const importer in this.importsById) { |
| 1253 | if ( |
| 1254 | this.importsById[importer].includes(dropped[i]) && |
| 1255 | !dropped.includes(importer) |
| 1256 | ) |
| 1257 | dropped.push(importer) |
| 1258 | } |
| 1259 | } |
| 1260 | const forgotten: SourceModule[] = [] |
| 1261 | for (const droppedId of dropped) { |
| 1262 | delete this.importsById[droppedId] |
| 1263 | const module = this.modulesById[droppedId] |
| 1264 | if (module instanceof SourceModule) forgotten.push(module) |
| 1265 | if (ids.includes(droppedId)) delete this.modulesById[droppedId] |
| 1266 | else if (module instanceof SourceModule) { |
| 1267 | this.modulesById[droppedId] = new SourceModule( |
| 1268 | droppedId, |
| 1269 | module.source, |
| 1270 | module.path |
| 1271 | ) |
| 1272 | } |
| 1273 | } |
| 1274 | this.exportedTypesByModule = new WeakMap() |
| 1275 | this.declaredTypeKinds.clear() |
| 1276 | return forgotten |
| 1277 | } |
| 1278 | |
| 1279 | moduleOf(id: string): SourceModule | ImportTarget { |
| 1280 | return (this.modulesById[id] ??= this.load(id, this.pathOf(id))) |
no test coverage detected