Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jordan Harband <ljharb@gmail.com>
  • Loading branch information
guybedford and ljharb committed Jul 4, 2020
1 parent 105b7f2 commit 8fe68f7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ const {
RegExpPrototypeTest,
SafeMap,
SafeWeakMap,
Set,
SafeSet,
String,
StringPrototypeIncludes,
StringPrototypeIndexOf,
StringPrototypeLastIndexOf,
StringPrototypeMatch,
Expand Down Expand Up @@ -574,7 +575,7 @@ function resolveExportsTarget(baseUrl, target, subpath, mappingKey) {
return fileURLToPath(resolved);
} catch (err) {
if (err.code === 'ERR_INVALID_FILE_URL_PATH' &&
err.message.includes('must not include encoded "/" characters')) {
StringPrototypeIncludes(err.message, 'must not include encoded "/" characters')) {
throw new ERR_INVALID_MODULE_SPECIFIER(
resolved.pathname, 'must not include encoded "/" characters',
fileURLToPath(baseUrl));
Expand Down Expand Up @@ -990,7 +991,7 @@ Module._load = function(request, parent, isMain) {
};

// TODO: Use this set when resolving pkg#exports conditions.
const cjsConditions = new Set(['require', 'node']);
const cjsConditions = new SafeSet(['require', 'node']);
Module._resolveFilename = function(request, parent, isMain, options) {
if (NativeModule.canBeRequiredByUsers(request)) {
return request;
Expand Down

0 comments on commit 8fe68f7

Please sign in to comment.