@tbela99/css-parser 1.4.10 → 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.
Files changed (37) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/README.md +11 -4
  3. package/dist/index-umd-web.js +2118 -1701
  4. package/dist/index.cjs +2130 -1696
  5. package/dist/index.d.ts +781 -269
  6. package/dist/lib/ast/clone.js +13 -8
  7. package/dist/lib/ast/expand.js +45 -9
  8. package/dist/lib/ast/features/calc.js +2 -1
  9. package/dist/lib/ast/features/if.js +24 -4
  10. package/dist/lib/ast/features/prefix.js +13 -31
  11. package/dist/lib/ast/features/shorthand.js +1 -1
  12. package/dist/lib/ast/features/transform.js +5 -2
  13. package/dist/lib/ast/find.js +7 -5
  14. package/dist/lib/ast/minify.js +80 -35
  15. package/dist/lib/ast/node.js +50 -0
  16. package/dist/lib/ast/types.js +1 -1
  17. package/dist/lib/ast/walk.js +27 -7
  18. package/dist/lib/fs/resolve.js +64 -32
  19. package/dist/lib/parser/declaration/map.js +14 -5
  20. package/dist/lib/parser/linesmap.js +5 -13
  21. package/dist/lib/parser/parse.js +489 -719
  22. package/dist/lib/parser/source.js +16 -2
  23. package/dist/lib/parser/tokenize.js +382 -278
  24. package/dist/lib/parser/utils/at-rule-container.js +2 -1
  25. package/dist/lib/parser/utils/selector.js +88 -10
  26. package/dist/lib/renderer/render.js +174 -99
  27. package/dist/lib/renderer/sourcemap/lib/codec.js +78 -0
  28. package/dist/lib/renderer/sourcemap/sourcemap.js +190 -34
  29. package/dist/lib/syntax/syntax.js +14 -151
  30. package/dist/lib/validation/match.js +81 -1
  31. package/dist/node.js +41 -26
  32. package/dist/utils/sync.d.ts +16 -0
  33. package/dist/utils/sync.js +52 -0
  34. package/dist/web.js +26 -28
  35. package/llms.txt +12 -5
  36. package/package.json +1 -1
  37. package/dist/lib/renderer/sourcemap/lib/encode.js +0 -37
package/CHANGELOG.md CHANGED
@@ -1,8 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ # v1.5.0
4
+
5
+ ## Improvements
6
+
7
+ - [x] Add support for input sourcemap
8
+
9
+ # v1.4.11
10
+
11
+ - fix bug in url resolution
12
+
3
13
  # v1.4.10
4
14
 
5
- - failure to convert colors to display-linear due to missing import
15
+ - failure to convert colors to display-p3-linear due to missing import
6
16
 
7
17
  # v1.4.9
8
18
 
package/README.md CHANGED
@@ -4,7 +4,9 @@
4
4
 
5
5
  # css-parser
6
6
 
7
- CSS parser, transformer, minifier and validator for node and the browser
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
- **Experimental vendor prefix cleanup** to modernize generated CSS.
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