Skip to content

Commit 1f9786f

Browse files
committed
rename cmj_path -> package_path
1 parent 476789a commit 1f9786f

File tree

8 files changed

+50
-60
lines changed

8 files changed

+50
-60
lines changed

jscomp/core/js_cmj_format.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,10 @@ let pp_cmj
248248
type path = string
249249
type cmj_load_info = {
250250
cmj_table : t ;
251-
cmj_path : path
251+
package_path : path
252252
(*
253253
Note it is the package path we want
254254
for ES6_global module spec
255+
Maybe we can employ package map in the future
255256
*)
256257
}

jscomp/core/js_cmj_format.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,5 @@ val pp_cmj: t -> unit
114114
type path = string
115115
type cmj_load_info = {
116116
cmj_table : t ;
117-
cmj_path : path ;
117+
package_path : path ;
118118
}

jscomp/core/js_cmj_load.ml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ let find_cmj_exn file : Js_cmj_format.cmj_load_info =
3636
match Builtin_cmj_datasets.query_by_name target with
3737
| Some v
3838
->
39-
{cmj_path = "BROWSER"; cmj_table = v}
39+
{package_path = "BROWSER"; cmj_table = v}
4040
| None
4141
->
4242
Bs_exception.error (Cmj_not_found file)
@@ -45,7 +45,10 @@ let find_cmj_exn file : Js_cmj_format.cmj_load_info =
4545
match Config_util.find_opt file with
4646
| Some f
4747
->
48-
{cmj_path = f; cmj_table = Js_cmj_format.from_file f}
48+
{package_path =
49+
(** hacking relying on the convention of pkg/lib/ocaml/xx.cmj*)
50+
Filename.dirname (Filename.dirname (Filename.dirname f));
51+
cmj_table = Js_cmj_format.from_file f}
4952
| None ->
5053
(* ONLY read the stored cmj data in browser environment *)
5154
Bs_exception.error (Cmj_not_found file)

jscomp/core/js_name_of_module_id.ml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ let string_of_module_id
113113
module_system
114114
in
115115
match Lam_compile_env.get_package_path_from_cmj dep_module_id with
116-
| (cmj_path, dep_package_info, little) ->
116+
| (package_path, dep_package_info, little) ->
117117
let js_file = Ext_namespace.js_name_of_modulename dep_module_id.id.name little in
118118
let dep_info_query =
119119
Js_packages_info.query_package_infos dep_package_info module_system
@@ -159,12 +159,7 @@ let string_of_module_id
159159
#end
160160
(** Note we did a post-processing when working on Windows *)
161161
| Es6_global
162-
->
163-
(** lib/ocaml/xx.cmj --
164-
HACKING: FIXME
165-
maybe we can caching relative package path calculation or employ package map *)
166-
(* assert false *)
167-
162+
->
168163
begin
169164
Ext_path.rel_normalized_absolute_path
170165
~from:(
@@ -173,8 +168,7 @@ let string_of_module_id
173168
~package_dir:(Lazy.force Ext_path.package_dir)
174169
module_system
175170
)
176-
((Filename.dirname
177-
(Filename.dirname (Filename.dirname cmj_path))) // dep_pkg.rel_path // js_file)
171+
(package_path // dep_pkg.rel_path // js_file)
178172
end
179173
end
180174
| Package_script, Package_script

jscomp/core/lam_compile_env.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ let get_package_path_from_cmj
140140
( id : Lam_module_ident.t)
141141
=
142142
match Lam_module_ident.Hash.find_opt cached_tbl id with
143-
| Some (Ml {cmj_table ; cmj_path}) ->
144-
(cmj_path,
143+
| Some (Ml {cmj_table ; package_path}) ->
144+
(package_path,
145145
Js_cmj_format.get_npm_package_path cmj_table,
146146
Js_cmj_format.get_cmj_case cmj_table )
147147
| Some External ->
@@ -158,7 +158,7 @@ let get_package_path_from_cmj
158158
Js_cmj_load.find_cmj_exn (Lam_module_ident.name id ^ Literals.suffix_cmj) in
159159
let cmj_table = cmj_load_info.cmj_table in
160160
id +> Ml cmj_load_info;
161-
(cmj_load_info.cmj_path,
161+
(cmj_load_info.package_path,
162162
Js_cmj_format.get_npm_package_path cmj_table,
163163
Js_cmj_format.get_cmj_case cmj_table )
164164
end

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -382840,7 +382840,7 @@ val pp_cmj: t -> unit
382840382840
type path = string
382841382841
type cmj_load_info = {
382842382842
cmj_table : t ;
382843-
cmj_path : path ;
382843+
package_path : path ;
382844382844
}
382845382845
end = struct
382846382846
#1 "js_cmj_format.ml"
@@ -383094,10 +383094,11 @@ let pp_cmj
383094383094
type path = string
383095383095
type cmj_load_info = {
383096383096
cmj_table : t ;
383097-
cmj_path : path
383097+
package_path : path
383098383098
(*
383099383099
Note it is the package path we want
383100-
for ES6_global
383100+
for ES6_global module spec
383101+
Maybe we can employ package map in the future
383101383102
*)
383102383103
}
383103383104
end
@@ -383558,7 +383559,7 @@ let find_cmj_exn file : Js_cmj_format.cmj_load_info =
383558383559
match Builtin_cmj_datasets.query_by_name target with
383559383560
| Some v
383560383561
->
383561-
{cmj_path = "BROWSER"; cmj_table = v}
383562+
{package_path = "BROWSER"; cmj_table = v}
383562383563
| None
383563383564
->
383564383565
Bs_exception.error (Cmj_not_found file)
@@ -388870,8 +388871,8 @@ let get_package_path_from_cmj
388870388871
( id : Lam_module_ident.t)
388871388872
=
388872388873
match Lam_module_ident.Hash.find_opt cached_tbl id with
388873-
| Some (Ml {cmj_table ; cmj_path}) ->
388874-
(cmj_path,
388874+
| Some (Ml {cmj_table ; package_path}) ->
388875+
(package_path,
388875388876
Js_cmj_format.get_npm_package_path cmj_table,
388876388877
Js_cmj_format.get_cmj_case cmj_table )
388877388878
| Some External ->
@@ -388888,7 +388889,7 @@ let get_package_path_from_cmj
388888388889
Js_cmj_load.find_cmj_exn (Lam_module_ident.name id ^ Literals.suffix_cmj) in
388889388890
let cmj_table = cmj_load_info.cmj_table in
388890388891
id +> Ml cmj_load_info;
388891-
(cmj_load_info.cmj_path,
388892+
(cmj_load_info.package_path,
388892388893
Js_cmj_format.get_npm_package_path cmj_table,
388893388894
Js_cmj_format.get_cmj_case cmj_table )
388894388895
end
@@ -389089,7 +389090,7 @@ let string_of_module_id
389089389090
module_system
389090389091
in
389091389092
match Lam_compile_env.get_package_path_from_cmj dep_module_id with
389092-
| (cmj_path, dep_package_info, little) ->
389093+
| (package_path, dep_package_info, little) ->
389093389094
let js_file = Ext_namespace.js_name_of_modulename dep_module_id.id.name little in
389094389095
let dep_info_query =
389095389096
Js_packages_info.query_package_infos dep_package_info module_system
@@ -389125,11 +389126,7 @@ let string_of_module_id
389125389126

389126389127
(** Note we did a post-processing when working on Windows *)
389127389128
| Es6_global
389128-
->
389129-
(** lib/ocaml/xx.cmj --
389130-
HACKING: FIXME
389131-
maybe we can caching relative package path calculation or employ package map *)
389132-
(* assert false *)
389129+
->
389133389130

389134389131
begin
389135389132
Ext_path.rel_normalized_absolute_path
@@ -389139,8 +389136,7 @@ let string_of_module_id
389139389136
~package_dir:(Lazy.force Ext_path.package_dir)
389140389137
module_system
389141389138
)
389142-
((Filename.dirname
389143-
(Filename.dirname (Filename.dirname cmj_path))) // dep_pkg.rel_path // js_file)
389139+
(package_path // dep_pkg.rel_path // js_file)
389144389140
end
389145389141
end
389146389142
| Package_script, Package_script

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -382840,7 +382840,7 @@ val pp_cmj: t -> unit
382840382840
type path = string
382841382841
type cmj_load_info = {
382842382842
cmj_table : t ;
382843-
cmj_path : path ;
382843+
package_path : path ;
382844382844
}
382845382845
end = struct
382846382846
#1 "js_cmj_format.ml"
@@ -383094,10 +383094,11 @@ let pp_cmj
383094383094
type path = string
383095383095
type cmj_load_info = {
383096383096
cmj_table : t ;
383097-
cmj_path : path
383097+
package_path : path
383098383098
(*
383099383099
Note it is the package path we want
383100-
for ES6_global
383100+
for ES6_global module spec
383101+
Maybe we can employ package map in the future
383101383102
*)
383102383103
}
383103383104
end
@@ -383558,7 +383559,7 @@ let find_cmj_exn file : Js_cmj_format.cmj_load_info =
383558383559
match Builtin_cmj_datasets.query_by_name target with
383559383560
| Some v
383560383561
->
383561-
{cmj_path = "BROWSER"; cmj_table = v}
383562+
{package_path = "BROWSER"; cmj_table = v}
383562383563
| None
383563383564
->
383564383565
Bs_exception.error (Cmj_not_found file)
@@ -388870,8 +388871,8 @@ let get_package_path_from_cmj
388870388871
( id : Lam_module_ident.t)
388871388872
=
388872388873
match Lam_module_ident.Hash.find_opt cached_tbl id with
388873-
| Some (Ml {cmj_table ; cmj_path}) ->
388874-
(cmj_path,
388874+
| Some (Ml {cmj_table ; package_path}) ->
388875+
(package_path,
388875388876
Js_cmj_format.get_npm_package_path cmj_table,
388876388877
Js_cmj_format.get_cmj_case cmj_table )
388877388878
| Some External ->
@@ -388888,7 +388889,7 @@ let get_package_path_from_cmj
388888388889
Js_cmj_load.find_cmj_exn (Lam_module_ident.name id ^ Literals.suffix_cmj) in
388889388890
let cmj_table = cmj_load_info.cmj_table in
388890388891
id +> Ml cmj_load_info;
388891-
(cmj_load_info.cmj_path,
388892+
(cmj_load_info.package_path,
388892388893
Js_cmj_format.get_npm_package_path cmj_table,
388893388894
Js_cmj_format.get_cmj_case cmj_table )
388894388895
end
@@ -389089,7 +389090,7 @@ let string_of_module_id
389089389090
module_system
389090389091
in
389091389092
match Lam_compile_env.get_package_path_from_cmj dep_module_id with
389092-
| (cmj_path, dep_package_info, little) ->
389093+
| (package_path, dep_package_info, little) ->
389093389094
let js_file = Ext_namespace.js_name_of_modulename dep_module_id.id.name little in
389094389095
let dep_info_query =
389095389096
Js_packages_info.query_package_infos dep_package_info module_system
@@ -389125,11 +389126,7 @@ let string_of_module_id
389125389126

389126389127
(** Note we did a post-processing when working on Windows *)
389127389128
| Es6_global
389128-
->
389129-
(** lib/ocaml/xx.cmj --
389130-
HACKING: FIXME
389131-
maybe we can caching relative package path calculation or employ package map *)
389132-
(* assert false *)
389129+
->
389133389130

389134389131
begin
389135389132
Ext_path.rel_normalized_absolute_path
@@ -389139,8 +389136,7 @@ let string_of_module_id
389139389136
~package_dir:(Lazy.force Ext_path.package_dir)
389140389137
module_system
389141389138
)
389142-
((Filename.dirname
389143-
(Filename.dirname (Filename.dirname cmj_path))) // dep_pkg.rel_path // js_file)
389139+
(package_path // dep_pkg.rel_path // js_file)
389144389140
end
389145389141
end
389146389142
| Package_script, Package_script

lib/4.06.1/whole_compiler.ml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86889,7 +86889,7 @@ val pp_cmj: t -> unit
8688986889
type path = string
8689086890
type cmj_load_info = {
8689186891
cmj_table : t ;
86892-
cmj_path : path ;
86892+
package_path : path ;
8689386893
}
8689486894
end = struct
8689586895
#1 "js_cmj_format.ml"
@@ -87143,10 +87143,11 @@ let pp_cmj
8714387143
type path = string
8714487144
type cmj_load_info = {
8714587145
cmj_table : t ;
87146-
cmj_path : path
87146+
package_path : path
8714787147
(*
8714887148
Note it is the package path we want
87149-
for ES6_global
87149+
for ES6_global module spec
87150+
Maybe we can employ package map in the future
8715087151
*)
8715187152
}
8715287153
end
@@ -87323,7 +87324,10 @@ let find_cmj_exn file : Js_cmj_format.cmj_load_info =
8732387324
match Config_util.find_opt file with
8732487325
| Some f
8732587326
->
87326-
{cmj_path = f; cmj_table = Js_cmj_format.from_file f}
87327+
{package_path =
87328+
(** hacking relying on the convention of pkg/lib/ocaml/xx.cmj*)
87329+
Filename.dirname (Filename.dirname (Filename.dirname f));
87330+
cmj_table = Js_cmj_format.from_file f}
8732787331
| None ->
8732887332
(* ONLY read the stored cmj data in browser environment *)
8732987333
Bs_exception.error (Cmj_not_found file)
@@ -95121,8 +95125,8 @@ let get_package_path_from_cmj
9512195125
( id : Lam_module_ident.t)
9512295126
=
9512395127
match Lam_module_ident.Hash.find_opt cached_tbl id with
95124-
| Some (Ml {cmj_table ; cmj_path}) ->
95125-
(cmj_path,
95128+
| Some (Ml {cmj_table ; package_path}) ->
95129+
(package_path,
9512695130
Js_cmj_format.get_npm_package_path cmj_table,
9512795131
Js_cmj_format.get_cmj_case cmj_table )
9512895132
| Some External ->
@@ -95139,7 +95143,7 @@ let get_package_path_from_cmj
9513995143
Js_cmj_load.find_cmj_exn (Lam_module_ident.name id ^ Literals.suffix_cmj) in
9514095144
let cmj_table = cmj_load_info.cmj_table in
9514195145
id +> Ml cmj_load_info;
95142-
(cmj_load_info.cmj_path,
95146+
(cmj_load_info.package_path,
9514395147
Js_cmj_format.get_npm_package_path cmj_table,
9514495148
Js_cmj_format.get_cmj_case cmj_table )
9514595149
end
@@ -101435,7 +101439,7 @@ let string_of_module_id
101435101439
module_system
101436101440
in
101437101441
match Lam_compile_env.get_package_path_from_cmj dep_module_id with
101438-
| (cmj_path, dep_package_info, little) ->
101442+
| (package_path, dep_package_info, little) ->
101439101443
let js_file = Ext_namespace.js_name_of_modulename dep_module_id.id.name little in
101440101444
let dep_info_query =
101441101445
Js_packages_info.query_package_infos dep_package_info module_system
@@ -101472,10 +101476,7 @@ let string_of_module_id
101472101476
(** Note we did a post-processing when working on Windows *)
101473101477
| Es6_global
101474101478
->
101475-
(** lib/ocaml/xx.cmj --
101476-
HACKING: FIXME
101477-
maybe we can caching relative package path calculation or employ package map *)
101478-
(* assert false *)
101479+
101479101480

101480101481
begin
101481101482
Ext_path.rel_normalized_absolute_path
@@ -101485,8 +101486,7 @@ let string_of_module_id
101485101486
~package_dir:(Lazy.force Ext_path.package_dir)
101486101487
module_system
101487101488
)
101488-
((Filename.dirname
101489-
(Filename.dirname (Filename.dirname cmj_path))) // dep_pkg.rel_path // js_file)
101489+
(package_path // dep_pkg.rel_path // js_file)
101490101490
end
101491101491
end
101492101492
| Package_script, Package_script

0 commit comments

Comments
 (0)