Fixes #566 by disallowing Main and Test.Main module names in library code due to their high chance of colliding with user module names. These really ought not be published to libraries and we now explicitly disallow it.
I've adjusted our containsPursFile check to instead be validatePursModules; instead of walking their src directory to ensure there is at least one PureScript file, we now parse the module header of each module in their src directory and fail if either a) there are no modules or b) a module uses a reserved name.
Fixes #566 by disallowing
Main
andTest.Main
module names in library code due to their high chance of colliding with user module names. These really ought not be published to libraries and we now explicitly disallow it.This PR uses
parsePartialModule
fromlanugage-cst-parser
as suggested by @natefaubion to reliably parse just the module header of a file: https://github.com/natefaubion/purescript-language-cst-parser/blob/7a0a4484f8abd91d688d297461209a75667e0da6/src/PureScript/CST.purs#L83-L84I've adjusted our
containsPursFile
check to instead bevalidatePursModules
; instead of walking theirsrc
directory to ensure there is at least one PureScript file, we now parse the module header of each module in theirsrc
directory and fail if either a) there are no modules or b) a module uses a reserved name.