@rg-dev/stdlib
Advanced tools
@@ -8,2 +8,5 @@ "use strict"; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __commonJS = (cb, mod) => function __require() { | ||
| return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | ||
| }; | ||
| var __export = (target, all) => { | ||
@@ -31,2 +34,61 @@ for (var name in all) | ||
| // node_modules/safe-json-stringify/index.js | ||
| var require_safe_json_stringify = __commonJS({ | ||
| "node_modules/safe-json-stringify/index.js"(exports, module2) { | ||
| "use strict"; | ||
| var hasProp = Object.prototype.hasOwnProperty; | ||
| function throwsMessage(err) { | ||
| return "[Throws: " + (err ? err.message : "?") + "]"; | ||
| } | ||
| function safeGetValueFromPropertyOnObject(obj, property) { | ||
| if (hasProp.call(obj, property)) { | ||
| try { | ||
| return obj[property]; | ||
| } catch (err) { | ||
| return throwsMessage(err); | ||
| } | ||
| } | ||
| return obj[property]; | ||
| } | ||
| function ensureProperties(obj) { | ||
| var seen = []; | ||
| function visit(obj2) { | ||
| if (obj2 === null || typeof obj2 !== "object") { | ||
| return obj2; | ||
| } | ||
| if (seen.indexOf(obj2) !== -1) { | ||
| return "[Circular]"; | ||
| } | ||
| seen.push(obj2); | ||
| if (typeof obj2.toJSON === "function") { | ||
| try { | ||
| var fResult = visit(obj2.toJSON()); | ||
| seen.pop(); | ||
| return fResult; | ||
| } catch (err) { | ||
| return throwsMessage(err); | ||
| } | ||
| } | ||
| if (Array.isArray(obj2)) { | ||
| var aResult = obj2.map(visit); | ||
| seen.pop(); | ||
| return aResult; | ||
| } | ||
| var result = Object.keys(obj2).reduce(function(result2, prop) { | ||
| result2[prop] = visit(safeGetValueFromPropertyOnObject(obj2, prop)); | ||
| return result2; | ||
| }, {}); | ||
| seen.pop(); | ||
| return result; | ||
| } | ||
| ; | ||
| return visit(obj); | ||
| } | ||
| module2.exports = function(data, replacer, space) { | ||
| return JSON.stringify(ensureProperties(data), replacer, space); | ||
| }; | ||
| module2.exports.ensureProperties = ensureProperties; | ||
| } | ||
| }); | ||
| // src/axios-helpers.ts | ||
@@ -44,2 +106,5 @@ var axios_helpers_exports = {}; | ||
| // src/common-env.ts | ||
| var import_safe_json_stringify = __toESM(require_safe_json_stringify(), 1); | ||
| // src/axios-helpers.ts | ||
@@ -64,3 +129,3 @@ import_axios.default.defaults.validateStatus = (status) => status < 400; | ||
| fnName || (fnName = "Function Error"); | ||
| const nonAxiosError = String((e == null ? void 0 : e.message) || JSON.stringify(e)) || "Unknown Error"; | ||
| const nonAxiosError = String((e == null ? void 0 : e.message) || (0, import_safe_json_stringify.default)(e)) || "Unknown Error"; | ||
| const error = Error(`${fnName} failed: ${String(nonAxiosError)}`); | ||
@@ -67,0 +132,0 @@ error.stack = e.stack; |
+89
-1
@@ -0,1 +1,86 @@ | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __commonJS = (cb, mod) => function __require() { | ||
| return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| // node_modules/safe-json-stringify/index.js | ||
| var require_safe_json_stringify = __commonJS({ | ||
| "node_modules/safe-json-stringify/index.js"(exports, module) { | ||
| "use strict"; | ||
| var hasProp = Object.prototype.hasOwnProperty; | ||
| function throwsMessage(err) { | ||
| return "[Throws: " + (err ? err.message : "?") + "]"; | ||
| } | ||
| function safeGetValueFromPropertyOnObject(obj, property) { | ||
| if (hasProp.call(obj, property)) { | ||
| try { | ||
| return obj[property]; | ||
| } catch (err) { | ||
| return throwsMessage(err); | ||
| } | ||
| } | ||
| return obj[property]; | ||
| } | ||
| function ensureProperties(obj) { | ||
| var seen = []; | ||
| function visit(obj2) { | ||
| if (obj2 === null || typeof obj2 !== "object") { | ||
| return obj2; | ||
| } | ||
| if (seen.indexOf(obj2) !== -1) { | ||
| return "[Circular]"; | ||
| } | ||
| seen.push(obj2); | ||
| if (typeof obj2.toJSON === "function") { | ||
| try { | ||
| var fResult = visit(obj2.toJSON()); | ||
| seen.pop(); | ||
| return fResult; | ||
| } catch (err) { | ||
| return throwsMessage(err); | ||
| } | ||
| } | ||
| if (Array.isArray(obj2)) { | ||
| var aResult = obj2.map(visit); | ||
| seen.pop(); | ||
| return aResult; | ||
| } | ||
| var result = Object.keys(obj2).reduce(function(result2, prop) { | ||
| result2[prop] = visit(safeGetValueFromPropertyOnObject(obj2, prop)); | ||
| return result2; | ||
| }, {}); | ||
| seen.pop(); | ||
| return result; | ||
| } | ||
| ; | ||
| return visit(obj); | ||
| } | ||
| module.exports = function(data, replacer, space) { | ||
| return JSON.stringify(ensureProperties(data), replacer, space); | ||
| }; | ||
| module.exports.ensureProperties = ensureProperties; | ||
| } | ||
| }); | ||
| // src/axios-helpers.ts | ||
@@ -7,2 +92,5 @@ import axios from "axios"; | ||
| // src/common-env.ts | ||
| var import_safe_json_stringify = __toESM(require_safe_json_stringify(), 1); | ||
| // src/axios-helpers.ts | ||
@@ -27,3 +115,3 @@ axios.defaults.validateStatus = (status) => status < 400; | ||
| fnName || (fnName = "Function Error"); | ||
| const nonAxiosError = String((e == null ? void 0 : e.message) || JSON.stringify(e)) || "Unknown Error"; | ||
| const nonAxiosError = String((e == null ? void 0 : e.message) || (0, import_safe_json_stringify.default)(e)) || "Unknown Error"; | ||
| const error = Error(`${fnName} failed: ${String(nonAxiosError)}`); | ||
@@ -30,0 +118,0 @@ error.stack = e.stack; |
+74
-34
| "use strict"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
@@ -6,2 +7,3 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
@@ -21,2 +23,5 @@ var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
| }; | ||
| var __commonJS = (cb, mod) => function __require() { | ||
| return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | ||
| }; | ||
| var __export = (target, all) => { | ||
@@ -34,5 +39,72 @@ for (var name in all) | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
| // node_modules/safe-json-stringify/index.js | ||
| var require_safe_json_stringify = __commonJS({ | ||
| "node_modules/safe-json-stringify/index.js"(exports, module2) { | ||
| "use strict"; | ||
| var hasProp = Object.prototype.hasOwnProperty; | ||
| function throwsMessage(err) { | ||
| return "[Throws: " + (err ? err.message : "?") + "]"; | ||
| } | ||
| function safeGetValueFromPropertyOnObject(obj, property) { | ||
| if (hasProp.call(obj, property)) { | ||
| try { | ||
| return obj[property]; | ||
| } catch (err) { | ||
| return throwsMessage(err); | ||
| } | ||
| } | ||
| return obj[property]; | ||
| } | ||
| function ensureProperties(obj) { | ||
| var seen = []; | ||
| function visit(obj2) { | ||
| if (obj2 === null || typeof obj2 !== "object") { | ||
| return obj2; | ||
| } | ||
| if (seen.indexOf(obj2) !== -1) { | ||
| return "[Circular]"; | ||
| } | ||
| seen.push(obj2); | ||
| if (typeof obj2.toJSON === "function") { | ||
| try { | ||
| var fResult = visit(obj2.toJSON()); | ||
| seen.pop(); | ||
| return fResult; | ||
| } catch (err) { | ||
| return throwsMessage(err); | ||
| } | ||
| } | ||
| if (Array.isArray(obj2)) { | ||
| var aResult = obj2.map(visit); | ||
| seen.pop(); | ||
| return aResult; | ||
| } | ||
| var result = Object.keys(obj2).reduce(function(result2, prop) { | ||
| result2[prop] = visit(safeGetValueFromPropertyOnObject(obj2, prop)); | ||
| return result2; | ||
| }, {}); | ||
| seen.pop(); | ||
| return result; | ||
| } | ||
| ; | ||
| return visit(obj); | ||
| } | ||
| module2.exports = function(data, replacer, space) { | ||
| return JSON.stringify(ensureProperties(data), replacer, space); | ||
| }; | ||
| module2.exports.ensureProperties = ensureProperties; | ||
| } | ||
| }); | ||
| // src/common-env.ts | ||
@@ -56,3 +128,3 @@ var common_env_exports = {}; | ||
| promiseWithTimeout: () => promiseWithTimeout, | ||
| safeJsonStringify: () => safeJsonStringify, | ||
| safeJsonStringify: () => import_safe_json_stringify.default, | ||
| sleep: () => sleep, | ||
@@ -208,2 +280,3 @@ useServer: () => useServer | ||
| // src/common-env.ts | ||
| var import_safe_json_stringify = __toESM(require_safe_json_stringify(), 1); | ||
| var Optional = class _Optional { | ||
@@ -334,34 +407,1 @@ constructor(value) { | ||
| } | ||
| function safeJsonStringify(obj, replacer, spaces, cycleReplacer) { | ||
| try { | ||
| return JSON.stringify(obj, replacer, spaces); | ||
| } catch (e) { | ||
| return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces); | ||
| } | ||
| } | ||
| function serializer(replacer, cycleReplacer) { | ||
| const stack = []; | ||
| const keys = []; | ||
| cycleReplacer != null ? cycleReplacer : cycleReplacer = (_key, value) => { | ||
| if (stack[0] === value) return "[Circular ~]"; | ||
| return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]"; | ||
| }; | ||
| return function(key, value) { | ||
| if (stack.length > 0) { | ||
| const thisPos = stack.indexOf(this); | ||
| if (thisPos !== -1) { | ||
| stack.splice(thisPos + 1); | ||
| keys.splice(thisPos, Infinity, key); | ||
| } else { | ||
| stack.push(this); | ||
| keys.push(key); | ||
| } | ||
| if (stack.includes(value)) { | ||
| value = cycleReplacer.call(this, key, value); | ||
| } | ||
| } else { | ||
| stack.push(value); | ||
| } | ||
| return replacer == null ? value : replacer.call(this, key, value); | ||
| }; | ||
| } |
| export { VERSION } from './index.cjs'; | ||
| export { default as safeJsonStringify } from 'safe-json-stringify'; | ||
@@ -50,3 +51,2 @@ type Options = { | ||
| type Reviver = (this: any, key: string, value: any) => any; | ||
| type MyFn<T extends Record<string, (...args: any[]) => any>> = { | ||
@@ -82,4 +82,3 @@ [K in keyof T]: (...args: Parameters<T[K]>) => void; | ||
| declare function joinURL(base: string, ...input: string[]): string; | ||
| declare function safeJsonStringify(obj: any, replacer?: Reviver, spaces?: number, cycleReplacer?: Reviver): string; | ||
| export { type AsyncReturnType, type MaybeFunction, type MyFn, Optional, StringBuilder, catchInline, doSafe, fetchHelperJSON, fetchHelperPost, fetchHelperText, isNonEmptyString, isNumber, isRunningOnServer, joinURL, lazyValue, promiseRetry, promiseWithTimeout, safeJsonStringify, sleep, useServer }; | ||
| export { type AsyncReturnType, type MaybeFunction, type MyFn, Optional, StringBuilder, catchInline, doSafe, fetchHelperJSON, fetchHelperPost, fetchHelperText, isNonEmptyString, isNumber, isRunningOnServer, joinURL, lazyValue, promiseRetry, promiseWithTimeout, sleep, useServer }; |
| export { VERSION } from './index.js'; | ||
| export { default as safeJsonStringify } from 'safe-json-stringify'; | ||
@@ -50,3 +51,2 @@ type Options = { | ||
| type Reviver = (this: any, key: string, value: any) => any; | ||
| type MyFn<T extends Record<string, (...args: any[]) => any>> = { | ||
@@ -82,4 +82,3 @@ [K in keyof T]: (...args: Parameters<T[K]>) => void; | ||
| declare function joinURL(base: string, ...input: string[]): string; | ||
| declare function safeJsonStringify(obj: any, replacer?: Reviver, spaces?: number, cycleReplacer?: Reviver): string; | ||
| export { type AsyncReturnType, type MaybeFunction, type MyFn, Optional, StringBuilder, catchInline, doSafe, fetchHelperJSON, fetchHelperPost, fetchHelperText, isNonEmptyString, isNumber, isRunningOnServer, joinURL, lazyValue, promiseRetry, promiseWithTimeout, safeJsonStringify, sleep, useServer }; | ||
| export { type AsyncReturnType, type MaybeFunction, type MyFn, Optional, StringBuilder, catchInline, doSafe, fetchHelperJSON, fetchHelperPost, fetchHelperText, isNonEmptyString, isNumber, isRunningOnServer, joinURL, lazyValue, promiseRetry, promiseWithTimeout, sleep, useServer }; |
+85
-34
@@ -0,3 +1,7 @@ | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
@@ -17,4 +21,82 @@ var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
| }; | ||
| var __commonJS = (cb, mod) => function __require() { | ||
| return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
| // node_modules/safe-json-stringify/index.js | ||
| var require_safe_json_stringify = __commonJS({ | ||
| "node_modules/safe-json-stringify/index.js"(exports, module) { | ||
| "use strict"; | ||
| var hasProp = Object.prototype.hasOwnProperty; | ||
| function throwsMessage(err) { | ||
| return "[Throws: " + (err ? err.message : "?") + "]"; | ||
| } | ||
| function safeGetValueFromPropertyOnObject(obj, property) { | ||
| if (hasProp.call(obj, property)) { | ||
| try { | ||
| return obj[property]; | ||
| } catch (err) { | ||
| return throwsMessage(err); | ||
| } | ||
| } | ||
| return obj[property]; | ||
| } | ||
| function ensureProperties(obj) { | ||
| var seen = []; | ||
| function visit(obj2) { | ||
| if (obj2 === null || typeof obj2 !== "object") { | ||
| return obj2; | ||
| } | ||
| if (seen.indexOf(obj2) !== -1) { | ||
| return "[Circular]"; | ||
| } | ||
| seen.push(obj2); | ||
| if (typeof obj2.toJSON === "function") { | ||
| try { | ||
| var fResult = visit(obj2.toJSON()); | ||
| seen.pop(); | ||
| return fResult; | ||
| } catch (err) { | ||
| return throwsMessage(err); | ||
| } | ||
| } | ||
| if (Array.isArray(obj2)) { | ||
| var aResult = obj2.map(visit); | ||
| seen.pop(); | ||
| return aResult; | ||
| } | ||
| var result = Object.keys(obj2).reduce(function(result2, prop) { | ||
| result2[prop] = visit(safeGetValueFromPropertyOnObject(obj2, prop)); | ||
| return result2; | ||
| }, {}); | ||
| seen.pop(); | ||
| return result; | ||
| } | ||
| ; | ||
| return visit(obj); | ||
| } | ||
| module.exports = function(data, replacer, space) { | ||
| return JSON.stringify(ensureProperties(data), replacer, space); | ||
| }; | ||
| module.exports.ensureProperties = ensureProperties; | ||
| } | ||
| }); | ||
| // src/index.ts | ||
@@ -165,2 +247,3 @@ var VERSION = "1"; | ||
| // src/common-env.ts | ||
| var import_safe_json_stringify = __toESM(require_safe_json_stringify(), 1); | ||
| var Optional = class _Optional { | ||
@@ -291,35 +374,3 @@ constructor(value) { | ||
| } | ||
| function safeJsonStringify(obj, replacer, spaces, cycleReplacer) { | ||
| try { | ||
| return JSON.stringify(obj, replacer, spaces); | ||
| } catch (e) { | ||
| return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces); | ||
| } | ||
| } | ||
| function serializer(replacer, cycleReplacer) { | ||
| const stack = []; | ||
| const keys = []; | ||
| cycleReplacer != null ? cycleReplacer : cycleReplacer = (_key, value) => { | ||
| if (stack[0] === value) return "[Circular ~]"; | ||
| return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]"; | ||
| }; | ||
| return function(key, value) { | ||
| if (stack.length > 0) { | ||
| const thisPos = stack.indexOf(this); | ||
| if (thisPos !== -1) { | ||
| stack.splice(thisPos + 1); | ||
| keys.splice(thisPos, Infinity, key); | ||
| } else { | ||
| stack.push(this); | ||
| keys.push(key); | ||
| } | ||
| if (stack.includes(value)) { | ||
| value = cycleReplacer.call(this, key, value); | ||
| } | ||
| } else { | ||
| stack.push(value); | ||
| } | ||
| return replacer == null ? value : replacer.call(this, key, value); | ||
| }; | ||
| } | ||
| var export_safeJsonStringify = import_safe_json_stringify.default; | ||
| export { | ||
@@ -341,5 +392,5 @@ Optional, | ||
| promiseWithTimeout, | ||
| safeJsonStringify, | ||
| export_safeJsonStringify as safeJsonStringify, | ||
| sleep, | ||
| useServer | ||
| }; |
+73
-0
| "use strict"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __commonJS = (cb, mod) => function __require() { | ||
| return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | ||
| }; | ||
| var __export = (target, all) => { | ||
@@ -18,4 +23,71 @@ for (var name in all) | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // node_modules/safe-json-stringify/index.js | ||
| var require_safe_json_stringify = __commonJS({ | ||
| "node_modules/safe-json-stringify/index.js"(exports, module2) { | ||
| "use strict"; | ||
| var hasProp = Object.prototype.hasOwnProperty; | ||
| function throwsMessage(err) { | ||
| return "[Throws: " + (err ? err.message : "?") + "]"; | ||
| } | ||
| function safeGetValueFromPropertyOnObject(obj, property) { | ||
| if (hasProp.call(obj, property)) { | ||
| try { | ||
| return obj[property]; | ||
| } catch (err) { | ||
| return throwsMessage(err); | ||
| } | ||
| } | ||
| return obj[property]; | ||
| } | ||
| function ensureProperties(obj) { | ||
| var seen = []; | ||
| function visit(obj2) { | ||
| if (obj2 === null || typeof obj2 !== "object") { | ||
| return obj2; | ||
| } | ||
| if (seen.indexOf(obj2) !== -1) { | ||
| return "[Circular]"; | ||
| } | ||
| seen.push(obj2); | ||
| if (typeof obj2.toJSON === "function") { | ||
| try { | ||
| var fResult = visit(obj2.toJSON()); | ||
| seen.pop(); | ||
| return fResult; | ||
| } catch (err) { | ||
| return throwsMessage(err); | ||
| } | ||
| } | ||
| if (Array.isArray(obj2)) { | ||
| var aResult = obj2.map(visit); | ||
| seen.pop(); | ||
| return aResult; | ||
| } | ||
| var result = Object.keys(obj2).reduce(function(result2, prop) { | ||
| result2[prop] = visit(safeGetValueFromPropertyOnObject(obj2, prop)); | ||
| return result2; | ||
| }, {}); | ||
| seen.pop(); | ||
| return result; | ||
| } | ||
| ; | ||
| return visit(obj); | ||
| } | ||
| module2.exports = function(data, replacer, space) { | ||
| return JSON.stringify(ensureProperties(data), replacer, space); | ||
| }; | ||
| module2.exports.ensureProperties = ensureProperties; | ||
| } | ||
| }); | ||
| // src/vite-helpers.ts | ||
@@ -33,2 +105,3 @@ var vite_helpers_exports = {}; | ||
| // src/common-env.ts | ||
| var import_safe_json_stringify = __toESM(require_safe_json_stringify(), 1); | ||
| function isNonEmptyString(str) { | ||
@@ -35,0 +108,0 @@ return typeof str == "string" && str.trim().length > 0; |
@@ -6,5 +6,5 @@ import { Handler } from 'express'; | ||
| editHtmlFn?: (html: string) => string; | ||
| hmr: boolean; | ||
| hmr?: boolean; | ||
| }): Promise<Handler>; | ||
| export { createViteMiddleware }; |
@@ -6,5 +6,5 @@ import { Handler } from 'express'; | ||
| editHtmlFn?: (html: string) => string; | ||
| hmr: boolean; | ||
| hmr?: boolean; | ||
| }): Promise<Handler>; | ||
| export { createViteMiddleware }; |
+86
-0
@@ -0,1 +1,86 @@ | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __commonJS = (cb, mod) => function __require() { | ||
| return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| // node_modules/safe-json-stringify/index.js | ||
| var require_safe_json_stringify = __commonJS({ | ||
| "node_modules/safe-json-stringify/index.js"(exports, module) { | ||
| "use strict"; | ||
| var hasProp = Object.prototype.hasOwnProperty; | ||
| function throwsMessage(err) { | ||
| return "[Throws: " + (err ? err.message : "?") + "]"; | ||
| } | ||
| function safeGetValueFromPropertyOnObject(obj, property) { | ||
| if (hasProp.call(obj, property)) { | ||
| try { | ||
| return obj[property]; | ||
| } catch (err) { | ||
| return throwsMessage(err); | ||
| } | ||
| } | ||
| return obj[property]; | ||
| } | ||
| function ensureProperties(obj) { | ||
| var seen = []; | ||
| function visit(obj2) { | ||
| if (obj2 === null || typeof obj2 !== "object") { | ||
| return obj2; | ||
| } | ||
| if (seen.indexOf(obj2) !== -1) { | ||
| return "[Circular]"; | ||
| } | ||
| seen.push(obj2); | ||
| if (typeof obj2.toJSON === "function") { | ||
| try { | ||
| var fResult = visit(obj2.toJSON()); | ||
| seen.pop(); | ||
| return fResult; | ||
| } catch (err) { | ||
| return throwsMessage(err); | ||
| } | ||
| } | ||
| if (Array.isArray(obj2)) { | ||
| var aResult = obj2.map(visit); | ||
| seen.pop(); | ||
| return aResult; | ||
| } | ||
| var result = Object.keys(obj2).reduce(function(result2, prop) { | ||
| result2[prop] = visit(safeGetValueFromPropertyOnObject(obj2, prop)); | ||
| return result2; | ||
| }, {}); | ||
| seen.pop(); | ||
| return result; | ||
| } | ||
| ; | ||
| return visit(obj); | ||
| } | ||
| module.exports = function(data, replacer, space) { | ||
| return JSON.stringify(ensureProperties(data), replacer, space); | ||
| }; | ||
| module.exports.ensureProperties = ensureProperties; | ||
| } | ||
| }); | ||
| // src/index.ts | ||
@@ -5,2 +90,3 @@ var VERSION = "1"; | ||
| // src/common-env.ts | ||
| var import_safe_json_stringify = __toESM(require_safe_json_stringify(), 1); | ||
| function isNonEmptyString(str) { | ||
@@ -7,0 +93,0 @@ return typeof str == "string" && str.trim().length > 0; |
+6
-4
| { | ||
| "name": "@rg-dev/stdlib", | ||
| "version": "1.0.63", | ||
| "version": "1.0.64", | ||
| "description": "", | ||
@@ -84,3 +84,4 @@ "scripts": { | ||
| "dependencies": { | ||
| "fs-extra": "^11.1.1" | ||
| "fs-extra": "^11.1.1", | ||
| "@types/safe-json-stringify": "^1.1.5" | ||
| }, | ||
@@ -91,3 +92,3 @@ "publishConfig": { | ||
| "devDependencies": { | ||
| "ufo": "^1.6.3", | ||
| "safe-json-stringify": "^1.2.0", | ||
| "@trpc/server": "^11.1.1", | ||
@@ -107,4 +108,5 @@ "@types/command-exists": "^1.2.3", | ||
| "tsup": "^8.0.1", | ||
| "typescript": "^5.9.3" | ||
| "typescript": "^5.9.3", | ||
| "ufo": "^1.6.3" | ||
| } | ||
| } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
617083
3.01%15463
3.4%2
100%17
6.25%+ Added