2025-07-16 22:29:28 +08:00
|
|
|
"use strict";
|
|
|
|
|
2025-03-05 02:05:18 +08:00
|
|
|
const fs = require("fs");
|
|
|
|
const path = require("path");
|
|
|
|
|
|
|
|
module.exports = {
|
2025-10-03 02:55:56 +08:00
|
|
|
findBundle() {
|
|
|
|
return ["dir_module_js.bundle0.js", "bundle0.js"];
|
|
|
|
},
|
2025-03-05 02:05:18 +08:00
|
|
|
afterExecute(options) {
|
|
|
|
const outputPath = options.output.path;
|
|
|
|
const files = fs.readdirSync(outputPath);
|
|
|
|
|
|
|
|
for (const file of files) {
|
|
|
|
const filename = path.resolve(outputPath, file);
|
2025-07-02 20:10:54 +08:00
|
|
|
const source = fs.readFileSync(filename, "utf8");
|
2025-03-05 02:05:18 +08:00
|
|
|
|
|
|
|
switch (file) {
|
|
|
|
case "resource-with-bom.ext": {
|
|
|
|
if (!/[\uFEFF]/.test(source)) {
|
|
|
|
throw new Error(`Not found BOM in ${filename}.`);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
if (/\uFEFF/.test(source)) {
|
|
|
|
throw new Error(`Found BOM in ${filename}.`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|