pptx-glimpse 0.5.0 → 0.6.0
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/dist/index.cjs +10 -17
- package/dist/index.js +10 -7
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/index.ts
|
|
@@ -1580,17 +1570,20 @@ function parseXmlOrdered(xml) {
|
|
|
1580
1570
|
}
|
|
1581
1571
|
|
|
1582
1572
|
// src/png/png-converter.ts
|
|
1583
|
-
var
|
|
1573
|
+
var import_resvg_js = require("@resvg/resvg-js");
|
|
1584
1574
|
async function svgToPng(svgString, options) {
|
|
1585
|
-
const
|
|
1586
|
-
let pipeline = (0, import_sharp.default)(svgBuffer);
|
|
1575
|
+
const resvgOptions = {};
|
|
1587
1576
|
if (options?.width) {
|
|
1588
|
-
|
|
1577
|
+
resvgOptions.fitTo = { mode: "width", value: options.width };
|
|
1589
1578
|
} else if (options?.height) {
|
|
1590
|
-
|
|
1579
|
+
resvgOptions.fitTo = { mode: "height", value: options.height };
|
|
1591
1580
|
}
|
|
1592
|
-
const
|
|
1593
|
-
return {
|
|
1581
|
+
const rendered = await (0, import_resvg_js.renderAsync)(svgString, resvgOptions);
|
|
1582
|
+
return {
|
|
1583
|
+
png: Buffer.from(rendered.asPng()),
|
|
1584
|
+
width: rendered.width,
|
|
1585
|
+
height: rendered.height
|
|
1586
|
+
};
|
|
1594
1587
|
}
|
|
1595
1588
|
|
|
1596
1589
|
// src/warning-logger.ts
|
package/dist/index.js
CHANGED
|
@@ -1535,17 +1535,20 @@ function parseXmlOrdered(xml) {
|
|
|
1535
1535
|
}
|
|
1536
1536
|
|
|
1537
1537
|
// src/png/png-converter.ts
|
|
1538
|
-
import
|
|
1538
|
+
import { renderAsync } from "@resvg/resvg-js";
|
|
1539
1539
|
async function svgToPng(svgString, options) {
|
|
1540
|
-
const
|
|
1541
|
-
let pipeline = sharp(svgBuffer);
|
|
1540
|
+
const resvgOptions = {};
|
|
1542
1541
|
if (options?.width) {
|
|
1543
|
-
|
|
1542
|
+
resvgOptions.fitTo = { mode: "width", value: options.width };
|
|
1544
1543
|
} else if (options?.height) {
|
|
1545
|
-
|
|
1544
|
+
resvgOptions.fitTo = { mode: "height", value: options.height };
|
|
1546
1545
|
}
|
|
1547
|
-
const
|
|
1548
|
-
return {
|
|
1546
|
+
const rendered = await renderAsync(svgString, resvgOptions);
|
|
1547
|
+
return {
|
|
1548
|
+
png: Buffer.from(rendered.asPng()),
|
|
1549
|
+
width: rendered.width,
|
|
1550
|
+
height: rendered.height
|
|
1551
|
+
};
|
|
1549
1552
|
}
|
|
1550
1553
|
|
|
1551
1554
|
// src/warning-logger.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pptx-glimpse",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "A lightweight JavaScript library for rendering PowerPoint (.pptx) files as SVG or PNG in Node.js. No LibreOffice required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"author": "hirokisakabe",
|
|
65
65
|
"license": "MIT",
|
|
66
66
|
"dependencies": {
|
|
67
|
+
"@resvg/resvg-js": "^2.6.2",
|
|
67
68
|
"fast-xml-parser": "^5.3.6",
|
|
68
69
|
"fflate": "^0.8.2",
|
|
69
|
-
"opentype.js": "^1.3.4"
|
|
70
|
-
"sharp": "^0.34.5"
|
|
70
|
+
"opentype.js": "^1.3.4"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@changesets/cli": "^2.29.8",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"knip": "^5.85.0",
|
|
82
82
|
"pixelmatch": "^7.1.0",
|
|
83
83
|
"prettier": "^3.0.0",
|
|
84
|
+
"sharp": "^0.34.5",
|
|
84
85
|
"tsup": "^8.0.0",
|
|
85
86
|
"tsx": "^4.21.0",
|
|
86
87
|
"typescript": "^5.9.3",
|