The PR is the continuation of #56917 and #57030.
The PR replaces `fs-extra#copy` with Node.js built-in `fs.cp` API (which is almost identical to `fs-extra#copy`, and has been available since Node.js 16). The PR also provides a workaround for flaky Windows `fs.rename` operation (#57030).
cc @styfle @wbinnssmith
Doesn't make any functional changes. Going through the current setup for isolated tests to figure out a better way to cache the repository setup, so that we don't have to wait ~30s+ when running tests locally.
The PR follows #56536 and #56491, replacing `fs-extra` usages inside the `scripts/` folder.
Note that the `copy` and `move` haven't been replaced yet. Currently, there is no better recursive copy (lightweight, promise-based, Node.js built-in `copyFile` API-based, support the `filter` option) library alternative available on npm, and Node.js built-in `fs.rename` doesn't support `overwrite`.
The PR also replaces many async fs API usage with their sync versions.
cc @wbinnssmith
This updates the `outputFileTracing` to fix a few cases we noticed where files weren't caught and also ensures we match webpack's `esm` resolving so that we don't include `cjs` files when webpack expects `esm`, it also updates to the latest `@vercel/nft` version which removes the caching in favor of ensuring the `reasons` map contains all parents allowing us to trace all entries in one `nodeFileTrace` run and the collect the separate files for each entry from the `reasons` map giving us much better performance/reliability.
This also ensures we don't include static image imports when enabled in the traces since they can drastically increase deployment size on larger projects.
* Use temp repo copy while linking packages
* Apply suggestions from code review
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>