case-sensitive-paths-webpack-plugin icon indicating copy to clipboard operation
case-sensitive-paths-webpack-plugin copied to clipboard

Use promises when listing directories

Open ivasilov opened this issue 4 years ago • 1 comments

As discussed in #46, this is the PR to migrate the usage of callbacks over to Promises.

Few things:

  • The PR is based of #48 so that should go in first. I'll rebase after.
  • I was trying to have getFilenamesInDir function set the filenames in the Map, but due to the code organization it's not possible without significant restructure. The useBeforeEmitHook also is an issue because it provides no info whether the supplied file dependency is a file or a folder.
  • I moved this.fsOperations += 1; to increment only if an actual system call is made. The previous code seemed misleading. Take this into consideration when comparing master to this branch.
  • Instead of returning the file name from fileExistsWithCase, maybe it should throw an error which would be caught in the checkFile function?
  • This function may be faster to use but it's only available in Node 10+.
  • Webpack API may have support for promises, maybe look into that.

ivasilov avatar Jun 29 '20 22:06 ivasilov

Hi! Are there updates for this PR?

gazaret avatar May 15 '21 08:05 gazaret