bun 出 windows版了! 准备兼容

This commit is contained in:
shenjack-5600u 2024-04-02 20:14:30 +08:00
parent 51c97517b9
commit d854be84f4
Signed by: shenjack
GPG Key ID: FDF9864E11C7E79F

View File

@ -1,14 +1,22 @@
// let document = document; // let document = document;
// let window = window; // let window = window;
'use strict';
let name_input = "test\ntest2"; let name_input = "test\ntest2";
let assets_data = { let assets_data = {
lang: null, lang: null,
gAd: null, gAd: null,
}; };
let from_node = typeof window == "undefined";
if (from_node) { let run_env = {
};
let from_code = typeof window == "undefined";
if (from_code) {
console.log("Running from node"); console.log("Running from node");
// 整一套虚拟的window和document // 整一套虚拟的window和document
@ -3164,7 +3172,7 @@ var A = {
return J.cW(a).a5(a, b) return J.cW(a).a5(a, b)
}, },
rs(a, b, c, d) { rs(a, b, c, d) {
if (from_node) { if (from_code) {
console.log("rs", a, "|", b, "|", c, "|", d) console.log("rs", a, "|", b, "|", c, "|", d)
return return
} }
@ -3343,7 +3351,7 @@ var A = {
if (s == null) return "" if (s == null) return ""
return s return s
}, },
v1(a) { load_lang(a) {
J.lY(a, new LangData.lA()) J.lY(a, new LangData.lA())
}, },
lA: function lA() {}, lA: function lA() {},
@ -3441,10 +3449,10 @@ var A = {
} }
}, },
_wrapJsFunctionForAsync(func) { _wrapJsFunctionForAsync(func) {
var protected = function (fn, error_) { var protected_func = function (fn, error_) {
return function (error_code, async_result) { return function (error_code, async_result) {
while (true) try { while (true) try {
if (from_node) { if (from_code) {
console.log("O._wrapJsFunctionForAsync", error_code, async_result) console.log("O._wrapJsFunctionForAsync", error_code, async_result)
} }
fn(error_code, async_result) fn(error_code, async_result)
@ -3455,7 +3463,7 @@ var A = {
} }
} }
}(func, 1) }(func, 1)
return $.P.ct(new P._wrapJsFunctionForAsync_closure(protected)) return $.P.ct(new P._wrapJsFunctionForAsync_closure(protected_func))
}, },
async_error(a, b) { async_error(a, b) {
var s = H.ls(a, "error", t.K) var s = H.ls(a, "error", t.K)
@ -7872,7 +7880,7 @@ var A = {
return s return s
}, },
static_init() { static_init() {
if (from_node) { if (from_code) {
console.log("reaching HtmlRenderer.static_init") console.log("reaching HtmlRenderer.static_init")
} }
var async_goto = 0, var async_goto = 0,
@ -7882,7 +7890,7 @@ var A = {
if (a === 1) return P.async_rethrow(b, r) if (a === 1) return P.async_rethrow(b, r)
while (true) switch (async_goto) { while (true) switch (async_goto) {
case 0: case 0:
if (from_node) { if (from_code) {
// 直接忽略这里的 wait // 直接忽略这里的 wait
async_goto = 2 async_goto = 2
} else { } else {
@ -7896,13 +7904,16 @@ var A = {
return P._asyncAwait($.nt().a, $async$jv) return P._asyncAwait($.nt().a, $async$jv)
} }
case 2: case 2:
if (from_node) { if (from_code) {
console.log("loading gAd data") console.log("loading gAd data")
// 暂时有问题, 还得调试 // 暂时有问题, 还得调试
LangData.v1(t.cF.a(C.C.bt(0, assets_data.gAd))) // LangData.v1(t.cF.a(C.C.bt(0, assets_data.gAd)))
// LangData.v1(assets_data.gAd)
} else { } else {
p = window.sessionStorage.getItem(LangData.eQ("ll")) p = window.sessionStorage.getItem(LangData.eQ("ll"))
if (typeof p == "string") LangData.v1(t.cF.a(C.C.bt(0, p))) if (typeof p == "string") {
LangData.load_lang(t.cF.a(C.C.bt(0, p)))
}
} }
return P.async_return(null, r) return P.async_return(null, r)
} }
@ -12755,7 +12766,7 @@ X.iW.prototype = {
o = H.b([], t.Y) o = H.b([], t.Y)
e.push($.K()) e.push($.K())
// 评分输出 // 评分输出
if (from_node) { if (from_code) {
console.log("outputing score") console.log("outputing score")
} }
if (this_.b >= d.length) { if (this_.b >= d.length) {
@ -13513,7 +13524,7 @@ Sgls.k7.prototype = {
r = H.e(a) + "@!" r = H.e(a) + "@!"
$.k8.m(0, r, s) $.k8.m(0, r, s)
$.mg.m(0, r, q) $.mg.m(0, r, q)
if (!from_node) { if (!from_code) {
t.w.a(C.v.gbl(document.styleSheets)).insertRule("div." + s + ' { background-image:url("' + q + '"); }', $.e_ - 1) t.w.a(C.v.gbl(document.styleSheets)).insertRule("div." + s + ' { background-image:url("' + q + '"); }', $.e_ - 1)
} }
}, },
@ -20688,7 +20699,7 @@ function main() {
} }
while (true) switch (async_goto) { while (true) switch (async_goto) {
case 0: case 0:
if (from_node) { if (from_code) {
console.log("initing from node") console.log("initing from node")
$.ox = "" $.ox = ""
// 后面填一下这玩意 // 后面填一下这玩意
@ -20714,7 +20725,7 @@ function main() {
// 战斗框输入位置 // 战斗框输入位置
// 这里请输入一个被混淆过的名字 // 这里请输入一个被混淆过的名字
p = 5 p = 5
if (from_node) { if (from_code) {
console.log("node input:", raw_names) console.log("node input:", raw_names)
raw_names = name_input raw_names = name_input
} else { } else {