Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
89645b6
update documentation
tbela99 Jun 15, 2026
cef61ef
reorganize documentation #127
tbela99 Jun 15, 2026
3da99fd
do not minify supports() arguments #127
tbela99 Jun 16, 2026
4e39277
fix parsing bug #127
tbela99 Jun 19, 2026
ab8ef7e
remove prefix from webkit gradient functions. minify gradient functio…
tbela99 Jun 25, 2026
3850dc2
change doc theme #127
tbela99 Jun 25, 2026
4553b26
fix doc theme hover style #127
tbela99 Jun 26, 2026
200ccde
minify conic-gradient syntax #127
tbela99 Jun 27, 2026
7725cf9
remove console log #127
tbela99 Jun 27, 2026
201f316
update changlelog #127
tbela99 Jun 27, 2026
66fc73e
update changlelog #127
tbela99 Jun 27, 2026
6a359bd
case insensitive function validation #127
tbela99 Jun 27, 2026
c574a11
minify css gradient #127
tbela99 Jun 28, 2026
38a5227
implement alpha() color function #127
tbela99 Jun 28, 2026
58a251a
changing oklab distance threshold to 0.00001 #127
tbela99 Jun 30, 2026
c5743ad
implement color-mix() with multiple arguments #127
tbela99 Jul 1, 2026
53a9def
fix path resolution on Windows #127
tbela99 Jul 3, 2026
b9b46a5
add Windows ci #127
tbela99 Jul 3, 2026
b2da1f9
replace crlf with lf #127
tbela99 Jul 3, 2026
e4bac11
fix validation issues #127
tbela99 Jul 9, 2026
3513196
update windows ci #127
tbela99 Jul 9, 2026
5d219ee
fix failing test case #127
tbela99 Jul 9, 2026
f9e6566
adding deprecation notices #127
tbela99 Jul 10, 2026
6e82a94
add missing doc file #127
tbela99 Jul 13, 2026
c66b196
removing console debug #127
tbela99 Jul 13, 2026
acf5622
fix path for test files on windows #127
tbela99 Jul 13, 2026
86dd485
bump version number #127
tbela99 Jul 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@
# do not replace lf by crlf
*.css text
*.json text
*.css text
*.js text
*.ts text
*.sh text
text eol=lf

4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ jobs:
runs-on: ubuntu-latest
steps:
# Your original steps
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
- name: Install
run: npm install
- name: Test and Coverage
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jsr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ jobs:
contents: read
id-token: write # The OIDC ID token is used for authentication with JSR.
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- run: npx jsr publish
6 changes: 3 additions & 3 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [ 20.x, 22.x, 24.x ]
node-version: [ 22.x, 24.x, 26.x ]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- name: Install NPM dependencies
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js Windows CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: windows-latest

strategy:
fail-fast: false
matrix:
node-version: [ 22.x, 24.x, 26.x ]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- name: Install NPM dependencies
run: npm install
- name: Install playwright dependencies
run: npx playwright install --with-deps
- run: npm run 'test:node'
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ test/*.html
test/*.json
test/*.md
/docs
/deno.lock
/badges
/.nyc_output
/.repl_history
/CPU.*

# Logs
logs
Expand Down
6 changes: 5 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@
/test/css-modules/demo.css
/test/img/
/test/main.mjs
/test/modules/
/test/modules/
/playground
/deno.lock
/scripts
/typedoc.config.js
194 changes: 192 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,198 @@
# Changelog

## v1.4.3
## v1.4.4

### Validation changes

- [x] Added the `state` and `errors` properties to nodes to expose their validation status and any associated validation errors.
- [x] Nodes that fail validation are no longer discarded. Nodes are discarded only if they are invalid, unparsed, or malformed. Unknown nodes are discarded when lenient parsing is disabled.

### Color

- [x] `alpha()`: Added support for minifying the CSS Color 5 `alpha()` color function.

```ts

import {transform} from '@tbela99/css-parser';

const css = `

:root {
--mycolor: oklch(60% 0.25 315 / 0.8);
}
.s {

color:
alpha(from var(--mycolor) / calc(alpha * 0.5));

`;

const result = await transform(css, {
beautify: true,
inlineCssVariables: true,
});

console.debug(result.code);

```

result:

```css
.s {
color: #b538e366
}
```

- [x] `color-mix()`: Implemented support for the updated `color-mix()` syntax defined in https://www.w3.org/TR/css-values-5/#color-mix


```ts

import {transform} from '@tbela99/css-parser';

const css = `
.hsl { color: color-mix(firebrick, goldenrod); }
`;

const result = await transform(css, {
beautify: true,
convertColor: ColorType.OKLAB
});

console.debug(result.code);

```

result:

```css
.hsl {
color: oklab(.624172 .087878 .113592)
}
```

### Webkit gradient prefix removal

- [x] Convert -webkit-* gradient functions
- [x] -webkit-gradient() to:
- [x] linear-gradient()
- [ ] radial-gradient() - not supported ⚠️
- [x] -webkit-linear-gradient()
- [x] -webkit-repeating-linear-gradient()
- [x] -webkit-radial-gradient()
- [x] -webkit-repeating-radial-gradient()

### CSS gradient minification

- [x] Minify gradient functions
- [x] linear-gradient()
- [x] radial-gradient()
- [x] conic-gradient()
- [x] repeating-linear-gradient()
- [x] repeating-radial-gradient()
- [x] repeating-conic-gradient()

### Other changes

- [x] Minify transform-origin property
- [x] Changing oklab distance threshold to `0.00001` according to https://drafts.csswg.org/css-color-4/#comparing-color-values

### Bug fixes
- [x] Fix path resolution on Windows
- [x] Do not minify supports() arguments

CSS incorrectly parsed:

```css
body {
background-color: if(
supports(color: oklch(0.7 0.185 232)): oklch(0.7 0.185 232);
else: #00adf3;
);

&::after {
content: if(
supports(color: oklch(0.7 0.185 232)): "Your browser supports OKLCH";
else: "Your browser does not support OKLCH";
);
}
}
```

result:

```css
body {
background-color: if(supports(color:#00aefc):#00aefc;else:#00adf3);
&:after {
content: if(supports(color:#00aefc):"Your browser supports OKLCH";else:"Your browser does not support OKLCH")
}
}
```

instead of:

```css
body {
background-color: #00adf3;
@supports (color:oklch(.7 .185 232)) {
background-color: #00aefc
}
&:after {
content: "Your browser does not support OKLCH";
@supports (color:oklch(.7 .185 232)) {
content: "Your browser supports OKLCH"
}
}
}
```

- [x] Incorrectly parse selector when removePrefix and css module settings are enabled

```css
*,:before,:after {
box-sizing: border-box
}
```
is parsed and rendered as:

```css
,,*:before:after {
box-sizing: border-box
}
```

instead of:

```css
*,:before,:after {
box-sizing: border-box
}
```

### Deprecation

#### Loading as commonjs module
- [x] Deprecate commonjs entry point. It will be removed in a future release.

#### Functions
- [x] Deprecate `parseFile()`. Use `parse({file, asStream, ...options})` instead.
- [x] Deprecate `transformFile()`. Use `transform({file, asStream, ...options})` instead

#### Enums
- [x] Deprecate using `ValidationLevel` to configure parsing validation settings. Use `boolean` values instead.
- [x] Deprecate invalid `EnumToken` node types. There are no longer used.
- [x] `EnumToken.InvalidRuleNodeType`
- [x] `EnumToken.InvalidAtRuleNodeType`
- [x] `EnumToken.InvalidDeclarationNodeType`

#### Interfaces
- [x] `AstInvalidRule`
- [x] `AstInvalidDeclaration`
- [x] `AstInvalidAtRule`

## v1.4.3

### CSS Modules

Expand All @@ -14,7 +205,6 @@ result = await transform(css, {
beautify: true,
module: {scoped: ModuleScopeEnumOptions.Shortest
}

});

console.log(result.code);
Expand Down
Loading
Loading