babel-preset-solid 2.0.0-beta.1 → 2.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -62
- package/index.js +1 -0
- package/package.json +9 -5
package/README.md
CHANGED
|
@@ -1,62 +1,79 @@
|
|
|
1
|
-
# babel-preset-solid
|
|
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
|
-
|
|
1
|
+
# babel-preset-solid
|
|
2
|
+
|
|
3
|
+
Babel preset to transform JSX into Solid runtime calls.
|
|
4
|
+
|
|
5
|
+
### Install
|
|
6
|
+
|
|
7
|
+
Via NPM
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
npm install babel-preset-solid --save-dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
or Yarn
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
yarn add babel-preset-solid --dev
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Usage
|
|
20
|
+
|
|
21
|
+
Make or update your .babelrc config file with the preset:
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
{
|
|
25
|
+
"presets": [
|
|
26
|
+
"solid"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
For TypeScript projects, configure JSX types through the renderer package. Web projects should use:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"compilerOptions": {
|
|
36
|
+
"jsx": "preserve",
|
|
37
|
+
"jsxImportSource": "@solidjs/web"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`babel-preset-solid` handles JSX compilation; `jsxImportSource` controls TypeScript's JSX namespace. In Solid 2.0, `solid-js` does not provide `solid-js/jsx-runtime` types.
|
|
43
|
+
|
|
44
|
+
Via package.json
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
...
|
|
48
|
+
"babel": {
|
|
49
|
+
"presets": [
|
|
50
|
+
"es2015",
|
|
51
|
+
"solid"
|
|
52
|
+
],
|
|
53
|
+
"plugins": [
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
...
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Usage for SSR code
|
|
60
|
+
|
|
61
|
+
When need to transform JSX code to be used on the server, pass the following options
|
|
62
|
+
|
|
63
|
+
```javascript
|
|
64
|
+
{
|
|
65
|
+
"presets": [
|
|
66
|
+
["solid", { "generate": "ssr", "hydratable": true }]
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
And for the browser build pass the hydratable option as well:
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
{
|
|
75
|
+
"presets": [
|
|
76
|
+
["solid", { "generate": "dom", "hydratable": true }]
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
```
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-preset-solid",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
4
|
-
"description": "Babel preset
|
|
3
|
+
"version": "2.0.0-beta.11",
|
|
4
|
+
"description": "Babel preset that compiles Solid's JSX into fine-grained DOM operations.",
|
|
5
5
|
"author": "Ryan Carniato <ryansolid@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/solidjs/solid/blob/main/packages/babel-preset-solid#readme",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"repository":
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/solidjs/solid.git",
|
|
11
|
+
"directory": "packages/babel-preset-solid"
|
|
12
|
+
},
|
|
9
13
|
"main": "index.js",
|
|
10
14
|
"files": [
|
|
11
15
|
"index.js"
|
|
12
16
|
],
|
|
13
17
|
"dependencies": {
|
|
14
|
-
"babel-plugin-jsx-dom-expressions": "
|
|
18
|
+
"babel-plugin-jsx-dom-expressions": "0.50.0-next.9"
|
|
15
19
|
},
|
|
16
20
|
"peerDependencies": {
|
|
17
21
|
"@babel/core": "^7.0.0",
|
|
18
|
-
"solid-js": "^2.0.0-beta.
|
|
22
|
+
"solid-js": "^2.0.0-beta.11"
|
|
19
23
|
},
|
|
20
24
|
"peerDependenciesMeta": {
|
|
21
25
|
"solid-js": {
|