@@ -49,8 +49,8 @@ module Imports =
4949 let importPath =
5050 if importPath.StartsWith( " ${outDir}" )
5151 // NOTE: Path.Combine in Fable Prelude trims / at the start
52- // of the 2nd argument, unline .NET IO.Path.Combine
53- then Path.Combine( outDir, importPath.Replace( " ${outDir}" , " " ))
52+ // of the 2nd argument, unlike .NET IO.Path.Combine
53+ then Path.Combine( outDir, importPath.Replace( " ${outDir}" , " " )) |> normalizeFullPath
5454 else importPath
5555 let sourceDir = Path.GetDirectoryName( sourcePath)
5656 let targetDir = Path.GetDirectoryName( targetPath)
@@ -141,11 +141,7 @@ let parseFiles projectFileName options =
141141
142142 // Fable (F# to JS)
143143 let projDir = projectFileName |> normalizeFullPath |> Path.GetDirectoryName
144- let libDir =
145- // special case for fable-library, the libDir is the outDir
146- if options.typescript && projectFileName.EndsWith( " Fable.Library.fsproj" ) && Option.isSome options.outDir
147- then options.outDir.Value |> normalizeFullPath
148- else getFableLibDir() |> normalizeFullPath
144+ let libDir = options.libDir |> Option.defaultValue ( getFableLibDir()) |> normalizeFullPath
149145
150146 let parseFable ( res , fileName ) =
151147 fable.CompileToBabelAst( libDir, res, fileName,
@@ -196,15 +192,15 @@ let parseFiles projectFileName options =
196192 writeAllText outPath writer.Result
197193 } |> runAsync
198194
199- let argValue key ( args : string []) =
195+ let argValue keys ( args : string []) =
200196 args
201197 |> Array.pairwise
202198 |> Array.tryPick ( fun ( k , v ) ->
203- if k = key && not ( v.StartsWith( " -" ))
199+ if ( List.contains k keys ) && not ( v.StartsWith( " -" ))
204200 then Some v else None)
205201
206202let tryFlag flag ( args : string []) =
207- match argValue flag args with
203+ match argValue [ flag] args with
208204 | Some flag ->
209205 match System.Boolean.TryParse( flag) with
210206 | true , flag -> Some flag
@@ -226,8 +222,8 @@ let run opts projectFileName outDir =
226222 let runArgs = opts.[ i+ 1 ..] |> String.concat " "
227223 sprintf " node %s %s " scriptFile runArgs)
228224 let options = {
229- outDir = opts |> argValue " --outDir" |> Option.orElse outDir
230- // fableDir = opts |> argValue "--fableDir"
225+ outDir = opts |> argValue [ " --outDir" ; " -o " ] |> Option.orElse outDir
226+ libDir = opts |> argValue [ " --fableLib " ]
231227 benchmark = opts |> hasFlag " --benchmark"
232228 optimize = opts |> hasFlag " --optimize"
233229 // sourceMaps = opts |> hasFlag "--sourceMaps"
0 commit comments