Skip to content

Commit 86a27d1

Browse files
authored
Merge pull request #49 from mattdamon108/jsx
Update new jsx transform apis, bind to Jsx in compiler
2 parents 46944b4 + 8d946e7 commit 86a27d1

33 files changed

+4644
-10131
lines changed

.github/workflows/nodejs.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [10.x, 12.x]
19+
node-version: [16.x]
2020

2121
steps:
22-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v3
2323
- name: Use Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v1
24+
uses: actions/setup-node@v3
2525
with:
2626
node-version: ${{ matrix.node-version }}
2727
- run: npm install

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ finalOutput/*.js
99
/docs/
1010
*.log
1111
.bsb.lock
12-
/src/**/*.js
1312
_esy
1413
_build
1514
*.install
16-
*.bs.js
15+
src/legacy/*.bs.js
1716

1817
# Editor
1918
/.idea/

Changes.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,21 @@
22

33
## master
44

5-
- Rewrite the `RescriptReactErrorBoundary` component implementation with `@react.component`, so it can be compatible with the changes of JSX PPX.
5+
## 0.11.0-rc.1
6+
7+
- `RescriptReactErrorBoundary` component now implemented using `@react.component`, so it is compatible with JSX V4.
8+
9+
- `ReactV3` module added for backward compatibility to JSX V3. See [the V3 compatibility mode](https://github.com/rescript-lang/syntax/blob/master/cli/JSXV4.md)
10+
11+
**Breaking:**
12+
13+
- **IMPORTANT** The `React` module has been modified in a breaking way to support the new JSX PPX V4.
14+
15+
- Removed the deprecation attribute from apis of the new jsx transform (introduced in React v17).
16+
17+
- New version requirements:
18+
- ReScript compiler V10.1+
19+
- ReactJS v18.2.0+
620

721
## v0.10.3
822

README.md

+22-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## rescript-react
1+
## rescript-react
22

33
> The Official ReScript Bindings for ReactJS
44
@@ -12,6 +12,12 @@
1212

1313
### Installation
1414

15+
#### React-JSX transformation V4
16+
17+
- [Documentation](https://github.com/rescript-lang/syntax/blob/master/cli/JSXV4.md)
18+
19+
The ReScript compiler V10.1+ is required.
20+
1521
```
1622
npm install @rescript/react --save
1723
```
@@ -20,20 +26,31 @@ In your `bsconfig.json`:
2026

2127
```
2228
{
23-
"reason": { "react-jsx": 3 },
29+
"jsx": { "version": 4, "mode": "classic" },
2430
"bs-dependencies": ["@rescript/react"]
2531
}
2632
```
2733

34+
If you want to try [the new jsx transform](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html) which was introduced in React v17, set the `"mode": "automatic"`.
35+
36+
If you want to try build your project with JSX v3, see [the V3 compatibility mode](https://github.com/rescript-lang/syntax/blob/master/cli/JSXV4.md)
37+
2838
**Quick Links:**
2939

3040
- [Introduction](https://rescript-lang.org/docs/react/latest/introduction)
3141

3242
### Requirements
3343

34-
- bs-platform v8.3+
35-
- ReactJS v16.8.1+
36-
- **Optimized for ReScript syntax usage**
44+
- v0.11.0+
45+
46+
- ReScript Compiler v10.1+
47+
- ReactJS v18.2.0+
48+
49+
- v0.10.3
50+
51+
- bs-platform v8.3+
52+
- ReactJS v16.8.1+
53+
- **Optimized for ReScript syntax usage**
3754

3855
### Development
3956

bsconfig.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "@rescript/react",
3-
"reason": { "react-jsx": 3 },
4-
"sources": [
5-
{"dir": "src", "subdirs": true},
6-
{ "dir": "test", "type": "dev" }
7-
],
3+
"jsx": {
4+
"version": 4,
5+
"mode": "classic"
6+
},
7+
"sources": [{ "dir": "src", "subdirs": true }],
88
"package-specs": [{ "module": "commonjs", "in-source": true }],
99
"suffix": ".bs.js",
10-
"bs-dev-dependencies": ["reason-test-framework"],
10+
"bs-dev-dependencies": [],
1111
"bsc-flags": []
1212
}

0 commit comments

Comments
 (0)