dreamopt is a JavaScript library designed for parsing command-line arguments, offering a syntax aimed at readability and ease of use. It supports a comprehensive range of features including mandatory and optional arguments, options with values, default values, automatic help generation, and the ability to define commands, subcommands, and nested subcommands. It also includes automatic type coercion for arguments (e.g., to numbers) and allows for custom tags and coercion rules. The library's core differentiator was its declarative, array-based specification format for defining CLI structures. The current stable version, `0.8.0`, was published in July 2012. The package is effectively abandoned, with its last commit over a decade ago. Despite its abandonment, npm download statistics show surprisingly high usage, which may be attributed to it being a transitive dependency in other legacy projects or due to automated processes, rather than active new development.
npm install dreamoptVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic command and option parsing with dreamopt, including argument access, version/help flags, and conditional command execution based on user input.
Migrate to a currently maintained command-line parser like `commander`, `yargs`, or `minimist`.
Ensure your project is configured for CommonJS, or use `require()` within an ESM wrapper (if necessary) at your own risk. The recommended fix is to migrate to a modern CLI parser that supports ESM.
There is no direct fix to make `dreamopt` fully compatible with modern Node.js. Consider rewriting the CLI parsing logic using an up-to-date library.
If using TypeScript, you would need to write your own declaration file (`.d.ts`) for `dreamopt` or, preferably, migrate to a CLI parsing library that includes or has community-supported types.
Always verify the last publish date and GitHub activity for a package's true maintenance status, regardless of download counts.
Convert your project or file to CommonJS, or rewrite the CLI parsing using an ESM-compatible library like `commander` or `yargs`.
Ensure `wordwrap` is explicitly listed in your `package.json` dependencies and try `npm install`. If the issue persists, it's a strong indicator of deeper compatibility problems, and migration to a modern CLI parser is recommended.
This error points to fundamental incompatibility with modern JavaScript engines or strict mode environments. There is no practical fix other than replacing `dreamopt` with a modern, actively maintained alternative.