Repository: yargs/yargs (js)

Issue:
Expose yargs-parser
Would you be willing to have yargs re-expose yargs-parser?  My hope is for nyc to be able to do something like `const {Parser} = require('yargs/yargs')`.  This would have the benefit of guaranteeing that when nyc uses the exact same version of `yargs-parser` as yargs itself.  It would also reduce the maintenance burden for packages like nyc, for example right now `yargs-parser@16.1.0` is available but latest yargs uses `yargs-parser@^15.0.0` so anyone who blindly upgrades (my CI passed so it's good) would cause two copies of yargs-parser to get installed.

Pull request description:
feat: Expose `Parser` from `require('yargs/yargs')`
Fixes #1475

Patch:
diff --git a/yargs.js b/yargs.js
index 24db759..f901734 100644
--- a/yargs.js
+++ b/yargs.js
@@ -1221,6 +1221,9 @@ function Yargs (processArgs, cwd, parentRequire) {
   return self
 }
 
+// allow consumers to directly use the version of yargs-parser used by yargs
+exports.Parser = Parser
+
 // rebase an absolute path to a relative one with respect to a base directory
 // exported for tests
 exports.rebase = rebase


Test patch:
diff --git a/test/parser.js b/test/parser.js
new file mode 100644
index 0000000..8b9eecd
--- /dev/null
+++ b/test/parser.js
@@ -0,0 +1,11 @@
+'use strict'
+/* global it */
+
+const yargs = require('../yargs')
+const Parser = require('yargs-parser')
+
+require('chai').should()
+
+it('should expose yargs-parser as Parser', () => {
+  yargs.Parser.should.equal(Parser)
+})