You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

19 lines
459 B

import _url from 'url';
const builtins = new Set(
Object.keys(process.binding('natives')).filter(str =>
/^(?!(?:internal|node|v8)\/)/.test(str))
)
export function resolve (specifier, base) {
if (builtins.has(specifier)) {
return {
url: specifier,
format: 'builtin'
};
}
// load all dependencies as esm, regardless of file extension
const url = new _url.URL(specifier, base).href;
return {
url,
format: 'esm'
};
}