Skip to content

Commit 28250e1

Browse files
committed
aoi
1 parent c337845 commit 28250e1

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

stores/app.js

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
/import\s+(?:{([^}]+)}|\*\s+as\s+(\w+)|(\w+))\s+from\s+["']vue["'];?/gs,
99+
/import\s*(?:{([^}]+)}|\*\s*as\s+(\w+)|(\w+))\s*from\s*["']vue["'];?/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+as\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-
/import\s+(?:{([^}]+)}|\*\s+as\s+(\w+)|(\w+))\s+from\s+["']pinia["'];?/gs,
119+
/import\s*(?:{([^}]+)}|\*\s*as\s+(\w+)|(\w+))\s*from\s*["']pinia["'];?/gs,
120120
(match, namedImports, namespaceImport, defaultImport) => {
121121
if (namedImports) {
122122
const converted = namedImports.replace(/\s+as\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+
/import\s+(\w+)\s*from\s*["']@geode\/opengeodeweb-back\/opengeodeweb_back_schemas\.json["'];?/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-
/import\s+[^;]+from\s+["']@geode\/[^"']+["'];?/gs,
136-
(match) => `/* ${match} */ // External dependency - resolved at runtime\n`
151+
/import\s+[^;]+from\s*["']@geode\/[^"']+["'];?/g,
152+
(match) => `/* ${match} */ // External dependency\n`
137153
)
138154

139155
// Replace @ogw_* imports
140156
code = code.replace(
141-
/import\s+[^;]+from\s+["']@ogw_[^"']+["'];?/gs,
157+
/import\s+[^;]+from\s*["']@ogw_[^"']+["'];?/gs,
142158
(match) => `/* ${match} */ // External dependency - resolved at runtime\n`
143159
)
144160

0 commit comments

Comments
 (0)