@@ -32,6 +32,10 @@ const protocolHandlers = ObjectAssign(ObjectCreate(null), {
3232 'node:' ( ) { return 'builtin' ; } ,
3333} ) ;
3434
35+ /**
36+ * @param {URL } parsed
37+ * @returns {string | null }
38+ */
3539function getDataProtocolModuleFormat ( parsed ) {
3640 const { 1 : mime } = RegExpPrototypeExec (
3741 / ^ ( [ ^ / ] + \/ [ ^ ; , ] + ) (?: [ ^ , ] * ?) ( ; b a s e 6 4 ) ? , / ,
@@ -41,6 +45,12 @@ function getDataProtocolModuleFormat(parsed) {
4145 return mimeToFormat ( mime ) ;
4246}
4347
48+ /**
49+ * @param {URL } url
50+ * @param {{parentURL: string} } context
51+ * @param {boolean } ignoreErrors
52+ * @returns {string }
53+ */
4454function getFileProtocolModuleFormat ( url , context , ignoreErrors ) {
4555 const ext = extname ( url . pathname ) ;
4656 if ( ext === '.js' ) {
@@ -59,6 +69,11 @@ function getFileProtocolModuleFormat(url, context, ignoreErrors) {
5969 return getLegacyExtensionFormat ( ext ) ?? null ;
6070}
6171
72+ /**
73+ * @param {URL } url
74+ * @param {{parentURL: string} } context
75+ * @returns {Promise<string> | undefined } only works when enabled
76+ */
6277function getHttpProtocolModuleFormat ( url , context ) {
6378 if ( experimentalNetworkImports ) {
6479 return PromisePrototypeThen (
@@ -70,13 +85,23 @@ function getHttpProtocolModuleFormat(url, context) {
7085 }
7186}
7287
88+ /**
89+ * @param {URL | URL['href'] } url
90+ * @param {{parentURL: string} } context
91+ * @returns {Promise<string> | string | undefined } only works when enabled
92+ */
7393function defaultGetFormatWithoutErrors ( url , context ) {
7494 const parsed = new URL ( url ) ;
7595 if ( ! ObjectPrototypeHasOwnProperty ( protocolHandlers , parsed . protocol ) )
7696 return null ;
7797 return protocolHandlers [ parsed . protocol ] ( parsed , context , true ) ;
7898}
7999
100+ /**
101+ * @param {URL | URL['href'] } url
102+ * @param {{parentURL: string} } context
103+ * @returns {Promise<string> | string | undefined } only works when enabled
104+ */
80105function defaultGetFormat ( url , context ) {
81106 const parsed = new URL ( url ) ;
82107 return ObjectPrototypeHasOwnProperty ( protocolHandlers , parsed . protocol ) ?
0 commit comments