Skip to content

Commit 0d7c8aa

Browse files
committed
Revert "Sync with reactpy core repo"
This reverts commit ba52195.
1 parent 8a16488 commit 0d7c8aa

File tree

11 files changed

+17
-24
lines changed

11 files changed

+17
-24
lines changed

.github/workflows/test-python.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ jobs:
6262
python-version: 3.x
6363
- name: Install Python Dependencies
6464
run: pip install --upgrade pip hatch uv
65-
- name: Run Python type checker
65+
- name: Check Python formatting
6666
run: hatch run python:type_check

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# ReactPy-Django Build Artifacts
2-
src/reactpy_django/static/reactpy_django/index.js
3-
src/reactpy_django/static/reactpy_django/index.js.map
2+
src/reactpy_django/static/reactpy_django/client.js
43
src/reactpy_django/static/reactpy_django/pyscript
54
src/reactpy_django/static/reactpy_django/morphdom
65

docs/src/about/contributing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ By utilizing `hatch`, the following commands are available to manage the develop
5050

5151
The `hatch test` command is a wrapper for `pytest`. Hatch "intercepts" a handful of arguments, which can be previewed by typing `hatch test --help`.
5252

53-
Any additional arguments in the `test` command are provided directly to pytest. See the [pytest documentation](https://docs.pytest.org/en/stable/reference/reference.html#command-line-flags) for what additional arguments are available.
53+
Any additional arguments in the `test` command are directly passed on to pytest. See the [pytest documentation](https://docs.pytest.org/en/stable/reference/reference.html#command-line-flags) for what additional arguments are available.
5454

5555
### Linting and Formatting
5656

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ installer = "uv"
7575
[[tool.hatch.build.hooks.build-scripts.scripts]]
7676
commands = [
7777
"bun install --cwd src/js",
78-
'bun build src/js/src/index.ts --outdir="src/reactpy_django/static/reactpy_django/" --minify --sourcemap=linked',
78+
"bun build src/js/src/index.ts --outfile src/reactpy_django/static/reactpy_django/client.js --minify",
7979
'cd src/build_scripts && python copy_dir.py "src/js/node_modules/@pyscript/core/dist" "src/reactpy_django/static/reactpy_django/pyscript"',
8080
'cd src/build_scripts && python copy_dir.py "src/js/node_modules/morphdom/dist" "src/reactpy_django/static/reactpy_django/morphdom"',
8181
]

src/js/src/client.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,11 @@ export class ReactPyDjangoClient
1919
constructor(props: ReactPyDjangoClientProps) {
2020
super();
2121
this.urls = props.urls;
22-
this.mountElement = props.mountElement;
23-
this.prerenderElement = props.prerenderElement;
24-
this.offlineElement = props.offlineElement;
2522
this.socket = createReconnectingWebSocket({
26-
url: this.urls.componentUrl,
2723
readyPromise: this.ready,
28-
...props.reconnectOptions,
24+
url: this.urls.componentUrl,
2925
onMessage: async ({ data }) => this.handleIncoming(JSON.parse(data)),
26+
...props.reconnectOptions,
3027
onClose: () => {
3128
// If offlineElement exists, show it and hide the mountElement/prerenderElement
3229
if (this.prerenderElement) {
@@ -46,6 +43,9 @@ export class ReactPyDjangoClient
4643
}
4744
},
4845
});
46+
this.mountElement = props.mountElement;
47+
this.prerenderElement = props.prerenderElement;
48+
this.offlineElement = props.offlineElement;
4949
}
5050

5151
sendMessage(message: any): void {

src/js/src/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export type ReconnectOptions = {
77

88
export type ReactPyUrls = {
99
componentUrl: URL;
10+
query: string;
1011
jsModules: string;
1112
};
1213

src/reactpy_django/checks.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ def reactpy_warnings(app_configs, **kwargs):
6262
)
6363
)
6464

65-
# Check if reactpy_django/index.js is available
66-
if not find("reactpy_django/index.js"):
65+
# Check if reactpy_django/client.js is available
66+
if not find("reactpy_django/client.js"):
6767
warnings.append(
6868
Warning(
69-
"ReactPy index.js could not be found within Django static files!",
69+
"ReactPy client.js could not be found within Django static files!",
7070
hint="Check all static files related Django settings and INSTALLED_APPS.",
7171
id="reactpy_django.W004",
7272
)

src/reactpy_django/forms/components.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from reactpy.core.types import VdomDict
2828

2929
DjangoForm = export(
30-
module_from_file("reactpy-django", file=Path(__file__).parent.parent / "static" / "reactpy_django" / "index.js"),
30+
module_from_file("reactpy-django", file=Path(__file__).parent.parent / "static" / "reactpy_django" / "client.js"),
3131
("DjangoForm"),
3232
)
3333

src/reactpy_django/javascript_components.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
from reactpy import web
66

77
HttpRequest = web.export(
8-
web.module_from_file("reactpy-django", file=Path(__file__).parent / "static" / "reactpy_django" / "index.js"),
8+
web.module_from_file("reactpy-django", file=Path(__file__).parent / "static" / "reactpy_django" / "client.js"),
99
("HttpRequest"),
1010
)

src/reactpy_django/templates/reactpy/component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{% if reactpy_prerender_html %}<div id="{{reactpy_uuid}}-prerender">{{reactpy_prerender_html|safe}}</div>{% endif %}
1111
{% if reactpy_offline_html %}<div id="{{reactpy_uuid}}-offline" hidden>{{reactpy_offline_html|safe}}</div>{% endif %}
1212
<script type="module" crossorigin="anonymous">
13-
import { mountComponent } from "{% static 'reactpy_django/index.js' %}";
13+
import { mountComponent } from "{% static 'reactpy_django/client.js' %}";
1414
const mountElement = document.getElementById("{{reactpy_uuid}}");
1515
mountComponent(
1616
mountElement,

tests/test_app/__init__.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,7 @@
88
assert subprocess.run(["bun", "install"], cwd=str(js_dir), check=True).returncode == 0
99
assert (
1010
subprocess.run(
11-
[
12-
"bun",
13-
"build",
14-
"./src/index.ts",
15-
f"--outdir={static_dir}",
16-
"--minify",
17-
"--sourcemap=linked",
18-
],
11+
["bun", "build", "./src/index.ts", "--outfile", str(static_dir / "client.js"), "--minify"],
1912
cwd=str(js_dir),
2013
check=True,
2114
).returncode

0 commit comments

Comments
 (0)