Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
283 changes: 164 additions & 119 deletions esy.lock/index.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion esy.lock/opam/ocamlformat.0.24.1/opam

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion esy.lock/opam/ppx_bench.v0.15.0/opam

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion esy.lock/opam/ppx_inline_test.v0.15.0/opam

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 0 additions & 63 deletions esy.lock/opam/ppxlib.0.27.0/opam

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@davesnx/styled-ppx",
"version": "0.34.0",
"version": "0.34.1",
"description": "Typed styled components in ReScript",
"author": "David Sancho <dsnxmoreno@gmail.com>",
"license": "MIT",
Expand Down Expand Up @@ -31,15 +31,17 @@
"@opam/ocaml-migrate-parsetree": "2.4.0",
"@opam/ocamlformat": "0.24.1",
"@opam/ppx_deriving": "5.2.1",
"@opam/ppxlib": "0.27.0",
"@opam/ppxlib": "*",
"@opam/reason": "3.8.1",
"@opam/sedlex": "3.0",
"@opam/patdiff": "v0.15.0",
"@opam/utop": "2.10.0",
"ocaml": "4.14.0"
},
"resolutions": {
"@opam/ppxlib": "zth/ppxlib:ppxlib.opam#32f83395fb89693a873541298b6367449f23bc4a"
},
"scripts": {
"scripts": "jq .scripts package.json",
"test_typecheck": "esy dune build @native_typecheck_test",
"test_css_support": "esy dune build @css_support_test",
"test_ppx_snapshot": "esy dune build @ppx_snapshot_test",
Expand Down
4 changes: 3 additions & 1 deletion packages/demo/rescript/src/index.res
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ switch ReactDOM.querySelector("#app") {
<div className />
<Dynamic a="23" />
<Component> {React.string("test..")} </Component>
<App2> <Component> {React.string("Demo of...")} </Component> </App2>
<App2>
<Component> {React.string("Demo of...")} </Component>
</App2>
<Link href="https://github.com/davesnx/styled-ppx"> {React.string("styled-ppx")} </Link>
<Link href="https://github.com/davesnx/styled-ppx"> {React.string("styled-ppx")} </Link>
<Link href="https://github.com/davesnx/styled-ppx"> {React.string("styled-ppx")} </Link>
Expand Down
6 changes: 2 additions & 4 deletions packages/ppx/src/declarations_to_emotion.re
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Helper = Ast_helper;
module Builder = Ppxlib.Ast_builder.Default;
module Types = Parser.Types;

module Option ={
module Option = {
include Option;

let mapWithDefault = (f, default, opt) => {
Expand All @@ -14,7 +14,7 @@ module Option ={
| None => default
};
};
}
};

let txt = (~loc, txt) => {Location.loc: loc, txt};

Expand Down Expand Up @@ -835,8 +835,6 @@ let render_color = (~loc, value) => switch (value: Types.color) {
| `Deprecated_system_color(_) => raise(Unsupported_feature)
};

/* and color = [%value.rec "<rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | 'currentColor' | <deprecated-system-color> | <interpolation> | <var()>"] */

let color = apply(Parser.property_color, (~loc) => [%expr CssJs.color], render_color);
let opacity =
apply(
Expand Down
17 changes: 17 additions & 0 deletions packages/ppx/src/file.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
type extension = Reason | OCaml | ReScript;

let detectFileSuffix = (path): result(extension, string) => {
switch (Filename.extension(path)) {
| "res" => Ok(ReScript)
| "re" => Ok(Reason)
| "ml" => Ok(OCaml)
| _ => Ok(Reason)
}
};

let detectExtension = (path) => {
switch (detectFileSuffix(path)) {
| Ok(extension) => extension
| Error(e) => failwith(e)
}
};
4 changes: 2 additions & 2 deletions packages/ppx/src/main.re
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,8 @@ Driver.register_transformation(
we rely on this order in native tests */
~instrument=Driver.Instrument.make(~position=Before, traverser#structure),
~rules=[
/* %cx without let binding */
/* which doesn't have CssJs.label */
/* %cx without let binding, it doesn't have CssJs.label
%cx is defined in traverser#structure */
Context_free.Rule.extension(
Extension.declare(
"cx",
Expand Down