ducsvg 4.0.4 → 4.0.6
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/pdf2svg-wasm.d.ts +23 -21
- package/dist/pdf2svg-wasm.js +90 -100
- package/dist/pdf2svg-wasm.js.br +0 -0
- package/dist/pdf2svg_bg.wasm +0 -0
- package/dist/pdf2svg_bg.wasm.br +0 -0
- package/dist/pdf2svg_bg.wasm.d.ts +1 -1
- package/package.json +9 -9
package/dist/pdf2svg-wasm.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* WASM binding: Convert PDF bytes to JSON array of SVG pages
|
|
5
6
|
*/
|
|
@@ -8,32 +9,33 @@ export function convert_pdf_to_svg_rs(pdf_data: Uint8Array): string;
|
|
|
8
9
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
9
10
|
|
|
10
11
|
export interface InitOutput {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
readonly memory: WebAssembly.Memory;
|
|
13
|
+
readonly convert_pdf_to_svg_rs: (a: number, b: number) => [number, number, number, number];
|
|
14
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
15
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
16
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
17
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
18
|
+
readonly __wbindgen_start: () => void;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
22
|
+
|
|
21
23
|
/**
|
|
22
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
23
|
-
* a precompiled `WebAssembly.Module`.
|
|
24
|
-
*
|
|
25
|
-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
26
|
-
*
|
|
27
|
-
* @returns {InitOutput}
|
|
28
|
-
*/
|
|
24
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
25
|
+
* a precompiled `WebAssembly.Module`.
|
|
26
|
+
*
|
|
27
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
28
|
+
*
|
|
29
|
+
* @returns {InitOutput}
|
|
30
|
+
*/
|
|
29
31
|
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
33
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
34
|
-
*
|
|
35
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
36
|
-
*
|
|
37
|
-
* @returns {Promise<InitOutput>}
|
|
38
|
-
*/
|
|
34
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
35
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
36
|
+
*
|
|
37
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
38
|
+
*
|
|
39
|
+
* @returns {Promise<InitOutput>}
|
|
40
|
+
*/
|
|
39
41
|
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/dist/pdf2svg-wasm.js
CHANGED
|
@@ -1,49 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* @ts-self-types="./pdf2svg.d.ts" */
|
|
2
2
|
|
|
3
|
-
let cachedUint8ArrayMemory0 = null;
|
|
4
|
-
|
|
5
|
-
function getUint8ArrayMemory0() {
|
|
6
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
7
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
8
|
-
}
|
|
9
|
-
return cachedUint8ArrayMemory0;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
13
|
-
|
|
14
|
-
cachedTextDecoder.decode();
|
|
15
|
-
|
|
16
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
17
|
-
let numBytesDecoded = 0;
|
|
18
|
-
function decodeText(ptr, len) {
|
|
19
|
-
numBytesDecoded += len;
|
|
20
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
21
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
22
|
-
cachedTextDecoder.decode();
|
|
23
|
-
numBytesDecoded = len;
|
|
24
|
-
}
|
|
25
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function getStringFromWasm0(ptr, len) {
|
|
29
|
-
ptr = ptr >>> 0;
|
|
30
|
-
return decodeText(ptr, len);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let WASM_VECTOR_LEN = 0;
|
|
34
|
-
|
|
35
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
36
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
37
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
38
|
-
WASM_VECTOR_LEN = arg.length;
|
|
39
|
-
return ptr;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function takeFromExternrefTable0(idx) {
|
|
43
|
-
const value = wasm.__wbindgen_export_0.get(idx);
|
|
44
|
-
wasm.__externref_table_dealloc(idx);
|
|
45
|
-
return value;
|
|
46
|
-
}
|
|
47
3
|
/**
|
|
48
4
|
* WASM binding: Convert PDF bytes to JSON array of SVG pages
|
|
49
5
|
* @param {Uint8Array} pdf_data
|
|
@@ -69,83 +25,125 @@ export function convert_pdf_to_svg_rs(pdf_data) {
|
|
|
69
25
|
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
70
26
|
}
|
|
71
27
|
}
|
|
28
|
+
function __wbg_get_imports() {
|
|
29
|
+
const import0 = {
|
|
30
|
+
__proto__: null,
|
|
31
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
32
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
33
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
34
|
+
return ret;
|
|
35
|
+
},
|
|
36
|
+
__wbindgen_init_externref_table: function() {
|
|
37
|
+
const table = wasm.__wbindgen_externrefs;
|
|
38
|
+
const offset = table.grow(4);
|
|
39
|
+
table.set(0, undefined);
|
|
40
|
+
table.set(offset + 0, undefined);
|
|
41
|
+
table.set(offset + 1, null);
|
|
42
|
+
table.set(offset + 2, true);
|
|
43
|
+
table.set(offset + 3, false);
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
__proto__: null,
|
|
48
|
+
"./pdf2svg_bg.js": import0,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
72
51
|
|
|
73
|
-
|
|
52
|
+
function getStringFromWasm0(ptr, len) {
|
|
53
|
+
return decodeText(ptr >>> 0, len);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let cachedUint8ArrayMemory0 = null;
|
|
57
|
+
function getUint8ArrayMemory0() {
|
|
58
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
59
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
60
|
+
}
|
|
61
|
+
return cachedUint8ArrayMemory0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
65
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
66
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
67
|
+
WASM_VECTOR_LEN = arg.length;
|
|
68
|
+
return ptr;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function takeFromExternrefTable0(idx) {
|
|
72
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
73
|
+
wasm.__externref_table_dealloc(idx);
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
78
|
+
cachedTextDecoder.decode();
|
|
79
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
80
|
+
let numBytesDecoded = 0;
|
|
81
|
+
function decodeText(ptr, len) {
|
|
82
|
+
numBytesDecoded += len;
|
|
83
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
84
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
85
|
+
cachedTextDecoder.decode();
|
|
86
|
+
numBytesDecoded = len;
|
|
87
|
+
}
|
|
88
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
let WASM_VECTOR_LEN = 0;
|
|
92
|
+
|
|
93
|
+
let wasmModule, wasmInstance, wasm;
|
|
94
|
+
function __wbg_finalize_init(instance, module) {
|
|
95
|
+
wasmInstance = instance;
|
|
96
|
+
wasm = instance.exports;
|
|
97
|
+
wasmModule = module;
|
|
98
|
+
cachedUint8ArrayMemory0 = null;
|
|
99
|
+
wasm.__wbindgen_start();
|
|
100
|
+
return wasm;
|
|
101
|
+
}
|
|
74
102
|
|
|
75
103
|
async function __wbg_load(module, imports) {
|
|
76
104
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
105
|
+
if (!module.ok) {
|
|
106
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
107
|
+
}
|
|
108
|
+
|
|
77
109
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
78
110
|
try {
|
|
79
111
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
80
|
-
|
|
81
112
|
} catch (e) {
|
|
82
|
-
const validResponse =
|
|
113
|
+
const validResponse = expectedResponseType(module.type);
|
|
83
114
|
|
|
84
115
|
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
85
116
|
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
86
117
|
|
|
87
|
-
} else {
|
|
88
|
-
throw e;
|
|
89
|
-
}
|
|
118
|
+
} else { throw e; }
|
|
90
119
|
}
|
|
91
120
|
}
|
|
92
121
|
|
|
93
122
|
const bytes = await module.arrayBuffer();
|
|
94
123
|
return await WebAssembly.instantiate(bytes, imports);
|
|
95
|
-
|
|
96
124
|
} else {
|
|
97
125
|
const instance = await WebAssembly.instantiate(module, imports);
|
|
98
126
|
|
|
99
127
|
if (instance instanceof WebAssembly.Instance) {
|
|
100
128
|
return { instance, module };
|
|
101
|
-
|
|
102
129
|
} else {
|
|
103
130
|
return instance;
|
|
104
131
|
}
|
|
105
132
|
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function __wbg_get_imports() {
|
|
109
|
-
const imports = {};
|
|
110
|
-
imports.wbg = {};
|
|
111
|
-
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
112
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
113
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
114
|
-
return ret;
|
|
115
|
-
};
|
|
116
|
-
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
117
|
-
const table = wasm.__wbindgen_export_0;
|
|
118
|
-
const offset = table.grow(4);
|
|
119
|
-
table.set(0, undefined);
|
|
120
|
-
table.set(offset + 0, undefined);
|
|
121
|
-
table.set(offset + 1, null);
|
|
122
|
-
table.set(offset + 2, true);
|
|
123
|
-
table.set(offset + 3, false);
|
|
124
|
-
;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
return imports;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function __wbg_init_memory(imports, memory) {
|
|
131
|
-
|
|
132
|
-
}
|
|
133
133
|
|
|
134
|
-
function
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
wasm.__wbindgen_start();
|
|
141
|
-
return wasm;
|
|
134
|
+
function expectedResponseType(type) {
|
|
135
|
+
switch (type) {
|
|
136
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
137
|
+
}
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
142
140
|
}
|
|
143
141
|
|
|
144
142
|
function initSync(module) {
|
|
145
143
|
if (wasm !== undefined) return wasm;
|
|
146
144
|
|
|
147
145
|
|
|
148
|
-
if (
|
|
146
|
+
if (module !== undefined) {
|
|
149
147
|
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
150
148
|
({module} = module)
|
|
151
149
|
} else {
|
|
@@ -154,15 +152,10 @@ function initSync(module) {
|
|
|
154
152
|
}
|
|
155
153
|
|
|
156
154
|
const imports = __wbg_get_imports();
|
|
157
|
-
|
|
158
|
-
__wbg_init_memory(imports);
|
|
159
|
-
|
|
160
155
|
if (!(module instanceof WebAssembly.Module)) {
|
|
161
156
|
module = new WebAssembly.Module(module);
|
|
162
157
|
}
|
|
163
|
-
|
|
164
158
|
const instance = new WebAssembly.Instance(module, imports);
|
|
165
|
-
|
|
166
159
|
return __wbg_finalize_init(instance, module);
|
|
167
160
|
}
|
|
168
161
|
|
|
@@ -170,7 +163,7 @@ async function __wbg_init(module_or_path) {
|
|
|
170
163
|
if (wasm !== undefined) return wasm;
|
|
171
164
|
|
|
172
165
|
|
|
173
|
-
if (
|
|
166
|
+
if (module_or_path !== undefined) {
|
|
174
167
|
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
175
168
|
({module_or_path} = module_or_path)
|
|
176
169
|
} else {
|
|
@@ -178,7 +171,7 @@ async function __wbg_init(module_or_path) {
|
|
|
178
171
|
}
|
|
179
172
|
}
|
|
180
173
|
|
|
181
|
-
if (
|
|
174
|
+
if (module_or_path === undefined) {
|
|
182
175
|
module_or_path = new URL('pdf2svg_bg.wasm', import.meta.url);
|
|
183
176
|
}
|
|
184
177
|
const imports = __wbg_get_imports();
|
|
@@ -187,12 +180,9 @@ async function __wbg_init(module_or_path) {
|
|
|
187
180
|
module_or_path = fetch(module_or_path);
|
|
188
181
|
}
|
|
189
182
|
|
|
190
|
-
__wbg_init_memory(imports);
|
|
191
|
-
|
|
192
183
|
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
193
184
|
|
|
194
185
|
return __wbg_finalize_init(instance, module);
|
|
195
186
|
}
|
|
196
187
|
|
|
197
|
-
export { initSync };
|
|
198
|
-
export default __wbg_init;
|
|
188
|
+
export { initSync, __wbg_init as default };
|
package/dist/pdf2svg-wasm.js.br
CHANGED
|
Binary file
|
package/dist/pdf2svg_bg.wasm
CHANGED
|
Binary file
|
package/dist/pdf2svg_bg.wasm.br
CHANGED
|
Binary file
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const convert_pdf_to_svg_rs: (a: number, b: number) => [number, number, number, number];
|
|
5
|
-
export const
|
|
5
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
6
6
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
7
7
|
export const __externref_table_dealloc: (a: number) => void;
|
|
8
8
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ducsvg",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
4
4
|
"description": "Adapter for converting duc CAD documents to SVG. Built on top of ducjs.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
"author": "Ducflair",
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"ducjs": "^4.0.
|
|
41
|
-
"ducpdf": "^4.0.
|
|
40
|
+
"ducjs": "^4.0.4",
|
|
41
|
+
"ducpdf": "^4.0.6"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@xmldom/xmldom": "^0.8
|
|
45
|
-
"happy-dom": "^20.
|
|
46
|
-
"semantic-release": "^
|
|
44
|
+
"@xmldom/xmldom": "^0.9.8",
|
|
45
|
+
"happy-dom": "^20.8.9",
|
|
46
|
+
"semantic-release": "^25.0.2",
|
|
47
47
|
"typedoc": "^0.27.9",
|
|
48
|
-
"typescript": "^5.
|
|
49
|
-
"vite": "^
|
|
48
|
+
"typescript": "^5.9.3",
|
|
49
|
+
"vite": "^7.3.6",
|
|
50
50
|
"vite-plugin-compression": "^0.5.1",
|
|
51
|
-
"vitest": "^3.2.
|
|
51
|
+
"vitest": "^3.2.6"
|
|
52
52
|
},
|
|
53
53
|
"files": [
|
|
54
54
|
"dist",
|