@lowlighter/xml 5.4.11 → 5.4.12

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/deno.jsonc CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "icon": "📃",
3
3
  "name": "@libs/xml",
4
- "version": "5.4.11",
4
+ "version": "5.4.12",
5
5
  "description": "XML parser/stringifier with no dependencies.",
6
6
  "keywords": [
7
7
  "xml",
@@ -35,7 +35,7 @@
35
35
  "imports": {
36
36
  "@std/fs/expand-glob": "jsr:@std/fs@0.229.3/expand-glob",
37
37
  "@std/fs/exists": "jsr:@std/fs@0.229.3/exists",
38
- "@std/path/from-file-url": "jsr:@std/path@0.225.2/from-file-url",
38
+ "@std/path/from-file-url": "jsr:@std/path@1/from-file-url",
39
39
  "@libs/typing": "jsr:@libs/typing@2",
40
40
  "@libs/testing": "jsr:@libs/testing@2"
41
41
  },
package/deno.lock CHANGED
@@ -17,6 +17,7 @@
17
17
  "jsr:@std/internal@^1.0.0": "jsr:@std/internal@1.0.1",
18
18
  "jsr:@std/io@^0.224.1": "jsr:@std/io@0.224.3",
19
19
  "jsr:@std/path@0.225.2": "jsr:@std/path@0.225.2",
20
+ "jsr:@std/path@1": "jsr:@std/path@1.0.0",
20
21
  "jsr:@std/streams@0.224.5": "jsr:@std/streams@0.224.5"
21
22
  },
22
23
  "jsr": {
@@ -89,6 +90,9 @@
89
90
  "@std/path@0.225.2": {
90
91
  "integrity": "0f2db41d36b50ef048dcb0399aac720a5348638dd3cb5bf80685bf2a745aa506"
91
92
  },
93
+ "@std/path@1.0.0": {
94
+ "integrity": "77fcb858b6e38777d1154df0f02245ba0b07e2c40ca3c0eec57c9233188c2d21"
95
+ },
92
96
  "@std/streams@0.224.5": {
93
97
  "integrity": "bcde7818dd5460d474cdbd674b15f6638b9cd73cd64e52bd852fba2bd4d8ec91",
94
98
  "dependencies": [
@@ -104,7 +108,7 @@
104
108
  "jsr:@libs/testing@2",
105
109
  "jsr:@libs/typing@2",
106
110
  "jsr:@std/fs@0.229.3",
107
- "jsr:@std/path@0.225.2"
111
+ "jsr:@std/path@1"
108
112
  ]
109
113
  }
110
114
  }
package/mod_test.ts ADDED
@@ -0,0 +1 @@
1
+ import "./mod.ts"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowlighter/xml",
3
- "version": "5.4.11",
3
+ "version": "5.4.12",
4
4
  "type": "module",
5
5
  "scripts": {},
6
6
  "dependencies": {},
package/parse.ts CHANGED
@@ -2,10 +2,8 @@
2
2
  import { initSync, JsReader, source, Token, tokenize } from "./wasm_xml_parser/wasm_xml_parser.js"
3
3
  import type { record, rw } from "@libs/typing"
4
4
  import type { Nullable, ReaderSync, xml_document, xml_node, xml_text } from "./_types.ts"
5
- initSync(source())
6
-
7
- // Re-exports
8
5
  export type { Nullable, ReaderSync, xml_document, xml_node, xml_text }
6
+ initSync(source())
9
7
 
10
8
  /** XML parser options. */
11
9
  export type options = {
@@ -113,6 +111,8 @@ export type options = {
113
111
  * using file = await Deno.open("bench/assets/small.xml")
114
112
  * console.log(parse(file))
115
113
  * ```
114
+ *
115
+ * @module
116
116
  */
117
117
  export function parse(content: string | ReaderSync, options?: options): xml_document {
118
118
  const xml = xml_node("~xml") as xml_document
package/stringify.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  // Imports
2
2
  import type { Nullable, record, rw } from "@libs/typing"
3
3
  import type { stringifyable, xml_document, xml_node, xml_text } from "./_types.ts"
4
-
5
- // Re-exports
6
4
  export type { Nullable, stringifyable, xml_document, xml_node, xml_text }
7
5
 
8
6
  /** XML stringifier options. */
@@ -64,6 +62,8 @@ const internal = Symbol("internal")
64
62
  * }
65
63
  * }))
66
64
  * ```
65
+ *
66
+ * @module
67
67
  */
68
68
  export function stringify(document: stringifyable, options?: options): string {
69
69
  options ??= {}
@@ -100,7 +100,16 @@ export function stringify(document: stringifyable, options?: options): string {
100
100
  return text.trim()
101
101
  }
102
102
 
103
- /** Helper to create a CDATA node. */
103
+ /**
104
+ * Helper to create a CDATA node.
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * import { stringify, cdata } from "./stringify.ts"
109
+ * stringify({ string: cdata(`hello <world>`) })
110
+ * // <string><![CDATA[hello <world>]]></string>
111
+ * ```
112
+ */
104
113
  export function cdata(text: string): Omit<xml_text, "~parent"> {
105
114
  return {
106
115
  "~name": "~cdata",
@@ -108,7 +117,16 @@ export function cdata(text: string): Omit<xml_text, "~parent"> {
108
117
  }
109
118
  }
110
119
 
111
- /** Helper to create a comment node. */
120
+ /**
121
+ * Helper to create a comment node.
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * import { stringify, comment } from "./stringify.ts"
126
+ * stringify({ string: comment(`hello world`) })
127
+ * // <string><!--hello world--></string>
128
+ * ```
129
+ */
112
130
  export function comment(text: string): Omit<xml_text, "~parent"> {
113
131
  return {
114
132
  "~name": "~comment",