ducpdf 2.0.0 → 3.2.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/duc2pdf/release.config.cjs +4 -1
- package/dist/duc2pdf/release.config.cjs.map +1 -1
- package/dist/duc2pdf/release.config.d.cts +1 -1
- package/dist/duc2pdf.d.ts +6 -6
- package/dist/duc2pdf.js +21 -48
- package/dist/duc2pdf_bg.wasm +0 -0
- package/dist/duc2pdf_bg.wasm.d.ts +2 -2
- package/package.json +3 -4
|
@@ -5,7 +5,10 @@ module.exports = {
|
|
|
5
5
|
[
|
|
6
6
|
require.resolve("../../../../scripts/semrel-path-filter.cjs"),
|
|
7
7
|
{
|
|
8
|
-
|
|
8
|
+
paths: [
|
|
9
|
+
"packages/ducpdf/src/duc2pdf",
|
|
10
|
+
"packages/ducrs",
|
|
11
|
+
],
|
|
9
12
|
analyzer: { preset: "conventionalcommits" },
|
|
10
13
|
notes: { preset: "conventionalcommits" },
|
|
11
14
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.config.cjs","sourceRoot":"","sources":["../../src/duc2pdf/release.config.cjs"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG;IACf,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IACzF,OAAO,EAAE;QACP;YACE,OAAO,CAAC,OAAO,CAAC,4CAA4C,CAAC;YAC7D;gBACE,
|
|
1
|
+
{"version":3,"file":"release.config.cjs","sourceRoot":"","sources":["../../src/duc2pdf/release.config.cjs"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG;IACf,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IACzF,OAAO,EAAE;QACP;YACE,OAAO,CAAC,OAAO,CAAC,4CAA4C,CAAC;YAC7D;gBACE,KAAK,EAAE;oBACL,6BAA6B;oBAC7B,gBAAgB;iBACjB;gBACD,QAAQ,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE;gBAC3C,KAAK,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE;aACzC;SACF;QACD;YACE,0BAA0B;SAC3B;QACD;YACE,wBAAwB;YACxB;gBACE,4DAA4D;gBAC5D,UAAU,EACR,mEAAmE;gBAErE,+CAA+C;gBAC/C,UAAU,EACR,yEAAyE;aAC5E;SACF;KACF;IACD,SAAS,EAAE,oBAAoB;CAChC,CAAC"}
|
package/dist/duc2pdf.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* WASM binding for the main conversion function
|
|
5
|
-
*/
|
|
6
|
-
export function convert_duc_to_pdf_rs(duc_data: Uint8Array): Uint8Array;
|
|
7
3
|
/**
|
|
8
4
|
* WASM binding for crop conversion
|
|
9
5
|
*/
|
|
10
6
|
export function convert_duc_to_pdf_crop_wasm(duc_data: Uint8Array, offset_x: number, offset_y: number, width?: number | null, height?: number | null, background_color?: string | null): Uint8Array;
|
|
7
|
+
/**
|
|
8
|
+
* WASM binding for the main conversion function
|
|
9
|
+
*/
|
|
10
|
+
export function convert_duc_to_pdf_rs(duc_data: Uint8Array): Uint8Array;
|
|
11
11
|
|
|
12
12
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
13
13
|
|
|
14
14
|
export interface InitOutput {
|
|
15
15
|
readonly memory: WebAssembly.Memory;
|
|
16
|
-
readonly convert_duc_to_pdf_rs: (a: number, b: number) => [number, number];
|
|
17
16
|
readonly convert_duc_to_pdf_crop_wasm: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
17
|
+
readonly convert_duc_to_pdf_rs: (a: number, b: number) => [number, number];
|
|
18
18
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
19
19
|
readonly __externref_table_alloc: () => number;
|
|
20
20
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
21
21
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
22
|
-
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
23
22
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
23
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
24
24
|
readonly __wbindgen_start: () => void;
|
|
25
25
|
}
|
|
26
26
|
|
package/dist/duc2pdf.js
CHANGED
|
@@ -29,22 +29,6 @@ function handleError(f, args) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
function logError(f, args) {
|
|
33
|
-
try {
|
|
34
|
-
return f.apply(this, args);
|
|
35
|
-
} catch (e) {
|
|
36
|
-
let error = (function () {
|
|
37
|
-
try {
|
|
38
|
-
return e instanceof Error ? `${e.message}\n\nStack:\n${e.stack}` : e.toString();
|
|
39
|
-
} catch(_) {
|
|
40
|
-
return "<failed to stringify thrown value>";
|
|
41
|
-
}
|
|
42
|
-
}());
|
|
43
|
-
console.error("wasm-bindgen: imported JS function that was not marked as `catch` threw an error:", error);
|
|
44
|
-
throw e;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
32
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
49
33
|
|
|
50
34
|
cachedTextDecoder.decode();
|
|
@@ -74,28 +58,11 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
74
58
|
WASM_VECTOR_LEN = arg.length;
|
|
75
59
|
return ptr;
|
|
76
60
|
}
|
|
77
|
-
/**
|
|
78
|
-
* WASM binding for the main conversion function
|
|
79
|
-
* @param {Uint8Array} duc_data
|
|
80
|
-
* @returns {Uint8Array}
|
|
81
|
-
*/
|
|
82
|
-
export function convert_duc_to_pdf_rs(duc_data) {
|
|
83
|
-
const ptr0 = passArray8ToWasm0(duc_data, wasm.__wbindgen_malloc);
|
|
84
|
-
const len0 = WASM_VECTOR_LEN;
|
|
85
|
-
const ret = wasm.convert_duc_to_pdf_rs(ptr0, len0);
|
|
86
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
87
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
88
|
-
return v2;
|
|
89
|
-
}
|
|
90
61
|
|
|
91
62
|
function isLikeNone(x) {
|
|
92
63
|
return x === undefined || x === null;
|
|
93
64
|
}
|
|
94
65
|
|
|
95
|
-
function _assertNum(n) {
|
|
96
|
-
if (typeof(n) !== 'number') throw new Error(`expected a number argument, found ${typeof(n)}`);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
66
|
const cachedTextEncoder = new TextEncoder();
|
|
100
67
|
|
|
101
68
|
if (!('encodeInto' in cachedTextEncoder)) {
|
|
@@ -111,8 +78,6 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
111
78
|
|
|
112
79
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
113
80
|
|
|
114
|
-
if (typeof(arg) !== 'string') throw new Error(`expected a string argument, found ${typeof(arg)}`);
|
|
115
|
-
|
|
116
81
|
if (realloc === undefined) {
|
|
117
82
|
const buf = cachedTextEncoder.encode(arg);
|
|
118
83
|
const ptr = malloc(buf.length, 1) >>> 0;
|
|
@@ -141,7 +106,7 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
141
106
|
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
142
107
|
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
143
108
|
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
144
|
-
|
|
109
|
+
|
|
145
110
|
offset += ret.written;
|
|
146
111
|
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
147
112
|
}
|
|
@@ -162,12 +127,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
162
127
|
export function convert_duc_to_pdf_crop_wasm(duc_data, offset_x, offset_y, width, height, background_color) {
|
|
163
128
|
const ptr0 = passArray8ToWasm0(duc_data, wasm.__wbindgen_malloc);
|
|
164
129
|
const len0 = WASM_VECTOR_LEN;
|
|
165
|
-
if (!isLikeNone(width)) {
|
|
166
|
-
_assertNum(width);
|
|
167
|
-
}
|
|
168
|
-
if (!isLikeNone(height)) {
|
|
169
|
-
_assertNum(height);
|
|
170
|
-
}
|
|
171
130
|
var ptr1 = isLikeNone(background_color) ? 0 : passStringToWasm0(background_color, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
172
131
|
var len1 = WASM_VECTOR_LEN;
|
|
173
132
|
const ret = wasm.convert_duc_to_pdf_crop_wasm(ptr0, len0, offset_x, offset_y, !isLikeNone(width), isLikeNone(width) ? 0 : width, !isLikeNone(height), isLikeNone(height) ? 0 : height, ptr1, len1);
|
|
@@ -176,6 +135,20 @@ export function convert_duc_to_pdf_crop_wasm(duc_data, offset_x, offset_y, width
|
|
|
176
135
|
return v3;
|
|
177
136
|
}
|
|
178
137
|
|
|
138
|
+
/**
|
|
139
|
+
* WASM binding for the main conversion function
|
|
140
|
+
* @param {Uint8Array} duc_data
|
|
141
|
+
* @returns {Uint8Array}
|
|
142
|
+
*/
|
|
143
|
+
export function convert_duc_to_pdf_rs(duc_data) {
|
|
144
|
+
const ptr0 = passArray8ToWasm0(duc_data, wasm.__wbindgen_malloc);
|
|
145
|
+
const len0 = WASM_VECTOR_LEN;
|
|
146
|
+
const ret = wasm.convert_duc_to_pdf_rs(ptr0, len0);
|
|
147
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
148
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
149
|
+
return v2;
|
|
150
|
+
}
|
|
151
|
+
|
|
179
152
|
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
|
|
180
153
|
|
|
181
154
|
async function __wbg_load(module, imports) {
|
|
@@ -217,20 +190,20 @@ function __wbg_get_imports() {
|
|
|
217
190
|
imports.wbg.__wbg_getRandomValues_1c61fac11405ffdc = function() { return handleError(function (arg0, arg1) {
|
|
218
191
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
219
192
|
}, arguments) };
|
|
220
|
-
imports.wbg.__wbg_log_6c7b5f4f00b8ce3f = function(
|
|
193
|
+
imports.wbg.__wbg_log_6c7b5f4f00b8ce3f = function(arg0) {
|
|
221
194
|
console.log(arg0);
|
|
222
|
-
}
|
|
223
|
-
imports.wbg.__wbg_warn_e2ada06313f92f09 = function(
|
|
195
|
+
};
|
|
196
|
+
imports.wbg.__wbg_warn_e2ada06313f92f09 = function(arg0) {
|
|
224
197
|
console.warn(arg0);
|
|
225
|
-
}
|
|
198
|
+
};
|
|
226
199
|
imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
|
|
227
200
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
228
201
|
};
|
|
229
|
-
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(
|
|
202
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
230
203
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
231
204
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
232
205
|
return ret;
|
|
233
|
-
}
|
|
206
|
+
};
|
|
234
207
|
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
235
208
|
const table = wasm.__wbindgen_export_2;
|
|
236
209
|
const offset = table.grow(4);
|
package/dist/duc2pdf_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const convert_duc_to_pdf_rs: (a: number, b: number) => [number, number];
|
|
5
4
|
export const convert_duc_to_pdf_crop_wasm: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
5
|
+
export const convert_duc_to_pdf_rs: (a: number, b: number) => [number, number];
|
|
6
6
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
7
7
|
export const __externref_table_alloc: () => number;
|
|
8
8
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
9
9
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
10
|
-
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
11
10
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
11
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
12
12
|
export const __wbindgen_start: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ducpdf",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Library for converting between PDF and DUC formats.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -40,8 +40,7 @@
|
|
|
40
40
|
"build": "bun run clean && bun run build:wasm && bun run copy:wasm-to-dist && bun run build:ts",
|
|
41
41
|
"build:ts": "tsc -p tsconfig.json",
|
|
42
42
|
"build:rs": "cd src/duc2pdf && cargo build",
|
|
43
|
-
"build:wasm": "cd src/duc2pdf && wasm-pack build --target web --out-dir ../../pkg --
|
|
44
|
-
"build:wasm:prod": "cd src/duc2pdf && wasm-pack build --target web --out-dir ../../pkg --release",
|
|
43
|
+
"build:wasm": "cd src/duc2pdf && wasm-pack build --target web --out-dir ../../pkg --release",
|
|
45
44
|
"copy:wasm-to-dist": "mkdir -p dist && cp pkg/duc2pdf_bg.wasm dist/ && cp pkg/duc2pdf.js dist/ && cp pkg/duc2pdf.d.ts dist/ && cp pkg/duc2pdf_bg.wasm.d.ts dist/",
|
|
46
45
|
"clean": "rm -rf dist pkg && cd src/duc2pdf && cargo clean",
|
|
47
46
|
"test": "bun run build:wasm && bun test",
|
|
@@ -49,7 +48,7 @@
|
|
|
49
48
|
"test:duc2pdf": "cd src/duc2pdf && cargo test"
|
|
50
49
|
},
|
|
51
50
|
"dependencies": {
|
|
52
|
-
"ducjs": "^
|
|
51
|
+
"ducjs": "^2.2.2"
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
55
54
|
"typescript": "^5.4.5",
|