ducpdf 0.0.0-development

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ducflair
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ <p align="center">
2
+ <br/>
3
+ <a href="https://duc.ducflair.com" target="_blank"><img width="256px" src="https://raw.githubusercontent.com/ducflair/assets/refs/heads/main/src/duc/duc-extended.png" /></a>
4
+ <p align="center">PDF Adapter for the duc 2D CAD File Format</p>
5
+ <p align="center" style="align: center;">
6
+ <a href="https://www.npmjs.com/package/ducpdf"><img src="https://shields.io/badge/NPM-cc3534?logo=Npm&logoColor=white&style=round-square" alt="NPM" /></a>
7
+ <a href="https://www.npmjs.com/package/ducpdf"><img src="https://img.shields.io/npm/v/ducpdf/latest?style=round-square&label=latest%20stable" alt="NPM ducpdf@latest release" /></a>
8
+ <a href="https://www.npmtrends.com/ducpdf"><img src="https://img.shields.io/npm/dm/ducpdf?style=round-square&color=salmon" alt="Downloads" /></a>
9
+ </p>
10
+ </p>
11
+
12
+ # ducpdf
13
+
14
+ `ducpdf` is a lightweight adapter for rendering `duc` CAD documents to PDF. It's built on top of `ducjs` and focuses on accurate, standards-compliant PDF output for professional document sharing and printing.
15
+
16
+ - Convert duc files to PDF documents
17
+ - Strongly typed with TypeScript
18
+ - Cross-platform support (Node.js and browser)
19
+
20
+ ## Documentation
21
+
22
+ For detailed documentation, including all available types and utility functions, visit our [Documentation](https://duc.ducflair.com).
23
+
24
+ ## Tools
25
+
26
+ - [Playground](https://ducflair.com/core): Experiment with the `duc` format in a live environment.
27
+ - [Documentation](https://duc.ducflair.com): Comprehensive guides and API references.
28
+
29
+ ## Contributing
30
+
31
+ At the moment we are not accepting contributions to this package. However, we welcome feedback and suggestions for future improvements. Feel free to open an issue or contact us at [Ducflair Support](https://www.ducflair.com/support).
32
+
33
+ ## License
34
+
35
+ This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details.
36
+
37
+
38
+ ## Commit Message Guidelines
39
+
40
+ To ensure smooth releases with semantic-release, please follow [these guidelines](https://semantic-release.gitbook.io/semantic-release#how-does-it-work).
41
+
42
+ ---
43
+
44
+ *The duc format and libraries are constantly evolving, aiming to set new standards in the 2D CAD industry. Be a part of this transformation and help shape the future of design technology!*
@@ -0,0 +1,31 @@
1
+ export interface ConversionOptions {
2
+ offsetX?: number;
3
+ offsetY?: number;
4
+ width?: number;
5
+ height?: number;
6
+ scale?: number;
7
+ zoom?: number;
8
+ backgroundColor?: string;
9
+ metadata?: {
10
+ title?: string;
11
+ author?: string;
12
+ subject?: string;
13
+ };
14
+ }
15
+ export declare function convertDucToPdf(ducData: Uint8Array, options?: ConversionOptions, debugMode?: boolean): Promise<Uint8Array>;
16
+ export declare function convertDucToPdfCrop(ducData: Uint8Array, offsetX: number, offsetY: number, width?: number, height?: number): Promise<Uint8Array>;
17
+ export declare function isWasmInitialized(): boolean;
18
+ export declare function getWasmStatus(): Promise<{
19
+ initialized: boolean;
20
+ moduleAvailable: boolean;
21
+ functions: string[];
22
+ }>;
23
+ export declare function resetWasmModule(): void;
24
+ export declare function analyzeDucData(ducData: Uint8Array): {
25
+ size: number;
26
+ headerInfo: string;
27
+ estimatedElements: number;
28
+ potentialIssues: string[];
29
+ };
30
+ export declare function debugConversionState(ducData: Uint8Array, options?: ConversionOptions): void;
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/duc2pdf/index.ts"],"names":[],"mappings":"AAwDA,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE;QACT,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAgDD,wBAAsB,eAAe,CACnC,OAAO,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,iBAAiB,EAC3B,SAAS,GAAE,OAAe,GACzB,OAAO,CAAC,UAAU,CAAC,CAsLrB;AAED,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,CAAC,CAErB;AAGD,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC;IAC7C,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC,CAeD;AAGD,wBAAgB,eAAe,IAAI,IAAI,CAGtC;AAGD,wBAAgB,cAAc,CAAC,OAAO,EAAE,UAAU,GAAG;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CA2DA;AAGD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,IAAI,CA0BN"}
@@ -0,0 +1,359 @@
1
+ import { getFreeDrawSvgPath, getNormalizedZoom, isFreeDrawElement, parseDuc, serializeDuc, traverseAndUpdatePrecisionValues } from 'ducjs';
2
+ let wasmModule = null;
3
+ let wasmInitPromise = null;
4
+ async function initWasm() {
5
+ if (wasmModule)
6
+ return wasmModule;
7
+ if (wasmInitPromise) {
8
+ return wasmInitPromise;
9
+ }
10
+ wasmInitPromise = (async () => {
11
+ try {
12
+ // Dynamically import the WASM JS bindings
13
+ const wasmBindings = await import('../wasm');
14
+ // The wasm-pack generated module exports a default init function
15
+ // that handles loading the WASM file using import.meta.url
16
+ // This is the same pattern used by duc_renderer_bin
17
+ if (typeof wasmBindings.default === 'function') {
18
+ // Call the init function - it will automatically fetch the WASM file
19
+ // using import.meta.url to resolve the path correctly
20
+ await wasmBindings.default();
21
+ }
22
+ else {
23
+ throw new Error('WASM module does not have a default initialization function');
24
+ }
25
+ // Validate that required functions exist on the imported module
26
+ const requiredFunctions = [
27
+ 'convert_duc_to_pdf_rs',
28
+ 'convert_duc_to_pdf_crop_wasm'
29
+ ];
30
+ for (const fnName of requiredFunctions) {
31
+ if (typeof wasmBindings[fnName] !== 'function') {
32
+ throw new Error(`Required WASM function '${fnName}' not found`);
33
+ }
34
+ }
35
+ wasmModule = wasmBindings;
36
+ return wasmModule;
37
+ }
38
+ catch (error) {
39
+ console.error('Failed to initialize WASM module:', error);
40
+ wasmInitPromise = null; // Reset promise on failure
41
+ if (error instanceof Error) {
42
+ throw new Error(`WASM module initialization failed: ${error.message}`);
43
+ }
44
+ throw new Error('WASM module initialization failed: Unknown error');
45
+ }
46
+ })();
47
+ return wasmInitPromise;
48
+ }
49
+ function validateInput(ducData, options) {
50
+ // Validate input data
51
+ if (!ducData || ducData.length === 0) {
52
+ throw new Error('DUC data is required and cannot be empty');
53
+ }
54
+ // Validate options - focus on basic validation only since the scaling system handles large values
55
+ if (options) {
56
+ if (options.offsetX !== undefined) {
57
+ if (typeof options.offsetX !== 'number' || !Number.isFinite(options.offsetX)) {
58
+ throw new Error(`offsetX must be a finite number, got: ${options.offsetX}`);
59
+ }
60
+ }
61
+ if (options.offsetY !== undefined) {
62
+ if (typeof options.offsetY !== 'number' || !Number.isFinite(options.offsetY)) {
63
+ throw new Error(`offsetY must be a finite number, got: ${options.offsetY}`);
64
+ }
65
+ }
66
+ if (options.width !== undefined) {
67
+ if (typeof options.width !== 'number' || !Number.isFinite(options.width) || options.width <= 0) {
68
+ throw new Error(`width must be a positive finite number, got: ${options.width}`);
69
+ }
70
+ }
71
+ if (options.height !== undefined) {
72
+ if (typeof options.height !== 'number' || !Number.isFinite(options.height) || options.height <= 0) {
73
+ throw new Error(`height must be a positive finite number, got: ${options.height}`);
74
+ }
75
+ }
76
+ if (options.scale !== undefined) {
77
+ if (typeof options.scale !== 'number' || !Number.isFinite(options.scale) || options.scale <= 0) {
78
+ throw new Error(`scale must be a positive finite number, got: ${options.scale}`);
79
+ }
80
+ }
81
+ if (options.zoom !== undefined) {
82
+ if (typeof options.zoom !== 'number' || !Number.isFinite(options.zoom) || options.zoom <= 0) {
83
+ throw new Error(`zoom must be a positive finite number, got: ${options.zoom}`);
84
+ }
85
+ }
86
+ if (options.backgroundColor !== undefined) {
87
+ if (typeof options.backgroundColor !== 'string' || options.backgroundColor.trim() === '') {
88
+ throw new Error(`backgroundColor must be a non-empty string, got: ${options.backgroundColor}`);
89
+ }
90
+ }
91
+ }
92
+ }
93
+ export async function convertDucToPdf(ducData, options, debugMode = false) {
94
+ try {
95
+ // Validate inputs
96
+ validateInput(ducData, options);
97
+ // Debug logging if enabled
98
+ if (debugMode) {
99
+ debugConversionState(ducData, options);
100
+ }
101
+ // Initialize WASM module
102
+ const wasm = await initWasm();
103
+ let ducBytes = new Uint8Array(ducData);
104
+ let viewBackgroundColor;
105
+ try {
106
+ const latestBlob = new Blob([ducBytes]);
107
+ const parsed = await parseDuc(latestBlob);
108
+ if (parsed) {
109
+ // Extract scope from parsed data - use localState.scope first, fallback to globalState.mainScope
110
+ const scope = parsed?.localState?.scope || parsed?.globalState?.mainScope || 'mm';
111
+ // ensure that we are only working with mm on the pdf conversion logic
112
+ const normalized = traverseAndUpdatePrecisionValues(parsed, 'mm', scope);
113
+ normalized.localState.scope = 'mm';
114
+ normalized.globalState.mainScope = 'mm';
115
+ // Apply zoom preference if provided
116
+ const rawZoom = options?.zoom;
117
+ const localState = normalized.localState;
118
+ if (rawZoom !== undefined) {
119
+ const normalizedZoomValue = getNormalizedZoom(rawZoom);
120
+ const exportZoom = normalizedZoomValue;
121
+ localState.zoom = {
122
+ value: exportZoom,
123
+ scoped: exportZoom,
124
+ scaled: exportZoom,
125
+ };
126
+ }
127
+ else if (!normalized.localState?.zoom) {
128
+ const normalizedZoomValue = getNormalizedZoom(1);
129
+ localState.zoom = {
130
+ value: normalizedZoomValue,
131
+ scoped: normalizedZoomValue,
132
+ scaled: normalizedZoomValue,
133
+ };
134
+ }
135
+ // Process elements before serialization
136
+ let normalizedElements = normalized.elements || [];
137
+ normalizedElements = normalizedElements.map(element => {
138
+ if (element && isFreeDrawElement(element)) {
139
+ const svgPath = getFreeDrawSvgPath(element);
140
+ if (svgPath) {
141
+ return Object.assign({}, element, { svgPath });
142
+ }
143
+ }
144
+ return element;
145
+ });
146
+ normalized.elements = normalizedElements;
147
+ viewBackgroundColor = normalized.globalState.viewBackgroundColor;
148
+ // Re-serialize the DUC with normalized values and scope set to 'mm'
149
+ const serialized = await serializeDuc(normalized, true, // use scoped values
150
+ undefined, {
151
+ forceScope: 'mm'
152
+ });
153
+ if (serialized && serialized.length > 0) {
154
+ ducBytes = new Uint8Array(serialized);
155
+ }
156
+ else {
157
+ console.warn('serializeDuc returned empty; falling back to original DUC bytes');
158
+ }
159
+ }
160
+ else {
161
+ console.warn('parseDuc returned null/undefined; falling back to original DUC bytes');
162
+ }
163
+ }
164
+ catch (e) {
165
+ console.warn('DUC parse/serialize normalization failed; using original bytes. Reason:', e);
166
+ }
167
+ // Call the appropriate WASM function based on options
168
+ let result;
169
+ if (options && (options.offsetX !== undefined || options.offsetY !== undefined)) {
170
+ // Use crop mode with offset
171
+ const offsetX = options.offsetX || 0;
172
+ const offsetY = options.offsetY || 0;
173
+ const backgroundColor = options.backgroundColor ? options.backgroundColor.trim() : viewBackgroundColor;
174
+ const widthOption = typeof options.width === 'number' ? options.width : undefined;
175
+ const heightOption = typeof options.height === 'number' ? options.height : undefined;
176
+ const backgroundOption = backgroundColor === undefined ? undefined : backgroundColor;
177
+ result = wasm.convert_duc_to_pdf_crop_wasm(ducBytes, offsetX, offsetY, widthOption, heightOption, backgroundOption);
178
+ }
179
+ else {
180
+ // Standard conversion
181
+ result = wasm.convert_duc_to_pdf_rs(ducBytes);
182
+ }
183
+ // Check if conversion was successful
184
+ if (!result || result.length === 0) {
185
+ throw new Error('PDF conversion failed - empty result');
186
+ }
187
+ // Check if the result contains an error message from WASM
188
+ if (result.length >= 6) {
189
+ const prefixBytes = result.slice(0, 6);
190
+ const prefixStr = String.fromCharCode(...prefixBytes);
191
+ if (prefixStr === 'ERROR:') {
192
+ // Extract and parse the error information
193
+ const errorBytes = result.slice(6);
194
+ let errorJson;
195
+ try {
196
+ errorJson = JSON.parse(new TextDecoder().decode(errorBytes));
197
+ }
198
+ catch (parseError) {
199
+ // Fallback if JSON parsing fails
200
+ const errorText = new TextDecoder().decode(errorBytes);
201
+ throw new Error(`PDF conversion failed: ${errorText}`);
202
+ }
203
+ // Handle the new structured error format
204
+ if (errorJson.error_type === 'ValidationError') {
205
+ console.error('=== DUC to PDF Validation Error ===');
206
+ console.error('Validation Error:', errorJson.error);
207
+ console.error('Details:', errorJson.details);
208
+ throw new Error(`PDF conversion failed: ${errorJson.details}`);
209
+ }
210
+ // Handle structured conversion errors
211
+ const detailedError = `PDF conversion failed: ${errorJson.details || errorJson.error}`;
212
+ console.error('=== DUC to PDF Conversion Error Details ===');
213
+ console.error('Error Type:', errorJson.error_type);
214
+ console.error('Error Message:', errorJson.error);
215
+ console.error('Details:', errorJson.details);
216
+ console.error('DUC Data Length:', `${errorJson.duc_data_length} bytes`);
217
+ // Log conversion context if available
218
+ if (errorJson.conversion_context) {
219
+ console.error('Conversion Context:', errorJson.conversion_context);
220
+ }
221
+ // Log conversion options for debugging
222
+ console.error('Conversion Options:', JSON.stringify(options, null, 2));
223
+ // Special handling for scaling-related errors
224
+ if (errorJson.details.includes('automatic scaling') || errorJson.details.includes('scaling logic')) {
225
+ console.error('⚠️ Scaling System Alert: This error indicates the automatic scaling system failed.');
226
+ console.error(' Please investigate the scaling logic in the Rust code:');
227
+ console.error(' - calculate_required_scale() function');
228
+ console.error(' - validate_all_coordinates_with_scale() function');
229
+ console.error(' - DucDataScaler scaling application');
230
+ }
231
+ throw new Error(detailedError);
232
+ }
233
+ }
234
+ return result;
235
+ }
236
+ catch (error) {
237
+ console.error('DUC to PDF conversion error:', error);
238
+ if (error instanceof Error) {
239
+ // Re-throw validation errors as-is
240
+ if (error.message.includes('required') || error.message.includes('must be')) {
241
+ throw error;
242
+ }
243
+ throw new Error(`Failed to convert DUC to PDF: ${error.message}`);
244
+ }
245
+ throw new Error('Failed to convert DUC to PDF: Unknown error');
246
+ }
247
+ }
248
+ export async function convertDucToPdfCrop(ducData, offsetX, offsetY, width, height) {
249
+ return convertDucToPdf(ducData, { offsetX, offsetY, width, height });
250
+ }
251
+ // Utility functions
252
+ export function isWasmInitialized() {
253
+ return wasmModule !== null;
254
+ }
255
+ export async function getWasmStatus() {
256
+ try {
257
+ const wasm = await initWasm();
258
+ return {
259
+ initialized: true,
260
+ moduleAvailable: true,
261
+ functions: Object.keys(wasm).filter(key => typeof wasm[key] === 'function')
262
+ };
263
+ }
264
+ catch (error) {
265
+ return {
266
+ initialized: false,
267
+ moduleAvailable: false,
268
+ functions: []
269
+ };
270
+ }
271
+ }
272
+ // Reset WASM module (useful for testing or error recovery)
273
+ export function resetWasmModule() {
274
+ wasmModule = null;
275
+ wasmInitPromise = null;
276
+ }
277
+ // Debug function to analyze DUC data before conversion
278
+ export function analyzeDucData(ducData) {
279
+ const issues = [];
280
+ let headerInfo = 'Unknown';
281
+ try {
282
+ // Basic size check
283
+ if (ducData.length === 0) {
284
+ issues.push('DUC data is empty');
285
+ return {
286
+ size: 0,
287
+ headerInfo: 'Empty',
288
+ estimatedElements: 0,
289
+ potentialIssues: issues
290
+ };
291
+ }
292
+ if (ducData.length < 100) {
293
+ issues.push(`DUC data is very small (${ducData.length} bytes), may be truncated`);
294
+ }
295
+ if (ducData.length > 50 * 1024 * 1024) { // 50MB
296
+ issues.push(`DUC data is very large (${(ducData.length / 1024 / 1024).toFixed(2)}MB), may cause memory issues`);
297
+ }
298
+ // Try to extract basic info from the binary data
299
+ const textDecoder = new TextDecoder('utf-8', { fatal: false });
300
+ const preview = textDecoder.decode(ducData.slice(0, Math.min(200, ducData.length)));
301
+ // Look for common DUC patterns
302
+ if (preview.includes('duc')) {
303
+ headerInfo = 'DUC format detected';
304
+ }
305
+ else if (preview.includes('{') || preview.includes('[')) {
306
+ headerInfo = 'JSON-like structure detected';
307
+ }
308
+ else {
309
+ headerInfo = 'Binary format';
310
+ }
311
+ // Estimate number of elements (rough heuristic)
312
+ let elementCount = 0;
313
+ const elementMatches = preview.match(/element/gi);
314
+ if (elementMatches) {
315
+ elementCount = elementMatches.length;
316
+ }
317
+ return {
318
+ size: ducData.length,
319
+ headerInfo,
320
+ estimatedElements: elementCount,
321
+ potentialIssues: issues
322
+ };
323
+ }
324
+ catch (error) {
325
+ issues.push(`Error analyzing DUC data: ${error}`);
326
+ return {
327
+ size: ducData.length,
328
+ headerInfo: 'Error analyzing',
329
+ estimatedElements: 0,
330
+ potentialIssues: issues
331
+ };
332
+ }
333
+ }
334
+ // Debug function to log conversion state
335
+ export function debugConversionState(ducData, options) {
336
+ console.group('🔍 DUC to PDF Conversion Debug Info');
337
+ const analysis = analyzeDucData(ducData);
338
+ console.log('📄 DUC Data Analysis:', analysis);
339
+ if (options) {
340
+ console.log('⚙️ Conversion Options:', {
341
+ offsetX: options.offsetX,
342
+ offsetY: options.offsetY,
343
+ width: options.width,
344
+ height: options.height,
345
+ scale: options.scale,
346
+ zoom: options.zoom,
347
+ hasMetadata: !!(options.metadata?.title || options.metadata?.author || options.metadata?.subject)
348
+ });
349
+ }
350
+ else {
351
+ console.log('⚙️ Conversion Options: (default/none)');
352
+ }
353
+ console.log('🌐 WASM Status:', {
354
+ initialized: isWasmInitialized(),
355
+ // Note: We can't easily check the detailed status without async
356
+ });
357
+ console.groupEnd();
358
+ }
359
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/duc2pdf/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,kBAAkB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,gCAAgC,EAAE,MAAM,OAAO,CAAC;AAE9J,IAAI,UAAU,GAAQ,IAAI,CAAC;AAC3B,IAAI,eAAe,GAAwB,IAAI,CAAC;AAEhD,KAAK,UAAU,QAAQ;IACrB,IAAI,UAAU;QAAE,OAAO,UAAU,CAAC;IAElC,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,eAA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AC,MAAM;YACtB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,WAAW,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,IAAI,OAAO,CAAC,QAAQ,EAAE,MAAM,IAAI,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC;SAClG,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;QAC7B,WAAW,EAAE,iBAAiB,EAAE;QAChC,gEAAgE;KACjE,CAAC,CAAC;IAEH,OAAO,CAAC,QAAQ,EAAE,CAAC;AACrB,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ module.exports = {
3
+ branches: ["main", { name: "next", prerelease: true }],
4
+ plugins: [
5
+ "@semantic-release/commit-analyzer",
6
+ "@semantic-release/release-notes-generator",
7
+ [
8
+ "@semantic-release/github",
9
+ {
10
+ assets: [
11
+ { path: "dist/**/*", label: "Distribution files" },
12
+ ]
13
+ }
14
+ ],
15
+ [
16
+ "@semantic-release/exec",
17
+ {
18
+ // Prepare step: Set the crate version and build the project
19
+ prepareCmd: "cargo set-version -p duc2pdf ${nextRelease.version} && cargo build -p duc2pdf --release",
20
+ // Publish step: Publish the crate to crates.io
21
+ publishCmd: "cargo publish -p duc2pdf --allow-dirty --token ${process.env.CARGO_REGISTRY_TOKEN}",
22
+ }
23
+ ],
24
+ ],
25
+ };
26
+ //# sourceMappingURL=release.config.cjs.map
@@ -0,0 +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,CAAC;IACtD,OAAO,EAAE;QACP,mCAAmC;QACnC,2CAA2C;QAC3C;YACE,0BAA0B;YAC1B;gBACE,MAAM,EAAE;oBACN,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,oBAAoB,EAAE;iBACnD;aACF;SACF;QACD;YACE,wBAAwB;YACxB;gBACE,4DAA4D;gBAC5D,UAAU,EAAE,yFAAyF;gBACrG,+CAA+C;gBAC/C,UAAU,EAAE,oFAAoF;aACjG;SACF;KACF;CACF,CAAC"}
@@ -0,0 +1,14 @@
1
+ export let branches: (string | {
2
+ name: string;
3
+ prerelease: boolean;
4
+ })[];
5
+ export let plugins: (string | (string | {
6
+ assets: {
7
+ path: string;
8
+ label: string;
9
+ }[];
10
+ })[] | (string | {
11
+ prepareCmd: string;
12
+ publishCmd: string;
13
+ })[])[];
14
+ //# sourceMappingURL=release.config.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release.config.d.cts","sourceRoot":"","sources":["../../src/duc2pdf/release.config.cjs"],"names":[],"mappings":""}
@@ -0,0 +1,46 @@
1
+ /* tslint:disable */
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
+ /**
8
+ * WASM binding for crop conversion
9
+ */
10
+ 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;
11
+
12
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
13
+
14
+ export interface InitOutput {
15
+ readonly memory: WebAssembly.Memory;
16
+ readonly convert_duc_to_pdf_rs: (a: number, b: number) => [number, number];
17
+ 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];
18
+ readonly __wbindgen_exn_store: (a: number) => void;
19
+ readonly __externref_table_alloc: () => number;
20
+ readonly __wbindgen_export_2: WebAssembly.Table;
21
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
22
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
23
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
24
+ readonly __wbindgen_start: () => void;
25
+ }
26
+
27
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
28
+ /**
29
+ * Instantiates the given `module`, which can either be bytes or
30
+ * a precompiled `WebAssembly.Module`.
31
+ *
32
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
33
+ *
34
+ * @returns {InitOutput}
35
+ */
36
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
37
+
38
+ /**
39
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
40
+ * for everything else, calls `WebAssembly.instantiate` directly.
41
+ *
42
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
43
+ *
44
+ * @returns {Promise<InitOutput>}
45
+ */
46
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -0,0 +1,316 @@
1
+ let wasm;
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
+ function getArrayU8FromWasm0(ptr, len) {
13
+ ptr = ptr >>> 0;
14
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
15
+ }
16
+
17
+ function addToExternrefTable0(obj) {
18
+ const idx = wasm.__externref_table_alloc();
19
+ wasm.__wbindgen_export_2.set(idx, obj);
20
+ return idx;
21
+ }
22
+
23
+ function handleError(f, args) {
24
+ try {
25
+ return f.apply(this, args);
26
+ } catch (e) {
27
+ const idx = addToExternrefTable0(e);
28
+ wasm.__wbindgen_exn_store(idx);
29
+ }
30
+ }
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
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
49
+
50
+ cachedTextDecoder.decode();
51
+
52
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
53
+ let numBytesDecoded = 0;
54
+ function decodeText(ptr, len) {
55
+ numBytesDecoded += len;
56
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
57
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
58
+ cachedTextDecoder.decode();
59
+ numBytesDecoded = len;
60
+ }
61
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
62
+ }
63
+
64
+ function getStringFromWasm0(ptr, len) {
65
+ ptr = ptr >>> 0;
66
+ return decodeText(ptr, len);
67
+ }
68
+
69
+ let WASM_VECTOR_LEN = 0;
70
+
71
+ function passArray8ToWasm0(arg, malloc) {
72
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
73
+ getUint8ArrayMemory0().set(arg, ptr / 1);
74
+ WASM_VECTOR_LEN = arg.length;
75
+ return ptr;
76
+ }
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
+
91
+ function isLikeNone(x) {
92
+ return x === undefined || x === null;
93
+ }
94
+
95
+ function _assertNum(n) {
96
+ if (typeof(n) !== 'number') throw new Error(`expected a number argument, found ${typeof(n)}`);
97
+ }
98
+
99
+ const cachedTextEncoder = new TextEncoder();
100
+
101
+ if (!('encodeInto' in cachedTextEncoder)) {
102
+ cachedTextEncoder.encodeInto = function (arg, view) {
103
+ const buf = cachedTextEncoder.encode(arg);
104
+ view.set(buf);
105
+ return {
106
+ read: arg.length,
107
+ written: buf.length
108
+ };
109
+ }
110
+ }
111
+
112
+ function passStringToWasm0(arg, malloc, realloc) {
113
+
114
+ if (typeof(arg) !== 'string') throw new Error(`expected a string argument, found ${typeof(arg)}`);
115
+
116
+ if (realloc === undefined) {
117
+ const buf = cachedTextEncoder.encode(arg);
118
+ const ptr = malloc(buf.length, 1) >>> 0;
119
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
120
+ WASM_VECTOR_LEN = buf.length;
121
+ return ptr;
122
+ }
123
+
124
+ let len = arg.length;
125
+ let ptr = malloc(len, 1) >>> 0;
126
+
127
+ const mem = getUint8ArrayMemory0();
128
+
129
+ let offset = 0;
130
+
131
+ for (; offset < len; offset++) {
132
+ const code = arg.charCodeAt(offset);
133
+ if (code > 0x7F) break;
134
+ mem[ptr + offset] = code;
135
+ }
136
+
137
+ if (offset !== len) {
138
+ if (offset !== 0) {
139
+ arg = arg.slice(offset);
140
+ }
141
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
142
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
143
+ const ret = cachedTextEncoder.encodeInto(arg, view);
144
+ if (ret.read !== arg.length) throw new Error('failed to pass whole string');
145
+ offset += ret.written;
146
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
147
+ }
148
+
149
+ WASM_VECTOR_LEN = offset;
150
+ return ptr;
151
+ }
152
+ /**
153
+ * WASM binding for crop conversion
154
+ * @param {Uint8Array} duc_data
155
+ * @param {number} offset_x
156
+ * @param {number} offset_y
157
+ * @param {number | null} [width]
158
+ * @param {number | null} [height]
159
+ * @param {string | null} [background_color]
160
+ * @returns {Uint8Array}
161
+ */
162
+ export function convert_duc_to_pdf_crop_wasm(duc_data, offset_x, offset_y, width, height, background_color) {
163
+ const ptr0 = passArray8ToWasm0(duc_data, wasm.__wbindgen_malloc);
164
+ const len0 = WASM_VECTOR_LEN;
165
+ if (!isLikeNone(width)) {
166
+ _assertNum(width);
167
+ }
168
+ if (!isLikeNone(height)) {
169
+ _assertNum(height);
170
+ }
171
+ var ptr1 = isLikeNone(background_color) ? 0 : passStringToWasm0(background_color, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
172
+ var len1 = WASM_VECTOR_LEN;
173
+ 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);
174
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
175
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
176
+ return v3;
177
+ }
178
+
179
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
180
+
181
+ async function __wbg_load(module, imports) {
182
+ if (typeof Response === 'function' && module instanceof Response) {
183
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
184
+ try {
185
+ return await WebAssembly.instantiateStreaming(module, imports);
186
+
187
+ } catch (e) {
188
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
189
+
190
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
191
+ 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);
192
+
193
+ } else {
194
+ throw e;
195
+ }
196
+ }
197
+ }
198
+
199
+ const bytes = await module.arrayBuffer();
200
+ return await WebAssembly.instantiate(bytes, imports);
201
+
202
+ } else {
203
+ const instance = await WebAssembly.instantiate(module, imports);
204
+
205
+ if (instance instanceof WebAssembly.Instance) {
206
+ return { instance, module };
207
+
208
+ } else {
209
+ return instance;
210
+ }
211
+ }
212
+ }
213
+
214
+ function __wbg_get_imports() {
215
+ const imports = {};
216
+ imports.wbg = {};
217
+ imports.wbg.__wbg_getRandomValues_1c61fac11405ffdc = function() { return handleError(function (arg0, arg1) {
218
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
219
+ }, arguments) };
220
+ imports.wbg.__wbg_log_6c7b5f4f00b8ce3f = function() { return logError(function (arg0) {
221
+ console.log(arg0);
222
+ }, arguments) };
223
+ imports.wbg.__wbg_warn_e2ada06313f92f09 = function() { return logError(function (arg0) {
224
+ console.warn(arg0);
225
+ }, arguments) };
226
+ imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
227
+ throw new Error(getStringFromWasm0(arg0, arg1));
228
+ };
229
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function() { return logError(function (arg0, arg1) {
230
+ // Cast intrinsic for `Ref(String) -> Externref`.
231
+ const ret = getStringFromWasm0(arg0, arg1);
232
+ return ret;
233
+ }, arguments) };
234
+ imports.wbg.__wbindgen_init_externref_table = function() {
235
+ const table = wasm.__wbindgen_export_2;
236
+ const offset = table.grow(4);
237
+ table.set(0, undefined);
238
+ table.set(offset + 0, undefined);
239
+ table.set(offset + 1, null);
240
+ table.set(offset + 2, true);
241
+ table.set(offset + 3, false);
242
+ ;
243
+ };
244
+
245
+ return imports;
246
+ }
247
+
248
+ function __wbg_init_memory(imports, memory) {
249
+
250
+ }
251
+
252
+ function __wbg_finalize_init(instance, module) {
253
+ wasm = instance.exports;
254
+ __wbg_init.__wbindgen_wasm_module = module;
255
+ cachedUint8ArrayMemory0 = null;
256
+
257
+
258
+ wasm.__wbindgen_start();
259
+ return wasm;
260
+ }
261
+
262
+ function initSync(module) {
263
+ if (wasm !== undefined) return wasm;
264
+
265
+
266
+ if (typeof module !== 'undefined') {
267
+ if (Object.getPrototypeOf(module) === Object.prototype) {
268
+ ({module} = module)
269
+ } else {
270
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
271
+ }
272
+ }
273
+
274
+ const imports = __wbg_get_imports();
275
+
276
+ __wbg_init_memory(imports);
277
+
278
+ if (!(module instanceof WebAssembly.Module)) {
279
+ module = new WebAssembly.Module(module);
280
+ }
281
+
282
+ const instance = new WebAssembly.Instance(module, imports);
283
+
284
+ return __wbg_finalize_init(instance, module);
285
+ }
286
+
287
+ async function __wbg_init(module_or_path) {
288
+ if (wasm !== undefined) return wasm;
289
+
290
+
291
+ if (typeof module_or_path !== 'undefined') {
292
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
293
+ ({module_or_path} = module_or_path)
294
+ } else {
295
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
296
+ }
297
+ }
298
+
299
+ if (typeof module_or_path === 'undefined') {
300
+ module_or_path = new URL('duc2pdf_bg.wasm', import.meta.url);
301
+ }
302
+ const imports = __wbg_get_imports();
303
+
304
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
305
+ module_or_path = fetch(module_or_path);
306
+ }
307
+
308
+ __wbg_init_memory(imports);
309
+
310
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
311
+
312
+ return __wbg_finalize_init(instance, module);
313
+ }
314
+
315
+ export { initSync };
316
+ export default __wbg_init;
Binary file
@@ -0,0 +1,12 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const convert_duc_to_pdf_rs: (a: number, b: number) => [number, number];
5
+ 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];
6
+ export const __wbindgen_exn_store: (a: number) => void;
7
+ export const __externref_table_alloc: () => number;
8
+ export const __wbindgen_export_2: WebAssembly.Table;
9
+ export const __wbindgen_malloc: (a: number, b: number) => number;
10
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
11
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
12
+ export const __wbindgen_start: () => void;
@@ -0,0 +1,3 @@
1
+ export * from './pdf2duc/index.js';
2
+ export * from './duc2pdf/index.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './pdf2duc/index.js';
2
+ export * from './duc2pdf/index.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function convertPdfToDuc(pdfData: Uint8Array): Uint8Array;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pdf2duc/index.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU,CAI/D"}
@@ -0,0 +1,7 @@
1
+ // import * as pdfjs from 'pdfjs-dist';
2
+ export function convertPdfToDuc(pdfData) {
3
+ console.log('Converting PDF to DUC...');
4
+ // TODO: Implement conversion logic using pdf.js
5
+ return new Uint8Array();
6
+ }
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pdf2duc/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AAEvC,MAAM,UAAU,eAAe,CAAC,OAAmB;IAC/C,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IACxC,gDAAgD;IAChD,OAAO,IAAI,UAAU,EAAE,CAAC;AAC5B,CAAC"}
package/dist/wasm.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from '../dist/duc2pdf';
2
+ export { default } from '../dist/duc2pdf';
3
+ //# sourceMappingURL=wasm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/wasm.js ADDED
@@ -0,0 +1,4 @@
1
+ // Re-export WASM bindings from dist for bundled distribution
2
+ export * from '../dist/duc2pdf';
3
+ export { default } from '../dist/duc2pdf';
4
+ //# sourceMappingURL=wasm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm.js","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "ducpdf",
3
+ "version": "0.0.0-development",
4
+ "description": "Library for converting between PDF and DUC formats.",
5
+ "private": false,
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "module": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./pkg": {
17
+ "types": "./pkg/duc2pdf.d.ts",
18
+ "import": "./pkg/duc2pdf.js",
19
+ "default": "./pkg/duc2pdf.js"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/ducflair/duc.git",
31
+ "directory": "packages/ducpdf"
32
+ },
33
+ "author": "Ducflair",
34
+ "license": "MIT",
35
+ "homepage": "https://duc.ducflair.com/",
36
+ "bugs": {
37
+ "url": "https://github.com/ducflair/duc/issues"
38
+ },
39
+ "scripts": {
40
+ "build": "bun run clean && bun run build:wasm && bun run copy:wasm-to-dist && bun run build:ts",
41
+ "build:ts": "tsc -p tsconfig.json",
42
+ "build:rs": "cd src/duc2pdf && cargo build",
43
+ "build:wasm": "cd src/duc2pdf && wasm-pack build --target web --out-dir ../../pkg --dev",
44
+ "build:wasm:prod": "cd src/duc2pdf && wasm-pack build --target web --out-dir ../../pkg --release",
45
+ "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
+ "clean": "rm -rf dist pkg && cd src/duc2pdf && cargo clean",
47
+ "test": "bun run build:wasm && bun test",
48
+ "test:rs": "cd src/duc2pdf && cargo test",
49
+ "test:duc2pdf": "cd src/duc2pdf && cargo test"
50
+ },
51
+ "dependencies": {
52
+ "ducjs": "^2.1.0"
53
+ },
54
+ "devDependencies": {
55
+ "typescript": "^5.4.5",
56
+ "wasm-pack": "^0.12.1",
57
+ "@types/node": "^20.12.2"
58
+ }
59
+ }