Skip to content

Commit

Permalink
Merge pull request #200 from fable-compiler/feature/compiler_directiv…
Browse files Browse the repository at this point in the history
…es_based_target

feat: Add Fable compiler directives based on the target
  • Loading branch information
MangelMaxime authored Jun 17, 2024
2 parents fecf9d7 + 05034a7 commit 0e74e8c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
To develop the REPL locally:

1. `dotnet fsi build.fsx -p WatchApp`
2. Open `localhost:8080` in your browser
2. Open `http://localhost:5173/` in your browser

## Release

Expand Down
21 changes: 16 additions & 5 deletions src/App/Widgets/Options.fs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,22 @@ type Model =
GistToken : string option
GistTokenField : string }
member this.ToOtherFSharpOptions =
[| yield "--define:FABLE_COMPILER"
yield "--langversion:preview"
if this.DefineDebug then yield "--define:DEBUG"
yield "--optimize" + (if this.Optimize then "+" else "-")
if this.TypedArrays then yield "--typedArrays" |]
[|
"--define:FABLE_COMPILER"
"--define:FABLE_COMPILER_4"
"--langversion:preview"
if this.DefineDebug then "--define:DEBUG"
match this.Target.ToLowerInvariant() with
| "javascript" -> "--define:FABLE_COMPILER_JAVASCRIPT"
| "typescript" -> "--define:FABLE_COMPILER_TYPESCRIPT"
| "python" -> "--define:FABLE_COMPILER_PYTHON"
| "rust" -> "--define:FABLE_COMPILER_RUST"
| "dart" -> "--define:FABLE_COMPILER_DART"
| _ -> ()
"--optimize"
if this.Optimize then "+" else "-"
if this.TypedArrays then "--typedArrays"
|]
static member Default =
{ Optimize = false
DefineDebug = true
Expand Down

0 comments on commit 0e74e8c

Please sign in to comment.