@stacksjs/utils 0.70.43 → 0.70.45

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 O}from"@stacksjs/path";async function F0(){await Bun.$`rm -rf ${O
5
5
  `).find((H)=>H.startsWith("APP_KEY="));return!!(P&&P.length>16)}function i$($){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 K0($){return $&&typeof $==="object"&&h($.name)&&h($.version)&&h($.description)}function h($){let T=typeof $;return $===null||T==="undefined"||T==="string"}async function s$($,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 J0({path:I(".env"),data:q})}async function r$($,T){let{data:P}=await U0("package.json",w());if(K0(P)&&M0(P,$))return await E0(`bun run ${$}`,T);return r(x(`The ${$} script does not exist in the package.json file.`))}function M0($,T){let P=$.scripts;if(P&&typeof P==="object")return Boolean(P[T]);return!1}function a$($){return Bun.YAML.parse($)}function o$($){if($?.verbose===!0)return!0;return s.debug===!0}function l$($){return $.family==="IPv6"||$.family===6}function t$($){let T=Bun.YAML;if(typeof T.stringify==="function")return T.stringify($);return JSON.stringify($,null,2)}function e$($){return Bun.YAML.parse($)}class Y0{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 TT($=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 PT($){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 qT($,T){if(typeof $!=="string"||$.length===0)return T;try{return JSON.parse($)}catch{return T}}function XT($){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 ZT($,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 I0="0.70.43";var BT=Bun.semver;function GT($,T){return Bun.semver.order($,T)===1}function UT($,T){return Bun.semver.order($,T)===-1}function JT($,T){return Bun.semver.order($,T)===0}function KT($,T){return Bun.semver.order($,T)>=0}function MT($,T){return Bun.semver.order($,T)<=0}import*as C4 from"@stacksjs/browser";import{clamp as g4,notNullish as b4,retry as m4,useOnline as u4}from"@stacksjs/browser";function R(...$){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"&&!W0(f))T[H]=R(Q||{},f);else T[H]=f}}return T}function OT($){return(...T)=>{return R($,...T)}}function L0($,...T){return R({},...T,$)}function W0($){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 IT=L0,LT=R;function DT($){let T=$.split(`
8
+ `;await J0({path:I(".env"),data:q})}async function r$($,T){let{data:P}=await U0("package.json",w());if(K0(P)&&M0(P,$))return await E0(`bun run ${$}`,T);return r(x(`The ${$} script does not exist in the package.json file.`))}function M0($,T){let P=$.scripts;if(P&&typeof P==="object")return Boolean(P[T]);return!1}function a$($){return Bun.YAML.parse($)}function o$($){if($?.verbose===!0)return!0;return s.debug===!0}function l$($){return $.family==="IPv6"||$.family===6}function t$($){let T=Bun.YAML;if(typeof T.stringify==="function")return T.stringify($);return JSON.stringify($,null,2)}function e$($){return Bun.YAML.parse($)}class Y0{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 TT($=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 PT($){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 qT($,T){if(typeof $!=="string"||$.length===0)return T;try{return JSON.parse($)}catch{return T}}function XT($){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 ZT($,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 I0="0.70.45";var BT=Bun.semver;function GT($,T){return Bun.semver.order($,T)===1}function UT($,T){return Bun.semver.order($,T)===-1}function JT($,T){return Bun.semver.order($,T)===0}function KT($,T){return Bun.semver.order($,T)>=0}function MT($,T){return Bun.semver.order($,T)<=0}import*as C4 from"@stacksjs/browser";import{clamp as g4,notNullish as b4,retry as m4,useOnline as u4}from"@stacksjs/browser";function R(...$){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"&&!W0(f))T[H]=R(Q||{},f);else T[H]=f}}return T}function OT($){return(...T)=>{return R($,...T)}}function L0($,...T){return R({},...T,$)}function W0($){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 IT=L0,LT=R;function DT($){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 D0($){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.43",
4
+ "version": "0.70.45",
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.43"
55
+ "@stacksjs/browser": "^0.70.45"
56
56
  },
57
57
  "devDependencies": {
58
- "@stacksjs/actions": "^0.70.43",
59
- "@stacksjs/arrays": "^0.70.43",
60
- "@stacksjs/cli": "^0.70.43",
61
- "@stacksjs/config": "^0.70.43",
58
+ "@stacksjs/actions": "^0.70.45",
59
+ "@stacksjs/arrays": "^0.70.45",
60
+ "@stacksjs/cli": "^0.70.45",
61
+ "@stacksjs/config": "^0.70.45",
62
62
  "better-dx": "^0.2.12",
63
- "@stacksjs/lint": "^0.70.43",
64
- "@stacksjs/path": "^0.70.43",
65
- "@stacksjs/storage": "^0.70.43",
66
- "@stacksjs/strings": "^0.70.43",
67
- "@stacksjs/types": "^0.70.43"
63
+ "@stacksjs/lint": "^0.70.45",
64
+ "@stacksjs/path": "^0.70.45",
65
+ "@stacksjs/storage": "^0.70.45",
66
+ "@stacksjs/strings": "^0.70.45",
67
+ "@stacksjs/types": "^0.70.45"
68
68
  }
69
69
  }