import { fileURLToPath } from 'node:url'; import process from 'node:process'; import vue from '@vitejs/plugin-vue'; import tailwind from '@tailwindcss/vite'; import { createServer } from 'vite'; const server = await createServer({ configFile: false, plugins: [vue(), tailwind()], resolve: { alias: { '@': fileURLToPath(new URL('../../resources/js', import.meta.url)), }, }, server: { host: '127.0.0.1', port: 4176, strictPort: true, hmr: false }, appType: 'custom', }); const project = { id: 7, name: 'Engineering', key: 'ENG', show_author: true, show_story_points: true, }; const ticketType = { id: 1, name: 'Task', is_parent: false }; const priority = { id: 1, name: 'Medium' }; const status = { id: 1, name: 'To do', board_column: null }; let ticket = { id: 31, ticket_key: 'ENG-31', title: 'Existing ticket', description: '', ticket_type: ticketType, ticket_type_id: 1, ticket_priority: priority, ticket_priority_id: 1, ticket_status: status, is_blocked: false, story_points: 0, acceptance_criteria: process.env.CRITERIA_FIXTURE ? [ { id: 11, text: 'Parent criterion', indent: 0, checked: false }, { id: 12, text: 'Nested criterion', indent: 1, checked: true }, { id: 13, text: 'Deep criterion', indent: 2, checked: false }, { id: 14, text: 'Independent criterion', indent: 0, checked: false, }, ] : [], field_values: [], worklog_entries: [], created_at: '2026-09-10T12:00:00Z', updated_at: '2026-09-11T12:00:00Z', }; server.middlewares.use(async (request, response, next) => { const url = new URL(request.url, 'http://localhost'); if (!/^\/(feedback|projects|dashboard)(\/|$)/.test(url.pathname)) { return next(); } let path = url.pathname; const mutation = request.method !== 'GET'; const result = request.headers.cookie?.match(/feedback_test_result=(\w+)/)?.[1] ?? 'success'; if (path.endsWith('/branches/validate')) { response.setHeader('Content-Type', 'application/json'); response.end(JSON.stringify({ is_valid: true, message: 'Available' })); return; } if (mutation) { if (result === 'server') { response.statusCode = 503; response.setHeader('Content-Type', 'text/html'); response.end('