暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829
  1. // Main entrypoint for ESM web browser environments. Avoids using Node.js
  2. // specific libraries, such as "path".
  3. //
  4. // TODO: figure out reasonable web equivalents for "resolve", "normalize", etc.
  5. import { camelCase, decamelize, looksLikeNumber } from './build/lib/string-utils.js'
  6. import { YargsParser } from './build/lib/yargs-parser.js'
  7. const parser = new YargsParser({
  8. cwd: () => { return '' },
  9. format: (str, arg) => { return str.replace('%s', arg) },
  10. normalize: (str) => { return str },
  11. resolve: (str) => { return str },
  12. require: () => {
  13. throw Error('loading config from files not currently supported in browser')
  14. },
  15. env: () => {}
  16. })
  17. const yargsParser = function Parser (args, opts) {
  18. const result = parser.parse(args.slice(), opts)
  19. return result.argv
  20. }
  21. yargsParser.detailed = function (args, opts) {
  22. return parser.parse(args.slice(), opts)
  23. }
  24. yargsParser.camelCase = camelCase
  25. yargsParser.decamelize = decamelize
  26. yargsParser.looksLikeNumber = looksLikeNumber
  27. export default yargsParser