Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0556030
Update ppxlib, and server-reason-react
davesnx Jan 14, 2026
31b44bd
Avoid running rescript tests
davesnx Jan 14, 2026
ec15432
Add space between switch branches?
davesnx Jan 14, 2026
6405f58
Format reason code
davesnx Jan 14, 2026
c86677b
Remove death code and update snapshot
davesnx Jan 14, 2026
300733f
Only format on 5.4.0
davesnx Jan 14, 2026
bc77400
Disable recript tests on CI
davesnx Jan 14, 2026
ca8721c
Update ocamlformat to 0.28.1 in .ocamlformat
davesnx Jan 14, 2026
1c0b708
Format Spec.expected.re snapshot
davesnx Jan 14, 2026
ccf1aff
Revert "Format Spec.expected.re snapshot"
davesnx Jan 14, 2026
da403ea
Disable formatting for snapshot test files
davesnx Jan 14, 2026
7215775
Remove ocamlformatignore
davesnx Jan 15, 2026
ac47664
Remove npm token
davesnx Jan 15, 2026
d1dc3d5
Add changes entry
davesnx Jan 15, 2026
9159bf7
ci: Remove registry-url
davesnx Jan 15, 2026
cc896c8
Use provenance
davesnx Jan 15, 2026
238f37a
Use provenance with token
davesnx Jan 15, 2026
23c7b2a
Env on each step, not global
davesnx Jan 15, 2026
c140b3a
DEBUG: Add OIDC instrumentation to diagnose publish failure
davesnx Jan 15, 2026
d4930ba
DEBUG: Add instrumentation for Hypothesis I/J - check _release/.npmrc…
davesnx Jan 15, 2026
b77c9b2
DEBUG: Hypothesis M - manually fetch OIDC token and set as npm auth
davesnx Jan 15, 2026
0b95bc4
FIX: Add newline before appending OIDC token to .npmrc
davesnx Jan 15, 2026
a75e7e7
DEBUG: Hypothesis N - let npm handle OIDC auth internally with --prov…
davesnx Jan 15, 2026
9ad1d53
Cosmetic change in CHANGES to trigger CI
davesnx Jan 15, 2026
9062b1e
FIX: Remove registry-url from setup-node - it conflicts with OIDC tru…
davesnx Jan 15, 2026
192e15a
FIX: Use Node.js 24 for npm >= 11.5.1 (required for OIDC trusted publ…
davesnx Jan 15, 2026
6e2141b
Cleanup: Remove debug instrumentation from npm OIDC publishing
davesnx Jan 16, 2026
ec58183
Replace mshick/add-pr-comment with github-script for PR comments
davesnx Jan 16, 2026
d91c989
FIX: Add pull-requests:write permission for PR comments
davesnx Jan 16, 2026
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
16 changes: 9 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
os: [ubuntu-latest, macos-latest] # windows-latest
ocaml-compiler:
- 4.14.1
- 5.2.0
- 5.4.0

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -96,6 +96,7 @@ jobs:
run: make test

- name: Format
if: matrix.ocaml-compiler == '5.4.0'
run: make format-check

- name: Release static
Expand Down Expand Up @@ -132,14 +133,17 @@ jobs:
path: node_modules
key: npm-${{ matrix.os }}-${{ hashFiles('package.json') }}

- name: Run demo tests
run: make test-demo
# - name: Run demo tests
# run: make test-demo

publish:
name: Publish
needs: build
if: github.repository_owner == 'davesnx'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -183,10 +187,9 @@ jobs:
id: nightly
working-directory: ./_release
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
NPM_CONFIG_PROVENANCE: true
run: |
ls -lhsa
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm config set scope "@davesnx"
npm version prerelease --preid ${{ steps.sha.outputs.sha_short }} -no-git-tag-version
npm publish --access public --tag nightly
Expand All @@ -196,9 +199,8 @@ jobs:
if: ${{ success() && github.event_name != 'pull_request' }}
working-directory: ./_release
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
NPM_CONFIG_PROVENANCE: true
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm config set scope "@davesnx"
REMOTE=$(npm view @davesnx/styled-ppx version)
CURRENT=$(jq -r '.version' package.json)
Expand Down
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=0.27.0
version=0.28.1
quiet=true
profile=default

Expand Down
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changes

- [BREAKING] Update to ppxlib.0.36

## 0.60.0
- [BREAKING] Transition property on `CSS.Transition.shorthand` function is now an optional argument (#499) (@zakybilfagih)
- [BREAKING] `CSS.gridTemplateColumns`, `CSS.gridTemplateRows`, `CSS.gridAutoColumns`, `CSS.gridAutoRows` now accepts `` `value of Track.t array `` (#502) (@zakybilfagih)
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ setup-githooks: ## Setup githooks

.PHONY: create-switch
create-switch: ## Create opam switch
opam switch create . 5.2.0 --deps-only --with-test --no-install
opam switch create . 5.4.0 --deps-only --with-test --no-install

.PHONY: install
install: ## Install project dependencies
Expand All @@ -66,7 +66,9 @@ release-static:

# Testing commands

TEST_TARGETS := test-parser test-css-property-parser test-ppx-native test-ppx-snapshot-reason test-ppx-snapshot-rescript test-css-support test-css-spec-types test-runtime test-murmur2 test-css-spec-parser test-string-interpolation
TEST_TARGETS := test-parser test-css-property-parser test-ppx-native test-ppx-snapshot-reason test-css-support test-css-spec-types test-runtime test-murmur2 test-css-spec-parser test-string-interpolation

# test-ppx-snapshot-rescript

# Create targets with the format "test-{{target_name}}-{{ "watch" | "promote" }}"
define create-test
Expand Down
4 changes: 2 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
(menhir (>= 20220210))
(ppx_deriving (>= 5.0))
(ppx_deriving_yojson (>= 3.7.0))
(ppxlib (and (>= 0.27.0) (<= 0.34.0)))
(ppxlib (>= 0.36.0))
(sedlex (>= 3.5))
(melange (>= 3.0.0))
(server-reason-react (>= 0.3.1))
(server-reason-react (>= 0.4.1))
(reason-react (>= 0.14.0))
(alcotest :with-test)
(conf-npm :with-test)
Expand Down
2 changes: 1 addition & 1 deletion packages/css-property-parser/lib/Parser.re
Original file line number Diff line number Diff line change
Expand Up @@ -1962,7 +1962,7 @@ let apply_parser = (parser, tokens_with_loc) => {

let tokens =
tokens_with_loc
|> List.map(({txt, _}) =>
|> List.map(({ txt, _ }) =>
switch (txt) {
| Ok(token) => token
| Error((token, _)) => token
Expand Down
7 changes: 4 additions & 3 deletions packages/css-property-parser/lib/Rule.re
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ module Data = {
: f(`Right(right_data), right_tokens);
};
let bind_shortest: best('a, data('a), 'b, data('b), 'c) =
((left, right), f) => bind_shortest_or_longest(true, (left, right), f);
((left, right), f) =>
bind_shortest_or_longest(true, (left, right), f);
let bind_longest: best('a, data('a), 'b, data('b), 'c) =
((left, right), f) =>
bind_shortest_or_longest(false, (left, right), f);
((left, right), f) =>
bind_shortest_or_longest(false, (left, right), f);
};

// monad when match is successful
Expand Down
6 changes: 3 additions & 3 deletions packages/css-property-parser/ppx/Css_property_parser_ppx.re
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,20 @@ let valueRecExtension =

let is_structure_item_recursive =
fun
| {pstr_desc: Pstr_value(Recursive, _), pstr_loc: _loc} => true
| { pstr_desc: Pstr_value(Recursive, _), pstr_loc: _loc } => true
| _ => false;

let is_open =
fun
| {pstr_desc: Pstr_open(_), pstr_loc: _loc} => true
| { pstr_desc: Pstr_open(_), pstr_loc: _loc } => true
| _ => false;

let preprocess_impl = structure_items => {
let (bindings, rest) =
List.partition(is_structure_item_recursive, structure_items);

switch (bindings) {
| [{pstr_desc: Pstr_value(_, value_binding), pstr_loc, _}] =>
| [{ pstr_desc: Pstr_value(_, value_binding), pstr_loc, _ }] =>
module Ast_builder =
Ppxlib.Ast_builder.Make({
let loc = pstr_loc;
Expand Down
73 changes: 36 additions & 37 deletions packages/css-property-parser/ppx/Generate.re
Original file line number Diff line number Diff line change
Expand Up @@ -202,41 +202,40 @@ module Make = (Builder: Ppxlib.Ast_builder.S) => {
}

and combinator_op: (combinator, list(value)) => Parsetree.core_type =
(kind, values) => {
switch (kind) {
| Xor =>
let names = variant_names(values);
let pairs = List.combine(names, values);
let types =
List.map(
((type_name, value)) =>
switch (value) {
| Terminal(kind, multiplier) =>
terminal_xor_op(type_name, kind, multiplier)
| Function_call(name, value) =>
let name =
first_uppercase(name) |> kebab_case_to_snake_case;
let type_ = function_call(name, value);
make_variant_branch(type_name, false, [type_]);
| Combinator(kind, values) =>
let type_ = combinator_op(kind, values);
make_variant_branch(type_name, false, [type_]);
| Group(value, multiplier) =>
let type_ = group_op(value, multiplier);
make_variant_branch(type_name, false, [type_]);
},
pairs,
);
ptyp_variant(types, Closed, None);
| Static
| And => ptyp_tuple(List.map(create_type, values))
| Or =>
let types =
List.map(create_type, values)
|> List.map(apply_modifier(Optional));
ptyp_tuple(types);
};
}
(kind, values) => {
switch (kind) {
| Xor =>
let names = variant_names(values);
let pairs = List.combine(names, values);
let types =
List.map(
((type_name, value)) =>
switch (value) {
| Terminal(kind, multiplier) =>
terminal_xor_op(type_name, kind, multiplier)
| Function_call(name, value) =>
let name = first_uppercase(name) |> kebab_case_to_snake_case;
let type_ = function_call(name, value);
make_variant_branch(type_name, false, [type_]);
| Combinator(kind, values) =>
let type_ = combinator_op(kind, values);
make_variant_branch(type_name, false, [type_]);
| Group(value, multiplier) =>
let type_ = group_op(value, multiplier);
make_variant_branch(type_name, false, [type_]);
},
pairs,
);
ptyp_variant(types, Closed, None);
| Static
| And => ptyp_tuple(List.map(create_type, values))
| Or =>
let types =
List.map(create_type, values)
|> List.map(apply_modifier(Optional));
ptyp_tuple(types);
};
}

and function_call = (_name, value) => create_type(value)

Expand Down Expand Up @@ -379,7 +378,7 @@ module Make = (Builder: Ppxlib.Ast_builder.S) => {
let (name, payload) =
switch (binding) {
| {
pvb_pat: {ppat_desc: Ppat_var({txt, _}), _},
pvb_pat: { ppat_desc: Ppat_var({ txt, _ }), _ },
pvb_expr:
{
pexp_desc:
Expand Down Expand Up @@ -457,7 +456,7 @@ module Make = (Builder: Ppxlib.Ast_builder.S) => {

let get_name_from_binding = (binding: Parsetree.value_binding) => {
switch (binding) {
| {pvb_pat: {ppat_desc: Ppat_var({txt, _}), _}, _} => Some(txt)
| { pvb_pat: { ppat_desc: Ppat_var({ txt, _ }), _ }, _ } => Some(txt)
| _ => None
};
};
Expand Down
4 changes: 4 additions & 0 deletions packages/css-property-parser/test/snapshots/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
(env
(_
(formatting disabled)))

(executable
(name Standalone)
(libraries reason_css_parser_ppx ppxlib))
Expand Down
8 changes: 4 additions & 4 deletions packages/css-spec-parser/lib/Ast.re
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// TODO: maybe polymorphic variant?
// TODO: best naming to no multiplier
// TODO: can a value have two multipliers?
[@deriving show({with_path: false})]
[@deriving show({ with_path: false })]
type multiplier =
| One /* */
| Zero_or_more /* * */
Expand All @@ -15,22 +15,22 @@ type multiplier =
| Repeat_by_comma(int, option(int)) /* # #{A, B} */
| At_least_one /* ! */; // TODO: ! is only allowed for groups

[@deriving show({with_path: false})]
[@deriving show({ with_path: false })]
type terminal =
| Delim(string) /* ',' */
| Keyword(string) /* auto */
| Data_type(string) /* <color> */
| Property_type(string) /* <'color'> */;

[@deriving show({with_path: false})]
[@deriving show({ with_path: false })]
type combinator =
| Static /* a b */
| And /* a && b */
| Or /* a || b */
| Xor; /* a | b */

// TODO: non-terminals https://drafts.csswg.org/css-values-3/#component-types item 4
[@deriving show({with_path: false})]
[@deriving show({ with_path: false })]
type value =
| Terminal(terminal, multiplier)
| Combinator(combinator, list(value))
Expand Down
Loading
Loading