@@ -30,32 +30,7 @@ const {
3030
3131/**
3232 * @param {URL } url URL to the module
33- * @param {ESModuleContext } context used to decorate error messages
34- * @returns {Promise<{ responseURL: string, source: string | BufferView }> }
35- */
36- async function getSource ( url , context ) {
37- const { protocol, href } = url ;
38- const responseURL = href ;
39- let source ;
40- if ( protocol === 'file:' ) {
41- const { readFile : readFileAsync } = require ( 'internal/fs/promises' ) . exports ;
42- source = await readFileAsync ( url ) ;
43- } else if ( protocol === 'data:' ) {
44- const result = dataURLProcessor ( url ) ;
45- if ( result === 'failure' ) {
46- throw new ERR_INVALID_URL ( responseURL , null ) ;
47- }
48- source = BufferFrom ( result . body ) ;
49- } else {
50- const supportedSchemes = [ 'file' , 'data' ] ;
51- throw new ERR_UNSUPPORTED_ESM_URL_SCHEME ( url , supportedSchemes ) ;
52- }
53- return { __proto__ : null , responseURL, source } ;
54- }
55-
56- /**
57- * @param {URL } url URL to the module
58- * @param {ESModuleContext } context used to decorate error messages
33+ * @param {LoadContext } context used to decorate error messages
5934 * @returns {{ responseURL: string, source: string | BufferView } }
6035 */
6136function getSourceSync ( url , context ) {
@@ -84,7 +59,7 @@ function getSourceSync(url, context) {
8459 * @param {LoadContext } context
8560 * @returns {LoadReturn }
8661 */
87- async function defaultLoad ( url , context = kEmptyObject ) {
62+ function defaultLoad ( url , context = kEmptyObject ) {
8863 let responseURL = url ;
8964 let {
9065 importAttributes,
@@ -111,13 +86,13 @@ async function defaultLoad(url, context = kEmptyObject) {
11186 format ??= 'builtin' ;
11287 } else if ( format !== 'commonjs' || defaultType === 'module' ) {
11388 if ( source == null ) {
114- ( { responseURL, source } = await getSource ( urlInstance , context ) ) ;
89+ ( { responseURL, source } = getSourceSync ( urlInstance , context ) ) ;
11590 context = { __proto__ : context , source } ;
11691 }
11792
11893 if ( format == null ) {
11994 // Now that we have the source for the module, run `defaultGetFormat` to detect its format.
120- format = await defaultGetFormat ( urlInstance , context ) ;
95+ format = defaultGetFormat ( urlInstance , context ) ;
12196
12297 if ( format === 'commonjs' ) {
12398 // For backward compatibility reasons, we need to discard the source in
0 commit comments