@projectwallace/css-parser 0.8.4 → 0.8.5

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/dist/arena.js CHANGED
@@ -57,15 +57,18 @@ class CSSDataArena {
57
57
  // Number of nodes that can fit
58
58
  count;
59
59
  // Number of nodes currently allocated
60
+ growth_count;
61
+ // Number of times the arena has grown
60
62
  // Growth multiplier when capacity is exceeded
61
63
  static GROWTH_FACTOR = 1.3;
62
64
  // Estimated nodes per KB of CSS (based on real-world data)
63
- static NODES_PER_KB = 60;
65
+ static NODES_PER_KB = 270;
64
66
  // Buffer to avoid frequent growth (15%)
65
- static CAPACITY_BUFFER = 1.15;
67
+ static CAPACITY_BUFFER = 1.2;
66
68
  constructor(initial_capacity = 1024) {
67
69
  this.capacity = initial_capacity;
68
70
  this.count = 1;
71
+ this.growth_count = 0;
69
72
  this.buffer = new ArrayBuffer(initial_capacity * BYTES_PER_NODE);
70
73
  this.view = new DataView(this.buffer);
71
74
  }
@@ -84,6 +87,10 @@ class CSSDataArena {
84
87
  get_capacity() {
85
88
  return this.capacity;
86
89
  }
90
+ // Get the number of times the arena has grown
91
+ get_growth_count() {
92
+ return this.growth_count;
93
+ }
87
94
  // Calculate byte offset for a node
88
95
  node_offset(node_index) {
89
96
  return node_index * BYTES_PER_NODE;
@@ -208,6 +215,7 @@ class CSSDataArena {
208
215
  // --- Node Creation ---
209
216
  // Grow the arena by 1.3x when capacity is exceeded
210
217
  grow() {
218
+ this.growth_count++;
211
219
  let new_capacity = Math.ceil(this.capacity * CSSDataArena.GROWTH_FACTOR);
212
220
  let new_buffer = new ArrayBuffer(new_capacity * BYTES_PER_NODE);
213
221
  new Uint8Array(new_buffer).set(new Uint8Array(this.buffer));
@@ -80,6 +80,8 @@ export declare class CSSNode {
80
80
  private source;
81
81
  private index;
82
82
  constructor(arena: CSSDataArena, source: string, index: number);
83
+ /** Get the arena (for internal/advanced use only) */
84
+ __get_arena(): CSSDataArena;
83
85
  /** Get node type as number (for performance) */
84
86
  get type(): CSSNodeType;
85
87
  /** Get node type as human-readable string */
package/dist/css-node.js CHANGED
@@ -49,6 +49,10 @@ class CSSNode {
49
49
  this.source = source;
50
50
  this.index = index;
51
51
  }
52
+ /** Get the arena (for internal/advanced use only) */
53
+ __get_arena() {
54
+ return this.arena;
55
+ }
52
56
  /** Get node type as number (for performance) */
53
57
  get type() {
54
58
  return this.arena.get_type(this.index);
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@projectwallace/css-parser",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "High-performance CSS lexer and parser, optimized for CSS inspection and analysis",
5
- "author": "Bart Veneman <bat@projectwallace.com>",
5
+ "author": "Bart Veneman <bart@projectwallace.com>",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",