unpdf 1.0.1 → 1.0.2
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/README.md +2 -2
- package/dist/index.cjs +3 -6
- package/dist/index.mjs +3 -6
- package/dist/pdfjs.d.mts +0 -3
- package/dist/pdfjs.d.ts +0 -3
- package/dist/pdfjs.mjs +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# unpdf
|
|
2
2
|
|
|
3
|
-
A collection of utilities for
|
|
3
|
+
A collection of utilities for PDF extraction and rendering. Designed specifically for Bun, Deno, and serverless environments. However, it also works in Node.js and the browser.
|
|
4
4
|
|
|
5
|
-
`unpdf` ships with a serverless build/redistribution of Mozilla's [PDF.js](https://github.com/mozilla/pdf.js) for serverless environments.
|
|
5
|
+
`unpdf` ships with a serverless build/redistribution of Mozilla's [PDF.js](https://github.com/mozilla/pdf.js) for serverless environments. Some string replacements and inlining the PDF.js worker allow the browser code to become platform agnostic. See [`pdfjs.rollup.config.ts`](./pdfjs.rollup.config.ts) for all the details.
|
|
6
6
|
|
|
7
7
|
This library is also intended as a modern alternative to the unmaintained but still popular [`pdf-parse`](https://www.npmjs.com/package/pdf-parse).
|
|
8
8
|
|
package/dist/index.cjs
CHANGED
|
@@ -29,16 +29,13 @@ async function resolvePDFJSImport(pdfjsResolver, { reload = false } = {}) {
|
|
|
29
29
|
resolvedModule = await interopDefault(pdfjsResolver());
|
|
30
30
|
return;
|
|
31
31
|
} catch (error) {
|
|
32
|
-
|
|
33
|
-
throw new Error("PDF.js could not be resolved. Please check the resolver function.");
|
|
32
|
+
throw new Error(`PDF.js could not be resolved: ${error}`);
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
try {
|
|
37
|
-
|
|
38
|
-
resolvedModule = await resolvePDFJS();
|
|
36
|
+
resolvedModule = await import('unpdf/pdfjs');
|
|
39
37
|
} catch (error) {
|
|
40
|
-
|
|
41
|
-
throw new Error("PDF.js package not available. Please install it first.");
|
|
38
|
+
throw new Error(`Built-in PDF.js module could not be resolved: ${error}`);
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
41
|
function isPDFDocumentProxy(data) {
|
package/dist/index.mjs
CHANGED
|
@@ -27,16 +27,13 @@ async function resolvePDFJSImport(pdfjsResolver, { reload = false } = {}) {
|
|
|
27
27
|
resolvedModule = await interopDefault(pdfjsResolver());
|
|
28
28
|
return;
|
|
29
29
|
} catch (error) {
|
|
30
|
-
|
|
31
|
-
throw new Error("PDF.js could not be resolved. Please check the resolver function.");
|
|
30
|
+
throw new Error(`PDF.js could not be resolved: ${error}`);
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
33
|
try {
|
|
35
|
-
|
|
36
|
-
resolvedModule = await resolvePDFJS();
|
|
34
|
+
resolvedModule = await import('unpdf/pdfjs');
|
|
37
35
|
} catch (error) {
|
|
38
|
-
|
|
39
|
-
throw new Error("PDF.js package not available. Please install it first.");
|
|
36
|
+
throw new Error(`Built-in PDF.js module could not be resolved: ${error}`);
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
39
|
function isPDFDocumentProxy(data) {
|
package/dist/pdfjs.d.mts
CHANGED
package/dist/pdfjs.d.ts
CHANGED