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/dist/liquidsoap.cjs +102604 -97961
- package/dist/web.mjs +1 -1
- package/package.json +7 -7
- package/src/dune +1 -1
- package/src/index.js +4 -4
- package/src/liquidsoap_js.ml +0 -3
- package/src/regexp_js.ml +0 -57
- package/src/regexp_js.mli +0 -4
package/package.json
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "liquidsoap-prettier",
|
|
3
|
-
"version": "1.4.
|
|
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
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 [
|
package/src/liquidsoap_js.ml
CHANGED
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