@@ -26,31 +26,7 @@ const {
2626
2727/**
2828 * @param {URL } url URL to the module
29- * @param {ESModuleContext } context used to decorate error messages
30- * @returns {Promise<{ responseURL: string, source: string | BufferView }> }
31- */
32- function getSource ( url , context ) {
33- const { protocol, href } = url ;
34- const responseURL = href ;
35- let source ;
36- if ( protocol === 'file:' ) {
37- source = readFileSync ( url ) ;
38- } else if ( protocol === 'data:' ) {
39- const result = dataURLProcessor ( url ) ;
40- if ( result === 'failure' ) {
41- throw new ERR_INVALID_URL ( responseURL , null ) ;
42- }
43- source = BufferFrom ( result . body ) ;
44- } else {
45- const supportedSchemes = [ 'file' , 'data' ] ;
46- throw new ERR_UNSUPPORTED_ESM_URL_SCHEME ( url , supportedSchemes ) ;
47- }
48- return { __proto__ : null , responseURL, source } ;
49- }
50-
51- /**
52- * @param {URL } url URL to the module
53- * @param {ESModuleContext } context used to decorate error messages
29+ * @param {LoadContext } context used to decorate error messages
5430 * @returns {{ responseURL: string, source: string | BufferView } }
5531 */
5632function getSourceSync ( url , context ) {
@@ -109,7 +85,7 @@ function defaultLoad(url, context = kEmptyObject) {
10985 source = null ;
11086 } else if ( format !== 'commonjs' ) {
11187 if ( source == null ) {
112- ( { responseURL, source } = getSource ( urlInstance , context ) ) ;
88+ ( { responseURL, source } = getSourceSync ( urlInstance , context ) ) ;
11389 context = { __proto__ : context , source } ;
11490 }
11591
0 commit comments