-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: skip proc.cwd()
when cwd
is given
#89
base: main
Are you sure you want to change the base?
Conversation
When explicitly given `cwd` in constructor, it's unnecessary to request `process.cwd()`. This allows using this library on capability-based runtimes (e.g Deno and Node experimental) where reading is forbidden.
Heya! Let me try to fix the build issue.
This project should be usable. Why are you/Deno specifically using a
Right, you specifically choose to use Node APIs. Why? Also, does Deno expect users to map every imported thing to a file on the file system? These internals specifically contain |
I was using changing import to
to recap:
I think it makes sense to choose node condition depending on how the library is used. The concern I have right now would be
Oh, most wouldn't, please ignore this one, I experimented running repo code as-is while reproducing the issue and had to do manual mapping myself.
I'm sorry, could you elaborate further? Would it mean vfile should always request cwd even if it's explicitly given in constructor? |
Ah okay, so the import map has to do with trying to make a small repro, good!
Nope! First: a But Lines 36 to 50 in de87fea
Everything else gets the Line 7 in de87fea
|
sorry, I'm getting even more confused. My point was:
|
Maybe. But:
|
I updated the PR description to remove mentions of deno, they got less relevant as i changed my position to optimization (removing unneeded system call) |
Initial checklist
Description of changes
make
VFile
skip unnecessary filesystem access forprocess.cwd()
ifcwd
is already given.due to how
VFile.cwd
works:process.cwd()
(/
if browser)options.cwd
if exists as stated in Add support for cwd option #15 (comment)VFile will always request filesystem access even if it's not needed.