liquidsoap-prettier 1.4.7 → 1.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,17 +1,12 @@
1
1
  {
2
2
  "name": "liquidsoap-prettier",
3
- "version": "1.4.7",
3
+ "version": "1.4.9",
4
4
  "description": "Liquidsoap language prettier CLI and plugin",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "bin": {
8
8
  "liquidsoap-prettier": "src/cli.js"
9
9
  },
10
- "scripts": {
11
- "build:web": "webpack --config webpack.web.cjs",
12
- "release": "dune build && npm run build:web && npm publish",
13
- "liquidsoap-prettier": "node ./src/cli.js"
14
- },
15
10
  "prettier": {
16
11
  "plugins": [
17
12
  "./src/index.js"
@@ -28,5 +23,10 @@
28
23
  "devDependencies": {
29
24
  "webpack": "^5.89.0",
30
25
  "webpack-cli": "^5.1.4"
26
+ },
27
+ "scripts": {
28
+ "build:web": "webpack --config webpack.web.cjs",
29
+ "release": "dune build && npm run build:web && npm publish",
30
+ "liquidsoap-prettier": "node ./src/cli.js"
31
31
  }
32
- }
32
+ }
package/src/dune CHANGED
@@ -2,7 +2,7 @@
2
2
  (name liquidsoap_js)
3
3
  (optional)
4
4
  (modes js)
5
- (modules regexp_js liquidsoap_js)
5
+ (modules liquidsoap_js)
6
6
  (preprocess
7
7
  (pps js_of_ocaml-ppx))
8
8
  (js_of_ocaml
package/src/index.js CHANGED
@@ -666,10 +666,10 @@ const print = (path, options, print) => {
666
666
  return [print("left"), "-", print("right")];
667
667
  case "time":
668
668
  return [
669
- ...(node.week ? ["" + node.week, "w"] : []),
670
- ...(node.hours ? ["" + node.hours, "h"] : []),
671
- ...(node.minutes ? ["" + node.minutes, "m"] : []),
672
- ...(node.second ? ["" + node.seconds, "s"] : []),
669
+ ...(typeof node.week === "number" ? ["" + node.week, "w"] : []),
670
+ ...(typeof node.hours === "number" ? ["" + node.hours, "h"] : []),
671
+ ...(typeof node.minutes === "number" ? ["" + node.minutes, "m"] : []),
672
+ ...(typeof node.second === "number" ? ["" + node.seconds, "s"] : []),
673
673
  ];
674
674
  case "encoder":
675
675
  return [
@@ -1,7 +1,4 @@
1
1
  open Js_of_ocaml
2
- open Liquidsoap_lang
3
-
4
- let () = Hooks.regexp := Regexp_js.make
5
2
 
6
3
  let parse content =
7
4
  let content = Js.to_string content in
package/src/regexp_js.ml DELETED
@@ -1,57 +0,0 @@
1
- open Js_of_ocaml
2
-
3
- type sub = Liquidsoap_lang.Regexp.sub = {
4
- matches : string option list;
5
- groups : (string * string) list;
6
- }
7
-
8
- class type match_result =
9
- object
10
- inherit Js.match_result
11
- method groups : Js.Unsafe.any Js.optdef Js.readonly_prop
12
- end
13
-
14
- let string_of_flag = function `i -> "i" | `g -> "g" | `s -> "s" | `m -> "m"
15
-
16
- let flags_of_flags flags =
17
- Js.string (String.concat "" (List.map string_of_flag flags))
18
-
19
- let make ?(flags = []) s =
20
- let rex = new%js Js.regExp_withFlags (Js.string s) (flags_of_flags flags) in
21
- object
22
- method split s =
23
- let split = (Js.string s)##split_regExp rex in
24
- let split = Js.str_array split in
25
- Array.to_list (Array.map Js.to_string (Js.to_array split))
26
-
27
- method exec s =
28
- let s = Js.string s in
29
- let ret =
30
- Js.Opt.case (rex##exec s) (fun () -> raise Not_found) (fun x -> x)
31
- in
32
- let sub : match_result Js.t = Js.Unsafe.coerce (Js.match_result ret) in
33
- let matches =
34
- List.init sub##.length (fun pos ->
35
- Option.map Js.to_string (Js.Optdef.to_option (Js.array_get sub pos)))
36
- in
37
- let groups =
38
- Js.Optdef.case sub##.groups
39
- (fun () -> [])
40
- (fun groups ->
41
- let names = Js.to_array (Js.object_keys groups) in
42
- Array.fold_left
43
- (fun cur key ->
44
- Js.Optdef.case (Js.Unsafe.get groups key)
45
- (fun () -> cur)
46
- (fun value -> (Js.to_string key, Js.to_string value) :: cur))
47
- [] names)
48
- in
49
- { matches; groups }
50
-
51
- method test s = Js.to_bool (rex##test (Js.string s))
52
-
53
- method substitute ~subst s =
54
- let subst a = Js.string (subst (Js.to_string a)) in
55
- let subst = Js.wrap_callback subst in
56
- Js.to_string ((Js.Unsafe.coerce (Js.string s))##replace rex subst)
57
- end
package/src/regexp_js.mli DELETED
@@ -1,4 +0,0 @@
1
- val make :
2
- ?flags:Liquidsoap_lang.Regexp.flag list ->
3
- string ->
4
- Liquidsoap_lang.Regexp.regexp