function checkLocalPlugin(plugin, rootDir) {
  const pluginName = typeof plugin === `string` ? plugin : plugin.resolve; // Make sure the plugin exists relatively

  if ((0, _fsExistsCached.sync)(pluginName) || !rootDir) {
    return {
      validLocalPlugin: false
    };
  }

  const resolvedPath = (0, _gatsbyCoreUtils.slash)(_path.default.join(rootDir, `plugins/${pluginName}`));

  if (!(0, _fsExistsCached.sync)(resolvedPath)) {
    return {
      validLocalPlugin: false
    };
  }

  const resolvedPackageJson = (0, _fsExistsCached.sync)(`${resolvedPath}/package.json`); // package.json is a requirement for local plugins

  if (!resolvedPackageJson) {
    throw new Error(`Local plugin ${pluginName} requires a package.json file`);
  }

  return {
    validLocalPlugin: true,
    localPluginPath: resolvedPath
  };
}
/**
 * Checks if a plugin is a valid local plugin and returns the resolved path if it is.
 */
Checks if a plugin is a valid local plugin and returns the resolved path if it is.
Checks if a plugin is a valid local plugin and returns the resolved path if it is .
function checkLocalPlugin(plugin, rootDir) {
  const pluginName = typeof plugin === `string` ? plugin : plugin.resolve; 
  if ((0, _fsExistsCached.sync)(pluginName) || !rootDir) {
    return {
      validLocalPlugin: false
    };
  }
  const resolvedPath = (0, _gatsbyCoreUtils.slash)(_path.default.join(rootDir, `plugins/${pluginName}`));
  if (!(0, _fsExistsCached.sync)(resolvedPath)) {
    return {
      validLocalPlugin: false
    };
  }
  const resolvedPackageJson = (0, _fsExistsCached.sync)(`${resolvedPath}/package.json`); 
  if (!resolvedPackageJson) {
    throw new Error(`Local plugin ${pluginName} requires a package.json file`);
  }
  return {
    validLocalPlugin: true,
    localPluginPath: resolvedPath
  };
}
function checkLocalPlugin ( plugin , rootDir ) { const pluginName = typeof plugin === ` ` ? plugin : plugin . resolve ; if ( ( 0 , _fsExistsCached . sync ) ( pluginName ) || ! rootDir ) { return { validLocalPlugin : false } ; } const resolvedPath = ( 0 , _gatsbyCoreUtils . slash ) ( _path . default . join ( rootDir , ` ${ pluginName } ` ) ) ; if ( ! ( 0 , _fsExistsCached . sync ) ( resolvedPath ) ) { return { validLocalPlugin : false } ; } const resolvedPackageJson = ( 0 , _fsExistsCached . sync ) ( ` ${ resolvedPath } ` ) ; if ( ! resolvedPackageJson ) { throw new Error ( ` ${ pluginName } ` ) ; } return { validLocalPlugin : true , localPluginPath : resolvedPath } ; }
Checks if a plugin is a valid local plugin and returns the resolved path if it is.
Checks if a plugin is a valid local plugin and returns the resolved path if it is .
// Make sure the plugin exists relatively // package.json is a requirement for local plugins