(ctx, directory, visited, callback)
| 340 | * @param {ResolveDependenciesCallback} callback callback |
| 341 | */ |
| 342 | const addDirectoryChecked = (ctx, directory, visited, callback) => { |
| 343 | /** @type {NonNullable<InputFileSystem["realpath"]>} */ |
| 344 | (fs.realpath)(directory, (err, _realPath) => { |
| 345 | if (err) return callback(err); |
| 346 | const realPath = /** @type {string} */ (_realPath); |
| 347 | if (visited.has(realPath)) return callback(null, []); |
| 348 | /** @type {Set<string> | undefined} */ |
| 349 | let recursionStack; |
| 350 | addDirectory( |
| 351 | ctx, |
| 352 | directory, |
| 353 | (_, dir, callback) => { |
| 354 | if (recursionStack === undefined) { |
| 355 | recursionStack = new Set(visited); |
| 356 | recursionStack.add(realPath); |
| 357 | } |
| 358 | addDirectoryChecked(ctx, dir, recursionStack, callback); |
| 359 | }, |
| 360 | callback |
| 361 | ); |
| 362 | }); |
| 363 | }; |
| 364 | |
| 365 | /** |
| 366 | * Adds the provided ctx to the context module factory. |
nothing calls this directly
no test coverage detected