-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Copy path_dash_renderer.py
77 lines (68 loc) · 2.8 KB
/
_dash_renderer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import os
__version__ = "1.18.0"
_available_react_versions = {"16.14.0", "18.2.0"}
_available_reactdom_versions = {"16.14.0", "18.2.0"}
_js_dist_dependencies = [] # to be set by _set_react_version
def _set_react_version(v_react, v_reactdom=None):
if not v_reactdom:
v_reactdom = v_react
react_err = f"looking for one of {_available_react_versions}, found {v_react}"
reactdom_err = (
f"looking for one of {_available_reactdom_versions}, found {v_reactdom}"
)
assert v_react in _available_react_versions, react_err
assert v_reactdom in _available_reactdom_versions, reactdom_err
_js_dist_dependencies[:] = [
{
"external_url": {
"prod": [
"https://unpkg.com/@babel/[email protected]/dist/polyfill.min.js",
f"https://unpkg.com/react@{v_react}/umd/react.production.min.js",
f"https://unpkg.com/react-dom@{v_reactdom}/umd/react-dom.production.min.js",
"https://unpkg.com/[email protected]/prop-types.min.js",
],
"dev": [
"https://unpkg.com/@babel/[email protected]/dist/polyfill.min.js",
f"https://unpkg.com/react@{v_react}/umd/react.development.js",
f"https://unpkg.com/react-dom@{v_reactdom}/umd/react-dom.development.js",
"https://unpkg.com/[email protected]/prop-types.js",
],
},
"relative_package_path": {
"prod": [
"deps/[email protected]",
f"deps/react@{v_react}.min.js",
f"deps/react-dom@{v_reactdom}.min.js",
"deps/[email protected]",
],
"dev": [
"deps/[email protected]",
f"deps/react@{v_react}.js",
f"deps/react-dom@{v_reactdom}.js",
"deps/[email protected]",
],
},
"namespace": "dash",
}
]
_env_react_version = os.getenv("REACT_VERSION")
if _env_react_version:
_set_react_version(_env_react_version)
print(f"EXPERIMENTAL: Using react version from env: {_env_react_version}")
else:
_set_react_version("16.14.0", "16.14.0")
_js_dist = [
{
"relative_package_path": "dash-renderer/build/dash_renderer.min.js",
"dev_package_path": "dash-renderer/build/dash_renderer.dev.js",
"external_url": "https://unpkg.com/[email protected]"
"/build/dash_renderer.min.js",
"namespace": "dash",
},
{
"relative_package_path": "dash-renderer/build/dash_renderer.min.js.map",
"dev_package_path": "dash-renderer/build/dash_renderer.dev.js.map",
"namespace": "dash",
"dynamic": True,
},
]