-
Notifications
You must be signed in to change notification settings - Fork 470
Add BS JS Playground reason support #3976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bobzhang
merged 16 commits into
rescript-lang:master
from
ryyppy:playground-reason-support
Nov 25, 2019
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
238db04
Add newest refmt_api to jsoo_main, add CONTRIBUTION docs
ryyppy 27afbb9
Snapshot
ryyppy 439e023
Remove unrelated dir_directory change in jsoo_main
ryyppy cb14307
Fix shake_compile for reason syntax
thangngoc89 c67eed5
Undo changes to bsb.ml / bsb_native.ml
ryyppy 5135835
Snapshot js_compiler.ml
ryyppy a2ebc76
Small CONTRIBUTING changes
ryyppy 569523a
Handle refmt error properly
thangngoc89 e42819f
Snapshot js_compiler.ml
ryyppy 46f65ce
Remove obsolete playground building instructions from jscomp README
ryyppy 9c1cc43
Switch to jsoo_refmt_main build target
ryyppy a1c579f
Snapshot js_compiler.ml / js_refmt_compiler.ml
ryyppy c2b4140
Create jsoo_common.ml module for common logic for playground entrypoints
ryyppy 5936cd8
Snapshot js_compiler / js_refmt_compiler
ryyppy 611134b
CONTRIBUTING: Make Reason upgrade instructions independent from Playg…
ryyppy 4f9e376
Snapshot js_compiler / js_reftm_compiler
ryyppy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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,39 @@ | ||
module Js = struct | ||
module Unsafe = struct | ||
type any | ||
external inject : 'a -> any = "%identity" | ||
external get : 'a -> 'b -> 'c = "caml_js_get" | ||
external set : 'a -> 'b -> 'c -> unit = "caml_js_set" | ||
external pure_js_expr : string -> 'a = "caml_pure_js_expr" | ||
let global = pure_js_expr "joo_global_object" | ||
type obj | ||
external obj : (string * any) array -> obj = "caml_js_object" | ||
end | ||
type (-'a, +'b) meth_callback | ||
type 'a callback = (unit, 'a) meth_callback | ||
external wrap_callback : ('a -> 'b) -> ('c, 'a -> 'b) meth_callback = "caml_js_wrap_callback" | ||
external wrap_meth_callback : ('a -> 'b) -> ('a, 'b) meth_callback = "caml_js_wrap_meth_callback" | ||
type + 'a t | ||
type js_string | ||
external string : string -> js_string t = "caml_js_from_string" | ||
external to_string : js_string t -> string = "caml_js_to_string" | ||
external create_file : js_string t -> js_string t -> unit = "caml_create_file" | ||
external to_bytestring : js_string t -> string = "caml_js_to_byte_string" | ||
end | ||
|
||
let mk_js_error (loc: Location.t) (msg: string) = | ||
let (file,line,startchar) = Location.get_pos_info loc.Location.loc_start in | ||
let (file,endline,endchar) = Location.get_pos_info loc.Location.loc_end in | ||
Js.Unsafe.(obj | ||
[| | ||
"js_error_msg", | ||
inject @@ Js.string (Printf.sprintf "Line %d, %d:\n %s" line startchar msg); | ||
"row" , inject (line - 1); | ||
"column" , inject startchar; | ||
"endRow" , inject (endline - 1); | ||
"endColumn" , inject endchar; | ||
"text" , inject @@ Js.string msg; | ||
"type" , inject @@ Js.string "error" | ||
|] | ||
) | ||
|
This file contains hidden or 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,35 @@ | ||
(** | ||
This module is shared between different JSOO / Playground based modules | ||
*) | ||
module Js : | ||
sig | ||
module Unsafe : | ||
sig | ||
type any | ||
external inject : 'a -> any = "%identity" | ||
external get : 'a -> 'b -> 'c = "caml_js_get" | ||
external set : 'a -> 'b -> 'c -> unit = "caml_js_set" | ||
external pure_js_expr : string -> 'a = "caml_pure_js_expr" | ||
val global : 'a | ||
type obj | ||
external obj : (string * any) array -> obj = "caml_js_object" | ||
end | ||
type (-'a, +'b) meth_callback | ||
type 'a callback = (unit, 'a) meth_callback | ||
external wrap_callback : ('a -> 'b) -> ('c, 'a -> 'b) meth_callback | ||
= "caml_js_wrap_callback" | ||
external wrap_meth_callback : ('a -> 'b) -> ('a, 'b) meth_callback | ||
= "caml_js_wrap_meth_callback" | ||
type +'a t | ||
type js_string | ||
external string : string -> js_string t = "caml_js_from_string" | ||
external to_string : js_string t -> string = "caml_js_to_string" | ||
external create_file : js_string t -> js_string t -> unit | ||
= "caml_create_file" | ||
external to_bytestring : js_string t -> string = "caml_js_to_byte_string" | ||
end | ||
|
||
(* | ||
Creates a Js Error object for given location with and a certain error message | ||
*) | ||
val mk_js_error : Location.t -> string -> Js.Unsafe.obj |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.