@tbela99/css-parser 1.4.11 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +11 -4
- package/dist/index-umd-web.js +2116 -1699
- package/dist/index.cjs +2128 -1694
- package/dist/index.d.ts +781 -269
- package/dist/lib/ast/clone.js +13 -8
- package/dist/lib/ast/expand.js +45 -9
- package/dist/lib/ast/features/calc.js +2 -1
- package/dist/lib/ast/features/if.js +24 -4
- package/dist/lib/ast/features/prefix.js +13 -31
- package/dist/lib/ast/features/shorthand.js +1 -1
- package/dist/lib/ast/features/transform.js +5 -2
- package/dist/lib/ast/find.js +7 -5
- package/dist/lib/ast/minify.js +80 -35
- package/dist/lib/ast/node.js +50 -0
- package/dist/lib/ast/types.js +1 -1
- package/dist/lib/ast/walk.js +27 -7
- package/dist/lib/fs/resolve.js +60 -28
- package/dist/lib/parser/declaration/map.js +14 -5
- package/dist/lib/parser/linesmap.js +5 -13
- package/dist/lib/parser/parse.js +489 -719
- package/dist/lib/parser/source.js +16 -2
- package/dist/lib/parser/tokenize.js +382 -278
- package/dist/lib/parser/utils/at-rule-container.js +2 -1
- package/dist/lib/parser/utils/selector.js +88 -10
- package/dist/lib/renderer/render.js +174 -99
- package/dist/lib/renderer/sourcemap/lib/codec.js +78 -0
- package/dist/lib/renderer/sourcemap/sourcemap.js +190 -34
- package/dist/lib/syntax/syntax.js +14 -151
- package/dist/lib/validation/match.js +81 -1
- package/dist/node.js +41 -26
- package/dist/utils/sync.d.ts +16 -0
- package/dist/utils/sync.js +52 -0
- package/dist/web.js +26 -28
- package/llms.txt +12 -5
- package/package.json +1 -1
- package/dist/lib/renderer/sourcemap/lib/encode.js +0 -37
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
# css-parser
|
|
6
6
|
|
|
7
|
-
CSS
|
|
7
|
+
An all-in-one CSS parsing solution for Node.js and the browser, covering parsing, validation, transformation, minification, and AST-based tooling.
|
|
8
|
+
|
|
9
|
+
The library always fully parses the stylesheet into a structured AST, and token values are exposed as typed data so custom transforms, plugins, and analysis can work with reliable, semantic input instead of raw strings.
|
|
8
10
|
|
|
9
11
|
## Installation
|
|
10
12
|
|
|
@@ -23,9 +25,11 @@ $ deno add @tbela99/css-parser
|
|
|
23
25
|
## Features
|
|
24
26
|
|
|
25
27
|
* **Zero dependencies** — lightweight and easy to integrate into any project.
|
|
28
|
+
* **All-in-one CSS parsing solution** covering parsing, validation, transformation, minification, and AST manipulation.
|
|
26
29
|
* **Standards-based CSS validation** powered by MDN data.
|
|
27
30
|
* **Full CSS Modules support** for modern component-based workflows.
|
|
28
|
-
* **Fault-tolerant parsing** that follows the CSS Syntax Module Level 3 specification.
|
|
31
|
+
* **Fault-tolerant parsing** that follows the CSS Syntax Module Level 3 specification and always produces a complete, structured parse result.
|
|
32
|
+
* **Typed tokens and AST** — parsed CSS is exposed as strongly typed tokens and nodes so plugins and transforms can operate on semantic structures.
|
|
29
33
|
* **High-performance minification** with safe optimizations and no unsafe transforms.
|
|
30
34
|
* **Advanced color processing** with support for modern color spaces and functions, including `color()`, `lab()`, `lch()`, `oklab()`, `oklch()`, `color-mix()`, `light-dark()`, system colors, and relative colors.
|
|
31
35
|
* **Color conversion engine** capable of transforming colors between all supported formats.
|
|
@@ -39,7 +43,7 @@ $ deno add @tbela99/css-parser
|
|
|
39
43
|
* **`@import` flattening** to produce self-contained stylesheets.
|
|
40
44
|
|
|
41
45
|
## Vendor prefix removal
|
|
42
|
-
**
|
|
46
|
+
**Vendor prefix cleanup** to modernize generated CSS.
|
|
43
47
|
|
|
44
48
|
## Syntax lowering
|
|
45
49
|
CSS-Parser can transform these modern CSS features into lower-level CSS syntax:
|
|
@@ -81,10 +85,13 @@ Try it [online](https://tbela99.github.io/css-parser/playground/)
|
|
|
81
85
|
- [CSS Modules](https://tbela99.github.io/css-parser/docs/documents/Guide.CSS_Modules.html)
|
|
82
86
|
- [Minification](https://tbela99.github.io/css-parser/docs/documents/Guide.Minification.html)
|
|
83
87
|
- [Custom Transform](https://tbela99.github.io/css-parser/docs/documents/Guide.Custom_Transform.html)
|
|
88
|
+
- [Sourcemap](https://tbela99.github.io/css-parser/docs/documents/Guide.Sourcemap.html)
|
|
89
|
+
- [Plugins API](https://tbela99.github.io/css-parser/docs/documents/Guide.Plugins_API.html)
|
|
84
90
|
- [Syntax Lowering](https://tbela99.github.io/css-parser/docs/documents/Guide.Syntax_Lowering.html)
|
|
91
|
+
- [Prefix Removal](https://tbela99.github.io/css-parser/docs/documents/Guide.Prefix_Removal.html)
|
|
85
92
|
- [Ast Manipulation](https://tbela99.github.io/css-parser/docs/documents/Guide.Ast_Manipulation.html)
|
|
86
93
|
- [Utility Functions](https://tbela99.github.io/css-parser/docs/documents/Guide.Utility_Functions.html)
|
|
87
|
-
|
|
94
|
+
|
|
88
95
|
## AST
|
|
89
96
|
|
|
90
97
|
### Comment
|