Skip to content

Commit

Permalink
Update quickjs to 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
davesnx committed Jul 23, 2024
1 parent 11cd14e commit ee0f34b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changes

## 0.3.1
* Update quickjs dependency to 0.1.2 by @davesnx

## 0.3.0

* browser-ppx: process stritems by @jchavarri in https://github.com/ml-in-barcelona/server-reason-react/pull/127
Expand Down
2 changes: 2 additions & 0 deletions demo/server/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
(name server)
(enabled_if
(= %{profile} "dev"))
(flags :standard -w -26-27) ; browser_only removes code form the server, making this warning necessary
(libraries
tiny_httpd
tiny_httpd.core
tiny_httpd.unix
shared_native
react
reactDOM
Expand Down
6 changes: 3 additions & 3 deletions demo/server/server.re
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
*/
module Httpd = Tiny_httpd;
module Httpd_dir = Tiny_httpd_dir;
module Httpd_dir = Tiny_httpd.Dir;

module Link = {
[@react.component]
let make = (~href, ~children) => {
let (useState, setState) = React.useState(() => false);
let (state, setState) = React.useState(() => false);

React.useEffect0(() => {
setState(_prev => !useState);
setState(_prev => !state);

None;
});
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

; Library dependencies
(ppxlib (> 0.23.0))
(quickjs (>= 0.1.1))
(quickjs (>= 0.1.2))
(promise (>= 1.1.2))
(lwt (>= 5.6.0))
(lwt_ppx (>= 2.1.0))
Expand Down
12 changes: 10 additions & 2 deletions packages/melange.js/Js.ml
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,18 @@ end = struct
let index : result -> int = Quickjs.RegExp.index
let input : result -> string = Quickjs.RegExp.input
let source : t -> string = Quickjs.RegExp.source
let fromString : string -> t = fun str -> Quickjs.RegExp.compile str ""

let fromString : string -> t =
fun str ->
match Quickjs.RegExp.compile str ~flags:"" with
| Ok regex -> regex
| Error (_, msg) -> raise (Invalid_argument msg)

let fromStringWithFlags : string -> flags:string -> t =
fun str ~flags -> Quickjs.RegExp.compile str flags
fun str ~flags ->
match Quickjs.RegExp.compile str ~flags with
| Ok regex -> regex
| Error (_, msg) -> raise (Invalid_argument msg)

let flags : t -> string = fun regexp -> Quickjs.RegExp.flags regexp
let global : t -> bool = fun regexp -> Quickjs.RegExp.global regexp
Expand Down
2 changes: 1 addition & 1 deletion server-reason-react.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ depends: [
"reason" {>= "3.10.0"}
"melange" {>= "3.0.0"}
"ppxlib" {> "0.23.0"}
"quickjs" {>= "0.1.1"}
"quickjs" {>= "0.1.2"}
"promise" {>= "1.1.2"}
"lwt" {>= "5.6.0"}
"lwt_ppx" {>= "2.1.0"}
Expand Down

0 comments on commit ee0f34b

Please sign in to comment.