node-liblzma 1.1.9 → 2.0.3

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.
Files changed (54) hide show
  1. package/.gitattributes +3 -0
  2. package/.release-it.json +7 -0
  3. package/.release-it.manual.json +7 -0
  4. package/.release-it.retry.json +3 -0
  5. package/CHANGELOG.md +271 -0
  6. package/History.md +20 -0
  7. package/README.md +750 -30
  8. package/RELEASING.md +131 -0
  9. package/binding.gyp +162 -436
  10. package/biome.json +81 -0
  11. package/index.d.ts +254 -0
  12. package/lib/errors.d.ts +72 -0
  13. package/lib/errors.d.ts.map +1 -0
  14. package/lib/errors.js +153 -0
  15. package/lib/errors.js.map +1 -0
  16. package/lib/lzma.d.ts +245 -0
  17. package/lib/lzma.d.ts.map +1 -0
  18. package/lib/lzma.js +626 -345
  19. package/lib/lzma.js.map +1 -0
  20. package/lib/pool.d.ts +123 -0
  21. package/lib/pool.d.ts.map +1 -0
  22. package/lib/pool.js +188 -0
  23. package/lib/pool.js.map +1 -0
  24. package/lib/types.d.ts +27 -0
  25. package/lib/types.d.ts.map +1 -0
  26. package/lib/types.js +5 -0
  27. package/lib/types.js.map +1 -0
  28. package/package.json +61 -22
  29. package/pnpm-workspace.yaml +3 -0
  30. package/prebuilds/darwin-x64/node-liblzma.node +0 -0
  31. package/prebuilds/linux-x64/node-liblzma.node +0 -0
  32. package/prebuilds/win32-x64/node-liblzma.node +0 -0
  33. package/scripts/analyze-coverage.js +132 -0
  34. package/scripts/build_xz_with_cmake.py +390 -0
  35. package/scripts/compare-coverage-tools.js +93 -0
  36. package/scripts/copy_dll.py +51 -0
  37. package/scripts/download_xz_from_github.py +376 -0
  38. package/src/bindings/node-liblzma.cpp +411 -229
  39. package/src/bindings/node-liblzma.hpp +101 -48
  40. package/src/errors.ts +167 -0
  41. package/src/lzma.ts +839 -0
  42. package/src/pool.ts +228 -0
  43. package/src/types.ts +30 -0
  44. package/tsconfig.json +50 -0
  45. package/vitest.config.istanbul.ts +29 -0
  46. package/vitest.config.monocart.ts +44 -0
  47. package/vitest.config.ts +52 -0
  48. package/xz-version.json +8 -0
  49. package/prebuilds/darwin-x64/node.napi.node +0 -0
  50. package/prebuilds/linux-x64/node.napi.node +0 -0
  51. package/prebuilds/win32-x64/node.napi.node +0 -0
  52. package/scripts/download_extract_deps.py +0 -29
  53. package/scripts/prebuildify.py +0 -13
  54. package/src/lzma.coffee +0 -344
package/.gitattributes ADDED
@@ -0,0 +1,3 @@
1
+ * text=auto eol=lf
2
+ *.{cmd,[cC][mM][dD]} text eol=crlf
3
+ *.{bat,[bB][aA][tT]} text eol=crlf
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "@oorabona/release-it-preset/config/default",
3
+ "git": {
4
+ "requireBranch": "master",
5
+ "requireCleanWorkingDir": true
6
+ }
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "@oorabona/release-it-preset/config/manual-changelog",
3
+ "git": {
4
+ "requireBranch": "master",
5
+ "requireCleanWorkingDir": true
6
+ }
7
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "@oorabona/release-it-preset/config/retry-publish"
3
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,271 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [2.0.3] - 2025-10-07
11
+
12
+ ### Fixed
13
+ - create dedicated .release-it.retry.json for publish workflow (ci) ([007ec61](https://github.com/oorabona/node-liblzma/commit/007ec61))
14
+ - ignore local .release-it.json in publish workflow (ci) ([0958cc3](https://github.com/oorabona/node-liblzma/commit/0958cc3))
15
+ - use correct release-it-preset CLI syntax (ci) ([210343e](https://github.com/oorabona/node-liblzma/commit/210343e))
16
+ - use npm config set for authentication (ci) ([8e6abcc](https://github.com/oorabona/node-liblzma/commit/8e6abcc))
17
+ - configure npm authentication in publish workflow (ci) ([5b085e4](https://github.com/oorabona/node-liblzma/commit/5b085e4))
18
+ - use tar.gz archives for cross-platform prebuild distribution (ci) ([bc6c213](https://github.com/oorabona/node-liblzma/commit/bc6c213))
19
+ - preserve prebuild directory structure to prevent file overwriting (ci) ([ac8f364](https://github.com/oorabona/node-liblzma/commit/ac8f364))
20
+ - remove build duplication and fix release-it command in publish workflow (ci) ([b0588ca](https://github.com/oorabona/node-liblzma/commit/b0588ca))
21
+ - skip build scripts in publish workflow (ci) ([eb7ab76](https://github.com/oorabona/node-liblzma/commit/eb7ab76))
22
+ - force bash shell for XZ download step on Windows (ci) ([73b6839](https://github.com/oorabona/node-liblzma/commit/73b6839))
23
+
24
+ ## [2.0.2] - 2025-10-07
25
+
26
+ ### Added
27
+ - refactor release workflow to use Pull Request strategy (ci) ([b2797fd](https://github.com/oorabona/node-liblzma/commit/b2797fd))
28
+ - optimize XZ management with artifacts and move prebuildify to CI-only (ci) ([de7d825](https://github.com/oorabona/node-liblzma/commit/de7d825))
29
+ - optimize XZ source management with artifacts and fix prebuildify PATH (ci) ([3984e19](https://github.com/oorabona/node-liblzma/commit/3984e19))
30
+ - optimize XZ source management with GitHub Actions artifacts (ci) ([0dec8f8](https://github.com/oorabona/node-liblzma/commit/0dec8f8))
31
+ - simplify republish workflow by removing target options and using boolean for npm publish (workflows) ([d1e188d](https://github.com/oorabona/node-liblzma/commit/d1e188d))
32
+
33
+ ### Fixed
34
+ - remove CHANGELOG update and dry-run validation steps since default handles both directly (release) ([8ff80f8](https://github.com/oorabona/node-liblzma/commit/8ff80f8))
35
+ - skip native module compilation in release workflow (ci) ([53fc871](https://github.com/oorabona/node-liblzma/commit/53fc871))
36
+ - correct gyp staleness detection to prevent unconditional XZ downloads (build) ([6ed20dd](https://github.com/oorabona/node-liblzma/commit/6ed20dd))
37
+ - prevent double compilation and ensure prebuildify executes (ci) ([4dece66](https://github.com/oorabona/node-liblzma/commit/4dece66))
38
+ - add tag normalization and fix checkout refs for reproducible builds (workflows) ([2c7beee](https://github.com/oorabona/node-liblzma/commit/2c7beee))
39
+ - add automatic 'v' prefix normalization to prevent tag mismatch (workflows) ([862dd89](https://github.com/oorabona/node-liblzma/commit/862dd89))
40
+
41
+ ## [2.0.1] - 2025-10-07
42
+
43
+ ### Changed
44
+ - **Vitest Configuration**: Universal fork-based worker pool with increased timeouts to resolve Vitest bug #8201
45
+ - Changed from conditional forks (macOS only) to universal forks for all platforms
46
+ - Increased testTimeout from 5000ms to 10000ms
47
+ - Added hookTimeout of 10000ms
48
+ - Configured singleFork and isolate options for better stability
49
+ - Increased workflow retry attempts from 3 to 5 for better reliability
50
+ - **CI/CD Workflow Architecture**:
51
+ - Extracted hardcoded Node.js version to environment variable (NODE_VERSION: '22')
52
+ - Added retry mechanism for all test executions (5 attempts with 10-minute timeout)
53
+ - Changed `tags-ignore` to `tags` in ci-unified.yml to allow CI validation before releases
54
+ - Removed duplicate test execution from release.yml (violates DRY and SRP principles)
55
+ - Added check-ci job to verify CI passed before building prebuilds and publishing
56
+
57
+ ### Fixed
58
+ - **Test Stability**: Fixed "Channel closed" (ERR_IPC_CHANNEL_CLOSED) errors on GitHub Actions macOS runners
59
+ - **Workflow Duplication**: Eliminated duplicate test execution between ci-unified.yml and release.yml
60
+ - **Release Safety**: Added CI verification step to ensure all checks pass before publishing to npm
61
+
62
+ ## [2.0.0] - 2025-10-06
63
+
64
+ ### Added
65
+ - **TypeScript Support**: Complete migration from CoffeeScript to TypeScript for better type safety and developer experience
66
+ - **Promise APIs**: New async functions `xzAsync()` and `unxzAsync()` with Promise support
67
+ - **Typed Error Classes**: 8 specialized error classes (`LZMAMemoryError`, `LZMADataError`, `LZMAFormatError`, etc.) with factory pattern for precise error handling
68
+ - **Concurrency Control**: `LZMAPool` class with EventEmitter-based monitoring for production environments
69
+ - Automatic backpressure and queue management
70
+ - Configurable concurrency limits
71
+ - Real-time metrics (`active`, `queued`, `completed`, `failed`)
72
+ - Events: `queue`, `start`, `complete`, `error-task`, `metrics`
73
+ - **File Helpers**: Simplified `xzFile()` and `unxzFile()` functions for file-based compression
74
+ - **Modern Testing**: Migrated from Mocha to Vitest with improved performance and TypeScript integration
75
+ - **100% Code Coverage**: Comprehensive test suite (320+ tests) covering all statements, branches, functions, and lines
76
+ - **Enhanced Tooling**:
77
+ - [Biome](https://biomejs.dev/) for fast linting and formatting
78
+ - Pre-commit hooks with nano-staged and simple-git-hooks
79
+ - pnpm as package manager for better dependency management
80
+ - **Security**:
81
+ - Fixed FunctionReference memory leak using smart pointers with custom deleter
82
+ - Added 512MB buffer size validation to prevent DoS attacks
83
+ - CodeQL workflow for continuous security scanning
84
+ - Dependabot configuration for automated dependency updates
85
+ - Enhanced tarball extraction with path validation and safety checks against path traversal
86
+ - **Thread Support**: Multi-threaded compression with configurable thread count
87
+ - **Automatic Filter Reordering**: LZMA2 filter automatically moved to end as required by liblzma
88
+ - **Factory Functions**: `createXz()` and `createUnxz()` to avoid circular dependencies in ESM
89
+ - **XZ Version Management**: Automated version tracking and update workflows for XZ Utils
90
+ - **CI/CD Enhancements**:
91
+ - Unified CI pipeline with smart smoke/full test detection
92
+ - Conditional test execution based on PR vs push vs schedule
93
+ - Composite GitHub Actions for dependency installation and environment setup
94
+ - XZ source caching with GitHub token support
95
+ - Upgraded to setup-node v5 across all workflows
96
+ - GITHUB_TOKEN environment variable for authenticated downloads
97
+ - **.gitattributes**: Line ending normalization for cross-platform consistency
98
+
99
+ ### Changed
100
+ - **Breaking**: Requires Node.js >= 16 (updated from >= 12)
101
+ - **Breaking**: Module is now ESM-only (`"type": "module"`)
102
+ - **Build System**: Modernized to use CMake for XZ Utils compilation
103
+ - Environment variable configuration for runtime linking (`RUNTIME_LINK=static|shared`)
104
+ - Threading support configuration (`ENABLE_THREAD_SUPPORT=yes|no`)
105
+ - Global liblzma usage option (`USE_GLOBAL=true|false`)
106
+ - Disabled CLI tools to avoid libintl dependency on macOS
107
+ - **XZ Utils**: Updated from 5.6.3 to 5.8.1 with complete CMake support
108
+ - **macOS Support**: Enhanced dylib handling with proper RPATH configuration
109
+ - Smart install_name verification and fixing for shared libraries
110
+ - Proper linker flags via xcode_settings
111
+ - Only applies install_name fixes to shared library builds
112
+ - **Windows Support**: Improved threading and DLL handling
113
+ - Thread support now works with both static and shared builds
114
+ - Fixed kernel32.lib linking for MSVC
115
+ - Automated library name fixing for binding.gyp compatibility
116
+ - Python-based DLL copying for better reliability
117
+ - **Vitest Configuration**: Fork-based worker pool on macOS to avoid IPC channel errors
118
+ - **CI Workflows**:
119
+ - Consolidated from 5 workflows to 1 unified pipeline
120
+ - Smoke tests and full tests are now mutually exclusive
121
+ - Proper handling of skipped job states in CI summary
122
+ - Enhanced caching strategy and matrix testing
123
+ - Path filters to avoid unnecessary runs
124
+ - **Code Quality**: Simplified instance data management and improved buffer handling
125
+ - Standardized error messages (removed "BUG?" prefixes) for production-ready error handling
126
+ - Improved async callback handling and error management
127
+ - Enhanced TypeScript configuration for better test reliability
128
+
129
+ ### Fixed
130
+ - **macOS Build Issues**:
131
+ - Fixed dylib loading errors (`Library not loaded: @rpath/liblzma.5.dylib`)
132
+ - Resolved libintl dependency issues by disabling XZ CLI tools
133
+ - Fixed RPATH configuration in binding.gyp and CMake
134
+ - Corrected install_name verification for shared vs static builds
135
+ - **Windows Build Issues**:
136
+ - Fixed NAPI_VERSION redefinition error
137
+ - Resolved DLL loading for shared library builds
138
+ - Fixed threading support configuration
139
+ - Corrected Windows library naming for compatibility
140
+ - **CI/CD Issues**:
141
+ - Fixed pipeline failure when smoke test is skipped
142
+ - Fixed conditional check for global liblzma usage
143
+ - Removed unnecessary shell specifications
144
+ - Fixed caching strategy and matrix configuration
145
+ - **Test Issues**:
146
+ - Skip negative threads test if threading not supported
147
+ - Fixed TypeScript error handling in tests
148
+ - **Code Issues**:
149
+ - Resolved C++ exception handling with `NAPI_DISABLE_CPP_EXCEPTIONS`
150
+ - Corrected memory management in async operations (Ref/Unref balance)
151
+ - Fixed filter validation bug causing `LZMA_OPTIONS_ERROR` with multiple filters
152
+ - Fixed memory leak in FunctionReference lifecycle management
153
+ - Fixed memory leaks and race conditions in C++ bindings
154
+ - Fixed filters array mutation by cloning in LZMAOptions
155
+ - Fixed XzStream destructuring for clarity
156
+ - Fixed LZMA2 filter ordering to ensure it's always last
157
+ - **General**:
158
+ - Fixed download script symbolic link safety checks
159
+ - Added `*.log` to .gitignore
160
+ - Fixed tsconfig formatting
161
+ - Improved code formatting consistency
162
+
163
+ ## [1.1.9] - Previous Release
164
+
165
+ ### Fixed
166
+ - Fix building if no prebuilt binary found
167
+
168
+ ## [1.1.7]
169
+
170
+ ### Fixed
171
+ - Fix build system
172
+ - Fix release system
173
+ - Fix documentation
174
+
175
+ ## [1.1.0]
176
+
177
+ ### Changed
178
+ - Refactor to deprecate Nan in favor of N-API
179
+ - Drop UBS building system to use standard `node-gyp`
180
+ - Support building on Linux, MacOSX and Windows
181
+ - Ability to build from preinstalled libraries as well as download from XZ website
182
+ - Deprecate Travis CI and AppVeyor to use GitHub Workflows
183
+
184
+ ## [1.0.5]
185
+
186
+ ### Added
187
+ - Added CI for OSX and Windows
188
+ - Implemented use of node-pre-gyp instead of node-gyp
189
+
190
+ ### Fixed
191
+ - Better build script, bug fixing
192
+
193
+ ## [1.0.3]
194
+
195
+ ### Changed
196
+ - Updated to latest versions of dependencies
197
+
198
+ ### Added
199
+ - NodeJS 6.x is now supported
200
+
201
+ ## [1.0.2]
202
+
203
+ ### Fixed
204
+ - Fixed build.yml to work with new UBS 0.6.1
205
+
206
+ ## [1.0.1]
207
+
208
+ ### Fixed
209
+ - Fixed minor bugs
210
+
211
+ ## [1.0.0]
212
+
213
+ ### Changed
214
+ - JS Library has been renamed to `lzma`
215
+
216
+ ### Fixed
217
+ - All known bugs have been fixed
218
+
219
+ ## [0.5.0]
220
+
221
+ ### Changed
222
+ - Rewrote large parts with Nan so now it supports 0.12+, 3+, 4+
223
+
224
+ ### Fixed
225
+ - Fixed syntax in XzStream.coffee
226
+
227
+ ### Removed
228
+ - Apparently not anymore 0.10 support
229
+
230
+ ## [0.4.3]
231
+
232
+ ### Changed
233
+ - Changes in build system (now using ubs to compile/run tests)
234
+
235
+ ### Fixed
236
+ - Applied a fix for 'availInAfter' in stream callback, after [#6032](https://github.com/joyent/node/issues/6032)
237
+ - Fixed bad variable init in binding module
238
+
239
+ ## [0.3.0]
240
+
241
+ ### Added
242
+ - Added multithread support
243
+ - ENABLE_MT is now available to compile with thread support
244
+ - Added new test cases
245
+
246
+ ## [0.2.0]
247
+
248
+ ### Added
249
+ - Full sync support
250
+ - Added new test cases (sync/async)
251
+
252
+ ### Changed
253
+ - Completed import of NodeJS Zlib API
254
+
255
+ ### Fixed
256
+ - Bug fixes
257
+
258
+ ## [0.1.0] - Initial Release
259
+
260
+ ### Added
261
+ - Initial version
262
+ - C++ binding support ENCODE/DECODE
263
+ - Async support
264
+
265
+ [Unreleased]: https://github.com/oorabona/node-liblzma/compare/v2.0.3...HEAD
266
+ [v2.0.1]: https://github.com/oorabona/node-liblzma/releases/tag/v2.0.1
267
+ [2.0.1]: https://github.com/oorabona/node-liblzma/releases/tag/v2.0.1
268
+ [v2.0.2]: https://github.com/oorabona/node-liblzma/releases/tag/v2.0.2
269
+ [2.0.2]: https://github.com/oorabona/node-liblzma/releases/tag/v2.0.2
270
+ [v2.0.3]: https://github.com/oorabona/node-liblzma/releases/tag/v2.0.3
271
+ [2.0.3]: https://github.com/oorabona/node-liblzma/releases/tag/v2.0.3
package/History.md CHANGED
@@ -1,3 +1,23 @@
1
+ # History.md
2
+
3
+ > **Note**: This file is deprecated. Please see [CHANGELOG.md](./CHANGELOG.md) for the current changelog following the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format.
4
+
5
+ # 2.0.0
6
+ * **Breaking**: Modernized testing framework from Mocha to Vitest
7
+ * **Breaking**: Modernized stack from Coffeescript to Typescript
8
+ * **Feature**: Added 100% code coverage (51 tests covering all statements, branches, functions, and lines)
9
+ * **Feature**: Implemented automatic filter reordering (LZMA2 filter automatically moved to end as required by liblzma)
10
+ * **Fix**: Resolved C++ exception handling issues with NAPI_DISABLE_CPP_EXCEPTIONS for better performance
11
+ * **Fix**: Corrected memory management in async operations (Ref/Unref balance)
12
+ * **Fix**: Fixed filter validation bug causing LZMA_OPTIONS_ERROR with multiple filters
13
+ * **CI**: Consolidated GitHub Actions workflows from 5 separate workflows to 1 unified pipeline
14
+ * **CI**: Enhanced caching strategy and matrix testing with conditional execution
15
+ * **CI**: Added path filters to avoid unnecessary CI runs for documentation-only changes
16
+ * **CI**: Optimized XZ source downloading with single download shared across all jobs
17
+ * **Performance**: Improved async callback handling and error management
18
+ * **Testing**: Added comprehensive edge case coverage including malformed inputs and threading tests
19
+ * **Testing**: Enhanced TypeScript configuration for better test reliability
20
+
1
21
  # 1.1.9
2
22
  * Fix building if no prebuilt binary found
3
23