Sitelet https://github.com/postcss/postcss-selector-parser/pull/345
Skip to content

Forward default options from the parser factory - #345

Merged
MoOx merged 1 commit into
postcss:mainfrom
Aurantium-47:fix/forward-parser-default-options
Nov 8, 2026
Merged

MoOx merged 1 commit into
postcss:mainfrom
Aurantium-47:fix/forward-parser-default-options

Conversation

@Aurantium-47

Copy link
Copy Markdown
Contributor

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>
@MoOx
MoOx merged commit cf59ffc into postcss:main Nov 8, 2026
4 checks passed
MoOx added a commit to wozhenbang2004/postcss-selector-parser that referenced this pull request Nov 8, 2026
* origin/main:
  feat: support the case-sensitive attribute flag (s) per Selectors Level 4 (postcss#327)
  fix: escape values assigned to an id through the value setter (postcss#326)
  fix: escape class values supplied to the constructor (postcss#349)
  fix: preserve the spaces declared on selector and root containers (postcss#356)
  fix: forward the default options given to the parser factory (postcss#345)
  7.1.8
  fix: remove four more quadratic paths from selector parsing

# Conflicts:
#	src/parser.js
MoOx added a commit to theRizwan/postcss-selector-parser that referenced this pull request Nov 8, 2026
* origin/main:
  fix: preserve selector delimiters after escaped backslashes (postcss#354)
  fix: keep the processor's entry points usable when destructured
  feat: support the case-sensitive attribute flag (s) per Selectors Level 4 (postcss#327)
  fix: escape values assigned to an id through the value setter (postcss#326)
  fix: escape class values supplied to the constructor (postcss#349)
  fix: preserve the spaces declared on selector and root containers (postcss#356)
  fix: forward the default options given to the parser factory (postcss#345)
  7.1.8
  fix: remove four more quadratic paths from selector parsing
  chore(deps): bump tinypool and oxfmt (postcss#351)
  7.1.7
  docs: add CVE-2026-104844 to the 7.1.6 changelog entry
  fix: keep whitespace around the namespace separator in attribute selectors (postcss#339)
  fix: invalidate stale raw spelling on combinator value assignment (postcss#342)
  fix: set parents for all variadic inserted nodes (postcss#343)
  Consume whitespace after hexadecimal CSS escapes (postcss#340)
  fix: lossless mode drops whitespace when a selector ends empty (postcss#337)
  chore(deps-dev): bump source-map-js from 1.2.1 to 1.2.2 (postcss#347)
  7.1.6
  fix: parse flat selectors in linear time, closing a CPU exhaustion vulnerability

# Conflicts:
#	src/parser.js
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.

2 participants