Skip to content

Forward default options from the parser factory - #345

Open
Aurantium-47 wants to merge 1 commit into
postcss:mainfrom
Aurantium-47:fix/forward-parser-default-options
Open

Aurantium-47 wants to merge 1 commit into
postcss:mainfrom
Aurantium-47:fix/forward-parser-default-options

Conversation

@Aurantium-47

Copy link
Copy Markdown

The documented parser(transform, options) API drops its second argument. For example, parser(undefined, { lossless: false }).processSync('a > b') returns a > b instead of a>b.

Forward the default options to Processor and expose the optional argument in the existing TypeScript overloads. The processor already merges defaults with per-call options. Four regression tests cover synchronous and asynchronous whitespace handling, a custom nesting limit, asynchronous rule mutation, and per-call overrides. Type checks cover omitted transforms, return inference, and the existing restriction on calling async processors synchronously.

Validation on Windows with Node 24.15.0:

  • All four regression tests fail on the unchanged source and pass with this fix.
  • Full suite: 800 passing; coverage 94.98% lines, 95.50% branches, 97.70% functions, meeting the configured thresholds.
  • TypeScript build, type checks, lint, formatting of changed source files, and git diff --check pass. Lint reports two existing unnecessary-escape warnings in exceptions.mjs.

Developed and tested with OpenAI Codex assistance.

Pass documented factory options to Processor and expose the optional argument in the TypeScript overloads. Cover default options and per-call overrides without changing Processor semantics.

Assisted-by: OpenAI GPT-6 <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant