Asynchronously validate generation options, check existance of given files
and directories

@throws
@param  {Object} options
@return {void}
187127
async function validateOptions(options) {
  // Check that input glob was passed
  if (!options.paths.length) {
    throw new ValidationError('No paths specified')
  }

  // Check that output path was passed
  if (!options.outputDir) {
    throw new ValidationError('Please specify an output directory with -o or --output')
  }

  // Check that the existance of output path
  if (!await fsAsync.exists(options.outputDir)) {
    throw new ValidationError('Output directory doesn\'t exist')
  }

  // Check that output path is a directory
  const outStat = await fsAsync.stat(options.outputDir)
  if (!outStat.isDirectory()) {
    throw new ValidationError('Output path must be a directory')
  }

  // Check existance of CSS template (If set)
  if (options.cssTemplate && !await fsAsync.exists(options.cssTemplate)) {
    throw new ValidationError('CSS template not found')
  }

  // Check existance of HTML template (If set)
  if (options.htmlTemplate && !await fsAsync.exists(options.htmlTemplate)) {
    throw new ValidationError('HTML template not found')
  }

  // Validate codepoints file if passed
  if (options.codepoints) {
    if (!await fsAsync.exists(options.codepoints)) {
      throw new ValidationError(`Cannot find json file @ ${options.codepoints}!`)
    }

    const codepointsStat = await fsAsync.stat(options.codepoints)
    if (!codepointsStat.isFile() || path.extname(options.codepoints) !== '.json') {
      throw new ValidationError([
        'Codepoints file must be JSON',
        `${options.codepoints} is not a valid file.`
      ].join(' '))
    }
  }
}
1215719
function validatePlugins (plugins) {
  var type = typeOf(plugins);

  if (type.hasValue) {
    if (type.isArray) {
      // Make sure all the items in the array are valid plugins
      plugins.forEach(validatePlugin);
    }
    else {
      throw ono('Invalid arguments. Expected an array of plugins.');
    }
  }
}
489257
function FileSystemLoader(dir, options) {
    this.dir = dir.replace(/\/$/, '');
    this.options = options || (options = {});
    this.posts = [];
    this.files = {};
    this.ignore = {};
    var self = this;
    (options.ignore || FileSystemLoader.ignore).forEach(function (file) {
        self.ignore[file] = true;
    });
    process.nextTick(function () {
        self.loadPosts();
    });
}
713012
protected void validate() {
    // make sure that the source uri is set correctly.
    if (mSourceUri == null) {
      throw new BuilderException("Source must be set!");
    }

    // For local resource we require caller to specify statically generated resource id as a path.
    if (UriUtil.isLocalResourceUri(mSourceUri)) {
      if (!mSourceUri.isAbsolute()) {
        throw new BuilderException("Resource URI path must be absolute.");
      }
      if (mSourceUri.getPath().isEmpty()) {
        throw new BuilderException("Resource URI must not be empty");
      }
      try {
        Integer.parseInt(mSourceUri.getPath().substring(1));
      } catch (NumberFormatException ignored) {
        throw new BuilderException("Resource URI path must be a resource id.");
      }
    }

    // For local asset we require caller to specify absolute path of an asset, which will be
    // resolved by AssetManager relative to configured asset folder of an app.
    if (UriUtil.isLocalAssetUri(mSourceUri) && !mSourceUri.isAbsolute()) {
      throw new BuilderException("Asset URI path must be absolute.");
    }
  }
740899
function (options, serverOptions) {

		options = extend(this._defaults, options || {});

		validatorLog.clear();
		validatorLog.neutral('response validation\'s started');

		this._options = options;
		this._serverOptions = serverOptions;
		this._prefFilePath = this._options.restPath + '/preferences.json';
		this._validatorFilePath = this._options.restPath + '/.validation.json';
		this._tempPrefData = '';
		this._setResponseDelay();
		this._validationResponses = this._getValidationResponses(this._options.restPath);
		this._runValidations(this._validationResponses);
		this._restoreResponseDelay();

	}
1006975
function validateOptions(options) {
  const notSupported = _.reject(_.keys(options), (key) => (
    OPTIONS.has(key)
  ));

  if (notSupported.length > 0) {
    console.warn(`[${PLUGIN_NAME}] Options ${notSupported} are not supported, use following options: ${Array.from(OPTIONS)}`);
  }
}
87169
async function (options) {

  // Get absolute path for directory to shake
  const root = path.resolve(process.cwd(), options.path || '.');

  const {
    entryPoints = findEntryPoints(root),
    exclude = [],
    silent = false,
    hideTable = false,
    delete: shouldDeleteFiles = false,
  } = options;

  if (entryPoints.length) {

    silent || displayEntryPoints(entryPoints);

    const filesInSassTree = await reduceEntryPointsToDependencies([root], entryPoints);
		const uniqueFilesInSassTree = unique(filesInSassTree);
    silent || console.log(`Found ${uniqueFilesInSassTree.length} files in Sass tree\n`);

    const deletionCandidates = await findUnusedFiles(root, uniqueFilesInSassTree, exclude);
    silent || hideTable || displayFiles(deletionCandidates);
    silent || console.log(`Found ${deletionCandidates.length} unused files in directory tree ${root}`);

    shouldDeleteFiles && console.log(`Deleted ${deleteFiles(deletionCandidates)} unused files in directory`);
    return deletionCandidates;
  } else {
    silent || console.log('No entrypoints found (to explicitly specify them, use the --entryPoints flag)');
  }
}
965413
function discoverAndReadFiles(options) {
    const FILES = {};
    const in_queue = Object.create(null);
    const queue = [];
    const enqueue = (moduleId) => {
        if (in_queue[moduleId]) {
            return;
        }
        in_queue[moduleId] = true;
        queue.push(moduleId);
    };
    options.entryPoints.forEach((entryPoint) => enqueue(entryPoint));
    while (queue.length > 0) {
        const moduleId = queue.shift();
        const dts_filename = path.join(options.sourcesRoot, moduleId + '.d.ts');
        if (fs.existsSync(dts_filename)) {
            const dts_filecontents = fs.readFileSync(dts_filename).toString();
            FILES[`${moduleId}.d.ts`] = dts_filecontents;
            continue;
        }
        const js_filename = path.join(options.sourcesRoot, moduleId + '.js');
        if (fs.existsSync(js_filename)) {
            // This is an import for a .js file, so ignore it...
            continue;
        }
        let ts_filename;
        if (options.redirects[moduleId]) {
            ts_filename = path.join(options.sourcesRoot, options.redirects[moduleId] + '.ts');
        }
        else {
            ts_filename = path.join(options.sourcesRoot, moduleId + '.ts');
        }
        const ts_filecontents = fs.readFileSync(ts_filename).toString();
        const info = ts.preProcessFile(ts_filecontents);
        for (let i = info.importedFiles.length - 1; i >= 0; i--) {
            const importedFileName = info.importedFiles[i].fileName;
            if (options.importIgnorePattern.test(importedFileName)) {
                // Ignore vs/css! imports
                continue;
            }
            let importedModuleId = importedFileName;
            if (/(^\.\/)|(^\.\.\/)/.test(importedModuleId)) {
                importedModuleId = path.join(path.dirname(moduleId), importedModuleId);
            }
            enqueue(importedModuleId);
        }
        FILES[`${moduleId}.ts`] = ts_filecontents;
    }
    return FILES;
}
563038
function validateExtensions(input) {
  return new Promise((resolve, reject) => {
    try {
      const extensionPath = getExtensionsPath();

      if (!fs.existsSync(extensionPath)) {
        fs.mkdirSync(extensionPath);
      }

      if (!input.imports.length) {
        return resolve(null);
      }

      return resolve(input);
    } catch (e) {
      return reject(new Error(t('EXTENSION_COULD_NOT_BE_VALIDATED')));
    }
  });
}
382894
function exists(file, src, opts) {
	var files = opts.path.map(function (dir) {
		return path.join(dir, file);
	});

	files = globby.sync(files);

	if (!files.length) {
		throw new Error(createError(file, src, opts.path));
	}

	return files[0];
}
1170098
def validate_files(directory, files_to_merge):
    
    for file_path in files_to_merge:
        pathname = directory.joinpath(file_path)
        if not pathname.exists():
            raise Exception("I18N: Cannot generate because file not found: {0}".format(pathname))
        # clean sources
        clean_pofile(pathname)
1069155
function checkOptions(options) {
                // @TODO: should we throw an error if there are incorrect options provided?
                options = _.pick(options, permittedOptions);

                let validationErrors = utils.validateOptions(options);

                if (_.isEmpty(validationErrors)) {
                    return Promise.resolve(options);
                }

                // For now, we can only handle showing the first validation error
                return Promise.reject(validationErrors[0]);
            }
1317790
function exec(paths, options) {
    ls.self = this;
    paths = paths !== null && !Array.isArray(paths) && (typeof paths === 'undefined' ? 'undefined' : _typeof(paths)) === 'object' ? paths.paths : paths;
    paths = paths || ['.'];
    paths = Array.isArray(paths) ? paths : [paths];
    paths = expand(paths);

    options = options || {};

    var preSortedPaths = ls.preSortPaths(paths);

    var dirResults = [];
    for (var i = 0; i < preSortedPaths.dirs.length; ++i) {
      if (options.recursive) {
        var result = ls.execDirRecursive(preSortedPaths.dirs[i], options);
        dirResults = dirResults.concat(result);
      } else {
        dirResults.push(ls.execDir(preSortedPaths.dirs[i], options));
      }
    }

    var stdout = '';
    if (preSortedPaths.files.length > 0) {
      stdout += ls.execLsOnFiles('.', preSortedPaths.files, options).results;
    }

    var dirOutput = ls.formatAll(dirResults, options, dirResults.length + preSortedPaths.files.length > 1);
    stdout += stdout && dirOutput ? '\n\n' + dirOutput : dirOutput;
    if (strip(stdout).trim() !== '') {
      ls.self.log(String(stdout).replace(/\\/g, '/'));
    }

    return 0;
  }
1005165
function Generate(options) {
  if (!(this instanceof Generate)) {
    return new Generate(options);
  }

  Assemble.call(this, options);
  this.is('generate');
  this.initGenerate(this.options);

  if (!setArgs) {
    setArgs = true;
    this.base.option(utils.argv);
  }
}
55810
async function runFile(src, options) {
    return runCode(await fs.readFile(src, 'utf-8'), {
        __dirname: path.dirname(src),
        __filename: src,
        ...options
    });
}
912727
function validateCallbacks(options) {
            if (options.successCallback && typeof options.successCallback !== 'function') {
                throw new Error(TAG + 'Success callback must be a function.');
            } else {
                options.successCallback = options.successCallback || enplug.noop;
            }

            if (options.errorCallback && typeof options.errorCallback !== 'function') {
                throw new Error(TAG + 'Error callback must be a function.');
            } else {
                options.errorCallback = options.errorCallback || enplug.noop;
            }
        }
1157268
function (options) {
    this.matchingJadeFilePath = options.matchingJadeFilePath;
    this.htmlFilePath = options.htmlFilePath;
    this.lastRenderToFile = undefined;
    this.jadeOptions = (typeof options.jadeOptions === 'undefined') ? { pretty: true } : options.jadeOptions;
}