2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-10-14 18:49:03 +00:00

chore: implement gtk handler for custom files

This commit is contained in:
Jan Laupetin
2025-10-05 18:31:39 +02:00
parent cb4b69c63b
commit cb2e83dfca
10 changed files with 166 additions and 22 deletions

View File

@@ -47,13 +47,10 @@ export function headerTransformationPlugin(): Plugin {
return {
name: "header-transformation",
apply: "build",
config(config) {
config.base = "http://modman";
},
generateBundle(options: OutputOptions, bundle: OutputBundle, isWrite: boolean) {
const includesStr: string[] = [`#include "index.html.h"`];
const uiFilesStr: string[] = [
`{ "index.html", { "index.html", INDEX_HTML, std::extent_v<decltype(INDEX_HTML)> } }`,
`{ "index.html", INDEX_HTML, std::extent_v<decltype(INDEX_HTML)> }`,
];
for (const curBundle of Object.values(bundle)) {
@@ -66,7 +63,7 @@ export function headerTransformationPlugin(): Plugin {
includesStr.push(`#include "${curBundle.fileName}.h"`);
uiFilesStr.push(
`{ "${curBundle.fileName}", { "${curBundle.fileName}", ${varName}, std::extent_v<decltype(${varName})> } }`,
`{ "${curBundle.fileName}", ${varName}, std::extent_v<decltype(${varName})> }`,
);
curBundle.fileName = `${curBundle.fileName}.h`;
@@ -79,8 +76,8 @@ export function headerTransformationPlugin(): Plugin {
${includesStr.join("\n")}
#include <string>
#include <unordered_map>
#include <cstdlib>
#include <type_traits>
struct UiFile
{
@@ -89,9 +86,9 @@ struct UiFile
const size_t dataSize;
};
static inline const std::unordered_map<std::string, UiFile> MOD_MAN_UI_FILES({
static inline const UiFile MOD_MAN_UI_FILES[] {
${uiFilesStr.join(",\n")}
});
};
`,
});
},
@@ -106,7 +103,6 @@ ${uiFilesStr.join(",\n")}
},
) {
html = html.replaceAll("index.js.h", "index.js");
// .replaceAll("http://modman-resource/", "modman-resource://");
html = createTransformedTextSource(createVarName("index.html"), html);
ctx.filename = `${ctx.filename}.h`;

View File

@@ -101,6 +101,7 @@
"integrity": "sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/code-frame": "^7.27.1",
"@babel/generator": "^7.28.3",
@@ -653,6 +654,7 @@
}
],
"license": "MIT",
"peer": true,
"engines": {
"node": ">=18"
},
@@ -699,6 +701,7 @@
}
],
"license": "MIT",
"peer": true,
"engines": {
"node": ">=18"
}
@@ -2274,6 +2277,7 @@
"integrity": "sha512-TGf22kon8KW+DeKaUmOibKWktRY8b2NSAZNdtWh798COm1NWx8+xJ6iFBtk3IvLdv6+LGLJLRlyhrhEDZWargQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.45.0",
"@typescript-eslint/types": "8.45.0",
@@ -3035,6 +3039,7 @@
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -3228,6 +3233,7 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.8.9",
"caniuse-lite": "^1.0.30001746",
@@ -3761,6 +3767,7 @@
"integrity": "sha512-hB4FIzXovouYzwzECDcUkJ4OcfOEkXTv2zRY6B9bkwjx/cprAq0uvm1nl7zvQ0/TsUk0zQiN4uPfJpB9m+rPMQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.8.0",
"@eslint-community/regexpp": "^4.12.1",
@@ -3822,6 +3829,7 @@
"integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"eslint-config-prettier": "bin/cli.js"
},
@@ -3869,6 +3877,7 @@
"integrity": "sha512-K6tP0dW8FJVZLQxa2S7LcE1lLw3X8VvB3t887Q6CLrFVxHYBXGANbXvwNzYIu6Ughx1bSJ5BDT0YB3ybPT39lw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"natural-compare": "^1.4.0",
@@ -4669,6 +4678,7 @@
"integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"jiti": "lib/jiti-cli.mjs"
}
@@ -5477,6 +5487,7 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"nanoid": "^3.3.11",
"picocolors": "^1.1.1",
@@ -5516,6 +5527,7 @@
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"prettier": "bin/prettier.cjs"
},
@@ -5757,6 +5769,7 @@
"integrity": "sha512-t+YPtOQHpGW1QWsh1CHQ5cPIr9lbbGZLZnbihP/D/qZj/yuV68m8qarcV17nvkOX81BCrvzAlq2klCQFZghyTg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"chokidar": "^4.0.0",
"immutable": "^5.0.2",
@@ -6261,6 +6274,7 @@
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"devOptional": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -6384,6 +6398,7 @@
"integrity": "sha512-VbA8ScMvAISJNJVbRDTJdCwqQoAareR/wutevKanhR2/1EkoXVZVkkORaYm/tNVCjP/UDTKtcw3bAkwOUdedmA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.5.0",
@@ -6627,6 +6642,7 @@
"integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@types/chai": "^5.2.2",
"@vitest/expect": "3.2.4",
@@ -6706,6 +6722,7 @@
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.22.tgz",
"integrity": "sha512-toaZjQ3a/G/mYaLSbV+QsQhIdMo9x5rrqIpYRObsJ6T/J+RyCSFwN2LHNVH9v8uIcljDNa3QzPVdv3Y6b9hAJQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@vue/compiler-dom": "3.5.22",
"@vue/compiler-sfc": "3.5.22",