A concurrent wrapper around webcrack that walks a directory tree and unpacks bundles in parallel using worker threads and PQueue, with timeouts and graceful fallbacks.
- Unpacks webpack/browserify bundles via
webcrack - Concurrency split for small/large files
- Worker-based execution with per-task timeout
- Falls back to pretty-print or copy when unpack fails
- Two queues: the tool maintains two
PQueueinstances running in parallel:- Small-file queue for files under the threshold
- Big-file queue for files above the threshold
- Routing via
sizeLimit:sizeLimit(bytes) decides which queue a file goes to. IfsizeLimitis not set, all files go to the small-file queue. - Goal: all bundles are intended to be de-bundled. If
webcracksucceeds, the unpacked modules are written; if not, it falls back. - Timeout/resource guard: each file is processed in a worker thread with a per-task timeout. When a task times out (heavy/complex bundles can be resource-intensive), the worker is terminated and the original file is written (attempting to pretty-print first, otherwise copying as-is).
npm i @ivan-/concurrent-webcrackimport unpackFiles from "@ivan-/concurrent-webcrack";
await unpackFiles(
"/path/to/input-dir",
"/path/to/output-dir",
/* sizeLimit */ 2_000_000,
/* smallConcurrency */ 6,
/* bigConcurrency */ 2,
/* timeoutMs */ 60_000
);This project is based on and uses webcrack by j4k0xb (MIT).
Repository: https://github.com/j4k0xb/webcrack
See THIRD_PARTY_NOTICES.md for license details.