pptx-viewer-core 1.1.44 → 1.1.45

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
@@ -4,8 +4,6 @@
4
4
  [![license](https://img.shields.io/npm/l/pptx-viewer-core.svg)](https://github.com/ChristopherVR/pptx-viewer/blob/main/LICENSE)
5
5
  [![types](https://img.shields.io/npm/types/pptx-viewer-core.svg)](https://www.npmjs.com/package/pptx-viewer-core)
6
6
 
7
- > **Also published as [`@christophervr/pptx-viewer`](https://www.npmjs.com/package/@christophervr/pptx-viewer)** -- the two package names are identical releases of the same code. Use whichever name you prefer; they are always published together and kept in sync.
8
-
9
7
  > A TypeScript library that **reads, creates, edits, and saves** PowerPoint (`.pptx`) files. It runs in the browser and in Node.js, with no native or system dependencies.
10
8
 
11
9
  Hand it the bytes of a `.pptx` file and it gives you back a structured, fully typed object that describes every slide: text, shapes, images, charts, tables, and more. Change anything in that object and write it back to a valid `.pptx`. You can also build new presentations from scratch with a simple chainable API, or turn a deck into Markdown.
@@ -20,11 +18,9 @@ There is no UI here: this is the engine on its own. Use it directly when you nee
20
18
 
21
19
  ```bash
22
20
  npm install pptx-viewer-core
23
- # required companions:
24
- npm install jszip fast-xml-parser
25
21
  ```
26
22
 
27
- > Two packages are always needed alongside it: **jszip** (a `.pptx` is a ZIP file, and this reads and writes that container) and **fast-xml-parser** (the slides inside are XML, and this reads and writes it). Password protection and digital signatures need a few extra packages (`node-forge`, `xml-crypto`, `@xmldom/xmldom`), but only if you actually use those features.
23
+ > That's it, nothing else to install. **jszip** (a `.pptx` is a ZIP file, and this reads and writes that container) and **fast-xml-parser** (the slides inside are XML, and this reads and writes it) are regular dependencies of `pptx-viewer-core`, so your package manager pulls them in automatically. Password protection and digital signatures need a few extra packages (`node-forge`, `xml-crypto`, `@xmldom/xmldom`), but only if you actually use those features.
28
24
 
29
25
  ## What it does
30
26
 
@@ -1018,6 +1018,9 @@ async function upsertRootOriginRelationship(zip) {
1018
1018
  const xml = await zip.file(relsPath)?.async("string") || '<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
1019
1019
  const doc = parser.parseFromString(xml, "text/xml");
1020
1020
  const relationships = doc.documentElement;
1021
+ if (!relationships) {
1022
+ throw new Error("Unable to sign package: invalid _rels/.rels XML.");
1023
+ }
1021
1024
  const existing = Array.from(relationships.getElementsByTagName("Relationship")).find(
1022
1025
  (node) => node.getAttribute("Type") === DIGITAL_SIGNATURE_ORIGIN_REL_TYPE
1023
1026
  );
@@ -1040,6 +1043,9 @@ async function upsertContentTypesForSignature(zip, signaturePath) {
1040
1043
  }
1041
1044
  const doc = parser.parseFromString(xml, "text/xml");
1042
1045
  const types = doc.documentElement;
1046
+ if (!types) {
1047
+ return;
1048
+ }
1043
1049
  const ensureOverride = (partName, contentType) => {
1044
1050
  const existing = Array.from(types.getElementsByTagName("Override")).find(
1045
1051
  (node) => node.getAttribute("PartName") === partName
@@ -1005,6 +1005,9 @@ async function upsertRootOriginRelationship(zip) {
1005
1005
  const xml = await zip.file(relsPath)?.async("string") || '<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
1006
1006
  const doc = parser.parseFromString(xml, "text/xml");
1007
1007
  const relationships = doc.documentElement;
1008
+ if (!relationships) {
1009
+ throw new Error("Unable to sign package: invalid _rels/.rels XML.");
1010
+ }
1008
1011
  const existing = Array.from(relationships.getElementsByTagName("Relationship")).find(
1009
1012
  (node) => node.getAttribute("Type") === DIGITAL_SIGNATURE_ORIGIN_REL_TYPE
1010
1013
  );
@@ -1027,6 +1030,9 @@ async function upsertContentTypesForSignature(zip, signaturePath) {
1027
1030
  }
1028
1031
  const doc = parser.parseFromString(xml, "text/xml");
1029
1032
  const types = doc.documentElement;
1033
+ if (!types) {
1034
+ return;
1035
+ }
1030
1036
  const ensureOverride = (partName, contentType) => {
1031
1037
  const existing = Array.from(types.getElementsByTagName("Override")).find(
1032
1038
  (node) => node.getAttribute("PartName") === partName
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptx-viewer-core",
3
- "version": "1.1.44",
3
+ "version": "1.1.45",
4
4
  "description": "PowerPoint PPTX engine: parse, edit, serialize, and convert .pptx files. Framework-agnostic TypeScript SDK.",
5
5
  "keywords": [
6
6
  "converter",