zeed 0.7.156 → 0.7.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-HTHM6PD3.js → chunk-3GWNE4EN.js} +97 -26
- package/dist/chunk-3GWNE4EN.js.map +1 -0
- package/dist/{chunk-KSVSOYIL.js → chunk-7KQAI5PZ.js} +3 -3
- package/dist/{chunk-KSVSOYIL.js.map → chunk-7KQAI5PZ.js.map} +0 -0
- package/dist/{chunk-T5YP6WMZ.js → chunk-AXXRNBMM.js} +2 -2
- package/dist/{chunk-T5YP6WMZ.js.map → chunk-AXXRNBMM.js.map} +0 -0
- package/dist/{chunk-ADHTQ42A.js → chunk-COVHX4K4.js} +4 -4
- package/dist/chunk-COVHX4K4.js.map +1 -0
- package/dist/{chunk-LMZGFDSJ.js → chunk-XIYO6O3U.js} +6 -1
- package/dist/chunk-XIYO6O3U.js.map +1 -0
- package/dist/index.all.cjs +101 -23
- package/dist/index.all.cjs.map +1 -1
- package/dist/index.all.d.ts +3 -3
- package/dist/index.all.js +13 -5
- package/dist/index.browser.cjs +101 -23
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.ts +2 -2
- package/dist/index.browser.js +12 -4
- package/dist/index.log.cjs.map +1 -1
- package/dist/index.log.js +2 -2
- package/dist/index.node.cjs +101 -23
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.ts +2 -2
- package/dist/index.node.js +11 -3
- package/dist/{log-colors-63883365.d.ts → log-colors-012ca8de.d.ts} +1 -1
- package/dist/{log-util-b6f3f361.d.ts → log-util-85c1bb7f.d.ts} +1 -1
- package/dist/{uuid-a095d779.d.ts → uuid-d7043fce.d.ts} +58 -23
- package/package.json +1 -1
- package/dist/chunk-ADHTQ42A.js.map +0 -1
- package/dist/chunk-HTHM6PD3.js.map +0 -1
- package/dist/chunk-LMZGFDSJ.js.map +0 -1
|
@@ -3,11 +3,13 @@ import {
|
|
|
3
3
|
__name,
|
|
4
4
|
__spreadProps,
|
|
5
5
|
__spreadValues,
|
|
6
|
+
deepMerge,
|
|
6
7
|
getGlobalContext,
|
|
7
8
|
getTimestamp,
|
|
9
|
+
isArray,
|
|
8
10
|
useLevelFilter,
|
|
9
11
|
useNamespaceFilter
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XIYO6O3U.js";
|
|
11
13
|
|
|
12
14
|
// src/common/data/bin.ts
|
|
13
15
|
var log = Logger("bin");
|
|
@@ -165,6 +167,40 @@ function Uint8ArrayToJson(data) {
|
|
|
165
167
|
}
|
|
166
168
|
}
|
|
167
169
|
__name(Uint8ArrayToJson, "Uint8ArrayToJson");
|
|
170
|
+
function Uint8ArrayToHexDump(buffer, blockSize) {
|
|
171
|
+
if (typeof buffer === "string") {
|
|
172
|
+
console.log("buffer is string");
|
|
173
|
+
} else if (buffer instanceof ArrayBuffer && buffer.byteLength !== void 0) {
|
|
174
|
+
console.log("buffer is ArrayBuffer");
|
|
175
|
+
buffer = String.fromCharCode.apply(String, [].slice.call(new Uint8Array(buffer)));
|
|
176
|
+
} else if (Array.isArray(buffer)) {
|
|
177
|
+
console.log("buffer is Array");
|
|
178
|
+
buffer = String.fromCharCode.apply(String, buffer);
|
|
179
|
+
} else if (buffer.constructor === Uint8Array) {
|
|
180
|
+
console.log("buffer is Uint8Array");
|
|
181
|
+
buffer = String.fromCharCode.apply(String, [].slice.call(buffer));
|
|
182
|
+
} else {
|
|
183
|
+
console.log("Error: buffer is unknown...");
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
blockSize = blockSize || 16;
|
|
187
|
+
var lines = [];
|
|
188
|
+
var hex = "0123456789ABCDEF";
|
|
189
|
+
for (var b = 0; b < buffer.length; b += blockSize) {
|
|
190
|
+
var block = buffer.slice(b, Math.min(b + blockSize, buffer.length));
|
|
191
|
+
var addr = ("0000" + b.toString(16)).slice(-4);
|
|
192
|
+
var codes = block.split("").map((ch) => {
|
|
193
|
+
var code = ch.charCodeAt(0);
|
|
194
|
+
return " " + hex[(240 & code) >> 4] + hex[15 & code];
|
|
195
|
+
}).join("");
|
|
196
|
+
codes += " ".repeat(blockSize - block.length);
|
|
197
|
+
var chars = block.replace(/[\x00-\x1F\x20]/g, ".");
|
|
198
|
+
chars += " ".repeat(blockSize - block.length);
|
|
199
|
+
lines.push(addr + " " + codes + " " + chars);
|
|
200
|
+
}
|
|
201
|
+
return lines.join("\n");
|
|
202
|
+
}
|
|
203
|
+
__name(Uint8ArrayToHexDump, "Uint8ArrayToHexDump");
|
|
168
204
|
|
|
169
205
|
// src/common/crypto.ts
|
|
170
206
|
function randomUint8Array(length = 16) {
|
|
@@ -2390,7 +2426,7 @@ __name(debounce, "debounce");
|
|
|
2390
2426
|
|
|
2391
2427
|
// src/common/localhost.ts
|
|
2392
2428
|
function isLocalHost(hostname = ((_a) => (_a = globalThis == null ? void 0 : globalThis.location) == null ? void 0 : _a.hostname)() ?? "") {
|
|
2393
|
-
return ["localhost", "127.0.0.1", "", "::1", "::"].includes(hostname) || hostname.startsWith("192.168.") || hostname.startsWith("10.0.") || hostname.endsWith(".local");
|
|
2429
|
+
return ["::ffff:127.0.0.1", "localhost", "127.0.0.1", "", "::1", "::"].includes(hostname) || hostname.startsWith("192.168.") || hostname.startsWith("10.0.") || hostname.endsWith(".local");
|
|
2394
2430
|
}
|
|
2395
2431
|
__name(isLocalHost, "isLocalHost");
|
|
2396
2432
|
|
|
@@ -2753,10 +2789,35 @@ __name(useRPC, "useRPC");
|
|
|
2753
2789
|
var log8 = Logger("network");
|
|
2754
2790
|
var defaultOptions = {
|
|
2755
2791
|
cache: "no-cache",
|
|
2756
|
-
redirect: "follow"
|
|
2792
|
+
redirect: "follow",
|
|
2793
|
+
headers: {}
|
|
2757
2794
|
};
|
|
2795
|
+
function parseBasicAuth(url) {
|
|
2796
|
+
let m = /:\/\/([^@]*)@/gi.exec(url);
|
|
2797
|
+
if (m && m[1]) {
|
|
2798
|
+
let [username, password] = m[1].split(":", 2);
|
|
2799
|
+
return {
|
|
2800
|
+
url: url.replace(m[1] + "@", ""),
|
|
2801
|
+
username,
|
|
2802
|
+
password
|
|
2803
|
+
};
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
__name(parseBasicAuth, "parseBasicAuth");
|
|
2758
2807
|
async function fetchBasic(url, fetchOptions = {}, fetchFn = fetch) {
|
|
2759
2808
|
try {
|
|
2809
|
+
if (isArray(fetchOptions)) {
|
|
2810
|
+
fetchOptions = deepMerge({}, ...arrayFlatten(fetchOptions));
|
|
2811
|
+
}
|
|
2812
|
+
let auth = parseBasicAuth(String(url));
|
|
2813
|
+
if (auth) {
|
|
2814
|
+
url = auth.url;
|
|
2815
|
+
fetchOptions = deepMerge({}, fetchOptions, fetchOptionsBasicAuth(auth.username, auth.password));
|
|
2816
|
+
}
|
|
2817
|
+
if (fetchOptions.headers != null && !(fetchOptions.headers instanceof Headers)) {
|
|
2818
|
+
fetchOptions.headers = new Headers(fetchOptions.headers);
|
|
2819
|
+
}
|
|
2820
|
+
log8("fetch", url, fetchOptions);
|
|
2760
2821
|
const response = await fetchFn(String(url), fetchOptions);
|
|
2761
2822
|
if (response.status < 400) {
|
|
2762
2823
|
return response;
|
|
@@ -2772,13 +2833,17 @@ async function fetchBasic(url, fetchOptions = {}, fetchFn = fetch) {
|
|
|
2772
2833
|
}
|
|
2773
2834
|
}
|
|
2774
2835
|
__name(fetchBasic, "fetchBasic");
|
|
2775
|
-
async function fetchJson(url,
|
|
2836
|
+
async function fetchJson(url, fetchOptions = {}, fetchFn = fetch) {
|
|
2776
2837
|
try {
|
|
2777
|
-
let res = await fetchBasic(url,
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2838
|
+
let res = await fetchBasic(url, [
|
|
2839
|
+
{
|
|
2840
|
+
method: "GET",
|
|
2841
|
+
headers: {
|
|
2842
|
+
Accept: "application/json"
|
|
2843
|
+
}
|
|
2844
|
+
},
|
|
2845
|
+
fetchOptions
|
|
2846
|
+
], fetchFn);
|
|
2782
2847
|
if (res) {
|
|
2783
2848
|
return await res.json();
|
|
2784
2849
|
}
|
|
@@ -2787,6 +2852,17 @@ async function fetchJson(url, opts = {}, fetchFn = fetch) {
|
|
|
2787
2852
|
}
|
|
2788
2853
|
}
|
|
2789
2854
|
__name(fetchJson, "fetchJson");
|
|
2855
|
+
async function fetchText(url, fetchOptions = {}, fetchFn = fetch) {
|
|
2856
|
+
try {
|
|
2857
|
+
let res = await fetchBasic(url, [defaultOptions, { method: "GET" }, fetchOptions], fetchFn);
|
|
2858
|
+
if (res) {
|
|
2859
|
+
return await res.text();
|
|
2860
|
+
}
|
|
2861
|
+
} catch (err) {
|
|
2862
|
+
log8.error("fetchHTML error:", err);
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
__name(fetchText, "fetchText");
|
|
2790
2866
|
function fetchOptionsFormURLEncoded(data, method = "POST") {
|
|
2791
2867
|
return __spreadProps(__spreadValues({
|
|
2792
2868
|
method
|
|
@@ -2803,28 +2879,20 @@ function fetchOptionsJson(data, method = "POST") {
|
|
|
2803
2879
|
method
|
|
2804
2880
|
}, defaultOptions), {
|
|
2805
2881
|
headers: {
|
|
2806
|
-
"Content-Type": "application/json; charset=utf-8"
|
|
2807
|
-
Accept: "application/json"
|
|
2882
|
+
"Content-Type": "application/json; charset=utf-8"
|
|
2808
2883
|
},
|
|
2809
2884
|
body: JSON.stringify(data)
|
|
2810
2885
|
});
|
|
2811
2886
|
}
|
|
2812
2887
|
__name(fetchOptionsJson, "fetchOptionsJson");
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
}, defaultOptions), {
|
|
2818
|
-
headers: {}
|
|
2819
|
-
}), opts), fetchFn);
|
|
2820
|
-
if (res) {
|
|
2821
|
-
return await res.text();
|
|
2888
|
+
function fetchOptionsBasicAuth(username, password) {
|
|
2889
|
+
return {
|
|
2890
|
+
headers: {
|
|
2891
|
+
Authorization: "Basic " + toBase64(username + ":" + password)
|
|
2822
2892
|
}
|
|
2823
|
-
}
|
|
2824
|
-
log8.error("fetchHTML error:", err);
|
|
2825
|
-
}
|
|
2893
|
+
};
|
|
2826
2894
|
}
|
|
2827
|
-
__name(
|
|
2895
|
+
__name(fetchOptionsBasicAuth, "fetchOptionsBasicAuth");
|
|
2828
2896
|
|
|
2829
2897
|
// src/common/platform.ts
|
|
2830
2898
|
function getWindow() {
|
|
@@ -2934,6 +3002,7 @@ export {
|
|
|
2934
3002
|
equalBinary,
|
|
2935
3003
|
jsonToUint8Array,
|
|
2936
3004
|
Uint8ArrayToJson,
|
|
3005
|
+
Uint8ArrayToHexDump,
|
|
2937
3006
|
randomUint8Array,
|
|
2938
3007
|
digest,
|
|
2939
3008
|
deriveKeyPbkdf2,
|
|
@@ -3130,11 +3199,13 @@ export {
|
|
|
3130
3199
|
PubSub,
|
|
3131
3200
|
usePubSub,
|
|
3132
3201
|
useRPC,
|
|
3202
|
+
parseBasicAuth,
|
|
3133
3203
|
fetchBasic,
|
|
3134
3204
|
fetchJson,
|
|
3205
|
+
fetchText,
|
|
3135
3206
|
fetchOptionsFormURLEncoded,
|
|
3136
3207
|
fetchOptionsJson,
|
|
3137
|
-
|
|
3208
|
+
fetchOptionsBasicAuth,
|
|
3138
3209
|
getWindow,
|
|
3139
3210
|
getNavigator,
|
|
3140
3211
|
getGlobal,
|
|
@@ -3144,4 +3215,4 @@ export {
|
|
|
3144
3215
|
useExitHandler,
|
|
3145
3216
|
MemStorage
|
|
3146
3217
|
};
|
|
3147
|
-
//# sourceMappingURL=chunk-
|
|
3218
|
+
//# sourceMappingURL=chunk-3GWNE4EN.js.map
|