@stacksjs/utils 0.70.32 → 0.70.33

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import{path as O}from"@stacksjs/path";async function F$(){await Bun.$`rm -rf ${O
5
5
  `).find((H)=>H.startsWith("APP_KEY="));return!!(P&&P.length>16)}function sT($){if($===void 0&&n.reset)$=n.reset;if($===null)return[];let H={tailwind:'import { tailwindPreflight as reset } from "@cwcss/crosswind"',preflight:'import { tailwindPreflight as reset } from "@cwcss/crosswind"',forms:'import { tailwindFormsPreflight as reset } from "@cwcss/crosswind"'}[$??"tailwind"];return H?[H]:[]}function K$($){return $&&typeof $==="object"&&z($.name)&&z($.version)&&z($.description)}function z($){let T=typeof $;return $===null||T==="undefined"||T==="string"}async function iT($,T){let P=await o(I(".env")),H=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),f=new RegExp(`^${H}=.*$`,"m"),Q=`${$}=${T}`,q=f.test(P.data)?P.data.replace(f,Q):`${P.data}${P.data.endsWith(`
6
6
  `)?"":`
7
7
  `}${Q}
8
- `;await J$({path:I(".env"),data:q})}async function rT($,T){let{data:P}=await U$("package.json",x());if(K$(P)&&M$(P,$))return await E$(`bun run ${$}`,T);return r(h(`The ${$} script does not exist in the package.json file.`))}function M$($,T){let P=$.scripts;if(P&&typeof P==="object")return Boolean(P[T]);return!1}function aT($){return Bun.YAML.parse($)}function oT($){if($?.verbose===!0)return!0;return i.debug===!0}function lT($){return $.family==="IPv6"||$.family===6}function tT($){let T=Bun.YAML;if(typeof T.stringify==="function")return T.stringify($);return JSON.stringify($,null,2)}function eT($){return Bun.YAML.parse($)}class Y${static macros=new Map;static macro($,T,P=!1){if(this.macros.has($)&&!P)throw Error(`Macro "${$}" is already registered`);this.macros.set($,T),Object.defineProperty(this.prototype,$,{value:T,writable:!0,configurable:!0,enumerable:!1})}static mixin($,T=!0){let P=Object.getOwnPropertyNames($);for(let H of P){if(H==="constructor")continue;if(this.macros.has(H)&&!T)continue;let f=Object.getOwnPropertyDescriptor($,H);if(f&&typeof f.value==="function")this.macro(H,f.value,T)}}static hasMacro($){return this.macros.has($)}static flushMacros(){for(let $ of this.macros.keys())delete this.prototype[$];this.macros.clear()}static getMacros(){return Array.from(this.macros.keys())}callMacro($,...T){let P=this.constructor.macros.get($);if(!P)throw Error(`Macro "${$}" is not registered`);return P.apply(this,T)}}function TP($=class{}){return class extends ${static macros=new Map;static macro(T,P,H=!1){if(this.macros.has(T)&&!H)throw Error(`Macro "${T}" is already registered`);this.macros.set(T,P),Object.defineProperty(this.prototype,T,{value:P,writable:!0,configurable:!0,enumerable:!1})}static mixin(T,P=!0){let H=Object.getOwnPropertyNames(T);for(let f of H){if(f==="constructor")continue;if(this.macros.has(f)&&!P)continue;let Q=Object.getOwnPropertyDescriptor(T,f);if(Q&&typeof Q.value==="function")this.macro(f,Q.value,P)}}static hasMacro(T){return this.macros.has(T)}static flushMacros(){for(let T of this.macros.keys())delete this.prototype[T];this.macros.clear()}static getMacros(){return Array.from(this.macros.keys())}}}function PP($){let T=new Map;return $.macro=function(P,H,f=!1){if(T.has(P)&&!f)throw Error(`Macro "${P}" is already registered`);T.set(P,H),Object.defineProperty($.prototype,P,{value:H,writable:!0,configurable:!0,enumerable:!1})},$.mixin=function(P,H=!0){let f=Object.getOwnPropertyNames(P);for(let Q of f){if(Q==="constructor")continue;if(T.has(Q)&&!H)continue;let q=Object.getOwnPropertyDescriptor(P,Q);if(q&&typeof q.value==="function")$.macro(Q,q.value,H)}},$.hasMacro=function(P){return T.has(P)},$.flushMacros=function(){for(let P of T.keys())delete $.prototype[P];T.clear()},$.getMacros=function(){return Array.from(T.keys())},$}function qP($,T){if(typeof $!=="string"||$.length===0)return T;try{return JSON.parse($)}catch{return T}}function XP($){if(typeof $!=="string")return{ok:!1,reason:"not-string"};if($.length===0)return{ok:!1,reason:"empty"};try{return{ok:!0,value:JSON.parse($)}}catch(T){return{ok:!1,reason:"malformed",error:T}}}function ZP($,T){let P=new WeakSet;return JSON.stringify($,(H,f)=>{if(typeof f==="bigint")return f.toString();if(f&&typeof f==="object"){if(P.has(f))return"[Circular]";P.add(f)}return f},T)}var I$="0.70.32";var BP=Bun.semver;function GP($,T){return Bun.semver.order($,T)===1}function UP($,T){return Bun.semver.order($,T)===-1}function JP($,T){return Bun.semver.order($,T)===0}function KP($,T){return Bun.semver.order($,T)>=0}function MP($,T){return Bun.semver.order($,T)<=0}import*as CH from"@stacksjs/browser";import{clamp as gH,notNullish as bH,retry as mH,useOnline as uH}from"@stacksjs/browser";function N(...$){let T={};for(let P of $){if(!P||typeof P!=="object")continue;for(let H in P){let f=P[H],Q=T[H];if(f===void 0)continue;if(Array.isArray(f))T[H]=Array.isArray(Q)?[...Q,...f]:[...f];else if(f&&typeof f==="object"&&!W$(f))T[H]=N(Q||{},f);else T[H]=f}}return T}function OP($){return(...T)=>{return N($,...T)}}function L$($,...T){return N({},...T,$)}function W$($){if($ instanceof Date)return!0;if($ instanceof RegExp)return!0;if($ instanceof Error)return!0;if($ instanceof Promise)return!0;if($ instanceof Map)return!0;if($ instanceof Set)return!0;if($ instanceof WeakMap)return!0;if($ instanceof WeakSet)return!0;if(ArrayBuffer.isView($))return!0;return!1}var IP=L$,LP=N;function kP($){let T=$.split(`
8
+ `;await J$({path:I(".env"),data:q})}async function rT($,T){let{data:P}=await U$("package.json",x());if(K$(P)&&M$(P,$))return await E$(`bun run ${$}`,T);return r(h(`The ${$} script does not exist in the package.json file.`))}function M$($,T){let P=$.scripts;if(P&&typeof P==="object")return Boolean(P[T]);return!1}function aT($){return Bun.YAML.parse($)}function oT($){if($?.verbose===!0)return!0;return i.debug===!0}function lT($){return $.family==="IPv6"||$.family===6}function tT($){let T=Bun.YAML;if(typeof T.stringify==="function")return T.stringify($);return JSON.stringify($,null,2)}function eT($){return Bun.YAML.parse($)}class Y${static macros=new Map;static macro($,T,P=!1){if(this.macros.has($)&&!P)throw Error(`Macro "${$}" is already registered`);this.macros.set($,T),Object.defineProperty(this.prototype,$,{value:T,writable:!0,configurable:!0,enumerable:!1})}static mixin($,T=!0){let P=Object.getOwnPropertyNames($);for(let H of P){if(H==="constructor")continue;if(this.macros.has(H)&&!T)continue;let f=Object.getOwnPropertyDescriptor($,H);if(f&&typeof f.value==="function")this.macro(H,f.value,T)}}static hasMacro($){return this.macros.has($)}static flushMacros(){for(let $ of this.macros.keys())delete this.prototype[$];this.macros.clear()}static getMacros(){return Array.from(this.macros.keys())}callMacro($,...T){let P=this.constructor.macros.get($);if(!P)throw Error(`Macro "${$}" is not registered`);return P.apply(this,T)}}function TP($=class{}){return class extends ${static macros=new Map;static macro(T,P,H=!1){if(this.macros.has(T)&&!H)throw Error(`Macro "${T}" is already registered`);this.macros.set(T,P),Object.defineProperty(this.prototype,T,{value:P,writable:!0,configurable:!0,enumerable:!1})}static mixin(T,P=!0){let H=Object.getOwnPropertyNames(T);for(let f of H){if(f==="constructor")continue;if(this.macros.has(f)&&!P)continue;let Q=Object.getOwnPropertyDescriptor(T,f);if(Q&&typeof Q.value==="function")this.macro(f,Q.value,P)}}static hasMacro(T){return this.macros.has(T)}static flushMacros(){for(let T of this.macros.keys())delete this.prototype[T];this.macros.clear()}static getMacros(){return Array.from(this.macros.keys())}}}function PP($){let T=new Map;return $.macro=function(P,H,f=!1){if(T.has(P)&&!f)throw Error(`Macro "${P}" is already registered`);T.set(P,H),Object.defineProperty($.prototype,P,{value:H,writable:!0,configurable:!0,enumerable:!1})},$.mixin=function(P,H=!0){let f=Object.getOwnPropertyNames(P);for(let Q of f){if(Q==="constructor")continue;if(T.has(Q)&&!H)continue;let q=Object.getOwnPropertyDescriptor(P,Q);if(q&&typeof q.value==="function")$.macro(Q,q.value,H)}},$.hasMacro=function(P){return T.has(P)},$.flushMacros=function(){for(let P of T.keys())delete $.prototype[P];T.clear()},$.getMacros=function(){return Array.from(T.keys())},$}function qP($,T){if(typeof $!=="string"||$.length===0)return T;try{return JSON.parse($)}catch{return T}}function XP($){if(typeof $!=="string")return{ok:!1,reason:"not-string"};if($.length===0)return{ok:!1,reason:"empty"};try{return{ok:!0,value:JSON.parse($)}}catch(T){return{ok:!1,reason:"malformed",error:T}}}function ZP($,T){let P=new WeakSet;return JSON.stringify($,(H,f)=>{if(typeof f==="bigint")return f.toString();if(f&&typeof f==="object"){if(P.has(f))return"[Circular]";P.add(f)}return f},T)}var I$="0.70.33";var BP=Bun.semver;function GP($,T){return Bun.semver.order($,T)===1}function UP($,T){return Bun.semver.order($,T)===-1}function JP($,T){return Bun.semver.order($,T)===0}function KP($,T){return Bun.semver.order($,T)>=0}function MP($,T){return Bun.semver.order($,T)<=0}import*as CH from"@stacksjs/browser";import{clamp as gH,notNullish as bH,retry as mH,useOnline as uH}from"@stacksjs/browser";function N(...$){let T={};for(let P of $){if(!P||typeof P!=="object")continue;for(let H in P){let f=P[H],Q=T[H];if(f===void 0)continue;if(Array.isArray(f))T[H]=Array.isArray(Q)?[...Q,...f]:[...f];else if(f&&typeof f==="object"&&!W$(f))T[H]=N(Q||{},f);else T[H]=f}}return T}function OP($){return(...T)=>{return N($,...T)}}function L$($,...T){return N({},...T,$)}function W$($){if($ instanceof Date)return!0;if($ instanceof RegExp)return!0;if($ instanceof Error)return!0;if($ instanceof Promise)return!0;if($ instanceof Map)return!0;if($ instanceof Set)return!0;if($ instanceof WeakMap)return!0;if($ instanceof WeakSet)return!0;if(ArrayBuffer.isView($))return!0;return!1}var IP=L$,LP=N;function kP($){let T=$.split(`
9
9
  `),P=[];for(let E of T){if(!E.trim())continue;let _=E.match(/^(\s+)/);if(_&&_[1]!==void 0)P.push(_[1])}if(P.length===0)return{amount:0,type:null,indent:""};let H=new Map;for(let E of P)H.set(E,(H.get(E)||0)+1);let f="",Q=0;for(let[E,_]of H)if(_>Q)Q=_,f=E;if(f.includes("\t"))return{amount:f.length,type:"tab",indent:f};return{amount:f.length,type:"space",indent:f}}function k$($){if(!$)return null;if($.includes(`\r
10
10
  `))return`\r
11
11
  `;if($.includes(`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/utils",
3
3
  "type": "module",
4
- "version": "0.70.32",
4
+ "version": "0.70.33",
5
5
  "description": "The Stacks helper functions.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [