@office-open/xml 0.6.7 → 0.6.9

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 CHANGED
@@ -103,31 +103,31 @@ Performance comparison against original `xml` (1.0.1) and `xml-js` (1.6.11) pack
103
103
 
104
104
  | Scenario | @office-open/xml | xml | Speedup |
105
105
  | ----------------------- | ---------------: | ---------: | --------: |
106
- | Simple element | 5,177,260 hz | 788,296 hz | **6.57x** |
107
- | Nested element | 931,473 hz | 283,093 hz | **3.29x** |
108
- | Nested with declaration | 871,188 hz | 252,580 hz | **3.45x** |
106
+ | Simple element | 5,069,751 hz | 724,533 hz | **7.00x** |
107
+ | Nested element | 1,122,376 hz | 279,423 hz | **4.02x** |
108
+ | Nested with declaration | 1,050,046 hz | 248,678 hz | **4.22x** |
109
109
 
110
110
  ### Parsing (xml2js)
111
111
 
112
112
  | Scenario | @office-open/xml | xml-js | Speedup |
113
113
  | ------------------ | ---------------: | --------: | ---------: |
114
- | Simple XML | 1,007,094 hz | 91,782 hz | **10.97x** |
115
- | Complex OOXML | 340,595 hz | 49,733 hz | **6.85x** |
116
- | With captureSpaces | 314,648 hz | 44,190 hz | **7.12x** |
114
+ | Simple XML | 1,000,869 hz | 90,488 hz | **11.06x** |
115
+ | Complex OOXML | 310,266 hz | 42,938 hz | **7.23x** |
116
+ | With captureSpaces | 313,183 hz | 41,814 hz | **7.49x** |
117
117
 
118
118
  ### Stringifying (js2xml)
119
119
 
120
120
  | Scenario | @office-open/xml | xml-js | Speedup |
121
121
  | -------------- | ---------------: | ---------: | --------: |
122
- | Simple element | 712,314 hz | 182,865 hz | **3.90x** |
123
- | Complex OOXML | 333,739 hz | 125,132 hz | **2.67x** |
122
+ | Simple element | 975,878 hz | 198,953 hz | **4.90x** |
123
+ | Complex OOXML | 492,220 hz | 107,815 hz | **4.57x** |
124
124
 
125
125
  ### Direct Conversion (toElement vs bridge)
126
126
 
127
127
  | Scenario | toElement() | xml() + xml2js() bridge | Speedup |
128
128
  | -------- | ------------: | ----------------------: | ---------: |
129
- | Simple | 13,922,735 hz | 1,083,869 hz | **12.85x** |
130
- | Nested | 3,799,372 hz | 436,241 hz | **8.71x** |
129
+ | Simple | 13,199,415 hz | 805,104 hz | **16.40x** |
130
+ | Nested | 4,207,319 hz | 458,333 hz | **9.18x** |
131
131
 
132
132
  ## Bundle Size
133
133
 
package/dist/index.d.mts CHANGED
@@ -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-DTU54qj_.mjs";
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-CSaXdiWb.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 | {
@@ -50,4 +50,4 @@ declare function selfCloseElement(tag: string, attrStr?: string): string;
50
50
  /** Convert XML string to JSON string — xml-js compatible export */
51
51
  declare function xml2json(xml: string, options?: Xml2JsOptions): string;
52
52
  //#endregion
53
- export { Attributes, DeclarationAttributes, Element, ElementCompact, ElementObject, IgnoreOptions, Js2XmlOptions, Xml2JsOptions, XmlAtom, XmlAttrs, XmlDesc, XmlDescArray, XmlObject, XmlOption, allChildren, attr, attrBool, attrNum, attrs, childCount, childText, children, collectText, colorAttr, escapeXml, findChild, findDeep, hasChild, js2xml, json2xml, nativeTypeValue, parseAttributes, selfCloseElement, textOf, toElement, unescapeXml, xml, xml2js, xml2json };
53
+ export { type Attributes, type DeclarationAttributes, type Element, type ElementCompact, type ElementObject, type IgnoreOptions, type Js2XmlOptions, type Xml2JsOptions, type XmlAtom, type XmlAttrs, type XmlDesc, type XmlDescArray, type XmlObject, type XmlOption, allChildren, attr, attrBool, attrNum, attrs, childCount, childText, children, collectText, colorAttr, escapeXml, findChild, findDeep, hasChild, js2xml, json2xml, nativeTypeValue, parseAttributes, selfCloseElement, textOf, toElement, unescapeXml, xml, xml2js, xml2json };
package/dist/index.mjs CHANGED
@@ -418,39 +418,39 @@ function writeElement(element, opts, depth) {
418
418
  return parts.join("");
419
419
  }
420
420
  function writeElements(elements, opts, depth, firstLine) {
421
- let result = "";
421
+ const parts = [];
422
422
  for (let i = 0; i < elements.length; i++) {
423
423
  const element = elements[i];
424
424
  const isFirst = firstLine && i === 0;
425
425
  switch (element.type) {
426
426
  case "element":
427
- result += writeIndentation(opts.spaces, depth, isFirst);
428
- result += writeElement(element, opts, depth);
427
+ parts.push(writeIndentation(opts.spaces, depth, isFirst));
428
+ parts.push(writeElement(element, opts, depth));
429
429
  break;
430
430
  case "text":
431
431
  if (opts.ignoreText) continue;
432
- if (opts.indentText) result += writeIndentation(opts.spaces, depth, isFirst);
433
- result += writeText(element.text);
432
+ if (opts.indentText) parts.push(writeIndentation(opts.spaces, depth, isFirst));
433
+ parts.push(writeText(element.text));
434
434
  break;
435
435
  case "cdata":
436
436
  if (opts.ignoreCdata) continue;
437
- if (opts.indentCdata) result += writeIndentation(opts.spaces, depth, isFirst);
438
- result += writeCdata(element.cdata);
437
+ if (opts.indentCdata) parts.push(writeIndentation(opts.spaces, depth, isFirst));
438
+ parts.push(writeCdata(element.cdata));
439
439
  break;
440
440
  case "comment":
441
441
  if (opts.ignoreComment) continue;
442
- result += writeIndentation(opts.spaces, depth, isFirst);
443
- result += writeComment(element.comment);
442
+ parts.push(writeIndentation(opts.spaces, depth, isFirst));
443
+ parts.push(writeComment(element.comment));
444
444
  break;
445
445
  case "doctype":
446
446
  if (opts.ignoreDoctype) continue;
447
- result += writeIndentation(opts.spaces, depth, isFirst);
448
- result += writeDoctype(element.doctype);
447
+ parts.push(writeIndentation(opts.spaces, depth, isFirst));
448
+ parts.push(writeDoctype(element.doctype));
449
449
  break;
450
450
  default: break;
451
451
  }
452
452
  }
453
- return result;
453
+ return parts.join("");
454
454
  }
455
455
  function writeText(text) {
456
456
  if (text == null) return "";
package/dist/utils.d.mts CHANGED
@@ -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-DTU54qj_.mjs";
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-CSaXdiWb.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.7",
3
+ "version": "0.6.9",
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",