`args-tokens` is a high-performance, type-safe library designed for parsing command-line arguments, offering a compatible token representation with Node.js `util.parseArgs`. It differentiates itself by providing a decoupled, more performant approach to argument parsing and tokenization compared to the built-in Node.js utility. The library is optimized for universal runtimes, ships with comprehensive TypeScript types, and maintains zero external dependencies, making it a lightweight and efficient choice for CLI application development. Currently at version 0.24.3, `args-tokens` demonstrates an active release cadence, frequently delivering bug fixes, performance improvements, and new features. Its key differentiators include significantly faster parsing benchmarks, explicit control over argument resolution, and a strong focus on generating `util.parseArgs`-compatible tokens.
npm install args-tokensVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic argument tokenization with `parse` and resolution with `resolveArgs` using an options schema, mirroring `util.parseArgs` functionality.
Upgrade your Node.js runtime environment to version 20 or newer (e.g., using nvm, fnm, or volta).
Thoroughly test argument parsing behavior with various short option combinations if exact parity with `util.parseArgs` is critical for your application.
Use experimental features with caution. Consider pinning to a specific patch version if you rely on the experimental combinators or postpone adoption until the API stabilizes.
Use ES Module `import` syntax: `import { parse } from 'args-tokens';`. Ensure your project's `package.json` includes `"type": "module"` or your file uses the `.mjs` extension.Ensure you are using named imports: `import { parse, resolveArgs } from 'args-tokens';`.Upgrade your Node.js runtime to version 20 or newer to meet the package's engine requirements.
No dependency data recorded yet.