@stacksjs/utils 0.70.42 → 0.70.44
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 +9 -9
- 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 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
|
|
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
|
|
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
|
|
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 $4,defineFilesystems as T4,defineUi as P4}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 Q4($,T){let P=typeof $==="string"?y($):$,H=typeof T==="string"?y(T):T;return P-H}var q4=L,X4=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 E4($){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 I4($,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 N4(){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 x4(){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 w4(){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 F4(){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 m4(){let{packageManager:$}=await a(w("package.json"));return $}async function u4(){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 d4(){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 c4(){}async function n4(){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 i4($){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 s4($,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
|
|
8
|
+
`;await J0({path:I(".env"),data:q})}async function r4($,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 a4($){return Bun.YAML.parse($)}function o4($){if($?.verbose===!0)return!0;return s.debug===!0}function l4($){return $.family==="IPv6"||$.family===6}function t4($){let T=Bun.YAML;if(typeof T.stringify==="function")return T.stringify($);return JSON.stringify($,null,2)}function e4($){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 T$($=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 P$($){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 q$($,T){if(typeof $!=="string"||$.length===0)return T;try{return JSON.parse($)}catch{return T}}function X$($){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 Z$($,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.44";var B$=Bun.semver;function G$($,T){return Bun.semver.order($,T)===1}function U$($,T){return Bun.semver.order($,T)===-1}function J$($,T){return Bun.semver.order($,T)===0}function K$($,T){return Bun.semver.order($,T)>=0}function M$($,T){return Bun.semver.order($,T)<=0}import*as CT from"@stacksjs/browser";import{clamp as gT,notNullish as bT,retry as mT,useOnline as uT}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 O$($){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 I$=L0,L$=R;function D$($){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(`
|
|
12
12
|
`))return`
|
|
13
|
-
`;if($.includes("\r"))return"\r";return null}function
|
|
14
|
-
`){return D0($)||T}function
|
|
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 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
|
|
13
|
+
`;if($.includes("\r"))return"\r";return null}function N$($,T=`
|
|
14
|
+
`){return D0($)||T}function R$($,T=`
|
|
15
|
+
`){return $.replace(/\r\n|\r|\n/g,T)}function k$($){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 z$($,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 h$($,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 x$($){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 F$=V(Z.black),j$=V(Z.red),S$=V(Z.green),v$=V(Z.yellow),y$=V(Z.blue),C$=V(Z.magenta),p$=V(Z.cyan),g$=V(Z.white),N0=V(Z.gray),b$=N0,m$=V(Z.lightRed),u$=V(Z.lightGreen),d$=V(Z.lightYellow),c$=V(Z.lightBlue),n$=V(Z.lightMagenta),i$=V(Z.lightCyan),R0=V(Z.lightGray),s$=R0,r$=V(Z.bgBlack),a$=V(Z.bgRed),o$=V(Z.bgGreen),l$=V(Z.bgYellow),t$=V(Z.bgBlue),e$=V(Z.bgMagenta),$T=V(Z.bgCyan),TT=V(Z.bgWhite),PT=V(Z.bgLightRed),HT=V(Z.bgLightGreen),fT=V(Z.bgLightYellow),QT=V(Z.bgLightBlue),qT=V(Z.bgLightMagenta),XT=V(Z.bgLightCyan),ZT=V(Z.bold),VT=V(Z.dim),_T=V(Z.italic),ET=V(Z.underline),BT=V(Z.inverse),GT=V(Z.hidden),UT=V(Z.strikethrough),JT=V(Z.reset,"");function KT($){return $.replace(/\x1B\[\d+m/g,"")}function MT(){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 OT($,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 LT($,T){return x0((P)=>{let H=P.find((f)=>f.target===$);if(H)T(H)},$)}var WT=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{v$ as yellow,g$ as white,w4 as websiteSourceHash,I0 as version,uT as useOnline,ET as underline,h$ as throttle,MT as supportsColor,KT as stripColors,UT as strikethrough,s4 as setEnvValue,B$ as semver,Z$ as safeJsonStringify,X$ as safeJsonParseResult,q$ as safeJsonParse,r4 as runNpmScript,mT as retry,JT as reset,j$ as red,X4 as readableSize,q4 as prettyBytes,a4 as parseYaml,y as parseBytes,m4 as packageManager,x4 as originRequestFunctionHash,LT as observeElementSize,bT as notNullish,R$ as normalizeNewlines,L0 as mergeDefaults,R as merge,OT as markdownTableFromObjects,k0 as markdownTable,C$ as magenta,P$ as macroable,e4 as loadYaml,d$ as lightYellow,m$ as lightRed,n$ as lightMagenta,s$ as lightGrey,u$ as lightGreen,R0 as lightGray,i$ as lightCyan,c$ as lightBlue,_T as italic,M$ as isVersionLessThanOrEqual,U$ as isVersionLessThan,K$ as isVersionGreaterThanOrEqual,G$ as isVersionGreaterThan,J$ as isVersionEqual,h0 as isResizeObserverSupported,h as isOptionalString,K0 as isManifest,l4 as isIpv6,N4 as isGitClean,v as isDeepEqual,i as isAppKeySet,BT as inverse,c4 as installIfVersionMismatch,u4 as initProject,GT as hidden,M0 as hasScript,b$ as grey,S$ as green,N0 as gray,l as getResizeObserver,T0 as getFileSize,P0 as getExportsSize,n4 as frameworkVersion,E4 as formatExportSizes,L as formatBytes,I4 as findStacksProjects,f0 as estimateGzipSize,Q0 as estimateBrotliSize,d4 as ensureProjectIsInitialized,t4 as dumpYaml,F4 as docsSourceHash,VT as dim,i4 as determineResetPreset,o4 as determineDebugLevel,N$ as detectNewlineGraceful,D0 as detectNewline,D$ as detectIndent,x$ as delay,L$ as defuArrayFn,I$ as defu,P4 as defineUi,$4 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,T4 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,z$ as debounce,p$ as cyan,x0 as createResizeObserver,O$ as createMerger,T$ as createMacroable,k$ as countNewlines,Q4 as compareBytes,F0 as cleanProject,gT as clamp,CT as browserUtils,ZT as bold,y$ as blue,F$ as black,l$ as bgYellow,TT as bgWhite,a$ as bgRed,e$ as bgMagenta,fT as bgLightYellow,PT as bgLightRed,qT as bgLightMagenta,HT as bgLightGreen,XT as bgLightCyan,QT as bgLightBlue,o$ as bgGreen,$T as bgCyan,t$ as bgBlue,r$ as bgBlack,WT as ResizeObserver,t as Pipeline,Y0 as Macroable};
|
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.44",
|
|
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.44"
|
|
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.44",
|
|
59
|
+
"@stacksjs/arrays": "^0.70.44",
|
|
60
|
+
"@stacksjs/cli": "^0.70.44",
|
|
61
|
+
"@stacksjs/config": "^0.70.44",
|
|
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.44",
|
|
64
|
+
"@stacksjs/path": "^0.70.44",
|
|
65
|
+
"@stacksjs/storage": "^0.70.44",
|
|
66
|
+
"@stacksjs/strings": "^0.70.44",
|
|
67
|
+
"@stacksjs/types": "^0.70.44"
|
|
68
68
|
}
|
|
69
69
|
}
|