File tree Expand file tree Collapse file tree 3 files changed +36
-39
lines changed Expand file tree Collapse file tree 3 files changed +36
-39
lines changed Original file line number Diff line number Diff line change @@ -92,20 +92,19 @@ let custom_resolution = lazy
92
92
| exception Not_found -> false
93
93
| "true" -> true
94
94
| _ -> false )
95
-
96
95
97
- let regex_at = Str. regexp " @ "
98
- let regex_unders = Str. regexp " _+ "
99
- let regex_slash = Str. regexp " \\ / "
100
- let regex_dot = Str. regexp " \\ . "
101
- let regex_hyphen = Str. regexp " - "
102
- let pkg_name_as_variable pkg =
103
- Bsb_pkg_types. to_string pkg
104
- |> Str. replace_first regex_at " "
105
- |> Str. global_replace regex_unders " \\ 0_ "
106
- |> Str. global_replace regex_slash " __slash__ "
107
- |> Str. global_replace regex_dot " __dot__ "
108
- |> Str. global_replace regex_hyphen " _"
96
+ let pkg_name_as_variable package =
97
+ Bsb_pkg_types. to_string package
98
+ |> fun s -> Ext_string. split s '@'
99
+ |> String. concat " "
100
+ |> fun s -> Ext_string. split s '_'
101
+ |> String. concat " __ "
102
+ |> fun s -> Ext_string. split s '/'
103
+ |> String. concat " __slash__ "
104
+ |> fun s -> Ext_string. split s '.'
105
+ |> String. concat " __dot__ "
106
+ |> fun s -> Ext_string. split s '-'
107
+ |> String. concat " _"
109
108
110
109
(* * TODO: collect all warnings and print later *)
111
110
let resolve_bs_package ~cwd (package : t ) =
Original file line number Diff line number Diff line change @@ -8558,20 +8558,19 @@ let custom_resolution = lazy
8558
8558
| exception Not_found -> false
8559
8559
| "true" -> true
8560
8560
| _ -> false)
8561
-
8562
8561
8563
- let regex_at = Str.regexp "@"
8564
- let regex_unders = Str.regexp "_+"
8565
- let regex_slash = Str.regexp "\\/"
8566
- let regex_dot = Str.regexp "\\. "
8567
- let regex_hyphen = Str.regexp "-"
8568
- let pkg_name_as_variable pkg =
8569
- Bsb_pkg_types.to_string pkg
8570
- |> Str.replace_first regex_at " "
8571
- |> Str.global_replace regex_unders "\\0_"
8572
- |> Str.global_replace regex_slash "__slash__ "
8573
- |> Str.global_replace regex_dot "__dot__"
8574
- |> Str.global_replace regex_hyphen "_"
8562
+ let pkg_name_as_variable package =
8563
+ Bsb_pkg_types.to_string package
8564
+ |> fun s -> Ext_string.split s '@'
8565
+ |> String.concat " "
8566
+ |> fun s -> Ext_string.split s '_'
8567
+ |> String.concat "__"
8568
+ |> fun s -> Ext_string.split s '/'
8569
+ |> String.concat "__slash__ "
8570
+ |> fun s -> Ext_string.split s '.'
8571
+ |> String.concat "__dot__ "
8572
+ |> fun s -> Ext_string.split s '-'
8573
+ |> String.concat "_"
8575
8574
8576
8575
(** TODO: collect all warnings and print later *)
8577
8576
let resolve_bs_package ~cwd (package : t) =
Original file line number Diff line number Diff line change @@ -8528,20 +8528,19 @@ let custom_resolution = lazy
8528
8528
| exception Not_found -> false
8529
8529
| "true" -> true
8530
8530
| _ -> false)
8531
-
8532
8531
8533
- let regex_at = Str.regexp "@"
8534
- let regex_unders = Str.regexp "_+"
8535
- let regex_slash = Str.regexp "\\/"
8536
- let regex_dot = Str.regexp "\\. "
8537
- let regex_hyphen = Str.regexp "-"
8538
- let pkg_name_as_variable pkg =
8539
- Bsb_pkg_types.to_string pkg
8540
- |> Str.replace_first regex_at " "
8541
- |> Str.global_replace regex_unders "\\0_"
8542
- |> Str.global_replace regex_slash "__slash__ "
8543
- |> Str.global_replace regex_dot "__dot__"
8544
- |> Str.global_replace regex_hyphen "_"
8532
+ let pkg_name_as_variable package =
8533
+ Bsb_pkg_types.to_string package
8534
+ |> fun s -> Ext_string.split s '@'
8535
+ |> String.concat " "
8536
+ |> fun s -> Ext_string.split s '_'
8537
+ |> String.concat "__"
8538
+ |> fun s -> Ext_string.split s '/'
8539
+ |> String.concat "__slash__ "
8540
+ |> fun s -> Ext_string.split s '.'
8541
+ |> String.concat "__dot__ "
8542
+ |> fun s -> Ext_string.split s '-'
8543
+ |> String.concat "_"
8545
8544
8546
8545
(** TODO: collect all warnings and print later *)
8547
8546
let resolve_bs_package ~cwd (package : t) =
You can’t perform that action at this time.
0 commit comments