@stacksjs/utils 0.70.36 → 0.70.42
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.
- package/dist/index.js +10 -10
- package/dist/package.json +1 -0
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{path as O}from"@stacksjs/path";async function
|
|
3
|
-
`).filter(Boolean)){let f=H.replace($,"").replace(/^\//,"");T.push({name:f,path:H})}}catch{}return T}function
|
|
4
|
-
`)}import g from"fs/promises";import
|
|
5
|
-
`).find((H)=>H.startsWith("APP_KEY="));return!!(P&&P.length>16)}function
|
|
2
|
+
import{path as O}from"@stacksjs/path";async function F0(){await Bun.$`rm -rf ${O.projectPath("bun.lock")}`,await Bun.$`rm -rf ${O.projectPath("yarn.lock")}`,await Bun.$`rm -rf ${O.projectPath("node_modules/")}`,await Bun.$`rm -rf ${O.frameworkPath("dist")}`,await Bun.$`rm -rf ${O.frameworkPath("node_modules")}`,await Bun.$`rm -rf ${O.frameworkPath("**/dist")}`,await Bun.$`rm -rf ${O.frameworkPath("**/node_modules")}`,await Bun.$`rm -rf ${O.frameworkCloudPath("cdk.out/")}`,await Bun.$`rm -rf ${O.frameworkCloudPath("cdk.context.json")}`,await Bun.$`rm -rf ${O.cloudPath("dist.zip")}`}import{defineApp as y0,defineCache as C0,defineCdn as p0,defineChat as g0,defineCli as b0,defineDatabase as m0,defineDependencies as u0,defineDns as d0,defineEmail as c0,defineEmailConfig as n0,defineGit as i0,defineHashing as s0,defineLibrary as r0,defineNotification as a0,definePayment as o0,defineQueue as l0,defineSearchEngine as t0,defineServices as e0,defineSms as $$,defineFilesystems as T$,defineUi as P$}from"@stacksjs/config";import{getTypeName as S}from"@stacksjs/types";function v($,T,P=new WeakMap){if($===T)return!0;if(typeof $==="number"&&typeof T==="number"&&Number.isNaN($)&&Number.isNaN(T))return!0;let H=S($),f=S(T);if(H!==f)return!1;if($&&typeof $==="object"){if(P.get($)===T)return!0;P.set($,T)}if(H==="array"){if($.length!==T.length)return!1;return $.every((Q,q)=>v(Q,T[q],P))}if(H==="object"){let Q=Object.keys($);if(Q.length!==Object.keys(T).length)return!1;return Q.every((q)=>v($[q],T[q],P))}return Object.is($,T)}import{stat as $0}from"fs/promises";var C=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],p=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];function L($,T={}){let{precision:P=1,binary:H=!1,space:f=!0,locale:Q="en-US",minimumFractionDigits:q=0,maximumFractionDigits:E=P}=T;if(!Number.isFinite($))throw TypeError(`Expected a finite number, got ${typeof $}: ${$}`);let _=$<0,B=_?"-":"";if(_)$=-$;if($<1){let e=$.toLocaleString(Q,{minimumFractionDigits:q,maximumFractionDigits:E});return`${B}${e}${f?" ":""}B`}let G=H?1024:1000,J=H?p:C,U=Math.min(Math.floor(Math.log($)/Math.log(G)),J.length-1),Y=($/G**U).toLocaleString(Q,{minimumFractionDigits:q,maximumFractionDigits:E}),W=J[U];return`${B}${Y}${f?" ":""}${W}`}function y($){let T=$.match(/^(-?[\d.]+)\s*([A-Za-z]+)?$/);if(!T)throw Error(`Invalid byte string: ${$}`);let[,P,H="B"]=T;if(P===void 0)throw Error(`Invalid byte string: ${$}`);let f=Number.parseFloat(P);if(!Number.isFinite(f))throw Error(`Invalid number in byte string: ${P}`);let Q=H.toUpperCase(),q=Q.endsWith("IB"),E=q?1024:1000,_=0,B=q?p:C;for(let G=0;G<B.length;G++)if(B[G]?.toUpperCase()===Q){_=G;break}return f*E**_}function Q$($,T){let P=typeof $==="string"?y($):$,H=typeof T==="string"?y(T):T;return P-H}var q$=L,X$=L;async function T0($){try{return(await $0($)).size}catch{return 0}}async function P0($){let T=[],P=0;try{let H=await H0($);for(let f of H){let Q=await T0(f.path);P+=Q,T.push({name:f.name,size:Q,readable:L(Q)})}}catch(H){}return{totalSize:P,totalReadable:L(P),exports:T.sort((H,f)=>f.size-H.size)}}async function H0($){let T=[];try{let P=await Bun.$.throws(!1)`find ${$} -type f \\( -name "*.js" -o -name "*.mjs" -o -name "*.cjs" \\)`.text();for(let H of P.split(`
|
|
3
|
+
`).filter(Boolean)){let f=H.replace($,"").replace(/^\//,"");T.push({name:f,path:H})}}catch{}return T}function f0($){return Math.floor($*0.3)}function Q0($){return Math.floor($*0.25)}function E$($){if($.exports.length===0)return"No exports found";let T=["Export Sizes:",""],P=Math.max(...$.exports.map((H)=>H.name.length));for(let H of $.exports){let f=H.name.padEnd(P," ");T.push(` ${f} ${H.readable}`)}return T.push(""),T.push(`Total: ${$.totalReadable}`),T.push(`Estimated gzipped: ${L(f0($.totalSize))}`),T.push(`Estimated brotli: ${L(Q0($.totalSize))}`),T.join(`
|
|
4
|
+
`)}import g from"fs/promises";import D from"os";import b from"path";import{italic as k}from"@stacksjs/cli";import{log as A}from"@stacksjs/logging";var q0="buddy",m=["node_modules","dist","vendor","storage/framework",`${D.homedir()}/Documents`,`${D.homedir()}/Pictures`,`${D.homedir()}/Library`,`${D.homedir()}/.Trash`,/.*out.*/,/.*\/\..*/];async function I$($,T){if($=$||D.homedir(),!T?.quiet)A.info(`Searching for Stacks projects in: ${k($)}`),A.info("This may take a few moments..."),console.log(""),console.log(k(" Please note, while Stacks is searching for projects on your machine,")),console.log(k(" you may be asked for permissions to scan certain directories.")),console.log(""),A.debug(`Excluding directories: ${m.join(", ")}`);let P=await u($);if(!P)throw Error("No Stacks projects found");return P}async function u($){let T=[];if(m.some((q)=>typeof q==="string"?$.includes(q):q.test($)))return T;let H;try{H=await g.readdir($,{withFileTypes:!0})}catch(q){return console.error(`Error reading directory ${$}:`,q),T}let f=!1,Q=!1;for(let q of H){if(q.isFile()&&q.name===q0)f=!0;if(q.isDirectory()){let E=b.join($,q.name);if(q.name==="storage"){let B=b.join(E,"framework/core/buddy");try{await g.access(B),Q=!0}catch{}}let _=await u(E);T.push(..._)}}if(f&&Q)T.push($);return T}import{execSync as X0}from"child_process";import{handleError as Z0}from"@stacksjs/error-handling";function N$(){try{return X0("git diff-index --quiet HEAD --"),!0}catch($){return Z0($),!1}}import{config as V0}from"@stacksjs/config";import{log as d}from"@stacksjs/logging";import{path as M}from"@stacksjs/path";import{hashPaths as N}from"@stacksjs/storage";function x$(){try{return N(M.cloudPath("src/edge"))}catch($){d.error("Are we in a Docker container? Failed to hash paths. Error below:"),d.error($);return}}function w$(){let $=[M.projectPath("docs"),M.frameworkPath("docs/dist")],T=[M.projectPath("resources/views"),M.projectPath("resources/assets"),M.projectPath("resources/lang"),M.projectPath("resources/functions"),M.projectPath("resources/components"),M.projectPath("resources/modules"),M.projectPath("resources/stores"),M.frameworkPath("views/web")];return V0.app.docMode===!0?N($):N(T)}function F$(){let $=[M.projectPath("docs"),M.frameworkPath("docs/dist")];return N($)}import{runAction as _0}from"@stacksjs/actions";import{log as c,runCommand as E0}from"@stacksjs/cli";import{app as s,ui as n}from"@stacksjs/config";import{Action as B0}from"@stacksjs/enums";import{err as r,handleError as x,ok as G0}from"@stacksjs/error-handling";import{frameworkPath as w,projectPath as I}from"@stacksjs/path";import{fs as z,readJsonFile as U0,readPackageJson as a,readTextFile as o,writeTextFile as J0}from"@stacksjs/storage";async function m$(){let{packageManager:$}=await a(w("package.json"));return $}async function u$(){if(s.env!=="production")c.info("Project not yet initialized, generating application key...");else x("Please run `buddy key:generate` to generate an application key");let $=await _0(B0.KeyGenerate,{cwd:I()});if($.isErr)return r(x($.error));return c.info("Application key generated."),G0($.value)}async function d$(){if(z.existsSync(I(".env")))return await i();if(z.existsSync(I(".env.example")))z.copyFileSync(I(".env.example"),I(".env"));else console.error("no .env.example file found");return await i()}async function c$(){}async function n$(){return(await a(w("package.json"))).version}async function i(){let P=(await o(".env",I())).data.split(`
|
|
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
|
|
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
|
|
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.42";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
|
+
`),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(`
|
|
12
12
|
`))return`
|
|
13
|
-
`;if($.includes("\r"))return"\r";return null}function
|
|
14
|
-
`){return
|
|
15
|
-
`){return $.replace(/\r\n|\r|\n/g,T)}function
|
|
16
|
-
`)}function F($,T,P,H,f,Q){let q=$.map((B,G)=>{let J=T[G]??0;return B.padEnd(J," ")}),E=P?" ":"",_=q.map((B)=>`${E}${B}${E}`).join(H);if(f)_=H+_;if(Q)_=_+H;return _}function
|
|
13
|
+
`;if($.includes("\r"))return"\r";return null}function NT($,T=`
|
|
14
|
+
`){return D0($)||T}function RT($,T=`
|
|
15
|
+
`){return $.replace(/\r\n|\r|\n/g,T)}function kT($){let T=($.match(/\r\n/g)||[]).length,P=($.match(/\r(?!\n)/g)||[]).length,H=($.match(/(?<!\r)\n/g)||[]).length;return{crlf:T,lf:H,cr:P,total:T+H+P}}function zT($,T=0,P={}){let{leading:H=!1,trailing:f=!0}=P,Q=null,q=null,E=null,_,B=()=>{if(q)_=$.apply(E,q),q=null,E=null;return _},G=()=>{if(Q)clearTimeout(Q),Q=null;q=null,E=null},J=()=>{if(Q)return clearTimeout(Q),Q=null,B();return _},U=function(...K){q=K,E=this;let Y=H&&!Q;if(Q)clearTimeout(Q);if(Q=setTimeout(()=>{if(Q=null,f&&q)B()},T),Y)return B();return _};return U.cancel=G,U.flush=J,U}function hT($,T=0){let P=null,H=0,f=null,Q=null,q=()=>{if(f)$.apply(Q,f),f=null,Q=null,H=Date.now()},E=()=>{if(P)clearTimeout(P),P=null;f=null,Q=null},_=function(...B){f=B,Q=this;let J=Date.now()-H;if(J>=T)q();else if(!P)P=setTimeout(()=>{P=null,q()},T-J)};return _.cancel=E,_}function xT($){return new Promise((T)=>setTimeout(T,$))}var X=!process.env.NO_COLOR&&(process.env.FORCE_COLOR||process.stdout?.isTTY),Z={reset:X?"\x1B[0m":"",black:X?"\x1B[30m":"",red:X?"\x1B[31m":"",green:X?"\x1B[32m":"",yellow:X?"\x1B[33m":"",blue:X?"\x1B[34m":"",magenta:X?"\x1B[35m":"",cyan:X?"\x1B[36m":"",white:X?"\x1B[37m":"",gray:X?"\x1B[90m":"",grey:X?"\x1B[90m":"",lightRed:X?"\x1B[91m":"",lightGreen:X?"\x1B[92m":"",lightYellow:X?"\x1B[93m":"",lightBlue:X?"\x1B[94m":"",lightMagenta:X?"\x1B[95m":"",lightCyan:X?"\x1B[96m":"",lightGray:X?"\x1B[37m":"",lightGrey:X?"\x1B[37m":"",bgBlack:X?"\x1B[40m":"",bgRed:X?"\x1B[41m":"",bgGreen:X?"\x1B[42m":"",bgYellow:X?"\x1B[43m":"",bgBlue:X?"\x1B[44m":"",bgMagenta:X?"\x1B[45m":"",bgCyan:X?"\x1B[46m":"",bgWhite:X?"\x1B[47m":"",bgLightRed:X?"\x1B[101m":"",bgLightGreen:X?"\x1B[102m":"",bgLightYellow:X?"\x1B[103m":"",bgLightBlue:X?"\x1B[104m":"",bgLightMagenta:X?"\x1B[105m":"",bgLightCyan:X?"\x1B[106m":"",bold:X?"\x1B[1m":"",dim:X?"\x1B[2m":"",italic:X?"\x1B[3m":"",underline:X?"\x1B[4m":"",inverse:X?"\x1B[7m":"",hidden:X?"\x1B[8m":"",strikethrough:X?"\x1B[9m":""};function V($,T=Z.reset){return(P)=>{if(!X)return String(P);return`${$}${P}${T}`}}var FT=V(Z.black),jT=V(Z.red),ST=V(Z.green),vT=V(Z.yellow),yT=V(Z.blue),CT=V(Z.magenta),pT=V(Z.cyan),gT=V(Z.white),N0=V(Z.gray),bT=N0,mT=V(Z.lightRed),uT=V(Z.lightGreen),dT=V(Z.lightYellow),cT=V(Z.lightBlue),nT=V(Z.lightMagenta),iT=V(Z.lightCyan),R0=V(Z.lightGray),sT=R0,rT=V(Z.bgBlack),aT=V(Z.bgRed),oT=V(Z.bgGreen),lT=V(Z.bgYellow),tT=V(Z.bgBlue),eT=V(Z.bgMagenta),$4=V(Z.bgCyan),T4=V(Z.bgWhite),P4=V(Z.bgLightRed),H4=V(Z.bgLightGreen),f4=V(Z.bgLightYellow),Q4=V(Z.bgLightBlue),q4=V(Z.bgLightMagenta),X4=V(Z.bgLightCyan),Z4=V(Z.bold),V4=V(Z.dim),_4=V(Z.italic),E4=V(Z.underline),B4=V(Z.inverse),G4=V(Z.hidden),U4=V(Z.strikethrough),J4=V(Z.reset,"");function K4($){return $.replace(/\x1B\[\d+m/g,"")}function M4(){return!!X}function k0($,T={}){let{align:P=[],padding:H=!0,delimiter:f="|",delimiterStart:Q=!0,delimiterEnd:q=!0,alignDelimiter:E="-"}=T;if(!$||$.length===0)return"";let _=$.map((U)=>U.map((K)=>{if(K===null||K===void 0)return"";return String(K)})),B=Math.max(..._.map((U)=>U.length)),G=Array.from({length:B}).fill(0);for(let U of _)for(let K=0;K<U.length;K++){let Y=U[K]?.length??0;if(Y>(G[K]??0))G[K]=Y}let J=[];if(_.length>0){let U=_[0]??[];J.push(F(U,G,H,f,Q,q));let K=G.map((Y,W)=>{let j=z0(P[W]);return A0(Y,j,E)});J.push(F(K,G,H,f,Q,q));for(let Y=1;Y<_.length;Y++){let W=_[Y]??[];J.push(F(W,G,H,f,Q,q))}}return J.join(`
|
|
16
|
+
`)}function F($,T,P,H,f,Q){let q=$.map((B,G)=>{let J=T[G]??0;return B.padEnd(J," ")}),E=P?" ":"",_=q.map((B)=>`${E}${B}${E}`).join(H);if(f)_=H+_;if(Q)_=_+H;return _}function A0($,T,P){let H=T==="center"?3:T?2:1;if($<H)$=H;let f=P.repeat($);if(T==="left")f=`:${f.slice(1)}`;else if(T==="right")f=f.slice(0,-1)+":";else if(T==="center")f=`:${f.slice(2)}:`;return f}function z0($){if(!$)return null;switch($){case"l":case"left":return"left";case"c":case"center":return"center";case"r":case"right":return"right";default:return null}}function O4($,T={}){if(!$||$.length===0)return"";let P=Array.from(new Set($.flatMap((f)=>Object.keys(f)))),H=[P,...$.map((f)=>P.map((Q)=>f[Q]))];return k0(H,T)}function h0(){return typeof window<"u"&&"ResizeObserver"in window}function l(){if(h0())return window.ResizeObserver;return class{callback;observedElements=new Set;rafId=null;constructor(T){this.callback=T}observe(T){if(!this.observedElements.has(T))this.observedElements.add(T),this.scheduleCheck()}unobserve(T){if(this.observedElements.delete(T),this.observedElements.size===0&&this.rafId!==null)(typeof cancelAnimationFrame<"u"?cancelAnimationFrame:clearTimeout)(this.rafId),this.rafId=null}disconnect(){if(this.observedElements.clear(),this.rafId!==null)(typeof cancelAnimationFrame<"u"?cancelAnimationFrame:clearTimeout)(this.rafId),this.rafId=null}scheduleCheck(){if(this.rafId!==null)return;let T=typeof requestAnimationFrame<"u"?requestAnimationFrame:setTimeout;this.rafId=T(()=>{if(this.check(),this.rafId=null,this.observedElements.size>0)this.scheduleCheck()})}check(){let T=[];for(let P of this.observedElements){let H=P.getBoundingClientRect(),f={target:P,contentRect:H,borderBoxSize:[{inlineSize:H.width,blockSize:H.height}],contentBoxSize:[{inlineSize:H.width,blockSize:H.height}],devicePixelContentBoxSize:[{inlineSize:H.width,blockSize:H.height}]};T.push(f)}if(T.length>0)this.callback(T,this)}}}function x0($,T){let H=new(l())($),f=Array.isArray(T)?T:[T];for(let Q of f)H.observe(Q);return()=>{H.disconnect()}}function L4($,T){return x0((P)=>{let H=P.find((f)=>f.target===$);if(H)T(H)},$)}var W4=l();class t{passable;pipes=[];method="handle";static send($){let T=new t;return T.passable=$,T}through($){return this.pipes=$,this}pipe(...$){return this.pipes.push(...$),this}via($){return this.method=$,this}then($){return this.pipes.reduceRight((P,H)=>{return(f)=>{if(typeof H==="function")return H(f,P);let Q=H[this.method];if(typeof Q==="function")return Q.call(H,f,P);return P(f)}},$)(this.passable)}thenReturn(){return this.then(($)=>$)}}export{vT as yellow,gT as white,w$ as websiteSourceHash,I0 as version,u4 as useOnline,E4 as underline,hT as throttle,M4 as supportsColor,K4 as stripColors,U4 as strikethrough,s$ as setEnvValue,BT as semver,ZT as safeJsonStringify,XT as safeJsonParseResult,qT as safeJsonParse,r$ as runNpmScript,m4 as retry,J4 as reset,jT as red,X$ as readableSize,q$ as prettyBytes,a$ as parseYaml,y as parseBytes,m$ as packageManager,x$ as originRequestFunctionHash,L4 as observeElementSize,b4 as notNullish,RT as normalizeNewlines,L0 as mergeDefaults,R as merge,O4 as markdownTableFromObjects,k0 as markdownTable,CT as magenta,PT as macroable,e$ as loadYaml,dT as lightYellow,mT as lightRed,nT as lightMagenta,sT as lightGrey,uT as lightGreen,R0 as lightGray,iT as lightCyan,cT as lightBlue,_4 as italic,MT as isVersionLessThanOrEqual,UT as isVersionLessThan,KT as isVersionGreaterThanOrEqual,GT as isVersionGreaterThan,JT as isVersionEqual,h0 as isResizeObserverSupported,h as isOptionalString,K0 as isManifest,l$ as isIpv6,N$ as isGitClean,v as isDeepEqual,i as isAppKeySet,B4 as inverse,c$ as installIfVersionMismatch,u$ as initProject,G4 as hidden,M0 as hasScript,bT as grey,ST as green,N0 as gray,l as getResizeObserver,T0 as getFileSize,P0 as getExportsSize,n$ as frameworkVersion,E$ as formatExportSizes,L as formatBytes,I$ as findStacksProjects,f0 as estimateGzipSize,Q0 as estimateBrotliSize,d$ as ensureProjectIsInitialized,t$ as dumpYaml,F$ as docsSourceHash,V4 as dim,i$ as determineResetPreset,o$ as determineDebugLevel,NT as detectNewlineGraceful,D0 as detectNewline,DT as detectIndent,xT as delay,LT as defuArrayFn,IT as defu,P$ as defineUi,$$ as defineSms,e0 as defineServices,t0 as defineSearchEngine,l0 as defineQueue,o0 as definePayment,a0 as defineNotification,r0 as defineLibrary,s0 as defineHashing,i0 as defineGit,T$ as defineFilesystems,n0 as defineEmailConfig,c0 as defineEmail,d0 as defineDns,u0 as defineDependencies,m0 as defineDatabase,b0 as defineCli,g0 as defineChat,p0 as defineCdn,C0 as defineCache,y0 as defineApp,zT as debounce,pT as cyan,x0 as createResizeObserver,OT as createMerger,TT as createMacroable,kT as countNewlines,Q$ as compareBytes,F0 as cleanProject,g4 as clamp,C4 as browserUtils,Z4 as bold,yT as blue,FT as black,lT as bgYellow,T4 as bgWhite,aT as bgRed,eT as bgMagenta,f4 as bgLightYellow,P4 as bgLightRed,q4 as bgLightMagenta,H4 as bgLightGreen,X4 as bgLightCyan,Q4 as bgLightBlue,oT as bgGreen,$4 as bgCyan,tT as bgBlue,rT as bgBlack,W4 as ResizeObserver,t as Pipeline,Y0 as Macroable};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.70.
|
|
4
|
+
"version": "0.70.42",
|
|
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.
|
|
55
|
+
"@stacksjs/browser": "^0.70.42"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@stacksjs/actions": "0.70.
|
|
59
|
-
"@stacksjs/arrays": "0.70.
|
|
60
|
-
"@stacksjs/cli": "0.70.
|
|
61
|
-
"@stacksjs/config": "0.70.
|
|
58
|
+
"@stacksjs/actions": "^0.70.42",
|
|
59
|
+
"@stacksjs/arrays": "^0.70.42",
|
|
60
|
+
"@stacksjs/cli": "^0.70.42",
|
|
61
|
+
"@stacksjs/config": "^0.70.42",
|
|
62
62
|
"better-dx": "^0.2.12",
|
|
63
|
-
"@stacksjs/lint": "0.70.
|
|
64
|
-
"@stacksjs/path": "0.70.
|
|
65
|
-
"@stacksjs/storage": "0.70.
|
|
66
|
-
"@stacksjs/strings": "0.70.
|
|
67
|
-
"@stacksjs/types": "0.70.
|
|
63
|
+
"@stacksjs/lint": "^0.70.42",
|
|
64
|
+
"@stacksjs/path": "^0.70.42",
|
|
65
|
+
"@stacksjs/storage": "^0.70.42",
|
|
66
|
+
"@stacksjs/strings": "^0.70.42",
|
|
67
|
+
"@stacksjs/types": "^0.70.42"
|
|
68
68
|
}
|
|
69
69
|
}
|