[Scummvm-git-logs] scummvm-web master -> 6e6a4ae4288822f347b8397ad9ce44eeed6ebc7d
lephilousophe
noreply at scummvm.org
Sat Sep 19 15:17:59 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-web' repo located at https://api.github.com/repos/scummvm/scummvm-web .
Summary:
6e6a4ae428 DUMPER-COMPANION: Split zip.js in a separate chunk
Commit: 6e6a4ae4288822f347b8397ad9ce44eeed6ebc7d
https://github.com/scummvm/scummvm-web/commit/6e6a4ae4288822f347b8397ad9ce44eeed6ebc7d
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2026-09-19T17:17:19+02:00
Commit Message:
DUMPER-COMPANION: Split zip.js in a separate chunk
This addresses a Webpack warning about the size of our JS file.
Loading of zip.js is done lazily and prefetched if possible.
Changed paths:
build.js
dumper-companion/.gitignore
dumper-companion/eslint.config.mjs
dumper-companion/src/Dumper.tsx
dumper-companion/webpack.config.js
public_html/js/.gitignore
diff --git a/build.js b/build.js
index ba0c1078..97e34a9b 100644
--- a/build.js
+++ b/build.js
@@ -22,7 +22,42 @@ async function renderScss(filename) {
function copyDumper() {
console.log("Copying dumper companion");
- fs.copyFileSync("./dumper-companion/index.js", "./public_html/js/dumper-companion.js");
+ const srcFiles = fs.readdirSync("./dumper-companion/dist/", { withFileTypes: true });
+ const copiedFiles = new Set();
+ for (const srcFile of srcFiles) {
+ const src = `./dumper-companion/dist/${srcFile.name}`;
+ const dest = `./public_html/js/${srcFile.name}`;
+
+ // ignore folders
+ if (srcFile.isDirectory()) {
+ continue;
+ }
+ // make sure we don't copy something not properly prefixed
+ if (!/^(.+\.)?dumper-companion\.js$/.test(srcFile.name)) {
+ continue;
+ }
+ fs.copyFileSync(src, dest);
+ copiedFiles.add(srcFile.name);
+ }
+ // Cleanup
+ const destFiles = fs.readdirSync("./public_html/js/", { withFileTypes: true });
+ for (const destFile of destFiles) {
+ const dest = `./public_html/js/${destFile.name}`;
+
+ // ignore folders
+ if (destFile.isDirectory()) {
+ continue;
+ }
+ // check every dumper-companion JS files
+ if (!/^(.+\.)?dumper-companion\.js$/.test(destFile.name)) {
+ continue;
+ }
+ if (copiedFiles.has(destFile.name)) {
+ continue;
+ }
+ console.log(`Cleaning up obsolete file: ${dest}`);
+ fs.unlinkSync(dest);
+ }
fs.copyFileSync("./dumper-companion/style.css", "./public_html/css/dumper-companion.css");
}
diff --git a/dumper-companion/.gitignore b/dumper-companion/.gitignore
index 6736aa1e..44d646d5 100644
--- a/dumper-companion/.gitignore
+++ b/dumper-companion/.gitignore
@@ -1,2 +1,2 @@
node_modules
-index.js
+dist/
diff --git a/dumper-companion/eslint.config.mjs b/dumper-companion/eslint.config.mjs
index 97b43b12..dc9453e2 100644
--- a/dumper-companion/eslint.config.mjs
+++ b/dumper-companion/eslint.config.mjs
@@ -10,7 +10,7 @@ export default defineConfig(
preact,
{
name: "global ignores",
- ignores: ["node_modules", "index.js"],
+ ignores: ["node_modules", "dist"],
},
{
name: "global settings",
diff --git a/dumper-companion/src/Dumper.tsx b/dumper-companion/src/Dumper.tsx
index faa1751c..976a9bd8 100644
--- a/dumper-companion/src/Dumper.tsx
+++ b/dumper-companion/src/Dumper.tsx
@@ -1,6 +1,5 @@
import { ComponentChild } from 'preact';
import { useState, useEffect } from 'preact/hooks';
-import { fs } from '@zip.js/zip.js';
import { Volume } from './hfs/main';
import { Language, getLanguages } from './encoding';
@@ -22,6 +21,13 @@ async function dumpVolume(file: ArrayBuffer, s: DumpSettings): Promise<void> {
s.updateDumpPercent(0);
+ const { fs } = await import(
+ /* webpackChunkName: "zipjs" */
+ /* webpackExports: ["fs"] */
+ /* webpackPreload: true */
+ /* webpackPrefetch: true */
+ '@zip.js/zip.js');
+
const zipFS = new fs.FS();
volume.dumpToZip(zipFS.root, s.lang, !s.unicode, s.forceMacBinary, s.log);
const blob = await zipFS.exportBlob({
diff --git a/dumper-companion/webpack.config.js b/dumper-companion/webpack.config.js
index a130eb1c..f33528ec 100644
--- a/dumper-companion/webpack.config.js
+++ b/dumper-companion/webpack.config.js
@@ -4,8 +4,10 @@ module.exports = {
context: `${__dirname}/src`,
entry: "./index.tsx",
output: {
- path: __dirname,
- filename: "index.js"
+ clean: true,
+ path: `${__dirname}/dist`,
+ filename: "dumper-companion.js",
+ chunkFilename: "[name].dumper-companion.js"
},
resolve: {
extensions: [".ts", ".tsx", ".js"]
@@ -17,6 +19,7 @@ module.exports = {
},
plugins: [],
optimization: {
+ usedExports: true,
minimizer: [
new MinimizerPlugin({
extractComments: false,
diff --git a/public_html/js/.gitignore b/public_html/js/.gitignore
index e2625926..379a3cf5 100644
--- a/public_html/js/.gitignore
+++ b/public_html/js/.gitignore
@@ -1 +1,2 @@
+*.dumper-companion.js
dumper-companion.js
More information about the Scummvm-git-logs
mailing list