@gjsify/domparser 0.4.42 → 0.4.44

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/README.md +34 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # @gjsify/domparser
2
+
3
+ A minimal `DOMParser.parseFromString` implementation (XML/HTML) with a small DOM surface — `tagName`, `getAttribute`, `children`, `querySelector`/`querySelectorAll`, `textContent`, `innerHTML`. Sized for excalibur-tiled and simple config parsing; runs on GJS, Node.js, and browsers (where the native `DOMParser` is used instead).
4
+
5
+ Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ gjsify install @gjsify/domparser
11
+
12
+ # npm or yarn also work (e.g. adding it to an existing project):
13
+ npm install @gjsify/domparser
14
+ yarn add @gjsify/domparser
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```typescript
20
+ import { DOMParser } from '@gjsify/domparser';
21
+
22
+ const parser = new DOMParser();
23
+ const doc = parser.parseFromString('<map width="20" height="15"><layer name="bg"/></map>', 'text/xml');
24
+
25
+ const map = doc.querySelector('map');
26
+ console.log(map?.getAttribute('width')); // "20"
27
+
28
+ const layers = doc.querySelectorAll('layer');
29
+ console.log(layers[0]?.getAttribute('name')); // "bg"
30
+ ```
31
+
32
+ ## License
33
+
34
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/domparser",
3
- "version": "0.4.42",
3
+ "version": "0.4.44",
4
4
  "description": "DOMParser for GJS — self-contained XML parser with minimal DOM (querySelector, getAttribute, children)",
5
5
  "module": "lib/esm/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -46,8 +46,8 @@
46
46
  "web-api"
47
47
  ],
48
48
  "devDependencies": {
49
- "@gjsify/cli": "^0.4.42",
50
- "@gjsify/unit": "^0.4.42",
49
+ "@gjsify/cli": "^0.4.44",
50
+ "@gjsify/unit": "^0.4.44",
51
51
  "@types/node": "^25.9.1",
52
52
  "typescript": "^6.0.3"
53
53
  },