@projectwallace/css-parser 0.7.0 → 0.7.1

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 (2) hide show
  1. package/dist/css-node.d.ts +41 -3
  2. package/package.json +8 -10
@@ -1,6 +1,44 @@
1
1
  import type { CSSDataArena } from './arena';
2
2
  import { STYLESHEET, STYLE_RULE, AT_RULE, DECLARATION, SELECTOR, COMMENT, BLOCK, IDENTIFIER, NUMBER, DIMENSION, STRING, HASH, FUNCTION, OPERATOR, PARENTHESIS, URL, SELECTOR_LIST, TYPE_SELECTOR, CLASS_SELECTOR, ID_SELECTOR, ATTRIBUTE_SELECTOR, PSEUDO_CLASS_SELECTOR, PSEUDO_ELEMENT_SELECTOR, COMBINATOR, UNIVERSAL_SELECTOR, NESTING_SELECTOR, NTH_SELECTOR, NTH_OF_SELECTOR, LANG_SELECTOR, MEDIA_QUERY, MEDIA_FEATURE, MEDIA_TYPE, CONTAINER_QUERY, SUPPORTS_QUERY, LAYER_NAME, PRELUDE_OPERATOR } from './arena';
3
- export declare const TYPE_NAMES: Record<number, string>;
3
+ export declare const TYPE_NAMES: {
4
+ readonly 1: "StyleSheet";
5
+ readonly 2: "Rule";
6
+ readonly 3: "Atrule";
7
+ readonly 4: "Declaration";
8
+ readonly 5: "Selector";
9
+ readonly 6: "Comment";
10
+ readonly 7: "Block";
11
+ readonly 10: "Identifier";
12
+ readonly 11: "Number";
13
+ readonly 12: "Dimension";
14
+ readonly 13: "String";
15
+ readonly 14: "Hash";
16
+ readonly 15: "Function";
17
+ readonly 16: "Operator";
18
+ readonly 17: "Parentheses";
19
+ readonly 18: "Url";
20
+ readonly 20: "SelectorList";
21
+ readonly 21: "TypeSelector";
22
+ readonly 22: "ClassSelector";
23
+ readonly 23: "IdSelector";
24
+ readonly 24: "AttributeSelector";
25
+ readonly 25: "PseudoClassSelector";
26
+ readonly 26: "PseudoElementSelector";
27
+ readonly 27: "Combinator";
28
+ readonly 28: "UniversalSelector";
29
+ readonly 29: "NestingSelector";
30
+ readonly 30: "Nth";
31
+ readonly 31: "NthOf";
32
+ readonly 56: "Lang";
33
+ readonly 32: "MediaQuery";
34
+ readonly 33: "Feature";
35
+ readonly 34: "MediaType";
36
+ readonly 35: "ContainerQuery";
37
+ readonly 36: "SupportsQuery";
38
+ readonly 37: "Layer";
39
+ readonly 38: "Operator";
40
+ };
41
+ export type TypeName = (typeof TYPE_NAMES)[keyof typeof TYPE_NAMES] | 'unknown';
4
42
  export type CSSNodeType = typeof STYLESHEET | typeof STYLE_RULE | typeof AT_RULE | typeof DECLARATION | typeof SELECTOR | typeof COMMENT | typeof BLOCK | typeof IDENTIFIER | typeof NUMBER | typeof DIMENSION | typeof STRING | typeof HASH | typeof FUNCTION | typeof OPERATOR | typeof PARENTHESIS | typeof URL | typeof SELECTOR_LIST | typeof TYPE_SELECTOR | typeof CLASS_SELECTOR | typeof ID_SELECTOR | typeof ATTRIBUTE_SELECTOR | typeof PSEUDO_CLASS_SELECTOR | typeof PSEUDO_ELEMENT_SELECTOR | typeof COMBINATOR | typeof UNIVERSAL_SELECTOR | typeof NESTING_SELECTOR | typeof NTH_SELECTOR | typeof NTH_OF_SELECTOR | typeof LANG_SELECTOR | typeof MEDIA_QUERY | typeof MEDIA_FEATURE | typeof MEDIA_TYPE | typeof CONTAINER_QUERY | typeof SUPPORTS_QUERY | typeof LAYER_NAME | typeof PRELUDE_OPERATOR;
5
43
  export interface CloneOptions {
6
44
  /**
@@ -16,7 +54,7 @@ export interface CloneOptions {
16
54
  }
17
55
  export type PlainCSSNode = {
18
56
  type: number;
19
- type_name: string;
57
+ type_name: TypeName;
20
58
  text: string;
21
59
  children: PlainCSSNode[];
22
60
  name?: string;
@@ -43,7 +81,7 @@ export declare class CSSNode {
43
81
  constructor(arena: CSSDataArena, source: string, index: number);
44
82
  get_index(): number;
45
83
  get type(): CSSNodeType;
46
- get type_name(): string;
84
+ get type_name(): TypeName;
47
85
  get text(): string;
48
86
  get name(): string;
49
87
  get property(): string;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@projectwallace/css-parser",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "High-performance CSS lexer and parser, optimized for CSS inspection and analysis",
5
5
  "author": "Bart Veneman <bat@projectwallace.com>",
6
6
  "license": "MIT",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/projectwallace/css-parser.git"
10
- },
11
- "issues": "https://github.com/projectwallace/css-parser/issues",
12
- "homepage": "https://github.com/projectwallace/css-parser",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/projectwallace/css-parser.git"
10
+ },
11
+ "issues": "https://github.com/projectwallace/css-parser/issues",
12
+ "homepage": "https://github.com/projectwallace/css-parser",
13
13
  "type": "module",
14
14
  "main": "./dist/index.js",
15
15
  "module": "./dist/index.js",
@@ -56,8 +56,7 @@
56
56
  "benchmark:memory": "npm run build && node --expose-gc benchmark/memory.ts",
57
57
  "lint": "oxlint --config .oxlintrc.json",
58
58
  "lint-package": "publint",
59
- "check": "tsc --noEmit",
60
- "knip": "knip"
59
+ "check": "tsc --noEmit"
61
60
  },
62
61
  "keywords": [
63
62
  "css",
@@ -72,7 +71,6 @@
72
71
  "@vitest/coverage-v8": "^4.0.8",
73
72
  "bootstrap": "^5.3.8",
74
73
  "css-tree": "^3.1.0",
75
- "knip": "^5.69.1",
76
74
  "oxlint": "^1.28.0",
77
75
  "postcss": "^8.5.6",
78
76
  "prettier": "^3.6.2",