{"_id":"@-xun/yargs-parser-experimental","_rev":"2-1099dab651cd0e945f2f2fac44831a98","name":"@-xun/yargs-parser-experimental","dist-tags":{"latest":"22.99.0"},"versions":{"21.1.2":{"name":"@-xun/yargs-parser-experimental","version":"21.1.2","keywords":["argument","parser","yargs","command","cli","parsing","option","args"],"author":{"name":"Ben Coe","email":"ben@npmjs.com"},"license":"ISC","_id":"@-xun/yargs-parser-experimental@21.1.2","maintainers":[{"name":"xunnamius","email":"git@bernarddickens.dev"}],"homepage":"https://github.com/yargs/yargs-parser#readme","bugs":{"url":"https://github.com/yargs/yargs-parser/issues"},"dist":{"shasum":"d0ef41afbd185aa81fefbb5b33504a9bfbff6318","tarball":"https://registry.npmjs.org/@-xun/yargs-parser-experimental/-/yargs-parser-experimental-21.1.2.tgz","fileCount":10,"integrity":"sha512-tXSRJfaS9cWzDUTlms2uBQ9Huomg0qSDyNPlDrUAiBfyNDP4AxWH1FvNRngy9kzZ6I/m92/NtVqtHsvIF9G4fg==","signatures":[{"sig":"MEUCIQDxVkjklV/gFmPvy9GJgex4fOc+wMFIlPWhBa1evUO4BAIgJsv2VkXqoBoS4/jWHLyI1HQ0COPacTXdycvSa6KgPYo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":100406},"main":"build/index.cjs","type":"module","module":"./build/lib/index.js","engines":{"node":">=12"},"exports":{".":[{"import":"./build/lib/index.js","require":"./build/index.cjs"},"./build/index.cjs"],"./browser":["./browser.js"]},"gitHead":"3aba24ceaa1a06ceb982c63a06002526d781e826","scripts":{"fix":"standardx --fix '**/*.ts' && standardx --fix '**/*.js' && standardx --fix '**/*.cjs'","test":"c8 --reporter=text --reporter=html mocha test/*.cjs","check":"standardx '**/*.ts' && standardx '**/*.js' && standardx '**/*.cjs'","compile":"tsc --noCheck","prepare":"npm run compile","pretest":"rimraf build && tsc --noCheck -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs","coverage":"c8 report --check-coverage","test:esm":"c8 --reporter=text --reporter=html mocha test/*.mjs","build:cjs":"rollup -c","precompile":"rimraf build","postcompile":"npm run build:cjs","test:browser":"start-server-and-test 'serve ./ -p 8080' http://127.0.0.1:8080/package.json 'node ./test/browser/yargs-test.cjs'","test:typescript":"c8 mocha ./build/test/typescript/*.js","pretest:typescript":"npm run pretest"},"_npmUser":{"name":"xunnamius","email":"git@bernarddickens.dev"},"standardx":{"ignore":["build"]},"repository":{"url":"git+https://github.com/yargs/yargs-parser.git","type":"git"},"_npmVersion":"11.2.0","description":"a temporary fork of the mighty option parser used by yargs","directories":{},"_nodeVersion":"22.14.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^7.3.0","gts":"^3.0.0","chai":"^4.2.0","mocha":"^10.0.0","serve":"^14.0.0","eslint":"^7.0.0","rimraf":"^3.0.2","rollup":"^2.22.1","cross-env":"^7.0.2","puppeteer":"^16.0.0","standardx":"^7.0.0","typescript":"^5.0.0","@types/chai":"^4.2.11","@types/node":"^16.11.4","@types/mocha":"^9.0.0","rollup-plugin-ts":"^3.0.2","eslint-plugin-node":"^11.0.0","eslint-plugin-import":"^2.20.1","rollup-plugin-cleanup":"^3.1.1","start-server-and-test":"^1.11.2","@typescript-eslint/parser":"^3.10.1","ts-transform-default-export":"^1.0.2","@typescript-eslint/eslint-plugin":"^3.10.1"},"_npmOperationalInternal":{"tmp":"tmp/yargs-parser-experimental_21.1.2_1742125002829_0.4499463942883948","host":"s3://npm-registry-packages-npm-production"}},"22.99.0":{"name":"@-xun/yargs-parser-experimental","version":"22.99.0","description":"the mighty option parser used by yargs","main":"build/lib/index.js","exports":{".":[{"import":"./build/lib/index.js"},"./build/lib/index.js"],"./browser":["./browser.js"]},"type":"module","module":"./build/lib/index.js","scripts":{"check":"gts lint","fix":"gts fix","pretest":"rimraf build && tsc --noCheck -p tsconfig.test.json","test":"c8 --reporter=text --reporter=html mocha test/*.mjs","test:browser":"start-server-and-test 'serve ./ -p 8080' http://127.0.0.1:8080/package.json 'node ./test/browser/yargs-test.cjs'","pretest:typescript":"npm run pretest","test:typescript":"c8 mocha ./build/test/typescript/*.js","coverage":"c8 report --check-coverage","precompile":"rimraf build","compile":"tsc --noCheck","prepare":"npm run compile"},"repository":{"type":"git","url":"git+https://github.com/yargs/yargs-parser.git"},"keywords":["argument","parser","yargs","command","cli","parsing","option","args","argument"],"author":{"name":"Ben Coe","email":"ben@npmjs.com"},"license":"ISC","devDependencies":{"@babel/eslint-parser":"^7.27.1","@babel/preset-typescript":"^7.27.1","@types/chai":"^5.2.1","@types/mocha":"^10.0.10","@types/node":"^22.15.3","@typescript-eslint/eslint-plugin":"^8.29.1","@typescript-eslint/parser":"^8.31.1","c8":"^10.1.3","chai":"^5.2.0","cross-env":"^7.0.2","eslint":"^8.57.1","gts":"^5.3.1","mocha":"^11.1.0","puppeteer":"^24.6.1","rimraf":"^6.0.1","serve":"^14.0.0","start-server-and-test":"^2.0.11","typescript":"^5.8.3"},"engines":{"node":"^20.19.0 || ^22.12.0 || >=23"},"_id":"@-xun/yargs-parser-experimental@22.99.0","gitHead":"837f5dd6ab1cab452c26c1e5081e08382fa5b024","types":"./build/lib/index.d.ts","bugs":{"url":"https://github.com/yargs/yargs-parser/issues"},"homepage":"https://github.com/yargs/yargs-parser#readme","_nodeVersion":"22.15.1","_npmVersion":"11.4.1","dist":{"integrity":"sha512-SlA2On1SuLnMfPN0ivK5Hyv6sb3rtgCESY6O87LKitPR54pLwyMTqs6MG+/dnvi4dT2yHvY7oZrssooPwqrPbw==","shasum":"15b5de830f6214a6f6eeb459f1342d643acdc055","tarball":"https://registry.npmjs.org/@-xun/yargs-parser-experimental/-/yargs-parser-experimental-22.99.0.tgz","fileCount":9,"unpackedSize":68783,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCglYZgZo1zJzbOGknJra1zywjtO6p7X0Dno/aJ2gsNPQIgaC7X4+xMJemJENDj9sW0bHkCfdSnMAfzL/OVYikYxE0="}]},"_npmUser":{"name":"xunnamius","email":"git@bernarddickens.dev"},"directories":{},"maintainers":[{"name":"xunnamius","email":"git@bernarddickens.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/yargs-parser-experimental_22.99.0_1748400468091_0.08639604159163738"},"_hasShrinkwrap":false}},"time":{"created":"2025-03-16T11:36:42.726Z","modified":"2025-05-28T02:47:48.506Z","21.1.2":"2025-03-16T11:36:43.031Z","22.99.0":"2025-05-28T02:47:48.322Z"},"bugs":{"url":"https://github.com/yargs/yargs-parser/issues"},"author":{"name":"Ben Coe","email":"ben@npmjs.com"},"license":"ISC","homepage":"https://github.com/yargs/yargs-parser#readme","keywords":["argument","parser","yargs","command","cli","parsing","option","args","argument"],"repository":{"type":"git","url":"git+https://github.com/yargs/yargs-parser.git"},"description":"the mighty option parser used by yargs","maintainers":[{"name":"xunnamius","email":"git@bernarddickens.dev"}],"readme":"# yargs-parser\n\n![ci](https://github.com/yargs/yargs-parser/workflows/ci/badge.svg)\n[![NPM version](https://img.shields.io/npm/v/yargs-parser.svg)](https://www.npmjs.com/package/yargs-parser)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n![nycrc config on GitHub](https://img.shields.io/nycrc/yargs/yargs-parser)\n\nThe mighty option parser used by [yargs](https://github.com/yargs/yargs).\n\nvisit the [yargs website](http://yargs.js.org/) for more examples, and thorough usage instructions.\n\n<img width=\"250\" src=\"https://raw.githubusercontent.com/yargs/yargs-parser/main/yargs-logo.png\">\n\n## Example\n\n```sh\nnpm i yargs-parser --save\n```\n\n```js\nconst argv = require('yargs-parser')(process.argv.slice(2))\nconsole.log(argv)\n```\n\n```console\n$ node example.js --foo=33 --bar hello\n{ _: [], foo: 33, bar: 'hello' }\n```\n\n_or parse a string!_\n\n```js\nconst argv = require('yargs-parser')('--foo=99 --bar=33')\nconsole.log(argv)\n```\n\n```console\n{ _: [], foo: 99, bar: 33 }\n```\n\nConvert an array of mixed types before passing to `yargs-parser`:\n\n```js\nconst parse = require('yargs-parser')\nparse(['-f', 11, '--zoom', 55].join(' '))   // <-- array to string\nparse(['-f', 11, '--zoom', 55].map(String)) // <-- array of strings\n```\n\n## Deno Example\n\nAs of `v19` `yargs-parser` supports [Deno](https://github.com/denoland/deno):\n\n```typescript\nimport parser from \"https://deno.land/x/yargs_parser/deno.ts\";\n\nconst argv = parser('--foo=99 --bar=9987930', {\n  string: ['bar']\n})\nconsole.log(argv)\n```\n\n## ESM Example\n\nAs of `v19` `yargs-parser` supports ESM (_both in Node.js and in the browser_):\n\n**Node.js:**\n\n```js\nimport parser from 'yargs-parser'\n\nconst argv = parser('--foo=99 --bar=9987930', {\n  string: ['bar']\n})\nconsole.log(argv)\n```\n\n**Browsers:**\n\n```html\n<!doctype html>\n<body>\n  <script type=\"module\">\n    import parser from \"https://unpkg.com/yargs-parser@19.0.0/browser.js\";\n\n    const argv = parser('--foo=99 --bar=9987930', {\n      string: ['bar']\n    })\n    console.log(argv)\n  </script>\n</body>\n```\n\n## API\n\n### parser(args, opts={})\n\nParses command line arguments returning a simple mapping of keys and values.\n\n**expects:**\n\n* `args`: a string or array of strings representing the options to parse.\n* `opts`: provide a set of hints indicating how `args` should be parsed:\n  * `opts.alias`: an object representing the set of aliases for a key: `{alias: {foo: ['f']}}`.\n  * `opts.array`: indicate that keys should be parsed as an array: `{array: ['foo', 'bar']}`.<br>\n    Indicate that keys should be parsed as an array and coerced to booleans / numbers:<br>\n    `{array: [{ key: 'foo', boolean: true }, {key: 'bar', number: true}]}`.\n  * `opts.boolean`: arguments should be parsed as booleans: `{boolean: ['x', 'y']}`.\n  * `opts.coerce`: provide a custom synchronous function that returns a coerced value from the argument provided\n    (or throws an error). For arrays the function is called only once for the entire array:<br>\n    `{coerce: {foo: function (arg) {return modifiedArg}}}`.\n  * `opts.config`: indicate a key that represents a path to a configuration file (this file will be loaded and parsed).\n  * `opts.configObjects`: configuration objects to parse, their properties will be set as arguments:<br>\n    `{configObjects: [{'x': 5, 'y': 33}, {'z': 44}]}`.\n  * `opts.configuration`: provide configuration options to the yargs-parser (see: [configuration](#configuration)).\n  * `opts.count`: indicate a key that should be used as a counter, e.g., `-vvv` = `{v: 3}`.\n  * `opts.default`: provide default values for keys: `{default: {x: 33, y: 'hello world!'}}`.\n  * `opts.envPrefix`: environment variables (`process.env`) with the prefix provided should be parsed.\n  * `opts.narg`: specify that a key requires `n` arguments: `{narg: {x: 2}}`.\n  * `opts.normalize`: `path.normalize()` will be applied to values set to this key.\n  * `opts.number`: keys should be treated as numbers.\n  * `opts.string`: keys should be treated as strings (even if they resemble a number `-x 33`).\n\n**returns:**\n\n* `obj`: an object representing the parsed value of `args`\n  * `key/value`: key value pairs for each argument and their aliases.\n  * `_`: an array representing the positional arguments.\n  * [optional] `--`:  an array with arguments after the end-of-options flag `--`.\n\n### require('yargs-parser').detailed(args, opts={})\n\nParses a command line string, returning detailed information required by the\nyargs engine.\n\n**expects:**\n\n* `args`: a string or array of strings representing options to parse.\n* `opts`: provide a set of hints indicating how `args`, inputs are identical to `require('yargs-parser')(args, opts={})`.\n\n**returns:**\n\n* `argv`: an object representing the parsed value of `args`\n  * `key/value`: key value pairs for each argument and their aliases.\n  * `_`: an array representing the positional arguments.\n  * [optional] `--`:  an array with arguments after the end-of-options flag `--`.\n* `error`: populated with an error object if an exception occurred during parsing.\n* `aliases`: the inferred list of aliases built by combining lists in `opts.alias`.\n* `newAliases`: any new aliases added via camel-case expansion:\n  * `boolean`: `{ fooBar: true }`\n* `defaulted`: any new argument created by `opts.default`, no aliases included.\n  * `boolean`: `{ foo: true }`\n* `configuration`: given by default settings and `opts.configuration`.\n\n<a name=\"configuration\"></a>\n\n### Configuration\n\nThe yargs-parser applies several automated transformations on the keys provided\nin `args`. These features can be turned on and off using the `configuration` field\nof `opts`.\n\n```js\nvar parsed = parser(['--no-dice'], {\n  configuration: {\n    'boolean-negation': false\n  }\n})\n```\n\n### short option groups\n\n* default: `true`.\n* key: `short-option-groups`.\n\nShould a group of short-options be treated as boolean flags?\n\n```console\n$ node example.js -abc\n{ _: [], a: true, b: true, c: true }\n```\n\n_if disabled:_\n\n```console\n$ node example.js -abc\n{ _: [], abc: true }\n```\n\n### camel-case expansion\n\n* default: `true`.\n* key: `camel-case-expansion`.\n\nShould hyphenated arguments be expanded into camel-case aliases?\n\n```console\n$ node example.js --foo-bar\n{ _: [], 'foo-bar': true, fooBar: true }\n```\n\n_if disabled:_\n\n```console\n$ node example.js --foo-bar\n{ _: [], 'foo-bar': true }\n```\n\n### dot-notation\n\n* default: `true`\n* key: `dot-notation`\n\nShould keys that contain `.` be treated as objects?\n\n```console\n$ node example.js --foo.bar\n{ _: [], foo: { bar: true } }\n```\n\n_if disabled:_\n\n```console\n$ node example.js --foo.bar\n{ _: [], \"foo.bar\": true }\n```\n\n### parse numbers\n\n* default: `true`\n* key: `parse-numbers`\n\nShould keys that look like numbers be treated as such?\n\n```console\n$ node example.js --foo=99.3\n{ _: [], foo: 99.3 }\n```\n\n_if disabled:_\n\n```console\n$ node example.js --foo=99.3\n{ _: [], foo: \"99.3\" }\n```\n\n### parse positional numbers\n\n* default: `true`\n* key: `parse-positional-numbers`\n\nShould positional keys that look like numbers be treated as such.\n\n```console\n$ node example.js 99.3\n{ _: [99.3] }\n```\n\n_if disabled:_\n\n```console\n$ node example.js 99.3\n{ _: ['99.3'] }\n```\n\n### boolean negation\n\n* default: `true`\n* key: `boolean-negation`\n\nShould variables prefixed with `--no` be treated as negations?\n\n```console\n$ node example.js --no-foo\n{ _: [], foo: false }\n```\n\n_if disabled:_\n\n```console\n$ node example.js --no-foo\n{ _: [], \"no-foo\": true }\n```\n\n### combine arrays\n\n* default: `false`\n* key: `combine-arrays`\n\nShould arrays be combined when provided by both command line arguments and\na configuration file.\n\n### duplicate arguments array\n\n* default: `true`\n* key: `duplicate-arguments-array`\n\nShould arguments be coerced into an array when duplicated:\n\n```console\n$ node example.js -x 1 -x 2\n{ _: [], x: [1, 2] }\n```\n\n_if disabled:_\n\n```console\n$ node example.js -x 1 -x 2\n{ _: [], x: 2 }\n```\n\n### flatten duplicate arrays\n\n* default: `true`\n* key: `flatten-duplicate-arrays`\n\nShould array arguments be coerced into a single array when duplicated:\n\n```console\n$ node example.js -x 1 2 -x 3 4\n{ _: [], x: [1, 2, 3, 4] }\n```\n\n_if disabled:_\n\n```console\n$ node example.js -x 1 2 -x 3 4\n{ _: [], x: [[1, 2], [3, 4]] }\n```\n\n### greedy arrays\n\n* default: `true`\n* key: `greedy-arrays`\n\nShould arrays consume more than one positional argument following their flag.\n\n```console\n$ node example --arr 1 2\n{ _: [], arr: [1, 2] }\n```\n\n_if disabled:_\n\n```console\n$ node example --arr 1 2\n{ _: [2], arr: [1] }\n```\n\n**Note: in `v18.0.0` we are considering defaulting greedy arrays to `false`.**\n\n### nargs eats options\n\n* default: `false`\n* key: `nargs-eats-options`\n\nShould nargs consume dash options as well as positional arguments.\n\n### negation prefix\n\n* default: `no-`\n* key: `negation-prefix`\n\nThe prefix to use for negated boolean variables.\n\n```console\n$ node example.js --no-foo\n{ _: [], foo: false }\n```\n\n_if set to `quux`:_\n\n```console\n$ node example.js --quuxfoo\n{ _: [], foo: false }\n```\n\n### populate --\n\n* default: `false`.\n* key: `populate--`\n\nShould unparsed flags be stored in `--` or `_`.\n\n_If disabled:_\n\n```console\n$ node example.js a -b -- x y\n{ _: [ 'a', 'x', 'y' ], b: true }\n```\n\n_If enabled:_\n\n```console\n$ node example.js a -b -- x y\n{ _: [ 'a' ], '--': [ 'x', 'y' ], b: true }\n```\n\n### set placeholder key\n\n* default: `false`.\n* key: `set-placeholder-key`.\n\nShould a placeholder be added for keys not set via the corresponding CLI argument?\n\n_If disabled:_\n\n```console\n$ node example.js -a 1 -c 2\n{ _: [], a: 1, c: 2 }\n```\n\n_If enabled:_\n\n```console\n$ node example.js -a 1 -c 2\n{ _: [], a: 1, b: undefined, c: 2 }\n```\n\n### halt at non-option\n\n* default: `false`.\n* key: `halt-at-non-option`.\n\nShould parsing stop at the first positional argument? This is similar to how e.g. `ssh` parses its command line.\n\n_If disabled:_\n\n```console\n$ node example.js -a run b -x y\n{ _: [ 'b' ], a: 'run', x: 'y' }\n```\n\n_If enabled:_\n\n```console\n$ node example.js -a run b -x y\n{ _: [ 'b', '-x', 'y' ], a: 'run' }\n```\n\n### strip aliased\n\n* default: `false`\n* key: `strip-aliased`\n\nShould aliases be removed before returning results?\n\n_If disabled:_\n\n```console\n$ node example.js --test-field 1\n{ _: [], 'test-field': 1, testField: 1, 'test-alias': 1, testAlias: 1 }\n```\n\n_If enabled:_\n\n```console\n$ node example.js --test-field 1\n{ _: [], 'test-field': 1, testField: 1 }\n```\n\n### strip dashed\n\n* default: `false`\n* key: `strip-dashed`\n\nShould dashed keys be removed before returning results?  This option has no effect if\n`camel-case-expansion` is disabled.\n\n_If disabled:_\n\n```console\n$ node example.js --test-field 1\n{ _: [], 'test-field': 1, testField: 1 }\n```\n\n_If enabled:_\n\n```console\n$ node example.js --test-field 1\n{ _: [], testField: 1 }\n```\n\n### unknown options as args\n\n* default: `false`\n* key: `unknown-options-as-args`\n\nShould unknown options be treated like regular arguments?  An unknown option is one that is not\nconfigured in `opts`.\n\n_If disabled_\n\n```console\n$ node example.js --unknown-option --known-option 2 --string-option --unknown-option2\n{ _: [], unknownOption: true, knownOption: 2, stringOption: '', unknownOption2: true }\n```\n\n_If enabled_\n\n```console\n$ node example.js --unknown-option --known-option 2 --string-option --unknown-option2\n{ _: ['--unknown-option'], knownOption: 2, stringOption: '--unknown-option2' }\n```\n\n## Supported Node.js Versions\n\nLibraries in this ecosystem make a best effort to track\n[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a\npost on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).\n\n## Special Thanks\n\nThe yargs project evolves from optimist and minimist. It owes its\nexistence to a lot of James Halliday's hard work. Thanks [substack](https://github.com/substack) **beep** **boop** \\o/\n\n## License\n\nISC\n","readmeFilename":"README.md"}