New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

@jesscss/css-parser

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jesscss/css-parser

Jess CSS base parser

npmnpm
Version
2.0.0-alpha.22
Version published
Maintainers
1
Created
Source

@jesscss/css-parser

parse() produces selectors, at-rule preludes, and declaration values as structured nodes in the same pass, rather than retaining them as strings for consumers to re-parse. The reasoning, the PostCSS contrast, and the counter-considerations are in docs/architecture/parser/PARSE-ONCE-DEEPLY.md; it is not restated here.

The CSS package exposes Parseman CSS grammar, canonical AST v2 parsing, and explicit CST parsing:

  • @jesscss/css-parserparse() to canonical AST v2 Stylesheet, and CST types.
  • @jesscss/css-parser/positions — the same parse() with line/column facts.
  • @jesscss/css-parser/cst — CST parsing entry.
  • @jesscss/css-parser/cst/positions — the same CST parsers with line/column facts.
  • @jesscss/css-parser/grammar — compiled CSS grammar (alias for /grammar/ast).

Line-aware entries

parse and the CST parsers come in two bindings, one per compiled table, so an entry never loads a table it does not parse with:

EntryExportTreePositions
@jesscss/css-parser (.)parseASTno
@jesscss/css-parser/positionsparseASTyes
@jesscss/css-parser/cstparseCssCst, parseCssDocCSTno
@jesscss/css-parser/cst/positionsparseCssCst, parseCssDocCSTyes

The /positions entries export the same names bound to the line-aware table: switching is a change of import specifier, not of call site.

Choosing a grammar build

Each compiled grammar is a standalone multi-megabyte artifact, so the four variants ship as four separate files. Importing one never loads the others. Pick by the two questions the subpath name answers — which tree, and whether source positions are tracked:

SubpathExportTreePositions
@jesscss/css-parser/grammar/astcssGrammarASTno
@jesscss/css-parser/grammar/ast/positionscssPositionsGrammarASTyes
@jesscss/css-parser/grammar/cstcssCstGrammar plus the individual CST rule handles (Stylesheet, Ruleset, …)CSTno
@jesscss/css-parser/grammar/cst/positionscssCstPositionsGrammarCSTyes

@jesscss/css-parser/grammar is an alias for /grammar/ast, the build the shipping parse() route uses. It is not a barrel: it exposes the AST variant only, so importing it cannot pull the other three in. The main entry no longer re-exports compiled grammars — that would have made every parse() consumer load all four builds.

The positions variants set startLine/startColumn on every span. There is no trackLines option: an option would force one module to name both tables, and Node executes every module it statically imports, so the choice is which entry you import. Error tolerance is not a property of a build — the CST runner collects result.errors on either CST variant.

The CST and grammar entries expose Parseman types and grammar values. Parseman ships as a bundled dependency, so it installs with the package automatically.

The former ./jess Chevrotain/functional-builder surface is deleted. CSS has no legacy tree parser or construction host. Its public parser constructs the canonical AST directly through Parseman reductions; the named CST APIs remain for language-service/document consumers only.

FAQs

Package last updated on 20 Sep 2026

Related posts