@stacksjs/utils 0.70.64 → 0.70.66

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((H)=>H.startsWith("APP_KEY="));return!!(f&&f.length>16)}function eT($){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 O$($){return $&&typeof $==="object"&&w($.name)&&w($.version)&&w($.description)}function w($){let T=typeof $;return $===null||T==="undefined"||T==="string"}async function $f($,T){let f=await o(I(".env")),H=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Q=new RegExp(`^${H}=.*$`,"m"),X=`${$}=${T}`,_=Q.test(f.data)?f.data.replace(Q,X):`${f.data}${f.data.endsWith(`
6
6
  `)?"":`
7
7
  `}${X}
8
- `;await M$({path:I(".env"),data:_})}async function Tf($,T){let{data:f}=await K$("package.json",h());if(O$(f)&&L$(f,$))return await J$(`bun run ${$}`,T);return r(x(`The ${$} script does not exist in the package.json file.`))}function L$($,T){let f=$.scripts;if(f&&typeof f==="object")return Boolean(f[T]);return!1}function ff($){return Bun.YAML.parse($)}function Hf($){if($?.verbose===!0)return!0;return s.debug===!0}function Qf($){return $.family==="IPv6"||$.family===6}function Xf($){let T=Bun.YAML;if(typeof T.stringify==="function")return T.stringify($);return JSON.stringify($,null,2)}function Zf($){return Bun.YAML.parse($)}class I${static macros=new Map;static macro($,T,f=!1){if(this.macros.has($)&&!f)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 f=Object.getOwnPropertyNames($);for(let H of f){if(H==="constructor")continue;if(this.macros.has(H)&&!T)continue;let Q=Object.getOwnPropertyDescriptor($,H);if(Q&&typeof Q.value==="function")this.macro(H,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 f=this.constructor.macros.get($);if(!f)throw Error(`Macro "${$}" is not registered`);return f.apply(this,T)}}function Vf($=class{}){return class extends ${static macros=new Map;static macro(T,f,H=!1){if(this.macros.has(T)&&!H)throw Error(`Macro "${T}" is already registered`);this.macros.set(T,f),Object.defineProperty(this.prototype,T,{value:f,writable:!0,configurable:!0,enumerable:!1})}static mixin(T,f=!0){let H=Object.getOwnPropertyNames(T);for(let Q of H){if(Q==="constructor")continue;if(this.macros.has(Q)&&!f)continue;let X=Object.getOwnPropertyDescriptor(T,Q);if(X&&typeof X.value==="function")this.macro(Q,X.value,f)}}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 _f($){let T=new Map;return $.macro=function(f,H,Q=!1){if(T.has(f)&&!Q)throw Error(`Macro "${f}" is already registered`);T.set(f,H),Object.defineProperty($.prototype,f,{value:H,writable:!0,configurable:!0,enumerable:!1})},$.mixin=function(f,H=!0){let Q=Object.getOwnPropertyNames(f);for(let X of Q){if(X==="constructor")continue;if(T.has(X)&&!H)continue;let _=Object.getOwnPropertyDescriptor(f,X);if(_&&typeof _.value==="function")$.macro(X,_.value,H)}},$.hasMacro=function(f){return T.has(f)},$.flushMacros=function(){for(let f of T.keys())delete $.prototype[f];T.clear()},$.getMacros=function(){return Array.from(T.keys())},$}function Jf($,T){if(typeof $!=="string"||$.length===0)return T;try{return JSON.parse($)}catch{return T}}function Uf($){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 Yf($,T){let f=new WeakSet;return JSON.stringify($,(H,Q)=>{if(typeof Q==="bigint")return Q.toString();if(Q&&typeof Q==="object"){if(f.has(Q))return"[Circular]";f.add(Q)}return Q},T)}var k$="0.70.64";var Lf=Bun.semver;function If($,T){return Bun.semver.order($,T)===1}function Wf($,T){return Bun.semver.order($,T)===-1}function kf($,T){return Bun.semver.order($,T)===0}function Df($,T){return Bun.semver.order($,T)>=0}function Ef($,T){return Bun.semver.order($,T)<=0}import*as iH from"@stacksjs/browser";import{clamp as rH,notNullish as aH,retry as oH,useOnline as lH}from"@stacksjs/browser";function N(...$){let T={};for(let f of $){if(!f||typeof f!=="object")continue;for(let H in f){let Q=f[H],X=T[H];if(Q===void 0)continue;if(Array.isArray(Q))T[H]=Array.isArray(X)?[...X,...Q]:[...Q];else if(Q&&typeof Q==="object"&&!E$(Q))T[H]=N(X||{},Q);else T[H]=Q}}return T}function Rf($){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 zf=D$,Af=N;function xf($){let T=$.split(`
8
+ `;await M$({path:I(".env"),data:_})}async function Tf($,T){let{data:f}=await K$("package.json",h());if(O$(f)&&L$(f,$))return await J$(`bun run ${$}`,T);return r(x(`The ${$} script does not exist in the package.json file.`))}function L$($,T){let f=$.scripts;if(f&&typeof f==="object")return Boolean(f[T]);return!1}function ff($){return Bun.YAML.parse($)}function Hf($){if($?.verbose===!0)return!0;return s.debug===!0}function Qf($){return $.family==="IPv6"||$.family===6}function Xf($){let T=Bun.YAML;if(typeof T.stringify==="function")return T.stringify($);return JSON.stringify($,null,2)}function Zf($){return Bun.YAML.parse($)}class I${static macros=new Map;static macro($,T,f=!1){if(this.macros.has($)&&!f)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 f=Object.getOwnPropertyNames($);for(let H of f){if(H==="constructor")continue;if(this.macros.has(H)&&!T)continue;let Q=Object.getOwnPropertyDescriptor($,H);if(Q&&typeof Q.value==="function")this.macro(H,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 f=this.constructor.macros.get($);if(!f)throw Error(`Macro "${$}" is not registered`);return f.apply(this,T)}}function Vf($=class{}){return class extends ${static macros=new Map;static macro(T,f,H=!1){if(this.macros.has(T)&&!H)throw Error(`Macro "${T}" is already registered`);this.macros.set(T,f),Object.defineProperty(this.prototype,T,{value:f,writable:!0,configurable:!0,enumerable:!1})}static mixin(T,f=!0){let H=Object.getOwnPropertyNames(T);for(let Q of H){if(Q==="constructor")continue;if(this.macros.has(Q)&&!f)continue;let X=Object.getOwnPropertyDescriptor(T,Q);if(X&&typeof X.value==="function")this.macro(Q,X.value,f)}}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 _f($){let T=new Map;return $.macro=function(f,H,Q=!1){if(T.has(f)&&!Q)throw Error(`Macro "${f}" is already registered`);T.set(f,H),Object.defineProperty($.prototype,f,{value:H,writable:!0,configurable:!0,enumerable:!1})},$.mixin=function(f,H=!0){let Q=Object.getOwnPropertyNames(f);for(let X of Q){if(X==="constructor")continue;if(T.has(X)&&!H)continue;let _=Object.getOwnPropertyDescriptor(f,X);if(_&&typeof _.value==="function")$.macro(X,_.value,H)}},$.hasMacro=function(f){return T.has(f)},$.flushMacros=function(){for(let f of T.keys())delete $.prototype[f];T.clear()},$.getMacros=function(){return Array.from(T.keys())},$}function Jf($,T){if(typeof $!=="string"||$.length===0)return T;try{return JSON.parse($)}catch{return T}}function Uf($){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 Yf($,T){let f=new WeakSet;return JSON.stringify($,(H,Q)=>{if(typeof Q==="bigint")return Q.toString();if(Q&&typeof Q==="object"){if(f.has(Q))return"[Circular]";f.add(Q)}return Q},T)}var k$="0.70.66";var Lf=Bun.semver;function If($,T){return Bun.semver.order($,T)===1}function Wf($,T){return Bun.semver.order($,T)===-1}function kf($,T){return Bun.semver.order($,T)===0}function Df($,T){return Bun.semver.order($,T)>=0}function Ef($,T){return Bun.semver.order($,T)<=0}import*as iH from"@stacksjs/browser";import{clamp as rH,notNullish as aH,retry as oH,useOnline as lH}from"@stacksjs/browser";function N(...$){let T={};for(let f of $){if(!f||typeof f!=="object")continue;for(let H in f){let Q=f[H],X=T[H];if(Q===void 0)continue;if(Array.isArray(Q))T[H]=Array.isArray(X)?[...X,...Q]:[...Q];else if(Q&&typeof Q==="object"&&!E$(Q))T[H]=N(X||{},Q);else T[H]=Q}}return T}function Rf($){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 zf=D$,Af=N;function xf($){let T=$.split(`
9
9
  `),f=[];for(let P of T){if(!P.trim())continue;let B=P.match(/^(\s+)/);if(B&&B[1]!==void 0)f.push(B[1])}if(f.length===0)return{amount:0,type:null,indent:""};let H=new Map;for(let P of f)H.set(P,(H.get(P)||0)+1);let Q="",X=0;for(let[P,B]of H)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.64",
4
+ "version": "0.70.66",
5
5
  "description": "The Stacks helper functions.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -57,18 +57,18 @@
57
57
  "size": "bun scripts/export-size.ts"
58
58
  },
59
59
  "dependencies": {
60
- "@stacksjs/browser": "0.70.64"
60
+ "@stacksjs/browser": "0.70.66"
61
61
  },
62
62
  "devDependencies": {
63
- "@stacksjs/actions": "0.70.64",
64
- "@stacksjs/arrays": "0.70.64",
65
- "@stacksjs/cli": "0.70.64",
66
- "@stacksjs/config": "0.70.64",
63
+ "@stacksjs/actions": "0.70.66",
64
+ "@stacksjs/arrays": "0.70.66",
65
+ "@stacksjs/cli": "0.70.66",
66
+ "@stacksjs/config": "0.70.66",
67
67
  "better-dx": "^0.2.12",
68
- "@stacksjs/lint": "0.70.64",
69
- "@stacksjs/path": "0.70.64",
70
- "@stacksjs/storage": "0.70.64",
71
- "@stacksjs/strings": "0.70.64",
72
- "@stacksjs/types": "0.70.64"
68
+ "@stacksjs/lint": "0.70.66",
69
+ "@stacksjs/path": "0.70.66",
70
+ "@stacksjs/storage": "0.70.66",
71
+ "@stacksjs/strings": "0.70.66",
72
+ "@stacksjs/types": "0.70.66"
73
73
  }
74
74
  }