@@ -40,6 +40,7 @@ export type DevProps = {
40
40
initialMode : "local" | "remote" ;
41
41
jsxFactory : undefined | string ;
42
42
jsxFragment : undefined | string ;
43
+ enableLocalPersistence : boolean ;
43
44
bindings : CfWorkerInit [ "bindings" ] ;
44
45
public : undefined | string ;
45
46
assetPaths : undefined | AssetPaths ;
@@ -102,6 +103,7 @@ function Dev(props: DevProps): JSX.Element {
102
103
site = { props . assetPaths }
103
104
public = { props . public }
104
105
port = { port }
106
+ enableLocalPersistence = { props . enableLocalPersistence }
105
107
/>
106
108
) : (
107
109
< Remote
@@ -184,13 +186,15 @@ function Local(props: {
184
186
public : undefined | string ;
185
187
site : undefined | AssetPaths ;
186
188
port : number ;
189
+ enableLocalPersistence : boolean ;
187
190
} ) {
188
191
const { inspectorUrl } = useLocalWorker ( {
189
192
name : props . name ,
190
193
bundle : props . bundle ,
191
194
format : props . format ,
192
195
bindings : props . bindings ,
193
196
port : props . port ,
197
+ enableLocalPersistence : props . enableLocalPersistence ,
194
198
} ) ;
195
199
useInspector ( { inspectorUrl, port : 9229 , logToTerminal : false } ) ;
196
200
return null ;
@@ -202,6 +206,7 @@ function useLocalWorker(props: {
202
206
format : CfScriptFormat ;
203
207
bindings : CfWorkerInit [ "bindings" ] ;
204
208
port : number ;
209
+ enableLocalPersistence : boolean ;
205
210
} ) {
206
211
// TODO: pass vars via command line
207
212
const { bundle, format, bindings, port } = props ;
@@ -238,9 +243,9 @@ function useLocalWorker(props: {
238
243
path . join ( __dirname , "../miniflare-config-stubs/package.empty.json" ) ,
239
244
"--port" ,
240
245
port . toString ( ) ,
241
- "--kv-persist" ,
242
- "--cache-persist" ,
243
- "--do-persist" ,
246
+ ... ( props . enableLocalPersistence
247
+ ? [ "--kv-persist" , "-- cache-persist", "--do-persist" ]
248
+ : [ ] ) ,
244
249
...Object . entries ( bindings . vars || { } ) . flatMap ( ( [ key , value ] ) => {
245
250
return [ "--binding" , `${ key } =${ value } ` ] ;
246
251
} ) ,
0 commit comments