Skip to content

Commit

Permalink
Use typeTest in isExternalModule and isExternalModuleMain
Browse files Browse the repository at this point in the history
  • Loading branch information
ombene committed Dec 22, 2021
1 parent 69c767e commit e60715e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/importType.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ export function isExternalModule(name, settings, path, context) {
if (arguments.length < 4) {
throw new TypeError('isExternalModule: name, settings, path, and context are all required');
}
return (isModule(name) || isScoped(name)) && (isExternalPath(path, context) || isExternalLookingName(name));
return (isModule(name) || isScoped(name)) && typeTest(name, context, path) === 'external';
}

export function isExternalModuleMain(name, settings, path, context) {
return isModuleMain(name) && (isExternalPath(path, context) || isExternalLookingName(name));
return isModuleMain(name) && typeTest(name, context, path) === 'external';
}

const moduleRegExp = /^\w/;
Expand Down Expand Up @@ -106,7 +106,7 @@ function isExternalLookingName(name) {
return isModule(name) || isScoped(name);
}

function typeTest(name, context, path) {
function typeTest(name, context, path, settings) {
const { settings } = context;
if (isInternalRegexMatch(name, settings)) { return 'internal'; }
if (isAbsolute(name, settings, path)) { return 'absolute'; }
Expand Down

0 comments on commit e60715e

Please sign in to comment.