File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -25,10 +25,26 @@ const props = withDefaults(defineProps<Props>(), {
2525 ssr: false
2626})
2727
28- props .store .options = props .sfcOptions
29- props .store .init ()
28+ const { store } = props
29+ const sfcOptions = (store .options = props .sfcOptions || {})
30+ if (! sfcOptions .script ) {
31+ sfcOptions .script = {}
32+ }
33+ // @ts-ignore only needed in 3.3
34+ sfcOptions .script .fs = {
35+ fileExists(file : string ) {
36+ if (file .startsWith (' /' )) file = file .slice (1 )
37+ return !! store .state .files [file ]
38+ },
39+ readFile(file : string ) {
40+ if (file .startsWith (' /' )) file = file .slice (1 )
41+ return store .state .files [file ].code
42+ }
43+ }
44+
45+ store .init ()
3046
31- provide (' store' , props . store )
47+ provide (' store' , store )
3248provide (' autoresize' , props .autoResize )
3349provide (' import-map' , toRef (props , ' showImportMap' ))
3450provide (' clear-console' , toRef (props , ' clearConsole' ))
You can’t perform that action at this time.
0 commit comments