Skip to content

Commit 2333d69

Browse files
committed
PART ONE: build es6 module in dev mode too
1 parent 54e71b5 commit 2333d69

File tree

10 files changed

+33
-21
lines changed

10 files changed

+33
-21
lines changed

jscomp/Makefile.shared

+7
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,11 @@ CAMLOPT=ocamlopt.opt
88

99
.SUFFIXES: .mli .ml .cmi .cmo .cmx .p.cmx .cmj .js
1010

11+
12+
ifdef BS_RELEASE_BUILD
13+
BS_PKG_FLAGS= -bs-package-output commonjs:lib/js -bs-package-output goog:lib/goog -bs-package-output amdjs:lib/amdjs -bs-package-output es6:lib/es6
14+
else
15+
BS_PKG_FLAGS= -bs-package-output commonjs:lib/js -bs-package-output es6:lib/es6
16+
endif
17+
1118
print-% : ; @echo $* = $($*)

jscomp/bin/bsdep.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26306,7 +26306,7 @@ let to_string t =
2630626306
match t with
2630726307
| Unsafe_ffi_bool_type
2630826308
->
26309-
"You are passing a OCaml bool type into JS, probabaly you want to pass Js.boolean"
26309+
"You are passing a OCaml bool type into JS, probably you want to pass Js.boolean"
2631026310
| Unsafe_poly_variant_type
2631126311
->
2631226312
"Here a OCaml polymorphic variant type passed into JS, probably you forgot annotations like `[@bs.int]` or `[@bs.string]` "

jscomp/bin/bsppx.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8254,7 +8254,7 @@ let to_string t =
82548254
match t with
82558255
| Unsafe_ffi_bool_type
82568256
->
8257-
"You are passing a OCaml bool type into JS, probabaly you want to pass Js.boolean"
8257+
"You are passing a OCaml bool type into JS, probably you want to pass Js.boolean"
82588258
| Unsafe_poly_variant_type
82598259
->
82608260
"Here a OCaml polymorphic variant type passed into JS, probably you forgot annotations like `[@bs.int]` or `[@bs.string]` "

jscomp/bin/whole_compiler.ml

+4-2
Original file line numberDiff line numberDiff line change
@@ -27192,7 +27192,7 @@ let to_string t =
2719227192
match t with
2719327193
| Unsafe_ffi_bool_type
2719427194
->
27195-
"You are passing a OCaml bool type into JS, probabaly you want to pass Js.boolean"
27195+
"You are passing a OCaml bool type into JS, probably you want to pass Js.boolean"
2719627196
| Unsafe_poly_variant_type
2719727197
->
2719827198
"Here a OCaml polymorphic variant type passed into JS, probably you forgot annotations like `[@bs.int]` or `[@bs.string]` "
@@ -84746,7 +84746,9 @@ let string_of_module_id ~output_prefix
8474684746
begin match module_system, dependency_pkg_info, current_pkg_info with
8474784747
| _, NotFound , _
8474884748
->
84749-
Bs_exception.error (Missing_ml_dependency js_file)
84749+
Bs_exception.error (Missing_ml_dependency modulename)
84750+
(*TODO: log which module info is not done
84751+
*)
8475084752
| Goog, (Empty | Package_script _), _
8475184753
->
8475284754
Bs_exception.error (Dependency_script_module_dependent_not js_file)

jscomp/core/js_program_loader.ml

+3-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ let string_of_module_id ~output_prefix
9999
begin match module_system, dependency_pkg_info, current_pkg_info with
100100
| _, NotFound , _
101101
->
102-
Bs_exception.error (Missing_ml_dependency js_file)
102+
Bs_exception.error (Missing_ml_dependency modulename)
103+
(*TODO: log which module info is not done
104+
*)
103105
| Goog, (Empty | Package_script _), _
104106
->
105107
Bs_exception.error (Dependency_script_module_dependent_not js_file)

jscomp/others/Makefile

+2-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ RUNTIME := $(addsuffix .cmj, $(SOURCE_LIST)) $(addsuffix .cmi, $(SOURCE_LIST))
1414

1515
BS_COMMON_FLAGS= -no-alias-deps -bs-no-version-header -bs-diagnose -bs-no-check-div-by-zero -bs-cross-module-opt -bs-package-name bs-platform
1616

17-
ifdef BS_RELEASE_BUILD
18-
BS_FLAGS= $(BS_COMMON_FLAGS) -bs-package-output commonjs:lib/js -bs-package-output goog:lib/goog -bs-package-output amdjs:lib/amdjs -bs-package-output es6:lib/es6
19-
else
20-
BS_FLAGS= $(BS_COMMON_FLAGS) -bs-package-output commonjs:lib/js
21-
endif
17+
18+
BS_FLAGS= $(BS_COMMON_FLAGS) $(BS_PKG_FLAGS)
2219

2320
COMPFLAGS += $(BS_FLAGS) -I ../runtime -I ../stdlib -w +3-40-49 -warn-error A -bin-annot
2421

jscomp/runtime/Makefile

+1-5
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ RUNTIME := $(addsuffix .cmj, $(SOURCE_LIST)) $(addsuffix .cmi, $(SOURCE_LIST))
3535

3636
BS_COMMON_FLAGS= -no-alias-deps -bs-no-version-header -bs-diagnose -bs-no-check-div-by-zero -bs-cross-module-opt -bs-package-name bs-platform
3737

38-
ifdef BS_RELEASE_BUILD
39-
BS_FLAGS= $(BS_COMMON_FLAGS) -bs-package-output commonjs:lib/js -bs-package-output goog:lib/goog -bs-package-output amdjs:lib/amdjs -bs-package-output es6:lib/es6
40-
else
41-
BS_FLAGS= $(BS_COMMON_FLAGS) -bs-package-output commonjs:lib/js
42-
endif
38+
BS_FLAGS= $(BS_COMMON_FLAGS) $(BS_PKG_FLAGS)
4339

4440
COMPFLAGS += $(BS_FLAGS) -I ../stdlib -nostdlib -nopervasives -open Pervasives -unsafe -warn-error A -w -40-49 -bin-annot
4541

jscomp/runtime/js.ml

+2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ external to_bool : boolean -> bool = "#boolean_to_bool"
9494
external typeof : 'a -> string = "#typeof"
9595
(** [typeof x] will be compiled as [typeof x] in JS *)
9696
external log : 'a -> unit = "console.log" [@@bs.val]
97+
external log2 : 'a -> 'b -> unit = "console.log" [@@bs.val]
98+
external log3 : 'a -> 'b -> 'c -> unit = "console.log" [@@bs.val]
9799
(** A convenience function to log *)
98100

99101
(** {4 operators }*)

jscomp/runtime/js.mli

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ external typeof : 'a -> string = "#typeof"
102102
*)
103103

104104
external log : 'a -> unit = "console.log" [@@bs.val]
105+
external log2 : 'a -> 'b -> unit = "console.log" [@@bs.val]
106+
external log3 : 'a -> 'b -> 'c -> unit = "console.log" [@@bs.val]
105107
(** A convenience function to log everything *)
106108

107109
(** {4 operators }*)

jscomp/stdlib/Makefile.shared

+10-6
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,25 @@ CAMLC=$(CAMLRUN) $(COMPILER)
2323
# -safe-string
2424
BS_COMMON_FLAGS= -bs-no-version-header -bs-no-builtin-ppx-ml -bs-no-builtin-ppx-mli -bs-diagnose -bs-no-check-div-by-zero -bs-cross-module-opt -bs-package-name bs-platform
2525

26-
ifdef BS_RELEASE_BUILD
27-
BS_FLAGS= $(BS_COMMON_FLAGS) -bs-package-output commonjs:lib/js -bs-package-output goog:lib/goog -bs-package-output amdjs:lib/amdjs -bs-package-output es6:lib/es6
28-
else
29-
BS_FLAGS= $(BS_COMMON_FLAGS) -bs-package-output commonjs:lib/js
30-
endif
26+
include ../Makefile.shared
3127

28+
# ifdef BS_RELEASE_BUILD
29+
# BS_FLAGS= $(BS_COMMON_FLAGS) -bs-package-output commonjs:lib/js -bs-package-output goog:lib/goog -bs-package-output amdjs:lib/amdjs -bs-package-output es6:lib/es6
30+
# else
31+
# BS_FLAGS= $(BS_COMMON_FLAGS) -bs-package-output commonjs:lib/js
32+
# endif
33+
34+
BS_FLAGS= $(BS_COMMON_FLAGS) $(BS_PKG_FLAGS)
3235
COMPFLAGS= $(BS_FLAGS) -strict-sequence -w +33..39 -g -warn-error A -nostdlib \
3336
-safe-string -I ../runtime $(PROD_BS_FLAGS)
3437

3538

3639
# OPTCOMPILER=ocamlopt.opt
3740
# CAMLOPT=$(CAMLRUN) $(OPTCOMPILER)
38-
CAMLDEP=ocamldep.opt
41+
#CAMLDEP=ocamldep.opt
3942
# CAMLDEP=$(CAMLRUN) ../tools/ocamldep
4043

44+
4145
OBJS=camlinternalFormatBasics.cmo pervasives.cmo $(OTHERS)
4246
OTHERS=array.cmo list.cmo char.cmo bytes.cmo string.cmo sys.cmo \
4347
sort.cmo marshal.cmo obj.cmo \

0 commit comments

Comments
 (0)