You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
544 B
28 lines
544 B
import qs from 'qs';
|
|
|
|
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,
|
|
};
|
|
}
|