@office-open/xml 0.6.6 → 0.6.7
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as XmlAttrs, D as XmlOption, E as XmlObject, S as XmlAtom, T as XmlDescArray, _ as ElementCompact, a as childCount, b as Js2XmlOptions, c as collectText, d as findDeep, f as hasChild, g as Element, h as DeclarationAttributes, i as attrNum, l as colorAttr, m as Attributes, n as attr, o as childText, p as textOf, r as attrBool, s as children, t as allChildren, u as findChild, v as ElementObject, w as XmlDesc, x as Xml2JsOptions, y as IgnoreOptions } from "./utils-
|
|
1
|
+
import { C as XmlAttrs, D as XmlOption, E as XmlObject, S as XmlAtom, T as XmlDescArray, _ as ElementCompact, a as childCount, b as Js2XmlOptions, c as collectText, d as findDeep, f as hasChild, g as Element, h as DeclarationAttributes, i as attrNum, l as colorAttr, m as Attributes, n as attr, o as childText, p as textOf, r as attrBool, s as children, t as allChildren, u as findChild, v as ElementObject, w as XmlDesc, x as Xml2JsOptions, y as IgnoreOptions } from "./utils-DTU54qj_.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/serialize.d.ts
|
|
4
4
|
declare function xml(input: Record<string, any> | Record<string, any>[], options?: boolean | string | {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { allChildren, attr, attrBool, attrNum, childCount, childText, children, collectText, colorAttr, findChild, findDeep, hasChild, textOf } from "./utils.
|
|
1
|
+
import { allChildren, attr, attrBool, attrNum, childCount, childText, children, collectText, colorAttr, findChild, findDeep, hasChild, textOf } from "./utils.mjs";
|
|
2
2
|
//#region src/escape.ts
|
|
3
3
|
/** Escape text content for XML. Fast path returns original string when no special chars. */
|
|
4
4
|
function escapeXml(str) {
|
|
@@ -454,7 +454,29 @@ function writeElements(elements, opts, depth, firstLine) {
|
|
|
454
454
|
}
|
|
455
455
|
function writeText(text) {
|
|
456
456
|
if (text == null) return "";
|
|
457
|
-
|
|
457
|
+
const str = String(text);
|
|
458
|
+
for (let i = 0; i < str.length; i++) {
|
|
459
|
+
const c = str.charCodeAt(i);
|
|
460
|
+
if (c === 38 || c === 60 || c === 62) {
|
|
461
|
+
let s = "";
|
|
462
|
+
let last = 0;
|
|
463
|
+
for (let j = i; j < str.length; j++) {
|
|
464
|
+
const cj = str.charCodeAt(j);
|
|
465
|
+
if (cj === 38) {
|
|
466
|
+
s += str.slice(last, j) + "&";
|
|
467
|
+
last = j + 1;
|
|
468
|
+
} else if (cj === 60) {
|
|
469
|
+
s += str.slice(last, j) + "<";
|
|
470
|
+
last = j + 1;
|
|
471
|
+
} else if (cj === 62) {
|
|
472
|
+
s += str.slice(last, j) + ">";
|
|
473
|
+
last = j + 1;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return s + str.slice(last);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
return str;
|
|
458
480
|
}
|
|
459
481
|
function writeCdata(cdata) {
|
|
460
482
|
if (cdata == null) return "";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as childCount, c as collectText, d as findDeep, f as hasChild, i as attrNum, l as colorAttr, n as attr, o as childText, p as textOf, r as attrBool, s as children, t as allChildren, u as findChild } from "./utils-
|
|
1
|
+
import { a as childCount, c as collectText, d as findDeep, f as hasChild, i as attrNum, l as colorAttr, n as attr, o as childText, p as textOf, r as attrBool, s as children, t as allChildren, u as findChild } from "./utils-DTU54qj_.mjs";
|
|
2
2
|
export { allChildren, attr, attrBool, attrNum, childCount, childText, children, collectText, colorAttr, findChild, findDeep, hasChild, textOf };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@office-open/xml",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
4
4
|
"description": "XML parsing and serialization for Office Open XML. Zero dependencies, drop-in replacement for xml + xml-js.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"office-open",
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"type": "module",
|
|
31
|
-
"main": "dist/index.
|
|
32
|
-
"types": "dist/index.d.
|
|
31
|
+
"main": "dist/index.mjs",
|
|
32
|
+
"types": "dist/index.d.mts",
|
|
33
33
|
"exports": {
|
|
34
34
|
".": {
|
|
35
|
-
"types": "./dist/index.d.
|
|
36
|
-
"import": "./dist/index.
|
|
35
|
+
"types": "./dist/index.d.mts",
|
|
36
|
+
"import": "./dist/index.mjs"
|
|
37
37
|
},
|
|
38
38
|
"./utils": {
|
|
39
|
-
"types": "./dist/utils.d.
|
|
40
|
-
"import": "./dist/utils.
|
|
39
|
+
"types": "./dist/utils.d.mts",
|
|
40
|
+
"import": "./dist/utils.mjs"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
File without changes
|
|
File without changes
|