@gameap/debug 0.2.0

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.
@@ -0,0 +1,34 @@
1
+ import type { UserData } from '@gameap/plugin-sdk'
2
+
3
+ export const adminUser: UserData = {
4
+ id: 1,
5
+ login: 'admin',
6
+ name: 'Administrator',
7
+ roles: ['admin', 'user'],
8
+ isAdmin: true,
9
+ isAuthenticated: true,
10
+ }
11
+
12
+ export const regularUser: UserData = {
13
+ id: 2,
14
+ login: 'player1',
15
+ name: 'Regular Player',
16
+ roles: ['user'],
17
+ isAdmin: false,
18
+ isAuthenticated: true,
19
+ }
20
+
21
+ export const guestUser: UserData = {
22
+ id: 0,
23
+ login: '',
24
+ name: 'Guest',
25
+ roles: [],
26
+ isAdmin: false,
27
+ isAuthenticated: false,
28
+ }
29
+
30
+ export const userMocks: Record<string, UserData> = {
31
+ admin: adminUser,
32
+ user: regularUser,
33
+ guest: guestUser,
34
+ }
@@ -0,0 +1,5 @@
1
+ declare module '*.vue' {
2
+ import type { DefineComponent } from 'vue'
3
+ const component: DefineComponent<object, object, unknown>
4
+ export default component
5
+ }
@@ -0,0 +1,25 @@
1
+ import { resolve } from 'path'
2
+ import { fileURLToPath } from 'url'
3
+ import { dirname } from 'path'
4
+
5
+ const __dirname = dirname(fileURLToPath(import.meta.url))
6
+ const frontendRoot = resolve(__dirname, '../..')
7
+
8
+ export default {
9
+ content: [
10
+ // Main frontend files
11
+ resolve(frontendRoot, 'index.html'),
12
+ resolve(frontendRoot, 'js/**/*.{js,ts,jsx,tsx,vue}'),
13
+ resolve(frontendRoot, 'packages/**/*.{js,vue,css}'),
14
+ // Debug harness files
15
+ resolve(__dirname, 'index.html'),
16
+ resolve(__dirname, 'src/**/*.{js,ts,vue}'),
17
+ ],
18
+ theme: {
19
+ extend: {},
20
+ },
21
+ plugins: [
22
+ require('@tailwindcss/aspect-ratio'),
23
+ ],
24
+ darkMode: 'selector',
25
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "useDefineForClassFields": true,
5
+ "module": "ESNext",
6
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
7
+ "skipLibCheck": true,
8
+ "moduleResolution": "bundler",
9
+ "allowImportingTsExtensions": true,
10
+ "resolveJsonModule": true,
11
+ "isolatedModules": true,
12
+ "noEmit": true,
13
+ "jsx": "preserve",
14
+ "strict": true,
15
+ "noUnusedLocals": false,
16
+ "noUnusedParameters": false,
17
+ "noFallthroughCasesInSwitch": true,
18
+ "paths": {
19
+ "@debug/*": ["./src/*"],
20
+ "@app/*": ["../../js/*"],
21
+ "@/*": ["../../js/*"],
22
+ "@gameap/ui": ["../../packages/gameap-ui/index.js"],
23
+ "@gameap/plugin-sdk": ["../../../plugin-sdk/src/index.ts"],
24
+ "@plugin/*": ["../../../../../hex-editor-plugin/frontend/dist/*"]
25
+ },
26
+ "baseUrl": ".",
27
+ "types": ["vite/client"]
28
+ },
29
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
30
+ "references": [{ "path": "./tsconfig.node.json" }]
31
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "skipLibCheck": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "allowSyntheticDefaultImports": true,
8
+ "strict": true
9
+ },
10
+ "include": ["vite.config.ts"]
11
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,93 @@
1
+ import { defineConfig } from 'vite'
2
+ import vue from '@vitejs/plugin-vue'
3
+ import { viteCommonjs } from '@originjs/vite-plugin-commonjs'
4
+ import { resolve, dirname } from 'path'
5
+ import { fileURLToPath } from 'url'
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url))
8
+
9
+ // Path to the main frontend (for local development fallback)
10
+ const frontendRoot = resolve(__dirname, '../..')
11
+
12
+ // Default plugin path - can be overridden via PLUGIN_PATH env variable
13
+ function resolvePluginPath(): string {
14
+ const pluginPath = process.env.PLUGIN_PATH
15
+
16
+ if (!pluginPath) {
17
+ // Default: no plugin loaded
18
+ return resolve(__dirname, 'empty-plugin')
19
+ }
20
+
21
+ if (pluginPath.startsWith('/')) {
22
+ // Absolute path
23
+ return pluginPath
24
+ }
25
+
26
+ // Relative path from current working directory
27
+ return resolve(process.cwd(), pluginPath)
28
+ }
29
+
30
+ export default defineConfig({
31
+ plugins: [
32
+ viteCommonjs(),
33
+ vue(),
34
+ ],
35
+ root: __dirname,
36
+ base: '/',
37
+ publicDir: resolve(frontendRoot, 'public'),
38
+ resolve: {
39
+ alias: [
40
+ // Debug harness source (for mocks, etc.)
41
+ { find: '@debug', replacement: resolve(__dirname, 'src') },
42
+ // Frontend app - resolve from npm package @gameap/frontend
43
+ // Vite will resolve this from node_modules automatically
44
+ // Standard @ alias for frontend components (fallback to local for development)
45
+ { find: '@', replacement: resolve(frontendRoot, 'js') },
46
+ // GameAP UI package - resolve from node_modules
47
+ // Plugin source (built bundle from external plugin)
48
+ { find: '@plugin', replacement: resolvePluginPath() },
49
+ ],
50
+ },
51
+ css: {
52
+ // Use debug harness's postcss config with correct Tailwind content paths
53
+ postcss: resolve(__dirname, 'postcss.config.cjs'),
54
+ preprocessorOptions: {
55
+ scss: {
56
+ api: 'modern-compiler',
57
+ },
58
+ },
59
+ },
60
+ server: {
61
+ port: 5174,
62
+ open: true,
63
+ fs: {
64
+ // Allow serving files from these directories
65
+ allow: [
66
+ __dirname,
67
+ frontendRoot,
68
+ resolvePluginPath(),
69
+ resolve(frontendRoot, 'node_modules'),
70
+ ],
71
+ },
72
+ },
73
+ define: {
74
+ 'window.gameapLang': JSON.stringify(process.env.LOCALE || 'en'),
75
+ },
76
+ optimizeDeps: {
77
+ include: [
78
+ 'vue',
79
+ 'vue-router',
80
+ 'pinia',
81
+ 'axios',
82
+ 'naive-ui',
83
+ 'dayjs',
84
+ 'codemirror',
85
+ ],
86
+ // Don't pre-bundle these to allow proper resolution
87
+ exclude: ['@gameap/plugin-sdk', '@gameap/frontend', 'msw'],
88
+ },
89
+ build: {
90
+ outDir: 'dist',
91
+ emptyOutDir: true,
92
+ },
93
+ })