Skip to content

fix(sea): strip trailing slashes in manifest key lookup#261

Merged
robertsLando merged 1 commit into
mainfrom
fix/sea-access-trailing-slash
Apr 22, 2026
Merged

fix(sea): strip trailing slashes in manifest key lookup#261
robertsLando merged 1 commit into
mainfrom
fix/sea-access-trailing-slash

Conversation

@robertsLando
Copy link
Copy Markdown
Member

Summary

  • SEA provider's toManifestKey did not strip trailing separators, so fs.access('/snapshot/.../dist/') (and other APIs) missed manifest keys (stored without trailing slashes) and threw ENOENT.
  • Classic (non-SEA) bootstrap already normalizes via removeTrailingSlashes() in lib/common.ts — this brings SEA to parity.
  • Affects any library that appends / to directory paths (e.g. nestjs-i18n).

Fix

prelude/sea-vfs-setup.js: added a _stripTrailingSeps helper (root / preserved; handles / and \) and applied it inside toManifestKey on both POSIX and Windows paths.

Test plan

  • Extend test/test-89-sea-fs-ops with trailing-slash regression cases: existsSync, statSync, readdirSync, accessSync, fs.promises.access.
  • yarn build && node test/test.js host no-npm test-89-sea-fs-ops — passes on Node 22.
  • yarn lint clean.

Fixes #260

🤖 Generated with Claude Code

SEA provider's toManifestKey did not strip trailing separators, so
fs.access('/snapshot/.../dist/') and similar calls missed manifest
keys (which are stored without trailing slashes) and threw ENOENT.
Classic (non-SEA) bootstrap already normalizes via
removeTrailingSlashes() in lib/common.ts — this brings SEA to parity.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@robertsLando robertsLando merged commit af0c086 into main Apr 22, 2026
26 checks passed
@robertsLando robertsLando deleted the fix/sea-access-trailing-slash branch April 22, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SEA: access() on exisiting folder path in snapshot throws error

1 participant