pdfium-native 0.5.4 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ 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
+ ## [0.5.5] - 2026-04-26
8
+
9
+ ### Changed
10
+
11
+ - Build TypeScript on `npm install` via `prepare` script (`husky && tsc`) so `dist/` is always rebuilt from `lib/` after install and on `npm pack`/publish, preventing stale `dist/` drift
12
+
7
13
  ## [0.5.4] - 2026-04-11
8
14
 
9
15
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdfium-native",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "Native Node.js bindings for PDFium",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -77,7 +77,7 @@
77
77
  "lint:check": "eslint .",
78
78
  "format": "prettier --write .",
79
79
  "format:check": "prettier --check .",
80
- "prepare": "husky"
80
+ "prepare": "husky && tsc"
81
81
  },
82
82
  "lint-staged": {
83
83
  "*.{ts,js,json,md,yaml,yml}": "prettier --write",
@@ -95,7 +95,7 @@
95
95
  "eslint-plugin-prettier": "^5.5.5",
96
96
  "husky": "^9.1.7",
97
97
  "lint-staged": "^16.4.0",
98
- "node-gyp": "^11.0.0",
98
+ "node-gyp": "^13.0.0",
99
99
  "prettier": "^3.8.1",
100
100
  "typescript": "^5.9.3",
101
101
  "typescript-eslint": "^8.57.2",
@@ -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
- env.AddCleanupHook([addonData]() {
403
- addonData->envAlive->store(false);
404
- delete addonData;
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();