function resolveExternalPath(importPath, originalPath, fromFile, options) {
  let baseIndex = importPath[0] === '@' ? importPath.indexOf('/') + 1 : 0;
  let addonName = importPath.substring(0, importPath.indexOf('/', baseIndex));
  let addon = options.parent.addons.find((addon) => {
    if (addon.moduleName) {
      return addon.moduleName() === addonName;
    }
    return addon.name === addonName;
  });

  if (!addon) {
    throw new Error(
      `Unable to resolve styles module '${originalPath}' imported from '${fromFile}'. ` +
      `No virtual module with that name was defined and no corresponding addon was found.`
    );
  }

  let pathWithinAddon = importPath.substring(addonName.length + 1);
  let addonTreePath = path.join(addon.root, addon.treePaths.addon);

  let absolutePath = ensurePosixPath(path.resolve(addonTreePath, pathWithinAddon));
  let keyPath = options.addonModulesRoot + addonName + '/' + pathWithinAddon;
  return new DependencyPath('external', absolutePath, keyPath);
}
// Resolve absolute paths pointing to external addons
Resolve absolute paths pointing to external addons
Resolve absolute paths pointing to external addons
function resolveExternalPath(importPath, originalPath, fromFile, options) {
  let baseIndex = importPath[0] === '@' ? importPath.indexOf('/') + 1 : 0;
  let addonName = importPath.substring(0, importPath.indexOf('/', baseIndex));
  let addon = options.parent.addons.find((addon) => {
    if (addon.moduleName) {
      return addon.moduleName() === addonName;
    }
    return addon.name === addonName;
  });
  if (!addon) {
    throw new Error(
      `Unable to resolve styles module '${originalPath}' imported from '${fromFile}'. ` +
      `No virtual module with that name was defined and no corresponding addon was found.`
    );
  }
  let pathWithinAddon = importPath.substring(addonName.length + 1);
  let addonTreePath = path.join(addon.root, addon.treePaths.addon);
  let absolutePath = ensurePosixPath(path.resolve(addonTreePath, pathWithinAddon));
  let keyPath = options.addonModulesRoot + addonName + '/' + pathWithinAddon;
  return new DependencyPath('external', absolutePath, keyPath);
}
function resolveExternalPath ( importPath , originalPath , fromFile , options ) { let baseIndex = importPath [ 0 ] === '@' ? importPath . indexOf ( '/' ) + 1 : 0 ; let addonName = importPath . substring ( 0 , importPath . indexOf ( '/' , baseIndex ) ) ; let addon = options . parent . addons . find ( ( addon ) => { if ( addon . moduleName ) { return addon . moduleName ( ) === addonName ; } return addon . name === addonName ; } ) ; if ( ! addon ) { throw new Error ( ` ${ originalPath } ${ fromFile } ` + ` ` ) ; } let pathWithinAddon = importPath . substring ( addonName . length + 1 ) ; let addonTreePath = path . join ( addon . root , addon . treePaths . addon ) ; let absolutePath = ensurePosixPath ( path . resolve ( addonTreePath , pathWithinAddon ) ) ; let keyPath = options . addonModulesRoot + addonName + '/' + pathWithinAddon ; return new DependencyPath ( 'external' , absolutePath , keyPath ) ; }
Resolve absolute paths pointing to external addons
Resolve absolute paths pointing to external addons