@wire-dsl/exporters 0.0.9 → 0.1.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 +4 -4
- package/dist/index.js +4 -11
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -42,9 +42,9 @@ module.exports = __toCommonJS(index_exports);
|
|
|
42
42
|
|
|
43
43
|
// src/svg.ts
|
|
44
44
|
var import_promises = require("fs/promises");
|
|
45
|
+
var import_path = __toESM(require("path"), 1);
|
|
45
46
|
async function exportSVG(svg, outputPath) {
|
|
46
|
-
const
|
|
47
|
-
const outputDir = path2.dirname(outputPath);
|
|
47
|
+
const outputDir = import_path.default.dirname(outputPath);
|
|
48
48
|
await (0, import_promises.mkdir)(outputDir, { recursive: true }).catch(() => {
|
|
49
49
|
});
|
|
50
50
|
await (0, import_promises.writeFile)(outputPath, svg, "utf8");
|
|
@@ -64,7 +64,7 @@ async function exportPNG(svg, outputPath, width, height) {
|
|
|
64
64
|
// src/pdf.ts
|
|
65
65
|
var import_promises2 = require("fs/promises");
|
|
66
66
|
var import_fs = require("fs");
|
|
67
|
-
var
|
|
67
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
68
68
|
var import_pdfkit = __toESM(require("pdfkit"), 1);
|
|
69
69
|
var import_svg_to_pdfkit = __toESM(require("svg-to-pdfkit"), 1);
|
|
70
70
|
|
|
@@ -94,7 +94,7 @@ function preprocessSVGColors(svg) {
|
|
|
94
94
|
// src/pdf.ts
|
|
95
95
|
async function exportMultipagePDF(svgs, outputPath) {
|
|
96
96
|
return new Promise(async (resolve, reject) => {
|
|
97
|
-
const outputDir =
|
|
97
|
+
const outputDir = import_path2.default.dirname(outputPath);
|
|
98
98
|
try {
|
|
99
99
|
await (0, import_promises2.mkdir)(outputDir, { recursive: true });
|
|
100
100
|
} catch (error) {
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
-
});
|
|
7
|
-
|
|
8
1
|
// src/svg.ts
|
|
9
2
|
import { writeFile, mkdir } from "fs/promises";
|
|
3
|
+
import path from "path";
|
|
10
4
|
async function exportSVG(svg, outputPath) {
|
|
11
|
-
const
|
|
12
|
-
const outputDir = path2.dirname(outputPath);
|
|
5
|
+
const outputDir = path.dirname(outputPath);
|
|
13
6
|
await mkdir(outputDir, { recursive: true }).catch(() => {
|
|
14
7
|
});
|
|
15
8
|
await writeFile(outputPath, svg, "utf8");
|
|
@@ -29,7 +22,7 @@ async function exportPNG(svg, outputPath, width, height) {
|
|
|
29
22
|
// src/pdf.ts
|
|
30
23
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
31
24
|
import { createWriteStream } from "fs";
|
|
32
|
-
import
|
|
25
|
+
import path2 from "path";
|
|
33
26
|
import PDFDocument from "pdfkit";
|
|
34
27
|
import SVGtoPDF from "svg-to-pdfkit";
|
|
35
28
|
|
|
@@ -59,7 +52,7 @@ function preprocessSVGColors(svg) {
|
|
|
59
52
|
// src/pdf.ts
|
|
60
53
|
async function exportMultipagePDF(svgs, outputPath) {
|
|
61
54
|
return new Promise(async (resolve, reject) => {
|
|
62
|
-
const outputDir =
|
|
55
|
+
const outputDir = path2.dirname(outputPath);
|
|
63
56
|
try {
|
|
64
57
|
await mkdir2(outputDir, { recursive: true });
|
|
65
58
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wire-dsl/exporters",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "WireDSL exporters - SVG, PNG, and PDF file export functions (Node.js only)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"pdfkit": "0.17.2",
|
|
35
35
|
"sharp": "0.34.5",
|
|
36
36
|
"svg-to-pdfkit": "0.1.8",
|
|
37
|
-
"@wire-dsl/engine": "0.
|
|
37
|
+
"@wire-dsl/engine": "0.3.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "25.2.0",
|