mirror of
https://github.com/luanslimadev/Wand-Enhancer.git
synced 2026-08-28 17:01:05 +00:00
a0b3968d33
Reorganize the panel around product capabilities and integrate the remote i18n feature from origin/master into the new structure. - Restructure src into capability features (app, trainer, library, remote-session, appearance, shared); move the bridge to bridge/src. - Add lingui-based UI localization and wrap remaining user-facing strings (Trans / msg macros); fix the 'END В·' mojibake. - Port WeMod cheat-metadata i18n: capture the access token from the snapshot's renderer in the bridge and fetch localized trainer_meta in remote-session.i18n; guarantee snapshot sync on token failure. - Wire vitest to the app's lingui/preact pipeline (mergeConfig).
64 lines
1.8 KiB
JavaScript
Vendored
64 lines
1.8 KiB
JavaScript
Vendored
import { build } from "esbuild"
|
|
import { readdir } from "node:fs/promises"
|
|
import { dirname, resolve } from "node:path"
|
|
import { fileURLToPath } from "node:url"
|
|
|
|
const bridgeRoot = dirname(fileURLToPath(import.meta.url))
|
|
const webPanelRoot = resolve(bridgeRoot, "..")
|
|
const distRoot = resolve(webPanelRoot, "dist")
|
|
const bridgeEntryPoint = resolve(bridgeRoot, "src", "index.ts")
|
|
const bridgeOutfile = resolve(distRoot, "bridge.cjs")
|
|
const rendererScriptsRoot = resolve(bridgeRoot, "scripts", "default")
|
|
const rendererScriptsOutdir = resolve(distRoot, "renderer-scripts")
|
|
|
|
await build({
|
|
banner: {
|
|
js: "// Generated by bridge/build.mjs. Do not edit this bundle by hand.",
|
|
},
|
|
bundle: true,
|
|
entryPoints: [bridgeEntryPoint],
|
|
format: "cjs",
|
|
legalComments: "none",
|
|
minify: true,
|
|
outfile: bridgeOutfile,
|
|
platform: "node",
|
|
target: "node16",
|
|
})
|
|
|
|
const EXCLUDED_RENDERER_SCRIPTS = new Set(["activate-pro.js"])
|
|
|
|
const rendererEntries = (
|
|
await readdir(rendererScriptsRoot, { withFileTypes: true })
|
|
)
|
|
.filter(
|
|
(entry) =>
|
|
entry.isFile() &&
|
|
entry.name.endsWith(".js") &&
|
|
!EXCLUDED_RENDERER_SCRIPTS.has(entry.name)
|
|
)
|
|
.map((entry) => resolve(rendererScriptsRoot, entry.name))
|
|
|
|
if (rendererEntries.length === 0) {
|
|
throw new Error(`No renderer script entries found in ${rendererScriptsRoot}`)
|
|
}
|
|
|
|
await build({
|
|
banner: {
|
|
js: "// Generated by bridge/build.mjs. Do not edit this bundle by hand.",
|
|
},
|
|
bundle: true,
|
|
entryNames: "[name]",
|
|
entryPoints: rendererEntries,
|
|
format: "iife",
|
|
legalComments: "none",
|
|
minify: true,
|
|
outdir: rendererScriptsOutdir,
|
|
platform: "browser",
|
|
target: "es2020",
|
|
})
|
|
|
|
console.log(`Built ${bridgeOutfile}`)
|
|
console.log(
|
|
`Built ${rendererEntries.length} renderer script(s) in ${rendererScriptsOutdir}`
|
|
)
|