Keep embedded skill assets in single bundles

This commit is contained in:
gitea committed 2026-09-18 12:23:33 +08:00
1 parent a37e925979
commit 605b8e18d2
5 files changed
+914 -526

No files matched your search

+7 -3
View File
@@ -31,15 +31,19 @@ const lines = [
];
for (const [index, file] of files.entries()) {
const importType = file.kind === "text" ? "text" : "file";
lines.push(`import file${index} from ${JSON.stringify(file.importPath)} with { type: ${JSON.stringify(importType)} };`);
if (file.kind === "text") {
lines.push(`import file${index} from ${JSON.stringify(file.importPath)} with { type: "text" };`);
} else {
const base64 = readFileSync(file.fullPath).toString("base64");
lines.push(`const file${index} = ${JSON.stringify(base64)};`);
}
}
lines.push("", "export const EMBEDDED_SKILL_TEXT_FILES: Record<string, string> = {");
for (const [index, file] of files.entries()) {
if (file.kind === "text") lines.push(` ${JSON.stringify(file.relativePath)}: file${index},`);
}
lines.push("};", "", "export const EMBEDDED_SKILL_ASSET_PATHS: Record<string, string> = {");
lines.push("};", "", "export const EMBEDDED_SKILL_ASSET_DATA: Record<string, string> = {");
for (const [index, file] of files.entries()) {
if (file.kind === "asset") lines.push(` ${JSON.stringify(file.relativePath)}: file${index},`);
}