* @param {string} filename * @returns {string}
(filename)
| 124 | * @returns {string} |
| 125 | */ |
| 126 | function convertCJSFilenameToURL(filename) { |
| 127 | if (!filename) { return filename; } |
| 128 | let normalizedId = filename; |
| 129 | if (StringPrototypeStartsWith(filename, 'node:')) { |
| 130 | normalizedId = StringPrototypeSlice(filename, 5); |
| 131 | } |
| 132 | if (BuiltinModule.canBeRequiredByUsers(normalizedId)) { |
| 133 | return `node:${normalizedId}`; |
| 134 | } |
| 135 | // Handle the case where filename is neither a path, nor a built-in id, |
| 136 | // which is possible via monkey-patching. |
| 137 | if (isAbsolute(filename)) { |
| 138 | return pathToFileURL(filename).href; |
| 139 | } |
| 140 | return filename; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * @param {string} url |
no test coverage detected
searching dependent graphs…