Files
QZMusic_PC/amll-local/packages/core/tsdown.config.ts
lqtmcstudio 72f4510dc8 fork(fix): Clone AMLL 并修复 BUG
- 将AMLL Clone到本以地进行修复和优化(emm虽然这很不优雅但是暂时无时间做子模块和Fork)
- 修复在当前播放歌词行不可见的视口Seek会出现滚动偏移的问题
2026-06-07 00:02:14 +08:00

35 lines
911 B
TypeScript

import { readFileSync } from "node:fs";
import { defineConfig } from "tsdown";
import { baseConfig } from "../../tsdown.base.ts";
const rawQueryPlugin = {
name: "raw-query",
resolveId(id: string, importer: string | undefined) {
if (id.endsWith("?raw")) {
const rawPath = id.slice(0, -4);
const base = importer ? `file://${importer}` : `file://${process.cwd()}/`;
const resolved = new URL(rawPath, base).pathname.replace(
/^\/([A-Za-z]:)/,
"$1",
);
return `\0raw:${resolved}`;
}
},
load(id: string) {
if (id.startsWith("\0raw:")) {
const file = id.slice(5);
const content = readFileSync(file, "utf-8");
return `export default ${JSON.stringify(content)}`;
}
},
};
export default defineConfig({
...baseConfig,
entry: { "amll-core": "./src/index.ts" },
plugins: [rawQueryPlugin],
define: {
"import.meta.env.DEV": "process.env.NODE_ENV !== 'production'",
},
});