@sprlab/wccompiler 0.4.2 → 0.4.3

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/lib/compiler.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * Takes a .wcc file path and produces a self-contained JavaScript web component string.
7
7
  */
8
8
 
9
- import { JSDOM } from 'jsdom';
9
+ import { parseHTML } from 'linkedom';
10
10
  import { readFileSync, existsSync } from 'node:fs';
11
11
  import { dirname, extname, basename, resolve } from 'node:path';
12
12
  import { walkTree, processIfChains, processForBlocks, recomputeAnchorPath, detectRefs } from './tree-walker.js';
@@ -223,9 +223,9 @@ async function compileSFC(filePath, config) {
223
223
  exposeNames,
224
224
  };
225
225
 
226
- // 16. Process template through jsdom → tree-walker → codegen (same as compile())
227
- const dom = new JSDOM(`<div id="__root">${template}</div>`);
228
- const rootEl = dom.window.document.getElementById('__root');
226
+ // 16. Process template through linkedom → tree-walker → codegen
227
+ const { document } = parseHTML(`<div id="__root">${template}</div>`);
228
+ const rootEl = document.getElementById('__root');
229
229
 
230
230
  const signalNames = new Set(signals.map(s => s.name));
231
231
  const computedNames = new Set(computeds.map(c => c.name));
@@ -12,7 +12,7 @@
12
12
  * extracts branch templates, and replaces chains with comment anchors.
13
13
  */
14
14
 
15
- import { JSDOM } from 'jsdom';
15
+ import { parseHTML } from 'linkedom';
16
16
  import { BOOLEAN_ATTRIBUTES } from './types.js';
17
17
 
18
18
  /** @import { Binding, EventBinding, IfBlock, IfBranch, ShowBinding, AttrBinding, ForBlock, ModelBinding, SlotBinding, SlotProp, RefBinding, ChildComponentBinding, ChildPropBinding } from './types.js' */
@@ -358,8 +358,8 @@ function isChainPredecessor(el) {
358
358
  * @returns {{ bindings: Binding[], events: EventBinding[], showBindings: ShowBinding[], attrBindings: AttrBinding[], modelBindings: ModelBinding[], slots: SlotBinding[], processedHtml: string }}
359
359
  */
360
360
  export function walkBranch(html, signalNames, computedNames, propNames) {
361
- const dom = new JSDOM(`<div id="__branchRoot">${html}</div>`);
362
- const branchRoot = dom.window.document.getElementById('__branchRoot');
361
+ const { document } = parseHTML(`<div id="__branchRoot">${html}</div>`);
362
+ const branchRoot = document.getElementById('__branchRoot');
363
363
 
364
364
  // Use walkTree on the branch root to discover bindings/events
365
365
  const result = walkTree(branchRoot, signalNames, computedNames, propNames);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprlab/wccompiler",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Zero-runtime compiler that transforms .wcc single-file components into native web components with signals-based reactivity",
5
5
  "type": "module",
6
6
  "bin": {
@@ -32,11 +32,11 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "esbuild": "^0.27.0",
35
- "jsdom": "^29.0.2"
35
+ "linkedom": "^0.18.12"
36
36
  },
37
37
  "devDependencies": {
38
- "@types/jsdom": "^28.0.1",
39
38
  "fast-check": "^4.1.1",
39
+ "jsdom": "^29.1.1",
40
40
  "typescript": "^6.0.3",
41
41
  "vitest": "^3.2.1"
42
42
  },