@lowlighter/xml 5.4.15 β 6.0.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/README.md +47 -0
- package/deno.jsonc +7 -7
- package/deno.lock +101 -83
- package/mod.mjs +1 -1
- package/package.json +1 -1
- package/parse.mjs +1 -1
- package/parse_test.ts +56 -56
- package/stringify_test.ts +16 -16
- package/wasm_xml_parser/wasm_xml_parser.js +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).
|
|
@@ -21,6 +64,10 @@
|
|
|
21
64
|
- Support for custom `reviver` and `replacer` functions
|
|
22
65
|
- Support for metadata stored into non-enumerable properties (advanced usage).
|
|
23
66
|
|
|
67
|
+
## ποΈ Migrating from `5.x.x` to `6.x.x`
|
|
68
|
+
|
|
69
|
+
Version `6.x.x` and onwards require Deno `2.x.x` or later.
|
|
70
|
+
|
|
24
71
|
## ποΈ Migrating from `4.x.x` to `5.x.x`
|
|
25
72
|
|
|
26
73
|
Prior to version version `5.0.0`, this library was fully written in TypeScript.
|
package/deno.jsonc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"icon": "π",
|
|
3
3
|
"name": "@libs/xml",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "6.0.0",
|
|
5
5
|
"description": "XML parser/stringifier with no dependencies.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"xml",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@std/fs/expand-glob": "jsr:@std/fs@1/expand-glob",
|
|
37
37
|
"@std/fs/exists": "jsr:@std/fs@1/exists",
|
|
38
38
|
"@std/path/from-file-url": "jsr:@std/path@1/from-file-url",
|
|
39
|
-
"@libs/typing": "jsr:@libs/typing@
|
|
40
|
-
"@libs/testing": "jsr:@libs/testing@
|
|
39
|
+
"@libs/typing": "jsr:@libs/typing@3",
|
|
40
|
+
"@libs/testing": "jsr:@libs/testing@3"
|
|
41
41
|
},
|
|
42
42
|
"test:permissions": {
|
|
43
43
|
"read": true,
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"tasks": {
|
|
58
58
|
"build": "deno run --allow-read --allow-net --allow-env --allow-write --allow-run jsr:@libs/bundle/wasm/cli/build --auto-install --banner='https://github.com/lowlighter/libs' wasm_xml_parser",
|
|
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
|
-
"dev": "deno fmt && deno task test --filter='
|
|
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 task clean:deno && deno fmt --check && deno task test --filter='
|
|
62
|
+
"test:deno": "deno task clean:deno && deno fmt --check && deno task test --filter='/DENO/' --quiet && deno coverage --exclude=.js && deno lint",
|
|
63
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='
|
|
65
|
-
"coverage:html": "deno task test --filter='
|
|
64
|
+
"test:others": "deno task clean:others && deno fmt --check && deno task test --filter='/NODE|BUN/' --quiet && deno coverage --exclude=.js && deno lint",
|
|
65
|
+
"coverage:html": "deno task test --filter='/DENO/' --quiet && deno coverage --exclude=.js --html && sleep 1",
|
|
66
66
|
"lint": "deno fmt --check && deno lint && deno doc --lint mod.ts && deno publish --dry-run --quiet --allow-dirty",
|
|
67
67
|
"clean:deno": "rm -rf node_modules .npmrc deno.lock",
|
|
68
68
|
"clean:others": "rm -rf node_modules .npmrc deno.lock package.json package-lock.json bun.lockb"
|
package/deno.lock
CHANGED
|
@@ -1,92 +1,110 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
"version": "4",
|
|
3
|
+
"specifiers": {
|
|
4
|
+
"jsr:@libs/logger@2": "2.1.4",
|
|
5
|
+
"jsr:@libs/run@2": "2.0.5",
|
|
6
|
+
"jsr:@libs/testing@3": "3.0.0",
|
|
7
|
+
"jsr:@libs/typing@2": "2.9.0",
|
|
8
|
+
"jsr:@libs/typing@3": "3.0.0",
|
|
9
|
+
"jsr:@std/assert@1": "1.0.6",
|
|
10
|
+
"jsr:@std/assert@^1.0.6": "1.0.6",
|
|
11
|
+
"jsr:@std/async@1": "1.0.5",
|
|
12
|
+
"jsr:@std/bytes@^1.0.2": "1.0.2",
|
|
13
|
+
"jsr:@std/expect@1": "1.0.4",
|
|
14
|
+
"jsr:@std/fmt@1": "1.0.2",
|
|
15
|
+
"jsr:@std/fs@1": "1.0.4",
|
|
16
|
+
"jsr:@std/html@1": "1.0.3",
|
|
17
|
+
"jsr:@std/http@1": "1.0.7",
|
|
18
|
+
"jsr:@std/internal@^1.0.4": "1.0.4",
|
|
19
|
+
"jsr:@std/path@1": "1.0.6",
|
|
20
|
+
"jsr:@std/streams@1": "1.0.6",
|
|
21
|
+
"npm:highlight.js@11": "11.10.0"
|
|
22
|
+
},
|
|
23
|
+
"jsr": {
|
|
24
|
+
"@libs/logger@2.1.4": {
|
|
25
|
+
"integrity": "47d100412f9c16b5752d670d7fb182a2dce2cda26a72896e0f69d3a2de35fa1f"
|
|
26
|
+
},
|
|
27
|
+
"@libs/run@2.0.5": {
|
|
28
|
+
"integrity": "6da09b6d9458a7f8134a113f7a70186742e6f759423a60f7037ca1001bbf1b78",
|
|
29
|
+
"dependencies": [
|
|
30
|
+
"jsr:@libs/logger",
|
|
31
|
+
"jsr:@libs/typing@2",
|
|
32
|
+
"jsr:@std/async",
|
|
33
|
+
"jsr:@std/streams"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"@libs/testing@3.0.0": {
|
|
37
|
+
"integrity": "514547988fadac36890692ccafc932546d9e27680df1b736dd7674ad2e7c9625",
|
|
38
|
+
"dependencies": [
|
|
39
|
+
"jsr:@libs/run",
|
|
40
|
+
"jsr:@libs/typing@2",
|
|
41
|
+
"jsr:@std/assert@1",
|
|
42
|
+
"jsr:@std/expect",
|
|
43
|
+
"jsr:@std/fmt",
|
|
44
|
+
"jsr:@std/html",
|
|
45
|
+
"jsr:@std/http",
|
|
46
|
+
"npm:highlight.js"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"@libs/typing@2.9.0": {
|
|
50
|
+
"integrity": "ddf35ea652b807cd9b19b4f3f163fb5d76d57299053753fbd01ba8b02d9306ad"
|
|
51
|
+
},
|
|
52
|
+
"@libs/typing@3.0.0": {
|
|
53
|
+
"integrity": "f84ffbbdcbb6a02e6a527911b1399dc79f6ad213aec4ad0a86c95df4b353738f"
|
|
54
|
+
},
|
|
55
|
+
"@std/assert@1.0.6": {
|
|
56
|
+
"integrity": "1904c05806a25d94fe791d6d883b685c9e2dcd60e4f9fc30f4fc5cf010c72207",
|
|
57
|
+
"dependencies": [
|
|
58
|
+
"jsr:@std/internal"
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
"@std/async@1.0.5": {
|
|
62
|
+
"integrity": "31d68214bfbb31bd4c6022401d484e3964147c76c9220098baa703a39b6c2da6"
|
|
63
|
+
},
|
|
64
|
+
"@std/bytes@1.0.2": {
|
|
65
|
+
"integrity": "fbdee322bbd8c599a6af186a1603b3355e59a5fb1baa139f8f4c3c9a1b3e3d57"
|
|
66
|
+
},
|
|
67
|
+
"@std/expect@1.0.4": {
|
|
68
|
+
"integrity": "97f68a445a9de0d9670200d2b7a19a7505a01b2cb390a983ba8d97d90ce30c4f",
|
|
69
|
+
"dependencies": [
|
|
70
|
+
"jsr:@std/assert@^1.0.6",
|
|
71
|
+
"jsr:@std/internal"
|
|
72
|
+
]
|
|
19
73
|
},
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"dependencies": [
|
|
49
|
-
"jsr:@std/internal@^1.0.2"
|
|
50
|
-
]
|
|
51
|
-
},
|
|
52
|
-
"@std/async@1.0.4": {
|
|
53
|
-
"integrity": "373f5168a01b46ecaabc785d4e0f9ef18a010ab867af069fb905d93a9129ae5b"
|
|
54
|
-
},
|
|
55
|
-
"@std/bytes@1.0.2": {
|
|
56
|
-
"integrity": "fbdee322bbd8c599a6af186a1603b3355e59a5fb1baa139f8f4c3c9a1b3e3d57"
|
|
57
|
-
},
|
|
58
|
-
"@std/expect@1.0.1": {
|
|
59
|
-
"integrity": "44075d9c2cb701ddfc4d5a260da2fb26ba3cfd94c45d3a0359f63cabbf85a058",
|
|
60
|
-
"dependencies": [
|
|
61
|
-
"jsr:@std/assert@^1.0.3",
|
|
62
|
-
"jsr:@std/internal@^1.0.2"
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
|
-
"@std/fs@1.0.2": {
|
|
66
|
-
"integrity": "af57555c7a224a6f147d5cced5404692974f7a628ced8eda67e0d22d92d474ec"
|
|
67
|
-
},
|
|
68
|
-
"@std/http@1.0.4": {
|
|
69
|
-
"integrity": "1a8142217907d49c4687f90ef3d257e7df2baf344c5122c322d7316df09df453"
|
|
70
|
-
},
|
|
71
|
-
"@std/internal@1.0.2": {
|
|
72
|
-
"integrity": "f4cabe2021352e8bfc24e6569700df87bf070914fc38d4b23eddd20108ac4495"
|
|
73
|
-
},
|
|
74
|
-
"@std/path@1.0.3": {
|
|
75
|
-
"integrity": "cd89d014ce7eb3742f2147b990f6753ee51d95276bfc211bc50c860c1bc7df6f"
|
|
76
|
-
},
|
|
77
|
-
"@std/streams@1.0.3": {
|
|
78
|
-
"integrity": "d62e645ab981cee2c3d03040eb03cf387fc6bceef6d4564f3ed485a43741a81f",
|
|
79
|
-
"dependencies": [
|
|
80
|
-
"jsr:@std/bytes@^1.0.2"
|
|
81
|
-
]
|
|
82
|
-
}
|
|
74
|
+
"@std/fmt@1.0.2": {
|
|
75
|
+
"integrity": "87e9dfcdd3ca7c066e0c3c657c1f987c82888eb8103a3a3baa62684ffeb0f7a7"
|
|
76
|
+
},
|
|
77
|
+
"@std/fs@1.0.4": {
|
|
78
|
+
"integrity": "2907d32d8d1d9e540588fd5fe0ec21ee638134bd51df327ad4e443aaef07123c"
|
|
79
|
+
},
|
|
80
|
+
"@std/html@1.0.3": {
|
|
81
|
+
"integrity": "7a0ac35e050431fb49d44e61c8b8aac1ebd55937e0dc9ec6409aa4bab39a7988"
|
|
82
|
+
},
|
|
83
|
+
"@std/http@1.0.7": {
|
|
84
|
+
"integrity": "9b904fc256678a5c9759f1a53a24a3fdcc59d83dc62099bb472683b6f819194c"
|
|
85
|
+
},
|
|
86
|
+
"@std/internal@1.0.4": {
|
|
87
|
+
"integrity": "62e8e4911527e5e4f307741a795c0b0a9e6958d0b3790716ae71ce085f755422"
|
|
88
|
+
},
|
|
89
|
+
"@std/path@1.0.6": {
|
|
90
|
+
"integrity": "ab2c55f902b380cf28e0eec501b4906e4c1960d13f00e11cfbcd21de15f18fed"
|
|
91
|
+
},
|
|
92
|
+
"@std/streams@1.0.6": {
|
|
93
|
+
"integrity": "022ed94e380d06b4d91c49eb70241b7289ab78b8c2b4c4bbb7eb265e4997c25c",
|
|
94
|
+
"dependencies": [
|
|
95
|
+
"jsr:@std/bytes"
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"npm": {
|
|
100
|
+
"highlight.js@11.10.0": {
|
|
101
|
+
"integrity": "sha512-SYVnVFswQER+zu1laSya563s+F8VDGt7o35d4utbamowvUNLLMovFqwCLSocpZTz3MgaSRA1IbqRWZv97dtErQ=="
|
|
83
102
|
}
|
|
84
103
|
},
|
|
85
|
-
"remote": {},
|
|
86
104
|
"workspace": {
|
|
87
105
|
"dependencies": [
|
|
88
|
-
"jsr:@libs/testing@
|
|
89
|
-
"jsr:@libs/typing@
|
|
106
|
+
"jsr:@libs/testing@3",
|
|
107
|
+
"jsr:@libs/typing@3",
|
|
90
108
|
"jsr:@std/fs@1",
|
|
91
109
|
"jsr:@std/path@1"
|
|
92
110
|
]
|