@tbela99/css-parser 2.3.1 → 2.3.2
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 +38 -0
- package/README.md +56 -26
- package/architecture.png +0 -0
- package/dist/ast/arena-node.js +32 -3
- package/dist/ast/arena.js +88 -10
- package/dist/ast/cache.js +1 -1
- package/dist/ast/features/calc.js +1 -1
- package/dist/ast/features/if.js +1 -1
- package/dist/ast/features/index.js +1 -1
- package/dist/ast/features/inlinecssvariables.js +1 -1
- package/dist/ast/features/mixin.js +1 -1
- package/dist/ast/features/prefix.js +1 -1
- package/dist/ast/features/shorthand.js +1 -1
- package/dist/ast/features/transform.js +1 -1
- package/dist/ast/features/type.js +1 -1
- package/dist/ast/math/expression.js +1 -1
- package/dist/ast/math/math.js +1 -1
- package/dist/ast/minify.js +131 -36
- package/dist/ast/mixins/custom-function.js +1 -1
- package/dist/ast/mixins/utils.js +1 -1
- package/dist/ast/mixins/variables.js +1 -1
- package/dist/ast/strings.js +26 -1
- package/dist/ast/transform/compute.js +6 -2
- package/dist/ast/transform/matrix.js +1 -1
- package/dist/ast/transform/minify.js +1 -1
- package/dist/ast/transform/perspective.js +1 -1
- package/dist/ast/transform/rotate.js +1 -1
- package/dist/ast/transform/scale.js +1 -1
- package/dist/ast/transform/skew.js +1 -1
- package/dist/ast/transform/translate.js +1 -1
- package/dist/ast/transform/utils.js +1 -1
- package/dist/ast/types.js +22 -2
- package/dist/ast/walk.js +1 -1
- package/dist/data/properties.json.js +1 -1
- package/dist/data/validation.json.js +1 -1
- package/dist/fs/resolve.js +1 -1
- package/dist/index-umd-web.js +1084 -293
- package/dist/index.d.ts +597 -686
- package/dist/node.js +14 -8
- package/dist/parser/declaration/list.js +8 -5
- package/dist/parser/declaration/map.js +1 -1
- package/dist/parser/declaration/set.js +1 -1
- package/dist/parser/input.js +62 -4
- package/dist/parser/linesmap.js +1 -1
- package/dist/parser/parse.js +121 -13
- package/dist/parser/source.js +1 -1
- package/dist/parser/tokenize.js +161 -19
- package/dist/parser/utils/angle.js +1 -1
- package/dist/parser/utils/at-rule-container.js +1 -1
- package/dist/parser/utils/at-rule-font-feature-values.js +1 -1
- package/dist/parser/utils/at-rule-generic.js +1 -1
- package/dist/parser/utils/at-rule-import.js +1 -1
- package/dist/parser/utils/at-rule-media.js +42 -2
- package/dist/parser/utils/at-rule-support.js +1 -1
- package/dist/parser/utils/at-rule-when-else.js +1 -1
- package/dist/parser/utils/at-rule.js +1 -1
- package/dist/parser/utils/base64.js +1 -1
- package/dist/parser/utils/cache.js +1 -1
- package/dist/parser/utils/canonical.js +1 -1
- package/dist/parser/utils/codes.js +1 -1
- package/dist/parser/utils/config.js +1 -1
- package/dist/parser/utils/declaration.js +1 -1
- package/dist/parser/utils/eq.js +1 -1
- package/dist/parser/utils/hash.js +1 -1
- package/dist/parser/utils/selector.js +98 -6
- package/dist/parser/utils/text.js +1 -1
- package/dist/parser/utils/token.js +1 -1
- package/dist/parser/utils/type.js +1 -1
- package/dist/printer/lib/codec.js +1 -1
- package/dist/printer/render.js +5 -7
- package/dist/printer/result.js +3 -1
- package/dist/printer/sourcemap.js +1 -1
- package/dist/printer/writer.js +1 -1
- package/dist/syntax/color/a98rgb.js +1 -1
- package/dist/syntax/color/alpha.js +1 -1
- package/dist/syntax/color/cmyk.js +1 -1
- package/dist/syntax/color/color-mix.js +1 -1
- package/dist/syntax/color/color.js +1 -1
- package/dist/syntax/color/hex.js +1 -1
- package/dist/syntax/color/hsl.js +12 -4
- package/dist/syntax/color/hwb.js +9 -3
- package/dist/syntax/color/lab.js +1 -1
- package/dist/syntax/color/lch.js +1 -1
- package/dist/syntax/color/oklab.js +1 -1
- package/dist/syntax/color/oklch.js +2 -2
- package/dist/syntax/color/p3.js +1 -1
- package/dist/syntax/color/prophotorgb.js +1 -1
- package/dist/syntax/color/rec2020.js +1 -1
- package/dist/syntax/color/relative-color.js +1 -1
- package/dist/syntax/color/rgb.js +1 -1
- package/dist/syntax/color/srgb.js +3 -2
- package/dist/syntax/color/utils/color-type.js +1 -1
- package/dist/syntax/color/utils/colorspace.js +1 -1
- package/dist/syntax/color/utils/components.js +1 -1
- package/dist/syntax/color/utils/distance.js +1 -1
- package/dist/syntax/color/utils/make-color.js +1 -1
- package/dist/syntax/color/utils/matrix.js +1 -1
- package/dist/syntax/color/xyz.js +1 -1
- package/dist/syntax/color/xyzd50.js +1 -1
- package/dist/syntax/constants.js +2 -2
- package/dist/syntax/syntax.js +1 -1
- package/dist/types.js +1 -1
- package/dist/utils/sync.js +1 -1
- package/dist/validation/compiled/builtins.js +1 -1
- package/dist/validation/compiled/runtime.js +1 -1
- package/dist/validation/compiled/syntaxes.js +1 -1
- package/dist/validation/config.js +1 -1
- package/dist/validation/first.js +1 -1
- package/dist/validation/match.js +77 -4
- package/dist/validation/parser/parse.js +1 -1
- package/dist/validation/parser/typedef.js +4 -1
- package/dist/validation/utils/list.js +1 -1
- package/dist/version.js +2 -2
- package/dist/web.js +13 -6
- package/package.json +15 -6
package/dist/version.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
CSS parser, minifier and validator for node, deno, bun and the browser
|
|
3
3
|
|
|
4
4
|
Author(s): Thierry Bela
|
|
5
|
-
Version: 2.3.
|
|
5
|
+
Version: 2.3.2
|
|
6
6
|
License: MIT
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* Version number
|
|
10
10
|
*/
|
|
11
|
-
const version = "2.3.
|
|
11
|
+
const version = "2.3.2";
|
|
12
12
|
|
|
13
13
|
export { version };
|
package/dist/web.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
CSS parser, minifier and validator for node, deno, bun and the browser
|
|
3
3
|
|
|
4
4
|
Author(s): Thierry Bela
|
|
5
|
-
Version: 2.3.
|
|
5
|
+
Version: 2.3.2
|
|
6
6
|
License: MIT
|
|
7
7
|
*/
|
|
8
8
|
import { doParse, doParseSync } from './parser/parse.js';
|
|
@@ -11,9 +11,9 @@ import { doRender } from './printer/render.js';
|
|
|
11
11
|
export { renderValue } from './printer/render.js';
|
|
12
12
|
import { TransformResult, RenderResult } from './printer/result.js';
|
|
13
13
|
import { ModuleScopeEnumOptions } from './ast/types.js';
|
|
14
|
-
export { ColorType, EnumAstNodeStatus, EnumToken, ModuleCaseTransformEnum, WalkerEvent, WalkerOptionEnum } from './ast/types.js';
|
|
14
|
+
export { ColorType, EnumAstNodeStatus, EnumToken, MergeRulesEnum, ModuleCaseTransformEnum, WalkerEvent, WalkerOptionEnum } from './ast/types.js';
|
|
15
15
|
import { createParseInfo, Tokenizer } from './parser/tokenize.js';
|
|
16
|
-
import { isCssInput } from './parser/input.js';
|
|
16
|
+
import { setStreamSize, responseSize, isCssInput } from './parser/input.js';
|
|
17
17
|
import { matchUrl, resolve, dirname } from './fs/resolve.js';
|
|
18
18
|
import { ResponseType } from './types.js';
|
|
19
19
|
import { SourceFile } from './parser/source.js';
|
|
@@ -25,6 +25,8 @@ export { Arena, AstArena, TokenField, arenaColumns } from './ast/arena.js';
|
|
|
25
25
|
export { ARENA, ARENAID, AstArenaNode } from './ast/arena-node.js';
|
|
26
26
|
export { PropertyList } from './parser/declaration/list.js';
|
|
27
27
|
export { SourceMap } from './printer/sourcemap.js';
|
|
28
|
+
export { ValidationTokenEnum } from './validation/parser/typedef.js';
|
|
29
|
+
export { LOC } from './syntax/constants.js';
|
|
28
30
|
export { FeatureWalkMode } from './ast/features/type.js';
|
|
29
31
|
export { parseSyntax } from './validation/parser/parse.js';
|
|
30
32
|
export { version } from './version.js';
|
|
@@ -69,7 +71,10 @@ async function load(url, currentDirectory = ".", responseType = false) {
|
|
|
69
71
|
if (responseType === ResponseType.JSON) {
|
|
70
72
|
return response.json();
|
|
71
73
|
}
|
|
72
|
-
|
|
74
|
+
// the size of the body: the parser allocates its buffers once
|
|
75
|
+
return responseType === ResponseType.ReadableStream
|
|
76
|
+
? setStreamSize(response.body, responseSize(response))
|
|
77
|
+
: response.text();
|
|
73
78
|
});
|
|
74
79
|
}
|
|
75
80
|
/**
|
|
@@ -206,7 +211,8 @@ function transformSync(...args) {
|
|
|
206
211
|
validateSyncArguments(options);
|
|
207
212
|
}
|
|
208
213
|
// the options of the caller are not modified: they may be reused
|
|
209
|
-
|
|
214
|
+
// the fast mode sets the default value of minify (see fastModeOptions)
|
|
215
|
+
options = { ...(options?.fastMode ? null : { minify: true }), removeEmpty: true, removeCharset: true, ...options };
|
|
210
216
|
const startTime = performance.now();
|
|
211
217
|
const parseResult = parseSyncInput(stream, options);
|
|
212
218
|
let mapping = null;
|
|
@@ -353,7 +359,8 @@ async function transform(...args) {
|
|
|
353
359
|
stream = input;
|
|
354
360
|
}
|
|
355
361
|
}
|
|
356
|
-
|
|
362
|
+
// the fast mode sets the default value of minify (see fastModeOptions)
|
|
363
|
+
options = { ...(options?.fastMode ? null : { minify: true }), removeEmpty: true, removeCharset: true, ...options };
|
|
357
364
|
const startTime = performance.now();
|
|
358
365
|
return parseInput(stream, options).then((parseResult) => {
|
|
359
366
|
let mapping = null;
|
package/package.json
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbela99/css-parser",
|
|
3
3
|
"description": "CSS parser, minifier and validator for node, deno, bun and the browser",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.2",
|
|
5
5
|
"exports": {
|
|
6
|
-
".":
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"default": "./dist/node.js"
|
|
9
|
+
},
|
|
10
|
+
"./node": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/node.js"
|
|
13
|
+
},
|
|
14
|
+
"./web": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/web.js"
|
|
17
|
+
}
|
|
9
18
|
},
|
|
10
19
|
"type": "module",
|
|
11
20
|
"typings": "dist/index.d.ts",
|
|
@@ -69,7 +78,7 @@
|
|
|
69
78
|
"@types/chai": "^5.2.3",
|
|
70
79
|
"@types/chai-as-promised": "^8.0.2",
|
|
71
80
|
"@types/mocha": "^10.0.10",
|
|
72
|
-
"@types/node": "^26.6.
|
|
81
|
+
"@types/node": "^26.6.11",
|
|
73
82
|
"@types/web": "^0.0.367",
|
|
74
83
|
"@typescript/typescript6": "^6.0.2",
|
|
75
84
|
"@web/test-runner": "^1.0.1",
|
|
@@ -80,7 +89,7 @@
|
|
|
80
89
|
"markdown-it-task-lists": "^2.1.1",
|
|
81
90
|
"mocha": "^12.0.3",
|
|
82
91
|
"playwright": "^1.65.1",
|
|
83
|
-
"rollup": "^4.68.
|
|
92
|
+
"rollup": "^4.68.8",
|
|
84
93
|
"rollup-plugin-dts": "^6.5.1",
|
|
85
94
|
"rollup-plugin-version-injector": "^1.3.3",
|
|
86
95
|
"superc8": "^12.7.0",
|