-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from ocsigen/v2
v2
- Loading branch information
Showing
37 changed files
with
5,280 additions
and
3,041 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module BindingUpdater | ||
|
||
open Fake.Core | ||
open Fake.IO | ||
open System.Text.RegularExpressions | ||
|
||
let commonOptions = "--noresizearray --convertpropfns --tagged-union --remove-obsolete" | ||
let ts2fable (srcs: string list) (dest: string) = | ||
let src = srcs |> String.concat " " | ||
Shell.Exec( | ||
"yarn", | ||
$"ts2fable {src} {dest} {commonOptions}" | ||
) | ||
|
||
let typeParamConstraints = | ||
new Regex("""when '\w+ :> \w+(?: and '\w+ :> \w+)*""", RegexOptions.Compiled) | ||
|
||
let erasedCast = | ||
new Regex("""static member inline op_ErasedCast.+$""", RegexOptions.Compiled ||| RegexOptions.Multiline) | ||
|
||
let replace (regex: Regex) (replacement: string) (s: string) = | ||
printfn $"{regex.ToString()} ==> {replacement}" | ||
regex.Replace(s, replacement) | ||
|
||
let typescript () = | ||
let dest = "lib/Bindings/TypeScript.fs" | ||
ts2fable ["node_modules/typescript/lib/typescript.d.ts"] dest |> ignore | ||
File.readAsString dest | ||
|> replace typeParamConstraints "" | ||
|> replace erasedCast "// $&" | ||
|> File.writeString false dest | ||
|
||
let run () = | ||
typescript () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
(lang dune 3.0) | ||
(name ts2ocaml-jsoo-stdlib) | ||
(version 1.4.6) | ||
(version 2.0.0-alpha.0) | ||
|
||
(maintainers "[email protected]") | ||
(authors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.