@putkoff/abstract-utilities 1.0.2 → 1.0.4

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/cjs/index.js CHANGED
@@ -2008,7 +2008,7 @@ function Spinner() {
2008
2008
  let _cachedConfig = null;
2009
2009
  function loadConfig() {
2010
2010
  return __awaiter(this, arguments, void 0, function* (filePath = null) {
2011
- var _a;
2011
+ var _a, _b;
2012
2012
  if (_cachedConfig) {
2013
2013
  return _cachedConfig;
2014
2014
  }
@@ -2020,9 +2020,11 @@ function loadConfig() {
2020
2020
  else if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)) }) !== 'undefined' && typeof (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)) === 'string') {
2021
2021
  // ES module: resolve relative to this file
2022
2022
  try {
2023
- configUrl = new URL('./config.json', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))).href;
2023
+ const mod = yield (new Function("return import('./config.json').catch(() => ({}))"))();
2024
+ _cachedConfig = (_a = mod.default) !== null && _a !== void 0 ? _a : {};
2025
+ return _cachedConfig;
2024
2026
  }
2025
- catch (_b) {
2027
+ catch (_c) {
2026
2028
  configUrl = 'config.json';
2027
2029
  }
2028
2030
  }
@@ -2035,7 +2037,7 @@ function loadConfig() {
2035
2037
  ? new URL('config.json', baseURI).href
2036
2038
  : 'config.json';
2037
2039
  }
2038
- catch (_c) {
2040
+ catch (_d) {
2039
2041
  configUrl = 'config.json';
2040
2042
  }
2041
2043
  }
@@ -2047,11 +2049,11 @@ function loadConfig() {
2047
2049
  if (res.ok) {
2048
2050
  const json = yield res.json();
2049
2051
  // cache & return
2050
- _cachedConfig = (_a = json) !== null && _a !== void 0 ? _a : {};
2052
+ _cachedConfig = (_b = json) !== null && _b !== void 0 ? _b : {};
2051
2053
  return _cachedConfig;
2052
2054
  }
2053
2055
  }
2054
- catch (_d) {
2056
+ catch (_e) {
2055
2057
  /* swallow */
2056
2058
  }
2057
2059
  }
@@ -2061,7 +2063,7 @@ function loadConfig() {
2061
2063
  _cachedConfig = disk !== null && disk !== void 0 ? disk : {};
2062
2064
  return _cachedConfig;
2063
2065
  }
2064
- catch (_e) {
2066
+ catch (_f) {
2065
2067
  /* swallow */
2066
2068
  }
2067
2069
  // 4) if all else fails, return an empty config