@@ -182,50 +182,134 @@ export interface Options {
182
182
183
183
onwarn ?: undefined | false | ( ( warning : any , defaultHandler ?: any ) => void )
184
184
185
- /** Enable/configure HMR */
185
+ /**
186
+ * enable/disable hmr. You want this enabled.
187
+ *
188
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
189
+ * DO NOT CUSTOMIZE SVELTE-HMR OPTIONS UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING
190
+ *
191
+ * YOU HAVE BEEN WARNED
192
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
193
+ *
194
+ * @default true for development, always false for production
195
+ */
186
196
hot ?:
187
197
| undefined
188
198
| boolean
189
199
| {
200
+ // svelte-hmr options
190
201
/**
191
- * Enable state preservation when a component is updated by HMR for every
192
- * components.
202
+ * preserve all local state
193
203
* @default false
194
204
*/
195
- preserveState ?: boolean
205
+ preserveLocalState ?: boolean
206
+
207
+ /**
208
+ * escape hatchs from preservation of local state
209
+ * disable preservation of state for this component
210
+ *
211
+ * @default ['@hmr:reset', '@!hmr']
212
+ */
213
+ noPreserveStateKey ?: string [ ]
196
214
197
215
/**
198
- * If this string appears anywhere in your component's code, then local
199
- * state won't be preserved, even when noPreserveState is false.
200
- * @default '\ @hmr:reset '
216
+ * enable preservation of state for all variables in this component
217
+ *
218
+ * @default '@hmr:keep-all '
201
219
*/
202
- noPreserveStateKey ?: string
220
+ preserveAllLocalStateKey ?: string
203
221
204
222
/**
205
- * If this string appears next to a `let` variable, the value of this
206
- * variable will be preserved accross HMR updates.
207
- * @default '\@hmr:keep'
223
+ * enable preservation of state for a given variable (must be inline or
224
+ * above the target variable or variables; can be repeated)
225
+ *
226
+ * @default '@hmr:keep'
208
227
*/
209
- preserveStateKey ?: string
228
+ preserveLocalStateKey ?: string
210
229
211
230
/**
212
- * Prevent doing a full reload on next HMR update after fatal error.
231
+ * don't reload on fatal error
232
+ *
213
233
* @default false
214
234
*/
215
235
noReload ?: boolean
216
236
217
237
/**
218
- * Try to recover after runtime errors in component init.
238
+ * try to recover after runtime errors during component init
239
+ *
219
240
* @default true
220
241
*/
221
242
optimistic ?: boolean
243
+ /**
244
+ * auto accept modules of components that have named exports (i.e. exports
245
+ * from context="module")
246
+ *
247
+ * @default true
248
+ */
249
+ acceptNamedExports ?: boolean
250
+
251
+ /**
252
+ * auto accept modules of components have accessors (either accessors compile
253
+ * option, or <svelte:option accessors={true} />) -- this means that if you
254
+ * set accessors compile option globally, you must also set this option to
255
+ * true, or no component will be hot reloaded (but there are a lot of edge
256
+ * cases that HMR can't support correctly with accessors)
257
+ *
258
+ * @default true
259
+ */
260
+ acceptAccessors ?: boolean
222
261
223
- noDisableCss ?: boolean
262
+ /**
263
+ * only inject CSS instead of recreating components when only CSS changes
264
+ *
265
+ * @default true, but vite-plugin-svelte configures this automatically according to emitCss requirements
266
+ */
224
267
injectCss ?: boolean
268
+
269
+ /**
270
+ * to mitigate FOUC between dispose (remove stylesheet) and accept
271
+ *
272
+ * note: has no effect when emitCss is true (vite-plugin-svelte default)
273
+ * @default 100
274
+ */
225
275
cssEjectDelay ?: number
276
+
277
+ //
278
+ /**
279
+ * Svelte Native mode
280
+ *
281
+ * @default false
282
+ */
283
+ native ?: boolean
284
+
285
+ /**
286
+ * name of the adapter import binding
287
+ *
288
+ * @default '___SVELTE_HMR_HOT_API_PROXY_ADAPTER'
289
+ */
290
+ importAdapterName ?: string
291
+ /**
292
+ * use absolute file paths to import runtime deps of svelte-hmr
293
+ * (see https://github.com/rixo/svelte-hmr/issues/11)
294
+ *
295
+ * @default true
296
+ */
226
297
absoluteImports ?: boolean
227
298
299
+ /**
300
+ * disable runtime error overlay
301
+ *
302
+ * @default false
303
+ */
304
+ noOverlay ?: boolean
305
+
306
+ /**
307
+ * custom import path for hotApi
308
+ */
228
309
hotApi ?: string
310
+ /**
311
+ * custom path for adapter
312
+ */
229
313
adapter ?: string
230
314
}
231
315
/**
0 commit comments