@lowlighter/xml 5.4.14 β 5.4.16
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/README.md +43 -0
- package/deno.jsonc +7 -5
- package/deno.lock +36 -36
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,49 @@
|
|
|
6
6
|
- [`π¦ Playground`](https://libs.lecoq.io/xml)
|
|
7
7
|
- [`π Documentation`](https://jsr.io/@libs/xml/doc)
|
|
8
8
|
|
|
9
|
+
## π Examples
|
|
10
|
+
|
|
11
|
+
### Parsing XML to objects
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { parse } from "./parse.ts"
|
|
15
|
+
|
|
16
|
+
// Parse a string
|
|
17
|
+
console.log(parse(`
|
|
18
|
+
<?xml version="1.0"?>
|
|
19
|
+
<root>
|
|
20
|
+
<text>hello</text>
|
|
21
|
+
<array>world</array>
|
|
22
|
+
<array>monde</array>
|
|
23
|
+
<array>δΈη</array>
|
|
24
|
+
<array>π</array>
|
|
25
|
+
<complex attribute="value">content</complex>
|
|
26
|
+
</root>
|
|
27
|
+
`))
|
|
28
|
+
|
|
29
|
+
// Parse a file
|
|
30
|
+
using file = await Deno.open("bench/assets/small.xml")
|
|
31
|
+
console.log(parse(file))
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Stringifying objects to XML
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { stringify } from "./stringify.ts"
|
|
38
|
+
|
|
39
|
+
console.log(stringify({
|
|
40
|
+
"@version": "1.0",
|
|
41
|
+
root: {
|
|
42
|
+
text: "hello",
|
|
43
|
+
array: ["world", "monde", "δΈη", "π"],
|
|
44
|
+
complex: {
|
|
45
|
+
"@attribute": "value",
|
|
46
|
+
"#text": "content",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
}))
|
|
50
|
+
```
|
|
51
|
+
|
|
9
52
|
## β¨ Features
|
|
10
53
|
|
|
11
54
|
- Based on the [quick-xml](https://github.com/tafia/quick-xml) Rust package (compiled to WASM).
|
package/deno.jsonc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"icon": "π",
|
|
3
3
|
"name": "@libs/xml",
|
|
4
|
-
"version": "5.4.
|
|
4
|
+
"version": "5.4.16",
|
|
5
5
|
"description": "XML parser/stringifier with no dependencies.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"xml",
|
|
@@ -59,11 +59,13 @@
|
|
|
59
59
|
"test": "deno test --allow-read --allow-env=CI --allow-write=bench --allow-run=deno,node,bun,npx --no-prompt --coverage --clean --trace-leaks --doc",
|
|
60
60
|
"dev": "deno fmt && deno task test --filter='/^\\[deno\\]/' && deno coverage --exclude=.js --detailed && deno task lint",
|
|
61
61
|
"bench": "deno bench --allow-read --allow-write=bench",
|
|
62
|
-
"test:deno": "deno fmt --check && deno task test --filter='/^\\[deno\\]/' --quiet && deno coverage --exclude=.js && deno lint",
|
|
63
|
-
"test:deno-future": "DENO_FUTURE=1 && deno task test:deno",
|
|
64
|
-
"test:others": "deno fmt --check && deno task test --filter='/^\\[node|bun \\]/' --quiet && deno coverage --exclude=.js && deno lint",
|
|
62
|
+
"test:deno": "deno task clean:deno && deno fmt --check && deno task test --filter='/^\\[deno\\]/' --quiet && deno coverage --exclude=.js && deno lint",
|
|
63
|
+
"test:deno-future": "deno task clean:deno && DENO_FUTURE=1 && deno task test:deno",
|
|
64
|
+
"test:others": "deno task clean:others && deno fmt --check && deno task test --filter='/^\\[node|bun \\]/' --quiet && deno coverage --exclude=.js && deno lint",
|
|
65
65
|
"coverage:html": "deno task test --filter='/^\\[deno\\]/' --quiet && deno coverage --exclude=.js --html && sleep 1",
|
|
66
|
-
"lint": "deno fmt --check && deno lint && deno doc --lint mod.ts && deno publish --dry-run --quiet --allow-dirty"
|
|
66
|
+
"lint": "deno fmt --check && deno lint && deno doc --lint mod.ts && deno publish --dry-run --quiet --allow-dirty",
|
|
67
|
+
"clean:deno": "rm -rf node_modules .npmrc deno.lock",
|
|
68
|
+
"clean:others": "rm -rf node_modules .npmrc deno.lock package.json package-lock.json bun.lockb"
|
|
67
69
|
},
|
|
68
70
|
"lint": {
|
|
69
71
|
"rules": {
|
package/deno.lock
CHANGED
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
"version": "3",
|
|
3
3
|
"packages": {
|
|
4
4
|
"specifiers": {
|
|
5
|
-
"jsr:@libs/logger@2": "jsr:@libs/logger@2.1.
|
|
6
|
-
"jsr:@libs/run@2": "jsr:@libs/run@2.0.
|
|
5
|
+
"jsr:@libs/logger@2": "jsr:@libs/logger@2.1.2",
|
|
6
|
+
"jsr:@libs/run@2": "jsr:@libs/run@2.0.3",
|
|
7
7
|
"jsr:@libs/testing@2": "jsr:@libs/testing@2.2.4",
|
|
8
8
|
"jsr:@libs/typing@2": "jsr:@libs/typing@2.8.2",
|
|
9
|
-
"jsr:@std/assert@1": "jsr:@std/assert@1.0.
|
|
10
|
-
"jsr:@std/assert@^1.0.
|
|
11
|
-
"jsr:@std/async@1": "jsr:@std/async@1.0.
|
|
12
|
-
"jsr:@std/bytes@^1.0.2
|
|
13
|
-
"jsr:@std/expect@1": "jsr:@std/expect@1.0.
|
|
14
|
-
"jsr:@std/fs@1": "jsr:@std/fs@1.0.
|
|
15
|
-
"jsr:@std/http@1": "jsr:@std/http@1.0.
|
|
16
|
-
"jsr:@std/internal@^1.0.
|
|
17
|
-
"jsr:@std/path@1": "jsr:@std/path@1.0.
|
|
18
|
-
"jsr:@std/streams@1": "jsr:@std/streams@1.0.
|
|
9
|
+
"jsr:@std/assert@1": "jsr:@std/assert@1.0.3",
|
|
10
|
+
"jsr:@std/assert@^1.0.3": "jsr:@std/assert@1.0.3",
|
|
11
|
+
"jsr:@std/async@1": "jsr:@std/async@1.0.4",
|
|
12
|
+
"jsr:@std/bytes@^1.0.2": "jsr:@std/bytes@1.0.2",
|
|
13
|
+
"jsr:@std/expect@1": "jsr:@std/expect@1.0.1",
|
|
14
|
+
"jsr:@std/fs@1": "jsr:@std/fs@1.0.2",
|
|
15
|
+
"jsr:@std/http@1": "jsr:@std/http@1.0.4",
|
|
16
|
+
"jsr:@std/internal@^1.0.2": "jsr:@std/internal@1.0.2",
|
|
17
|
+
"jsr:@std/path@1": "jsr:@std/path@1.0.3",
|
|
18
|
+
"jsr:@std/streams@1": "jsr:@std/streams@1.0.3"
|
|
19
19
|
},
|
|
20
20
|
"jsr": {
|
|
21
|
-
"@libs/logger@2.1.
|
|
22
|
-
"integrity": "
|
|
21
|
+
"@libs/logger@2.1.2": {
|
|
22
|
+
"integrity": "2a5f4b148fd8d6b1221ff89cff73367ca0511137f4d6548c532b6e220ed22bcc"
|
|
23
23
|
},
|
|
24
|
-
"@libs/run@2.0.
|
|
25
|
-
"integrity": "
|
|
24
|
+
"@libs/run@2.0.3": {
|
|
25
|
+
"integrity": "77fe95cbfdc6c0855ab1bc5fb008ad4e37c6da848fd20ed8e88d98c3cf51eccb",
|
|
26
26
|
"dependencies": [
|
|
27
27
|
"jsr:@libs/logger@2",
|
|
28
28
|
"jsr:@libs/typing@2",
|
|
@@ -43,41 +43,41 @@
|
|
|
43
43
|
"@libs/typing@2.8.2": {
|
|
44
44
|
"integrity": "c53f8aad9b01621de893aeac5d6cd592ec2ce783f8e89b677dcd81490a3be0a0"
|
|
45
45
|
},
|
|
46
|
-
"@std/assert@1.0.
|
|
47
|
-
"integrity": "
|
|
46
|
+
"@std/assert@1.0.3": {
|
|
47
|
+
"integrity": "b0d03ce1ced880df67132eea140623010d415848df66f6aa5df76507ca7c26d8",
|
|
48
48
|
"dependencies": [
|
|
49
|
-
"jsr:@std/internal@^1.0.
|
|
49
|
+
"jsr:@std/internal@^1.0.2"
|
|
50
50
|
]
|
|
51
51
|
},
|
|
52
|
-
"@std/async@1.0.
|
|
53
|
-
"integrity": "
|
|
52
|
+
"@std/async@1.0.4": {
|
|
53
|
+
"integrity": "373f5168a01b46ecaabc785d4e0f9ef18a010ab867af069fb905d93a9129ae5b"
|
|
54
54
|
},
|
|
55
55
|
"@std/bytes@1.0.2": {
|
|
56
56
|
"integrity": "fbdee322bbd8c599a6af186a1603b3355e59a5fb1baa139f8f4c3c9a1b3e3d57"
|
|
57
57
|
},
|
|
58
|
-
"@std/expect@1.0.
|
|
59
|
-
"integrity": "
|
|
58
|
+
"@std/expect@1.0.1": {
|
|
59
|
+
"integrity": "44075d9c2cb701ddfc4d5a260da2fb26ba3cfd94c45d3a0359f63cabbf85a058",
|
|
60
60
|
"dependencies": [
|
|
61
|
-
"jsr:@std/assert@^1.0.
|
|
62
|
-
"jsr:@std/internal@^1.0.
|
|
61
|
+
"jsr:@std/assert@^1.0.3",
|
|
62
|
+
"jsr:@std/internal@^1.0.2"
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
|
-
"@std/fs@1.0.
|
|
66
|
-
"integrity": "
|
|
65
|
+
"@std/fs@1.0.2": {
|
|
66
|
+
"integrity": "af57555c7a224a6f147d5cced5404692974f7a628ced8eda67e0d22d92d474ec"
|
|
67
67
|
},
|
|
68
|
-
"@std/http@1.0.
|
|
69
|
-
"integrity": "
|
|
68
|
+
"@std/http@1.0.4": {
|
|
69
|
+
"integrity": "1a8142217907d49c4687f90ef3d257e7df2baf344c5122c322d7316df09df453"
|
|
70
70
|
},
|
|
71
|
-
"@std/internal@1.0.
|
|
72
|
-
"integrity": "
|
|
71
|
+
"@std/internal@1.0.2": {
|
|
72
|
+
"integrity": "f4cabe2021352e8bfc24e6569700df87bf070914fc38d4b23eddd20108ac4495"
|
|
73
73
|
},
|
|
74
|
-
"@std/path@1.0.
|
|
75
|
-
"integrity": "
|
|
74
|
+
"@std/path@1.0.3": {
|
|
75
|
+
"integrity": "cd89d014ce7eb3742f2147b990f6753ee51d95276bfc211bc50c860c1bc7df6f"
|
|
76
76
|
},
|
|
77
|
-
"@std/streams@1.0.
|
|
78
|
-
"integrity": "
|
|
77
|
+
"@std/streams@1.0.3": {
|
|
78
|
+
"integrity": "d62e645ab981cee2c3d03040eb03cf387fc6bceef6d4564f3ed485a43741a81f",
|
|
79
79
|
"dependencies": [
|
|
80
|
-
"jsr:@std/bytes@^1.0.2
|
|
80
|
+
"jsr:@std/bytes@^1.0.2"
|
|
81
81
|
]
|
|
82
82
|
}
|
|
83
83
|
}
|