refactor: batch 3

This commit is contained in:
鲁树人
2025-05-18 02:41:20 +09:00
parent 75b43e1e84
commit 2e4e57be45
52 changed files with 933 additions and 1136 deletions

15
support/b64-loader.ts Normal file
View File

@@ -0,0 +1,15 @@
import { readFile } from 'node:fs/promises';
import { Plugin } from 'vite';
export const base64Loader: Plugin = {
name: 'base64-loader',
async transform(_: unknown, id: string) {
const [path, query] = id.split('?');
if (query != 'base64') return null;
const data = await readFile(path);
const base64 = data.toString('base64');
return `export default '${base64}';`;
},
};