* Tries to get the absolute file path of the parent module. * @param {Module} parent The parent module object. * @returns {string|false|void}
(parent)
| 640 | * @returns {string|false|void} |
| 641 | */ |
| 642 | function trySelfParentPath(parent) { |
| 643 | if (!parent) { return false; } |
| 644 | |
| 645 | if (parent.filename) { |
| 646 | return parent.filename; |
| 647 | } else if (parent.id === '<repl>' || parent.id === 'internal/preload') { |
| 648 | try { |
| 649 | return process.cwd() + path.sep; |
| 650 | } catch { |
| 651 | return false; |
| 652 | } |
| 653 | } |
| 654 | } |
| 655 | |
| 656 | /** |
| 657 | * Attempt to resolve a module request using the parent module package metadata. |
no outgoing calls
no test coverage detected
searching dependent graphs…