@@ -32,6 +32,10 @@ const protocolHandlers = ObjectAssign(ObjectCreate(null), {
32
32
'node:' ( ) { return 'builtin' ; } ,
33
33
} ) ;
34
34
35
+ /**
36
+ * @param {URL } parsed
37
+ * @returns {string | null }
38
+ */
35
39
function getDataProtocolModuleFormat ( parsed ) {
36
40
const { 1 : mime } = RegExpPrototypeExec (
37
41
/ ^ ( [ ^ / ] + \/ [ ^ ; , ] + ) (?: [ ^ , ] * ?) ( ; b a s e 6 4 ) ? , / ,
@@ -41,6 +45,12 @@ function getDataProtocolModuleFormat(parsed) {
41
45
return mimeToFormat ( mime ) ;
42
46
}
43
47
48
+ /**
49
+ * @param {URL } url
50
+ * @param {{parentURL: string} } context
51
+ * @param {boolean } ignoreErrors
52
+ * @returns {string }
53
+ */
44
54
function getFileProtocolModuleFormat ( url , context , ignoreErrors ) {
45
55
const ext = extname ( url . pathname ) ;
46
56
if ( ext === '.js' ) {
@@ -59,6 +69,11 @@ function getFileProtocolModuleFormat(url, context, ignoreErrors) {
59
69
return getLegacyExtensionFormat ( ext ) ?? null ;
60
70
}
61
71
72
+ /**
73
+ * @param {URL } url
74
+ * @param {{parentURL: string} } context
75
+ * @returns {Promise<string> | undefined } only works when enabled
76
+ */
62
77
function getHttpProtocolModuleFormat ( url , context ) {
63
78
if ( experimentalNetworkImports ) {
64
79
return PromisePrototypeThen (
@@ -70,13 +85,23 @@ function getHttpProtocolModuleFormat(url, context) {
70
85
}
71
86
}
72
87
88
+ /**
89
+ * @param {URL | URL['href'] } url
90
+ * @param {{parentURL: string} } context
91
+ * @returns {Promise<string> | string | undefined } only works when enabled
92
+ */
73
93
function defaultGetFormatWithoutErrors ( url , context ) {
74
94
const parsed = new URL ( url ) ;
75
95
if ( ! ObjectPrototypeHasOwnProperty ( protocolHandlers , parsed . protocol ) )
76
96
return null ;
77
97
return protocolHandlers [ parsed . protocol ] ( parsed , context , true ) ;
78
98
}
79
99
100
+ /**
101
+ * @param {URL | URL['href'] } url
102
+ * @param {{parentURL: string} } context
103
+ * @returns {Promise<string> | string | undefined } only works when enabled
104
+ */
80
105
function defaultGetFormat ( url , context ) {
81
106
const parsed = new URL ( url ) ;
82
107
return ObjectPrototypeHasOwnProperty ( protocolHandlers , parsed . protocol ) ?
0 commit comments