From ecac8edecef9078a89cffbe63092f0f2907cf95b Mon Sep 17 00:00:00 2001 From: Feihong Hsu Date: Wed, 30 Oct 2024 13:14:33 -0500 Subject: [PATCH] Upgrade to OCaml 5.2 (#518) * Add depext for @emotion/css >= 11.0.0 * Upgrade to ocaml 5.2 And fix tests that were broken by reason 3.13 refmt --- .github/workflows/ci.yml | 2 +- Makefile | 2 +- dune-project | 2 +- package-lock.json | 4 ++-- .../test/snapshots/Spec.expected.re | 16 +++++++++++++--- .../reason/reason-bs-config-missing-jsx.t/run.t | 5 ++++- .../snapshot/reason/reason-dynamic-array.t/run.t | 5 ++++- .../run.t | 5 ++++- .../reason/reason-dynamic-interpolation.t/run.t | 5 ++++- .../reason/reason-dynamic-sequence.t/run.t | 10 ++++++++-- .../reason/reason-dynamic-with-array.t/run.t | 5 ++++- .../reason/reason-dynamic-with-ident.t/run.t | 5 ++++- .../run.t | 5 ++++- .../test/snapshot/reason/reason-dynamic.t/run.t | 5 ++++- .../snapshot/reason/reason-keyframes.t/run.t | 5 ++++- .../run.t | 5 ++++- .../reason-media-queries-and-selectors.t/run.t | 5 ++++- .../reason-media-queries-with-calc.t/run.t | 5 ++++- .../snapshot/reason/reason-static-array.t/run.t | 5 ++++- .../reason-static-doble-quotes-string.t/run.t | 5 ++++- .../reason/reason-static-interpolation.t/run.t | 5 ++++- .../reason-static-multi-line-string.t/run.t | 5 ++++- .../reason/reason-static-open-property.t/run.t | 5 ++++- .../reason-static-self-closing-element.t/run.t | 5 ++++- styled-ppx.opam | 2 +- 25 files changed, 99 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28e6f0aee..f1a513ca7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: matrix: os: [ubuntu-20.04, macos-latest] # Missing windows-latest ocaml-compiler: - - 5.1.1 + - 5.2.0 runs-on: ${{ matrix.os }} diff --git a/Makefile b/Makefile index 0842ec873..82077cbcf 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ setup-githooks: ## Setup githooks .PHONY: create-switch create-switch: ## Create opam switch - opam switch create . 5.1.1 --deps-only --with-test --no-install + opam switch create . 5.2.0 --deps-only --with-test --no-install .PHONY: install install: ## Install project dependencies diff --git a/dune-project b/dune-project index 6008af8d0..731e69598 100644 --- a/dune-project +++ b/dune-project @@ -26,7 +26,7 @@ (description "styled-ppx is the ppx that brings styled components to ReScript and Melange, allowing you to create React Components with type-safe style definitions using CSS.") (depends - (ocaml (>= 5.1.0)) + (ocaml (>= 5.2.0)) (reason (>= 3.11.0)) (menhir (>= 20220210)) (ppx_deriving (>= 5.0)) diff --git a/package-lock.json b/package-lock.json index d02c11110..406086f71 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@davesnx/styled-ppx", - "version": "0.54.1", + "version": "0.56.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@davesnx/styled-ppx", - "version": "0.54.1", + "version": "0.56.0", "license": "BSD-2", "devDependencies": { "rescript": "10.1.4" diff --git a/packages/css-property-parser/test/snapshots/Spec.expected.re b/packages/css-property-parser/test/snapshots/Spec.expected.re index 79c1f93f3..a15e21ba6 100644 --- a/packages/css-property-parser/test/snapshots/Spec.expected.re +++ b/packages/css-property-parser/test/snapshots/Spec.expected.re @@ -67,9 +67,19 @@ module Types = { | `Rad(number) | `Turn(number) ] - and time = [ | `Ms(float) | `S(float)] - and frequency = [ | `Hz(float) | `KHz(float)] - and resolution = [ | `Dpi(float) | `Dpcm(float) | `Dppx(float)] + and time = [ + | `Ms(float) + | `S(float) + ] + and frequency = [ + | `Hz(float) + | `KHz(float) + ] + and resolution = [ + | `Dpi(float) + | `Dpcm(float) + | `Dppx(float) + ] and percentage = float and ident = string and custom_ident = string diff --git a/packages/ppx/test/snapshot/reason/reason-bs-config-missing-jsx.t/run.t b/packages/ppx/test/snapshot/reason/reason-bs-config-missing-jsx.t/run.t index e94b698c1..19a5f0687 100644 --- a/packages/ppx/test/snapshot/reason/reason-bs-config-missing-jsx.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-bs-config-missing-jsx.t/run.t @@ -983,7 +983,10 @@ let make = (props: makeProps('var)) => { let className = styles(~var=varGet(props), ()) ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "var")); ignore(deleteProp(. newProps, "innerRef")); diff --git a/packages/ppx/test/snapshot/reason/reason-dynamic-array.t/run.t b/packages/ppx/test/snapshot/reason/reason-dynamic-array.t/run.t index 10e5c79e4..f0ad9b912 100644 --- a/packages/ppx/test/snapshot/reason/reason-dynamic-array.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-dynamic-array.t/run.t @@ -975,7 +975,10 @@ let make = (props: makeProps('var)) => { let className = styles(~var=varGet(props), ()) ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "var")); ignore(deleteProp(. newProps, "innerRef")); diff --git a/packages/ppx/test/snapshot/reason/reason-dynamic-interpolation-default-value.t/run.t b/packages/ppx/test/snapshot/reason/reason-dynamic-interpolation-default-value.t/run.t index a21c6ac9d..281bb089e 100644 --- a/packages/ppx/test/snapshot/reason/reason-dynamic-interpolation-default-value.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-dynamic-interpolation-default-value.t/run.t @@ -973,7 +973,10 @@ let make = (props: makeProps('var)) => { let className = styles(~var=?varGet(props), ()) ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "var")); ignore(deleteProp(. newProps, "innerRef")); diff --git a/packages/ppx/test/snapshot/reason/reason-dynamic-interpolation.t/run.t b/packages/ppx/test/snapshot/reason/reason-dynamic-interpolation.t/run.t index b05097a67..4ac1cab0d 100644 --- a/packages/ppx/test/snapshot/reason/reason-dynamic-interpolation.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-dynamic-interpolation.t/run.t @@ -972,7 +972,10 @@ let make = (props: makeProps('var)) => { let className = styles(~var=varGet(props), ()) ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "var")); ignore(deleteProp(. newProps, "innerRef")); diff --git a/packages/ppx/test/snapshot/reason/reason-dynamic-sequence.t/run.t b/packages/ppx/test/snapshot/reason/reason-dynamic-sequence.t/run.t index 5111e645d..ffa426ce3 100644 --- a/packages/ppx/test/snapshot/reason/reason-dynamic-sequence.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-dynamic-sequence.t/run.t @@ -968,7 +968,10 @@ let make = (props: makeProps('size)) => { let className = styles(~size=sizeGet(props), ()) ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "size")); ignore(deleteProp(. newProps, "innerRef")); @@ -1957,7 +1960,10 @@ let className = styles(~variant=variantGet(props), ()) ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "variant")); ignore(deleteProp(. newProps, "innerRef")); diff --git a/packages/ppx/test/snapshot/reason/reason-dynamic-with-array.t/run.t b/packages/ppx/test/snapshot/reason/reason-dynamic-with-array.t/run.t index d4d1cc2aa..d34793100 100644 --- a/packages/ppx/test/snapshot/reason/reason-dynamic-with-array.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-dynamic-with-array.t/run.t @@ -974,7 +974,10 @@ let className = styles(~color=colorGet(props), ~size=sizeGet(props), ()) ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "color")); ignore(deleteProp(. newProps, "size")); diff --git a/packages/ppx/test/snapshot/reason/reason-dynamic-with-ident.t/run.t b/packages/ppx/test/snapshot/reason/reason-dynamic-with-ident.t/run.t index 586e3caf1..791e1e259 100644 --- a/packages/ppx/test/snapshot/reason/reason-dynamic-with-ident.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-dynamic-with-ident.t/run.t @@ -967,7 +967,10 @@ let make = (props: makeProps('a)) => { let className = styles(~a=aGet(props), ()) ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "a")); ignore(deleteProp(. newProps, "innerRef")); diff --git a/packages/ppx/test/snapshot/reason/reason-dynamic-with-sequence-out-scope.t/run.t b/packages/ppx/test/snapshot/reason/reason-dynamic-with-sequence-out-scope.t/run.t index 0d8146ba2..616072c78 100644 --- a/packages/ppx/test/snapshot/reason/reason-dynamic-with-sequence-out-scope.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-dynamic-with-sequence-out-scope.t/run.t @@ -972,7 +972,10 @@ let make = (props: makeProps('color)) => { let className = styles(~color=colorGet(props), ()) ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "color")); ignore(deleteProp(. newProps, "innerRef")); diff --git a/packages/ppx/test/snapshot/reason/reason-dynamic.t/run.t b/packages/ppx/test/snapshot/reason/reason-dynamic.t/run.t index 5ccf03d72..43ad8cffc 100644 --- a/packages/ppx/test/snapshot/reason/reason-dynamic.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-dynamic.t/run.t @@ -973,7 +973,10 @@ let className = styles(~id=idGet(props), ~var=varGet(props), ()) ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "id")); ignore(deleteProp(. newProps, "var")); diff --git a/packages/ppx/test/snapshot/reason/reason-keyframes.t/run.t b/packages/ppx/test/snapshot/reason/reason-keyframes.t/run.t index f7950a81d..88bee3ab0 100644 --- a/packages/ppx/test/snapshot/reason/reason-keyframes.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-keyframes.t/run.t @@ -971,7 +971,10 @@ CSS.style([|CSS.label("FadeIn"), CSS.animationName(animation)|]); let make = (props: makeProps) => { let className = styles ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "innerRef")); let asTag = as_Get(props); diff --git a/packages/ppx/test/snapshot/reason/reason-media-queries-and-selectors-interpolation.t/run.t b/packages/ppx/test/snapshot/reason/reason-media-queries-and-selectors-interpolation.t/run.t index 1eb09100f..37bc7f06f 100644 --- a/packages/ppx/test/snapshot/reason/reason-media-queries-and-selectors-interpolation.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-media-queries-and-selectors-interpolation.t/run.t @@ -980,7 +980,10 @@ |]); let make = (props: makeProps) => { let className = styles ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "innerRef")); let asTag = as_Get(props); diff --git a/packages/ppx/test/snapshot/reason/reason-media-queries-and-selectors.t/run.t b/packages/ppx/test/snapshot/reason/reason-media-queries-and-selectors.t/run.t index ad9f9c678..30f96abaa 100644 --- a/packages/ppx/test/snapshot/reason/reason-media-queries-and-selectors.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-media-queries-and-selectors.t/run.t @@ -977,7 +977,10 @@ |]); let make = (props: makeProps) => { let className = styles ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "innerRef")); let asTag = as_Get(props); diff --git a/packages/ppx/test/snapshot/reason/reason-media-queries-with-calc.t/run.t b/packages/ppx/test/snapshot/reason/reason-media-queries-with-calc.t/run.t index 97756d1ac..222f21d29 100644 --- a/packages/ppx/test/snapshot/reason/reason-media-queries-with-calc.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-media-queries-with-calc.t/run.t @@ -976,7 +976,10 @@ |]); let make = (props: makeProps) => { let className = styles ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "innerRef")); let asTag = as_Get(props); diff --git a/packages/ppx/test/snapshot/reason/reason-static-array.t/run.t b/packages/ppx/test/snapshot/reason/reason-static-array.t/run.t index e308343e8..8acc9b835 100644 --- a/packages/ppx/test/snapshot/reason/reason-static-array.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-static-array.t/run.t @@ -970,7 +970,10 @@ |]); let make = (props: makeProps) => { let className = styles ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "innerRef")); let asTag = as_Get(props); diff --git a/packages/ppx/test/snapshot/reason/reason-static-doble-quotes-string.t/run.t b/packages/ppx/test/snapshot/reason/reason-static-doble-quotes-string.t/run.t index 73c9ff2b0..d8f2cf328 100644 --- a/packages/ppx/test/snapshot/reason/reason-static-doble-quotes-string.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-static-doble-quotes-string.t/run.t @@ -970,7 +970,10 @@ |]); let make = (props: makeProps) => { let className = styles ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "innerRef")); let asTag = as_Get(props); diff --git a/packages/ppx/test/snapshot/reason/reason-static-interpolation.t/run.t b/packages/ppx/test/snapshot/reason/reason-static-interpolation.t/run.t index 24342d1b5..efd8284a3 100644 --- a/packages/ppx/test/snapshot/reason/reason-static-interpolation.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-static-interpolation.t/run.t @@ -979,7 +979,10 @@ |]); let make = (props: makeProps) => { let className = styles ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "innerRef")); let asTag = as_Get(props); diff --git a/packages/ppx/test/snapshot/reason/reason-static-multi-line-string.t/run.t b/packages/ppx/test/snapshot/reason/reason-static-multi-line-string.t/run.t index 171745e77..b034e31ef 100644 --- a/packages/ppx/test/snapshot/reason/reason-static-multi-line-string.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-static-multi-line-string.t/run.t @@ -970,7 +970,10 @@ |]); let make = (props: makeProps) => { let className = styles ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "innerRef")); let asTag = as_Get(props); diff --git a/packages/ppx/test/snapshot/reason/reason-static-open-property.t/run.t b/packages/ppx/test/snapshot/reason/reason-static-open-property.t/run.t index 4d2d00201..b10e71cae 100644 --- a/packages/ppx/test/snapshot/reason/reason-static-open-property.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-static-open-property.t/run.t @@ -966,7 +966,10 @@ CSS.style([|CSS.label("OneSingleProperty"), CSS.display(`block)|]); let make = (props: makeProps) => { let className = styles ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "innerRef")); let asTag = as_Get(props); diff --git a/packages/ppx/test/snapshot/reason/reason-static-self-closing-element.t/run.t b/packages/ppx/test/snapshot/reason/reason-static-self-closing-element.t/run.t index 12a31ca01..dab8107f2 100644 --- a/packages/ppx/test/snapshot/reason/reason-static-self-closing-element.t/run.t +++ b/packages/ppx/test/snapshot/reason/reason-static-self-closing-element.t/run.t @@ -965,7 +965,10 @@ let styles = CSS.style([|CSS.label("SelfClosingElement")|]); let make = (props: makeProps) => { let className = styles ++ getOrEmpty(classNameGet(props)); - let stylesObject = {"className": className, "ref": innerRefGet(props)}; + let stylesObject = { + "className": className, + "ref": innerRefGet(props), + }; let newProps = assign2(Js.Obj.empty(), Obj.magic(props), stylesObject); ignore(deleteProp(. newProps, "innerRef")); let asTag = as_Get(props); diff --git a/styled-ppx.opam b/styled-ppx.opam index b4a5b7e13..d2dd29dc1 100644 --- a/styled-ppx.opam +++ b/styled-ppx.opam @@ -10,7 +10,7 @@ homepage: "https://styled-ppx.vercel.app" bug-reports: "https://github.com/davesnx/styled-ppx/issues" depends: [ "dune" {>= "3.8"} - "ocaml" {>= "5.1.0"} + "ocaml" {>= "5.2.0"} "reason" {>= "3.11.0"} "menhir" {>= "20220210"} "ppx_deriving" {>= "5.0"}