@@ -272,7 +272,10 @@ export function useStore(
272272 if ( vueVersion . value ) files . _version = vueVersion . value
273273 return '#' + utoa ( JSON . stringify ( files ) )
274274 }
275- const deserialize : ReplStore [ 'deserialize' ] = ( serializedState : string ) => {
275+ const deserialize : ReplStore [ 'deserialize' ] = (
276+ serializedState : string ,
277+ checkBuiltinImportMap = true ,
278+ ) => {
276279 if ( serializedState . startsWith ( '#' ) )
277280 serializedState = serializedState . slice ( 1 )
278281 let saved : any
@@ -290,6 +293,9 @@ export function useStore(
290293 setFile ( files . value , filename , saved [ filename ] )
291294 }
292295 }
296+ if ( checkBuiltinImportMap ) {
297+ applyBuiltinImportMap ( )
298+ }
293299 }
294300 const getFiles : ReplStore [ 'getFiles' ] = ( ) => {
295301 const exported : Record < string , string > = { }
@@ -333,7 +339,7 @@ export function useStore(
333339 }
334340
335341 if ( serializedState ) {
336- deserialize ( serializedState )
342+ deserialize ( serializedState , false )
337343 } else {
338344 setDefaultFile ( )
339345 }
@@ -444,7 +450,12 @@ export interface ReplStore extends UnwrapRef<StoreState> {
444450 setImportMap ( map : ImportMap , merge ?: boolean ) : void
445451 getTsConfig ( ) : Record < string , any >
446452 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
448459 getFiles ( ) : Record < string , string >
449460 setFiles ( newFiles : Record < string , string > , mainFile ?: string ) : Promise < void >
450461}
0 commit comments