Skip to content

Commit d8342a5

Browse files
committed
Merge branch 'master' into group-jsx-modules
2 parents 1f70005 + 75afc52 commit d8342a5

File tree

289 files changed

+5452
-2990
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

289 files changed

+5452
-2990
lines changed

.github/workflows/ci.yml

Lines changed: 79 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ env:
2121

2222
jobs:
2323
build-compiler:
24+
outputs:
25+
api-docs-artifact-id: ${{ steps.upload-api-docs.outputs.artifact-id }}
2426
strategy:
2527
fail-fast: false
2628
matrix:
@@ -36,6 +38,7 @@ jobs:
3638
upload_binaries: true
3739
# Build the playground compiler and run the benchmarks on the fastest runner
3840
build_playground: true
41+
generate_api_docs: true
3942
benchmarks: true
4043
node-target: linux-arm64
4144
rust-target: aarch64-unknown-linux-musl
@@ -98,6 +101,9 @@ jobs:
98101
- name: Install npm packages
99102
run: yarn install
100103

104+
- name: Install testrepo deps
105+
run: cd rewatch/testrepo && yarn install
106+
101107
- name: Install dependencies (Linux)
102108
if: runner.os == 'Linux'
103109
uses: awalsh128/[email protected]
@@ -133,6 +139,8 @@ jobs:
133139
- name: Copy rewatch binary
134140
run: |
135141
cp rewatch/target/${{ matrix.rust-target }}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }} rewatch
142+
mkdir -p rewatch/target/release
143+
cp rewatch/target/${{ matrix.rust-target }}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }} rewatch/target/release
136144
./scripts/copyExes.js --rewatch
137145
shell: bash
138146

@@ -316,13 +324,11 @@ jobs:
316324
if: steps.ninja-build-cache.outputs.cache-hit != 'true'
317325
run: node scripts/copyExes.js --ninja
318326

319-
- name: "Syntax: Run roundtrip tests"
320-
if: ${{ runner.os != 'Windows' }}
321-
run: opam exec -- make test-syntax-roundtrip
322-
323-
- name: "Syntax: Run tests (Windows)"
324-
if: ${{ runner.os == 'Windows' }}
325-
run: opam exec -- make test-syntax
327+
- name: "Syntax: Run tests"
328+
env:
329+
ROUNDTRIP_TEST: ${{ runner.os == 'Windows' && '0' || '1' }}
330+
run: ./scripts/test_syntax.sh
331+
shell: bash
326332

327333
- name: Build runtime/stdlib with rewatch
328334
if: ${{ runner.os != 'Windows' }}
@@ -354,9 +360,15 @@ jobs:
354360
if: runner.os != 'Windows'
355361
run: make -C tests/gentype_tests/typescript-react-example clean test
356362

363+
- name: Run rewatch tests
364+
run: ./rewatch/tests/suite-ci.sh
365+
shell: bash
366+
357367
- name: Run syntax benchmarks
358368
if: matrix.benchmarks
359-
run: ./_build/install/default/bin/syntax_benchmarks | tee tests/benchmark-output.json
369+
run: |
370+
set -o pipefail
371+
./_build/install/default/bin/syntax_benchmarks | tee tests/benchmark-output.json
360372
361373
# Benchmarking is disabled for now because of inconsistent run times on different runners
362374
#
@@ -429,6 +441,18 @@ jobs:
429441
name: lib-ocaml
430442
path: lib/ocaml
431443

444+
- name: Generate API Docs
445+
if: ${{ matrix.generate_api_docs }}
446+
run: yarn apidocs:generate
447+
448+
- name: "Upload artifacts: scripts/res/apiDocs"
449+
id: upload-api-docs
450+
if: ${{ matrix.generate_api_docs }}
451+
uses: actions/upload-artifact@v4
452+
with:
453+
name: api
454+
path: scripts/res/apiDocs/
455+
432456
pkg-pr-new:
433457
needs:
434458
- build-compiler
@@ -456,6 +480,49 @@ jobs:
456480
run: |
457481
yarn dlx pkg-pr-new publish "." "./packages/@rescript/*"
458482
483+
api-docs:
484+
needs:
485+
- build-compiler
486+
runs-on: ubuntu-24.04-arm
487+
steps:
488+
- name: Checkout rescript-lang.org
489+
uses: actions/checkout@v4
490+
with:
491+
repository: rescript-lang/rescript-lang.org
492+
ssh-key: ${{ secrets.RESCRIPT_LANG_ORG_DEPLOY_KEY }}
493+
494+
- name: Download artifacts
495+
uses: actions/download-artifact@v4
496+
with:
497+
artifact-ids: ${{ needs.build-compiler.outputs.api-docs-artifact-id }}
498+
path: data
499+
500+
- name: Check if repo is clean
501+
id: diffcheck
502+
run: |
503+
git status
504+
if [ -z "$(git status --porcelain)" ]; then
505+
echo "clean=true" >> $GITHUB_OUTPUT
506+
else
507+
echo "clean=false" >> $GITHUB_OUTPUT
508+
fi
509+
510+
- name: Build website
511+
if: steps.diffcheck.outputs.clean == 'false'
512+
run: |
513+
npm ci
514+
npx rescript
515+
npm run build
516+
517+
- name: Commit and push
518+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
519+
run: |
520+
git config --global user.name "github-actions[bot]"
521+
git config --global user.email "[email protected]"
522+
git add data/api
523+
git commit -m "Update API docs for ${{ github.ref_name }}"
524+
git push
525+
459526
test-integration:
460527
needs:
461528
- pkg-pr-new
@@ -478,7 +545,8 @@ jobs:
478545
- name: Use Node.js
479546
uses: actions/setup-node@v4
480547
with:
481-
node-version-file: .nvmrc
548+
# Run integration tests with the oldest supported node version.
549+
node-version: 20
482550

483551
- name: Make test directory
484552
id: tmp-dir
@@ -507,17 +575,15 @@ jobs:
507575
working-directory: ${{ steps.tmp-dir.outputs.path }}
508576

509577
- name: Install ReScript package in rewatch/testrepo
510-
if: runner.os == 'Linux'
511578
run: |
512579
COMMIT_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
513580
yarn add "rescript@https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA::7}"
514581
shell: bash
515582
working-directory: rewatch/testrepo
516583

517584
- name: Run rewatch integration tests
518-
# Currently failing on Windows and intermittently on macOS
519-
if: runner.os == 'Linux'
520-
run: make test-rewatch-ci
585+
run: ./rewatch/tests/suite-ci.sh node_modules/.bin/rewatch
586+
shell: bash
521587

522588
publish:
523589
needs:

.mcp.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"mcpServers": {
3+
"ocamllsp": {
4+
"type": "stdio",
5+
"command": "mcp-language-server",
6+
"args": [
7+
"--workspace",
8+
"/Users/shulhi/Dev/rescript/rescript-compiler",
9+
"--lsp",
10+
"ocamllsp"
11+
],
12+
"env": {}
13+
}
14+
}
15+
}

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20
1+
22

CHANGELOG.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,62 @@
1010
> - :house: [Internal]
1111
> - :nail_care: [Polish]
1212
13-
# 12.0.0-alpha.14 (Unreleased)
13+
# 12.0.0-alpha.15 (Unreleased)
14+
15+
#### :bug: Bug fix
16+
17+
- Ignore inferred arity in functions inside `%raw` functions, leaving to `%ffi` the responsibility to check the arity since it gives an error in case of mismatch. https://github.com/rescript-lang/rescript/pull/7542
18+
- Pass the rewatch exit code through in wrapper script. https://github.com/rescript-lang/rescript/pull/7565
19+
- Prop punning when types don't match results in I/O error: _none_: No such file or directory. https://github.com/rescript-lang/rescript/pull/7533
20+
- Pass location to children prop in jsx ppx. https://github.com/rescript-lang/rescript/pull/7540
21+
22+
#### :nail_care: Polish
23+
24+
- Better error message for when trying to await something that is not a promise. https://github.com/rescript-lang/rescript/pull/7561
25+
26+
#### :house: Internal
27+
28+
- Remove `@return(undefined_to_opt)` and `%undefined_to_opt` primitive. https://github.com/rescript-lang/rescript/pull/7462
29+
30+
# 12.0.0-alpha.14
31+
32+
#### :boom: Breaking Change
33+
34+
- `Iterator.forEach` now emits `Iterator.prototype.forEach` call. https://github.com/rescript-lang/rescript/pull/7506
35+
- Rename functions ending with `Exn` to end with `OrThrow`. The old `Exn` functions are now deprecated:
36+
- `Bool.fromStringExn``Bool.fromStringOrThrow`
37+
- `BigInt.fromStringExn``BigInt.fromStringOrThrow`
38+
- `JSON.parseExn``JSON.parseOrThrow`
39+
- Changed `BigInt.fromFloat` to return an option rather than throwing an error.
40+
- Added `BigInt.fromFloatOrThrow`
41+
- `Option.getExn``Option.getOrThrow`
42+
- `Null.getExn``Null.getOrThrow`
43+
- `Nullable.getExn``Nullable.getOrThrow`
44+
- `Result.getExn``Result.getOrThrow`
45+
- `List.getExn``List.getOrThrow`
46+
- `List.tailExn``List.tailOrThrow`
47+
- `List.headExn``List.headOrThrow`
48+
- Old functions remain available but are marked as deprecated with guidance to use the new `OrThrow` variants.
49+
- https://github.com/rescript-lang/rescript/pull/7518, https://github.com/rescript-lang/rescript/pull/7554
1450

1551
#### :rocket: New Feature
1652

1753
- Add `RegExp.flags`. https://github.com/rescript-lang/rescript/pull/7461
1854
- Add `Array.findLast`, `Array.findLastWithIndex`, `Array.findLastIndex`, `Array.findLastIndexWithIndex` and `Array.findLastIndexOpt`. https://github.com/rescript-lang/rescript/pull/7503
1955
- Add `options` argument to `Console.dir`. https://github.com/rescript-lang/rescript/pull/7504
2056
- Show variant constructor's inline record types on hover. https://github.com/rescript-lang/rescript/pull/7519
57+
- Add additional `Iterator.prototype` bindings to `runtime/Stdlib_Iterator.res`. https://github.com/rescript-lang/rescript/pull/7506
2158

2259
#### :bug: Bug fix
2360

2461
- `rescript-tools doc` no longer includes shadowed bindings in its output. https://github.com/rescript-lang/rescript/pull/7497
2562
- Treat `throw` like `raise` in analysis. https://github.com/rescript-lang/rescript/pull/7521
2663
- Fix `index out of bounds` exception thrown in rare cases by `rescript-editor-analysis.exe codeAction` command. https://github.com/rescript-lang/rescript/pull/7523
2764
- Don't produce duplicate type definitions for recursive types on hover. https://github.com/rescript-lang/rescript/pull/7524
65+
- Prop punning when types don't match results in `I/O error: _none_: No such file or directory`. https://github.com/rescript-lang/rescript/pull/7533
66+
- Fix partial application with user-defined function types. https://github.com/rescript-lang/rescript/pull/7548
67+
- Fix doc comment before variant throwing syntax error. https://github.com/rescript-lang/rescript/pull/7535
68+
- Fix apparent non-determinism in generated code for pattern matching. https://github.com/rescript-lang/rescript/pull/7557
2869

2970
#### :nail_care: Polish
3071

@@ -37,11 +78,17 @@
3778
- Improve error message for pipe (`->`) syntax. https://github.com/rescript-lang/rescript/pull/7520
3879
- Improve a few error messages around various subtyping issues. https://github.com/rescript-lang/rescript/pull/7404
3980
- In module declarations, accept the invalid syntax `M = {...}` and format it to `M : {...}`. https://github.com/rescript-lang/rescript/pull/7527
81+
- Improve doc comment formatting to match the style of multiline comments. https://github.com/rescript-lang/rescript/pull/7529
82+
- Improve error messages around type mismatches for try/catch, if, for, while, and optional record fields + optional function arguments. https://github.com/rescript-lang/rescript/pull/7522
83+
- Sync reanalyze with the new APIs around exception. https://github.com/rescript-lang/rescript/pull/7536
84+
- Improve array pattern spread error message. https://github.com/rescript-lang/rescript/pull/7549
85+
- Sync API docs with rescript-lang.org on release. https://github.com/rescript-lang/rescript/pull/7555
4086

4187
#### :house: Internal
4288

4389
- Refactor the ast for record expressions and patterns. https://github.com/rescript-lang/rescript/pull/7528
4490
- Editor: add completions from included modules. https://github.com/rescript-lang/rescript/pull/7515
91+
- Add `-editor-mode` arg to `bsc` for doing special optimizations only relevant to the editor tooling. https://github.com/rescript-lang/rescript/pull/7541
4592

4693
# 12.0.0-alpha.13
4794

0 commit comments

Comments
 (0)