mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-21 05:50:55 +08:00
* 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
14 lines
408 B
JavaScript
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)));
|