diff --git a/CHANGELOG.md b/CHANGELOG.md index 3526d9c1d..38bdb5a82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,10 @@ * Non-recursive top-level constants are compiled to eagerly evaluated constants in Chez Scheme. +#### Node.js + +* Generated JavaScript files now include a shebang when using the Node.js backend + ### Compiler changes * If `IAlternative` expression with `FirstSuccess` rule fails to typecheck, diff --git a/src/Compiler/ES/Node.idr b/src/Compiler/ES/Node.idr index 3e7b71147..3d67689be 100644 --- a/src/Compiler/ES/Node.idr +++ b/src/Compiler/ES/Node.idr @@ -31,7 +31,12 @@ compileToNode : Ref Ctxt Defs -> Ref Syn SyntaxInfo -> ClosedTerm -> Core String -compileToNode c s tm = compileToES c s Node tm ["node", "javascript"] +compileToNode c s tm = do + js <- compileToES c s Node tm ["node", "javascript"] + pure $ shebang ++ js + where + shebang : String + shebang = "#!/usr/bin/env node\n" ||| Node implementation of the `compileExpr` interface. compileExpr :