@@ -94,12 +94,12 @@ export const useAppStore = defineStore("app", () => {
9494 const response = await fetch ( path )
9595 let code = await response . text ( )
9696
97- // Replace Vue imports - handle all patterns including multiline
97+ // Replace Vue imports - handle all patterns including multiline and minified
9898 code = code . replace (
99- / i m p o r t \s + (?: { ( [ ^ } ] + ) } | \* \s + a s \s + ( \w + ) | ( \w + ) ) \s + f r o m \s + [ " ' ] v u e [ " ' ] ; ? / gs,
99+ / i m p o r t \s * (?: { ( [ ^ } ] + ) } | \* \s * a s \s + ( \w + ) | ( \w + ) ) \s * f r o m \s * [ " ' ] v u e [ " ' ] ; ? / gs,
100100 ( match , namedImports , namespaceImport , defaultImport ) => {
101101 if ( namedImports ) {
102- // Named imports: import { ref, computed } from 'vue'
102+ // Named imports: import { ref, computed } from 'vue' or import{ref}from"vue"
103103 // Convert 'as' to ':' for object destructuring
104104 const converted = namedImports . replace ( / \s + a s \s + / g, ': ' )
105105 return `const {${ converted } } = window.__VUE_RUNTIME__;`
@@ -116,7 +116,7 @@ export const useAppStore = defineStore("app", () => {
116116
117117 // Replace Pinia imports
118118 code = code . replace (
119- / i m p o r t \s + (?: { ( [ ^ } ] + ) } | \* \s + a s \s + ( \w + ) | ( \w + ) ) \s + f r o m \s + [ " ' ] p i n i a [ " ' ] ; ? / gs,
119+ / i m p o r t \s * (?: { ( [ ^ } ] + ) } | \* \s * a s \s + ( \w + ) | ( \w + ) ) \s * f r o m \s * [ " ' ] p i n i a [ " ' ] ; ? / gs,
120120 ( match , namedImports , namespaceImport , defaultImport ) => {
121121 if ( namedImports ) {
122122 const converted = namedImports . replace ( / \s + a s \s + / g, ': ' )
@@ -129,16 +129,32 @@ export const useAppStore = defineStore("app", () => {
129129 return match
130130 }
131131 )
132+
133+ // Replace back schemas import FIRST (before other @geode imports)
134+ let schemasReplaced = false
135+ code = code . replace (
136+ / i m p o r t \s + ( \w + ) \s * f r o m \s * [ " ' ] @ g e o d e \/ o p e n g e o d e w e b - b a c k \/ o p e n g e o d e w e b _ b a c k _ s c h e m a s \. j s o n [ " ' ] ; ? / g,
137+ ( match , defaultImport ) => {
138+ console . log ( '[AppStore] ✓ Replacing back schemas:' , match )
139+ schemasReplaced = true
140+ return `const ${ defaultImport } = window.__GEODE_BACK_SCHEMAS__;`
141+ }
142+ )
143+
144+ if ( ! schemasReplaced ) {
145+ console . warn ( '[AppStore] ⚠️ Back schemas import NOT found!' )
146+ console . log ( '[AppStore] First 300 chars after Vue/Pinia replacement:' , code . substring ( 0 , 300 ) )
147+ }
132148
133- // Replace @geode /* imports - just comment them out for now
149+ // Replace other @geode /* imports - comment them out
134150 code = code . replace (
135- / i m p o r t \s + [ ^ ; ] + f r o m \s + [ " ' ] @ g e o d e \/ [ ^ " ' ] + [ " ' ] ; ? / gs ,
136- ( match ) => `/* ${ match } */ // External dependency - resolved at runtime \n`
151+ / i m p o r t \s + [ ^ ; ] + f r o m \s * [ " ' ] @ g e o d e \/ [ ^ " ' ] + [ " ' ] ; ? / g ,
152+ ( match ) => `/* ${ match } */ // External dependency\n`
137153 )
138154
139155 // Replace @ogw_ * imports
140156 code = code . replace (
141- / i m p o r t \s + [ ^ ; ] + f r o m \s + [ " ' ] @ o g w _ [ ^ " ' ] + [ " ' ] ; ? / gs,
157+ / i m p o r t \s + [ ^ ; ] + f r o m \s * [ " ' ] @ o g w _ [ ^ " ' ] + [ " ' ] ; ? / gs,
142158 ( match ) => `/* ${ match } */ // External dependency - resolved at runtime\n`
143159 )
144160
0 commit comments