@@ -5,7 +5,7 @@ defmodule ElixirScript.Compiler do
55
66 @ spec compile ( [ atom ] , [ ] ) :: nil
77 def compile ( entry_modules , opts \\ [ ] ) do
8- opts = build_compiler_options ( opts )
8+ opts = build_compiler_options ( opts , entry_modules )
99 { :ok , pid } = ElixirScript.State . start_link ( opts )
1010
1111 IO . puts "Finding used modules and functions"
@@ -15,19 +15,24 @@ defmodule ElixirScript.Compiler do
1515
1616 IO . puts "Compiling"
1717 modules = ElixirScript.State . list_modules ( pid )
18-
1918 ElixirScript.Translate . execute ( modules , pid )
19+
20+ IO . puts "Building Output"
21+ modules = ElixirScript.State . list_modules ( pid )
22+ ElixirScript.Output . execute ( modules , pid )
2023
2124 ElixirScript.State . stop ( pid )
2225 end
2326
24- defp build_compiler_options ( opts ) do
27+ defp build_compiler_options ( opts , entry_modules ) do
2528 default_options = Map . new
26- |> Map . put ( :output , nil )
27- |> Map . put ( :format , :es )
29+ |> Map . put ( :output , Keyword . get ( opts , :output ) )
30+ |> Map . put ( :format , Keyword . get ( opts , :format , :es ) )
2831 |> Map . put ( :js_modules , Keyword . get ( opts , :js_modules , [ ] ) )
32+ |> Map . put ( :entry_modules , entry_modules )
2933
3034 options = default_options
35+ IO . inspect options
3136 Map . put ( options , :module_formatter , get_module_formatter ( options [ :format ] ) )
3237 end
3338
0 commit comments