mirror of https://github.com/sveltejs/svelte
parent
85dcb91f7c
commit
bc205c64d5
@ -0,0 +1,18 @@
|
||||
/**
|
||||
*
|
||||
* @param {Record<string, string>} modules
|
||||
* @returns {import('rolldown').Plugin}
|
||||
*/
|
||||
export function virtual(modules) {
|
||||
const resolved_ids = new Map(Object.entries(modules).map(([id, code]) => ['\0' + id, code]));
|
||||
|
||||
return {
|
||||
name: 'virtual',
|
||||
resolveId(id) {
|
||||
if (id in modules) return '\0' + id;
|
||||
},
|
||||
load(id) {
|
||||
return resolved_ids.get(id) ?? null;
|
||||
}
|
||||
};
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue