solid-refresh 0.6.3 → 0.7.1
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 +39 -11
- package/dist/babel.cjs +583 -286
- package/dist/babel.mjs +583 -286
- package/dist/types/src/babel/core/checks.d.ts +4 -0
- package/dist/types/src/babel/core/checks.d.ts.map +1 -0
- package/dist/types/src/babel/core/constants.d.ts +8 -0
- package/dist/types/src/babel/core/constants.d.ts.map +1 -0
- package/dist/types/src/babel/core/create-registry.d.ts +5 -0
- package/dist/types/src/babel/core/create-registry.d.ts.map +1 -0
- package/dist/types/src/babel/core/generate-unique-name.d.ts +4 -0
- package/dist/types/src/babel/core/generate-unique-name.d.ts.map +1 -0
- package/dist/types/src/babel/core/generator.d.ts +3 -0
- package/dist/types/src/babel/core/generator.d.ts.map +1 -0
- package/dist/types/src/babel/core/get-descriptive-name.d.ts +3 -0
- package/dist/types/src/babel/core/get-descriptive-name.d.ts.map +1 -0
- package/dist/types/src/babel/core/get-foreign-bindings.d.ts +4 -0
- package/dist/types/src/babel/core/get-foreign-bindings.d.ts.map +1 -0
- package/dist/types/src/babel/core/get-hmr-decline-call.d.ts +4 -0
- package/dist/types/src/babel/core/get-hmr-decline-call.d.ts.map +1 -0
- package/dist/types/src/babel/core/get-hot-identifier.d.ts +4 -0
- package/dist/types/src/babel/core/get-hot-identifier.d.ts.map +1 -0
- package/dist/types/src/babel/core/get-import-identifier.d.ts +5 -0
- package/dist/types/src/babel/core/get-import-identifier.d.ts.map +1 -0
- package/dist/types/src/babel/core/get-root-statement-path.d.ts +3 -0
- package/dist/types/src/babel/core/get-root-statement-path.d.ts.map +1 -0
- package/dist/types/src/babel/core/get-statement-path.d.ts +3 -0
- package/dist/types/src/babel/core/get-statement-path.d.ts.map +1 -0
- package/dist/types/src/babel/core/get-vite-hmr-requirement.d.ts +4 -0
- package/dist/types/src/babel/core/get-vite-hmr-requirement.d.ts.map +1 -0
- package/dist/types/src/babel/core/is-valid-callee.d.ts +5 -0
- package/dist/types/src/babel/core/is-valid-callee.d.ts.map +1 -0
- package/dist/types/src/babel/core/register-import-specifiers.d.ts +5 -0
- package/dist/types/src/babel/core/register-import-specifiers.d.ts.map +1 -0
- package/dist/types/src/babel/core/transform-jsx.d.ts +4 -0
- package/dist/types/src/babel/core/transform-jsx.d.ts.map +1 -0
- package/dist/types/src/babel/core/types.d.ts +40 -0
- package/dist/types/src/babel/core/types.d.ts.map +1 -0
- package/dist/types/src/babel/core/unwrap.d.ts +11 -0
- package/dist/types/src/babel/core/unwrap.d.ts.map +1 -0
- package/dist/types/src/babel/core/xxhash32.d.ts +7 -0
- package/dist/types/src/babel/core/xxhash32.d.ts.map +1 -0
- package/dist/types/src/babel/index.d.ts +2 -25
- package/dist/types/src/babel/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ You can read the following guides first, respectively:
|
|
|
37
37
|
* [Rspack](https://www.rspack.dev/guide/dev-server.html#hmr)
|
|
38
38
|
* [Rspack SolidJS guide](https://www.rspack.dev/guide/solid.html)
|
|
39
39
|
|
|
40
|
-
>
|
|
40
|
+
> [!NOTE]
|
|
41
41
|
> Rspack has HMR already enabled by default. The guide only tells you how to disable it or run the dev server on a proxy server.
|
|
42
42
|
|
|
43
43
|
Requires the use of [`babel-loader`](https://www.npmjs.com/package/babel-loader). Add the following to `.babelrc`:
|
|
@@ -75,6 +75,42 @@ devServer: {
|
|
|
75
75
|
}
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
+
### Parcel
|
|
79
|
+
|
|
80
|
+
Add the following to `.babelrc`:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"env": {
|
|
85
|
+
"development": {
|
|
86
|
+
"presets": [
|
|
87
|
+
["babel-preset-solid"]
|
|
88
|
+
],
|
|
89
|
+
"plugins": [
|
|
90
|
+
["module:solid-refresh/babel"]
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
"production": {
|
|
94
|
+
"presets": [
|
|
95
|
+
["babel-preset-solid"]
|
|
96
|
+
],
|
|
97
|
+
"plugins": [
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Parcel doesn't enable package exports by default, which allows loading the dev version of SolidJS. To enable it, the following must be added in `package.json` (in accordance with [this document](https://parceljs.org/features/dependency-resolution/#enabling-package-exports)):
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"@parcel/resolver-default": {
|
|
109
|
+
"packageExports": true
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
78
114
|
### Nollup
|
|
79
115
|
|
|
80
116
|
Requires the use of [`@rollup/plugin-babel`](https://www.npmjs.com/package/@rollup/plugin-babel). Add the following to `.babelrc`:
|
|
@@ -105,8 +141,6 @@ Requires the use of [`@snowpack/plugin-babel`](https://www.npmjs.com/package/@sn
|
|
|
105
141
|
|
|
106
142
|
### Other dev servers
|
|
107
143
|
|
|
108
|
-
* [`Parcel`](https://parceljs.org/)
|
|
109
|
-
* ParcelJS doesn't support [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) yet, which makes ParcelJS load the production build of SolidJS instead of its development build. Solid Refresh requires the SolidJS development build to work.
|
|
110
144
|
* [`wmr`](https://wmr.dev/)
|
|
111
145
|
* SolidJS is yet to be supported or isn't clear yet. It will use the same config as Snowpack.
|
|
112
146
|
* [`rollup-plugin-hot`](https://github.com/rixo/rollup-plugin-hot)
|
|
@@ -118,7 +152,7 @@ Requires the use of [`@snowpack/plugin-babel`](https://www.npmjs.com/package/@sn
|
|
|
118
152
|
|
|
119
153
|
In any case, your build system needs to support conditional exports and have the `development` condition set.
|
|
120
154
|
|
|
121
|
-
>
|
|
155
|
+
> [!WARNING]
|
|
122
156
|
> In some standard HMR implementations, this may cause your app to reload the full page if the development environment isn't properly set!
|
|
123
157
|
|
|
124
158
|
## How it works
|
|
@@ -157,15 +191,9 @@ Or force reload:
|
|
|
157
191
|
/* @refresh reload */
|
|
158
192
|
```
|
|
159
193
|
|
|
160
|
-
### `@refresh granular`
|
|
161
|
-
|
|
162
|
-
By default, components from the old module are replaced with the new ones from the replacement module, which might cause components that hasn't really changed to unmount abruptly.
|
|
163
|
-
|
|
164
|
-
Adding `@refresh granular` comment pragma in the file allows components to opt-in to granular replacement: If the component has changed *code-wise*, it will be replaced, otherwise, it will be retained, which allows unchanged ancestor components to preserve lifecycles.
|
|
165
|
-
|
|
166
194
|
## Limitations
|
|
167
195
|
|
|
168
|
-
* Preserving state
|
|
196
|
+
* Preserving state is applied partially.
|
|
169
197
|
* No HOC support.
|
|
170
198
|
|
|
171
199
|
## Custom `render`/`createContext`
|