Files
scriptc/tests/corpus/2681-util-parseargs-dynamic.js
Chris Tate a4e9970119 Support static util.parseArgs (#103)
* Support static util.parseArgs

- Lower typed util.parseArgs calls through the C and LLVM backends.
- Add a link-gated native parser with Node-compatible options, tokens, defaults, and errors.
- Cover ESM, CommonJS, default argv, sanitizer, and TS7 behavior.

* fix(runtime): align parseArgs behavior with Node

* fix(runtime): close parseArgs parity gaps

* fix(runtime): match parseArgs edge cases

* fix(runtime): preserve parseArgs short and default semantics
2026-08-09 08:57:03 -05:00

14 lines
408 B
JavaScript

// @dynamic
// An any-typed config is engine-backed in the dynamic tier. The static
// util.parseArgs spoke must snapshot its documented members before parsing.
import { parseArgs } from "node:util";
const config = /** @type {any} */ ({
args: ["--name=codex", "tail"],
options: { name: { type: "string" } },
allowPositionals: true,
tokens: true,
});
console.log(JSON.stringify(parseArgs(config)));