const major = Number(process.version.match(/v([^.]+)/)[1]);
if (major < minNodeVersion) {
throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
}
}
const env = process ? process.env : {};
const parser = new YargsParser({
cwd: process.cwd,
env: () => {
return env;
},
format: util.format,
normalize: path.normalize,
resolve: path.resolve,
require: (path) => {
if (typeof require !== 'undefined') {
return require(path);
}
else if (path.match(/\.json$/)) {
return fs.readFileSync(path, 'utf8');
}
else {
throw Error('only .json config files are supported in ESM');