Skip to content

Conversation

@mmmulani
Copy link

This PR adds support for symlinks to emulated filesystem in fs.ts. The main motivation is for compiling projects where the node_modules folder is heavily symlinked, like with pnpm.

The only real changes required were adding readlink and updating lstat to return the symlink inode entry vs the real file/folder.

Only part of this PR that I was having trouble with was updating the web UI to show symlinks in a nice way. I hacked around it by making resetFileSystem create symlinks when the file content started with // symlink: , and that worked pretty nicely. (like here https://esbuild.github.io/try/index.html#YgAwLjIxLjUALS1idW5kbGUKLS1vdXRmaWxlPW91dC5qcwotLXNvdXJjZW1hcAotLW1ldGFmaWxlAGUAZW50cnkudHMALy8gVGhpcyBpbXBvcnQgd2lsbCBiZSBpbmxpbmVkIGJ5IHRoZSBidW5kbGVyCmltcG9ydCB7IHRlc3RGdW5jIH0gZnJvbSAnZm9vJwoKCnRlc3RGdW5jKCk7AABub2RlX21vZHVsZXMALy8gc3ltbGluazogcmVhbF9tb2R1bGVzAAByZWFsX21vZHVsZXMvZm9vL2luZGV4LmpzAGV4cG9ydCBmdW5jdGlvbiB0ZXN0RnVuYygpIHsKICByZXR1cm4gMTsKfQ)

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.

1 participant