@gameap/debug 0.2.10 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/public/plugins.css +1 -0
- package/public/plugins.js +1 -0
- package/src/gameap-frontend.d.ts +9 -0
- package/src/main.ts +5 -0
- package/src/mocks/handlers.ts +1 -1
- package/vite.config.ts +17 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gameap/debug",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Debug harness for GameAP plugin development with mock API",
|
|
6
6
|
"bin": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@gameap/plugin-sdk": "^0.2.0",
|
|
28
|
-
"@gameap/frontend": "4.1.0-
|
|
28
|
+
"@gameap/frontend": "4.1.0-dev5",
|
|
29
29
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
30
30
|
"@tailwindcss/postcss": "^4.1.0",
|
|
31
31
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* Empty plugins CSS */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Empty plugins JS
|
package/src/main.ts
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
* allowing plugin testing in a realistic environment.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
// Import frontend styles
|
|
9
|
+
import '@gameap/frontend/style.css'
|
|
10
|
+
|
|
8
11
|
import { startMockServiceWorker, setPluginContent, updateDebugState } from './mocks/browser'
|
|
9
12
|
|
|
10
13
|
// Declare window globals for plugin compatibility
|
|
@@ -15,6 +18,7 @@ declare global {
|
|
|
15
18
|
Pinia: typeof import('pinia')
|
|
16
19
|
axios: typeof import('axios').default
|
|
17
20
|
gameapLang: string
|
|
21
|
+
i18n: Record<string, string>
|
|
18
22
|
gameapDebug: {
|
|
19
23
|
updateDebugState: typeof updateDebugState
|
|
20
24
|
setPluginContent: typeof setPluginContent
|
|
@@ -23,6 +27,7 @@ declare global {
|
|
|
23
27
|
}
|
|
24
28
|
}
|
|
25
29
|
|
|
30
|
+
|
|
26
31
|
// Load plugin from dist directory (set via PLUGIN_PATH env var)
|
|
27
32
|
// Using glob imports to handle dynamic file names
|
|
28
33
|
const pluginJsFiles = import.meta.glob('@plugin/plugin.js', { query: '?raw', import: 'default', eager: true })
|
package/src/mocks/handlers.ts
CHANGED
|
@@ -570,7 +570,7 @@ export const handlers = [
|
|
|
570
570
|
|
|
571
571
|
http.get('/api/users/:id/servers', async () => {
|
|
572
572
|
await delay(debugState.networkDelay)
|
|
573
|
-
return HttpResponse.json(
|
|
573
|
+
return HttpResponse.json(mockServersList.map((s: ServerListItem) => ({ id: s.id, name: s.name })))
|
|
574
574
|
}),
|
|
575
575
|
|
|
576
576
|
http.get('/api/users/:id/servers/:serverId/permissions', async () => {
|
package/vite.config.ts
CHANGED
|
@@ -3,8 +3,21 @@ import vue from '@vitejs/plugin-vue'
|
|
|
3
3
|
import { viteCommonjs } from '@originjs/vite-plugin-commonjs'
|
|
4
4
|
import { resolve, dirname } from 'path'
|
|
5
5
|
import { fileURLToPath } from 'url'
|
|
6
|
+
import { createRequire } from 'module'
|
|
6
7
|
|
|
7
8
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
9
|
+
const require = createRequire(import.meta.url)
|
|
10
|
+
|
|
11
|
+
// Resolve @gameap/frontend CSS path using Node's module resolution
|
|
12
|
+
function resolveFrontendCss(): string {
|
|
13
|
+
try {
|
|
14
|
+
const frontendPkg = require.resolve('@gameap/frontend/package.json')
|
|
15
|
+
return resolve(dirname(frontendPkg), 'dist/frontend.css')
|
|
16
|
+
} catch {
|
|
17
|
+
// Fallback for development (local workspace)
|
|
18
|
+
return resolve(__dirname, '../gameap-frontend/dist/frontend.css')
|
|
19
|
+
}
|
|
20
|
+
}
|
|
8
21
|
|
|
9
22
|
// Default plugin path - can be overridden via PLUGIN_PATH env variable
|
|
10
23
|
function resolvePluginPath(): string {
|
|
@@ -38,6 +51,8 @@ export default defineConfig({
|
|
|
38
51
|
{ find: '@debug', replacement: resolve(__dirname, 'src') },
|
|
39
52
|
// Plugin source (built bundle from external plugin)
|
|
40
53
|
{ find: '@plugin', replacement: resolvePluginPath() },
|
|
54
|
+
// Explicit CSS resolution for @gameap/frontend
|
|
55
|
+
{ find: '@gameap/frontend/style.css', replacement: resolveFrontendCss() },
|
|
41
56
|
],
|
|
42
57
|
},
|
|
43
58
|
css: {
|
|
@@ -52,14 +67,8 @@ export default defineConfig({
|
|
|
52
67
|
port: 5174,
|
|
53
68
|
open: true,
|
|
54
69
|
fs: {
|
|
55
|
-
// Allow serving files from
|
|
56
|
-
|
|
57
|
-
__dirname,
|
|
58
|
-
resolvePluginPath(),
|
|
59
|
-
// Allow node_modules for npm packages
|
|
60
|
-
resolve(__dirname, 'node_modules'),
|
|
61
|
-
resolve(process.cwd(), 'node_modules'),
|
|
62
|
-
],
|
|
70
|
+
// Allow serving files from anywhere (needed for npm packages)
|
|
71
|
+
strict: false,
|
|
63
72
|
},
|
|
64
73
|
},
|
|
65
74
|
define: {
|