@stacksjs/utils 0.70.53 → 0.70.54

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 +11 -11
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import{path as L}from"@stacksjs/path";async function S$(){await Bun.$`rm -rf ${L
5
5
  `).find((f)=>f.startsWith("APP_KEY="));return!!(H&&H.length>16)}function eT($){if($===void 0&&n.reset)$=n.reset;if($===null)return[];let f={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 f?[f]:[]}function O$($){return $&&typeof $==="object"&&w($.name)&&w($.version)&&w($.description)}function w($){let T=typeof $;return $===null||T==="undefined"||T==="string"}async function $H($,T){let H=await o(I(".env")),f=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Q=new RegExp(`^${f}=.*$`,"m"),X=`${$}=${T}`,_=Q.test(H.data)?H.data.replace(Q,X):`${H.data}${H.data.endsWith(`
6
6
  `)?"":`
7
7
  `}${X}
8
- `;await M$({path:I(".env"),data:_})}async function TH($,T){let{data:H}=await K$("package.json",h());if(O$(H)&&L$(H,$))return await J$(`bun run ${$}`,T);return r(x(`The ${$} script does not exist in the package.json file.`))}function L$($,T){let H=$.scripts;if(H&&typeof H==="object")return Boolean(H[T]);return!1}function HH($){return Bun.YAML.parse($)}function fH($){if($?.verbose===!0)return!0;return s.debug===!0}function QH($){return $.family==="IPv6"||$.family===6}function XH($){let T=Bun.YAML;if(typeof T.stringify==="function")return T.stringify($);return JSON.stringify($,null,2)}function ZH($){return Bun.YAML.parse($)}class I${static macros=new Map;static macro($,T,H=!1){if(this.macros.has($)&&!H)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 H=Object.getOwnPropertyNames($);for(let f of H){if(f==="constructor")continue;if(this.macros.has(f)&&!T)continue;let Q=Object.getOwnPropertyDescriptor($,f);if(Q&&typeof Q.value==="function")this.macro(f,Q.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 H=this.constructor.macros.get($);if(!H)throw Error(`Macro "${$}" is not registered`);return H.apply(this,T)}}function VH($=class{}){return class extends ${static macros=new Map;static macro(T,H,f=!1){if(this.macros.has(T)&&!f)throw Error(`Macro "${T}" is already registered`);this.macros.set(T,H),Object.defineProperty(this.prototype,T,{value:H,writable:!0,configurable:!0,enumerable:!1})}static mixin(T,H=!0){let f=Object.getOwnPropertyNames(T);for(let Q of f){if(Q==="constructor")continue;if(this.macros.has(Q)&&!H)continue;let X=Object.getOwnPropertyDescriptor(T,Q);if(X&&typeof X.value==="function")this.macro(Q,X.value,H)}}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 _H($){let T=new Map;return $.macro=function(H,f,Q=!1){if(T.has(H)&&!Q)throw Error(`Macro "${H}" is already registered`);T.set(H,f),Object.defineProperty($.prototype,H,{value:f,writable:!0,configurable:!0,enumerable:!1})},$.mixin=function(H,f=!0){let Q=Object.getOwnPropertyNames(H);for(let X of Q){if(X==="constructor")continue;if(T.has(X)&&!f)continue;let _=Object.getOwnPropertyDescriptor(H,X);if(_&&typeof _.value==="function")$.macro(X,_.value,f)}},$.hasMacro=function(H){return T.has(H)},$.flushMacros=function(){for(let H of T.keys())delete $.prototype[H];T.clear()},$.getMacros=function(){return Array.from(T.keys())},$}function JH($,T){if(typeof $!=="string"||$.length===0)return T;try{return JSON.parse($)}catch{return T}}function UH($){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 YH($,T){let H=new WeakSet;return JSON.stringify($,(f,Q)=>{if(typeof Q==="bigint")return Q.toString();if(Q&&typeof Q==="object"){if(H.has(Q))return"[Circular]";H.add(Q)}return Q},T)}var k$="0.70.53";var LH=Bun.semver;function IH($,T){return Bun.semver.order($,T)===1}function WH($,T){return Bun.semver.order($,T)===-1}function kH($,T){return Bun.semver.order($,T)===0}function DH($,T){return Bun.semver.order($,T)>=0}function EH($,T){return Bun.semver.order($,T)<=0}import*as nf from"@stacksjs/browser";import{clamp as rf,notNullish as af,retry as of,useOnline as lf}from"@stacksjs/browser";function N(...$){let T={};for(let H of $){if(!H||typeof H!=="object")continue;for(let f in H){let Q=H[f],X=T[f];if(Q===void 0)continue;if(Array.isArray(Q))T[f]=Array.isArray(X)?[...X,...Q]:[...Q];else if(Q&&typeof Q==="object"&&!E$(Q))T[f]=N(X||{},Q);else T[f]=Q}}return T}function RH($){return(...T)=>{return N($,...T)}}function D$($,...T){return N({},...T,$)}function E$($){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 zH=D$,AH=N;function xH($){let T=$.split(`
8
+ `;await M$({path:I(".env"),data:_})}async function TH($,T){let{data:H}=await K$("package.json",h());if(O$(H)&&L$(H,$))return await J$(`bun run ${$}`,T);return r(x(`The ${$} script does not exist in the package.json file.`))}function L$($,T){let H=$.scripts;if(H&&typeof H==="object")return Boolean(H[T]);return!1}function HH($){return Bun.YAML.parse($)}function fH($){if($?.verbose===!0)return!0;return s.debug===!0}function QH($){return $.family==="IPv6"||$.family===6}function XH($){let T=Bun.YAML;if(typeof T.stringify==="function")return T.stringify($);return JSON.stringify($,null,2)}function ZH($){return Bun.YAML.parse($)}class I${static macros=new Map;static macro($,T,H=!1){if(this.macros.has($)&&!H)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 H=Object.getOwnPropertyNames($);for(let f of H){if(f==="constructor")continue;if(this.macros.has(f)&&!T)continue;let Q=Object.getOwnPropertyDescriptor($,f);if(Q&&typeof Q.value==="function")this.macro(f,Q.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 H=this.constructor.macros.get($);if(!H)throw Error(`Macro "${$}" is not registered`);return H.apply(this,T)}}function VH($=class{}){return class extends ${static macros=new Map;static macro(T,H,f=!1){if(this.macros.has(T)&&!f)throw Error(`Macro "${T}" is already registered`);this.macros.set(T,H),Object.defineProperty(this.prototype,T,{value:H,writable:!0,configurable:!0,enumerable:!1})}static mixin(T,H=!0){let f=Object.getOwnPropertyNames(T);for(let Q of f){if(Q==="constructor")continue;if(this.macros.has(Q)&&!H)continue;let X=Object.getOwnPropertyDescriptor(T,Q);if(X&&typeof X.value==="function")this.macro(Q,X.value,H)}}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 _H($){let T=new Map;return $.macro=function(H,f,Q=!1){if(T.has(H)&&!Q)throw Error(`Macro "${H}" is already registered`);T.set(H,f),Object.defineProperty($.prototype,H,{value:f,writable:!0,configurable:!0,enumerable:!1})},$.mixin=function(H,f=!0){let Q=Object.getOwnPropertyNames(H);for(let X of Q){if(X==="constructor")continue;if(T.has(X)&&!f)continue;let _=Object.getOwnPropertyDescriptor(H,X);if(_&&typeof _.value==="function")$.macro(X,_.value,f)}},$.hasMacro=function(H){return T.has(H)},$.flushMacros=function(){for(let H of T.keys())delete $.prototype[H];T.clear()},$.getMacros=function(){return Array.from(T.keys())},$}function JH($,T){if(typeof $!=="string"||$.length===0)return T;try{return JSON.parse($)}catch{return T}}function UH($){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 YH($,T){let H=new WeakSet;return JSON.stringify($,(f,Q)=>{if(typeof Q==="bigint")return Q.toString();if(Q&&typeof Q==="object"){if(H.has(Q))return"[Circular]";H.add(Q)}return Q},T)}var k$="0.70.54";var LH=Bun.semver;function IH($,T){return Bun.semver.order($,T)===1}function WH($,T){return Bun.semver.order($,T)===-1}function kH($,T){return Bun.semver.order($,T)===0}function DH($,T){return Bun.semver.order($,T)>=0}function EH($,T){return Bun.semver.order($,T)<=0}import*as nf from"@stacksjs/browser";import{clamp as rf,notNullish as af,retry as of,useOnline as lf}from"@stacksjs/browser";function N(...$){let T={};for(let H of $){if(!H||typeof H!=="object")continue;for(let f in H){let Q=H[f],X=T[f];if(Q===void 0)continue;if(Array.isArray(Q))T[f]=Array.isArray(X)?[...X,...Q]:[...Q];else if(Q&&typeof Q==="object"&&!E$(Q))T[f]=N(X||{},Q);else T[f]=Q}}return T}function RH($){return(...T)=>{return N($,...T)}}function D$($,...T){return N({},...T,$)}function E$($){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 zH=D$,AH=N;function xH($){let T=$.split(`
9
9
  `),H=[];for(let P of T){if(!P.trim())continue;let B=P.match(/^(\s+)/);if(B&&B[1]!==void 0)H.push(B[1])}if(H.length===0)return{amount:0,type:null,indent:""};let f=new Map;for(let P of H)f.set(P,(f.get(P)||0)+1);let Q="",X=0;for(let[P,B]of f)if(B>X)X=B,Q=P;if(Q.includes("\t"))return{amount:Q.length,type:"tab",indent:Q};return{amount:Q.length,type:"space",indent:Q}}function N$($){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.53",
4
+ "version": "0.70.54",
5
5
  "description": "The Stacks helper functions.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -52,18 +52,18 @@
52
52
  "size": "bun scripts/export-size.ts"
53
53
  },
54
54
  "dependencies": {
55
- "@stacksjs/browser": "0.70.53"
55
+ "@stacksjs/browser": "0.70.54"
56
56
  },
57
57
  "devDependencies": {
58
- "@stacksjs/actions": "0.70.53",
59
- "@stacksjs/arrays": "0.70.53",
60
- "@stacksjs/cli": "0.70.53",
61
- "@stacksjs/config": "0.70.53",
58
+ "@stacksjs/actions": "0.70.54",
59
+ "@stacksjs/arrays": "0.70.54",
60
+ "@stacksjs/cli": "0.70.54",
61
+ "@stacksjs/config": "0.70.54",
62
62
  "better-dx": "^0.2.12",
63
- "@stacksjs/lint": "0.70.53",
64
- "@stacksjs/path": "0.70.53",
65
- "@stacksjs/storage": "0.70.53",
66
- "@stacksjs/strings": "0.70.53",
67
- "@stacksjs/types": "0.70.53"
63
+ "@stacksjs/lint": "0.70.54",
64
+ "@stacksjs/path": "0.70.54",
65
+ "@stacksjs/storage": "0.70.54",
66
+ "@stacksjs/strings": "0.70.54",
67
+ "@stacksjs/types": "0.70.54"
68
68
  }
69
69
  }