pdfium-native 0.5.5 → 0.6.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/CHANGELOG.md +60 -17
- package/README.md +4 -3
- package/THIRD-PARTY-NOTICES.md +47 -0
- package/binding.gyp +7 -4
- package/dist/concurrency.js +1 -1
- package/dist/concurrency.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +2 -1
- package/dist/page.js.map +1 -1
- package/lib/index.ts +3 -1
- package/lib/page.ts +4 -3
- package/package.json +15 -8
- package/scripts/download-pdfium.mjs +19 -43
- package/scripts/install.mjs +5 -4
- package/scripts/lib/integrity.mjs +106 -0
- package/scripts/native-deps.json +50 -0
- package/scripts/verify-checksums.mjs +58 -0
- package/src/pdfium_addon.cc +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,44 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.6.0] - 2026-06-27
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `.nvmrc` and a `packageManager` field to pin the development toolchain
|
|
14
|
+
- `.editorconfig` for consistent cross-editor defaults
|
|
15
|
+
- Vitest v8 coverage reporting (`npm run test:coverage`)
|
|
16
|
+
- `typecheck` step wired into CI (`npm run typecheck`) for type-level regression coverage
|
|
17
|
+
- Weekly `windows-latest` canary workflow to detect drift from the pinned `windows-2022` runner
|
|
18
|
+
- `"./package.json"` to the package `exports` map
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Raised the minimum supported Node.js to `>=22.0.0` (dropped EOL Node 20)
|
|
23
|
+
- TypeScript config: `nodenext` module resolution, `es2023` target, and stricter flags (`verbatimModuleSyntax`, `exactOptionalPropertyTypes`, `noUnusedLocals`, `noUnusedParameters`, `noImplicitOverride`, `noFallthroughCasesInSwitch`)
|
|
24
|
+
- ESLint: type-aware linting for `lib/`, adopted the `globals` package, and dropped `eslint-plugin-prettier`
|
|
25
|
+
- Native build: bumped the C++ standard to C++20 and Node-API to 9 (C++ standard now defined once via a gyp variable)
|
|
26
|
+
- CI/CD hardening: pinned all GitHub Actions to commit SHAs, added npm and native-dependency caching, a concurrency group, job timeouts, and top-level least-privilege permissions
|
|
27
|
+
|
|
28
|
+
### Security
|
|
29
|
+
|
|
30
|
+
- Added OpenSSF Scorecard analysis, Dependabot, and a security policy (`SECURITY.md`); CodeQL code scanning runs via GitHub's default setup
|
|
31
|
+
- Supply chain: pin and verify the SHA-256 of every downloaded native dependency (`scripts/native-deps.json`) through a hardened downloader (timeout, retry, atomic writes, origin pinning); added an `npm run verify:checksums` tripwire
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- Windows build: upgraded `node-gyp` to 13 and dropped Node 20 from the CI matrix
|
|
36
|
+
- Pinned Windows CI to `windows-2022` to avoid a VS 2026 (MSVC C1001) internal compiler error
|
|
37
|
+
|
|
38
|
+
## [0.5.6] - 2026-06-26
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- Fix double free of addon instance data on environment teardown
|
|
43
|
+
- `npm audit` fix for transitive dev dependencies
|
|
44
|
+
|
|
7
45
|
## [0.5.5] - 2026-04-26
|
|
8
46
|
|
|
9
47
|
### Changed
|
|
@@ -80,23 +118,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
|
|
|
80
118
|
- Image `render()` binding moved from TypeScript layer to native C++ (`GetObjectWorker::OnOK`) for cleaner API
|
|
81
119
|
- `PDFiumPage.getObject()` is now a direct passthrough to the native addon
|
|
82
120
|
|
|
83
|
-
## [0.3.0] - 2026-03-31
|
|
84
|
-
|
|
85
|
-
### Added
|
|
86
|
-
|
|
87
|
-
- `ImagePageObject.render()` — extract and render embedded PDF images as PNG, JPEG, or raw stream bytes
|
|
88
|
-
- Three render modes: intrinsic bitmap, rendered bitmap (with mask/matrix), and raw encoded stream
|
|
89
|
-
- File output support for image rendering via `output` option
|
|
90
|
-
- `objects()` async generator on `PDFiumPage` for iterating all page objects
|
|
91
|
-
- Image dimension cap (`MAX_IMAGE_PIXELS = 256 MP`) to prevent allocation failures on huge embedded images
|
|
92
|
-
- Negative object index guard in `RenderImageWorker`
|
|
93
|
-
|
|
94
|
-
### Changed
|
|
95
|
-
|
|
96
|
-
- **Breaking:** Default render format changed from JPEG to PNG for both `page.render()` and `image.render()` — use `{ format: 'jpeg' }` to restore previous behavior
|
|
97
|
-
- Image `render()` binding moved from TypeScript layer to native C++ (`GetObjectWorker::OnOK`) for cleaner API
|
|
98
|
-
- `PDFiumPage.getObject()` is now a direct passthrough to the native addon
|
|
99
|
-
|
|
100
121
|
## [0.2.4] - 2026-03-30
|
|
101
122
|
|
|
102
123
|
### Fixed
|
|
@@ -250,3 +271,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
|
|
|
250
271
|
- ESLint + Prettier configuration
|
|
251
272
|
- GitHub Actions publish workflow with test gate
|
|
252
273
|
- TypeScript type declarations for JS consumers
|
|
274
|
+
|
|
275
|
+
[Unreleased]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.6.0...HEAD
|
|
276
|
+
[0.6.0]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.5.6...v0.6.0
|
|
277
|
+
[0.5.6]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.5.5...v0.5.6
|
|
278
|
+
[0.5.5]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.5.4...v0.5.5
|
|
279
|
+
[0.5.4]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.5.3...v0.5.4
|
|
280
|
+
[0.5.3]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.5.2...v0.5.3
|
|
281
|
+
[0.5.2]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.5.1...v0.5.2
|
|
282
|
+
[0.5.1]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.5.0...v0.5.1
|
|
283
|
+
[0.5.0]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.4.0...v0.5.0
|
|
284
|
+
[0.4.0]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.3.0...v0.4.0
|
|
285
|
+
[0.3.0]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.2.4...v0.3.0
|
|
286
|
+
[0.2.4]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.2.3...v0.2.4
|
|
287
|
+
[0.2.3]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.2.2...v0.2.3
|
|
288
|
+
[0.2.2]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.2.0...v0.2.2
|
|
289
|
+
[0.2.0]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.1.7...v0.2.0
|
|
290
|
+
[0.1.7]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.1.6...v0.1.7
|
|
291
|
+
[0.1.6]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.1.5...v0.1.6
|
|
292
|
+
[0.1.5]: https://github.com/xonaman/nodejs-pdfium-native/compare/v0.1.4...v0.1.5
|
|
293
|
+
[0.1.4]: https://github.com/xonaman/nodejs-pdfium-native/compare/0.1.3...v0.1.4
|
|
294
|
+
[0.1.3]: https://github.com/xonaman/nodejs-pdfium-native/compare/0.1.2...0.1.3
|
|
295
|
+
[0.1.2]: https://github.com/xonaman/nodejs-pdfium-native/releases/tag/0.1.2
|
package/README.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# pdfium-native
|
|
2
2
|
|
|
3
|
+
[](https://github.com/xonaman/nodejs-pdfium-native/actions/workflows/ci.yml)
|
|
3
4
|
[](https://www.npmjs.com/package/pdfium-native)
|
|
4
5
|
[](https://nodejs.org)
|
|
5
6
|
[](https://github.com/xonaman/nodejs-pdfium-native/blob/main/LICENSE)
|
|
6
|
-
[]()
|
|
7
|
+
[](#-supported-platforms)
|
|
7
8
|
|
|
8
9
|
Fast, native PDF rendering and text extraction for Node.js — powered by [PDFium](https://pdfium.googlesource.com/pdfium/), the same engine used in Chromium. Built as a C++ addon with N-API for ABI stability across Node.js versions.
|
|
9
10
|
|
|
@@ -40,7 +41,7 @@ doc.destroy();
|
|
|
40
41
|
**🔒 Reliability**
|
|
41
42
|
|
|
42
43
|
- Built on PDFium — the PDF engine used in Chromium
|
|
43
|
-
- ABI-stable via N-API — works across Node.js
|
|
44
|
+
- ABI-stable via N-API — works across Node.js 22–24 without recompilation
|
|
44
45
|
- Password-protected PDFs supported out of the box
|
|
45
46
|
|
|
46
47
|
### 🎯 Use cases
|
|
@@ -90,7 +91,7 @@ doc.destroy();
|
|
|
90
91
|
npm install pdfium-native
|
|
91
92
|
```
|
|
92
93
|
|
|
93
|
-
Prebuilt binaries are available for all [supported platforms](
|
|
94
|
+
Prebuilt binaries are available for all [supported platforms](#-supported-platforms) — most installs require no compiler. If no prebuilt is available, the package falls back to compiling from source (requires a C++ toolchain: Xcode CLI tools on macOS, `build-essential` on Linux, Visual Studio on Windows).
|
|
94
95
|
|
|
95
96
|
## 🌍 Supported Platforms
|
|
96
97
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
`pdfium-native` is distributed under the [MIT License](./LICENSE). It bundles
|
|
4
|
+
and/or links against the third-party native components listed below. Each
|
|
5
|
+
component remains under its own license; the relevant license texts are shipped
|
|
6
|
+
inside the prebuilt PDFium distribution under `deps/pdfium/licenses/`.
|
|
7
|
+
|
|
8
|
+
## Bundled native libraries
|
|
9
|
+
|
|
10
|
+
| Component | Version | License |
|
|
11
|
+
| -------------------------------------------------- | --------------- | --------------------------------------- |
|
|
12
|
+
| [PDFium](https://pdfium.googlesource.com/pdfium/) | `chromium/7749` | BSD-3-Clause |
|
|
13
|
+
| [stb_image_write](https://github.com/nothings/stb) | `v1.16` | Public Domain (Unlicense) or MIT (dual) |
|
|
14
|
+
|
|
15
|
+
- **PDFium** — the PDF rendering and parsing engine, consumed as a prebuilt
|
|
16
|
+
shared library from
|
|
17
|
+
[bblanchon/pdfium-binaries](https://github.com/bblanchon/pdfium-binaries).
|
|
18
|
+
Copyright The PDFium Authors. Licensed under BSD-3-Clause.
|
|
19
|
+
- **stb_image_write** — single-header PNG/JPEG encoder vendored in
|
|
20
|
+
`src/stb_image_write.{h,cc}`, used to encode rendered bitmaps. By Sean Barrett
|
|
21
|
+
(and based on Jon Olick's public-domain JPEG writer). Dual-licensed: you may
|
|
22
|
+
use it under the MIT License or as public domain (Unlicense).
|
|
23
|
+
|
|
24
|
+
## Components statically linked into the prebuilt PDFium library
|
|
25
|
+
|
|
26
|
+
The prebuilt PDFium shared library statically incorporates the third-party
|
|
27
|
+
components below. Their versions track the upstream PDFium `chromium/7749`
|
|
28
|
+
build; full license texts are provided in `deps/pdfium/licenses/`.
|
|
29
|
+
|
|
30
|
+
| Component | License |
|
|
31
|
+
| ------------------------- | ----------------------------------------- |
|
|
32
|
+
| Abseil | Apache-2.0 |
|
|
33
|
+
| Anti-Grain Geometry (2.3) | Anti-Grain Geometry License (permissive) |
|
|
34
|
+
| fast_float | MIT (also Apache-2.0 / BSL-1.0) |
|
|
35
|
+
| FreeType | FreeType License (FTL) or GPLv2 |
|
|
36
|
+
| ICU | Unicode License v3 |
|
|
37
|
+
| Little CMS (lcms2) | MIT |
|
|
38
|
+
| libjpeg-turbo | BSD-3-Clause and IJG License |
|
|
39
|
+
| OpenJPEG | BSD-2-Clause |
|
|
40
|
+
| libpng | libpng License (PNG Reference Library v2) |
|
|
41
|
+
| libtiff | libtiff License (MIT/BSD-style) |
|
|
42
|
+
| LLVM libc | Apache-2.0 with LLVM Exceptions |
|
|
43
|
+
| simdutf | MIT (also Apache-2.0) |
|
|
44
|
+
| zlib (1.3.1) | zlib License |
|
|
45
|
+
|
|
46
|
+
If you redistribute `pdfium-native` (or its prebuilt binaries), you must retain
|
|
47
|
+
the above notices and the corresponding license texts.
|
package/binding.gyp
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
"targets": [
|
|
3
3
|
{
|
|
4
4
|
"target_name": "pdfium",
|
|
5
|
+
"variables": {
|
|
6
|
+
"cpp_std%": "c++20"
|
|
7
|
+
},
|
|
5
8
|
"sources": [
|
|
6
9
|
"src/pdfium_addon.cc",
|
|
7
10
|
"src/stb_image_write.cc"
|
|
@@ -12,7 +15,7 @@
|
|
|
12
15
|
"src"
|
|
13
16
|
],
|
|
14
17
|
"defines": [
|
|
15
|
-
"NAPI_VERSION=
|
|
18
|
+
"NAPI_VERSION=9"
|
|
16
19
|
],
|
|
17
20
|
"cflags!": [
|
|
18
21
|
"-fno-exceptions"
|
|
@@ -27,7 +30,7 @@
|
|
|
27
30
|
"-fno-exceptions"
|
|
28
31
|
],
|
|
29
32
|
"cflags_cc": [
|
|
30
|
-
"-std
|
|
33
|
+
"-std=<(cpp_std)",
|
|
31
34
|
"-fvisibility=hidden"
|
|
32
35
|
],
|
|
33
36
|
"conditions": [
|
|
@@ -36,7 +39,7 @@
|
|
|
36
39
|
{
|
|
37
40
|
"xcode_settings": {
|
|
38
41
|
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
|
|
39
|
-
"CLANG_CXX_LANGUAGE_STANDARD": "
|
|
42
|
+
"CLANG_CXX_LANGUAGE_STANDARD": "<(cpp_std)",
|
|
40
43
|
"GCC_SYMBOLS_PRIVATE_EXTERN": "YES",
|
|
41
44
|
"DEAD_CODE_STRIPPING": "YES",
|
|
42
45
|
"LLVM_LTO": "YES",
|
|
@@ -85,7 +88,7 @@
|
|
|
85
88
|
"Optimization": 2,
|
|
86
89
|
"WholeProgramOptimization": "true",
|
|
87
90
|
"AdditionalOptions": [
|
|
88
|
-
"/std
|
|
91
|
+
"/std:<(cpp_std)"
|
|
89
92
|
]
|
|
90
93
|
},
|
|
91
94
|
"VCLinkerTool": {
|
package/dist/concurrency.js
CHANGED
package/dist/concurrency.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concurrency.js","sourceRoot":"","sources":["../lib/concurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,
|
|
1
|
+
{"version":3,"file":"concurrency.js","sourceRoot":"","sources":["../lib/concurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,MAAM,EAAE,EAAsB,MAAM,SAAS,CAAC;AAErD,IAAI,KAAK,GAAkB,MAAM,CAAC,oBAAoB,EAAE,CAAC,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAC;QACpE,CAAC;QACD,KAAK,GAAG,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,KAAK,CAAC,WAAW,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,eAAe,CAAI,EAAoB;IACrD,OAAO,KAAK,CAAC,EAAE,CAAC,CAAC;AACnB,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OA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EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EACL,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,aAAa,EACb,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,IAAI,EACJ,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,IAAI,EACJ,WAAW,EACX,aAAa,EACb,UAAU,EACV,oBAAoB,EACpB,cAAc,EACd,cAAc,GACf,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,8 @@ if (process.platform === 'win32') {
|
|
|
16
16
|
else {
|
|
17
17
|
process.env.LD_LIBRARY_PATH = `${addonDir}:${process.env.LD_LIBRARY_PATH ?? ''}`;
|
|
18
18
|
}
|
|
19
|
+
// The native addon is loaded through createRequire, so its export is `any` at
|
|
20
|
+
// the module boundary; assert it to the typed surface once, here.
|
|
19
21
|
const addon = require('../build/Release/pdfium.node');
|
|
20
22
|
/**
|
|
21
23
|
* Opens a PDF document from a Buffer or file path.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EA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CAAC;IAC1B,yCAAyC;IACzC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,2FAA2F;IAC3F,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,oDAAoD;IACpD,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,iEAAiE;IACjE,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAEpC,gBAAgB;gBACI,MAAM,EAAE,UAAU;IAYtC,uCAAuC;IACvC,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAI1B,kCAAkC;IAClC,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IACtE,iEAAiE;IACjE,MAAM,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAKpD,uEAAuE;IACjE,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAYnD,wEAAwE;IACjE,OAAO,IAAI,cAAc,CAAC,UAAU,CAAC;IAM5C,2CAA2C;IAC3C,KAAK,IAAI,IAAI;IAIb,qCAAqC;IACrC,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAI3B,wFAAwF;IACxF,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAIrE,2CAA2C;IAC3C,cAAc,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAIvC,2CAA2C;IAC3C,aAAa,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;CAGtC"}
|
package/dist/page.js
CHANGED
|
@@ -48,7 +48,8 @@ export class PDFiumPage {
|
|
|
48
48
|
/** Returns the page object at the given index with type and bounds. */
|
|
49
49
|
async getObject(index) {
|
|
50
50
|
const obj = await withConcurrency(() => this.native.getObject(index));
|
|
51
|
-
// wrap the native render function on image objects with the concurrency
|
|
51
|
+
// wrap the native render function on image objects with the concurrency
|
|
52
|
+
// semaphore. `obj` is already narrowed to ImagePageObject by the guard.
|
|
52
53
|
if (obj.type === 'image') {
|
|
53
54
|
const nativeRender = obj.render.bind(obj);
|
|
54
55
|
obj.render = ((opts) => withConcurrency(() => nativeRender(opts)));
|
package/dist/page.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.js","sourceRoot":"","sources":["../lib/page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAenD;;GAEG;AACH,MAAM,OAAO,UAAU;IAqBD;IApBpB,+CAA+C;IACtC,KAAK,CAAS;IACvB,gDAAgD;IACvC,MAAM,CAAS;IACxB,0BAA0B;IACjB,MAAM,CAAS;IACxB,gEAAgE;IACvD,WAAW,CAAS;IAC7B,kEAAkE;IACzD,QAAQ,CAAS;IAC1B,yCAAyC;IAChC,eAAe,CAAU;IAClC,2FAA2F;IAClF,KAAK,CAAU;IACxB,oDAAoD;IAC3C,OAAO,CAAoB;IACpC,iEAAiE;IACxD,OAAO,CAAoB;IAEpC,gBAAgB;IAChB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QACpC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;QAC9C,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,C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IAAyB,EAAE,EAAE,CAC1C,eAAe,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAA8B,CAAC;QAC5E,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,wEAAwE;IACxE,KAAK,CAAC,CAAC,OAAO;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1C,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,2CAA2C;IAC3C,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAED,qCAAqC;IACrC,QAAQ;QACN,OAAO,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,wFAAwF;IACxF,MAAM,CAAC,IAAY,EAAE,OAAuB;QAC1C,OAAO,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,2CAA2C;IAC3C,cAAc;QACZ,OAAO,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,2CAA2C;IAC3C,aAAa;QACX,OAAO,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
package/lib/index.ts
CHANGED
|
@@ -26,7 +26,9 @@ if (process.platform === 'win32') {
|
|
|
26
26
|
process.env.LD_LIBRARY_PATH = `${addonDir}:${process.env.LD_LIBRARY_PATH ?? ''}`;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
// The native addon is loaded through createRequire, so its export is `any` at
|
|
30
|
+
// the module boundary; assert it to the typed surface once, here.
|
|
31
|
+
const addon = require('../build/Release/pdfium.node') as NativeAddon;
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
34
|
* Opens a PDF document from a Buffer or file path.
|
package/lib/page.ts
CHANGED
|
@@ -65,10 +65,11 @@ export class PDFiumPage {
|
|
|
65
65
|
/** Returns the page object at the given index with type and bounds. */
|
|
66
66
|
async getObject(index: number): Promise<PageObject> {
|
|
67
67
|
const obj = await withConcurrency(() => this.native.getObject(index));
|
|
68
|
-
// wrap the native render function on image objects with the concurrency
|
|
68
|
+
// wrap the native render function on image objects with the concurrency
|
|
69
|
+
// semaphore. `obj` is already narrowed to ImagePageObject by the guard.
|
|
69
70
|
if (obj.type === 'image') {
|
|
70
|
-
const nativeRender =
|
|
71
|
-
|
|
71
|
+
const nativeRender = obj.render.bind(obj);
|
|
72
|
+
obj.render = ((opts?: ImageRenderOptions) =>
|
|
72
73
|
withConcurrency(() => nativeRender(opts))) as ImagePageObject['render'];
|
|
73
74
|
}
|
|
74
75
|
return obj;
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdfium-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Native Node.js bindings for PDFium",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"packageManager": "npm@11.17.0",
|
|
7
8
|
"engines": {
|
|
8
|
-
"node": ">=
|
|
9
|
+
"node": ">=22.0.0"
|
|
9
10
|
},
|
|
10
11
|
"keywords": [
|
|
11
12
|
"pdf",
|
|
@@ -32,7 +33,8 @@
|
|
|
32
33
|
".": {
|
|
33
34
|
"types": "./dist/index.d.ts",
|
|
34
35
|
"default": "./dist/index.js"
|
|
35
|
-
}
|
|
36
|
+
},
|
|
37
|
+
"./package.json": "./package.json"
|
|
36
38
|
},
|
|
37
39
|
"files": [
|
|
38
40
|
"dist",
|
|
@@ -42,7 +44,8 @@
|
|
|
42
44
|
"binding.gyp",
|
|
43
45
|
"README.md",
|
|
44
46
|
"CHANGELOG.md",
|
|
45
|
-
"LICENSE"
|
|
47
|
+
"LICENSE",
|
|
48
|
+
"THIRD-PARTY-NOTICES.md"
|
|
46
49
|
],
|
|
47
50
|
"repository": {
|
|
48
51
|
"type": "git",
|
|
@@ -72,7 +75,10 @@
|
|
|
72
75
|
"build:ts": "tsc",
|
|
73
76
|
"prepublishOnly": "tsc",
|
|
74
77
|
"download": "node scripts/download-pdfium.mjs",
|
|
78
|
+
"verify:checksums": "node scripts/verify-checksums.mjs",
|
|
75
79
|
"test": "vitest run",
|
|
80
|
+
"test:coverage": "vitest run --coverage",
|
|
81
|
+
"typecheck": "tsc --noEmit",
|
|
76
82
|
"lint": "eslint --fix .",
|
|
77
83
|
"lint:check": "eslint .",
|
|
78
84
|
"format": "prettier --write .",
|
|
@@ -80,8 +86,8 @@
|
|
|
80
86
|
"prepare": "husky && tsc"
|
|
81
87
|
},
|
|
82
88
|
"lint-staged": {
|
|
83
|
-
"*.{ts,js,json,md,yaml,yml}": "prettier --write",
|
|
84
|
-
"*.{ts,js}": "eslint --max-warnings 0"
|
|
89
|
+
"*.{ts,js,mjs,cjs,json,md,yaml,yml}": "prettier --write",
|
|
90
|
+
"*.{ts,js,mjs,cjs}": "eslint --max-warnings 0"
|
|
85
91
|
},
|
|
86
92
|
"dependencies": {
|
|
87
93
|
"node-addon-api": "^8.0.0",
|
|
@@ -90,12 +96,13 @@
|
|
|
90
96
|
"devDependencies": {
|
|
91
97
|
"@eslint/js": "^10.0.1",
|
|
92
98
|
"@types/node": "^25.5.0",
|
|
99
|
+
"@vitest/coverage-v8": "^4.1.2",
|
|
93
100
|
"eslint": "^10.1.0",
|
|
94
101
|
"eslint-config-prettier": "^10.1.8",
|
|
95
|
-
"
|
|
102
|
+
"globals": "^17.0.0",
|
|
96
103
|
"husky": "^9.1.7",
|
|
97
104
|
"lint-staged": "^16.4.0",
|
|
98
|
-
"node-gyp": "^
|
|
105
|
+
"node-gyp": "^13.0.0",
|
|
99
106
|
"prettier": "^3.8.1",
|
|
100
107
|
"typescript": "^5.9.3",
|
|
101
108
|
"typescript-eslint": "^8.57.2",
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { execSync
|
|
2
|
-
import {
|
|
3
|
-
import { pipeline } from 'node:stream/promises';
|
|
4
|
-
import { Readable } from 'node:stream';
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import { existsSync, mkdirSync, rmSync } from 'node:fs';
|
|
5
3
|
import { join } from 'node:path';
|
|
4
|
+
import { downloadFile, extractTarball, loadManifest } from './lib/integrity.mjs';
|
|
6
5
|
|
|
7
|
-
const
|
|
8
|
-
const BASE_URL = 'https://github.com/bblanchon/pdfium-binaries/releases/download';
|
|
6
|
+
const { pdfium } = loadManifest();
|
|
9
7
|
|
|
10
8
|
// detect musl libc (Alpine, Void, etc.)
|
|
11
9
|
function isMusl() {
|
|
@@ -22,33 +20,16 @@ function isMusl() {
|
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
const TARGETS = {
|
|
26
|
-
// macOS
|
|
27
|
-
'darwin-arm64': 'pdfium-mac-arm64',
|
|
28
|
-
'darwin-x64': 'pdfium-mac-x64',
|
|
29
|
-
// Linux (glibc)
|
|
30
|
-
'linux-x64': 'pdfium-linux-x64',
|
|
31
|
-
'linux-arm64': 'pdfium-linux-arm64',
|
|
32
|
-
'linux-arm': 'pdfium-linux-arm',
|
|
33
|
-
'linux-ppc64': 'pdfium-linux-ppc64',
|
|
34
|
-
// Linux (musl / Alpine)
|
|
35
|
-
'linux-musl-x64': 'pdfium-linux-musl-x64',
|
|
36
|
-
'linux-musl-arm64': 'pdfium-linux-musl-arm64',
|
|
37
|
-
// Windows
|
|
38
|
-
'win32-x64': 'pdfium-win-x64',
|
|
39
|
-
'win32-arm64': 'pdfium-win-arm64',
|
|
40
|
-
};
|
|
41
|
-
|
|
42
23
|
const platform = process.platform;
|
|
43
24
|
// support cross-compilation via npm_config_arch (e.g. win32 x64 → arm64)
|
|
44
25
|
const arch = process.env.npm_config_arch || process.arch;
|
|
45
26
|
const musl = isMusl();
|
|
46
27
|
const key = musl ? `${platform}-musl-${arch}` : `${platform}-${arch}`;
|
|
47
|
-
const
|
|
28
|
+
const entry = pdfium.targets[key];
|
|
48
29
|
|
|
49
|
-
if (!
|
|
30
|
+
if (!entry) {
|
|
50
31
|
console.error(`Unsupported platform: ${key}`);
|
|
51
|
-
console.error(`Supported: ${Object.keys(
|
|
32
|
+
console.error(`Supported: ${Object.keys(pdfium.targets).join(', ')}`);
|
|
52
33
|
process.exit(1);
|
|
53
34
|
}
|
|
54
35
|
|
|
@@ -59,27 +40,22 @@ if (existsSync(join(depsDir, 'include', 'fpdfview.h'))) {
|
|
|
59
40
|
process.exit(0);
|
|
60
41
|
}
|
|
61
42
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
43
|
+
// version is repo-controlled (native-deps.json); encode it so it can't escape
|
|
44
|
+
// the release path, and downloadFile pins both the origin and the SHA-256.
|
|
45
|
+
const url = `${pdfium.baseUrl}/${encodeURIComponent(pdfium.version)}/${entry.asset}`;
|
|
46
|
+
const tarball = join(import.meta.dirname, '..', entry.asset);
|
|
65
47
|
|
|
66
|
-
console.log(`Downloading PDFium ${
|
|
48
|
+
console.log(`Downloading PDFium ${pdfium.version} for ${key}...`);
|
|
67
49
|
console.log(`URL: ${url}`);
|
|
68
50
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
51
|
+
await downloadFile(url, tarball, {
|
|
52
|
+
expectedSha256: entry.sha256,
|
|
53
|
+
allowedOrigin: pdfium.origin,
|
|
54
|
+
});
|
|
74
55
|
|
|
75
|
-
|
|
76
|
-
await pipeline(Readable.fromWeb(response.body), createWriteStream(tarball));
|
|
77
|
-
|
|
78
|
-
console.log('Extracting...');
|
|
56
|
+
console.log('Checksum verified. Extracting...');
|
|
79
57
|
mkdirSync(depsDir, { recursive: true });
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// clean up tarball
|
|
83
|
-
rmSync(tarball);
|
|
58
|
+
extractTarball(tarball, depsDir);
|
|
59
|
+
rmSync(tarball, { force: true });
|
|
84
60
|
|
|
85
61
|
console.log(`PDFium installed to ${depsDir}`);
|
package/scripts/install.mjs
CHANGED
|
@@ -6,11 +6,12 @@
|
|
|
6
6
|
* Musl (Alpine) naming: pdfium-v{version}-linux-musl-{arch}.tar.gz
|
|
7
7
|
* Contents: build/Release/pdfium.node + build/Release/libpdfium.{dylib,so,dll}
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { execSync } from 'node:child_process';
|
|
10
10
|
import { createWriteStream, existsSync, mkdirSync, readFileSync, unlinkSync } from 'node:fs';
|
|
11
11
|
import { join } from 'node:path';
|
|
12
12
|
import { Readable } from 'node:stream';
|
|
13
13
|
import { pipeline } from 'node:stream/promises';
|
|
14
|
+
import { extractTarball } from './lib/integrity.mjs';
|
|
14
15
|
|
|
15
16
|
const root = join(import.meta.dirname, '..');
|
|
16
17
|
const pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
|
|
@@ -57,7 +58,7 @@ async function tryDownload() {
|
|
|
57
58
|
if (releaseUrl.origin !== releaseOrigin) {
|
|
58
59
|
throw new Error(`Unexpected URL origin: ${releaseUrl.origin}`);
|
|
59
60
|
}
|
|
60
|
-
const res = await fetch(releaseUrl, { redirect: 'follow' });
|
|
61
|
+
const res = await fetch(releaseUrl, { redirect: 'follow', signal: AbortSignal.timeout(60000) });
|
|
61
62
|
if (!res.ok) {
|
|
62
63
|
console.log(`No prebuilt binary found (HTTP ${res.status}), will compile from source.`);
|
|
63
64
|
return false;
|
|
@@ -73,8 +74,8 @@ async function tryDownload() {
|
|
|
73
74
|
|
|
74
75
|
await pipeline(Readable.fromWeb(body), fileStream);
|
|
75
76
|
|
|
76
|
-
// extract tar.gz into project root
|
|
77
|
-
|
|
77
|
+
// extract tar.gz into project root (hardened: no -P, no archived ownership)
|
|
78
|
+
extractTarball(tmpTar, root);
|
|
78
79
|
unlinkSync(tmpTar);
|
|
79
80
|
|
|
80
81
|
// verify the .node file exists
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared download/verify helpers for the install and dependency-build scripts.
|
|
3
|
+
*
|
|
4
|
+
* Goals:
|
|
5
|
+
* - never trust the network blindly: verify a pinned SHA-256 before use,
|
|
6
|
+
* - survive flaky connections: timeout + exponential-backoff retry,
|
|
7
|
+
* - never leave a half-written file behind: download to `<dest>.part` and
|
|
8
|
+
* rename atomically only after the checksum passes,
|
|
9
|
+
* - extract archives without restoring archived ownership or honouring
|
|
10
|
+
* absolute/`..` paths (tar's default, kept by NOT passing -P).
|
|
11
|
+
*/
|
|
12
|
+
import { execFileSync } from 'node:child_process';
|
|
13
|
+
import { createHash } from 'node:crypto';
|
|
14
|
+
import {
|
|
15
|
+
createReadStream,
|
|
16
|
+
createWriteStream,
|
|
17
|
+
mkdirSync,
|
|
18
|
+
readFileSync,
|
|
19
|
+
rmSync,
|
|
20
|
+
renameSync,
|
|
21
|
+
} from 'node:fs';
|
|
22
|
+
import { dirname, join } from 'node:path';
|
|
23
|
+
import { Readable } from 'node:stream';
|
|
24
|
+
import { pipeline } from 'node:stream/promises';
|
|
25
|
+
|
|
26
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
27
|
+
|
|
28
|
+
/** Compute the SHA-256 of a file as a lowercase hex string. */
|
|
29
|
+
export async function sha256File(path) {
|
|
30
|
+
const hash = createHash('sha256');
|
|
31
|
+
await pipeline(createReadStream(path), hash);
|
|
32
|
+
return hash.digest('hex');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Read the native-dependency manifest (scripts/native-deps.json). */
|
|
36
|
+
export function loadManifest() {
|
|
37
|
+
return JSON.parse(readFileSync(join(import.meta.dirname, '..', 'native-deps.json'), 'utf8'));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Download `url` to `dest` with a per-attempt timeout and exponential-backoff
|
|
42
|
+
* retry. Writes to `<dest>.part` (same filesystem, so the rename is atomic) and
|
|
43
|
+
* only promotes it once the optional `expectedSha256` matches. A checksum
|
|
44
|
+
* mismatch or unexpected origin fails immediately (not retried).
|
|
45
|
+
*
|
|
46
|
+
* @param {string} url
|
|
47
|
+
* @param {string} dest
|
|
48
|
+
* @param {{ expectedSha256?: string, allowedOrigin?: string, timeoutMs?: number, retries?: number }} [opts]
|
|
49
|
+
*/
|
|
50
|
+
export async function downloadFile(url, dest, opts = {}) {
|
|
51
|
+
const { expectedSha256, allowedOrigin, timeoutMs = 60000, retries = 4 } = opts;
|
|
52
|
+
|
|
53
|
+
const u = new URL(url);
|
|
54
|
+
if (allowedOrigin && u.origin !== allowedOrigin) {
|
|
55
|
+
throw new Error(`Refusing to download from unexpected origin: ${u.origin}`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
59
|
+
const tmp = `${dest}.part`;
|
|
60
|
+
|
|
61
|
+
let lastErr;
|
|
62
|
+
for (let attempt = 1; attempt <= retries; attempt++) {
|
|
63
|
+
try {
|
|
64
|
+
const res = await fetch(u, { redirect: 'follow', signal: AbortSignal.timeout(timeoutMs) });
|
|
65
|
+
if (!res.ok) throw new Error(`HTTP ${res.status} ${res.statusText}`);
|
|
66
|
+
if (!res.body) throw new Error('empty response body');
|
|
67
|
+
await pipeline(Readable.fromWeb(res.body), createWriteStream(tmp));
|
|
68
|
+
|
|
69
|
+
if (expectedSha256) {
|
|
70
|
+
const actual = await sha256File(tmp);
|
|
71
|
+
if (actual !== expectedSha256.toLowerCase()) {
|
|
72
|
+
throw new Error(
|
|
73
|
+
`checksum mismatch for ${u.href}\n expected ${expectedSha256}\n actual ${actual}`,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
renameSync(tmp, dest);
|
|
79
|
+
return dest;
|
|
80
|
+
} catch (err) {
|
|
81
|
+
lastErr = err;
|
|
82
|
+
rmSync(tmp, { force: true });
|
|
83
|
+
const msg = String(err?.message ?? err);
|
|
84
|
+
// integrity failures are not transient — surface them immediately
|
|
85
|
+
if (msg.includes('checksum mismatch') || msg.includes('unexpected origin')) throw err;
|
|
86
|
+
if (attempt < retries) {
|
|
87
|
+
const backoff = Math.min(1000 * 2 ** (attempt - 1), 8000);
|
|
88
|
+
console.warn(` attempt ${attempt}/${retries} failed (${msg}); retrying in ${backoff}ms`);
|
|
89
|
+
await sleep(backoff);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
throw new Error(`Failed to download ${u.href} after ${retries} attempts: ${lastErr?.message}`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Extract a .tar.gz / .tar.xz into `destDir`. Compression is auto-detected.
|
|
98
|
+
* Not passing `-P` keeps tar's default refusal of absolute and `..` paths;
|
|
99
|
+
* `--no-same-owner` avoids restoring archived uid/gid.
|
|
100
|
+
*/
|
|
101
|
+
export function extractTarball(tarball, destDir, { strip } = {}) {
|
|
102
|
+
mkdirSync(destDir, { recursive: true });
|
|
103
|
+
const args = ['-xf', tarball, '-C', destDir, '--no-same-owner'];
|
|
104
|
+
if (strip) args.push('--strip-components', String(strip));
|
|
105
|
+
execFileSync('tar', args, { stdio: 'inherit' });
|
|
106
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pdfium": {
|
|
3
|
+
"version": "chromium/7749",
|
|
4
|
+
"origin": "https://github.com",
|
|
5
|
+
"baseUrl": "https://github.com/bblanchon/pdfium-binaries/releases/download",
|
|
6
|
+
"checksumSource": "Sigstore SLSA provenance attestation (pdfium-attestation.json) attached to the bblanchon/pdfium-binaries release",
|
|
7
|
+
"targets": {
|
|
8
|
+
"darwin-arm64": {
|
|
9
|
+
"asset": "pdfium-mac-arm64.tgz",
|
|
10
|
+
"sha256": "38be4f699283f7b890d709a52e85af219eb9969bd095a00b301a3a094c4bac0e"
|
|
11
|
+
},
|
|
12
|
+
"darwin-x64": {
|
|
13
|
+
"asset": "pdfium-mac-x64.tgz",
|
|
14
|
+
"sha256": "956433456e5c43acb1dfad4889260568c3ff6b7f626a4321671b2af94d85b1dd"
|
|
15
|
+
},
|
|
16
|
+
"linux-x64": {
|
|
17
|
+
"asset": "pdfium-linux-x64.tgz",
|
|
18
|
+
"sha256": "735abb28af7deab720dc54c8df3673a0a2a57bae9a0b16288842695fbd90a4b9"
|
|
19
|
+
},
|
|
20
|
+
"linux-arm64": {
|
|
21
|
+
"asset": "pdfium-linux-arm64.tgz",
|
|
22
|
+
"sha256": "0e0cbe3976336276bea33e5248e25b8da15e44e837cbd350ce2995f8866f48ec"
|
|
23
|
+
},
|
|
24
|
+
"linux-arm": {
|
|
25
|
+
"asset": "pdfium-linux-arm.tgz",
|
|
26
|
+
"sha256": "1eaf23df0bf87bc444f60020fc49193ee5c569e1fe5325610cbb04209f4513f4"
|
|
27
|
+
},
|
|
28
|
+
"linux-ppc64": {
|
|
29
|
+
"asset": "pdfium-linux-ppc64.tgz",
|
|
30
|
+
"sha256": "dfd82a718e8aca8d04fb5aabca0b7a3b3b838ab509c6eac45bfa0018ba8c1f06"
|
|
31
|
+
},
|
|
32
|
+
"linux-musl-x64": {
|
|
33
|
+
"asset": "pdfium-linux-musl-x64.tgz",
|
|
34
|
+
"sha256": "42036d6de407f989f96fc335e10f1e9b5653ad4b4cff781423074e99026d9fe7"
|
|
35
|
+
},
|
|
36
|
+
"linux-musl-arm64": {
|
|
37
|
+
"asset": "pdfium-linux-musl-arm64.tgz",
|
|
38
|
+
"sha256": "616f43abe9951613f9b49c9939d618db7ffcca98895c7dbfbafcd9cc4a537b05"
|
|
39
|
+
},
|
|
40
|
+
"win32-x64": {
|
|
41
|
+
"asset": "pdfium-win-x64.tgz",
|
|
42
|
+
"sha256": "a0f7ca96b3a1b2f509bb003f717147bc612e8a3f9b435cd8d1adb97c70cb2dbd"
|
|
43
|
+
},
|
|
44
|
+
"win32-arm64": {
|
|
45
|
+
"asset": "pdfium-win-arm64.tgz",
|
|
46
|
+
"sha256": "4aa3292b36dcb99c27ad8c4b48cf9d2f907802cd3f6170f9e4030e581780ff4e"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verify that the SHA-256 hashes pinned in native-deps.json still match what
|
|
3
|
+
* the upstream URLs serve. Use after a version bump, or in CI as a supply-chain
|
|
4
|
+
* tripwire. By default only this platform's artifacts are checked; pass --all
|
|
5
|
+
* to verify every pinned target (large download for prebuilt-binary deps).
|
|
6
|
+
*/
|
|
7
|
+
import { rmSync } from 'node:fs';
|
|
8
|
+
import { tmpdir } from 'node:os';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import { downloadFile, loadManifest } from './lib/integrity.mjs';
|
|
11
|
+
|
|
12
|
+
const all = process.argv.includes('--all');
|
|
13
|
+
const manifest = loadManifest();
|
|
14
|
+
const platform = process.platform;
|
|
15
|
+
const arch = process.arch;
|
|
16
|
+
|
|
17
|
+
const checks = [];
|
|
18
|
+
for (const [name, dep] of Object.entries(manifest)) {
|
|
19
|
+
if (dep.targets) {
|
|
20
|
+
for (const [key, t] of Object.entries(dep.targets)) {
|
|
21
|
+
if (!all && key !== `${platform}-${arch}` && key !== `${platform}-musl-${arch}`) continue;
|
|
22
|
+
checks.push({
|
|
23
|
+
label: `${name} ${key}`,
|
|
24
|
+
url: `${dep.baseUrl}/${encodeURIComponent(dep.version)}/${t.asset}`,
|
|
25
|
+
sha256: t.sha256,
|
|
26
|
+
origin: dep.origin,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
checks.push({
|
|
31
|
+
label: `${name} ${dep.version}`,
|
|
32
|
+
url: dep.url,
|
|
33
|
+
sha256: dep.sha256,
|
|
34
|
+
origin: dep.origin,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let failed = 0;
|
|
40
|
+
for (const c of checks) {
|
|
41
|
+
const tmp = join(tmpdir(), `verify-${c.label.replace(/\W+/g, '-')}`);
|
|
42
|
+
try {
|
|
43
|
+
process.stdout.write(`Verifying ${c.label} ... `);
|
|
44
|
+
await downloadFile(c.url, tmp, { expectedSha256: c.sha256, allowedOrigin: c.origin });
|
|
45
|
+
console.log('OK');
|
|
46
|
+
} catch (err) {
|
|
47
|
+
console.log(`FAIL\n ${err.message}`);
|
|
48
|
+
failed++;
|
|
49
|
+
} finally {
|
|
50
|
+
rmSync(tmp, { force: true });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (failed) {
|
|
55
|
+
console.error(`\n${failed} checksum(s) did not match.`);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
console.log(`\nAll ${checks.length} checksum(s) verified.`);
|
package/src/pdfium_addon.cc
CHANGED
|
@@ -398,11 +398,11 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
|
|
398
398
|
env.SetInstanceData(addonData);
|
|
399
399
|
auto envAlive = addonData->envAlive;
|
|
400
400
|
|
|
401
|
-
// Layer 2: cleanup hook — fires during RunCleanup() after uv drain
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
});
|
|
401
|
+
// Layer 2: cleanup hook — fires during RunCleanup() after uv drain.
|
|
402
|
+
// SetInstanceData already installs a finalizer that deletes addonData on env
|
|
403
|
+
// teardown, so the hook must NOT delete it again (double free); it only flips
|
|
404
|
+
// the alive flag.
|
|
405
|
+
env.AddCleanupHook([addonData]() { addonData->envAlive->store(false); });
|
|
406
406
|
|
|
407
407
|
if (g_pdfium_refcount.fetch_add(1) == 0) {
|
|
408
408
|
FPDF_InitLibrary();
|