import * as fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

const root = path.join(path.dirname(fileURLToPath(import.meta.url)), 'node_modules', 'typescript');

function supportSPA() {
	const workbenchPath = path.join(path.dirname(fileURLToPath(import.meta.url)), 'node_modules', '@vscode', 'test-web', 'out', 'server', 'workbench.js');
	let content = fs.readFileSync(workbenchPath, { encoding: 'utf-8' });
	content = content.replace('router.get(\'/\', async (ctx)', 'router.get(/.*/, async (ctx)');
	fs.writeFileSync(workbenchPath, content, 'utf-8');
}

supportSPA();
