@tbela99/css-parser 1.0.0 → 1.1.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 +265 -0
- package/README.md +16 -11
- package/dist/index-umd-web.js +3613 -1829
- package/dist/index.cjs +3611 -1827
- package/dist/index.d.ts +160 -50
- package/dist/lib/ast/expand.js +2 -1
- package/dist/lib/ast/features/calc.js +12 -1
- package/dist/lib/ast/features/inlinecssvariables.js +47 -24
- package/dist/lib/ast/features/prefix.js +117 -86
- package/dist/lib/ast/features/shorthand.js +29 -6
- package/dist/lib/ast/features/transform.js +10 -3
- package/dist/lib/ast/features/type.js +7 -0
- package/dist/lib/ast/math/expression.js +7 -1
- package/dist/lib/ast/math/math.js +6 -0
- package/dist/lib/ast/minify.js +165 -77
- package/dist/lib/ast/transform/compute.js +1 -0
- package/dist/lib/ast/transform/matrix.js +1 -0
- package/dist/lib/ast/types.js +17 -15
- package/dist/lib/ast/walk.js +33 -7
- package/dist/lib/fs/resolve.js +10 -0
- package/dist/lib/parser/declaration/list.js +48 -45
- package/dist/lib/parser/declaration/map.js +1 -0
- package/dist/lib/parser/declaration/set.js +2 -1
- package/dist/lib/parser/parse.js +364 -276
- package/dist/lib/parser/tokenize.js +147 -72
- package/dist/lib/parser/utils/declaration.js +4 -3
- package/dist/lib/parser/utils/type.js +2 -1
- package/dist/lib/renderer/color/a98rgb.js +2 -1
- package/dist/lib/renderer/color/color-mix.js +10 -7
- package/dist/lib/renderer/color/color.js +171 -153
- package/dist/lib/renderer/color/hex.js +2 -1
- package/dist/lib/renderer/color/hsl.js +2 -1
- package/dist/lib/renderer/color/hwb.js +2 -1
- package/dist/lib/renderer/color/lab.js +2 -1
- package/dist/lib/renderer/color/lch.js +2 -1
- package/dist/lib/renderer/color/oklab.js +2 -1
- package/dist/lib/renderer/color/oklch.js +2 -1
- package/dist/lib/renderer/color/p3.js +2 -1
- package/dist/lib/renderer/color/rec2020.js +2 -1
- package/dist/lib/renderer/color/relativecolor.js +17 -11
- package/dist/lib/renderer/color/rgb.js +4 -3
- package/dist/lib/renderer/color/srgb.js +18 -17
- package/dist/lib/renderer/color/utils/components.js +6 -5
- package/dist/lib/renderer/color/utils/constants.js +47 -3
- package/dist/lib/renderer/color/xyz.js +2 -1
- package/dist/lib/renderer/color/xyzd50.js +2 -1
- package/dist/lib/renderer/render.js +48 -20
- package/dist/lib/syntax/syntax.js +253 -140
- package/dist/lib/validation/at-rules/container.js +75 -97
- package/dist/lib/validation/at-rules/counter-style.js +9 -8
- package/dist/lib/validation/at-rules/custom-media.js +13 -15
- package/dist/lib/validation/at-rules/document.js +22 -27
- package/dist/lib/validation/at-rules/font-feature-values.js +8 -8
- package/dist/lib/validation/at-rules/import.js +30 -81
- package/dist/lib/validation/at-rules/keyframes.js +18 -22
- package/dist/lib/validation/at-rules/layer.js +5 -5
- package/dist/lib/validation/at-rules/media.js +42 -52
- package/dist/lib/validation/at-rules/namespace.js +19 -23
- package/dist/lib/validation/at-rules/page-margin-box.js +15 -18
- package/dist/lib/validation/at-rules/page.js +8 -7
- package/dist/lib/validation/at-rules/supports.js +73 -82
- package/dist/lib/validation/at-rules/when.js +32 -36
- package/dist/lib/validation/atrule.js +15 -14
- package/dist/lib/validation/config.js +24 -1
- package/dist/lib/validation/config.json.js +563 -63
- package/dist/lib/validation/parser/parse.js +196 -185
- package/dist/lib/validation/parser/types.js +1 -1
- package/dist/lib/validation/selector.js +3 -3
- package/dist/lib/validation/syntax.js +828 -0
- package/dist/lib/validation/syntaxes/complex-selector-list.js +10 -11
- package/dist/lib/validation/syntaxes/complex-selector.js +10 -11
- package/dist/lib/validation/syntaxes/compound-selector.js +40 -50
- package/dist/lib/validation/syntaxes/family-name.js +9 -8
- package/dist/lib/validation/syntaxes/keyframe-block-list.js +4 -3
- package/dist/lib/validation/syntaxes/keyframe-selector.js +15 -18
- package/dist/lib/validation/syntaxes/layer-name.js +6 -5
- package/dist/lib/validation/syntaxes/relative-selector-list.js +7 -6
- package/dist/lib/validation/syntaxes/relative-selector.js +2 -1
- package/dist/lib/validation/syntaxes/url.js +18 -22
- package/dist/lib/validation/utils/list.js +2 -1
- package/dist/lib/validation/utils/whitespace.js +2 -1
- package/dist/node/index.js +4 -2
- package/dist/node/load.js +5 -0
- package/dist/web/index.js +4 -2
- package/dist/web/load.js +5 -0
- package/package.json +12 -11
|
@@ -2,9 +2,10 @@ import { EnumToken } from '../../ast/types.js';
|
|
|
2
2
|
import '../../ast/minify.js';
|
|
3
3
|
import '../../ast/walk.js';
|
|
4
4
|
import '../../parser/parse.js';
|
|
5
|
+
import '../../parser/tokenize.js';
|
|
6
|
+
import '../../parser/utils/config.js';
|
|
5
7
|
import '../../renderer/color/utils/constants.js';
|
|
6
8
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
7
|
-
import '../../parser/utils/config.js';
|
|
8
9
|
|
|
9
10
|
function stripCommaToken(tokenList) {
|
|
10
11
|
let result = [];
|
|
@@ -2,9 +2,10 @@ import { EnumToken } from '../../ast/types.js';
|
|
|
2
2
|
import '../../ast/minify.js';
|
|
3
3
|
import '../../ast/walk.js';
|
|
4
4
|
import '../../parser/parse.js';
|
|
5
|
+
import '../../parser/tokenize.js';
|
|
6
|
+
import '../../parser/utils/config.js';
|
|
5
7
|
import '../../renderer/color/utils/constants.js';
|
|
6
8
|
import '../../renderer/sourcemap/lib/encode.js';
|
|
7
|
-
import '../../parser/utils/config.js';
|
|
8
9
|
|
|
9
10
|
function consumeWhitespace(tokens) {
|
|
10
11
|
if (tokens.length == 0) {
|
package/dist/node/index.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
|
-
export { EnumToken } from '../lib/ast/types.js';
|
|
2
|
+
export { EnumToken, ValidationLevel } from '../lib/ast/types.js';
|
|
3
3
|
export { minify } from '../lib/ast/minify.js';
|
|
4
4
|
export { walk, walkValues } from '../lib/ast/walk.js';
|
|
5
5
|
export { expand } from '../lib/ast/expand.js';
|
|
6
6
|
import { doRender } from '../lib/renderer/render.js';
|
|
7
7
|
export { renderToken } from '../lib/renderer/render.js';
|
|
8
|
+
import '../lib/renderer/color/utils/constants.js';
|
|
8
9
|
import { doParse } from '../lib/parser/parse.js';
|
|
9
10
|
export { parseString, parseTokens } from '../lib/parser/parse.js';
|
|
10
|
-
import '../lib/
|
|
11
|
+
import '../lib/parser/tokenize.js';
|
|
11
12
|
import '../lib/parser/utils/config.js';
|
|
12
13
|
import '../lib/validation/config.js';
|
|
13
14
|
import '../lib/validation/parser/types.js';
|
|
14
15
|
import '../lib/validation/parser/parse.js';
|
|
15
16
|
import '../lib/validation/syntaxes/complex-selector.js';
|
|
17
|
+
import '../lib/validation/syntax.js';
|
|
16
18
|
import { dirname, resolve } from '../lib/fs/resolve.js';
|
|
17
19
|
import { load } from './load.js';
|
|
18
20
|
|
package/dist/node/load.js
CHANGED
|
@@ -7,6 +7,11 @@ function parseResponse(response) {
|
|
|
7
7
|
}
|
|
8
8
|
return response.text();
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* load file
|
|
12
|
+
* @param url
|
|
13
|
+
* @param currentFile
|
|
14
|
+
*/
|
|
10
15
|
async function load(url, currentFile = '.') {
|
|
11
16
|
const resolved = resolve(url, currentFile);
|
|
12
17
|
return matchUrl.test(resolved.absolute) ? fetch(resolved.absolute).then(parseResponse) : readFile(resolved.absolute, { encoding: 'utf-8' });
|
package/dist/web/index.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
export { EnumToken } from '../lib/ast/types.js';
|
|
1
|
+
export { EnumToken, ValidationLevel } from '../lib/ast/types.js';
|
|
2
2
|
export { minify } from '../lib/ast/minify.js';
|
|
3
3
|
export { walk, walkValues } from '../lib/ast/walk.js';
|
|
4
4
|
export { expand } from '../lib/ast/expand.js';
|
|
5
5
|
import { doRender } from '../lib/renderer/render.js';
|
|
6
6
|
export { renderToken } from '../lib/renderer/render.js';
|
|
7
|
+
import '../lib/renderer/color/utils/constants.js';
|
|
7
8
|
import { doParse } from '../lib/parser/parse.js';
|
|
8
9
|
export { parseString, parseTokens } from '../lib/parser/parse.js';
|
|
9
|
-
import '../lib/
|
|
10
|
+
import '../lib/parser/tokenize.js';
|
|
10
11
|
import '../lib/parser/utils/config.js';
|
|
11
12
|
import '../lib/validation/config.js';
|
|
12
13
|
import '../lib/validation/parser/types.js';
|
|
13
14
|
import '../lib/validation/parser/parse.js';
|
|
14
15
|
import '../lib/validation/syntaxes/complex-selector.js';
|
|
16
|
+
import '../lib/validation/syntax.js';
|
|
15
17
|
import { dirname, resolve } from '../lib/fs/resolve.js';
|
|
16
18
|
import { load } from './load.js';
|
|
17
19
|
|
package/dist/web/load.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbela99/css-parser",
|
|
3
3
|
"description": "CSS parser for node and the browser",
|
|
4
|
-
"version": "v1.
|
|
4
|
+
"version": "v1.1.0",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/node/index.js",
|
|
7
7
|
"./node": "./dist/node/index.js",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "rollup -c;./build.sh dist/index.d.ts 'declare interface' 'declare type'",
|
|
19
19
|
"test": "web-test-runner \"test/**/web.spec.js\" --node-resolve --playwright --browsers chromium firefox webkit --root-dir=.; mocha --reporter-options='maxDiffSize=1801920' \"test/**/node.spec.js\"",
|
|
20
|
+
"test:web": "web-test-runner \"test/**/web.spec.js\" --node-resolve --playwright --browsers chromium firefox webkit --root-dir=.",
|
|
20
21
|
"test:node": "mocha --reporter-options='maxDiffSize=1801920' \"test/**/node.spec.js\"",
|
|
21
22
|
"test:cov": "c8 -x 'test/specs/**/*.js' -x dist/lib/validation/syntax.js -x 'dist/lib/validation/parser/*.js' --reporter=html --reporter=text --reporter=json-summary mocha --reporter-options='maxDiffSize=1801920' \"test/**/node.spec.js\"",
|
|
22
23
|
"test:web-cov": "web-test-runner -x 'test/specs/**/*.js' -x dist/lib/validation/syntax.js,dist/lib/validation/parser \"test/**/web.spec.js\" --node-resolve --playwright --browsers chromium firefox webkit --root-dir=. --coverage",
|
|
@@ -51,21 +52,21 @@
|
|
|
51
52
|
"homepage": "https://github.com/tbela99/css-parser#readme",
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@esm-bundle/chai": "^4.3.4-fix.0",
|
|
54
|
-
"@rollup/plugin-commonjs": "^28.0.
|
|
55
|
+
"@rollup/plugin-commonjs": "^28.0.6",
|
|
55
56
|
"@rollup/plugin-json": "^6.1.0",
|
|
56
57
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
57
|
-
"@rollup/plugin-typescript": "^12.1.
|
|
58
|
-
"@types/chai": "^5.2.
|
|
58
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
59
|
+
"@types/chai": "^5.2.2",
|
|
59
60
|
"@types/mocha": "^10.0.10",
|
|
60
|
-
"@types/node": "^
|
|
61
|
-
"@types/web": "^0.0.
|
|
62
|
-
"@web/test-runner": "^0.20.
|
|
63
|
-
"@web/test-runner-playwright": "^0.11.
|
|
61
|
+
"@types/node": "^24.0.10",
|
|
62
|
+
"@types/web": "^0.0.245",
|
|
63
|
+
"@web/test-runner": "^0.20.2",
|
|
64
|
+
"@web/test-runner-playwright": "^0.11.1",
|
|
64
65
|
"c8": "^10.1.3",
|
|
65
66
|
"esno": "^4.8.0",
|
|
66
|
-
"mocha": "^11.1
|
|
67
|
-
"playwright": "^1.
|
|
68
|
-
"rollup": "^4.
|
|
67
|
+
"mocha": "^11.7.1",
|
|
68
|
+
"playwright": "^1.53.2",
|
|
69
|
+
"rollup": "^4.44.2",
|
|
69
70
|
"rollup-plugin-dts": "^6.2.1",
|
|
70
71
|
"tslib": "^2.8.1"
|
|
71
72
|
}
|