@@ -87,23 +87,25 @@ export const useAppStore = defineStore("app", () => {
8787 try {
8888 let finalURL = path
8989
90- if ( codeTransformer . value && path . startsWith ( ' blob:' ) ) {
90+ if ( codeTransformer . value && path . startsWith ( " blob:" ) ) {
9191 const response = await fetch ( path )
9292 const code = await response . text ( )
9393 const transformedCode = codeTransformer . value ( code )
9494
95- const newBlob = new Blob ( [ transformedCode ] , { type : 'application/javascript' } )
95+ const newBlob = new Blob ( [ transformedCode ] , {
96+ type : "application/javascript" ,
97+ } )
9698 finalURL = URL . createObjectURL ( newBlob )
9799 }
98100
99101 const extensionModule = await import ( finalURL )
100102
101- if ( finalURL !== path && finalURL . startsWith ( ' blob:' ) ) {
103+ if ( finalURL !== path && finalURL . startsWith ( " blob:" ) ) {
102104 URL . revokeObjectURL ( finalURL )
103105 }
104106
105107 if ( ! extensionModule . metadata ?. id ) {
106- throw new Error ( ' Extension must have metadata.id' )
108+ throw new Error ( " Extension must have metadata.id" )
107109 }
108110
109111 const extensionId = extensionModule . metadata . id
@@ -117,9 +119,9 @@ export const useAppStore = defineStore("app", () => {
117119 throw new Error ( "Extension API not initialized" )
118120 }
119121
120- if ( typeof extensionModule . install === ' function' ) {
122+ if ( typeof extensionModule . install === " function" ) {
121123 await extensionModule . install ( extensionAPI . value )
122-
124+
123125 const extensionData = {
124126 module : extensionModule ,
125127 id : extensionId ,
@@ -134,7 +136,7 @@ export const useAppStore = defineStore("app", () => {
134136
135137 return extensionModule
136138 } else {
137- throw new Error ( ' Extension must export an install function' )
139+ throw new Error ( " Extension must export an install function" )
138140 }
139141 } catch ( error ) {
140142 console . error ( `[AppStore] Failed to load extension from ${ path } :` , error )
@@ -149,20 +151,26 @@ export const useAppStore = defineStore("app", () => {
149151 function unloadExtension ( id ) {
150152 const extensionData = getExtension ( id )
151153 if ( ! extensionData ) return false
152-
153- if ( extensionData . module && typeof extensionData . module . uninstall === 'function' ) {
154+
155+ if (
156+ extensionData . module &&
157+ typeof extensionData . module . uninstall === "function"
158+ ) {
154159 try {
155160 extensionData . module . uninstall ( extensionAPI . value )
156161 console . log ( `[AppStore] Extension uninstall called: ${ id } ` )
157162 } catch ( error ) {
158163 console . error ( `[AppStore] Error calling uninstall for ${ id } :` , error )
159164 }
160165 }
161-
162- if ( extensionAPI . value && typeof extensionAPI . value . unregisterToolsByExtension === 'function' ) {
166+
167+ if (
168+ extensionAPI . value &&
169+ typeof extensionAPI . value . unregisterToolsByExtension === "function"
170+ ) {
163171 extensionAPI . value . unregisterToolsByExtension ( id )
164172 }
165-
173+
166174 loadedExtensions . value . delete ( id )
167175 console . log ( `[AppStore] Extension unloaded: ${ id } ` )
168176 return true
@@ -171,18 +179,22 @@ export const useAppStore = defineStore("app", () => {
171179 function toggleExtension ( id ) {
172180 const extensionData = getExtension ( id )
173181 if ( ! extensionData ) return false
174-
182+
175183 extensionData . enabled = ! extensionData . enabled
176- console . log ( `[AppStore] Extension ${ extensionData . enabled ? 'enabled' : 'disabled' } : ${ id } ` )
184+ console . log (
185+ `[AppStore] Extension ${ extensionData . enabled ? "enabled" : "disabled" } : ${ id } ` ,
186+ )
177187 return extensionData . enabled
178188 }
179189
180190 function setExtensionEnabled ( id , enabled ) {
181191 const extensionData = getExtension ( id )
182192 if ( ! extensionData ) return false
183-
193+
184194 extensionData . enabled = enabled
185- console . log ( `[AppStore] Extension ${ enabled ? 'enabled' : 'disabled' } : ${ id } ` )
195+ console . log (
196+ `[AppStore] Extension ${ enabled ? "enabled" : "disabled" } : ${ id } ` ,
197+ )
186198 return true
187199 }
188200
0 commit comments