Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@lezer/css
Advanced tools
@lezer/css is a parser for CSS written using the Lezer parser system. It provides a way to parse CSS code into a syntax tree, which can be useful for syntax highlighting, code analysis, and other tooling purposes.
Parsing CSS
This feature allows you to parse a CSS string into a syntax tree. The code sample demonstrates how to use the parser to convert a CSS string into a tree structure.
const {parser} = require('@lezer/css');
const input = 'body { color: red; }';
const tree = parser.parse(input);
console.log(tree.toString());
Syntax Tree Traversal
This feature allows you to traverse the syntax tree generated by the parser. The code sample shows how to use a TreeCursor to iterate over the nodes in the syntax tree.
const {parser} = require('@lezer/css');
const {TreeCursor} = require('@lezer/common');
const input = 'body { color: red; }';
const tree = parser.parse(input);
let cursor = tree.cursor();
do {
console.log(cursor.node.type.name);
} while (cursor.next());
PostCSS is a tool for transforming CSS with JavaScript plugins. It provides a way to parse CSS into an Abstract Syntax Tree (AST), which can then be manipulated and transformed. Compared to @lezer/css, PostCSS is more focused on transforming and processing CSS rather than just parsing it.
CSSTree is a tool for working with CSS, including parsing, generating, and analyzing CSS code. It provides a detailed AST and various utilities for manipulating CSS. CSSTree offers more comprehensive features for CSS analysis and transformation compared to @lezer/css.
Stylelint is a modern linter that helps you avoid errors and enforce conventions in your styles. While it also parses CSS, its primary focus is on linting and enforcing coding standards, which is different from the primary parsing focus of @lezer/css.
This is a CSS grammar for the lezer parser system.
The code is licensed under an MIT license.
0.15.2 (2021-09-24)
Distinguish between variable names and other names.
Fix the name of nodes for the selector
keyword (which by accident was callee
before).
FAQs
lezer-based CSS grammar
The npm package @lezer/css receives a total of 428,051 weekly downloads. As such, @lezer/css popularity was classified as popular.
We found that @lezer/css demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.