* throws an error if the protocol is not one of the protocols * that can be loaded in the default loader * @param {URL} parsed
(parsed)
| 177 | * @param {URL} parsed |
| 178 | */ |
| 179 | function throwIfUnsupportedURLScheme(parsed) { |
| 180 | // Avoid accessing the `protocol` property due to the lazy getters. |
| 181 | const protocol = parsed?.protocol; |
| 182 | if ( |
| 183 | protocol && |
| 184 | protocol !== 'file:' && |
| 185 | protocol !== 'data:' && |
| 186 | protocol !== 'node:' && |
| 187 | ( |
| 188 | protocol !== 'https:' && |
| 189 | protocol !== 'http:' |
| 190 | ) |
| 191 | ) { |
| 192 | const schemes = ['file', 'data', 'node']; |
| 193 | throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed, schemes); |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * For a falsy `format` returned from `load`, throw an error. |
no outgoing calls
no test coverage detected
searching dependent graphs…