You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of @neodx/vfs relies on granular change tracking, which works well in typical cases.
However, I've found that this approach has significant limitations and lacks the potential for future growth.
For instance, the following scenarios are blocked:
Symbolic links support due to its chaining nature and our lack of it.
Cleaning up parent directories with future writes underneath them due to the lack of a steps concept.
Illustration of the real issue (from the docs)
Unfortunately, the following code will not work as expected:
asyncfunctionreinitWorkingDir(vfs: Vfs){// 1. Cleanup working dirawaitvfs.delete('.');// 2. Write some initial filesawaitvfs.write('index.ts',`export const foo = 'bar';`);}
Instead of the deletion of the working directory, our current implementation will "forget" about it because of child file writes.
We plan to fix this in the nearest future.
Currently, you can use the following workarounds:
// Variant A - scan and delete all files directlyasyncfunctionreinitWorkingDir(vfs: Vfs){// 1. Delete all files and directoriesawaitconcurrently(awaitvfs.glob('**/*'),vfs.delete);// 2. Write some initial filesawaitvfs.write('index.ts',`export const foo = 'bar';`);}// Variant B - use `apply` method right after the deletionasyncfunctionreinitWorkingDir(vfs: Vfs){// 1. Cleanup working dirawaitvfs.delete('.');awaitvfs.apply();// 2. Write some initial filesawaitvfs.write('index.ts',`export const foo = 'bar';`);}
The text was updated successfully, but these errors were encountered:
The current implementation of
@neodx/vfs
relies on granular change tracking, which works well in typical cases.However, I've found that this approach has significant limitations and lacks the potential for future growth.
For instance, the following scenarios are blocked:
Illustration of the real issue (from the docs)
Unfortunately, the following code will not work as expected:
Instead of the deletion of the working directory, our current implementation will "forget" about it because of child file writes.
We plan to fix this in the nearest future.
Currently, you can use the following workarounds:
The text was updated successfully, but these errors were encountered: