why were the files not compressed at all lmao

This commit is contained in:
Quartinal 2025-01-12 09:47:16 -08:00
parent 654c8c1bbe
commit da6de49227
10 changed files with 67 additions and 2 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
dist/
node_modules/
pnpm-lock.yaml

30
compressWasm.cjs Normal file
View File

@ -0,0 +1,30 @@
const { readFileSync, writeFileSync } = require('node:fs');
const fg = require('fast-glob');
let brotliWasm;
(() => {
brotliWasm = require('brotli-wasm');
})();
const { compress } = brotliWasm;
((
/** @type {string} */
globPattern
) => {
console.warn('Warning: If you provide more than two files as arguments');
console.warn('it will only compress the first file due to performance');
console.warn('reasons. You can change this behavior by modifying the');
console.warn('function calling at the end of the script.');
for (const file of fg.globSync(globPattern)) {
const compressedFile = compress(readFileSync(file), {
quality: 11,
});
console.log(`Compressed ${file} from ${readFileSync(file).length} to ${compressedFile.length} bytes`);
writeFileSync(file, compressedFile);
}
})(process.argv[2]);

View File

@ -17,7 +17,7 @@
<script type="text/javascript" src="eagswebrtc.js"></script>
<script src="/js/ga4.js"></script>
<script type="text/javascript">
if(document.location.href.startsWith("file:")) {
if(location.protocol === "file:") {
alert("You cannot 'open' this file in your browser, the code doesn't work. Upload this folder to your HTTP(s) server and access it via the internet to launch the stable-download game. This is not a bug, please read the documentation");
}else {
window.addEventListener("load", function(){

View File

@ -76,7 +76,7 @@
<input class="starter" type="button" value="Launch" onclick="Start();" />
</div>
<script type="text/javascript">
if (document.location.href.startsWith("file:")) {
if (location.protocol === 'file:') {
alert("You cannot 'open' this file in your browser, the code doesn't work. Upload this folder to your HTTP(s) server and access it via the internet to launch the stable-download game. This is not a bug, please read the documentation.");
} else {
var PackSelect = document.getElementById("Packs");

View File

Before

Width:  |  Height:  |  Size: 265 KiB

After

Width:  |  Height:  |  Size: 265 KiB

18
package.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "somethingidontknowabout",
"private": true,
"dependencies": {
"brotli-wasm": "^3.0.1",
"fast-glob": "^3.3.3",
"tsup": "^8.3.5"
},
"devDependencies": {
"@types/node": "^22.10.5",
"typescript": "^5.7.3"
},
"scripts": {
"compress": "tsup --config tsup.config.js",
"compressWasm": "node compressWasm.cjs ./eagler-files/**/*.wasm"
},
"type": "module"
}

14
tsup.config.js Normal file
View File

@ -0,0 +1,14 @@
import { defineConfig } from 'tsup';
import fg from 'fast-glob';
export default defineConfig({
entry: fg.globSync('eagler-files/**/*.js'),
format: ['esm'],
target: ['chrome131'],
dts: false,
clean: true,
sourcemap: true,
minify: true,
watch: false,
outDir: 'dist',
});