mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 07:37:19 +02:00
Optimize built scripts
This commit is contained in:
parent
728abced45
commit
6fa1f73702
7
build.ts
7
build.ts
@ -55,7 +55,7 @@ const postProcess = (str: string): string => {
|
|||||||
|
|
||||||
// Minify SVG import code
|
// Minify SVG import code
|
||||||
const svgMap = {}
|
const svgMap = {}
|
||||||
str = str.replaceAll(/var ([\w_]+) = ("<svg.*?");\n\n/g, function(match, p1, p2) {
|
str = str.replaceAll(/var ([\w_]+) = ("<svg.*?");\n\n/g, (match, p1, p2) => {
|
||||||
// Remove new lines in SVG
|
// Remove new lines in SVG
|
||||||
p2 = p2.replaceAll(/\\n*\s*/g, '');
|
p2 = p2.replaceAll(/\\n*\s*/g, '');
|
||||||
|
|
||||||
@ -82,6 +82,11 @@ const postProcess = (str: string): string => {
|
|||||||
// Remove comment line
|
// Remove comment line
|
||||||
str = str.replaceAll(/\\n\/\/.*?(?=\\n)/g, '');
|
str = str.replaceAll(/\\n\/\/.*?(?=\\n)/g, '');
|
||||||
|
|
||||||
|
// Replace ${"time".toUpperCase()} with "TIME"
|
||||||
|
str = str.replaceAll(/\$\{"([^"]+)"\.toUpperCase\(\)\}/g, (match, p1) => {
|
||||||
|
return p1.toUpperCase();
|
||||||
|
});
|
||||||
|
|
||||||
assert(str.includes('/* ADDITIONAL CODE */'));
|
assert(str.includes('/* ADDITIONAL CODE */'));
|
||||||
assert(str.includes('window.BX_EXPOSED = BxExposed'));
|
assert(str.includes('window.BX_EXPOSED = BxExposed'));
|
||||||
assert(str.includes('window.BxEvent = BxEvent'));
|
assert(str.includes('window.BxEvent = BxEvent'));
|
||||||
|
24
dist/better-xcloud.lite.user.js
vendored
24
dist/better-xcloud.lite.user.js
vendored
@ -1665,18 +1665,18 @@ class GlobalSettingsStorage extends BaseSettingsStore {
|
|||||||
label: t("stats"),
|
label: t("stats"),
|
||||||
default: ["ping", "fps", "btr", "dt", "pl", "fl"],
|
default: ["ping", "fps", "btr", "dt", "pl", "fl"],
|
||||||
multipleOptions: {
|
multipleOptions: {
|
||||||
time: `${"time".toUpperCase()}: ${t("clock")}`,
|
time: `TIME: ${t("clock")}`,
|
||||||
play: `${"play".toUpperCase()}: ${t("playtime")}`,
|
play: `PLAY: ${t("playtime")}`,
|
||||||
batt: `${"batt".toUpperCase()}: ${t("battery")}`,
|
batt: `BATT: ${t("battery")}`,
|
||||||
ping: `${"ping".toUpperCase()}: ${t("stat-ping")}`,
|
ping: `PING: ${t("stat-ping")}`,
|
||||||
jit: `${"jit".toUpperCase()}: ${t("jitter")}`,
|
jit: `JIT: ${t("jitter")}`,
|
||||||
fps: `${"fps".toUpperCase()}: ${t("stat-fps")}`,
|
fps: `FPS: ${t("stat-fps")}`,
|
||||||
btr: `${"btr".toUpperCase()}: ${t("stat-bitrate")}`,
|
btr: `BTR: ${t("stat-bitrate")}`,
|
||||||
dt: `${"dt".toUpperCase()}: ${t("stat-decode-time")}`,
|
dt: `DT: ${t("stat-decode-time")}`,
|
||||||
pl: `${"pl".toUpperCase()}: ${t("stat-packets-lost")}`,
|
pl: `PL: ${t("stat-packets-lost")}`,
|
||||||
fl: `${"fl".toUpperCase()}: ${t("stat-frames-lost")}`,
|
fl: `FL: ${t("stat-frames-lost")}`,
|
||||||
dl: `${"dl".toUpperCase()}: ${t("downloaded")}`,
|
dl: `DL: ${t("downloaded")}`,
|
||||||
ul: `${"ul".toUpperCase()}: ${t("uploaded")}`
|
ul: `UL: ${t("uploaded")}`
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
size: 6
|
size: 6
|
||||||
|
24
dist/better-xcloud.user.js
vendored
24
dist/better-xcloud.user.js
vendored
@ -1692,18 +1692,18 @@ class GlobalSettingsStorage extends BaseSettingsStore {
|
|||||||
label: t("stats"),
|
label: t("stats"),
|
||||||
default: ["ping", "fps", "btr", "dt", "pl", "fl"],
|
default: ["ping", "fps", "btr", "dt", "pl", "fl"],
|
||||||
multipleOptions: {
|
multipleOptions: {
|
||||||
time: `${"time".toUpperCase()}: ${t("clock")}`,
|
time: `TIME: ${t("clock")}`,
|
||||||
play: `${"play".toUpperCase()}: ${t("playtime")}`,
|
play: `PLAY: ${t("playtime")}`,
|
||||||
batt: `${"batt".toUpperCase()}: ${t("battery")}`,
|
batt: `BATT: ${t("battery")}`,
|
||||||
ping: `${"ping".toUpperCase()}: ${t("stat-ping")}`,
|
ping: `PING: ${t("stat-ping")}`,
|
||||||
jit: `${"jit".toUpperCase()}: ${t("jitter")}`,
|
jit: `JIT: ${t("jitter")}`,
|
||||||
fps: `${"fps".toUpperCase()}: ${t("stat-fps")}`,
|
fps: `FPS: ${t("stat-fps")}`,
|
||||||
btr: `${"btr".toUpperCase()}: ${t("stat-bitrate")}`,
|
btr: `BTR: ${t("stat-bitrate")}`,
|
||||||
dt: `${"dt".toUpperCase()}: ${t("stat-decode-time")}`,
|
dt: `DT: ${t("stat-decode-time")}`,
|
||||||
pl: `${"pl".toUpperCase()}: ${t("stat-packets-lost")}`,
|
pl: `PL: ${t("stat-packets-lost")}`,
|
||||||
fl: `${"fl".toUpperCase()}: ${t("stat-frames-lost")}`,
|
fl: `FL: ${t("stat-frames-lost")}`,
|
||||||
dl: `${"dl".toUpperCase()}: ${t("downloaded")}`,
|
dl: `DL: ${t("downloaded")}`,
|
||||||
ul: `${"ul".toUpperCase()}: ${t("uploaded")}`
|
ul: `UL: ${t("uploaded")}`
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
size: 6
|
size: 6
|
||||||
|
Loading…
x
Reference in New Issue
Block a user