├── .gitignore
├── .indo.json
├── .vscode
└── settings.json
├── LICENSE
├── README.md
├── demo
├── index.html
├── package.json
├── packages
│ ├── react-one
│ │ ├── index.d.ts
│ │ ├── index.jsx
│ │ └── package.json
│ └── react-two
│ │ ├── index.tsx
│ │ ├── package.json
│ │ └── tsconfig.json
├── pnpm-lock.yaml
├── src
│ ├── Root.tsx
│ ├── deps.tsx
│ ├── main.tsx
│ └── styles.css
├── tsconfig.json
└── vite.config.ts
├── package.json
├── pnpm-lock.yaml
├── src
├── babel.d.ts
├── babelRestoreJsx.ts
└── plugin.ts
└── tsconfig.json
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | vendor
3 | dist
4 |
--------------------------------------------------------------------------------
/.indo.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "[markdown]": {
3 | "editor.wordWrap": "on",
4 | "editor.quickSuggestions": false,
5 | "editor.formatOnSave": false
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Alec Larson
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### ⚠️ Deprecated: Use [`@vitejs/plugin-react`](https://www.npmjs.com/package/@vitejs/plugin-react) instead.
2 |
3 | # vite-react-jsx
4 |
5 | [](https://www.npmjs.com/package/vite-react-jsx)
6 | [](https://github.com/prettier/prettier)
7 | [](https://paypal.me/alecdotbiz)
8 |
9 | > React 17's automatic JSX runtime for your entire bundle
10 |
11 |
12 |
13 | ### Features
14 |
15 | - Replaces `React.createElement` calls in your **entire** bundle (even for **pre-minified**, compiled React components from `node_modules`) with [the automatic JSX runtime](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html) introduced in React 17
16 | - Injects `import React` statements in server mode, but not for modules where React is already imported
17 | - Deduplicates `react` and `react-dom` imports by setting `resolve.dedupe` for you
18 |
19 |
20 |
21 | ### FAQ
22 |
23 | - **What are the benefits of using the new JSX runtime?**
24 | 1) You don't need to `import React` manually anymore.
25 | 2) Better performance now and in the future. The [Motivations](https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md#motivation) section in the RFC explains the specifics of performance issues with `React.createElement`.
26 | 3) In the future, you won't need `React.forwardRef` anymore.
27 | 4) Depending on your setup, slightly smaller bundle sizes (according to the React team).
28 | 5) Faster parsing of JavaScript by web browser (`.createElement` cannot be minified).
29 |
30 | - **How much does this affect Vite's performance?**
31 | In serve mode, the performance effects are unnoticeable, since Babel is only used when bundling.
32 | Otherwise, you'll see ~40% longer build times in the `./demo` folder, but this % largely depends on how many kB of JavaScript need to be parsed and transformed by Babel.
33 |
34 | - **Do I need React 17+ to use the new JSX runtime?**
35 | No. Support for the new runtime was backported to React 16.14.0, React 15.7.0, and React 0.14.10.
36 |
37 |
38 |
39 | ### Usage
40 |
41 | ```ts
42 | import reactJsx from 'vite-react-jsx'
43 |
44 | export default {
45 | plugins: [
46 | reactJsx(),
47 | ]
48 | }
49 | ```
50 |
--------------------------------------------------------------------------------
/demo/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Demo
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/demo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "demo",
3 | "private": true,
4 | "scripts": {
5 | "dev": "vite",
6 | "build": "vite build",
7 | "test": "sirv dist"
8 | },
9 | "dependencies": {
10 | "react": "17.0.2",
11 | "react-dom": "17.0.2",
12 | "react-dropzone": "11.3.2",
13 | "react-one": "link:./packages/react-one",
14 | "react-switch": "6.0.0",
15 | "react-two": "link:./packages/react-two"
16 | },
17 | "devDependencies": {
18 | "@types/react": "17.0.6",
19 | "@types/react-dom": "17.0.5",
20 | "@vitejs/plugin-react-refresh": "^1.3.3",
21 | "sirv-cli": "^1.0.8",
22 | "vite": "link:../node_modules/vite",
23 | "vite-react-jsx": "link:.."
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/demo/packages/react-one/index.d.ts:
--------------------------------------------------------------------------------
1 | declare const One: () => JSX.Element
2 | export default One
3 |
--------------------------------------------------------------------------------
/demo/packages/react-one/index.jsx:
--------------------------------------------------------------------------------
1 | export default () => react-one
2 |
--------------------------------------------------------------------------------
/demo/packages/react-one/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-one",
3 | "private": true,
4 | "main": "index.jsx"
5 | }
6 |
--------------------------------------------------------------------------------
/demo/packages/react-two/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | interface Props {}
4 |
5 | export default () => react-two
6 |
--------------------------------------------------------------------------------
/demo/packages/react-two/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-two",
3 | "private": true,
4 | "main": "index.tsx"
5 | }
6 |
--------------------------------------------------------------------------------
/demo/packages/react-two/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "files": ["index.tsx"],
3 | "compilerOptions": {
4 | "jsx": "react",
5 | "esModuleInterop": true
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/demo/pnpm-lock.yaml:
--------------------------------------------------------------------------------
1 | lockfileVersion: 5.3
2 |
3 | specifiers:
4 | '@types/react': 17.0.6
5 | '@types/react-dom': 17.0.5
6 | '@vitejs/plugin-react-refresh': ^1.3.3
7 | react: 17.0.2
8 | react-dom: 17.0.2
9 | react-dropzone: 11.3.2
10 | react-one: link:./packages/react-one
11 | react-switch: 6.0.0
12 | react-two: link:./packages/react-two
13 | sirv-cli: ^1.0.8
14 | vite: link:../node_modules/vite
15 | vite-react-jsx: link:..
16 |
17 | dependencies:
18 | react: 17.0.2
19 | react-dom: 17.0.2_react@17.0.2
20 | react-dropzone: 11.3.2_react@17.0.2
21 | react-one: link:packages/react-one
22 | react-switch: 6.0.0_react-dom@17.0.2+react@17.0.2
23 | react-two: link:packages/react-two
24 |
25 | devDependencies:
26 | '@types/react': 17.0.6
27 | '@types/react-dom': 17.0.5
28 | '@vitejs/plugin-react-refresh': 1.3.3
29 | sirv-cli: 1.0.11
30 | vite: link:../node_modules/vite
31 | vite-react-jsx: link:..
32 |
33 | packages:
34 |
35 | /@babel/code-frame/7.12.13:
36 | resolution: {integrity: sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==}
37 | dependencies:
38 | '@babel/highlight': 7.14.0
39 | dev: true
40 |
41 | /@babel/compat-data/7.14.0:
42 | resolution: {integrity: sha512-vu9V3uMM/1o5Hl5OekMUowo3FqXLJSw+s+66nt0fSWVWTtmosdzn45JHOB3cPtZoe6CTBDzvSw0RdOY85Q37+Q==}
43 | dev: true
44 |
45 | /@babel/core/7.14.3:
46 | resolution: {integrity: sha512-jB5AmTKOCSJIZ72sd78ECEhuPiDMKlQdDI/4QRI6lzYATx5SSogS1oQA2AoPecRCknm30gHi2l+QVvNUu3wZAg==}
47 | engines: {node: '>=6.9.0'}
48 | dependencies:
49 | '@babel/code-frame': 7.12.13
50 | '@babel/generator': 7.14.3
51 | '@babel/helper-compilation-targets': 7.13.16_@babel+core@7.14.3
52 | '@babel/helper-module-transforms': 7.14.2
53 | '@babel/helpers': 7.14.0
54 | '@babel/parser': 7.14.3
55 | '@babel/template': 7.12.13
56 | '@babel/traverse': 7.14.2
57 | '@babel/types': 7.14.2
58 | convert-source-map: 1.7.0
59 | debug: 4.3.1
60 | gensync: 1.0.0-beta.2
61 | json5: 2.2.0
62 | semver: 6.3.0
63 | source-map: 0.5.7
64 | transitivePeerDependencies:
65 | - supports-color
66 | dev: true
67 |
68 | /@babel/generator/7.14.3:
69 | resolution: {integrity: sha512-bn0S6flG/j0xtQdz3hsjJ624h3W0r3llttBMfyHX3YrZ/KtLYr15bjA0FXkgW7FpvrDuTuElXeVjiKlYRpnOFA==}
70 | dependencies:
71 | '@babel/types': 7.14.2
72 | jsesc: 2.5.2
73 | source-map: 0.5.7
74 | dev: true
75 |
76 | /@babel/helper-compilation-targets/7.13.16_@babel+core@7.14.3:
77 | resolution: {integrity: sha512-3gmkYIrpqsLlieFwjkGgLaSHmhnvlAYzZLlYVjlW+QwI+1zE17kGxuJGmIqDQdYp56XdmGeD+Bswx0UTyG18xA==}
78 | peerDependencies:
79 | '@babel/core': ^7.0.0
80 | dependencies:
81 | '@babel/compat-data': 7.14.0
82 | '@babel/core': 7.14.3
83 | '@babel/helper-validator-option': 7.12.17
84 | browserslist: 4.16.6
85 | semver: 6.3.0
86 | dev: true
87 |
88 | /@babel/helper-function-name/7.14.2:
89 | resolution: {integrity: sha512-NYZlkZRydxw+YT56IlhIcS8PAhb+FEUiOzuhFTfqDyPmzAhRge6ua0dQYT/Uh0t/EDHq05/i+e5M2d4XvjgarQ==}
90 | dependencies:
91 | '@babel/helper-get-function-arity': 7.12.13
92 | '@babel/template': 7.12.13
93 | '@babel/types': 7.14.2
94 | dev: true
95 |
96 | /@babel/helper-get-function-arity/7.12.13:
97 | resolution: {integrity: sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg==}
98 | dependencies:
99 | '@babel/types': 7.14.2
100 | dev: true
101 |
102 | /@babel/helper-member-expression-to-functions/7.13.12:
103 | resolution: {integrity: sha512-48ql1CLL59aKbU94Y88Xgb2VFy7a95ykGRbJJaaVv+LX5U8wFpLfiGXJJGUozsmA1oEh/o5Bp60Voq7ACyA/Sw==}
104 | dependencies:
105 | '@babel/types': 7.14.2
106 | dev: true
107 |
108 | /@babel/helper-module-imports/7.13.12:
109 | resolution: {integrity: sha512-4cVvR2/1B693IuOvSI20xqqa/+bl7lqAMR59R4iu39R9aOX8/JoYY1sFaNvUMyMBGnHdwvJgUrzNLoUZxXypxA==}
110 | dependencies:
111 | '@babel/types': 7.14.2
112 | dev: true
113 |
114 | /@babel/helper-module-transforms/7.14.2:
115 | resolution: {integrity: sha512-OznJUda/soKXv0XhpvzGWDnml4Qnwp16GN+D/kZIdLsWoHj05kyu8Rm5kXmMef+rVJZ0+4pSGLkeixdqNUATDA==}
116 | dependencies:
117 | '@babel/helper-module-imports': 7.13.12
118 | '@babel/helper-replace-supers': 7.14.3
119 | '@babel/helper-simple-access': 7.13.12
120 | '@babel/helper-split-export-declaration': 7.12.13
121 | '@babel/helper-validator-identifier': 7.14.0
122 | '@babel/template': 7.12.13
123 | '@babel/traverse': 7.14.2
124 | '@babel/types': 7.14.2
125 | transitivePeerDependencies:
126 | - supports-color
127 | dev: true
128 |
129 | /@babel/helper-optimise-call-expression/7.12.13:
130 | resolution: {integrity: sha512-BdWQhoVJkp6nVjB7nkFWcn43dkprYauqtk++Py2eaf/GRDFm5BxRqEIZCiHlZUGAVmtwKcsVL1dC68WmzeFmiA==}
131 | dependencies:
132 | '@babel/types': 7.14.2
133 | dev: true
134 |
135 | /@babel/helper-plugin-utils/7.13.0:
136 | resolution: {integrity: sha512-ZPafIPSwzUlAoWT8DKs1W2VyF2gOWthGd5NGFMsBcMMol+ZhK+EQY/e6V96poa6PA/Bh+C9plWN0hXO1uB8AfQ==}
137 | dev: true
138 |
139 | /@babel/helper-replace-supers/7.14.3:
140 | resolution: {integrity: sha512-Rlh8qEWZSTfdz+tgNV/N4gz1a0TMNwCUcENhMjHTHKp3LseYH5Jha0NSlyTQWMnjbYcwFt+bqAMqSLHVXkQ6UA==}
141 | dependencies:
142 | '@babel/helper-member-expression-to-functions': 7.13.12
143 | '@babel/helper-optimise-call-expression': 7.12.13
144 | '@babel/traverse': 7.14.2
145 | '@babel/types': 7.14.2
146 | transitivePeerDependencies:
147 | - supports-color
148 | dev: true
149 |
150 | /@babel/helper-simple-access/7.13.12:
151 | resolution: {integrity: sha512-7FEjbrx5SL9cWvXioDbnlYTppcZGuCY6ow3/D5vMggb2Ywgu4dMrpTJX0JdQAIcRRUElOIxF3yEooa9gUb9ZbA==}
152 | dependencies:
153 | '@babel/types': 7.14.2
154 | dev: true
155 |
156 | /@babel/helper-split-export-declaration/7.12.13:
157 | resolution: {integrity: sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg==}
158 | dependencies:
159 | '@babel/types': 7.14.2
160 | dev: true
161 |
162 | /@babel/helper-validator-identifier/7.14.0:
163 | resolution: {integrity: sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A==}
164 | dev: true
165 |
166 | /@babel/helper-validator-option/7.12.17:
167 | resolution: {integrity: sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw==}
168 | dev: true
169 |
170 | /@babel/helpers/7.14.0:
171 | resolution: {integrity: sha512-+ufuXprtQ1D1iZTO/K9+EBRn+qPWMJjZSw/S0KlFrxCw4tkrzv9grgpDHkY9MeQTjTY8i2sp7Jep8DfU6tN9Mg==}
172 | dependencies:
173 | '@babel/template': 7.12.13
174 | '@babel/traverse': 7.14.2
175 | '@babel/types': 7.14.2
176 | transitivePeerDependencies:
177 | - supports-color
178 | dev: true
179 |
180 | /@babel/highlight/7.14.0:
181 | resolution: {integrity: sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg==}
182 | dependencies:
183 | '@babel/helper-validator-identifier': 7.14.0
184 | chalk: 2.4.2
185 | js-tokens: 4.0.0
186 | dev: true
187 |
188 | /@babel/parser/7.14.3:
189 | resolution: {integrity: sha512-7MpZDIfI7sUC5zWo2+foJ50CSI5lcqDehZ0lVgIhSi4bFEk94fLAKlF3Q0nzSQQ+ca0lm+O6G9ztKVBeu8PMRQ==}
190 | engines: {node: '>=6.0.0'}
191 | hasBin: true
192 | dev: true
193 |
194 | /@babel/plugin-transform-react-jsx-self/7.12.13_@babel+core@7.14.3:
195 | resolution: {integrity: sha512-FXYw98TTJ125GVCCkFLZXlZ1qGcsYqNQhVBQcZjyrwf8FEUtVfKIoidnO8S0q+KBQpDYNTmiGo1gn67Vti04lQ==}
196 | peerDependencies:
197 | '@babel/core': ^7.0.0-0
198 | dependencies:
199 | '@babel/core': 7.14.3
200 | '@babel/helper-plugin-utils': 7.13.0
201 | dev: true
202 |
203 | /@babel/plugin-transform-react-jsx-source/7.14.2_@babel+core@7.14.3:
204 | resolution: {integrity: sha512-OMorspVyjxghAjzgeAWc6O7W7vHbJhV69NeTGdl9Mxgz6PaweAuo7ffB9T5A1OQ9dGcw0As4SYMUhyNC4u7mVg==}
205 | peerDependencies:
206 | '@babel/core': ^7.0.0-0
207 | dependencies:
208 | '@babel/core': 7.14.3
209 | '@babel/helper-plugin-utils': 7.13.0
210 | dev: true
211 |
212 | /@babel/template/7.12.13:
213 | resolution: {integrity: sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA==}
214 | dependencies:
215 | '@babel/code-frame': 7.12.13
216 | '@babel/parser': 7.14.3
217 | '@babel/types': 7.14.2
218 | dev: true
219 |
220 | /@babel/traverse/7.14.2:
221 | resolution: {integrity: sha512-TsdRgvBFHMyHOOzcP9S6QU0QQtjxlRpEYOy3mcCO5RgmC305ki42aSAmfZEMSSYBla2oZ9BMqYlncBaKmD/7iA==}
222 | dependencies:
223 | '@babel/code-frame': 7.12.13
224 | '@babel/generator': 7.14.3
225 | '@babel/helper-function-name': 7.14.2
226 | '@babel/helper-split-export-declaration': 7.12.13
227 | '@babel/parser': 7.14.3
228 | '@babel/types': 7.14.2
229 | debug: 4.3.1
230 | globals: 11.12.0
231 | transitivePeerDependencies:
232 | - supports-color
233 | dev: true
234 |
235 | /@babel/types/7.14.2:
236 | resolution: {integrity: sha512-SdjAG/3DikRHpUOjxZgnkbR11xUlyDMUFJdvnIgZEE16mqmY0BINMmc4//JMJglEmn6i7sq6p+mGrFWyZ98EEw==}
237 | dependencies:
238 | '@babel/helper-validator-identifier': 7.14.0
239 | to-fast-properties: 2.0.0
240 | dev: true
241 |
242 | /@polka/url/1.0.0-next.12:
243 | resolution: {integrity: sha512-6RglhutqrGFMO1MNUXp95RBuYIuc8wTnMAV5MUhLmjTOy78ncwOw7RgeQ/HeymkKXRhZd0s2DNrM1rL7unk3MQ==}
244 | dev: true
245 |
246 | /@types/prop-types/15.7.3:
247 | resolution: {integrity: sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==}
248 | dev: true
249 |
250 | /@types/react-dom/17.0.5:
251 | resolution: {integrity: sha512-ikqukEhH4H9gr4iJCmQVNzTB307kROe3XFfHAOTxOXPOw7lAoEXnM5KWTkzeANGL5Ce6ABfiMl/zJBYNi7ObmQ==}
252 | dependencies:
253 | '@types/react': 17.0.6
254 | dev: true
255 |
256 | /@types/react/17.0.6:
257 | resolution: {integrity: sha512-u/TtPoF/hrvb63LdukET6ncaplYsvCvmkceasx8oG84/ZCsoLxz9Z/raPBP4lTAiWW1Jb889Y9svHmv8R26dWw==}
258 | dependencies:
259 | '@types/prop-types': 15.7.3
260 | '@types/scheduler': 0.16.1
261 | csstype: 3.0.8
262 | dev: true
263 |
264 | /@types/scheduler/0.16.1:
265 | resolution: {integrity: sha512-EaCxbanVeyxDRTQBkdLb3Bvl/HK7PBK6UJjsSixB0iHKoWxE5uu2Q/DgtpOhPIojN0Zl1whvOd7PoHs2P0s5eA==}
266 | dev: true
267 |
268 | /@vitejs/plugin-react-refresh/1.3.3:
269 | resolution: {integrity: sha512-J3KFwSQKrEK7fgOwTx0PMTlsolZORUch6BswjsM50q+Y7zSvX1ROIRn+tK2VE8SCvbYRHtzEKFlYW3vsWyTosQ==}
270 | engines: {node: '>=12.0.0'}
271 | dependencies:
272 | '@babel/core': 7.14.3
273 | '@babel/plugin-transform-react-jsx-self': 7.12.13_@babel+core@7.14.3
274 | '@babel/plugin-transform-react-jsx-source': 7.14.2_@babel+core@7.14.3
275 | react-refresh: 0.9.0
276 | transitivePeerDependencies:
277 | - supports-color
278 | dev: true
279 |
280 | /ansi-styles/3.2.1:
281 | resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==}
282 | engines: {node: '>=4'}
283 | dependencies:
284 | color-convert: 1.9.3
285 | dev: true
286 |
287 | /attr-accept/2.2.2:
288 | resolution: {integrity: sha512-7prDjvt9HmqiZ0cl5CRjtS84sEyhsHP2coDkaZKRKVfCDo9s7iw7ChVmar78Gu9pC4SoR/28wFu/G5JJhTnqEg==}
289 | engines: {node: '>=4'}
290 | dev: false
291 |
292 | /browserslist/4.16.6:
293 | resolution: {integrity: sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==}
294 | engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
295 | hasBin: true
296 | dependencies:
297 | caniuse-lite: 1.0.30001228
298 | colorette: 1.2.2
299 | electron-to-chromium: 1.3.735
300 | escalade: 3.1.1
301 | node-releases: 1.1.72
302 | dev: true
303 |
304 | /caniuse-lite/1.0.30001228:
305 | resolution: {integrity: sha512-QQmLOGJ3DEgokHbMSA8cj2a+geXqmnpyOFT0lhQV6P3/YOJvGDEwoedcwxEQ30gJIwIIunHIicunJ2rzK5gB2A==}
306 | dev: true
307 |
308 | /chalk/2.4.2:
309 | resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==}
310 | engines: {node: '>=4'}
311 | dependencies:
312 | ansi-styles: 3.2.1
313 | escape-string-regexp: 1.0.5
314 | supports-color: 5.5.0
315 | dev: true
316 |
317 | /color-convert/1.9.3:
318 | resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==}
319 | dependencies:
320 | color-name: 1.1.3
321 | dev: true
322 |
323 | /color-name/1.1.3:
324 | resolution: {integrity: sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=}
325 | dev: true
326 |
327 | /colorette/1.2.2:
328 | resolution: {integrity: sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==}
329 | dev: true
330 |
331 | /console-clear/1.1.1:
332 | resolution: {integrity: sha512-pMD+MVR538ipqkG5JXeOEbKWS5um1H4LUUccUQG68qpeqBYbzYy79Gh55jkd2TtPdRfUaLWdv6LPP//5Zt0aPQ==}
333 | engines: {node: '>=4'}
334 | dev: true
335 |
336 | /convert-source-map/1.7.0:
337 | resolution: {integrity: sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==}
338 | dependencies:
339 | safe-buffer: 5.1.2
340 | dev: true
341 |
342 | /csstype/3.0.8:
343 | resolution: {integrity: sha512-jXKhWqXPmlUeoQnF/EhTtTl4C9SnrxSH/jZUih3jmO6lBKr99rP3/+FmrMj4EFpOXzMtXHAZkd3x0E6h6Fgflw==}
344 | dev: true
345 |
346 | /debug/4.3.1:
347 | resolution: {integrity: sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==}
348 | engines: {node: '>=6.0'}
349 | peerDependencies:
350 | supports-color: '*'
351 | peerDependenciesMeta:
352 | supports-color:
353 | optional: true
354 | dependencies:
355 | ms: 2.1.2
356 | dev: true
357 |
358 | /electron-to-chromium/1.3.735:
359 | resolution: {integrity: sha512-cp7MWzC3NseUJV2FJFgaiesdrS+A8ZUjX5fLAxdRlcaPDkaPGFplX930S5vf84yqDp4LjuLdKouWuVOTwUfqHQ==}
360 | dev: true
361 |
362 | /escalade/3.1.1:
363 | resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==}
364 | engines: {node: '>=6'}
365 | dev: true
366 |
367 | /escape-string-regexp/1.0.5:
368 | resolution: {integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=}
369 | engines: {node: '>=0.8.0'}
370 | dev: true
371 |
372 | /file-selector/0.2.4:
373 | resolution: {integrity: sha512-ZDsQNbrv6qRi1YTDOEWzf5J2KjZ9KMI1Q2SGeTkCJmNNW25Jg4TW4UMcmoqcg4WrAyKRcpBXdbWRxkfrOzVRbA==}
374 | engines: {node: '>= 10'}
375 | dependencies:
376 | tslib: 2.2.0
377 | dev: false
378 |
379 | /gensync/1.0.0-beta.2:
380 | resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
381 | engines: {node: '>=6.9.0'}
382 | dev: true
383 |
384 | /get-port/3.2.0:
385 | resolution: {integrity: sha1-3Xzn3hh8Bsi/NTeWrHHgmfCYDrw=}
386 | engines: {node: '>=4'}
387 | dev: true
388 |
389 | /globals/11.12.0:
390 | resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==}
391 | engines: {node: '>=4'}
392 | dev: true
393 |
394 | /has-flag/3.0.0:
395 | resolution: {integrity: sha1-tdRU3CGZriJWmfNGfloH87lVuv0=}
396 | engines: {node: '>=4'}
397 | dev: true
398 |
399 | /js-tokens/4.0.0:
400 | resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
401 |
402 | /jsesc/2.5.2:
403 | resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==}
404 | engines: {node: '>=4'}
405 | hasBin: true
406 | dev: true
407 |
408 | /json5/2.2.0:
409 | resolution: {integrity: sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==}
410 | engines: {node: '>=6'}
411 | hasBin: true
412 | dependencies:
413 | minimist: 1.2.5
414 | dev: true
415 |
416 | /kleur/3.0.3:
417 | resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
418 | engines: {node: '>=6'}
419 | dev: true
420 |
421 | /local-access/1.1.0:
422 | resolution: {integrity: sha512-XfegD5pyTAfb+GY6chk283Ox5z8WexG56OvM06RWLpAc/UHozO8X6xAxEkIitZOtsSMM1Yr3DkHgW5W+onLhCw==}
423 | engines: {node: '>=6'}
424 | dev: true
425 |
426 | /loose-envify/1.4.0:
427 | resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==}
428 | hasBin: true
429 | dependencies:
430 | js-tokens: 4.0.0
431 | dev: false
432 |
433 | /mime/2.5.2:
434 | resolution: {integrity: sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==}
435 | engines: {node: '>=4.0.0'}
436 | hasBin: true
437 | dev: true
438 |
439 | /minimist/1.2.5:
440 | resolution: {integrity: sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==}
441 | dev: true
442 |
443 | /mri/1.1.6:
444 | resolution: {integrity: sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ==}
445 | engines: {node: '>=4'}
446 | dev: true
447 |
448 | /ms/2.1.2:
449 | resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
450 | dev: true
451 |
452 | /node-releases/1.1.72:
453 | resolution: {integrity: sha512-LLUo+PpH3dU6XizX3iVoubUNheF/owjXCZZ5yACDxNnPtgFuludV1ZL3ayK1kVep42Rmm0+R9/Y60NQbZ2bifw==}
454 | dev: true
455 |
456 | /object-assign/4.1.1:
457 | resolution: {integrity: sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=}
458 | engines: {node: '>=0.10.0'}
459 | dev: false
460 |
461 | /prop-types/15.7.2:
462 | resolution: {integrity: sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==}
463 | dependencies:
464 | loose-envify: 1.4.0
465 | object-assign: 4.1.1
466 | react-is: 16.13.1
467 | dev: false
468 |
469 | /react-dom/17.0.2_react@17.0.2:
470 | resolution: {integrity: sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==}
471 | peerDependencies:
472 | react: 17.0.2
473 | dependencies:
474 | loose-envify: 1.4.0
475 | object-assign: 4.1.1
476 | react: 17.0.2
477 | scheduler: 0.20.2
478 | dev: false
479 |
480 | /react-dropzone/11.3.2_react@17.0.2:
481 | resolution: {integrity: sha512-Z0l/YHcrNK1r85o6RT77Z5XgTARmlZZGfEKBl3tqTXL9fZNQDuIdRx/J0QjvR60X+yYu26dnHeaG2pWU+1HHvw==}
482 | engines: {node: '>= 10'}
483 | peerDependencies:
484 | react: '>= 16.8'
485 | dependencies:
486 | attr-accept: 2.2.2
487 | file-selector: 0.2.4
488 | prop-types: 15.7.2
489 | react: 17.0.2
490 | dev: false
491 |
492 | /react-is/16.13.1:
493 | resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
494 | dev: false
495 |
496 | /react-refresh/0.9.0:
497 | resolution: {integrity: sha512-Gvzk7OZpiqKSkxsQvO/mbTN1poglhmAV7gR/DdIrRrSMXraRQQlfikRJOr3Nb9GTMPC5kof948Zy6jJZIFtDvQ==}
498 | engines: {node: '>=0.10.0'}
499 | dev: true
500 |
501 | /react-switch/6.0.0_react-dom@17.0.2+react@17.0.2:
502 | resolution: {integrity: sha512-QV3/6eRK5/5epdQzIqvDAHRoGLbCv/wDpHUi6yBMXY1Xco5XGuIZxvB49PHoV1v/SpEgOCJLD/Zo43iic+aEIw==}
503 | peerDependencies:
504 | react: ^15.3.0 || ^16.0.0 || ^17.0.0
505 | react-dom: ^15.3.0 || ^16.0.0 || ^17.0.0
506 | dependencies:
507 | prop-types: 15.7.2
508 | react: 17.0.2
509 | react-dom: 17.0.2_react@17.0.2
510 | dev: false
511 |
512 | /react/17.0.2:
513 | resolution: {integrity: sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==}
514 | engines: {node: '>=0.10.0'}
515 | dependencies:
516 | loose-envify: 1.4.0
517 | object-assign: 4.1.1
518 | dev: false
519 |
520 | /sade/1.7.4:
521 | resolution: {integrity: sha512-y5yauMD93rX840MwUJr7C1ysLFBgMspsdTo4UVrDg3fXDvtwOyIqykhVAAm6fk/3au77773itJStObgK+LKaiA==}
522 | engines: {node: '>= 6'}
523 | dependencies:
524 | mri: 1.1.6
525 | dev: true
526 |
527 | /safe-buffer/5.1.2:
528 | resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==}
529 | dev: true
530 |
531 | /scheduler/0.20.2:
532 | resolution: {integrity: sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==}
533 | dependencies:
534 | loose-envify: 1.4.0
535 | object-assign: 4.1.1
536 | dev: false
537 |
538 | /semiver/1.1.0:
539 | resolution: {integrity: sha512-QNI2ChmuioGC1/xjyYwyZYADILWyW6AmS1UH6gDj/SFUUUS4MBAWs/7mxnkRPc/F4iHezDP+O8t0dO8WHiEOdg==}
540 | engines: {node: '>=6'}
541 | dev: true
542 |
543 | /semver/6.3.0:
544 | resolution: {integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==}
545 | hasBin: true
546 | dev: true
547 |
548 | /sirv-cli/1.0.11:
549 | resolution: {integrity: sha512-L8NILoRSBd38VcfFcERYCaVCnWPBLo9G6u/a37UJ8Ysv4DfjizMbFBcM+SswNnndJienhR6qy8KFuAEaeL4g8Q==}
550 | engines: {node: '>= 10'}
551 | hasBin: true
552 | dependencies:
553 | console-clear: 1.1.1
554 | get-port: 3.2.0
555 | kleur: 3.0.3
556 | local-access: 1.1.0
557 | sade: 1.7.4
558 | semiver: 1.1.0
559 | sirv: 1.0.11
560 | tinydate: 1.3.0
561 | dev: true
562 |
563 | /sirv/1.0.11:
564 | resolution: {integrity: sha512-SR36i3/LSWja7AJNRBz4fF/Xjpn7lQFI30tZ434dIy+bitLYSP+ZEenHg36i23V2SGEz+kqjksg0uOGZ5LPiqg==}
565 | engines: {node: '>= 10'}
566 | dependencies:
567 | '@polka/url': 1.0.0-next.12
568 | mime: 2.5.2
569 | totalist: 1.1.0
570 | dev: true
571 |
572 | /source-map/0.5.7:
573 | resolution: {integrity: sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=}
574 | engines: {node: '>=0.10.0'}
575 | dev: true
576 |
577 | /supports-color/5.5.0:
578 | resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
579 | engines: {node: '>=4'}
580 | dependencies:
581 | has-flag: 3.0.0
582 | dev: true
583 |
584 | /tinydate/1.3.0:
585 | resolution: {integrity: sha512-7cR8rLy2QhYHpsBDBVYnnWXm8uRTr38RoZakFSW7Bs7PzfMPNZthuMLkwqZv7MTu8lhQ91cOFYS5a7iFj2oR3w==}
586 | engines: {node: '>=4'}
587 | dev: true
588 |
589 | /to-fast-properties/2.0.0:
590 | resolution: {integrity: sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=}
591 | engines: {node: '>=4'}
592 | dev: true
593 |
594 | /totalist/1.1.0:
595 | resolution: {integrity: sha512-gduQwd1rOdDMGxFG1gEvhV88Oirdo2p+KjoYFU7k2g+i7n6AFFbDQ5kMPUsW0pNbfQsB/cwXvT1i4Bue0s9g5g==}
596 | engines: {node: '>=6'}
597 | dev: true
598 |
599 | /tslib/2.2.0:
600 | resolution: {integrity: sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==}
601 | dev: false
602 |
--------------------------------------------------------------------------------
/demo/src/Root.tsx:
--------------------------------------------------------------------------------
1 | import { useState } from 'react'
2 |
3 | // This local package uses the automatic JSX runtime in a .jsx module
4 | import One from 'react-one'
5 |
6 | // This local package uses `import React from 'react'` in a .tsx module
7 | import Two from 'react-two'
8 |
9 | // This package has a minified CJS entry point and a development module
10 | import { Switch } from './deps'
11 |
12 | // This package has a ESM entry point
13 | import Dropzone from 'react-dropzone'
14 |
15 | export const Root = () => {
16 | const [checked, setChecked] = useState(false)
17 | return (
18 | <>
19 |
20 |
21 |
22 |
23 | >
24 | )
25 | }
26 |
27 | const FileZone = () => (
28 |
29 |
30 | {state => (
31 |
32 |
33 |
48 | Drop a file on me!
49 |
50 |
51 | )}
52 |
53 |
54 | )
55 |
--------------------------------------------------------------------------------
/demo/src/deps.tsx:
--------------------------------------------------------------------------------
1 | import S from 'react-switch'
2 |
3 | export const Switch = interopDefault(S)
4 |
5 | function interopDefault(value: T): T {
6 | return (value as any).default
7 | }
8 |
--------------------------------------------------------------------------------
/demo/src/main.tsx:
--------------------------------------------------------------------------------
1 | import ReactDOM from 'react-dom'
2 | import { Root } from './Root'
3 | import './styles.css'
4 |
5 | ReactDOM.render( , document.getElementById('root'))
6 |
--------------------------------------------------------------------------------
/demo/src/styles.css:
--------------------------------------------------------------------------------
1 | body {
2 | color: lightblue;
3 | font-size: 300%;
4 | font-family: Menlo, monospace;
5 | text-align: center;
6 | background: darkslateblue;
7 | padding-top: 200px;
8 | }
9 |
--------------------------------------------------------------------------------
/demo/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "include": ["src", "vite.config.ts"],
4 | "compilerOptions": {
5 | "jsx": "react-jsx",
6 | "lib": ["dom", "es2018"]
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/demo/vite.config.ts:
--------------------------------------------------------------------------------
1 | import reactJsx from 'vite-react-jsx'
2 | import reactRefresh from '@vitejs/plugin-react-refresh'
3 | import type { UserConfig } from 'vite'
4 |
5 | const config: UserConfig = {
6 | plugins: [reactRefresh(), reactJsx()],
7 | build: {
8 | // The minified bundle works as expected.
9 | minify: false,
10 | // Source maps are generated properly.
11 | sourcemap: true,
12 | },
13 | }
14 |
15 | export default config
16 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vite-react-jsx",
3 | "version": "1.1.2",
4 | "description": "React 17's automatic JSX runtime for your entire bundle",
5 | "author": "Alec Larson",
6 | "license": "MIT",
7 | "repository": "alloc/vite-react-jsx",
8 | "main": "dist/cjs/plugin.js",
9 | "module": "dist/esm/plugin.js",
10 | "exports": {
11 | "import": "./dist/esm/plugin.js",
12 | "require": "./dist/cjs/plugin.js"
13 | },
14 | "files": [
15 | "src",
16 | "dist"
17 | ],
18 | "scripts": {
19 | "build": "rimraf dist && tsc -p . --outDir dist/esm && tsc -p . --module commonjs --outDir dist/cjs",
20 | "prepublishOnly": "yarn build"
21 | },
22 | "peerDependencies": {
23 | "vite": ">2.0.0-0"
24 | },
25 | "devDependencies": {
26 | "@alloc/fast-rimraf": "^1.0.8",
27 | "@alloc/prettier-config": "^1.0.0",
28 | "@types/babel__core": "^7.1.14",
29 | "@types/node": "^14.14.20",
30 | "@types/resolve": "^1.20.0",
31 | "prettier": "^2.0.5",
32 | "typescript": "^4.0.0",
33 | "vite": "latest"
34 | },
35 | "prettier": "@alloc/prettier-config",
36 | "keywords": [
37 | "vite",
38 | "vite-plugin",
39 | "react",
40 | "react17",
41 | "jsx",
42 | "runtime"
43 | ],
44 | "dependencies": {
45 | "@babel/core": "^7.14.3",
46 | "@babel/plugin-syntax-jsx": "^7.12.13",
47 | "@babel/plugin-syntax-typescript": "^7.12.13",
48 | "@babel/plugin-transform-react-jsx": "^7.14.3",
49 | "resolve": "^1.20.0"
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/pnpm-lock.yaml:
--------------------------------------------------------------------------------
1 | lockfileVersion: 5.3
2 |
3 | specifiers:
4 | '@alloc/fast-rimraf': ^1.0.8
5 | '@alloc/prettier-config': ^1.0.0
6 | '@babel/core': ^7.14.3
7 | '@babel/plugin-syntax-jsx': ^7.12.13
8 | '@babel/plugin-syntax-typescript': ^7.12.13
9 | '@babel/plugin-transform-react-jsx': ^7.14.3
10 | '@types/babel__core': ^7.1.14
11 | '@types/node': ^14.14.20
12 | '@types/resolve': ^1.20.0
13 | prettier: ^2.0.5
14 | resolve: ^1.20.0
15 | typescript: ^4.0.0
16 | vite: latest
17 |
18 | dependencies:
19 | '@babel/core': 7.14.3
20 | '@babel/plugin-syntax-jsx': 7.12.13_@babel+core@7.14.3
21 | '@babel/plugin-syntax-typescript': 7.12.13_@babel+core@7.14.3
22 | '@babel/plugin-transform-react-jsx': 7.14.3_@babel+core@7.14.3
23 | resolve: 1.20.0
24 |
25 | devDependencies:
26 | '@alloc/fast-rimraf': 1.0.8
27 | '@alloc/prettier-config': 1.0.0
28 | '@types/babel__core': 7.1.14
29 | '@types/node': 14.17.0
30 | '@types/resolve': 1.20.0
31 | prettier: 2.3.0
32 | typescript: 4.2.4
33 | vite: 2.3.3
34 |
35 | packages:
36 |
37 | /@alloc/fast-rimraf/1.0.8:
38 | resolution: {integrity: sha512-TsRTRLLDW6Q4fWBAYlbkcaHQDAANKsI0smrhS/1x7/GHcjVxo+r+2VRbqrWaYpmjdhvCp5v7n2wtwkMYp+Kivw==}
39 | hasBin: true
40 | dev: true
41 |
42 | /@alloc/prettier-config/1.0.0:
43 | resolution: {integrity: sha512-xm50V1qxSdTh1O1fKA+gqcU605YSnxfq6HwtYSFU3fRsKMFnUSuSOxqSAPI7y2sRxqPed2EIuGmNn107LVQM6g==}
44 | dev: true
45 |
46 | /@babel/code-frame/7.12.13:
47 | resolution: {integrity: sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==}
48 | dependencies:
49 | '@babel/highlight': 7.14.0
50 | dev: false
51 |
52 | /@babel/compat-data/7.14.0:
53 | resolution: {integrity: sha512-vu9V3uMM/1o5Hl5OekMUowo3FqXLJSw+s+66nt0fSWVWTtmosdzn45JHOB3cPtZoe6CTBDzvSw0RdOY85Q37+Q==}
54 | dev: false
55 |
56 | /@babel/core/7.14.3:
57 | resolution: {integrity: sha512-jB5AmTKOCSJIZ72sd78ECEhuPiDMKlQdDI/4QRI6lzYATx5SSogS1oQA2AoPecRCknm30gHi2l+QVvNUu3wZAg==}
58 | engines: {node: '>=6.9.0'}
59 | dependencies:
60 | '@babel/code-frame': 7.12.13
61 | '@babel/generator': 7.14.3
62 | '@babel/helper-compilation-targets': 7.13.16_@babel+core@7.14.3
63 | '@babel/helper-module-transforms': 7.14.2
64 | '@babel/helpers': 7.14.0
65 | '@babel/parser': 7.14.3
66 | '@babel/template': 7.12.13
67 | '@babel/traverse': 7.14.2
68 | '@babel/types': 7.14.2
69 | convert-source-map: 1.7.0
70 | debug: 4.3.1
71 | gensync: 1.0.0-beta.2
72 | json5: 2.2.0
73 | semver: 6.3.0
74 | source-map: 0.5.7
75 | transitivePeerDependencies:
76 | - supports-color
77 | dev: false
78 |
79 | /@babel/generator/7.14.3:
80 | resolution: {integrity: sha512-bn0S6flG/j0xtQdz3hsjJ624h3W0r3llttBMfyHX3YrZ/KtLYr15bjA0FXkgW7FpvrDuTuElXeVjiKlYRpnOFA==}
81 | dependencies:
82 | '@babel/types': 7.14.2
83 | jsesc: 2.5.2
84 | source-map: 0.5.7
85 | dev: false
86 |
87 | /@babel/helper-annotate-as-pure/7.12.13:
88 | resolution: {integrity: sha512-7YXfX5wQ5aYM/BOlbSccHDbuXXFPxeoUmfWtz8le2yTkTZc+BxsiEnENFoi2SlmA8ewDkG2LgIMIVzzn2h8kfw==}
89 | dependencies:
90 | '@babel/types': 7.14.2
91 | dev: false
92 |
93 | /@babel/helper-compilation-targets/7.13.16_@babel+core@7.14.3:
94 | resolution: {integrity: sha512-3gmkYIrpqsLlieFwjkGgLaSHmhnvlAYzZLlYVjlW+QwI+1zE17kGxuJGmIqDQdYp56XdmGeD+Bswx0UTyG18xA==}
95 | peerDependencies:
96 | '@babel/core': ^7.0.0
97 | dependencies:
98 | '@babel/compat-data': 7.14.0
99 | '@babel/core': 7.14.3
100 | '@babel/helper-validator-option': 7.12.17
101 | browserslist: 4.16.6
102 | semver: 6.3.0
103 | dev: false
104 |
105 | /@babel/helper-function-name/7.14.2:
106 | resolution: {integrity: sha512-NYZlkZRydxw+YT56IlhIcS8PAhb+FEUiOzuhFTfqDyPmzAhRge6ua0dQYT/Uh0t/EDHq05/i+e5M2d4XvjgarQ==}
107 | dependencies:
108 | '@babel/helper-get-function-arity': 7.12.13
109 | '@babel/template': 7.12.13
110 | '@babel/types': 7.14.2
111 | dev: false
112 |
113 | /@babel/helper-get-function-arity/7.12.13:
114 | resolution: {integrity: sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg==}
115 | dependencies:
116 | '@babel/types': 7.14.2
117 | dev: false
118 |
119 | /@babel/helper-member-expression-to-functions/7.13.12:
120 | resolution: {integrity: sha512-48ql1CLL59aKbU94Y88Xgb2VFy7a95ykGRbJJaaVv+LX5U8wFpLfiGXJJGUozsmA1oEh/o5Bp60Voq7ACyA/Sw==}
121 | dependencies:
122 | '@babel/types': 7.14.2
123 | dev: false
124 |
125 | /@babel/helper-module-imports/7.13.12:
126 | resolution: {integrity: sha512-4cVvR2/1B693IuOvSI20xqqa/+bl7lqAMR59R4iu39R9aOX8/JoYY1sFaNvUMyMBGnHdwvJgUrzNLoUZxXypxA==}
127 | dependencies:
128 | '@babel/types': 7.14.2
129 | dev: false
130 |
131 | /@babel/helper-module-transforms/7.14.2:
132 | resolution: {integrity: sha512-OznJUda/soKXv0XhpvzGWDnml4Qnwp16GN+D/kZIdLsWoHj05kyu8Rm5kXmMef+rVJZ0+4pSGLkeixdqNUATDA==}
133 | dependencies:
134 | '@babel/helper-module-imports': 7.13.12
135 | '@babel/helper-replace-supers': 7.14.3
136 | '@babel/helper-simple-access': 7.13.12
137 | '@babel/helper-split-export-declaration': 7.12.13
138 | '@babel/helper-validator-identifier': 7.14.0
139 | '@babel/template': 7.12.13
140 | '@babel/traverse': 7.14.2
141 | '@babel/types': 7.14.2
142 | transitivePeerDependencies:
143 | - supports-color
144 | dev: false
145 |
146 | /@babel/helper-optimise-call-expression/7.12.13:
147 | resolution: {integrity: sha512-BdWQhoVJkp6nVjB7nkFWcn43dkprYauqtk++Py2eaf/GRDFm5BxRqEIZCiHlZUGAVmtwKcsVL1dC68WmzeFmiA==}
148 | dependencies:
149 | '@babel/types': 7.14.2
150 | dev: false
151 |
152 | /@babel/helper-plugin-utils/7.13.0:
153 | resolution: {integrity: sha512-ZPafIPSwzUlAoWT8DKs1W2VyF2gOWthGd5NGFMsBcMMol+ZhK+EQY/e6V96poa6PA/Bh+C9plWN0hXO1uB8AfQ==}
154 | dev: false
155 |
156 | /@babel/helper-replace-supers/7.14.3:
157 | resolution: {integrity: sha512-Rlh8qEWZSTfdz+tgNV/N4gz1a0TMNwCUcENhMjHTHKp3LseYH5Jha0NSlyTQWMnjbYcwFt+bqAMqSLHVXkQ6UA==}
158 | dependencies:
159 | '@babel/helper-member-expression-to-functions': 7.13.12
160 | '@babel/helper-optimise-call-expression': 7.12.13
161 | '@babel/traverse': 7.14.2
162 | '@babel/types': 7.14.2
163 | transitivePeerDependencies:
164 | - supports-color
165 | dev: false
166 |
167 | /@babel/helper-simple-access/7.13.12:
168 | resolution: {integrity: sha512-7FEjbrx5SL9cWvXioDbnlYTppcZGuCY6ow3/D5vMggb2Ywgu4dMrpTJX0JdQAIcRRUElOIxF3yEooa9gUb9ZbA==}
169 | dependencies:
170 | '@babel/types': 7.14.2
171 | dev: false
172 |
173 | /@babel/helper-split-export-declaration/7.12.13:
174 | resolution: {integrity: sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg==}
175 | dependencies:
176 | '@babel/types': 7.14.2
177 | dev: false
178 |
179 | /@babel/helper-validator-identifier/7.14.0:
180 | resolution: {integrity: sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A==}
181 |
182 | /@babel/helper-validator-option/7.12.17:
183 | resolution: {integrity: sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw==}
184 | dev: false
185 |
186 | /@babel/helpers/7.14.0:
187 | resolution: {integrity: sha512-+ufuXprtQ1D1iZTO/K9+EBRn+qPWMJjZSw/S0KlFrxCw4tkrzv9grgpDHkY9MeQTjTY8i2sp7Jep8DfU6tN9Mg==}
188 | dependencies:
189 | '@babel/template': 7.12.13
190 | '@babel/traverse': 7.14.2
191 | '@babel/types': 7.14.2
192 | transitivePeerDependencies:
193 | - supports-color
194 | dev: false
195 |
196 | /@babel/highlight/7.14.0:
197 | resolution: {integrity: sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg==}
198 | dependencies:
199 | '@babel/helper-validator-identifier': 7.14.0
200 | chalk: 2.4.2
201 | js-tokens: 4.0.0
202 | dev: false
203 |
204 | /@babel/parser/7.14.3:
205 | resolution: {integrity: sha512-7MpZDIfI7sUC5zWo2+foJ50CSI5lcqDehZ0lVgIhSi4bFEk94fLAKlF3Q0nzSQQ+ca0lm+O6G9ztKVBeu8PMRQ==}
206 | engines: {node: '>=6.0.0'}
207 | hasBin: true
208 |
209 | /@babel/plugin-syntax-jsx/7.12.13_@babel+core@7.14.3:
210 | resolution: {integrity: sha512-d4HM23Q1K7oq/SLNmG6mRt85l2csmQ0cHRaxRXjKW0YFdEXqlZ5kzFQKH5Uc3rDJECgu+yCRgPkG04Mm98R/1g==}
211 | peerDependencies:
212 | '@babel/core': ^7.0.0-0
213 | dependencies:
214 | '@babel/core': 7.14.3
215 | '@babel/helper-plugin-utils': 7.13.0
216 | dev: false
217 |
218 | /@babel/plugin-syntax-typescript/7.12.13_@babel+core@7.14.3:
219 | resolution: {integrity: sha512-cHP3u1JiUiG2LFDKbXnwVad81GvfyIOmCD6HIEId6ojrY0Drfy2q1jw7BwN7dE84+kTnBjLkXoL3IEy/3JPu2w==}
220 | peerDependencies:
221 | '@babel/core': ^7.0.0-0
222 | dependencies:
223 | '@babel/core': 7.14.3
224 | '@babel/helper-plugin-utils': 7.13.0
225 | dev: false
226 |
227 | /@babel/plugin-transform-react-jsx/7.14.3_@babel+core@7.14.3:
228 | resolution: {integrity: sha512-uuxuoUNVhdgYzERiHHFkE4dWoJx+UFVyuAl0aqN8P2/AKFHwqgUC5w2+4/PjpKXJsFgBlYAFXlUmDQ3k3DUkXw==}
229 | peerDependencies:
230 | '@babel/core': ^7.0.0-0
231 | dependencies:
232 | '@babel/core': 7.14.3
233 | '@babel/helper-annotate-as-pure': 7.12.13
234 | '@babel/helper-module-imports': 7.13.12
235 | '@babel/helper-plugin-utils': 7.13.0
236 | '@babel/plugin-syntax-jsx': 7.12.13_@babel+core@7.14.3
237 | '@babel/types': 7.14.2
238 | dev: false
239 |
240 | /@babel/template/7.12.13:
241 | resolution: {integrity: sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA==}
242 | dependencies:
243 | '@babel/code-frame': 7.12.13
244 | '@babel/parser': 7.14.3
245 | '@babel/types': 7.14.2
246 | dev: false
247 |
248 | /@babel/traverse/7.14.2:
249 | resolution: {integrity: sha512-TsdRgvBFHMyHOOzcP9S6QU0QQtjxlRpEYOy3mcCO5RgmC305ki42aSAmfZEMSSYBla2oZ9BMqYlncBaKmD/7iA==}
250 | dependencies:
251 | '@babel/code-frame': 7.12.13
252 | '@babel/generator': 7.14.3
253 | '@babel/helper-function-name': 7.14.2
254 | '@babel/helper-split-export-declaration': 7.12.13
255 | '@babel/parser': 7.14.3
256 | '@babel/types': 7.14.2
257 | debug: 4.3.1
258 | globals: 11.12.0
259 | transitivePeerDependencies:
260 | - supports-color
261 | dev: false
262 |
263 | /@babel/types/7.14.2:
264 | resolution: {integrity: sha512-SdjAG/3DikRHpUOjxZgnkbR11xUlyDMUFJdvnIgZEE16mqmY0BINMmc4//JMJglEmn6i7sq6p+mGrFWyZ98EEw==}
265 | dependencies:
266 | '@babel/helper-validator-identifier': 7.14.0
267 | to-fast-properties: 2.0.0
268 |
269 | /@types/babel__core/7.1.14:
270 | resolution: {integrity: sha512-zGZJzzBUVDo/eV6KgbE0f0ZI7dInEYvo12Rb70uNQDshC3SkRMb67ja0GgRHZgAX3Za6rhaWlvbDO8rrGyAb1g==}
271 | dependencies:
272 | '@babel/parser': 7.14.3
273 | '@babel/types': 7.14.2
274 | '@types/babel__generator': 7.6.2
275 | '@types/babel__template': 7.4.0
276 | '@types/babel__traverse': 7.11.1
277 | dev: true
278 |
279 | /@types/babel__generator/7.6.2:
280 | resolution: {integrity: sha512-MdSJnBjl+bdwkLskZ3NGFp9YcXGx5ggLpQQPqtgakVhsWK0hTtNYhjpZLlWQTviGTvF8at+Bvli3jV7faPdgeQ==}
281 | dependencies:
282 | '@babel/types': 7.14.2
283 | dev: true
284 |
285 | /@types/babel__template/7.4.0:
286 | resolution: {integrity: sha512-NTPErx4/FiPCGScH7foPyr+/1Dkzkni+rHiYHHoTjvwou7AQzJkNeD60A9CXRy+ZEN2B1bggmkTMCDb+Mv5k+A==}
287 | dependencies:
288 | '@babel/parser': 7.14.3
289 | '@babel/types': 7.14.2
290 | dev: true
291 |
292 | /@types/babel__traverse/7.11.1:
293 | resolution: {integrity: sha512-Vs0hm0vPahPMYi9tDjtP66llufgO3ST16WXaSTtDGEl9cewAl3AibmxWw6TINOqHPT9z0uABKAYjT9jNSg4npw==}
294 | dependencies:
295 | '@babel/types': 7.14.2
296 | dev: true
297 |
298 | /@types/node/14.17.0:
299 | resolution: {integrity: sha512-w8VZUN/f7SSbvVReb9SWp6cJFevxb4/nkG65yLAya//98WgocKm5PLDAtSs5CtJJJM+kHmJjO/6mmYW4MHShZA==}
300 | dev: true
301 |
302 | /@types/resolve/1.20.0:
303 | resolution: {integrity: sha512-SFT3jdUNlLkjxUWwH/0QjLiEsV38hjdDX8oMcX9jZAD8KWNzRLdg6INZE7UMz9O86b2BOHzA3dR8nF+DbonX2Q==}
304 | dev: true
305 |
306 | /ansi-styles/3.2.1:
307 | resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==}
308 | engines: {node: '>=4'}
309 | dependencies:
310 | color-convert: 1.9.3
311 | dev: false
312 |
313 | /browserslist/4.16.6:
314 | resolution: {integrity: sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==}
315 | engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
316 | hasBin: true
317 | dependencies:
318 | caniuse-lite: 1.0.30001228
319 | colorette: 1.2.2
320 | electron-to-chromium: 1.3.735
321 | escalade: 3.1.1
322 | node-releases: 1.1.72
323 | dev: false
324 |
325 | /caniuse-lite/1.0.30001228:
326 | resolution: {integrity: sha512-QQmLOGJ3DEgokHbMSA8cj2a+geXqmnpyOFT0lhQV6P3/YOJvGDEwoedcwxEQ30gJIwIIunHIicunJ2rzK5gB2A==}
327 | dev: false
328 |
329 | /chalk/2.4.2:
330 | resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==}
331 | engines: {node: '>=4'}
332 | dependencies:
333 | ansi-styles: 3.2.1
334 | escape-string-regexp: 1.0.5
335 | supports-color: 5.5.0
336 | dev: false
337 |
338 | /color-convert/1.9.3:
339 | resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==}
340 | dependencies:
341 | color-name: 1.1.3
342 | dev: false
343 |
344 | /color-name/1.1.3:
345 | resolution: {integrity: sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=}
346 | dev: false
347 |
348 | /colorette/1.2.2:
349 | resolution: {integrity: sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==}
350 |
351 | /convert-source-map/1.7.0:
352 | resolution: {integrity: sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==}
353 | dependencies:
354 | safe-buffer: 5.1.2
355 | dev: false
356 |
357 | /debug/4.3.1:
358 | resolution: {integrity: sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==}
359 | engines: {node: '>=6.0'}
360 | peerDependencies:
361 | supports-color: '*'
362 | peerDependenciesMeta:
363 | supports-color:
364 | optional: true
365 | dependencies:
366 | ms: 2.1.2
367 | dev: false
368 |
369 | /electron-to-chromium/1.3.735:
370 | resolution: {integrity: sha512-cp7MWzC3NseUJV2FJFgaiesdrS+A8ZUjX5fLAxdRlcaPDkaPGFplX930S5vf84yqDp4LjuLdKouWuVOTwUfqHQ==}
371 | dev: false
372 |
373 | /esbuild/0.11.23:
374 | resolution: {integrity: sha512-iaiZZ9vUF5wJV8ob1tl+5aJTrwDczlvGP0JoMmnpC2B0ppiMCu8n8gmy5ZTGl5bcG081XBVn+U+jP+mPFm5T5Q==}
375 | hasBin: true
376 | requiresBuild: true
377 | dev: true
378 |
379 | /escalade/3.1.1:
380 | resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==}
381 | engines: {node: '>=6'}
382 | dev: false
383 |
384 | /escape-string-regexp/1.0.5:
385 | resolution: {integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=}
386 | engines: {node: '>=0.8.0'}
387 | dev: false
388 |
389 | /fsevents/2.3.2:
390 | resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
391 | engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
392 | os: [darwin]
393 | dev: true
394 | optional: true
395 |
396 | /function-bind/1.1.1:
397 | resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==}
398 |
399 | /gensync/1.0.0-beta.2:
400 | resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
401 | engines: {node: '>=6.9.0'}
402 | dev: false
403 |
404 | /globals/11.12.0:
405 | resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==}
406 | engines: {node: '>=4'}
407 | dev: false
408 |
409 | /has-flag/3.0.0:
410 | resolution: {integrity: sha1-tdRU3CGZriJWmfNGfloH87lVuv0=}
411 | engines: {node: '>=4'}
412 | dev: false
413 |
414 | /has/1.0.3:
415 | resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==}
416 | engines: {node: '>= 0.4.0'}
417 | dependencies:
418 | function-bind: 1.1.1
419 |
420 | /is-core-module/2.4.0:
421 | resolution: {integrity: sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==}
422 | dependencies:
423 | has: 1.0.3
424 |
425 | /js-tokens/4.0.0:
426 | resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
427 | dev: false
428 |
429 | /jsesc/2.5.2:
430 | resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==}
431 | engines: {node: '>=4'}
432 | hasBin: true
433 | dev: false
434 |
435 | /json5/2.2.0:
436 | resolution: {integrity: sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==}
437 | engines: {node: '>=6'}
438 | hasBin: true
439 | dependencies:
440 | minimist: 1.2.5
441 | dev: false
442 |
443 | /minimist/1.2.5:
444 | resolution: {integrity: sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==}
445 | dev: false
446 |
447 | /ms/2.1.2:
448 | resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
449 | dev: false
450 |
451 | /nanoid/3.1.23:
452 | resolution: {integrity: sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==}
453 | engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
454 | hasBin: true
455 | dev: true
456 |
457 | /node-releases/1.1.72:
458 | resolution: {integrity: sha512-LLUo+PpH3dU6XizX3iVoubUNheF/owjXCZZ5yACDxNnPtgFuludV1ZL3ayK1kVep42Rmm0+R9/Y60NQbZ2bifw==}
459 | dev: false
460 |
461 | /path-parse/1.0.6:
462 | resolution: {integrity: sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==}
463 |
464 | /postcss/8.3.0:
465 | resolution: {integrity: sha512-+ogXpdAjWGa+fdYY5BQ96V/6tAo+TdSSIMP5huJBIygdWwKtVoB5JWZ7yUd4xZ8r+8Kvvx4nyg/PQ071H4UtcQ==}
466 | engines: {node: ^10 || ^12 || >=14}
467 | dependencies:
468 | colorette: 1.2.2
469 | nanoid: 3.1.23
470 | source-map-js: 0.6.2
471 | dev: true
472 |
473 | /prettier/2.3.0:
474 | resolution: {integrity: sha512-kXtO4s0Lz/DW/IJ9QdWhAf7/NmPWQXkFr/r/WkR3vyI+0v8amTDxiaQSLzs8NBlytfLWX/7uQUMIW677yLKl4w==}
475 | engines: {node: '>=10.13.0'}
476 | hasBin: true
477 | dev: true
478 |
479 | /resolve/1.20.0:
480 | resolution: {integrity: sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==}
481 | dependencies:
482 | is-core-module: 2.4.0
483 | path-parse: 1.0.6
484 |
485 | /rollup/2.48.0:
486 | resolution: {integrity: sha512-wl9ZSSSsi5579oscSDYSzGn092tCS076YB+TQrzsGuSfYyJeep8eEWj0eaRjuC5McuMNmcnR8icBqiE/FWNB1A==}
487 | engines: {node: '>=10.0.0'}
488 | hasBin: true
489 | optionalDependencies:
490 | fsevents: 2.3.2
491 | dev: true
492 |
493 | /safe-buffer/5.1.2:
494 | resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==}
495 | dev: false
496 |
497 | /semver/6.3.0:
498 | resolution: {integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==}
499 | hasBin: true
500 | dev: false
501 |
502 | /source-map-js/0.6.2:
503 | resolution: {integrity: sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==}
504 | engines: {node: '>=0.10.0'}
505 | dev: true
506 |
507 | /source-map/0.5.7:
508 | resolution: {integrity: sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=}
509 | engines: {node: '>=0.10.0'}
510 | dev: false
511 |
512 | /supports-color/5.5.0:
513 | resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
514 | engines: {node: '>=4'}
515 | dependencies:
516 | has-flag: 3.0.0
517 | dev: false
518 |
519 | /to-fast-properties/2.0.0:
520 | resolution: {integrity: sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=}
521 | engines: {node: '>=4'}
522 |
523 | /typescript/4.2.4:
524 | resolution: {integrity: sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==}
525 | engines: {node: '>=4.2.0'}
526 | hasBin: true
527 | dev: true
528 |
529 | /vite/2.3.3:
530 | resolution: {integrity: sha512-eO1iwRbn3/BfkNVMNJDeANAFCZ5NobYOFPu7IqfY7DcI7I9nFGjJIZid0EViTmLDGwwSUPmRAq3cRBbO3+DsMA==}
531 | engines: {node: '>=12.0.0'}
532 | hasBin: true
533 | dependencies:
534 | esbuild: 0.11.23
535 | postcss: 8.3.0
536 | resolve: 1.20.0
537 | rollup: 2.48.0
538 | optionalDependencies:
539 | fsevents: 2.3.2
540 | dev: true
541 |
--------------------------------------------------------------------------------
/src/babel.d.ts:
--------------------------------------------------------------------------------
1 | declare module '@babel/plugin-syntax-jsx'
2 | declare module '@babel/plugin-syntax-typescript'
3 | declare module '@babel/plugin-transform-react-jsx'
4 |
--------------------------------------------------------------------------------
/src/babelRestoreJsx.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * https://github.com/flying-sheep/babel-plugin-transform-react-createelement-to-jsx
3 | * @license GNU General Public License v3.0
4 | */
5 | import * as babel from '@babel/core'
6 |
7 | /**
8 | * Visitor factory for babel, converting React.createElement(...) to ...
9 | *
10 | * What we want to handle here is this CallExpression:
11 | *
12 | * React.createElement(
13 | * type: StringLiteral|Identifier|MemberExpression,
14 | * [props: ObjectExpression|Expression],
15 | * [...children: StringLiteral|Expression]
16 | * )
17 | *
18 | * Any of those arguments might also be missing (undefined) and/or invalid.
19 | */
20 | export default function ({ types: t }: typeof babel): babel.PluginObj {
21 | /**
22 | * Get a `JSXElement` from a `CallExpression`.
23 | * Returns `null` if this impossible.
24 | */
25 | function getJSXNode(node: any): any {
26 | if (!isReactCreateElement(node)) {
27 | return null
28 | }
29 |
30 | //nameNode and propsNode may be undefined, getJSX* need to handle that
31 | const [nameNode, propsNode, ...childNodes] = node.arguments
32 |
33 | const name = getJSXName(nameNode)
34 | if (name === null) {
35 | return null //name is required
36 | }
37 |
38 | const props = getJSXProps(propsNode)
39 | if (props === null) {
40 | return null //no props → [], invalid → null
41 | }
42 |
43 | const children = getJSXChildren(childNodes)
44 | if (children === null) {
45 | return null //no children → [], invalid → null
46 | }
47 |
48 | if (
49 | t.isJSXMemberExpression(name) &&
50 | t.isJSXIdentifier(name.object) &&
51 | name.object.name === 'React' &&
52 | name.property.name === 'Fragment'
53 | ) {
54 | return t.jsxFragment(
55 | t.jsxOpeningFragment(),
56 | t.jsxClosingFragment(),
57 | children
58 | )
59 | }
60 |
61 | // self-closing tag if no children
62 | const selfClosing = children.length === 0
63 | const startTag = t.jsxOpeningElement(name, props, selfClosing)
64 | const endTag = selfClosing ? null : t.jsxClosingElement(name)
65 |
66 | return t.jsxElement(startTag, endTag, children, selfClosing)
67 | }
68 |
69 | /**
70 | * Get a JSXIdentifier or JSXMemberExpression from a Node of known type.
71 | * Returns null if a unknown node type, null or undefined is passed.
72 | */
73 | function getJSXName(node: any): any {
74 | if (node == null) {
75 | return null
76 | }
77 |
78 | const name = getJSXIdentifier(node)
79 | if (name !== null) {
80 | return name
81 | }
82 |
83 | if (!t.isMemberExpression(node)) {
84 | return null
85 | }
86 | const object = getJSXName(node.object)
87 | const property = getJSXName(node.property)
88 | if (object === null || property === null) {
89 | return null
90 | }
91 | return t.jsxMemberExpression(object, property)
92 | }
93 |
94 | /**
95 | * Get a array of JSX(Spread)Attribute from a props ObjectExpression.
96 | * Handles the _extends Expression babel creates from SpreadElement nodes.
97 | * Returns null if a validation error occurs.
98 | */
99 | function getJSXProps(node: any): any[] | null {
100 | if (node == null || isNullLikeNode(node)) {
101 | return []
102 | }
103 |
104 | if (
105 | t.isCallExpression(node) &&
106 | t.isIdentifier(node.callee, { name: '_extends' })
107 | ) {
108 | const props = node.arguments.map(getJSXProps)
109 | //if calling this recursively works, flatten.
110 | if (props.every(prop => prop !== null)) {
111 | return [].concat.apply([], props as any[])
112 | }
113 | }
114 |
115 | if (!t.isObjectExpression(node) && t.isExpression(node))
116 | return [t.jsxSpreadAttribute(node)]
117 |
118 | if (!isPlainObjectExpression(node)) {
119 | return null
120 | }
121 | return node.properties.map((prop: any) =>
122 | t.isObjectProperty(prop)
123 | ? t.jsxAttribute(
124 | getJSXIdentifier(prop.key)!,
125 | getJSXAttributeValue(prop.value)
126 | )
127 | : t.jsxSpreadAttribute(prop.argument)
128 | )
129 | }
130 |
131 | function getJSXChild(node: any) {
132 | if (t.isStringLiteral(node)) {
133 | return t.jsxText(node.value)
134 | }
135 | if (isReactCreateElement(node)) {
136 | return getJSXNode(node)
137 | }
138 | if (t.isExpression(node)) {
139 | return t.jsxExpressionContainer(node)
140 | }
141 | return null
142 | }
143 |
144 | function getJSXChildren(nodes: any[]) {
145 | const children = nodes
146 | .filter(node => !isNullLikeNode(node))
147 | .map(getJSXChild)
148 | if (children.some(child => child == null)) {
149 | return null
150 | }
151 | return children
152 | }
153 |
154 | function getJSXIdentifier(node: any) {
155 | //TODO: JSXNamespacedName
156 | if (t.isIdentifier(node)) {
157 | return t.jsxIdentifier(node.name)
158 | }
159 | if (t.isStringLiteral(node)) {
160 | return t.jsxIdentifier(node.value)
161 | }
162 | return null
163 | }
164 |
165 | function getJSXAttributeValue(node: any) {
166 | if (t.isStringLiteral(node)) {
167 | return node
168 | }
169 | if (t.isJSXElement(node)) {
170 | return node
171 | }
172 | if (t.isExpression(node)) {
173 | return t.jsxExpressionContainer(node)
174 | }
175 | return null
176 | }
177 |
178 | /**
179 | * Tests if a node is a CallExpression with callee `React.createElement`
180 | */
181 | const isReactCreateElement = (node: any) =>
182 | t.isCallExpression(node) &&
183 | t.isMemberExpression(node.callee) &&
184 | t.isIdentifier(node.callee.object, { name: 'React' }) &&
185 | t.isIdentifier(node.callee.property, { name: 'createElement' }) &&
186 | !node.callee.computed
187 |
188 | /**
189 | * Tests if a node is `null` or `undefined`
190 | */
191 | const isNullLikeNode = (node: any) =>
192 | t.isNullLiteral(node) || t.isIdentifier(node, { name: 'undefined' })
193 |
194 | /**
195 | * Tests if a node is an object expression with noncomputed, nonmethod attrs
196 | */
197 | const isPlainObjectExpression = (node: any) =>
198 | t.isObjectExpression(node) &&
199 | node.properties.every(
200 | m =>
201 | t.isSpreadElement(m) ||
202 | (t.isObjectProperty(m, { computed: false }) &&
203 | getJSXIdentifier(m.key) !== null &&
204 | getJSXAttributeValue(m.value) !== null)
205 | )
206 |
207 | return {
208 | visitor: {
209 | CallExpression(path) {
210 | const node = getJSXNode(path.node)
211 | if (node === null) {
212 | return null
213 | }
214 | path.replaceWith(node)
215 | },
216 | },
217 | }
218 | }
219 |
--------------------------------------------------------------------------------
/src/plugin.ts:
--------------------------------------------------------------------------------
1 | import type { Plugin } from 'vite'
2 | import type { types as t, NodePath, PluginItem } from '@babel/core'
3 | import type { ImportDeclaration, ImportSpecifier } from '@babel/types'
4 | import resolve from 'resolve'
5 |
6 | export default function viteReactJsx(): Plugin {
7 | return {
8 | name: 'vite:react-jsx',
9 | enforce: 'pre',
10 | config: () => ({
11 | resolve: {
12 | dedupe: ['react', 'react-dom'],
13 | },
14 | }),
15 | configResolved(config) {
16 | if (config.command === 'build') {
17 | Object.assign(this, getRuntimeLoader(config))
18 | this.transform = getTransformer({
19 | sourceMaps: !!config.build.sourcemap,
20 | })
21 | } else {
22 | const jsxRE = /\.[tj]sx$/
23 | const reactRE = /(^|\n)import React[ ,]/
24 |
25 | // Just use React.createElement in serve mode
26 | this.transform = function (code, id) {
27 | if (jsxRE.test(id) && !reactRE.test(code)) {
28 | return `import React from 'react'; ` + code
29 | }
30 | }
31 | }
32 | },
33 | }
34 | }
35 |
36 | viteReactJsx.getRuntimeLoader = getRuntimeLoader
37 | viteReactJsx.restoreJSX = restoreJSX
38 |
39 | function getRuntimeLoader(opts: { root: string }) {
40 | const runtimeId = 'react/jsx-runtime'
41 | return {
42 | name: 'vite:react-jsx',
43 | enforce: 'pre',
44 | resolveId(id: string) {
45 | return id === runtimeId ? id : null
46 | },
47 | load(id: string) {
48 | if (id === runtimeId) {
49 | const runtimePath = resolve.sync(runtimeId, {
50 | basedir: opts.root,
51 | })
52 | const exports = ['jsx', 'jsxs', 'Fragment']
53 | return [
54 | `import * as jsxRuntime from ${JSON.stringify(runtimePath)}`,
55 | // We can't use `export * from` or else any callsite that uses
56 | // this module will be compiled to `jsxRuntime.exports.jsx`
57 | // instead of the more concise `jsx` alias.
58 | ...exports.map(name => `export const ${name} = jsxRuntime.${name}`),
59 | ].join('\n')
60 | }
61 | },
62 | }
63 | }
64 |
65 | function getTransformer(opts: { sourceMaps?: boolean }) {
66 | const babelImport = import('@babel/core')
67 | const babelTransformJsx = import('@babel/plugin-transform-react-jsx')
68 |
69 | return async function transform(code: string, id: string) {
70 | if (/.+\/node_modules\/.+\.jsx?$/.test(id)) {
71 | const babel = await babelImport
72 |
73 | // Reverse-compile any React.createElement calls
74 | let [ast, isCommonJS] = await viteReactJsx.restoreJSX(babel, code)
75 |
76 | // Then apply the JSX automatic runtime transform
77 | if (ast) {
78 | const plugins: PluginItem[] = [
79 | [await babelTransformJsx, { runtime: 'automatic' }],
80 | ]
81 | if (isCommonJS) {
82 | plugins.push(babelImportToRequire)
83 | }
84 | const result = await babel.transformFromAstAsync(ast, undefined, {
85 | plugins,
86 | sourceMaps: opts.sourceMaps,
87 | })
88 | if (result?.code) {
89 | return {
90 | code: result.code,
91 | map: result.map,
92 | }
93 | }
94 | }
95 | } else if (/\.[tj]sx$/.test(id)) {
96 | const syntaxPlugins: PluginItem[] = []
97 | if (id.endsWith('.tsx')) {
98 | syntaxPlugins.push(await babelTSX())
99 | }
100 | const babel = await babelImport
101 | const res = await babel.transformAsync(code, {
102 | plugins: [
103 | ...syntaxPlugins,
104 | [await babelTransformJsx, { runtime: 'automatic' }],
105 | ],
106 | sourceMaps: opts.sourceMaps,
107 | })
108 | if (res?.code) {
109 | return {
110 | code: res.code,
111 | map: res.map,
112 | }
113 | }
114 | }
115 | }
116 |
117 | async function babelTSX() {
118 | return [
119 | await import('@babel/plugin-syntax-typescript').then(m => m.default),
120 | { isTSX: true },
121 | ]
122 | }
123 | }
124 |
125 | type RestoredJSX = [result: t.File | null | undefined, isCommonJS: boolean]
126 |
127 | let babelRestoreJSX: any
128 |
129 | /** Restore JSX from `React.createElement` calls */
130 | async function restoreJSX(
131 | babel: typeof import('@babel/core'),
132 | code: string
133 | ): Promise {
134 | const [reactAlias, isCommonJS] = parseReactAlias(code)
135 | const reactJsxRE = new RegExp(
136 | '\\b' + reactAlias + '\\.(createElement|Fragment)\\b',
137 | 'g'
138 | )
139 |
140 | let hasCompiledJsx = false
141 | code = code.replace(reactJsxRE, (_, prop) => {
142 | hasCompiledJsx = true
143 | // Replace with "React" so JSX can be reverse compiled.
144 | return 'React.' + prop
145 | })
146 |
147 | if (!hasCompiledJsx) {
148 | return [null, false]
149 | }
150 |
151 | // Support modules that use `import {Fragment} from 'react'`
152 | code = code.replace(
153 | /createElement\(Fragment,/g,
154 | 'createElement(React.Fragment,'
155 | )
156 |
157 | babelRestoreJSX ||= import('./babelRestoreJsx')
158 |
159 | const result = await babel.transformAsync(code, {
160 | ast: true,
161 | code: false,
162 | parserOpts: {
163 | plugins: ['jsx'],
164 | },
165 | plugins: [await babelRestoreJSX],
166 | })
167 |
168 | return [result?.ast, isCommonJS]
169 | }
170 |
171 | function parseReactAlias(
172 | code: string
173 | ): [alias: string | undefined, isCommonJS: boolean] {
174 | let match = code.match(
175 | /\b(var|let|const) +(\w+) *= *require\(["']react["']\)/
176 | )
177 | if (match) {
178 | return [match[2], true]
179 | }
180 | match = code.match(/^import (\w+).+? from ["']react["']/m)
181 | if (match) {
182 | return [match[1], false]
183 | }
184 | return [undefined, false]
185 | }
186 |
187 | /**
188 | * Replace this:
189 | *
190 | * import { jsx as _jsx } from "react/jsx-runtime"
191 | *
192 | * with this:
193 | *
194 | * var _jsx = require("react/jsx-runtime").jsx
195 | */
196 | export function babelImportToRequire({
197 | types: t,
198 | }: typeof import('@babel/core')) {
199 | return {
200 | visitor: {
201 | ImportDeclaration(path: NodePath) {
202 | const decl = path.node as ImportDeclaration
203 | const spec = decl.specifiers[0] as ImportSpecifier
204 |
205 | path.replaceWith(
206 | t.variableDeclaration('var', [
207 | t.variableDeclarator(
208 | spec.local,
209 | t.memberExpression(
210 | t.callExpression(t.identifier('require'), [decl.source]),
211 | spec.imported
212 | )
213 | ),
214 | ])
215 | )
216 | },
217 | },
218 | }
219 | }
220 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "include": ["src"],
3 | "compilerOptions": {
4 | "declaration": true,
5 | "esModuleInterop": true,
6 | "lib": ["es2018"],
7 | "module": "esnext",
8 | "moduleResolution": "node",
9 | "noUnusedLocals": true,
10 | "outDir": "dist",
11 | "strict": true,
12 | "sourceMap": true,
13 | "target": "es2018"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------