@office-open/xml 0.10.9 → 0.10.11
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 +12 -12
- package/dist/index.d.mts +1 -1
- package/dist/{utils-CDLayhwk.d.mts → utils-t-_-N57p.d.mts} +4 -4
- package/dist/utils.d.mts +1 -1
- package/dist/utils.mjs +4 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -109,31 +109,31 @@ Performance comparison against original `xml` (1.0.1) and `xml-js` (1.6.11) pack
|
|
|
109
109
|
|
|
110
110
|
| Scenario | @office-open/xml | xml | Speedup |
|
|
111
111
|
| ----------------------- | ---------------: | ---------: | --------: |
|
|
112
|
-
| Simple element | 5,
|
|
113
|
-
| Nested element | 1,
|
|
114
|
-
| Nested with declaration |
|
|
112
|
+
| Simple element | 5,440,771 hz | 805,545 hz | **6.75x** |
|
|
113
|
+
| Nested element | 1,050,272 hz | 315,184 hz | **3.33x** |
|
|
114
|
+
| Nested with declaration | 967,945 hz | 275,684 hz | **3.51x** |
|
|
115
115
|
|
|
116
116
|
### Parsing (xml2js)
|
|
117
117
|
|
|
118
|
-
| Scenario | @office-open/xml |
|
|
119
|
-
| ------------------ | ---------------: |
|
|
120
|
-
| Simple XML |
|
|
121
|
-
| Complex OOXML |
|
|
122
|
-
| With captureSpaces |
|
|
118
|
+
| Scenario | @office-open/xml | xml-js | Speedup |
|
|
119
|
+
| ------------------ | ---------------: | ---------: | --------: |
|
|
120
|
+
| Simple XML | 869,965 hz | 100,507 hz | **8.66x** |
|
|
121
|
+
| Complex OOXML | 346,440 hz | 53,621 hz | **6.46x** |
|
|
122
|
+
| With captureSpaces | 344,586 hz | 52,414 hz | **6.57x** |
|
|
123
123
|
|
|
124
124
|
### Stringifying (js2xml)
|
|
125
125
|
|
|
126
126
|
| Scenario | @office-open/xml | xml-js | Speedup |
|
|
127
127
|
| -------------- | ---------------: | ---------: | --------: |
|
|
128
|
-
| Simple element |
|
|
129
|
-
| Complex OOXML |
|
|
128
|
+
| Simple element | 793,710 hz | 207,730 hz | **3.82x** |
|
|
129
|
+
| Complex OOXML | 366,515 hz | 135,815 hz | **2.70x** |
|
|
130
130
|
|
|
131
131
|
### Direct Conversion (toElement vs bridge)
|
|
132
132
|
|
|
133
133
|
| Scenario | toElement() | xml() + xml2js() bridge | Speedup |
|
|
134
134
|
| -------- | ------------: | ----------------------: | ---------: |
|
|
135
|
-
| Simple |
|
|
136
|
-
| Nested | 4,
|
|
135
|
+
| Simple | 15,471,913 hz | 1,073,016 hz | **14.42x** |
|
|
136
|
+
| Nested | 4,278,499 hz | 441,468 hz | **9.69x** |
|
|
137
137
|
|
|
138
138
|
## Bundle Size
|
|
139
139
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Xml2JsOptions, D as XmlDescArray, E as XmlDesc, O as XmlObject, S as Js2XmlOptions, T as XmlAttrs, _ as DeclarationAttributes, a as attrNum, b as ElementObject, c as children, d as findChild, f as findDeep, g as Attributes, h as textOf, i as attrMeasure, k as XmlOption, l as collectText, m as hasChild, n as attr, o as childCount, p as findFirst, r as attrBool, s as childText, t as allChildren, u as colorAttr, v as Element, w as XmlAtom, x as IgnoreOptions, y as ElementCompact } from "./utils-
|
|
1
|
+
import { C as Xml2JsOptions, D as XmlDescArray, E as XmlDesc, O as XmlObject, S as Js2XmlOptions, T as XmlAttrs, _ as DeclarationAttributes, a as attrNum, b as ElementObject, c as children, d as findChild, f as findDeep, g as Attributes, h as textOf, i as attrMeasure, k as XmlOption, l as collectText, m as hasChild, n as attr, o as childCount, p as findFirst, r as attrBool, s as childText, t as allChildren, u as colorAttr, v as Element, w as XmlAtom, x as IgnoreOptions, y as ElementCompact } from "./utils-t-_-N57p.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/serialize.d.ts
|
|
4
4
|
/**
|
|
@@ -164,11 +164,11 @@ declare function attrNum(element: Element | undefined, name: string): number | u
|
|
|
164
164
|
* UniversalMeasure ("5mm") and Percentage ("50%") stay verbatim so they
|
|
165
165
|
* round-trip with the stringify-side value helpers in @office-open/core.
|
|
166
166
|
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
167
|
+
* For CT_TblWidth with type="pct", the fiftieths token ("5000" = 100%) is a
|
|
168
|
+
* plain numeric token and is returned as the number 5000; the stringify side
|
|
169
|
+
* emits it verbatim (never "5000%", which is a different XSD branch).
|
|
170
170
|
*/
|
|
171
|
-
declare function attrMeasure(element: Element | undefined, name: string
|
|
171
|
+
declare function attrMeasure(element: Element | undefined, name: string): number | string | undefined;
|
|
172
172
|
/**
|
|
173
173
|
* Get an attribute value as a boolean.
|
|
174
174
|
*/
|
package/dist/utils.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as attrNum, c as children, d as findChild, f as findDeep, h as textOf, i as attrMeasure, l as collectText, m as hasChild, n as attr, o as childCount, p as findFirst, r as attrBool, s as childText, t as allChildren, u as colorAttr } from "./utils-
|
|
1
|
+
import { a as attrNum, c as children, d as findChild, f as findDeep, h as textOf, i as attrMeasure, l as collectText, m as hasChild, n as attr, o as childCount, p as findFirst, r as attrBool, s as childText, t as allChildren, u as colorAttr } from "./utils-t-_-N57p.mjs";
|
|
2
2
|
export { allChildren, attr, attrBool, attrMeasure, attrNum, childCount, childText, children, collectText, colorAttr, findChild, findDeep, findFirst, hasChild, textOf };
|
package/dist/utils.mjs
CHANGED
|
@@ -72,15 +72,14 @@ function attrNum(element, name) {
|
|
|
72
72
|
* UniversalMeasure ("5mm") and Percentage ("50%") stay verbatim so they
|
|
73
73
|
* round-trip with the stringify-side value helpers in @office-open/core.
|
|
74
74
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
75
|
+
* For CT_TblWidth with type="pct", the fiftieths token ("5000" = 100%) is a
|
|
76
|
+
* plain numeric token and is returned as the number 5000; the stringify side
|
|
77
|
+
* emits it verbatim (never "5000%", which is a different XSD branch).
|
|
78
78
|
*/
|
|
79
|
-
function attrMeasure(element, name
|
|
79
|
+
function attrMeasure(element, name) {
|
|
80
80
|
const v = element?.attributes?.[name];
|
|
81
81
|
if (v === void 0) return void 0;
|
|
82
82
|
const raw = String(v);
|
|
83
|
-
if (type === "pct") return raw;
|
|
84
83
|
const n = Number(raw);
|
|
85
84
|
return Number.isNaN(n) ? raw : n;
|
|
86
85
|
}
|
package/package.json
CHANGED