@@ -32,12 +32,11 @@ defmodule ElixirScript.Compiler do
3232 FindUsedModules ,
3333 FindUsedFunctions ,
3434 Output ,
35- Manifest ,
3635 }
3736 alias ElixirScript.ModuleSystems.ES
3837 alias Kernel.ParallelCompiler
3938
40- @ spec compile ( atom | [ atom ] | binary , [ ] ) :: [ { atom , map } ]
39+ @ spec compile ( atom | [ atom ] | binary , [ ] ) :: map
4140 def compile ( path , opts \\ [ ] )
4241
4342 def compile ( path , opts ) when is_binary ( path ) do
@@ -87,10 +86,7 @@ defmodule ElixirScript.Compiler do
8786
8887 State . stop ( pid )
8988
90- manifest_path = Path . join ( Mix.Project . manifest_path ( ) , ".compile.elixir_script" )
91- Manifest . write_manifest ( manifest_path , modules , opts )
92-
93- result
89+ transform_output ( modules , result , opts )
9490 end
9591
9692 defp build_compiler_options ( opts ) do
@@ -107,4 +103,25 @@ defmodule ElixirScript.Compiler do
107103 defp on_module_compile ( pid , _file , module , beam ) do
108104 State . put_in_memory_module ( pid , module , beam )
109105 end
106+
107+ defp transform_output ( modules , compiled_js , opts ) do
108+ output_path = if opts . output == nil or opts . output == :stdout do
109+ ""
110+ else
111+ Path . dirname ( opts . output )
112+ end
113+
114+ Enum . reduce ( modules , % { } , fn { module , info } , current_data ->
115+ info = % {
116+ references: info . used_modules ,
117+ last_modified: info . last_modified ,
118+ beam_path: Map . get ( info , :beam_path ) ,
119+ source: Map . get ( info , :file ) ,
120+ js_path: Path . join ( output_path , "#{ module } .js" ) ,
121+ js_code: Keyword . get ( compiled_js , module )
122+ }
123+
124+ Map . put ( current_data , module , info )
125+ end )
126+ end
110127end
0 commit comments