import qs from 'querystring'; export interface VueQuery { vue?: boolean; src?: boolean; type?: 'script' | 'template' | 'style' | 'custom'; index?: number; lang?: string; } export function parseVueRequest(id: string): any { const [filename, rawQuery] = id.split(`?`, 2); const query = qs.parse(rawQuery) as VueQuery; if (query.vue != null) { query.vue = true; } if (query.src != null) { query.src = true; } if (query.index != null) { query.index = Number(query.index); } return { filename, query, }; }