fix: bundle assets into executable

This commit is contained in:
2026-03-13 09:19:54 +07:00 Unverified
parent 649466a4de
commit b26fdbb9da
3 changed files with 16 additions and 6 deletions
Vendored
+9
View File
@@ -0,0 +1,9 @@
declare module "*.woff2" {
const file: string;
export default file;
}
declare module "*.svg" {
const file: string;
export default file;
}
+6 -5
View File
@@ -11,10 +11,11 @@ import {
import { twj } from "tw-to-css"; import { twj } from "tw-to-css";
import type { App } from "@"; import type { App } from "@";
import { ConstsSvg } from "@/assets/consts"; import { ConstsSvg } from "@/assets/consts";
import { mockData } from "@/lib/mock"; import shadeSvg from "@/assets/shade.svg" with { type: "file" };
import fontFile from "@/assets/shinshin.woff2" with { type: "file" };
const font = file("src/assets/shinshin.woff2"); const font = file(fontFile);
const shade = file("src/assets/shade.svg"); const shade = file(shadeSvg);
export function card(app: App) { export function card(app: App) {
return app return app
@@ -28,8 +29,8 @@ export function card(app: App) {
"/genshin/:uid/:char", "/genshin/:uid/:char",
async ({ params: { uid, char: charId } }) => { async ({ params: { uid, char: charId } }) => {
try { try {
// const data = await fetchEnka(uid, false); // const data = mockData;
const data = mockData; const data = await fetchEnka(uid, false);
if (typeof data.avatarInfoList === "undefined") if (typeof data.avatarInfoList === "undefined")
return status(400, "The showcase for this UID is private"); return status(400, "The showcase for this UID is private");
const char = data.avatarInfoList.find( const char = data.avatarInfoList.find(
+1 -1
View File
@@ -25,7 +25,7 @@
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */ /* Modules */
"module": "ES2022" /* Specify what module code is generated. */, "module": "esnext" /* Specify what module code is generated. */,
// "rootDir": "./", /* Specify the root folder within your source files. */ // "rootDir": "./", /* Specify the root folder within your source files. */
"moduleResolution": "bundler" /* Specify how TypeScript looks up a file from a given module specifier. */, "moduleResolution": "bundler" /* Specify how TypeScript looks up a file from a given module specifier. */,
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */