2024-03-11 18:18:41 +08:00
|
|
|
import { defineBuildConfig } from "unbuild";
|
|
|
|
import { join } from "node:path";
|
|
|
|
import { obfuscator } from "rollup-obfuscator";
|
|
|
|
|
2024-03-11 14:15:30 +08:00
|
|
|
export default defineBuildConfig({
|
2024-03-11 18:18:41 +08:00
|
|
|
name: "printHelp",
|
|
|
|
entries: ["src/index"],
|
|
|
|
clean: true,
|
|
|
|
declaration: true,
|
|
|
|
rollup: {
|
|
|
|
emitCJS: true,
|
|
|
|
inlineDependencies: true,
|
|
|
|
esbuild: {
|
|
|
|
minify: true,
|
2024-03-11 14:15:30 +08:00
|
|
|
},
|
2024-03-11 18:18:41 +08:00
|
|
|
},
|
|
|
|
alias: {
|
|
|
|
"@": join(__dirname, "src"),
|
|
|
|
},
|
|
|
|
hooks: {
|
|
|
|
"rollup:options"(_ctx, options) {
|
|
|
|
if (Array.isArray(options?.plugins)) {
|
|
|
|
options.plugins.push(
|
|
|
|
obfuscator({
|
|
|
|
compact: true,
|
|
|
|
sourceMap: false,
|
|
|
|
rotateStringArray: true,
|
|
|
|
stringArray: true,
|
|
|
|
stringArrayThreshold: 0.75,
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
2024-03-11 14:15:30 +08:00
|
|
|
},
|
2024-03-11 18:18:41 +08:00
|
|
|
},
|
|
|
|
});
|