_resolve(id, absParentPath, _seenDirPaths) {
    let resolved =
      this._resolveAbsolute(id, absParentPath) ||
      this._resolveRelative(id, absParentPath) ||
      this._resolveNodeModule(id, absParentPath);

    if (typeof resolved === "string") {
      // The _resolveNodeModule method can return "missing" to indicate
      // that the ImportScanner should look elsewhere for this module,
      // such as in the app node_modules directory.
      return resolved;
    }

    let packageJsonMap = null;

    while (resolved && resolved.stat.isDirectory()) {
      let dirPath = resolved.path;
      _seenDirPaths = _seenDirPaths || new Set;

      // If the "main" field of a package.json file resolves to a
      // directory we've already considered, then we should not attempt to
      // read the same package.json file again.
      if (! _seenDirPaths.has(dirPath)) {
        _seenDirPaths.add(dirPath);
        resolved = this._resolvePkgJsonMain(dirPath, _seenDirPaths);
        if (resolved) {
          // The _resolvePkgJsonMain call above may have returned a
          // directory, so first merge resolved.packageJsonMap into
          // packageJsonMap so that we don't forget the package.json we
          // just resolved, then continue the loop to make sure we fully
          // resolve the "main" module identifier to a non-directory.
          // Technically this could involve even more package.json files,
          // but in practice the "main" property will almost always name a
          // directory containing an index.js file.
          Object.assign(
            packageJsonMap || (packageJsonMap = Object.create(null)),
            resolved.packageJsonMap,
          );
          continue;
        }
      }

      // If we didn't find a `package.json` file, or it didn't have a
      // resolvable `.main` property, the only possibility left to
      // consider is that this directory contains an `index.js` module.
      // This assignment almost always terminates the while loop, because
      // there's very little chance an `index.js` file will be a
      // directory. However, in principle it is remotely possible that a
      // file called `index.js` could be a directory instead of a file.
      resolved = this._joinAndStat(dirPath, "index.js");
    }

    if (resolved) {
      if (packageJsonMap) {
        resolved.packageJsonMap = packageJsonMap;
      }

      resolved.id = convertToPosixPath(
        convertToOSPath(resolved.path),
        true
      );
    }

    return resolved;
  }
// parameter is for internal use only and should be ommitted.
parameter is for internal use only and should be ommitted.
parameter is for internal use only and should be ommitted .
_resolve(id, absParentPath, _seenDirPaths) {
    let resolved =
      this._resolveAbsolute(id, absParentPath) ||
      this._resolveRelative(id, absParentPath) ||
      this._resolveNodeModule(id, absParentPath);
    if (typeof resolved === "string") {
      return resolved;
    }
    let packageJsonMap = null;
    while (resolved && resolved.stat.isDirectory()) {
      let dirPath = resolved.path;
      _seenDirPaths = _seenDirPaths || new Set;
      if (! _seenDirPaths.has(dirPath)) {
        _seenDirPaths.add(dirPath);
        resolved = this._resolvePkgJsonMain(dirPath, _seenDirPaths);
        if (resolved) {
          Object.assign(
            packageJsonMap || (packageJsonMap = Object.create(null)),
            resolved.packageJsonMap,
          );
          continue;
        }
      }
      resolved = this._joinAndStat(dirPath, "index.js");
    }
    if (resolved) {
      if (packageJsonMap) {
        resolved.packageJsonMap = packageJsonMap;
      }
      resolved.id = convertToPosixPath(
        convertToOSPath(resolved.path),
        true
      );
    }
    return resolved;
  }
_resolve ( id , absParentPath , _seenDirPaths ) { let resolved = this . _resolveAbsolute ( id , absParentPath ) || this . _resolveRelative ( id , absParentPath ) || this . _resolveNodeModule ( id , absParentPath ) ; if ( typeof resolved === "string" ) { return resolved ; } let packageJsonMap = null ; while ( resolved && resolved . stat . isDirectory ( ) ) { let dirPath = resolved . path ; _seenDirPaths = _seenDirPaths || new Set ; if ( ! _seenDirPaths . has ( dirPath ) ) { _seenDirPaths . add ( dirPath ) ; resolved = this . _resolvePkgJsonMain ( dirPath , _seenDirPaths ) ; if ( resolved ) { Object . assign ( packageJsonMap || ( packageJsonMap = Object . create ( null ) ) , resolved . packageJsonMap , ) ; continue ; } } resolved = this . _joinAndStat ( dirPath , "index.js" ) ; } if ( resolved ) { if ( packageJsonMap ) { resolved . packageJsonMap = packageJsonMap ; } resolved . id = convertToPosixPath ( convertToOSPath ( resolved . path ) , true ) ; } return resolved ; }
parameter is for internal use only and should be ommitted.
parameter is for internal use only and should be ommitted .
// The _resolveNodeModule method can return "missing" to indicate // that the ImportScanner should look elsewhere for this module, // such as in the app node_modules directory. // If the "main" field of a package.json file resolves to a // directory we've already considered, then we should not attempt to // read the same package.json file again. // The _resolvePkgJsonMain call above may have returned a // directory, so first merge resolved.packageJsonMap into // packageJsonMap so that we don't forget the package.json we // just resolved, then continue the loop to make sure we fully // resolve the "main" module identifier to a non-directory. // Technically this could involve even more package.json files, // but in practice the "main" property will almost always name a // directory containing an index.js file. // If we didn't find a `package.json` file, or it didn't have a // resolvable `.main` property, the only possibility left to // consider is that this directory contains an `index.js` module. // This assignment almost always terminates the while loop, because // there's very little chance an `index.js` file will be a // directory. However, in principle it is remotely possible that a // file called `index.js` could be a directory instead of a file.