@@ -272,7 +272,10 @@ export function useStore(
272
272
if ( vueVersion . value ) files . _version = vueVersion . value
273
273
return '#' + utoa ( JSON . stringify ( files ) )
274
274
}
275
- const deserialize : ReplStore [ 'deserialize' ] = ( serializedState : string ) => {
275
+ const deserialize : ReplStore [ 'deserialize' ] = (
276
+ serializedState : string ,
277
+ checkBuiltinImportMap = true ,
278
+ ) => {
276
279
if ( serializedState . startsWith ( '#' ) )
277
280
serializedState = serializedState . slice ( 1 )
278
281
let saved : any
@@ -290,6 +293,9 @@ export function useStore(
290
293
setFile ( files . value , filename , saved [ filename ] )
291
294
}
292
295
}
296
+ if ( checkBuiltinImportMap ) {
297
+ applyBuiltinImportMap ( )
298
+ }
293
299
}
294
300
const getFiles : ReplStore [ 'getFiles' ] = ( ) => {
295
301
const exported : Record < string , string > = { }
@@ -333,7 +339,7 @@ export function useStore(
333
339
}
334
340
335
341
if ( serializedState ) {
336
- deserialize ( serializedState )
342
+ deserialize ( serializedState , false )
337
343
} else {
338
344
setDefaultFile ( )
339
345
}
@@ -444,7 +450,12 @@ export interface ReplStore extends UnwrapRef<StoreState> {
444
450
setImportMap ( map : ImportMap , merge ?: boolean ) : void
445
451
getTsConfig ( ) : Record < string , any >
446
452
serialize ( ) : string
447
- deserialize ( serializedState : string ) : void
453
+ /**
454
+ * Deserializes the given string to restore the REPL store state.
455
+ * @param serializedState - The serialized state string.
456
+ * @param checkBuiltinImportMap - Whether to check the built-in import map. Default to true
457
+ */
458
+ deserialize ( serializedState : string , checkBuiltinImportMap ?: boolean ) : void
448
459
getFiles ( ) : Record < string , string >
449
460
setFiles ( newFiles : Record < string , string > , mainFile ?: string ) : Promise < void >
450
461
}
0 commit comments