Some checks failed
Test and deploy staging / staging (push) Failing after 14s
- run sv migrate sveltekit-3: config moves into vite.config.ts, $lib becomes #lib, $env/dynamic becomes $app/env/private via src/env.ts, $app/environment becomes $app/env, hook types move to @sveltejs/kit/hooks - env vars stay optional (the migrator defaulted them to ''), and BANCHO_MODE, which it missed, is declared and passed to simulatorEnabled - handleError only logs and masks unknown errors; Kit 3 now routes 404s and error(...) through it too - json()/text() become Response.json()/new Response(); goto keepFocus/noScroll becomes reset: false; invalidateAll becomes refreshAll; page.url is copied before mutating - replace adapter-node with @sveltejs/adapter-bun; prod-server.ts wraps Bun.serve to add native WebSockets (bunSockets) for /ws paths, since the generated server has no websocket option - drop the Kit readdir patch: Kit 3 sorts route entries itself - match view and broadcast pages use the live score modules BREAKING CHANGE: requires SvelteKit 3, TypeScript 6 and Bun 1.4; the build output is build/index.js from adapter-bun, started through prod-server.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
79 lines
2.0 KiB
TypeScript
79 lines
2.0 KiB
TypeScript
import adapter from '@sveltejs/adapter-bun';
|
|
import devtoolsJson from 'vite-plugin-devtools-json';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import { defineConfig, type Plugin } from 'vitest/config';
|
|
import type { Server } from 'node:http';
|
|
import { attachSockets } from './src/lib/server/ws-attach.ts';
|
|
import { sveltekit } from '@sveltejs/kit/vite';
|
|
import { sentrySvelteKit } from '@sentry/sveltekit';
|
|
|
|
function matchSocket(): Plugin {
|
|
return {
|
|
name: 'esports-match-socket',
|
|
configureServer(server) {
|
|
if (server.httpServer) void attachSockets(server.httpServer as Server);
|
|
}
|
|
};
|
|
}
|
|
|
|
// Stub import-in-the-middle — its ESM loader hooks are Node-only and crash Bun.
|
|
// Sentry's manual error tracking (sentryHandle, captureException) still works;
|
|
// only automatic OpenTelemetry instrumentation is disabled.
|
|
function stubIITM(): Plugin {
|
|
return {
|
|
name: 'stub-import-in-the-middle',
|
|
resolveId(id) {
|
|
if (id === 'import-in-the-middle' || id.startsWith('import-in-the-middle/')) {
|
|
return '\0iitm-stub';
|
|
}
|
|
},
|
|
load(id) {
|
|
if (id === '\0iitm-stub') {
|
|
return 'export class Hook { constructor() {} enable() {} disable() {} unhook() {} }';
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
stubIITM(),
|
|
tailwindcss(),
|
|
sentrySvelteKit({
|
|
org: 'vash-software-vr',
|
|
project: 'esports',
|
|
authToken: process.env.SENTRY_AUTH_TOKEN,
|
|
telemetry: false
|
|
}),
|
|
sveltekit({
|
|
adapter: adapter(),
|
|
csrf: { trustedOrigins: ['https://esports-dev.vash.software'] }
|
|
}),
|
|
devtoolsJson(),
|
|
matchSocket()
|
|
],
|
|
ssr: {
|
|
external: ['bun']
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
external: ['bun']
|
|
},
|
|
reportCompressedSize: false
|
|
},
|
|
server: {
|
|
host: '127.0.0.1',
|
|
port: 3102,
|
|
allowedHosts: ['esports-dev.vash.software'],
|
|
ws:
|
|
process.env.AUTH_E2E === '1'
|
|
? false
|
|
: { host: 'esports-dev.vash.software', protocol: 'wss', clientPort: 443 }
|
|
},
|
|
test: {
|
|
expect: { requireAssertions: true },
|
|
environment: 'node',
|
|
include: ['src/**/*.{test,spec}.{js,ts}']
|
|
}
|
|
});
|