Skip to content

Commit

Permalink
remove unused range
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Oct 23, 2021
1 parent 440896c commit aac02ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions internal/resolver/package_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,8 @@ func (r resolverQuery) parsePackageJSON(inputPath string) *packageJSON {
}

// Read the "exports" map
if exportsJSON, exportsRange, ok := getProperty(json, "exports"); ok {
if exportsJSON, _, ok := getProperty(json, "exports"); ok {
if exportsMap := parseExportsMap(jsonSource, r.log, exportsJSON); exportsMap != nil {
exportsMap.exportsRange = jsonSource.RangeOfString(exportsRange)
packageJSON.exportsMap = exportsMap
}
}
Expand Down Expand Up @@ -439,8 +438,7 @@ func globstarToEscapedRegexp(glob string) (string, bool) {

// Reference: https://nodejs.org/api/esm.html#esm_resolver_algorithm_specification
type pjMap struct {
exportsRange logger.Range
root pjEntry
root pjEntry
}

type pjKind uint8
Expand Down
4 changes: 2 additions & 2 deletions internal/resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1506,11 +1506,11 @@ func (r resolverQuery) loadNodeModules(importPath string, dirInfo *dirInfo) (Pat
r.debugLogs.addNote(fmt.Sprintf("Checking for a package in the directory %q", absPath))
}

// Check for an "exports" map in the package's package.json folder
// Check the package's package.json file
if esmOK {
absPkgPath := r.fs.Join(dirInfo.absPath, "node_modules", esmPackageName)
if pkgDirInfo := r.dirInfoCached(absPkgPath); pkgDirInfo != nil {
// Check for an "exports" map in the package's package.json folder
// Check the "exports" map
if packageJSON := pkgDirInfo.packageJSON; packageJSON != nil && packageJSON.exportsMap != nil {
if r.debugLogs != nil {
r.debugLogs.addNote(fmt.Sprintf("Looking for %q in \"exports\" map in %q", esmPackageSubpath, packageJSON.source.KeyPath.Text))
Expand Down

0 comments on commit aac02ae

Please sign in to comment.