mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-08 08:44:37 +08:00
planNpmStaticReexports visited a file again each time another of its export names was demanded. Every visit resolved the file's import and export declarations again and walked its whole syntax tree for import() and require() calls. The purity check kept only pure trees and the failing root, so once a walk reached an impure file, the next namespace re-export walked the same files again. Each file's edges are now collected once per plan; the calls come from moduleSourceCandidates, which fork and worker discovery already fill. A repeated visit re-checks only the file's namespace re-exports, the only edges whose pruning depends on the demand. Purity is decided per strongly connected component of the module graph and kept for every file, and a walk that reaches an impure file marks every file on its stack impure. The pruned re-exports and the module order are unchanged.