on master help sign in
Fix issue where relative paths aren't parsed correctly for JS %lib includes
commit2fdf342da15ea6b0b6a8a5c66e19fcb67e477d62 authorRisto Stevcev <risto1@gmail.com> dateFri 7 Jul 2017, 12:34 (9 years ago) parente819e6b
1 file changed+4−1
src/IRTS/JavaScript/Codegen.hs+4−1
src/IRTS/JavaScript/Codegen.hs+4−1
@@ -84,8 +84,11 @@ includeLibs =
8484 repl '\\' = '_'
8585 repl '/' = '_'
8686 repl c = c
87+
88+ trimPeriod ('.' : xs) = '_' : xs
89+ trimPeriod s = s
8790 in
88− concatMap (\lib -> "var " ++ (repl <$> lib) ++ " = require(\"" ++ lib ++"\");\n")
91+ concatMap (\lib -> "var " ++ (trimPeriod $ repl <$> lib) ++ " = require(\"" ++ lib ++"\");\n")
8992
9093isYes :: Maybe String -> Bool
9194isYes (Just "Y") = True