Repository navigation
Description
Context
#449 added tar-stream@^3.2.0 for the pod data export endpoint. It's working and tested, but Copilot's review (and a closer look during that PR) surfaced that the npm install footprint is meaningfully larger than originally claimed:
tar-stream: 60Kstreamx: 64Kbare-fs: 1.4Mbare-os: 1.0Mbare-url: 1.6Mbare-events,bare-path,bare-stream: ~210K combinedb4a: 80K
Total: ~4.4 MB on disk added by one dep.
Functional impact on Node is zero — the bare-* family exists for the Bare runtime (a Node-alternative for embedded / RN) and is lazy-loaded only when running there. On Node, streamx falls back to readable-stream and the bare-* packages sit on disk but never load. So runtime weight is the 60K of tar-stream itself.
But the disk hit matters for our deployment targets — Termux/mobile, embedded servers, anywhere install footprint is a constraint. JSS otherwise stays lean (no native bindings, small dep tree); this single addition is disproportionately heavy.
Options
- Hand-roll tar producer. POSIX ustar is a well-specified format (~200 lines of streaming code: 512-byte header per entry with name/size/mode/checksum, file bytes padded to 512, two zero blocks at end). Zero deps, full control. Maintenance burden is real but small — tar format is stable.
- Find a leaner alternative.
node-tarhas its own dep tree; would need to compare carefully. No obvious drop-in that's strictly smaller. - Strip optional
bare-*peers at install time via.npmrcor similar. Brittle; depends on npm/pnpm version. - Accept the hit. Document it clearly (already done in feat: GET /idp/account/export — self-service pod data download (#353) #449 PR description) and move on. Disk is cheap on most targets, it's only mobile/embedded where this matters.
Recommendation: option 1 (hand-roll) feels right for the project's lean-deps ethos, but it's a focused chunk of work that wasn't right for #449's scope.
Acceptance
- Replace
tar-streamimport insrc/idp/export.jswith the new producer. - All 6 tests in
test/idp-export.test.jsstill pass (they extract viatar-streamon the test side — test-only dep, fine to keep). - npm install adds <500K to
node_modules. package.jsonandpackage-lock.jsonno longer carry thebare-*family.
Out of scope
- Changing the export format itself (still tar.gz).
- Touching the export endpoint's auth / denylist / streaming logic — that's all settled in feat: GET /idp/account/export — self-service pod data download (#353) #449.
Follow-up to #449.
Activity