(source: string)
| 159 | id: SourceModule.getModuleId(filepath), |
| 160 | filepath, |
| 161 | addSource(source: string) { |
| 162 | if (sources.has(source)) { |
| 163 | return null |
| 164 | } |
| 165 | |
| 166 | const extension = path.extname(source) |
| 167 | if (extension !== '' && extensions.includes(extension)) { |
| 168 | return null |
| 169 | } |
| 170 | |
| 171 | const resolved = resolve(source, mod.filepath) |
| 172 | if (resolved.type === 'error') { |
| 173 | // eslint-disable-next-line no-console |
| 174 | console.log('Unable to resolve source') |
| 175 | // eslint-disable-next-line no-console |
| 176 | console.log(resolved.error) |
| 177 | return null |
| 178 | } |
| 179 | |
| 180 | if (resolved.type === 'relative') { |
| 181 | queue.push(resolved.value) |
| 182 | const id = SourceModule.getModuleId(resolved.value) |
| 183 | mod.addDependency(id) |
| 184 | sources.set(source, id) |
| 185 | } |
| 186 | |
| 187 | if (resolved.type === 'bare') { |
| 188 | const id = BareModule.getModuleId(resolved.path) |
| 189 | if (!graph.has(id)) { |
| 190 | graph.set(id, BareModule.create(resolved.path)) |
| 191 | } |
| 192 | mod.addDependency(id) |
| 193 | sources.set(source, id) |
| 194 | } |
| 195 | |
| 196 | if (resolved.type === 'absolute') { |
| 197 | throw new Error('Unimplemented') |
| 198 | } |
| 199 | |
| 200 | return resolved |
| 201 | }, |
| 202 | getSourceModuleId(source: string) { |
| 203 | if (sources.has(source)) { |
| 204 | return sources.get(source) |
nothing calls this directly
no test coverage detected