File tree 1 file changed +19
-3
lines changed
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>(), {
25
25
ssr: false
26
26
})
27
27
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 ()
30
46
31
- provide (' store' , props . store )
47
+ provide (' store' , store )
32
48
provide (' autoresize' , props .autoResize )
33
49
provide (' import-map' , toRef (props , ' showImportMap' ))
34
50
provide (' clear-console' , toRef (props , ' clearConsole' ))
You can’t perform that action at this time.
0 commit comments