circuit-json-to-gltf 0.0.53 → 0.0.56
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.js
CHANGED
|
@@ -14678,7 +14678,7 @@ async function renderBoardLayer(circuitJson, options) {
|
|
|
14678
14678
|
}
|
|
14679
14679
|
async function convertSvgToPng(svgString, resolution, backgroundColor) {
|
|
14680
14680
|
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
14681
|
-
const { svgToPngDataUrl } = await import("./svg-to-png-browser-
|
|
14681
|
+
const { svgToPngDataUrl } = await import("./svg-to-png-browser-MXUWCXAZ.js");
|
|
14682
14682
|
return await svgToPngDataUrl(svgString, {
|
|
14683
14683
|
width: resolution,
|
|
14684
14684
|
background: backgroundColor
|
|
@@ -6,14 +6,18 @@ import {
|
|
|
6
6
|
} from "./chunk-QGM4M3NI.js";
|
|
7
7
|
|
|
8
8
|
// lib/utils/svg-to-png-browser.ts
|
|
9
|
-
import { Resvg, initWasm } from "@resvg/resvg-wasm";
|
|
10
9
|
var wasmInitialized = false;
|
|
10
|
+
var Resvg;
|
|
11
|
+
var initWasm;
|
|
11
12
|
async function ensureWasmInitialized() {
|
|
12
13
|
if (!wasmInitialized) {
|
|
13
14
|
try {
|
|
14
15
|
if (typeof process !== "undefined" && process.versions?.node) {
|
|
15
16
|
const { readFileSync } = await import("fs");
|
|
16
17
|
const { dirname, join } = await import("path");
|
|
18
|
+
const resvgModule = await import("@resvg/resvg-wasm");
|
|
19
|
+
Resvg = resvgModule.Resvg;
|
|
20
|
+
initWasm = resvgModule.initWasm;
|
|
17
21
|
try {
|
|
18
22
|
const packagePath = __require.resolve("@resvg/resvg-wasm/package.json");
|
|
19
23
|
const wasmPath = join(dirname(packagePath), "index_bg.wasm");
|
|
@@ -33,12 +37,28 @@ async function ensureWasmInitialized() {
|
|
|
33
37
|
}
|
|
34
38
|
} else {
|
|
35
39
|
try {
|
|
40
|
+
const resvgModule = await import("@resvg/resvg-wasm");
|
|
41
|
+
Resvg = resvgModule.Resvg;
|
|
42
|
+
initWasm = resvgModule.initWasm;
|
|
36
43
|
const wasmUrl = await import("@resvg/resvg-wasm/index_bg.wasm?url");
|
|
37
44
|
await initWasm(fetch(wasmUrl.default));
|
|
38
45
|
} catch {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
try {
|
|
47
|
+
const cdnUrl = "https://cdn.jsdelivr.net/npm/@resvg/resvg-wasm@2.6.2/+esm";
|
|
48
|
+
const resvgModule = await import(
|
|
49
|
+
/* @vite-ignore */
|
|
50
|
+
cdnUrl
|
|
51
|
+
);
|
|
52
|
+
Resvg = resvgModule.Resvg;
|
|
53
|
+
initWasm = resvgModule.initWasm;
|
|
54
|
+
await initWasm(
|
|
55
|
+
fetch("https://unpkg.com/@resvg/resvg-wasm@2.6.2/index_bg.wasm")
|
|
56
|
+
);
|
|
57
|
+
} catch (cdnError) {
|
|
58
|
+
throw new Error(
|
|
59
|
+
`Failed to load resvg-wasm from CDN: ${cdnError.message}`
|
|
60
|
+
);
|
|
61
|
+
}
|
|
42
62
|
}
|
|
43
63
|
}
|
|
44
64
|
wasmInitialized = true;
|