zeed 0.7.157 → 0.7.158

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.
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-T5YP6WMZ.js";
7
7
  import {
8
8
  isBrowser
9
- } from "./chunk-DPI2LOOM.js";
9
+ } from "./chunk-TIMYBUQO.js";
10
10
  import {
11
11
  Logger,
12
12
  __name,
@@ -329,4 +329,4 @@ export {
329
329
  LocalStorage,
330
330
  LoggerBrowserClassicHandler
331
331
  };
332
- //# sourceMappingURL=chunk-L5EPYO3L.js.map
332
+ //# sourceMappingURL=chunk-DYIBY42G.js.map
@@ -2,7 +2,7 @@ import {
2
2
  cloneObject,
3
3
  renderMessages,
4
4
  toValidFilename
5
- } from "./chunk-DPI2LOOM.js";
5
+ } from "./chunk-TIMYBUQO.js";
6
6
  import {
7
7
  Logger,
8
8
  __name,
@@ -586,4 +586,4 @@ export {
586
586
  loggerStackTraceDebug,
587
587
  LoggerNodeHandler
588
588
  };
589
- //# sourceMappingURL=chunk-V3MEV7XK.js.map
589
+ //# sourceMappingURL=chunk-FGL56JF2.js.map
@@ -2758,11 +2758,28 @@ var defaultOptions = {
2758
2758
  redirect: "follow",
2759
2759
  headers: {}
2760
2760
  };
2761
+ function parseBasicAuth(url) {
2762
+ let m = /:\/\/([^@]*)@/gi.exec(url);
2763
+ if (m && m[1]) {
2764
+ let [username, password] = m[1].split(":", 2);
2765
+ return {
2766
+ url: url.replace(m[1] + "@", ""),
2767
+ username,
2768
+ password
2769
+ };
2770
+ }
2771
+ }
2772
+ __name(parseBasicAuth, "parseBasicAuth");
2761
2773
  async function fetchBasic(url, fetchOptions = {}, fetchFn = fetch) {
2762
2774
  try {
2763
2775
  if (isArray(fetchOptions)) {
2764
2776
  fetchOptions = deepMerge({}, ...arrayFlatten(fetchOptions));
2765
2777
  }
2778
+ let auth = parseBasicAuth(String(url));
2779
+ if (auth) {
2780
+ url = auth.url;
2781
+ fetchOptions = deepMerge({}, fetchOptions, fetchOptionsBasicAuth(auth.username, auth.password));
2782
+ }
2766
2783
  const response = await fetchFn(String(url), fetchOptions);
2767
2784
  if (response.status < 400) {
2768
2785
  return response;
@@ -3143,6 +3160,7 @@ export {
3143
3160
  PubSub,
3144
3161
  usePubSub,
3145
3162
  useRPC,
3163
+ parseBasicAuth,
3146
3164
  fetchBasic,
3147
3165
  fetchJson,
3148
3166
  fetchText,
@@ -3158,4 +3176,4 @@ export {
3158
3176
  useExitHandler,
3159
3177
  MemStorage
3160
3178
  };
3161
- //# sourceMappingURL=chunk-DPI2LOOM.js.map
3179
+ //# sourceMappingURL=chunk-TIMYBUQO.js.map