From bd192876a6bb76d20344cfee259de101ef9bf110 Mon Sep 17 00:00:00 2001 From: what Date: Fri, 3 Jan 2025 17:14:00 +0800 Subject: [PATCH] v0.9.15 --- dist/ff-request.js | 366 ++++++++++++++++++++-------------------- dist/ff-request.umd.cjs | 4 +- package.json | 9 +- 3 files changed, 192 insertions(+), 187 deletions(-) diff --git a/dist/ff-request.js b/dist/ff-request.js index 6837401..59e93ca 100644 --- a/dist/ff-request.js +++ b/dist/ff-request.js @@ -4,11 +4,11 @@ var v = (r, e, t) => (le(r, typeof e != "symbol" ? e + "" : e, t), t), re = (r, if (!e.has(r)) throw TypeError("Cannot " + t); }; -var o = (r, e, t) => (re(r, e, "read from private field"), t ? t.call(r) : e.get(r)), E = (r, e, t) => { +var i = (r, e, t) => (re(r, e, "read from private field"), t ? t.call(r) : e.get(r)), E = (r, e, t) => { if (e.has(r)) throw TypeError("Cannot add the same private member more than once"); e instanceof WeakSet ? e.add(r) : e.set(r, t); -}, C = (r, e, t, n) => (re(r, e, "write to private field"), n ? n.call(r, t) : e.set(r, t), t); +}, _ = (r, e, t, n) => (re(r, e, "write to private field"), n ? n.call(r, t) : e.set(r, t), t); function he(r) { return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r; } @@ -16,63 +16,63 @@ var oe = {}; (function(r) { (function(e) { e([], function() { - var t = -1, n = -2, s = -3, f = -4, h = -5, $ = function(a, c) { - c = c || {}; - var l = c.verbose || !1; - l && console.log("Normalize the JSON Object"), a = typeof a == "string" ? this.JSON.parse(a) : a, l && console.log("Creating a empty dictionary"); - var d = { + var t = -1, n = -2, s = -3, c = -4, l = -5, A = function(h, o) { + o = o || {}; + var d = o.verbose || !1; + d && console.log("Normalize the JSON Object"), h = typeof h == "string" ? this.JSON.parse(h) : h, d && console.log("Creating a empty dictionary"); + var f = { strings: [], integers: [], floats: [] }; - l && console.log("Creating the AST"); - var g = function T(i) { - l && console.log("Calling recursiveAstBuilder with " + this.JSON.stringify(i)); - var w = typeof i; - if (i === null) + d && console.log("Creating the AST"); + var g = function P(a) { + d && console.log("Calling recursiveAstBuilder with " + this.JSON.stringify(a)); + var w = typeof a; + if (a === null) return { type: "null", index: s }; - if (typeof i > "u") + if (typeof a > "u") return { type: "undefined", - index: h + index: l }; - if (i instanceof Array) { - var P = ["@"]; - for (var y in i) - i.hasOwnProperty(y) && P.push(T(i[y])); - return P; + if (a instanceof Array) { + var x = ["@"]; + for (var y in a) + a.hasOwnProperty(y) && x.push(P(a[y])); + return x; } if (w === "object") { - var P = ["$"]; - for (var M in i) - i.hasOwnProperty(M) && (P.push(T(M)), P.push(T(i[M]))); - return P; + var x = ["$"]; + for (var $ in a) + a.hasOwnProperty($) && (x.push(P($)), x.push(P(a[$]))); + return x; } - if (i === "") + if (a === "") return { type: "empty", - index: f + index: c }; if (w === "string") { - var O = u.call(d.strings, i); - return O == -1 && (d.strings.push(q(i)), O = d.strings.length - 1), { + var O = T.call(f.strings, a); + return O == -1 && (f.strings.push(G(a)), O = f.strings.length - 1), { type: "strings", index: O }; } - if (w === "number" && i % 1 === 0) { - var O = u.call(d.integers, i); - return O == -1 && (d.integers.push(U(i)), O = d.integers.length - 1), { + if (w === "number" && a % 1 === 0) { + var O = T.call(f.integers, a); + return O == -1 && (f.integers.push(F(a)), O = f.integers.length - 1), { type: "integers", index: O }; } if (w === "number") { - var O = u.call(d.floats, i); - return O == -1 && (d.floats.push(i), O = d.floats.length - 1), { + var O = T.call(f.floats, a); + return O == -1 && (f.floats.push(a), O = f.floats.length - 1), { type: "floats", index: O }; @@ -80,77 +80,77 @@ var oe = {}; if (w === "boolean") return { type: "boolean", - index: i ? t : n + index: a ? t : n }; - throw new Error("Unexpected argument of type " + typeof i); - }(a), b = d.strings.length, F = d.integers.length; - d.floats.length, l && console.log("Parsing the dictionary"); - var A = d.strings.join("|"); - return A += "^" + d.integers.join("|"), A += "^" + d.floats.join("|"), l && console.log("Parsing the structure"), A += "^" + function T(i) { - if (l && console.log("Calling a recursiveParser with " + this.JSON.stringify(i)), i instanceof Array) { - var w = i.shift(); - for (var P in i) - i.hasOwnProperty(P) && (w += T(i[P]) + "|"); + throw new Error("Unexpected argument of type " + typeof a); + }(h), b = f.strings.length, I = f.integers.length; + f.floats.length, d && console.log("Parsing the dictionary"); + var N = f.strings.join("|"); + return N += "^" + f.integers.join("|"), N += "^" + f.floats.join("|"), d && console.log("Parsing the structure"), N += "^" + function P(a) { + if (d && console.log("Calling a recursiveParser with " + this.JSON.stringify(a)), a instanceof Array) { + var w = a.shift(); + for (var x in a) + a.hasOwnProperty(x) && (w += P(a[x]) + "|"); return (w[w.length - 1] === "|" ? w.slice(0, -1) : w) + "]"; } - var y = i.type, M = i.index; + var y = a.type, $ = a.index; if (y === "strings") - return U(M); + return F($); if (y === "integers") - return U(b + M); + return F(b + $); if (y === "floats") - return U(b + F + M); + return F(b + I + $); if (y === "boolean") - return i.index; + return a.index; if (y === "null") return s; if (y === "undefined") - return h; + return l; if (y === "empty") - return f; + return c; throw new TypeError("The item is alien!"); - }(g), l && console.log("Ending parser"), c.debug ? { - dictionary: d, + }(g), d && console.log("Ending parser"), o.debug ? { + dictionary: f, ast: g, - packed: A - } : A; - }, _ = function(a, c) { - c = c || {}; - var l = a.split("^"); - c.verbose && console.log("Building dictionary"); - var d = [], g = l[0]; + packed: N + } : N; + }, M = function(h, o) { + o = o || {}; + var d = h.split("^"); + o.verbose && console.log("Building dictionary"); + var f = [], g = d[0]; if (g !== "") { - g = g.split("|"), c.verbose && console.log("Parse the strings dictionary"); - for (var b = 0, F = g.length; b < F; b++) - d.push(z(g[b])); + g = g.split("|"), o.verbose && console.log("Parse the strings dictionary"); + for (var b = 0, I = g.length; b < I; b++) + f.push(z(g[b])); } - if (g = l[1], g !== "") { - g = g.split("|"), c.verbose && console.log("Parse the integers dictionary"); - for (var b = 0, F = g.length; b < F; b++) - d.push(J(g[b])); + if (g = d[1], g !== "") { + g = g.split("|"), o.verbose && console.log("Parse the integers dictionary"); + for (var b = 0, I = g.length; b < I; b++) + f.push(u(g[b])); } - if (g = l[2], g !== "") { - g = g.split("|"), c.verbose && console.log("Parse the floats dictionary"); - for (var b = 0, F = g.length; b < F; b++) - d.push(parseFloat(g[b])); + if (g = d[2], g !== "") { + g = g.split("|"), o.verbose && console.log("Parse the floats dictionary"); + for (var b = 0, I = g.length; b < I; b++) + f.push(parseFloat(g[b])); } - g = null, c.verbose && console.log("Tokenizing the structure"); - for (var A = "", T = [], i = l[3].length, b = 0; b < i; b++) { - var w = l[3].charAt(b); - w === "|" || w === "$" || w === "@" || w === "]" ? (A && (T.push(J(A)), A = ""), w !== "|" && T.push(w)) : A += w; + g = null, o.verbose && console.log("Tokenizing the structure"); + for (var N = "", P = [], a = d[3].length, b = 0; b < a; b++) { + var w = d[3].charAt(b); + w === "|" || w === "$" || w === "@" || w === "]" ? (N && (P.push(u(N)), N = ""), w !== "|" && P.push(w)) : N += w; } - var P = T.length, y = 0; - return c.verbose && console.log("Starting recursive parser"), function M() { - var O = T[y++]; - if (c.verbose && console.log("Reading collection type " + (O === "$" ? "object" : "Array")), O === "@") { - for (var p = []; y < P; y++) { - var S = T[y]; - if (c.verbose && console.log("Read " + S + " symbol"), S === "]") + var x = P.length, y = 0; + return o.verbose && console.log("Starting recursive parser"), function $() { + var O = P[y++]; + if (o.verbose && console.log("Reading collection type " + (O === "$" ? "object" : "Array")), O === "@") { + for (var p = []; y < x; y++) { + var C = P[y]; + if (o.verbose && console.log("Read " + C + " symbol"), C === "]") return p; - if (S === "@" || S === "$") - p.push(M()); + if (C === "@" || C === "$") + p.push($()); else - switch (S) { + switch (C) { case t: p.push(!0); break; @@ -160,86 +160,86 @@ var oe = {}; case s: p.push(null); break; - case h: + case l: p.push(void 0); break; - case f: + case c: p.push(""); break; default: - p.push(d[S]); + p.push(f[C]); } } - return c.verbose && console.log("Parsed " + this.JSON.stringify(p)), p; + return o.verbose && console.log("Parsed " + this.JSON.stringify(p)), p; } if (O === "$") { - for (var p = {}; y < P; y++) { - var x = T[y]; - if (x === "]") + for (var p = {}; y < x; y++) { + var S = P[y]; + if (S === "]") return p; - x === f ? x = "" : x = d[x]; - var S = T[++y]; - if (S === "@" || S === "$") - p[x] = M(); + S === c ? S = "" : S = f[S]; + var C = P[++y]; + if (C === "@" || C === "$") + p[S] = $(); else - switch (S) { + switch (C) { case t: - p[x] = !0; + p[S] = !0; break; case n: - p[x] = !1; + p[S] = !1; break; case s: - p[x] = null; + p[S] = null; break; - case h: - p[x] = void 0; + case l: + p[S] = void 0; break; - case f: - p[x] = ""; + case c: + p[S] = ""; break; default: - p[x] = d[S]; + p[S] = f[C]; } } - return c.verbose && console.log("Parsed " + this.JSON.stringify(p)), p; + return o.verbose && console.log("Parsed " + this.JSON.stringify(p)), p; } throw new TypeError("Bad token " + O + " isn't a type"); }(); - }, q = function(a) { - return typeof a != "string" ? a : a.replace(/[\+ \|\^\%]/g, function(c) { + }, G = function(h) { + return typeof h != "string" ? h : h.replace(/[\+ \|\^\%]/g, function(o) { return { " ": "+", "+": "%2B", "|": "%7C", "^": "%5E", "%": "%25" - }[c]; + }[o]; }); - }, z = function(a) { - return typeof a != "string" ? a : a.replace(/\+|%2B|%7C|%5E|%25/g, function(c) { + }, z = function(h) { + return typeof h != "string" ? h : h.replace(/\+|%2B|%7C|%5E|%25/g, function(o) { return { "+": " ", "%2B": "+", "%7C": "|", "%5E": "^", "%25": "%" - }[c]; + }[o]; }); - }, U = function(a) { - return Number.prototype.toString.call(a, 36).toUpperCase(); - }, J = function(a) { - return parseInt(a, 36); - }, u = Array.prototype.indexOf || function(a, c) { - for (var l = c || 0, d = this.length; l < d; l++) - if (this[l] === a) - return l; + }, F = function(h) { + return Number.prototype.toString.call(h, 36).toUpperCase(); + }, u = function(h) { + return parseInt(h, 36); + }, T = Array.prototype.indexOf || function(h, o) { + for (var d = o || 0, f = this.length; d < f; d++) + if (this[d] === h) + return d; return -1; }; return { JSON, - pack: $, - unpack: _ + pack: A, + unpack: M }; }); })(function(e, t) { @@ -249,42 +249,42 @@ var oe = {}; }); })(oe); const ne = /* @__PURE__ */ he(oe); -var D, j, I, R, Y, Q, K, W, X; +var j, B, D, U, Y, Q, J, W, X; class ee { - constructor(e, t, n, s, f) { + constructor(e, t, n, s, c) { v(this, "code", 0); v(this, "message", "操作成功"); v(this, "data", null); v(this, "url", ""); v(this, "res", ""); // static [Symbol.hasInstance](self) { return self?.IS_ECHO_MSG !== undefined } - E(this, D, null); + E(this, j, null); // 判断返回 Response 对象, 还是 Response 中的 data - E(this, j, !0); + E(this, B, !0); // 判罚是否已经给出错误提示 - E(this, I, !0); - E(this, R, { - get: (e, t) => o(this, Y).call(this, t), - ownKeys: () => Object.keys(o(this, R).getPrototypeOf() || {}), - getPrototypeOf: () => o(this, j) ? this : this.data, + E(this, D, !0); + E(this, U, { + get: (e, t) => i(this, Y).call(this, t), + ownKeys: () => Object.keys(i(this, U).getPrototypeOf() || {}), + getPrototypeOf: () => i(this, B) ? this : this.data, getOwnPropertyDescriptor: () => ({ configurable: !0, enumerable: !0, writable: !0, - value: o(this, R).getPrototypeOf() + value: i(this, U).getPrototypeOf() }) }); - E(this, Y, (e) => e === "$echoMsg" ? o(this, K) : e === "msg" ? o(this, Q) : e === "then" || e === "resp" ? (C(this, I, !0), C(this, j, e === "resp"), o(this, W)) : e === "catch" ? o(this, X) : e === "IS_ECHO_MSG" ? o(this, I) : Reflect.get(this, e)); - E(this, Q, (e = (n) => n, t = !1) => (o(this, K).call(this), C(this, j, t), Promise.resolve(e == null ? void 0 : e(o(this, R).getPrototypeOf())))); - E(this, K, () => { - o(this, I) && (C(this, I, !1), Te.onMsg(this.code, this.message)); + E(this, Y, (e) => e === "$echoMsg" ? i(this, J) : e === "msg" ? i(this, Q) : e === "then" || e === "resp" ? (_(this, D, !0), _(this, B, e === "resp"), i(this, W)) : e === "catch" ? i(this, X) : e === "IS_ECHO_MSG" ? i(this, D) : Reflect.get(this, e)); + E(this, Q, (e = (n) => n, t = !1) => (i(this, J).call(this), _(this, B, t), Promise.resolve(e == null ? void 0 : e(i(this, U).getPrototypeOf())))); + E(this, J, () => { + i(this, D) && (_(this, D, !1), Te.onMsg(this.code, this.message)); }); - E(this, W, (e) => [0, 1].includes(this.code) ? Promise.resolve(e == null ? void 0 : e(o(this, R).getPrototypeOf())) : Promise.reject(o(this, D))); - E(this, X, (e) => Promise.resolve(e(o(this, D)))); - return this.code = e, this.message = t, this.data = n, this.url = s, this.res = f, C(this, D, new Proxy(this, o(this, R))); + E(this, W, (e) => [0, 1].includes(this.code) ? Promise.resolve(e == null ? void 0 : e(i(this, U).getPrototypeOf())) : Promise.reject(i(this, j))); + E(this, X, (e) => Promise.resolve(e(i(this, j)))); + return this.code = e, this.message = t, this.data = n, this.url = s, this.res = c, _(this, j, new Proxy(this, i(this, U))); } } -D = new WeakMap(), j = new WeakMap(), I = new WeakMap(), R = new WeakMap(), Y = new WeakMap(), Q = new WeakMap(), K = new WeakMap(), W = new WeakMap(), X = new WeakMap(); +j = new WeakMap(), B = new WeakMap(), D = new WeakMap(), U = new WeakMap(), Y = new WeakMap(), Q = new WeakMap(), J = new WeakMap(), W = new WeakMap(), X = new WeakMap(); const k = (r, e, t, n = "/", s = "") => new ee(r, e, t, n, s); var ie = [ "utf8", @@ -299,8 +299,8 @@ function ue(r) { throw new TypeError("passed argument must be of tye string"); var t = unescape(encodeURIComponent(e)), n = new Uint8Array(t.length); const s = t.split(""); - for (let f = 0; f < s.length; f++) - n[f] = s[f].charCodeAt(0); + for (let c = 0; c < s.length; c++) + n[c] = s[c].charCodeAt(0); return n; }; } @@ -314,10 +314,10 @@ function fe(r) { if (typeof n != "boolean") throw new TypeError("stream option must be boolean"); if (ArrayBuffer.isView(e)) { - var s = new Uint8Array(e.buffer, e.byteOffset, e.byteLength), f = new Array(s.length); - for (let h = 0; h < s.length; h++) - f[h] = String.fromCharCode(s[h]); - return decodeURIComponent(escape(f.join(""))); + var s = new Uint8Array(e.buffer, e.byteOffset, e.byteLength), c = new Array(s.length); + for (let l = 0; l < s.length; l++) + c[l] = String.fromCharCode(s[l]); + return decodeURIComponent(escape(c.join(""))); } else throw new TypeError("passed argument must be an array buffer view"); }; @@ -360,11 +360,11 @@ class be { return new TextDecoder().decode(t); } } -var G; +var K; class Ee { constructor(e) { - E(this, G, null); - C(this, G, e); + E(this, K, null); + _(this, K, e); } get6bits() { let e = this.pos & 7, t = this.pos >> 3; @@ -377,28 +377,28 @@ class Ee { const t = []; for (; this.pos > 0; ) { let n = 6, s = this.get6bits(); - (s & V) === V && ((this.pos > 6 || s > se) && (n = 5), s &= se), t.push(o(this, G).encodeTable[s].charCodeAt(0)), this.pos -= n; + (s & V) === V && ((this.pos > 6 || s > se) && (n = 5), s &= se), t.push(i(this, K).encodeTable[s].charCodeAt(0)), this.pos -= n; } return t; } } -G = new WeakMap(); +K = new WeakMap(); var H; class Oe { constructor(e) { E(this, H, null); - C(this, H, e); + _(this, H, e); } decode(e) { const t = new Uint8Array(Math.ceil(e.length * 6 / 8) + 1); - let n = t.length, s = 0, f = 0; - for (let h = 0; h < e.length; h++) { - const $ = e[h].charCodeAt(0), _ = o(this, H).decodeMap[$]; - if (_ === 255) - throw new Error(`CorruptInputError at index ${h}`); - h === e.length - 1 ? (f |= _ << s, s += Math.ceil(Math.log2(_ + 1))) : (_ & V) === V ? (f |= _ << s, s += 5) : (f |= _ << s, s += 6), s >= 8 && (n--, t[n] = f & 255, s %= 8, f >>= 8); + let n = t.length, s = 0, c = 0; + for (let l = 0; l < e.length; l++) { + const A = e[l].charCodeAt(0), M = i(this, H).decodeMap[A]; + if (M === 255) + throw new Error(`CorruptInputError at index ${l}`); + l === e.length - 1 ? (c |= M << s, s += Math.ceil(Math.log2(M + 1))) : (M & V) === V ? (c |= M << s, s += 5) : (c |= M << s, s += 6), s >= 8 && (n--, t[n] = c & 255, s %= 8, c >>= 8); } - return s > 0 && (n--, t[n] = f & 255), t.slice(n); + return s > 0 && (n--, t[n] = c & 255), t.slice(n); } } H = new WeakMap(); @@ -408,11 +408,11 @@ Promise.withResolvers || (Promise.withResolvers = function() { r = n, e = s; }), resolve: r, reject: e }; }); -var L, B, Z, m, N; +var L, q, Z, m, R; class te { constructor(e, t, n = ({}) => Promise.reject({ code: -1, msg: "请初始化HTTP请求方法主体" })) { E(this, L, void 0); - E(this, B, void 0); + E(this, q, void 0); E(this, Z, void 0); E(this, m, { "#": /* @__PURE__ */ new Map(), @@ -420,29 +420,31 @@ class te { $: /* @__PURE__ */ new Map() // 普通缓存 }); - E(this, N, /* @__PURE__ */ new Map()); + E(this, R, /* @__PURE__ */ new Map()); v(this, "request", ({ url: e = "/", method: t = "GET", ...n }, s = !1) => { - var U, J; - const f = t.toUpperCase(), h = pe(JSON.stringify([e, f, n])), $ = (U = e == null ? void 0 : e.includes) != null && U.call(e, "/_/") ? "#" : "$", { promise: _, resolve: q, reject: z } = Promise.withResolvers(); - return o(this, m)[$].has(h) ? (console.log("缓存命中", e), q(o(this, m)[$].get(h))) : (o(this, N).has(h) ? o(this, N).get(h).push([q, z]) : o(this, N).set(h, [[q, z]]), (J = o(this, N).get(h)) != null && J.some((u) => u) && o(this, L).call(this, { url: e, method: f, ...n }).then((u) => { + var F; + const c = t.toUpperCase(), l = pe(JSON.stringify([e, c, n])), A = (F = e == null ? void 0 : e.includes) != null && F.call(e, "/_/") ? "#" : "$", { promise: M, resolve: G, reject: z } = Promise.withResolvers(); + return i(this, m)[A].has(l) ? (console.log("cache", e), G(i(this, m)[A].get(l))) : i(this, R).has(l) ? i(this, R).get(l).push([G, z]) : (i(this, R).set(l, [[G, z]]), i(this, L).call(this, { url: e, method: c, ...n }).then((u) => { if (![0, 1].includes(u.code)) throw k(u.code, u.msg, u.data, e, u == null ? void 0 : u.res); return [u.code, u.msg, u.data, e, u == null ? void 0 : u.res]; - }).then((u) => (($ == "#" || s && f === "GET") && o(this, m)[$].set(h, u), u)).then((u) => { - var a; - return (a = o(this, N).get(h)) == null ? void 0 : a.forEach((c, l, d) => { - c && c[0](u), delete d[l]; + }).then((u) => ((c === "GET" || A == "#") && i(this, m)[A].set(l, u), c === "GET" && !s && setTimeout(() => { + i(this, m)[A].delete(l); + }, 300), u)).then((u) => { + var T; + return (T = i(this, R).get(l)) == null ? void 0 : T.forEach((h, o, d) => { + h && h[0](u), delete d[o]; }); }).catch((u) => { - var a; - o(this, m)[$].delete(h), (a = o(this, N).get(h)) == null || a.forEach((c, l, d) => { - c && c[1](u instanceof ee ? u : k(-1, u, null, e)), delete d[l]; + var T; + i(this, m)[A].delete(l), (T = i(this, R).get(l)) == null || T.forEach((h, o, d) => { + h && h[1](u instanceof ee ? u : k(-1, u, null, e)), delete d[o]; }); - }).finally(() => o(this, N).delete(h))), new Proxy(_, { - get: (u, a) => (...c) => u.then((l) => k(...l)[a](...c)).catch((l) => { - if (!l instanceof ee) - throw l; - return typeof l[a] == "function" ? l[a](...c) : l[a]; + }).finally(() => i(this, R).delete(l))), new Proxy(M, { + get: (u, T) => (...h) => u.then((o) => k(...o)[T](...h)).catch((o) => { + if (!o instanceof ee) + throw o; + return typeof o[T] == "function" ? o[T](...h) : o[T]; }) }); }); @@ -457,13 +459,13 @@ class te { v(this, "getAppInfo", () => { }); v(this, "refreshCache", (e = !1) => { - e && o(this, m)["#"].clear(), o(this, m).$.clear(); + e && i(this, m)["#"].clear(), i(this, m).$.clear(); }); v(this, "decode", (e = "", t = {}) => { if (e === void 0 || e === "" || e === null) return t; try { - const n = o(this, B).decode(e); + const n = i(this, q).decode(e); return ne.unpack(n); } catch { return console.warn("core.decode", e), t; @@ -471,16 +473,16 @@ class te { }); v(this, "encode", (e = {}) => { const t = JSON.stringify(e, (n, s) => s === void 0 ? null : s); - return o(this, B).encode(ne.pack(t)); + return i(this, q).encode(ne.pack(t)); }); - C(this, Z, e), C(this, L, n), C(this, B, new be(t)); + _(this, Z, e), _(this, L, n), _(this, q, new be(t)); } } -L = new WeakMap(), B = new WeakMap(), Z = new WeakMap(), m = new WeakMap(), N = new WeakMap(); +L = new WeakMap(), q = new WeakMap(), Z = new WeakMap(), m = new WeakMap(), R = new WeakMap(); const Te = te; te.onUnhandledRejection = (r) => { - var e, t, n, s, f, h; - r != null && r.IS_ECHO_MSG ? ((e = r == null ? void 0 : r.$echoMsg) == null || e.call(r), (t = r == null ? void 0 : r.preventDefault) == null || t.call(r)) : (n = r.reason) != null && n.IS_ECHO_MSG && ((f = (s = r.reason) == null ? void 0 : s.$echoMsg) == null || f.call(s), (h = r == null ? void 0 : r.preventDefault) == null || h.call(r)); + var e, t, n, s, c, l; + r != null && r.IS_ECHO_MSG ? ((e = r == null ? void 0 : r.$echoMsg) == null || e.call(r), (t = r == null ? void 0 : r.preventDefault) == null || t.call(r)) : (n = r.reason) != null && n.IS_ECHO_MSG && ((c = (s = r.reason) == null ? void 0 : s.$echoMsg) == null || c.call(s), (l = r == null ? void 0 : r.preventDefault) == null || l.call(r)); }; te.onMsg = (r, e) => [0, 1].includes(r) ? console.log(e) : console.warn(e); export { diff --git a/dist/ff-request.umd.cjs b/dist/ff-request.umd.cjs index e4cc74f..5943d8b 100644 --- a/dist/ff-request.umd.cjs +++ b/dist/ff-request.umd.cjs @@ -1,2 +1,2 @@ -(function(u,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(u=typeof globalThis<"u"?globalThis:u||self,p(u["ff-request"]={}))})(this,function(u){"use strict";var Se=Object.defineProperty;var xe=(u,p,b)=>p in u?Se(u,p,{enumerable:!0,configurable:!0,writable:!0,value:b}):u[p]=b;var w=(u,p,b)=>(xe(u,typeof p!="symbol"?p+"":p,b),b),he=(u,p,b)=>{if(!p.has(u))throw TypeError("Cannot "+b)};var i=(u,p,b)=>(he(u,p,"read from private field"),b?b.call(u):p.get(u)),P=(u,p,b)=>{if(p.has(u))throw TypeError("Cannot add the same private member more than once");p instanceof WeakSet?p.add(u):p.set(u,b)},M=(u,p,b,G)=>(he(u,p,"write to private field"),G?G.call(u,b):p.set(u,b),b);var q,J,j,I,X,Z,H,k,ee,L,z,V,K,te,U,m;function p(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var b={};(function(r){(function(e){e([],function(){var t=-1,n=-2,s=-3,d=-4,f=-5,F=function(a,c){c=c||{};var l=c.verbose||!1;l&&console.log("Normalize the JSON Object"),a=typeof a=="string"?this.JSON.parse(a):a,l&&console.log("Creating a empty dictionary");var g={strings:[],integers:[],floats:[]};l&&console.log("Creating the AST");var v=function x(o){l&&console.log("Calling recursiveAstBuilder with "+this.JSON.stringify(o));var E=typeof o;if(o===null)return{type:"null",index:s};if(typeof o>"u")return{type:"undefined",index:f};if(o instanceof Array){var _=["@"];for(var O in o)o.hasOwnProperty(O)&&_.push(x(o[O]));return _}if(E==="object"){var _=["$"];for(var R in o)o.hasOwnProperty(R)&&(_.push(x(R)),_.push(x(o[R])));return _}if(o==="")return{type:"empty",index:d};if(E==="string"){var S=h.call(g.strings,o);return S==-1&&(g.strings.push(Y(o)),S=g.strings.length-1),{type:"strings",index:S}}if(E==="number"&&o%1===0){var S=h.call(g.integers,o);return S==-1&&(g.integers.push(D(o)),S=g.integers.length-1),{type:"integers",index:S}}if(E==="number"){var S=h.call(g.floats,o);return S==-1&&(g.floats.push(o),S=g.floats.length-1),{type:"floats",index:S}}if(E==="boolean")return{type:"boolean",index:o?t:n};throw new Error("Unexpected argument of type "+typeof o)}(a),T=g.strings.length,B=g.integers.length;g.floats.length,l&&console.log("Parsing the dictionary");var $=g.strings.join("|");return $+="^"+g.integers.join("|"),$+="^"+g.floats.join("|"),l&&console.log("Parsing the structure"),$+="^"+function x(o){if(l&&console.log("Calling a recursiveParser with "+this.JSON.stringify(o)),o instanceof Array){var E=o.shift();for(var _ in o)o.hasOwnProperty(_)&&(E+=x(o[_])+"|");return(E[E.length-1]==="|"?E.slice(0,-1):E)+"]"}var O=o.type,R=o.index;if(O==="strings")return D(R);if(O==="integers")return D(T+R);if(O==="floats")return D(T+B+R);if(O==="boolean")return o.index;if(O==="null")return s;if(O==="undefined")return f;if(O==="empty")return d;throw new TypeError("The item is alien!")}(v),l&&console.log("Ending parser"),c.debug?{dictionary:g,ast:v,packed:$}:$},N=function(a,c){c=c||{};var l=a.split("^");c.verbose&&console.log("Building dictionary");var g=[],v=l[0];if(v!==""){v=v.split("|"),c.verbose&&console.log("Parse the strings dictionary");for(var T=0,B=v.length;Ti(this,X).call(this,t),ownKeys:()=>Object.keys(i(this,I).getPrototypeOf()||{}),getPrototypeOf:()=>i(this,J)?this:this.data,getOwnPropertyDescriptor:()=>({configurable:!0,enumerable:!0,writable:!0,value:i(this,I).getPrototypeOf()})});P(this,X,e=>e==="$echoMsg"?i(this,H):e==="msg"?i(this,Z):e==="then"||e==="resp"?(M(this,j,!0),M(this,J,e==="resp"),i(this,k)):e==="catch"?i(this,ee):e==="IS_ECHO_MSG"?i(this,j):Reflect.get(this,e));P(this,Z,(e=n=>n,t=!1)=>(i(this,H).call(this),M(this,J,t),Promise.resolve(e==null?void 0:e(i(this,I).getPrototypeOf()))));P(this,H,()=>{i(this,j)&&(M(this,j,!1),fe.onMsg(this.code,this.message))});P(this,k,e=>[0,1].includes(this.code)?Promise.resolve(e==null?void 0:e(i(this,I).getPrototypeOf())):Promise.reject(i(this,q)));P(this,ee,e=>Promise.resolve(e(i(this,q))));return this.code=e,this.message=t,this.data=n,this.url=s,this.res=d,M(this,q,new Proxy(this,i(this,I)))}}q=new WeakMap,J=new WeakMap,j=new WeakMap,I=new WeakMap,X=new WeakMap,Z=new WeakMap,H=new WeakMap,k=new WeakMap,ee=new WeakMap;const se=(r,e,t,n="/",s="")=>new ne(r,e,t,n,s);var oe=["utf8","utf-8","unicode-1-1-utf-8"];function de(r){if(oe.indexOf(r)<0&&typeof r<"u"&&r!=null)throw new RangeError("Invalid encoding type. Only utf-8 is supported");this.encoding="utf-8",this.encode=function(e){if(typeof e!="string")throw new TypeError("passed argument must be of tye string");var t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);const s=t.split("");for(let d=0;d"u")return"";var n=typeof t<"u"&&n in t?t.stream:!1;if(typeof n!="boolean")throw new TypeError("stream option must be boolean");if(ArrayBuffer.isView(e)){var s=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),d=new Array(s.length);for(let f=0;f{let e=5381;for(let t=0;t>>0).toString(16)},ye=(r,e)=>r.replace(new RegExp(`^${e}+|${e}+$`,"g"),""),le=r=>pe.encode(r||""),we=r=>ve.decode(new DataView(r),{}),be=62,W=30,ue=31,Ee=63;class Oe{constructor(e){w(this,"encodeTable",[]);w(this,"decodeMap",new Uint8Array(256).fill(255));if(e.length!==be)throw new Error("Encoding alphabet must be 62 characters long");if(e.includes(` -`)||e.includes("\r"))throw new Error("Encoding alphabet contains newline character");this.encodeTable=e.split(""),this.decodeMap=new Uint8Array(256).fill(255);for(let t=0;t>3;e===0&&(t-=1,e=8);let n=this.src[t]>>8-e;return e<6&&t>0&&(n|=this.src[t-1]<0;){let n=6,s=this.get6bits();(s&W)===W&&((this.pos>6||s>ue)&&(n=5),s&=ue),t.push(i(this,L).encodeTable[s].charCodeAt(0)),this.pos-=n}return t}}L=new WeakMap;class Pe{constructor(e){P(this,z,null);M(this,z,e)}decode(e){const t=new Uint8Array(Math.ceil(e.length*6/8)+1);let n=t.length,s=0,d=0;for(let f=0;f=8&&(n--,t[n]=d&255,s%=8,d>>=8)}return s>0&&(n--,t[n]=d&255),t.slice(n)}}z=new WeakMap,Promise.withResolvers||(Promise.withResolvers=function(){let r,e;return{promise:new Promise((n,s)=>{r=n,e=s}),resolve:r,reject:e}});class ie{constructor(e,t,n=({})=>Promise.reject({code:-1,msg:"请初始化HTTP请求方法主体"})){P(this,V,void 0);P(this,K,void 0);P(this,te,void 0);P(this,U,{"#":new Map,$:new Map});P(this,m,new Map);w(this,"request",({url:e="/",method:t="GET",...n},s=!1)=>{var D,Q;const d=t.toUpperCase(),f=ce(JSON.stringify([e,d,n])),F=(D=e==null?void 0:e.includes)!=null&&D.call(e,"/_/")?"#":"$",{promise:N,resolve:Y,reject:re}=Promise.withResolvers();return i(this,U)[F].has(f)?(console.log("缓存命中",e),Y(i(this,U)[F].get(f))):(i(this,m).has(f)?i(this,m).get(f).push([Y,re]):i(this,m).set(f,[[Y,re]]),(Q=i(this,m).get(f))!=null&&Q.some(h=>h)&&i(this,V).call(this,{url:e,method:d,...n}).then(h=>{if(![0,1].includes(h.code))throw se(h.code,h.msg,h.data,e,h==null?void 0:h.res);return[h.code,h.msg,h.data,e,h==null?void 0:h.res]}).then(h=>((F=="#"||s&&d==="GET")&&i(this,U)[F].set(f,h),h)).then(h=>{var a;return(a=i(this,m).get(f))==null?void 0:a.forEach((c,l,g)=>{c&&c[0](h),delete g[l]})}).catch(h=>{var a;i(this,U)[F].delete(f),(a=i(this,m).get(f))==null||a.forEach((c,l,g)=>{c&&c[1](h instanceof ne?h:se(-1,h,null,e)),delete g[l]})}).finally(()=>i(this,m).delete(f))),new Proxy(N,{get:(h,a)=>(...c)=>h.then(l=>se(...l)[a](...c)).catch(l=>{if(!l instanceof ne)throw l;return typeof l[a]=="function"?l[a](...c):l[a]})})});w(this,"get",(e,t={})=>this.request({url:e,method:"GET",params:t}));w(this,"post",(e,t={},n={})=>this.request({url:e,method:"POST",data:t,params:n}));w(this,"put",(e,t={},n={})=>this.request({url:e,method:"PUT",data:t,params:n}));w(this,"del",(e,t={},n={})=>this.request({url:e,method:"DELETE",data:t,params:n}));w(this,"download",(e,t)=>{});w(this,"cache",(e,t={})=>this.request({url:e,method:"GET",params:t},!0));w(this,"list",(e,t={})=>this.get(`/api/${e}/${this.encode(t)}`));w(this,"getAppInfo",()=>{});w(this,"refreshCache",(e=!1)=>{e&&i(this,U)["#"].clear(),i(this,U).$.clear()});w(this,"decode",(e="",t={})=>{if(e===void 0||e===""||e===null)return t;try{const n=i(this,K).decode(e);return G.unpack(n)}catch{return console.warn("core.decode",e),t}});w(this,"encode",(e={})=>{const t=JSON.stringify(e,(n,s)=>s===void 0?null:s);return i(this,K).encode(G.pack(t))});M(this,te,e),M(this,V,n),M(this,K,new Oe(t))}}V=new WeakMap,K=new WeakMap,te=new WeakMap,U=new WeakMap,m=new WeakMap;const fe=ie;ie.onUnhandledRejection=r=>{var e,t,n,s,d,f;r!=null&&r.IS_ECHO_MSG?((e=r==null?void 0:r.$echoMsg)==null||e.call(r),(t=r==null?void 0:r.preventDefault)==null||t.call(r)):(n=r.reason)!=null&&n.IS_ECHO_MSG&&((d=(s=r.reason)==null?void 0:s.$echoMsg)==null||d.call(s),(f=r==null?void 0:r.preventDefault)==null||f.call(r))},ie.onMsg=(r,e)=>[0,1].includes(r)?console.log(e):console.warn(e),u.default=fe,u.signature=ce,u.str2uint8array=le,u.trim=ye,u.uint8array2str=we,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); +(function(c,d){typeof exports=="object"&&typeof module<"u"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(c=typeof globalThis<"u"?globalThis:c||self,d(c["ff-request"]={}))})(this,function(c){"use strict";var Se=Object.defineProperty;var xe=(c,d,b)=>d in c?Se(c,d,{enumerable:!0,configurable:!0,writable:!0,value:b}):c[d]=b;var w=(c,d,b)=>(xe(c,typeof d!="symbol"?d+"":d,b),b),he=(c,d,b)=>{if(!d.has(c))throw TypeError("Cannot "+b)};var o=(c,d,b)=>(he(c,d,"read from private field"),b?b.call(c):d.get(c)),P=(c,d,b)=>{if(d.has(c))throw TypeError("Cannot add the same private member more than once");d instanceof WeakSet?d.add(c):d.set(c,b)},m=(c,d,b,H)=>(he(c,d,"write to private field"),H?H.call(c,b):d.set(c,b),b);var G,J,D,j,X,Z,L,k,ee,z,V,Y,K,te,N,I;function d(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var b={};(function(r){(function(e){e([],function(){var t=-1,n=-2,s=-3,l=-4,u=-5,$=function(f,i){i=i||{};var p=i.verbose||!1;p&&console.log("Normalize the JSON Object"),f=typeof f=="string"?this.JSON.parse(f):f,p&&console.log("Creating a empty dictionary");var g={strings:[],integers:[],floats:[]};p&&console.log("Creating the AST");var v=function _(a){p&&console.log("Calling recursiveAstBuilder with "+this.JSON.stringify(a));var E=typeof a;if(a===null)return{type:"null",index:s};if(typeof a>"u")return{type:"undefined",index:u};if(a instanceof Array){var C=["@"];for(var T in a)a.hasOwnProperty(T)&&C.push(_(a[T]));return C}if(E==="object"){var C=["$"];for(var F in a)a.hasOwnProperty(F)&&(C.push(_(F)),C.push(_(a[F])));return C}if(a==="")return{type:"empty",index:l};if(E==="string"){var S=x.call(g.strings,a);return S==-1&&(g.strings.push(Q(a)),S=g.strings.length-1),{type:"strings",index:S}}if(E==="number"&&a%1===0){var S=x.call(g.integers,a);return S==-1&&(g.integers.push(B(a)),S=g.integers.length-1),{type:"integers",index:S}}if(E==="number"){var S=x.call(g.floats,a);return S==-1&&(g.floats.push(a),S=g.floats.length-1),{type:"floats",index:S}}if(E==="boolean")return{type:"boolean",index:a?t:n};throw new Error("Unexpected argument of type "+typeof a)}(f),O=g.strings.length,q=g.integers.length;g.floats.length,p&&console.log("Parsing the dictionary");var U=g.strings.join("|");return U+="^"+g.integers.join("|"),U+="^"+g.floats.join("|"),p&&console.log("Parsing the structure"),U+="^"+function _(a){if(p&&console.log("Calling a recursiveParser with "+this.JSON.stringify(a)),a instanceof Array){var E=a.shift();for(var C in a)a.hasOwnProperty(C)&&(E+=_(a[C])+"|");return(E[E.length-1]==="|"?E.slice(0,-1):E)+"]"}var T=a.type,F=a.index;if(T==="strings")return B(F);if(T==="integers")return B(O+F);if(T==="floats")return B(O+q+F);if(T==="boolean")return a.index;if(T==="null")return s;if(T==="undefined")return u;if(T==="empty")return l;throw new TypeError("The item is alien!")}(v),p&&console.log("Ending parser"),i.debug?{dictionary:g,ast:v,packed:U}:U},R=function(f,i){i=i||{};var p=f.split("^");i.verbose&&console.log("Building dictionary");var g=[],v=p[0];if(v!==""){v=v.split("|"),i.verbose&&console.log("Parse the strings dictionary");for(var O=0,q=v.length;Oo(this,X).call(this,t),ownKeys:()=>Object.keys(o(this,j).getPrototypeOf()||{}),getPrototypeOf:()=>o(this,J)?this:this.data,getOwnPropertyDescriptor:()=>({configurable:!0,enumerable:!0,writable:!0,value:o(this,j).getPrototypeOf()})});P(this,X,e=>e==="$echoMsg"?o(this,L):e==="msg"?o(this,Z):e==="then"||e==="resp"?(m(this,D,!0),m(this,J,e==="resp"),o(this,k)):e==="catch"?o(this,ee):e==="IS_ECHO_MSG"?o(this,D):Reflect.get(this,e));P(this,Z,(e=n=>n,t=!1)=>(o(this,L).call(this),m(this,J,t),Promise.resolve(e==null?void 0:e(o(this,j).getPrototypeOf()))));P(this,L,()=>{o(this,D)&&(m(this,D,!1),fe.onMsg(this.code,this.message))});P(this,k,e=>[0,1].includes(this.code)?Promise.resolve(e==null?void 0:e(o(this,j).getPrototypeOf())):Promise.reject(o(this,G)));P(this,ee,e=>Promise.resolve(e(o(this,G))));return this.code=e,this.message=t,this.data=n,this.url=s,this.res=l,m(this,G,new Proxy(this,o(this,j)))}}G=new WeakMap,J=new WeakMap,D=new WeakMap,j=new WeakMap,X=new WeakMap,Z=new WeakMap,L=new WeakMap,k=new WeakMap,ee=new WeakMap;const se=(r,e,t,n="/",s="")=>new ne(r,e,t,n,s);var oe=["utf8","utf-8","unicode-1-1-utf-8"];function de(r){if(oe.indexOf(r)<0&&typeof r<"u"&&r!=null)throw new RangeError("Invalid encoding type. Only utf-8 is supported");this.encoding="utf-8",this.encode=function(e){if(typeof e!="string")throw new TypeError("passed argument must be of tye string");var t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);const s=t.split("");for(let l=0;l"u")return"";var n=typeof t<"u"&&n in t?t.stream:!1;if(typeof n!="boolean")throw new TypeError("stream option must be boolean");if(ArrayBuffer.isView(e)){var s=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),l=new Array(s.length);for(let u=0;u{let e=5381;for(let t=0;t>>0).toString(16)},ye=(r,e)=>r.replace(new RegExp(`^${e}+|${e}+$`,"g"),""),le=r=>pe.encode(r||""),we=r=>ve.decode(new DataView(r),{}),be=62,W=30,ue=31,Ee=63;class Te{constructor(e){w(this,"encodeTable",[]);w(this,"decodeMap",new Uint8Array(256).fill(255));if(e.length!==be)throw new Error("Encoding alphabet must be 62 characters long");if(e.includes(` +`)||e.includes("\r"))throw new Error("Encoding alphabet contains newline character");this.encodeTable=e.split(""),this.decodeMap=new Uint8Array(256).fill(255);for(let t=0;t>3;e===0&&(t-=1,e=8);let n=this.src[t]>>8-e;return e<6&&t>0&&(n|=this.src[t-1]<0;){let n=6,s=this.get6bits();(s&W)===W&&((this.pos>6||s>ue)&&(n=5),s&=ue),t.push(o(this,z).encodeTable[s].charCodeAt(0)),this.pos-=n}return t}}z=new WeakMap;class Pe{constructor(e){P(this,V,null);m(this,V,e)}decode(e){const t=new Uint8Array(Math.ceil(e.length*6/8)+1);let n=t.length,s=0,l=0;for(let u=0;u=8&&(n--,t[n]=l&255,s%=8,l>>=8)}return s>0&&(n--,t[n]=l&255),t.slice(n)}}V=new WeakMap,Promise.withResolvers||(Promise.withResolvers=function(){let r,e;return{promise:new Promise((n,s)=>{r=n,e=s}),resolve:r,reject:e}});class ie{constructor(e,t,n=({})=>Promise.reject({code:-1,msg:"请初始化HTTP请求方法主体"})){P(this,Y,void 0);P(this,K,void 0);P(this,te,void 0);P(this,N,{"#":new Map,$:new Map});P(this,I,new Map);w(this,"request",({url:e="/",method:t="GET",...n},s=!1)=>{var B;const l=t.toUpperCase(),u=ce(JSON.stringify([e,l,n])),$=(B=e==null?void 0:e.includes)!=null&&B.call(e,"/_/")?"#":"$",{promise:R,resolve:Q,reject:re}=Promise.withResolvers();return o(this,N)[$].has(u)?(console.log("cache",e),Q(o(this,N)[$].get(u))):o(this,I).has(u)?o(this,I).get(u).push([Q,re]):(o(this,I).set(u,[[Q,re]]),o(this,Y).call(this,{url:e,method:l,...n}).then(h=>{if(![0,1].includes(h.code))throw se(h.code,h.msg,h.data,e,h==null?void 0:h.res);return[h.code,h.msg,h.data,e,h==null?void 0:h.res]}).then(h=>((l==="GET"||$=="#")&&o(this,N)[$].set(u,h),l==="GET"&&!s&&setTimeout(()=>{o(this,N)[$].delete(u)},300),h)).then(h=>{var x;return(x=o(this,I).get(u))==null?void 0:x.forEach((f,i,p)=>{f&&f[0](h),delete p[i]})}).catch(h=>{var x;o(this,N)[$].delete(u),(x=o(this,I).get(u))==null||x.forEach((f,i,p)=>{f&&f[1](h instanceof ne?h:se(-1,h,null,e)),delete p[i]})}).finally(()=>o(this,I).delete(u))),new Proxy(R,{get:(h,x)=>(...f)=>h.then(i=>se(...i)[x](...f)).catch(i=>{if(!i instanceof ne)throw i;return typeof i[x]=="function"?i[x](...f):i[x]})})});w(this,"get",(e,t={})=>this.request({url:e,method:"GET",params:t}));w(this,"post",(e,t={},n={})=>this.request({url:e,method:"POST",data:t,params:n}));w(this,"put",(e,t={},n={})=>this.request({url:e,method:"PUT",data:t,params:n}));w(this,"del",(e,t={},n={})=>this.request({url:e,method:"DELETE",data:t,params:n}));w(this,"download",(e,t)=>{});w(this,"cache",(e,t={})=>this.request({url:e,method:"GET",params:t},!0));w(this,"list",(e,t={})=>this.get(`/api/${e}/${this.encode(t)}`));w(this,"getAppInfo",()=>{});w(this,"refreshCache",(e=!1)=>{e&&o(this,N)["#"].clear(),o(this,N).$.clear()});w(this,"decode",(e="",t={})=>{if(e===void 0||e===""||e===null)return t;try{const n=o(this,K).decode(e);return H.unpack(n)}catch{return console.warn("core.decode",e),t}});w(this,"encode",(e={})=>{const t=JSON.stringify(e,(n,s)=>s===void 0?null:s);return o(this,K).encode(H.pack(t))});m(this,te,e),m(this,Y,n),m(this,K,new Te(t))}}Y=new WeakMap,K=new WeakMap,te=new WeakMap,N=new WeakMap,I=new WeakMap;const fe=ie;ie.onUnhandledRejection=r=>{var e,t,n,s,l,u;r!=null&&r.IS_ECHO_MSG?((e=r==null?void 0:r.$echoMsg)==null||e.call(r),(t=r==null?void 0:r.preventDefault)==null||t.call(r)):(n=r.reason)!=null&&n.IS_ECHO_MSG&&((l=(s=r.reason)==null?void 0:s.$echoMsg)==null||l.call(s),(u=r==null?void 0:r.preventDefault)==null||u.call(r))},ie.onMsg=(r,e)=>[0,1].includes(r)?console.log(e):console.warn(e),c.default=fe,c.signature=ce,c.str2uint8array=le,c.trim=ye,c.uint8array2str=we,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); diff --git a/package.json b/package.json index 8ae580a..b984784 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ff-request", "private": true, - "version": "0.9.14", + "version": "0.9.15", "type": "module", "files": [ "dist" @@ -13,7 +13,7 @@ "require": "./dist/ff-request.umd.cjs" }, "scripts": { - "dev": "vite", + "test": "vitest", "build": "vite build" }, "dependencies": { @@ -21,7 +21,10 @@ "text-encoder": "^0.0.4" }, "devDependencies": { + "axios": "1.7.2", + "jsdom": "^25.0.1", "rollup-plugin-copy": "^3.5.0", - "vite": "^5.0.10" + "vite": "^5.0.10", + "vitest": "^2.1.8" } }