Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ReactDOM and add SSR API #50

Merged
merged 27 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
582de33
Fix field init with es6 generator
kLabz Mar 29, 2021
19e10ae
It's actually safe
kLabz Mar 29, 2021
7330eaf
Remove type resolution attempt; can break things
kLabz Mar 30, 2021
83fb310
Still infer constant types
kLabz Mar 30, 2021
5d8162c
Emit fatal error to avoid strange side effects
kLabz Mar 30, 2021
521b067
Server side rendering utils
kLabz Jul 7, 2021
16919be
Improved editor support and misc improvements
kLabz Oct 25, 2022
e61f419
Fix position for "Invalid node" error
kLabz Nov 16, 2022
6b24f62
Improve 'Type not found' error
kLabz Nov 16, 2022
3539733
Improve support for 'import as' types in props
kLabz Nov 16, 2022
08a3d07
Delay some typing
kLabz Nov 16, 2022
c9452f9
Optimize output for ReactType
kLabz Nov 16, 2022
0e5cdd2
@:enum abstract -> enum abstract (+ same for @:extern)
kLabz Oct 12, 2023
62bfa83
Add custom define/metadata
kLabz Oct 12, 2023
1c33f09
Update and document ReactDOM API
kLabz Oct 12, 2023
0d99d7a
Update React and Suspense API docs
kLabz Oct 12, 2023
a9c78f6
Add metadata to docs
kLabz Oct 13, 2023
553bfbd
[samples] Add SSR sample (react-next docs website)
kLabz Oct 13, 2023
92e48f8
[samples] use fork for markdown lib
kLabz Oct 13, 2023
361ca11
[ci] fix libs versions (not that CI is running anymore but still..)
kLabz Oct 13, 2023
d34b25c
[docs] minor fixes
kLabz Oct 13, 2023
5367f47
[samples] css update for inline code
kLabz Oct 13, 2023
bf75d56
[samples] minor css update
kLabz Oct 13, 2023
805c5b6
[samples] add static site generator example
kLabz Oct 13, 2023
e38ec22
[ci] move to github actions
kLabz Oct 14, 2023
b3653a5
[Samples] Update todoapp sample
kLabz Oct 14, 2023
fa5781e
[ci] fix tests with node 18
kLabz Oct 14, 2023
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ insert_final_newline = true
indent_style = tab
indent_size = 4

[*.json]
[*.{json,yml}]
indent_style = space
indent_size = 2

48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Tests

on: [push, repository_dispatch]

jobs:
build:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
haxe: [4.3.2, latest]

steps:
- uses: actions/checkout@v1

- name: Setup haxe ${{ matrix.haxe }}
uses: krdlab/setup-haxe@v1
with:
haxe-version: ${{ matrix.haxe }}

- name: Install libs
run: |
git config --global url."https://github.com/".insteadOf "[email protected]:"
haxelib newrepo
haxelib install munit
haxelib install hxnodejs
haxelib git tink_hxx [email protected]:kLabz/tink_hxx.git
haxelib git tink_anon [email protected]:haxetink/tink_anon.git

- name: Run tests
run: |
haxelib run munit test -js

- name: "[Samples] SSR sample : react-next docs website"
run: |
cd samples/docs
make setup
make server
make static

- name: "[Samples] TODO App"
run: |
cd samples/todoapp
haxelib newrepo
haxelib dev react-next ../..
haxelib install --skip-dependencies --always install.hxml
haxe build.hxml
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

6 changes: 5 additions & 1 deletion doc/compilation-flags.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
---
title: Custom compilation flags
---

# Custom compilation flags used by haxe-react

## `-debug` / `-D debug`

This is not a custom compilation flag, but it enables/disables some features in
haxe-react. Basically, you'll want to compile with it when using dev version of
react, and remove it when using prog version.
react, and remove it when using prod version.

### Disabled features

Expand Down
4 changes: 4 additions & 0 deletions doc/custom-meta.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Custom metadata
---

# Custom meta used by haxe-react

## `@:wrap(hoc)`
Expand Down
18 changes: 18 additions & 0 deletions doc/defines.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"define": "react_no_inline",
"doc": "Skip React.createElement inlining optimization."
},
{
"define": "react_global",
"doc": "Use window.React instead of require() from modular/webpack."
},
{
"define": "react_hot",
"doc": "Adds some data needed for react hot reloading with modular/webpack."
},
{
"define": "react_runtime_warnings",
"doc": "Enable some runtime warnings for debug purpose."
}
]
19 changes: 19 additions & 0 deletions doc/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
{
"metadata": ":wrap",
"doc": "Wrap current class component in a HOC.",
"params": ["HOC"],
"targets": ["TClass"]
},
{
"metadata": ":publicProps",
"doc": "Set public props type to ensure jsx type checking.",
"params": ["TProps"],
"targets": ["TClass"]
},
{
"metadata": ":noPublicProps",
"doc": "Disallow public props for this component when used in jsx.",
"targets": ["TClass"]
}
]
5 changes: 5 additions & 0 deletions doc/react-next-roadmap.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
order: 1
title: React "next" Roadmap
---

# Haxe React #next: roadmap

There's still work to be done being this fork is ready for a haxe-react 2.0.0
Expand Down
7 changes: 6 additions & 1 deletion doc/react-next.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
order: 0
title: React "next"
---

# Haxe React #next

Branch `#next` of my haxe-react fork aims to move haxe-react forward to `2.0.0+`
Expand Down Expand Up @@ -311,7 +316,7 @@ compatible with other versions.
* `React._internals.ReactDebugCurrentFrame.getCurrentStack()` will list all
parent nodes of current element, up to the root node of the application

#### [`TODO`]() Generate PropTypes for more runtime checks on props
#### [`TODO`](<>) Generate PropTypes for more runtime checks on props

There are already many checks at compile time to ensure you are not doing
obvious mistakes. However, sometimes the compiler cannot see what is really
Expand Down
4 changes: 4 additions & 0 deletions doc/react-refs-api.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: React Refs API (React 16.3)
---

# New React Refs API (React 16.3)

Externs have been added for [`React.createRef()`][createRef] and
Expand Down
4 changes: 4 additions & 0 deletions doc/typing-props.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Typing your props
---

# Typing your props with haxe-react

One of the points of using Haxe to develop javascript applications is to benefit
Expand Down
4 changes: 4 additions & 0 deletions doc/wrapping-with-hoc.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Wrap with HOC
---

# Wrapping your components in HOCs

You can use HOCs with your components (unless they are `@:jsxStatic` components)
Expand Down
5 changes: 5 additions & 0 deletions haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"version": "1.122.0",
"url": "https://github.com/kLabz/haxe-react",
"classPath": "src/lib",
"documentation": {
"url": "https://github.com/kLabz/haxe-react/tree/next/doc",
"metadata": "doc/metadata.json",
"defines": "doc/defines.json"
},
"dependencies": {
"tink_hxx": "",
"js-object": ""
Expand Down
4 changes: 4 additions & 0 deletions samples/docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bin
.haxelib
node_modules
package-lock.json
11 changes: 11 additions & 0 deletions samples/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Example project: Server side rendering (no hydration)

TODO: add some documentation here, or in `docs` and link here.

Run `make setup` to install dependencies.

Run `make server` to build and then `make start-server` to start the server on
port `8042`.

To generate static html pages instead, run `make static`, and then
`make serve-static` to start a http server serving html files on port `8043`.
6 changes: 6 additions & 0 deletions samples/docs/build-static.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env haxe

common.hxml

-main StaticGenerator
-js bin/static-gen.js
6 changes: 6 additions & 0 deletions samples/docs/build.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env haxe

common.hxml

-main Main
-js bin/server.js
30 changes: 30 additions & 0 deletions samples/docs/common.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-L react-next
-L react-css
-L css-types
-L classnames
-L datetime
-L markdown
-L event-types
-L html-entities
-L tink_domspec
-L hxnodejs
-L yaml

-cp src

# -dce full
-D js-es=6
# -D analyzer-optimize
-D message.reporting=pretty

-w -WDeprecatedEnumAbstract

# Configure react-css
-D react.css.out=bin/styles.css
-D react.css.base=res/base.css
# -D react.css.sourcemap=styles.css.map

# Configure react-next
-D react-wrap-strict
-D react-check-jsxstatic-type
-D react-disable-dynamic-components
20 changes: 20 additions & 0 deletions samples/docs/install.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-lib HtmlParser:3.3.2
-lib js-object:0.0.7
-lib datetime:3.1.4
-lib html-entities:1.0.0

-lib tink_macro:1.0.1
-lib tink_parse:0.4.1
-lib tink_core:2.1.0
-lib tink_domspec:0.5.0
-lib tink_svgspec:0.0.1
-lib tink_anon:git:[email protected]:haxetink/tink_anon.git#0277e6e
-lib tink_hxx:git:[email protected]:kLabz/tink_hxx.git#5a01af1

-lib hxnodejs:git:[email protected]:HaxeFoundation/hxnodejs.git#d2d871c
-lib css-types:git:[email protected]:kLabz/haxe-css-types.git#5f5d2c6
-lib event-types:git:[email protected]:kLabz/event-types.git#df271a9
-lib react-css:git:[email protected]:kLabz/haxe-react-css.git#5595611
-lib classnames:git:[email protected]:kLabz/haxe-classnames.git#30e7436
-lib yaml:git:[email protected]:kLabz/hx-yaml.git#c61ca1f
-lib markdown:git:[email protected]:kLabz/haxe-markdown.git#8503130
20 changes: 20 additions & 0 deletions samples/docs/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.SILENT:

setup:
haxelib newrepo
haxelib dev react-next ../..
haxelib install --skip-dependencies --always install.hxml
npm i

server:
haxe build.hxml

start-server:
node bin/server.js

static:
haxe build-static.hxml
node bin/static-gen.js

serve-static:
cd bin/static && python -m http.server 8043
7 changes: 7 additions & 0 deletions samples/docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"dependencies": {
"jsdom": "19.0.0",
"react": "18.2.0",
"react-dom": "18.2.0"
}
}
Loading