@plurnk/plurnk-mimetypes-application-xml 0.1.0
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/LICENSE +21 -0
- package/README.md +23 -0
- package/dist/ApplicationXml.d.ts +9 -0
- package/dist/ApplicationXml.d.ts.map +1 -0
- package/dist/ApplicationXml.js +202 -0
- package/dist/ApplicationXml.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PossumTech Laboratories, LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @plurnk/plurnk-mimetypes-application-xml
|
|
2
|
+
|
|
3
|
+
`application/xml` AND `text/xml` mimetype handler for the [plurnk](https://github.com/plurnk) ecosystem. DOM-tree extraction via [@xmldom/xmldom](https://www.npmjs.com/package/@xmldom/xmldom); XPath 1.0 via [xpath](https://www.npmjs.com/package/xpath).
|
|
4
|
+
|
|
5
|
+
## install
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm i @plurnk/plurnk-mimetypes-application-xml
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## what it does
|
|
12
|
+
|
|
13
|
+
Provides three channels per the framework's #10 contract:
|
|
14
|
+
|
|
15
|
+
- **symbols** (`extractRaw` / `preview`) — root element as a `module`; immediate children as `field` symbols named by `id` attribute, `name` attribute, or tag name (in that order of preference). Surfaces enough shape for the model to recognize "this is RSS / this is SOAP / this is a Maven pom" without dumping every leaf.
|
|
16
|
+
- **deep-json** (`deepJson`) — full DOM tree as nested objects. Each element: `{ type: tagName, attrs: {...}, children: [...] }` per the framework's `attrs` convention. Text-only elements collapse to a `text` field; mixed content keeps text nodes as `{ type: "#text", text }` siblings.
|
|
17
|
+
- **deep-xml** (framework-projected) — the deep-json projected back to XML via `projectJsonToXml`. xpath queries like `//book[@id='b1']/title` work naturally.
|
|
18
|
+
|
|
19
|
+
`query()` overrides the `xpath` dialect to run against the real DOM (via the `xpath` package's XPath 1.0 engine over xmldom). `jsonpath` inherits the framework's default dispatch against `deepJson`. `regex` and `glob` inherit text-based scanning.
|
|
20
|
+
|
|
21
|
+
## license
|
|
22
|
+
|
|
23
|
+
MIT.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseHandler } from "@plurnk/plurnk-mimetypes";
|
|
2
|
+
import type { HandlerContent, MimeSymbol, Preview, QueryDialect, QueryMatch } from "@plurnk/plurnk-mimetypes";
|
|
3
|
+
export default class ApplicationXml extends BaseHandler {
|
|
4
|
+
extractRaw(content: HandlerContent): MimeSymbol[];
|
|
5
|
+
preview(content: HandlerContent): Preview;
|
|
6
|
+
deepJson(content: HandlerContent): unknown;
|
|
7
|
+
query(content: HandlerContent, dialect: QueryDialect, pattern: string, flags?: string): Promise<QueryMatch[]>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=ApplicationXml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationXml.d.ts","sourceRoot":"","sources":["../src/ApplicationXml.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EAGd,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACR,cAAc,EACd,UAAU,EACV,OAAO,EACP,YAAY,EACZ,UAAU,EACb,MAAM,0BAA0B,CAAC;AA+BlC,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,WAAW;IAC1C,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,UAAU,EAAE;IAiCjD,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO;IAWzC,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO;IAmBpC,KAAK,CAChB,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,UAAU,EAAE,CAAC;CAqB3B"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { BaseHandler, InvalidExpressionError, QueryParseFailureError, } from "@plurnk/plurnk-mimetypes";
|
|
2
|
+
import { DOMParser } from "@xmldom/xmldom";
|
|
3
|
+
import * as xpath from "xpath";
|
|
4
|
+
// application/xml + text/xml handler. Parses with @xmldom/xmldom and emits:
|
|
5
|
+
//
|
|
6
|
+
// Symbols (extractRaw):
|
|
7
|
+
// - the root element → module, with its tag name
|
|
8
|
+
// - direct children of the root that carry an `id` or `name` attribute →
|
|
9
|
+
// field, named by the attribute value (preferring id over name)
|
|
10
|
+
// - direct children without identifiers → field, named by tag name
|
|
11
|
+
//
|
|
12
|
+
// Deep-json (deepJson, issue #10):
|
|
13
|
+
// - { type: "document", line, endLine, children: [<root element tree>] }
|
|
14
|
+
// - each element: { type: tagName, attrs: {...}, children: [...] }
|
|
15
|
+
// - text content collapses to a `text` field when it's the only child;
|
|
16
|
+
// mixed content keeps text nodes as { type: "#text", text } siblings
|
|
17
|
+
//
|
|
18
|
+
// Query (query, xpath dialect overridden):
|
|
19
|
+
// - xpath dispatches against the parsed XML DOM directly (the xpath package
|
|
20
|
+
// gives us a real XPath 1.0 engine over xmldom's DOM)
|
|
21
|
+
// - jsonpath inherits BaseHandler's default — runs against deepJson via the
|
|
22
|
+
// framework's pipeline
|
|
23
|
+
// - regex/glob inherit the BaseHandler defaults (against raw text)
|
|
24
|
+
const TEXT_NODE = 3;
|
|
25
|
+
const ATTRIBUTE_NODE = 2;
|
|
26
|
+
const ELEMENT_NODE = 1;
|
|
27
|
+
const CDATA_SECTION_NODE = 4;
|
|
28
|
+
const PROCESSING_INSTRUCTION_NODE = 7;
|
|
29
|
+
const COMMENT_NODE = 8;
|
|
30
|
+
export default class ApplicationXml extends BaseHandler {
|
|
31
|
+
extractRaw(content) {
|
|
32
|
+
const text = typeof content === "string"
|
|
33
|
+
? content
|
|
34
|
+
: new TextDecoder("utf-8").decode(content);
|
|
35
|
+
const doc = parseXmlSilent(text);
|
|
36
|
+
if (doc === null)
|
|
37
|
+
return [];
|
|
38
|
+
const root = doc.documentElement;
|
|
39
|
+
if (root === null)
|
|
40
|
+
return [];
|
|
41
|
+
const symbols = [
|
|
42
|
+
{ name: root.tagName, kind: "module", line: 1, endLine: 1 },
|
|
43
|
+
];
|
|
44
|
+
for (let i = 0; i < root.childNodes.length; i += 1) {
|
|
45
|
+
const child = root.childNodes.item(i);
|
|
46
|
+
if (child === null || child.nodeType !== ELEMENT_NODE)
|
|
47
|
+
continue;
|
|
48
|
+
const el = child;
|
|
49
|
+
const idAttr = el.getAttribute?.("id");
|
|
50
|
+
const nameAttr = el.getAttribute?.("name");
|
|
51
|
+
const name = (idAttr && idAttr.length > 0)
|
|
52
|
+
? idAttr
|
|
53
|
+
: ((nameAttr && nameAttr.length > 0) ? nameAttr : el.tagName);
|
|
54
|
+
symbols.push({ name, kind: "field", line: 1, endLine: 1 });
|
|
55
|
+
}
|
|
56
|
+
return symbols;
|
|
57
|
+
}
|
|
58
|
+
// Hybrid preview: SymbolPreview when the document parses and surfaces
|
|
59
|
+
// structural symbols; head-oriented TextPreview otherwise. Malformed XML
|
|
60
|
+
// still gets a TextPreview — the model can read the raw content rather
|
|
61
|
+
// than going dark.
|
|
62
|
+
preview(content) {
|
|
63
|
+
const text = typeof content === "string"
|
|
64
|
+
? content
|
|
65
|
+
: new TextDecoder("utf-8").decode(content);
|
|
66
|
+
const symbols = this.extractRaw(text);
|
|
67
|
+
if (symbols.length > 0)
|
|
68
|
+
return { kind: "symbols", symbols };
|
|
69
|
+
return { kind: "text", text, orientation: "head" };
|
|
70
|
+
}
|
|
71
|
+
// Deep-channel (issue #10). DOM tree with attrs convention so xpath like
|
|
72
|
+
// //*[@id='x'] and //channel/item work against the projected deep-xml.
|
|
73
|
+
deepJson(content) {
|
|
74
|
+
const text = typeof content === "string"
|
|
75
|
+
? content
|
|
76
|
+
: new TextDecoder("utf-8").decode(content);
|
|
77
|
+
const doc = parseXmlSilent(text);
|
|
78
|
+
if (doc === null)
|
|
79
|
+
return null;
|
|
80
|
+
const root = doc.documentElement;
|
|
81
|
+
if (root === null)
|
|
82
|
+
return null;
|
|
83
|
+
return {
|
|
84
|
+
type: "document",
|
|
85
|
+
line: 1,
|
|
86
|
+
endLine: 1,
|
|
87
|
+
children: [elementToDeep(root)],
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
// Override xpath dispatch. The xpath package gives us a real XPath 1.0
|
|
91
|
+
// engine over xmldom's DOM. Line numbers default to 1 because xmldom
|
|
92
|
+
// doesn't track source positions.
|
|
93
|
+
async query(content, dialect, pattern, flags) {
|
|
94
|
+
if (dialect === "xpath") {
|
|
95
|
+
const text = typeof content === "string"
|
|
96
|
+
? content
|
|
97
|
+
: new TextDecoder("utf-8").decode(content);
|
|
98
|
+
let doc;
|
|
99
|
+
try {
|
|
100
|
+
doc = new DOMParser().parseFromString(text, "text/xml");
|
|
101
|
+
}
|
|
102
|
+
catch (cause) {
|
|
103
|
+
throw new QueryParseFailureError({ mimetype: this.mimetype, cause });
|
|
104
|
+
}
|
|
105
|
+
let result;
|
|
106
|
+
try {
|
|
107
|
+
result = xpath.select(pattern, doc);
|
|
108
|
+
}
|
|
109
|
+
catch (cause) {
|
|
110
|
+
throw new InvalidExpressionError({ dialect: "xpath", expression: pattern, cause });
|
|
111
|
+
}
|
|
112
|
+
return shapeXpathResult(pattern, result);
|
|
113
|
+
}
|
|
114
|
+
return super.query(content, dialect, pattern, flags);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function parseXmlSilent(text) {
|
|
118
|
+
if (text.length === 0)
|
|
119
|
+
return null;
|
|
120
|
+
// xmldom 0.9's errorHandler is a single function (level, msg, context).
|
|
121
|
+
// No-op silences both warnings and parse errors for our extraction path —
|
|
122
|
+
// we want a best-effort parse, not a strict gate. Anything genuinely
|
|
123
|
+
// unparseable returns a document with no documentElement and we route
|
|
124
|
+
// that through the "no symbols" path upstream.
|
|
125
|
+
try {
|
|
126
|
+
const doc = new DOMParser({
|
|
127
|
+
errorHandler: () => undefined,
|
|
128
|
+
}).parseFromString(text, "text/xml");
|
|
129
|
+
return doc;
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function elementToDeep(el) {
|
|
136
|
+
const node = {
|
|
137
|
+
type: el.tagName,
|
|
138
|
+
line: 1,
|
|
139
|
+
endLine: 1,
|
|
140
|
+
};
|
|
141
|
+
if (el.attributes && el.attributes.length > 0) {
|
|
142
|
+
const attrs = {};
|
|
143
|
+
for (let i = 0; i < el.attributes.length; i += 1) {
|
|
144
|
+
const a = el.attributes.item(i);
|
|
145
|
+
if (a)
|
|
146
|
+
attrs[a.name] = a.value;
|
|
147
|
+
}
|
|
148
|
+
node.attrs = attrs;
|
|
149
|
+
}
|
|
150
|
+
const children = [];
|
|
151
|
+
for (let i = 0; i < el.childNodes.length; i += 1) {
|
|
152
|
+
const child = el.childNodes.item(i);
|
|
153
|
+
if (child === null)
|
|
154
|
+
continue;
|
|
155
|
+
if (child.nodeType === TEXT_NODE || child.nodeType === CDATA_SECTION_NODE) {
|
|
156
|
+
const value = child.data;
|
|
157
|
+
if (value.length > 0)
|
|
158
|
+
children.push({ type: "#text", text: value });
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (child.nodeType === ELEMENT_NODE) {
|
|
162
|
+
children.push(elementToDeep(child));
|
|
163
|
+
}
|
|
164
|
+
// Skip comments, PIs — not queryable structural content.
|
|
165
|
+
}
|
|
166
|
+
if (children.length === 1
|
|
167
|
+
&& typeof children[0] === "object"
|
|
168
|
+
&& children[0] !== null
|
|
169
|
+
&& children[0].type === "#text") {
|
|
170
|
+
node.text = children[0].text;
|
|
171
|
+
}
|
|
172
|
+
else if (children.length > 0) {
|
|
173
|
+
node.children = children;
|
|
174
|
+
}
|
|
175
|
+
return node;
|
|
176
|
+
}
|
|
177
|
+
// Translate xpath.select result per grammar #17.
|
|
178
|
+
function shapeXpathResult(pattern, result) {
|
|
179
|
+
if (Array.isArray(result)) {
|
|
180
|
+
return result.map((node, i) => ({
|
|
181
|
+
line: 1,
|
|
182
|
+
matched: serializeNode(node),
|
|
183
|
+
matching: result.length > 1 ? `(${pattern})[${i + 1}]` : undefined,
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
if (result === null || result === undefined)
|
|
187
|
+
return [];
|
|
188
|
+
return [{ line: 1, matched: typeof result === "string" ? result : String(result) }];
|
|
189
|
+
}
|
|
190
|
+
function serializeNode(node) {
|
|
191
|
+
const nt = node.nodeType;
|
|
192
|
+
if (nt === ATTRIBUTE_NODE)
|
|
193
|
+
return node.value;
|
|
194
|
+
if (nt === TEXT_NODE || nt === CDATA_SECTION_NODE)
|
|
195
|
+
return node.data;
|
|
196
|
+
if (nt === COMMENT_NODE)
|
|
197
|
+
return node.data;
|
|
198
|
+
if (nt === PROCESSING_INSTRUCTION_NODE)
|
|
199
|
+
return node.data;
|
|
200
|
+
return node.toString();
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=ApplicationXml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationXml.js","sourceRoot":"","sources":["../src/ApplicationXml.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,sBAAsB,EACtB,sBAAsB,GACzB,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,4EAA4E;AAC5E,EAAE;AACF,wBAAwB;AACxB,mDAAmD;AACnD,2EAA2E;AAC3E,oEAAoE;AACpE,qEAAqE;AACrE,EAAE;AACF,mCAAmC;AACnC,2EAA2E;AAC3E,qEAAqE;AACrE,yEAAyE;AACzE,yEAAyE;AACzE,EAAE;AACF,2CAA2C;AAC3C,8EAA8E;AAC9E,0DAA0D;AAC1D,8EAA8E;AAC9E,2BAA2B;AAC3B,qEAAqE;AACrE,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,2BAA2B,GAAG,CAAC,CAAC;AACtC,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,WAAW;IAC1C,UAAU,CAAC,OAAuB;QAC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,CAAC,IAAI,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;SACrE,CAAC,CAAC,CAAC;IACR,CAAC;IACD,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACvD,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACxF,CAAC;AAED,SAAS,aAAa,CAAC,IAAU;IAC7B,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC;IACzB,IAAI,EAAE,KAAK,cAAc;QAAE,OAAQ,IAAa,CAAC,KAAK,CAAC;IACvD,IAAI,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,kBAAkB;QAAE,OAAQ,IAAa,CAAC,IAAI,CAAC;IAC9E,IAAI,EAAE,KAAK,YAAY;QAAE,OAAQ,IAAgB,CAAC,IAAI,CAAC;IACvD,IAAI,EAAE,KAAK,2BAA2B;QAAE,OAAQ,IAA8B,CAAC,IAAI,CAAC;IACpF,OAAQ,IAA8C,CAAC,QAAQ,EAAE,CAAC;AACtE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@plurnk/plurnk-mimetypes-application-xml",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "application/xml and text/xml mimetype handler for plurnk-service. DOM-tree extraction via @xmldom/xmldom; xpath via the xpath package; deep-json projection per framework #10.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=25"
|
|
12
|
+
},
|
|
13
|
+
"plurnk": {
|
|
14
|
+
"kind": "mimetype",
|
|
15
|
+
"handlers": [
|
|
16
|
+
{
|
|
17
|
+
"name": "application/xml",
|
|
18
|
+
"glyph": "📐",
|
|
19
|
+
"extensions": [
|
|
20
|
+
".xml"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "text/xml",
|
|
25
|
+
"glyph": "📐",
|
|
26
|
+
"extensions": []
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist/**/*",
|
|
39
|
+
"README.md"
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"test:lint": "tsc --noEmit",
|
|
43
|
+
"test:unit": "node --test src/**/*.test.ts",
|
|
44
|
+
"test": "npm run test:lint && npm run test:unit",
|
|
45
|
+
"build:dist": "tsc -p tsconfig.build.json",
|
|
46
|
+
"build": "npm run build:dist",
|
|
47
|
+
"prepare": "npm run build"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@plurnk/plurnk-mimetypes": "0.9.0",
|
|
51
|
+
"@xmldom/xmldom": "^0.9.10",
|
|
52
|
+
"xpath": "^0.0.34"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/node": "^25.9.1",
|
|
56
|
+
"typescript": "^6.0.3"
|
|
57
|
+
}
|
|
58
|
+
}
|