All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- CLI is multi-format throughout: program description,
--formathelp (Binary format to unpack (default: auto-detect)) and--runhelp (pkg binaries on Node.js only); the pkg-specific--run-under-Bun guard now lives inPkgUnpackersosea/bun/nexe/caxaunpack with a warning instead of a hard CLI failure src/main.tsshebang is#!/usr/bin/env nodeso thedist-node/main.jsentrypoint runs directly under Node.js;bun src/main.tskeeps working- README covers all formats (CLI
--formatexamples, Bun and Node.js entrypoints, per-format library examples) and drops the## Creditssection; thepkg-unpackername is kept for legacy
NexeUnpacker: unpack nexe binaries (ZIP payload, old JSON-manifest layout included)CaxaUnpacker: unpack caxa self-extracting gzip-tar binariesSeaUnpacker: unpack Node.js single-executable binaries (source mains, raw assets, snapshot mains reported unrecoverable)BunUnpacker: unpack Bun single-file executables (bundled source, raw assets, bytecode bundles reported unrecoverable)- Multi-format architecture:
FormatUnpackerinterface, format detection and dispatcher,--formatflag
- Breaking:
Unpackeris nowPkgUnpackerand lives insrc/pkg/unpacker.ts; usecreateUnpackerfor multi-format binaries - Breaking: the package root now exports the library (
src/index.tsre-exporting the dispatcher) instead of the CLI runner; thepkg-unpackerbin still runs the CLI. New subpaths:./dispatch,./sea/unpacker,./bun/unpacker,./nexe/unpacker,./caxa/unpacker - Shared unpack helpers (
createResultCollector,createOutputWriter,writeSymlinkOut,applyMode,stripPrefix,ensureDir,isOutside) replace the per-formatwarnclosures, inline outside-checks, inlinemkdirs andstripNamevariants - Test fixtures live in
tests/helpers.tssodist-node/no longer shipssrc/*/fixtures.js
- Mask caxa tar modes with
0o777at parse time so crafted binaries cannot set setuid/setgid/sticky bits viachmod - Skip
chmodfor files that were not written (outside output directory or duplicate path) in nexe/caxa unpackers
binentry with Bun shebang: run via./node_modules/.bin/pkg-unpackerorbunxafter a GitHub install
unpack()returns a result object (files, skipped, symlinks, warnings) and--jsonprints it on stdout- Classify extracted files as bytecode, source or asset
- Strip the snapshot root from output paths; reject paths escaping the output directory
- Recreate directories and symlinks and apply stat modes on extraction
- Unpack files in parallel chunks and cache created directories
--runis refused under Bun and requires a matching Node.js/V8 version otherwise, with an explicit error
- Support Zstd compression (yao-pkg/pkg) end to end: enum value, decompression, placeholder discovery, tests
- Reject
payloadPosition <= 0with a loud error instead of silently extracting garbage - Reject unknown compression types instead of writing nonsense files
Unpacker.createfalls back to placeholder discovery (padded-number scan validated against stat entries) when the payload marker is unpatched, restoring newer yao-pkg binaries- Props regex captures any compression digit so unknown ones reach validation instead of being silently truncated
- Close the file handle in
unpack(try/finally) instead of leaking it - Await the CLI run in
main.tsand exit non-zero on failure instead of an unhandled rejection - Keep unknown path segments as-is in
toOriginalinstead of joiningundefined - Debug-log decompression fallback in
readFileinstead of swallowing the error
Unpacker.createscans the binary tail (doubling 4 MiB window) for props and the payload marker instead of reading the whole file twice- Remove dead
Buffer/URLbranches (isUrl/pathToString), fixnativeSeparatortypo - Add
-V, --versionflag wired to the package version
- Node.js compatibility for
src/(tests stay Bun-only):tsconfig.node.json(NodeNextemit todist-node/, tests excluded),build:node/start:node/typecheck:nodescripts,main/exportsfields, explicit@types/nodedev dependency - Use
.jsextensions in relative imports so both Bun and Node ESM resolve them
- Migrate runtime and toolchain from Node.js/npm to Bun
- Bump
commanderfrom^13.1.0to^15.0.0andtypescriptfrom^5.8.2to^7.0.2, replace@types/nodewith@types/bun - Update
tsconfig.jsonto the Bun recommended setup (Preserve/bundler, stricter checks) - Migrate tests from
node:testtobun:test - Fix strict type errors revealed by TypeScript 7 (
noUncheckedIndexedAccess) - Update install/usage docs to Bun
- Some basic tests
- Regression in path handling introduced in
2.1.0
- Support for pkg 5.2.0 (using $ separators)
- Support for pkg >= 5.0.0 and < 5.2.0
- Compression type and entrypoint logs
- Supported tools in README
- Changed StoreType to reflect vercel/pkg names
- Unpacker.readFile return when no compression is detected
- TypeScript rewrite
- Regex refactoring (#2)
- Improve speed and use text content by default (#1)
- Initial release