pickier 0.1.43 → 0.1.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.
- package/dist/bin/cli.js +1 -1
- package/dist/{chunk-y0y1q8bv.js → chunk-1r3qehn7.js} +2 -2
- package/dist/{chunk-hv7gwshy.js → chunk-3t8wv4b6.js} +1 -1
- package/dist/{chunk-jtgkwhm9.js → chunk-b0ger4k1.js} +1 -1
- package/dist/{chunk-sa6phv2n.js → chunk-bf2bz66g.js} +1 -1
- package/dist/{chunk-z5xqmfa2.js → chunk-jq3ddym7.js} +1 -1
- package/dist/chunk-t89q2skh.js +2 -0
- package/dist/{chunk-spaq2txq.js → chunk-vymeaw3a.js} +90 -90
- package/dist/{chunk-6vr8d924.js → chunk-ysnm1635.js} +1 -1
- package/dist/src/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-0t5n4772.js +0 -2
package/dist/bin/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import{L as N}from"../chunk-h6ac3d60.js";import J from"process";async function I(){let E=J.argv.slice(2),Q=E[0]==="run",C=Q?1:0,O=Q?"auto":"lint",X=!1,Y=!1,Z=!1,_=!1,$,T=[],x=!0;for(let y=C;y<E.length;y++){let q=E[y];if(q==="--mode")O=E[++y]||"auto";else if(q==="--format")Z=!0,O="format";else if(q==="--check")X=!0;else if(q==="--write")Y=!0;else if(q==="--config")$=E[++y];else if(q==="--verbose")_=!0;else if(q==="--ext"||q==="--ignore-path")y++;else if(q==="--fix"||q==="--dry-run"||q==="--reporter"||q==="--max-warnings"||q==="--cache"){x=!1,T.length=0;break}else if(q.startsWith("--"));else T.push(q)}if(x&&(O==="format"||O==="auto"||O==="lint")&&T.length>0){let{runUnified:y}=await import("../chunk-
|
|
3
|
+
import{L as N}from"../chunk-h6ac3d60.js";import J from"process";async function I(){let E=J.argv.slice(2),Q=E[0]==="run",C=Q?1:0,O=Q?"auto":"lint",X=!1,Y=!1,Z=!1,_=!1,$,T=[],x=!0;for(let y=C;y<E.length;y++){let q=E[y];if(q==="--mode")O=E[++y]||"auto";else if(q==="--format")Z=!0,O="format";else if(q==="--check")X=!0;else if(q==="--write")Y=!0;else if(q==="--config")$=E[++y];else if(q==="--verbose")_=!0;else if(q==="--ext"||q==="--ignore-path")y++;else if(q==="--fix"||q==="--dry-run"||q==="--reporter"||q==="--max-warnings"||q==="--cache"){x=!1,T.length=0;break}else if(q.startsWith("--"));else T.push(q)}if(x&&(O==="format"||O==="auto"||O==="lint")&&T.length>0){let{runUnified:y}=await import("../chunk-t89q2skh.js"),q=await y(T,{mode:O,check:X,write:Y,verbose:_,config:$});J.exit(q)}let{CLI:L}=await import("../chunk-88xjkex3.js"),{version:F}=await import("../chunk-jq3ddym7.js"),H=new L("pickier"),V=(y)=>{let[q,B]=y;return[Array.isArray(q)?q.filter((W)=>typeof W==="string"):[],B&&typeof B==="object"?B:{}]};H.command("[...globs]","Lint files (default)").option("--fix","Auto-fix lint problems").option("--format","Format files instead of linting").option("--dry-run","Simulate fixes without writing").option("--check","Check formatting without writing (CI-friendly)").option("--max-warnings <n>","Max warnings before non-zero exit",{default:-1}).option("--reporter <name>","stylish|json|compact",{default:"stylish"}).option("--config <path>","Path to pickier config").option("--ignore-path <file>","Ignore file (like .gitignore)").option("--ext <exts>","Comma-separated extensions").option("--cache","Enable cache").option("--verbose","Verbose output").example("pickier .").example("pickier . --fix").example("pickier . --format").example("pickier src --fix --verbose").action(async(...y)=>{let[q,B]=V(y);if(q.length===0){H.outputHelp();return}let{runUnified:K}=await import("../chunk-t89q2skh.js"),D;if(B.format){if(D="format",!B.check)B.write=!0}else D="lint";let W=await K(q,{...B,mode:D});J.exit(W)}),H.command("lint [...globs]","[DEPRECATION] Use `pickier [...globs]` instead. Lint files").option("--fix","Auto-fix problems").option("--dry-run","Simulate fixes without writing").option("--max-warnings <n>","Max warnings before non-zero exit",{default:-1}).option("--reporter <name>","stylish|json|compact",{default:"stylish"}).option("--config <path>","Path to pickier config").option("--ignore-path <file>","Ignore file (like .gitignore)").option("--ext <exts>","Comma-separated extensions").option("--cache","Enable cache").option("--verbose","Verbose output").example("pickier lint .").example("pickier lint src --fix").example('pickier lint "src/**/*.{ts,tsx}" --reporter json').action(async(...y)=>{let[q,B]=V(y),{runUnified:K}=await import("../chunk-t89q2skh.js"),D=await K(q,{...B,mode:"lint"});J.exit(D)}),H.command("format [...globs]","[DEPRECATION] Use `pickier [...globs] --format` instead. Format files").option("--write","Write changes to files").option("--check","Check without writing (CI-friendly)").option("--config <path>","Path to pickier config").option("--ignore-path <file>","Ignore file").option("--ext <exts>","Comma-separated extensions").option("--verbose","Verbose output").example("pickier format . --write").example("pickier format . --check").action(async(...y)=>{let[q,B]=V(y),{runUnified:K}=await import("../chunk-t89q2skh.js"),D=await K(q,{...B,mode:"format"});J.exit(D)}),H.command("run [...globs]","Unified mode (auto, lint, or format)").option("--mode <mode>","auto|lint|format",{default:"auto"}).option("--fix","Auto-fix problems (lint mode)").option("--dry-run","Simulate fixes without writing (lint mode)").option("--max-warnings <n>","Max warnings before non-zero exit (lint mode)",{default:-1}).option("--reporter <name>","stylish|json|compact (lint mode)",{default:"stylish"}).option("--write","Write changes to files (format mode)").option("--check","Check without writing (format mode)").option("--config <path>","Path to pickier config").option("--ignore-path <file>","Ignore file (like .gitignore)").option("--ext <exts>","Comma-separated extensions").option("--cache","Enable cache (lint mode)").option("--verbose","Verbose output").example("pickier run . --mode lint --fix").example("pickier run . --mode format --write").action(async(...y)=>{let[q,B]=V(y),{runUnified:K}=await import("../chunk-t89q2skh.js"),D=await K(q,B);J.exit(D)}),H.command("version","Show the version of the CLI").action(async()=>{let{version:y}=await import("../chunk-jq3ddym7.js");J.stdout.write(`${y}
|
|
4
4
|
`)}),H.version(F),H.help(),H.parse()}I().catch((E)=>{let Q=E instanceof Error?E.message:String(E);J.stderr.write(`pickier: ${Q}
|
|
5
5
|
`),J.exit(1)});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{I as P}from"./chunk-
|
|
2
|
+
import{I as P}from"./chunk-bf2bz66g.js";import{L as F0}from"./chunk-h6ac3d60.js";function qZ($){let Y=$.length,V=Array.from({length:Y},(X,J)=>$[J]),Z=0;while(Z<Y){let X=$[Z];if(X==="#"&&(Z===0||/\s/.test($[Z-1]))){while(Z<Y)V[Z]=" ",Z++;break}if(X==="$"&&$[Z+1]==="'"){Z+=2;while(Z<Y){if($[Z]==="\\"&&Z+1<Y){V[Z]=" ",V[Z+1]=" ",Z+=2;continue}if($[Z]==="'"){Z++;break}V[Z]=" ",Z++}continue}if(X==="$"&&$[Z+1]==='"'){Z++,Z=x($,Z,V);continue}if(X==="$"&&$[Z+1]==="{"){Z+=2;let J=1;while(Z<Y&&J>0){let H=$[Z];if(H==="\\"&&Z+1<Y){V[Z]=" ",V[Z+1]=" ",Z+=2;continue}if(H==="'"){Z++;while(Z<Y&&$[Z]!=="'")V[Z]=" ",Z++;if(Z<Y)Z++;continue}if(H==='"'){Z=x($,Z,V);continue}if(H==="{"){J++,Z++;continue}if(H==="}"){J--,Z++;continue}V[Z]=" ",Z++}continue}if(X==="$"&&$[Z+1]==="("&&$[Z+2]==="("){Z+=3;let J=2;while(Z<Y&&J>0){let H=$[Z];if(H==="("){J++,Z++;continue}if(H===")"){J--,Z++;continue}V[Z]=" ",Z++}continue}if(X==="$"&&$[Z+1]==="("){Z+=2;let J=1;while(Z<Y&&J>0){let H=$[Z];if(H==="\\"&&Z+1<Y){V[Z]=" ",V[Z+1]=" ",Z+=2;continue}if(H==="'"){Z++;while(Z<Y&&$[Z]!=="'")V[Z]=" ",Z++;if(Z<Y)Z++;continue}if(H==='"'){Z=x($,Z,V);continue}if(H==="("){J++,Z++;continue}if(H===")"){J--,Z++;continue}V[Z]=" ",Z++}continue}if(X==="'"){Z++;while(Z<Y&&$[Z]!=="'")V[Z]=" ",Z++;if(Z<Y)Z++;continue}if(X==='"'){Z=x($,Z,V);continue}if(X==="`"){Z++;while(Z<Y&&$[Z]!=="`"){if($[Z]==="\\"&&Z+1<Y){V[Z]=" ",V[Z+1]=" ",Z+=2;continue}V[Z]=" ",Z++}if(Z<Y)Z++;continue}Z++}return V.join("")}function x($,Y,V){let Z=$.length,X=Y+1;while(X<Z){let J=$[X];if(J==="\\"&&X+1<Z){V[X]=" ",V[X+1]=" ",X+=2;continue}if(J==='"')return X+1;if(J==="$"&&$[X+1]==="("&&$[X+2]==="("){X+=3;let H=2;while(X<Z&&H>0){let U=$[X];if(U==="("){H++,X++;continue}if(U===")"){H--,X++;continue}V[X]=" ",X++}continue}if(J==="$"&&$[X+1]==="("){X+=2;let H=1;while(X<Z&&H>0){let U=$[X];if(U==="\\"&&X+1<Z){V[X]=" ",V[X+1]=" ",X+=2;continue}if(U==="'"){X++;while(X<Z&&$[X]!=="'")V[X]=" ",X++;if(X<Z)X++;continue}if(U==='"'){X=x($,X,V);continue}if(U==="("){H++,X++;continue}if(U===")"){H--,X++;continue}V[X]=" ",X++}continue}if(J==="$"&&$[X+1]==="{"){X+=2;let H=1;while(X<Z&&H>0){let U=$[X];if(U==="{"){H++,X++;continue}if(U==="}"){H--,X++;continue}V[X]=" ",X++}continue}V[X]=" ",X++}return X}function o($){let V=qZ($).match(/<<-?/);if(!V||V.index===void 0)return null;let X=$.slice(V.index+V[0].length).match(/^\s*(['"]?)(\w+)\1/);if(!X)return null;return X[2]}var QZ=new Set([".ts",".js"]),KZ=new Set([".json",".jsonc"]),FZ=new Set([".yaml",".yml"]),zZ=new Set([".sh",".bash",".zsh",".ksh",".dash"]),BZ=/^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/;var GZ=/^[}\])]/,DZ=/[{[(]\s*$/,yZ=/\s*\/\/.*$/,MZ=/^(?:if|else\s+if|for|while)\s*\(/,AZ=/^(?:\.[\w$[]|\?[\s.:]|:\s|&&|\|\|)/;function OZ($){let Y=MZ.exec($);if(!Y)return/^(?:else|do)\s*$/.test($);let V=0,Z=null;for(let X=Y[0].length-1;X<$.length;X++){let J=$[X];if(Z){if(J==="\\"){X++;continue}if(J===Z)Z=null;continue}if(J==="'"||J==='"'||J==="`"){Z=J;continue}if(J==="(")V++;else if(J===")"){if(V--,V===0)return $.slice(X+1).trim().length===0}}return!1}var NZ=/^\s*for\s*\(/,jZ=new RegExp("^\\s*;\\s*$"),IZ=new RegExp(";{2,}\\s*$"),RZ=/([\w)])\{/g,wZ=/\{(return|if|for|while|switch|const|let|var|function)\b/g,LZ=/,(\S)/g,vZ=/(?<![=!<>+\-*/%&|^?])=(?![=><])/g,PZ=/(\w)\+(\w)/g,_Z=/(\w)-(\w)/g,TZ=/(\w)\*(\w)/g,CZ=/(\w)\/(\w)/g,EZ=new RegExp("(?<=\\S);([^\\s;])","g"),xZ=/([\w)\]])<(\d)/g,kZ=/([\w)\]])>(\d)/g,a=/\s{2,}/g,l=/^\s*$/,SZ=/^\s*\/\//,r=/^\s*\/\*/,bZ=/^\s*import\b/,s=/\bfrom\s*['"][^'"]+['"]|^\s*import\s+['"][^'"]+['"]/,fZ=/package\.json$/i,hZ=/[jt]sconfig(?:\..+)?\.json$/i,f=/[ \t]+$/,gZ=/^\n+/;function S($){let Y=$.lastIndexOf(".");return Y>=0?$.slice(Y):""}function h($){return QZ.has(S($))}function mZ($){return KZ.has(S($))}function uZ($){return FZ.has(S($))}function cZ($){return zZ.has(S($))}function pZ($,Y){return cZ($)||BZ.test(Y)}function dZ($,Y){let V=$.split(`
|
|
3
3
|
`),Z=V.length,X=Array(Z),J=Y.format.indent,H=Y.format.indentStyle==="tabs",U=0,Q=!1,F="",z=!1,G=0;for(let W=0;W<Z;W++){let D=V[W];if(D.length===0||/^\s*$/.test(D)){X[W]="";continue}if(Q){if(X[W]=D,D.trim()===F)Q=!1,F="";continue}let M=o(D);if(M)Q=!0,F=M;let A=0;while(A<D.length&&(D.charCodeAt(A)===32||D.charCodeAt(A)===9))A++;let B=D.slice(A).trimEnd();if(B.startsWith("#")&&W>0){let E=H?"\t".repeat(U):" ".repeat(U*J);X[W]=E+B;continue}if(/^case\b/.test(B)&&/\bin\s*$/.test(B))G++,z=!0;if(/^esac\b/.test(B)){if(G=Math.max(0,G-1),G===0)z=!1}let j=z&&/\)\s*$/.test(B)&&!/\$\(/.test(B)&&!/^\s*\(/.test(B)&&!B.startsWith("#"),I=/^;[;&]\s*$/.test(B);if(/^(?:fi|done|esac|elif|else)\b/.test(B)||/^\}/.test(B))U=Math.max(0,U-1);if(I)U=Math.max(0,U-1);let C=H?"\t".repeat(U):" ".repeat(U*J);if(X[W]=C+B,/^then\b/.test(B)||/^do\b/.test(B)||/^else\b/.test(B))U++;else if(/^if\b/.test(B)&&/\bthen\s*$/.test(B))U++;else if(/^elif\b/.test(B)&&/\bthen\s*$/.test(B))U++;else if(/^(?:while|for|until)\b/.test(B)&&/\bdo\s*$/.test(B))U++;else if(/^case\b/.test(B)&&/\bin\s*$/.test(B))U++;else if(j)U++;else if(/\{\s*$/.test(B)&&!B.startsWith("#"))U++}return X.join(`
|
|
4
4
|
`)}function oZ($,Y){try{let V=Bun.YAML.parse($),Z=Y.format.indentStyle==="tabs"?"\t":Y.format.indent;return Bun.YAML.stringify(V,null,Z).split(`
|
|
5
5
|
`).map((J)=>J.replace(/[ \t]+$/,"")).join(`
|
|
@@ -29,5 +29,5 @@ ${J.join(`
|
|
|
29
29
|
`)}`:"",L=G.replace(/^\n+/,""),WZ=L.length>0?`
|
|
30
30
|
|
|
31
31
|
`:`
|
|
32
|
-
`;return`${R}${C}${E}${WZ}${L}`}function U0($){if($.kind==="side-effect")return`import '${$.source}'`;if($.kind==="type")return`import type { ${$.namedTypes.map((X)=>X.alias?`${X.name} as ${X.alias}`:X.name).join(", ")} } from '${$.source}'`;let Y=[];if($.defaultName)Y.push($.defaultName);if($.namespaceName)Y.push(`* as ${$.namespaceName}`);if($.named.length>0){let Z=$.named.map((X)=>X.alias?`${X.name} as ${X.alias}`:X.name).join(", ");Y.push(`{ ${Z} }`)}return`import ${Y.join(", ")} from '${$.source}'`}function W0($){let Y=$.match(/^\s*import\s+['"]([^'"]+)['"]/);if(Y)return{kind:"side-effect",source:Y[1],named:[],namedTypes:[],original:$};if(Y=$.match(/^\s*import\s+type\s+\{([^}]*)\}\s+from\s+['"]([^'"]+)['"]/),Y){let W=Y[1],D=Y[2],M=W.split(",").map((A)=>A.trim()).filter(Boolean).map((A)=>{let B=A.match(/^(\w+)(?:\s+as\s+(\w+))?$/);return{name:B?.[1]||A,alias:B?.[2]}});return{kind:"type",source:D,named:[],namedTypes:M,original:$}}let V=$.match(/^\s*import\s+/),Z=new RegExp(`\\sfrom\\s+['"]([^'"]+)['"]\\s*;?$`),X=$.match(Z);if(!V||!X)return;let J=X[1],H=$.slice(V[0].length,X.index).trim(),U,Q,F=[],z=[],G=H.match(/\{([^}]*)\}/);if(G){let D=G[1].split(",").map((M)=>M.trim()).filter(Boolean);for(let M of D){let A=/^type\s+/.test(M),j=M.replace(/^type\s+/,"").match(/^(\w+)(?:\s+as\s+(\w+))?$/);if(!j)continue;let I={name:j[1],alias:j[2]};if(A)z.push(I);else F.push(I)}H=H.replace(/\{[\s\S]*?\}/,"").trim()}if(H.length>0){let W=H.split(",").map((D)=>D.trim()).filter(Boolean);for(let D of W)if(D.startsWith("* as "))Q=D.slice(5).trim();else if(/^\w+$/.test(D))U=D}return{kind:"value",source:J,defaultName:U,namespaceName:Q,named:F,namedTypes:z,original:$}}function q0($,Y){if(fZ.test(Y))return Q0($);if(hZ.test(Y))return K0($);return null}function YZ($){try{return JSON.parse($)}catch{return null}}function k($,Y,V=[]){let Z={};for(let J of Y)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=$[J];for(let J of V){let H=Object.keys($).filter((U)=>J.test(U)&&!(U in Z)).sort();for(let U of H)Z[U]=$[U]}let X=Object.keys($).filter((J)=>!(J in Z)).sort();for(let J of X)Z[J]=$[J];return Z}function i($){let Y={};for(let V of Object.keys($).sort())Y[V]=$[V];return Y}function Q0($){let Y=YZ($);if(!Y||typeof Y!=="object")return $;let Z=k(Y,["publisher","name","displayName","type","version","private","packageManager","description","author","contributors","license","funding","homepage","repository","bugs","keywords","categories","sideEffects","imports","exports","main","module","unpkg","jsdelivr","types","typesVersions","bin","icon","files","engines","activationEvents","contributes","scripts","peerDependencies","peerDependenciesMeta","dependencies","optionalDependencies","devDependencies","pnpm","overrides","resolutions","husky","simple-git-hooks","lint-staged","eslintConfig"]);if(Array.isArray(Z.files)){if(Z.files.every((H)=>typeof H==="string"))Z.files=[...Z.files].sort()}for(let J of Object.keys(Z))if(/^(?:dev|peer|optional|bundled)?[Dd]ependencies(?:Meta)?$/.test(J)||/^(?:resolutions|overrides|pnpm\.overrides)$/.test(J)){if(Z[J]&&typeof Z[J]==="object")Z[J]=i(Z[J])}if(Z.pnpm&&typeof Z.pnpm==="object"&&Z.pnpm.overrides&&typeof Z.pnpm.overrides==="object")Z.pnpm.overrides=i(Z.pnpm.overrides);if(Z.exports&&typeof Z.exports==="object"){let J=Z.exports,H=["types","import","require","default"];if(!Array.isArray(J)){let U={};for(let Q of Object.keys(J)){let F=J[Q];if(F&&typeof F==="object"&&!Array.isArray(F))U[Q]=k(F,H);else U[Q]=F}Z.exports=U}}let X=["pre-commit","prepare-commit-msg","commit-msg","post-commit","pre-rebase","post-rewrite","post-checkout","post-merge","pre-push","pre-auto-gc"];for(let J of["gitHooks","husky","simple-git-hooks"])if(Z[J]&&typeof Z[J]==="object")Z[J]=k(Z[J],X);return JSON.stringify(Z,null,2)}function K0($){let Y=YZ($);if(!Y||typeof Y!=="object")return $;let Z=k(Y,["extends","compilerOptions","references","files","include","exclude"]);if(Z.compilerOptions&&typeof Z.compilerOptions==="object"){let X=["incremental","composite","tsBuildInfoFile","disableSourceOfProjectReferenceRedirect","disableSolutionSearching","disableReferencedProjectLoad","target","jsx","jsxFactory","jsxFragmentFactory","jsxImportSource","lib","moduleDetection","noLib","reactNamespace","useDefineForClassFields","emitDecoratorMetadata","experimentalDecorators","libReplacement","baseUrl","rootDir","rootDirs","customConditions","module","moduleResolution","moduleSuffixes","noResolve","paths","resolveJsonModule","resolvePackageJsonExports","resolvePackageJsonImports","typeRoots","types","allowArbitraryExtensions","allowImportingTsExtensions","allowUmdGlobalAccess","allowJs","checkJs","maxNodeModuleJsDepth","strict","strictBindCallApply","strictFunctionTypes","strictNullChecks","strictPropertyInitialization","allowUnreachableCode","allowUnusedLabels","alwaysStrict","exactOptionalPropertyTypes","noFallthroughCasesInSwitch","noImplicitAny","noImplicitOverride","noImplicitReturns","noImplicitThis","noPropertyAccessFromIndexSignature","noUncheckedIndexedAccess","noUnusedLocals","noUnusedParameters","useUnknownInCatchVariables","declaration","declarationDir","declarationMap","downlevelIteration","emitBOM","emitDeclarationOnly","importHelpers","importsNotUsedAsValues","inlineSourceMap","inlineSources","mapRoot","newLine","noEmit","noEmitHelpers","noEmitOnError","outDir","outFile","preserveConstEnums","preserveValueImports","removeComments","sourceMap","sourceRoot","stripInternal","allowSyntheticDefaultImports","esModuleInterop","forceConsistentCasingInFileNames","isolatedDeclarations","isolatedModules","preserveSymlinks","verbatimModuleSyntax","erasableSyntaxOnly","skipDefaultLibCheck","skipLibCheck"];Z.compilerOptions=k(Z.compilerOptions,X)}return JSON.stringify(Z,null,2)}import{readdirSync as z0,readFileSync as B0,statSync as HZ}from"fs";import{extname as G0,isAbsolute as u,join as c,resolve as D0}from"path";import v from"process";var f0=5;function y0($){let Y="",V=0;while(V<$.length){let Z=$[V];if(Z==="*")if($[V+1]==="*"){if(Y+=".*",V+=2,$[V]==="/")V++}else Y+="[^/]*",V++;else if(Z==="?")Y+="[^/]",V++;else if(Z==="["){let X=$.indexOf("]",V);if(X===-1)Y+="\\[",V++;else Y+=$.slice(V,X+1),V=X+1}else if(".+^${}()|\\".includes(Z))Y+=`\\${Z}`,V++;else Y+=Z,V++}return new RegExp(`^${Y}$`)}function*UZ($,Y,V){let Z;try{Z=z0($)}catch{return}for(let X of Z){if(!V&&X.startsWith("."))continue;let J=c($,X);if(Y(J))continue;let H;try{H=HZ(J)}catch{continue}if(H.isDirectory())yield*UZ(J,Y,V);else yield J}}function*JZ($,Y,V,Z){yield*UZ($,d(Y,Z),V)}async function h0($,Y={}){let V=Y.cwd??v.cwd(),Z=Y.ignore??[],X=Y.dot??!1,J=Y.absolute??!0,H=d(Z,V);if(typeof globalThis.Bun?.Glob<"u"){let Q=globalThis.Bun.Glob,F=[];for(let z of $){let G=new Q(z);for await(let W of G.scan({cwd:V,dot:X,onlyFiles:Y.onlyFiles??!0,followSymlinks:!1})){let D=u(W)?W:c(V,W),M=D.startsWith(`${V}/`)?D.slice(V.length+1):D;if(H(D))continue;F.push(J?D:M)}}return F}let U=[];for(let Q of $){if(!/[*?[{]/.test(Q)){let z=u(Q)?Q:c(V,Q);try{if(!HZ(z).isDirectory()){let W=z.startsWith(`${V}/`)?z.slice(V.length+1):z;if(!H(z))U.push(J?z:W)}else for(let W of JZ(z,Z,X,V))U.push(J?W:W.startsWith(`${V}/`)?W.slice(V.length+1):W)}catch{}continue}let F=y0(Q);for(let z of JZ(V,Z,X,V)){let G=z.startsWith(`${V}/`)?z.slice(V.length+1):z;if(F.test(G)||F.test(G.replace(/\\/g,"/")))U.push(J?z:G)}}return U}function g0($){let Y=0,V=[],Z=()=>{if(V.length>0&&Y<$)Y++,V.shift()()};return(X)=>{return new Promise((J,H)=>{let U=()=>{X().then((Q)=>{Y--,J(Q),Z()},(Q)=>{Y--,H(Q),Z()})};if(Y<$)Y++,U();else V.push(U)})}}var M0={get TRACE(){return v.env.PICKIER_TRACE==="1"},get TIMEOUT_MS(){return Number(v.env.PICKIER_TIMEOUT_MS||"8000")},get RULE_TIMEOUT_MS(){return Number(v.env.PICKIER_RULE_TIMEOUT_MS||"5000")},get CONCURRENCY(){return Number(v.env.PICKIER_CONCURRENCY)||8},get DIAGNOSTICS(){return v.env.PICKIER_DIAGNOSTICS==="1"},get FAIL_ON_WARNINGS(){return v.env.PICKIER_FAIL_ON_WARNINGS==="1"},get NO_AUTO_CONFIG(){return v.env.PICKIER_NO_AUTO_CONFIG==="1"}},A0=["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.vercel/**","**/.netlify/**","**/.cache/**","**/.turbo/**","**/.vscode/**","**/.idea/**","**/.zed/**","**/.cursor/**","**/.claude/**","**/.github/**","**/coverage/**","**/.nyc_output/**","**/.tmp/**","**/.temp/**","**/vendor/**","**/pantry/**","**/target/**","**/zig-cache/**","**/zig-out/**","**/.zig-cache/**","**/__pycache__/**","**/.pytest_cache/**","**/venv/**","**/.venv/**","**/out/**","**/.DS_Store","**/Thumbs.db"];function m0($,Y){let V=$[Y];if(V===void 0){let J=Y.indexOf("/");if(J>0){let H=Y.slice(0,J),U=Y.slice(J+1),Q=H==="general"?"pickier":H==="pickier"?"general":null;if(Q)V=$[`${Q}/${U}`];if(V===void 0)V=$[U]}}let Z,X;if(typeof V==="string"){if(V==="error")Z="error";else if(V==="warn"||V==="warning")Z="warning"}else if(Array.isArray(V)&&typeof V[0]==="string"){let J=V[0];if(J==="error")Z="error";else if(J==="warn"||J==="warning")Z="warning";X=V[1]}return{enabled:!!Z,severity:Z,options:X}}function T($,Y){return`\x1B[${$}m${Y}\x1B[0m`}function O0($){return T("32",$)}function N0($){return T("31",$)}function j0($){return T("33",$)}function I0($){return T("34",$)}function R0($){return T("90",$)}function w0($){return T("1",$)}var u0={green:O0,red:N0,yellow:j0,blue:I0,gray:R0,bold:w0};function _($,Y){let V=Y.ignores?[...new Set([...$.ignores||[],...Y.ignores])]:$.ignores,Z={...$.pluginRules||{},...Y.pluginRules||{}};if((Y.tailwind??$.tailwind)?.enabled&&!Object.prototype.hasOwnProperty.call(Z,"pickier/sort-tailwind-classes"))Z["pickier/sort-tailwind-classes"]="warn";return{...$,...Y,verbose:Y.verbose??$.verbose,ignores:V,lint:{...$.lint,...Y.lint||{}},format:{...$.format,...Y.format||{}},rules:{...$.rules,...Y.rules||{}},pluginRules:Z}}var m=null;async function c0($){if(!$){if(M0.NO_AUTO_CONFIG){if(!m)m=_(P,{});return m}try{let{getConfig:Z}=await import("./chunk-jtgkwhm9.js"),X=await Z();return _(P,X)}catch{}return _(P,{})}let Y=u($)?$:D0(v.cwd(),$);if(G0(Y).toLowerCase()===".json")try{let Z=B0(Y,"utf8");return _(P,JSON.parse(Z))}catch{return console.warn(`[pickier:warn] Config file not found: ${Y}. Using default config values.`),_(P,{})}try{let Z=await import(Y);return _(P,Z.default||Z)}catch{return console.warn(`[pickier:warn] Config file not found: ${Y}. Using default config values.`),_(P,{})}}function p0($){return $.map((Y)=>{if(/[*?[\]{}()!]/.test(Y))return Y;if(/\.[A-Z0-9]+$/i.test(Y))return Y;return`${Y.replace(/\/$/,"")}/**/*`})}function d0($,Y){let V=$.lastIndexOf(".");if(V<0)return!1;let Z=$.slice(V);return Y.has(Z)}function p($){return $.replace(/\\/g,"/").replace(/\/+/g,"/")}function L0($){let Y=[];for(let V of $){let Z=p(V.trim());if(!Z)continue;let X=Z.match(/\*\*\/\*\.(.+)$/);if(X){Y.push({raw:Z,kind:"extension",value:X[1]});continue}let J=Z.match(/\*\*\/(.+?)\/\*\*$/);if(J){Y.push({raw:Z,kind:"segment",value:J[1]});continue}let H=Z.match(/\*\*\/(.+)$/);if(H)Y.push({raw:Z,kind:"suffix",value:H[1].replace(/\/$/,"")})}return Y}function d($,Y=v.cwd()){if($.length===0)return()=>!1;let V=L0($);if(V.length===0)return()=>!1;let Z=new Set(A0);return(X)=>{let J=p(X),H=p(Y).replace(/\/$/,""),U=J!==H&&!J.startsWith(`${H}/`),Q=U?J:J.slice(H.length);for(let F of V){if(U&&!Z.has(F.raw))continue;if(F.kind==="extension"){if(Q.endsWith(`.${F.value}`))return!0;continue}if(F.kind==="segment"||F.kind==="suffix"){let z=F.value;if(Q.includes(`/${z}/`)||Q.endsWith(`/${z}`))return!0}}return!1}}function o0($,Y){return d(Y)($)}
|
|
32
|
+
`;return`${R}${C}${E}${WZ}${L}`}function U0($){if($.kind==="side-effect")return`import '${$.source}'`;if($.kind==="type")return`import type { ${$.namedTypes.map((X)=>X.alias?`${X.name} as ${X.alias}`:X.name).join(", ")} } from '${$.source}'`;let Y=[];if($.defaultName)Y.push($.defaultName);if($.namespaceName)Y.push(`* as ${$.namespaceName}`);if($.named.length>0){let Z=$.named.map((X)=>X.alias?`${X.name} as ${X.alias}`:X.name).join(", ");Y.push(`{ ${Z} }`)}return`import ${Y.join(", ")} from '${$.source}'`}function W0($){let Y=$.match(/^\s*import\s+['"]([^'"]+)['"]/);if(Y)return{kind:"side-effect",source:Y[1],named:[],namedTypes:[],original:$};if(Y=$.match(/^\s*import\s+type\s+\{([^}]*)\}\s+from\s+['"]([^'"]+)['"]/),Y){let W=Y[1],D=Y[2],M=W.split(",").map((A)=>A.trim()).filter(Boolean).map((A)=>{let B=A.match(/^(\w+)(?:\s+as\s+(\w+))?$/);return{name:B?.[1]||A,alias:B?.[2]}});return{kind:"type",source:D,named:[],namedTypes:M,original:$}}let V=$.match(/^\s*import\s+/),Z=new RegExp(`\\sfrom\\s+['"]([^'"]+)['"]\\s*;?$`),X=$.match(Z);if(!V||!X)return;let J=X[1],H=$.slice(V[0].length,X.index).trim(),U,Q,F=[],z=[],G=H.match(/\{([^}]*)\}/);if(G){let D=G[1].split(",").map((M)=>M.trim()).filter(Boolean);for(let M of D){let A=/^type\s+/.test(M),j=M.replace(/^type\s+/,"").match(/^(\w+)(?:\s+as\s+(\w+))?$/);if(!j)continue;let I={name:j[1],alias:j[2]};if(A)z.push(I);else F.push(I)}H=H.replace(/\{[\s\S]*?\}/,"").trim()}if(H.length>0){let W=H.split(",").map((D)=>D.trim()).filter(Boolean);for(let D of W)if(D.startsWith("* as "))Q=D.slice(5).trim();else if(/^\w+$/.test(D))U=D}return{kind:"value",source:J,defaultName:U,namespaceName:Q,named:F,namedTypes:z,original:$}}function q0($,Y){if(fZ.test(Y))return Q0($);if(hZ.test(Y))return K0($);return null}function YZ($){try{return JSON.parse($)}catch{return null}}function k($,Y,V=[]){let Z={};for(let J of Y)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=$[J];for(let J of V){let H=Object.keys($).filter((U)=>J.test(U)&&!(U in Z)).sort();for(let U of H)Z[U]=$[U]}let X=Object.keys($).filter((J)=>!(J in Z)).sort();for(let J of X)Z[J]=$[J];return Z}function i($){let Y={};for(let V of Object.keys($).sort())Y[V]=$[V];return Y}function Q0($){let Y=YZ($);if(!Y||typeof Y!=="object")return $;let Z=k(Y,["publisher","name","displayName","type","version","private","packageManager","description","author","contributors","license","funding","homepage","repository","bugs","keywords","categories","sideEffects","imports","exports","main","module","unpkg","jsdelivr","types","typesVersions","bin","icon","files","engines","activationEvents","contributes","scripts","peerDependencies","peerDependenciesMeta","dependencies","optionalDependencies","devDependencies","pnpm","overrides","resolutions","husky","simple-git-hooks","lint-staged","eslintConfig"]);if(Array.isArray(Z.files)){if(Z.files.every((H)=>typeof H==="string"))Z.files=[...Z.files].sort()}for(let J of Object.keys(Z))if(/^(?:dev|peer|optional|bundled)?[Dd]ependencies(?:Meta)?$/.test(J)||/^(?:resolutions|overrides|pnpm\.overrides)$/.test(J)){if(Z[J]&&typeof Z[J]==="object")Z[J]=i(Z[J])}if(Z.pnpm&&typeof Z.pnpm==="object"&&Z.pnpm.overrides&&typeof Z.pnpm.overrides==="object")Z.pnpm.overrides=i(Z.pnpm.overrides);if(Z.exports&&typeof Z.exports==="object"){let J=Z.exports,H=["types","import","require","default"];if(!Array.isArray(J)){let U={};for(let Q of Object.keys(J)){let F=J[Q];if(F&&typeof F==="object"&&!Array.isArray(F))U[Q]=k(F,H);else U[Q]=F}Z.exports=U}}let X=["pre-commit","prepare-commit-msg","commit-msg","post-commit","pre-rebase","post-rewrite","post-checkout","post-merge","pre-push","pre-auto-gc"];for(let J of["gitHooks","husky","simple-git-hooks"])if(Z[J]&&typeof Z[J]==="object")Z[J]=k(Z[J],X);return JSON.stringify(Z,null,2)}function K0($){let Y=YZ($);if(!Y||typeof Y!=="object")return $;let Z=k(Y,["extends","compilerOptions","references","files","include","exclude"]);if(Z.compilerOptions&&typeof Z.compilerOptions==="object"){let X=["incremental","composite","tsBuildInfoFile","disableSourceOfProjectReferenceRedirect","disableSolutionSearching","disableReferencedProjectLoad","target","jsx","jsxFactory","jsxFragmentFactory","jsxImportSource","lib","moduleDetection","noLib","reactNamespace","useDefineForClassFields","emitDecoratorMetadata","experimentalDecorators","libReplacement","baseUrl","rootDir","rootDirs","customConditions","module","moduleResolution","moduleSuffixes","noResolve","paths","resolveJsonModule","resolvePackageJsonExports","resolvePackageJsonImports","typeRoots","types","allowArbitraryExtensions","allowImportingTsExtensions","allowUmdGlobalAccess","allowJs","checkJs","maxNodeModuleJsDepth","strict","strictBindCallApply","strictFunctionTypes","strictNullChecks","strictPropertyInitialization","allowUnreachableCode","allowUnusedLabels","alwaysStrict","exactOptionalPropertyTypes","noFallthroughCasesInSwitch","noImplicitAny","noImplicitOverride","noImplicitReturns","noImplicitThis","noPropertyAccessFromIndexSignature","noUncheckedIndexedAccess","noUnusedLocals","noUnusedParameters","useUnknownInCatchVariables","declaration","declarationDir","declarationMap","downlevelIteration","emitBOM","emitDeclarationOnly","importHelpers","importsNotUsedAsValues","inlineSourceMap","inlineSources","mapRoot","newLine","noEmit","noEmitHelpers","noEmitOnError","outDir","outFile","preserveConstEnums","preserveValueImports","removeComments","sourceMap","sourceRoot","stripInternal","allowSyntheticDefaultImports","esModuleInterop","forceConsistentCasingInFileNames","isolatedDeclarations","isolatedModules","preserveSymlinks","verbatimModuleSyntax","erasableSyntaxOnly","skipDefaultLibCheck","skipLibCheck"];Z.compilerOptions=k(Z.compilerOptions,X)}return JSON.stringify(Z,null,2)}import{readdirSync as z0,readFileSync as B0,statSync as HZ}from"fs";import{extname as G0,isAbsolute as u,join as c,resolve as D0}from"path";import v from"process";var f0=5;function y0($){let Y="",V=0;while(V<$.length){let Z=$[V];if(Z==="*")if($[V+1]==="*"){if(Y+=".*",V+=2,$[V]==="/")V++}else Y+="[^/]*",V++;else if(Z==="?")Y+="[^/]",V++;else if(Z==="["){let X=$.indexOf("]",V);if(X===-1)Y+="\\[",V++;else Y+=$.slice(V,X+1),V=X+1}else if(".+^${}()|\\".includes(Z))Y+=`\\${Z}`,V++;else Y+=Z,V++}return new RegExp(`^${Y}$`)}function*UZ($,Y,V){let Z;try{Z=z0($)}catch{return}for(let X of Z){if(!V&&X.startsWith("."))continue;let J=c($,X);if(Y(J))continue;let H;try{H=HZ(J)}catch{continue}if(H.isDirectory())yield*UZ(J,Y,V);else yield J}}function*JZ($,Y,V,Z){yield*UZ($,d(Y,Z),V)}async function h0($,Y={}){let V=Y.cwd??v.cwd(),Z=Y.ignore??[],X=Y.dot??!1,J=Y.absolute??!0,H=d(Z,V);if(typeof globalThis.Bun?.Glob<"u"){let Q=globalThis.Bun.Glob,F=[];for(let z of $){let G=new Q(z);for await(let W of G.scan({cwd:V,dot:X,onlyFiles:Y.onlyFiles??!0,followSymlinks:!1})){let D=u(W)?W:c(V,W),M=D.startsWith(`${V}/`)?D.slice(V.length+1):D;if(H(D))continue;F.push(J?D:M)}}return F}let U=[];for(let Q of $){if(!/[*?[{]/.test(Q)){let z=u(Q)?Q:c(V,Q);try{if(!HZ(z).isDirectory()){let W=z.startsWith(`${V}/`)?z.slice(V.length+1):z;if(!H(z))U.push(J?z:W)}else for(let W of JZ(z,Z,X,V))U.push(J?W:W.startsWith(`${V}/`)?W.slice(V.length+1):W)}catch{}continue}let F=y0(Q);for(let z of JZ(V,Z,X,V)){let G=z.startsWith(`${V}/`)?z.slice(V.length+1):z;if(F.test(G)||F.test(G.replace(/\\/g,"/")))U.push(J?z:G)}}return U}function g0($){let Y=0,V=[],Z=()=>{if(V.length>0&&Y<$)Y++,V.shift()()};return(X)=>{return new Promise((J,H)=>{let U=()=>{X().then((Q)=>{Y--,J(Q),Z()},(Q)=>{Y--,H(Q),Z()})};if(Y<$)Y++,U();else V.push(U)})}}var M0={get TRACE(){return v.env.PICKIER_TRACE==="1"},get TIMEOUT_MS(){return Number(v.env.PICKIER_TIMEOUT_MS||"8000")},get RULE_TIMEOUT_MS(){return Number(v.env.PICKIER_RULE_TIMEOUT_MS||"5000")},get CONCURRENCY(){return Number(v.env.PICKIER_CONCURRENCY)||8},get DIAGNOSTICS(){return v.env.PICKIER_DIAGNOSTICS==="1"},get FAIL_ON_WARNINGS(){return v.env.PICKIER_FAIL_ON_WARNINGS==="1"},get NO_AUTO_CONFIG(){return v.env.PICKIER_NO_AUTO_CONFIG==="1"}},A0=["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.vercel/**","**/.netlify/**","**/.cache/**","**/.turbo/**","**/.vscode/**","**/.idea/**","**/.zed/**","**/.cursor/**","**/.claude/**","**/.github/**","**/coverage/**","**/.nyc_output/**","**/.tmp/**","**/.temp/**","**/vendor/**","**/pantry/**","**/target/**","**/zig-cache/**","**/zig-out/**","**/.zig-cache/**","**/__pycache__/**","**/.pytest_cache/**","**/venv/**","**/.venv/**","**/out/**","**/.DS_Store","**/Thumbs.db"];function m0($,Y){let V=$[Y];if(V===void 0){let J=Y.indexOf("/");if(J>0){let H=Y.slice(0,J),U=Y.slice(J+1),Q=H==="general"?"pickier":H==="pickier"?"general":null;if(Q)V=$[`${Q}/${U}`];if(V===void 0)V=$[U]}}let Z,X;if(typeof V==="string"){if(V==="error")Z="error";else if(V==="warn"||V==="warning")Z="warning"}else if(Array.isArray(V)&&typeof V[0]==="string"){let J=V[0];if(J==="error")Z="error";else if(J==="warn"||J==="warning")Z="warning";X=V[1]}return{enabled:!!Z,severity:Z,options:X}}function T($,Y){return`\x1B[${$}m${Y}\x1B[0m`}function O0($){return T("32",$)}function N0($){return T("31",$)}function j0($){return T("33",$)}function I0($){return T("34",$)}function R0($){return T("90",$)}function w0($){return T("1",$)}var u0={green:O0,red:N0,yellow:j0,blue:I0,gray:R0,bold:w0};function _($,Y){let V=Y.ignores?[...new Set([...$.ignores||[],...Y.ignores])]:$.ignores,Z={...$.pluginRules||{},...Y.pluginRules||{}};if((Y.tailwind??$.tailwind)?.enabled&&!Object.prototype.hasOwnProperty.call(Z,"pickier/sort-tailwind-classes"))Z["pickier/sort-tailwind-classes"]="warn";return{...$,...Y,verbose:Y.verbose??$.verbose,ignores:V,lint:{...$.lint,...Y.lint||{}},format:{...$.format,...Y.format||{}},rules:{...$.rules,...Y.rules||{}},pluginRules:Z}}var m=null;async function c0($){if(!$){if(M0.NO_AUTO_CONFIG){if(!m)m=_(P,{});return m}try{let{getConfig:Z}=await import("./chunk-b0ger4k1.js"),X=await Z();return _(P,X)}catch{}return _(P,{})}let Y=u($)?$:D0(v.cwd(),$);if(G0(Y).toLowerCase()===".json")try{let Z=B0(Y,"utf8");return _(P,JSON.parse(Z))}catch{return console.warn(`[pickier:warn] Config file not found: ${Y}. Using default config values.`),_(P,{})}try{let Z=await import(Y);return _(P,Z.default||Z)}catch{return console.warn(`[pickier:warn] Config file not found: ${Y}. Using default config values.`),_(P,{})}}function p0($){return $.map((Y)=>{if(/[*?[\]{}()!]/.test(Y))return Y;if(/\.[A-Z0-9]+$/i.test(Y))return Y;return`${Y.replace(/\/$/,"")}/**/*`})}function d0($,Y){let V=$.lastIndexOf(".");if(V<0)return!1;let Z=$.slice(V);return Y.has(Z)}function p($){return $.replace(/\\/g,"/").replace(/\/+/g,"/")}function L0($){let Y=[];for(let V of $){let Z=p(V.trim());if(!Z)continue;let X=Z.match(/\*\*\/\*\.(.+)$/);if(X){Y.push({raw:Z,kind:"extension",value:X[1]});continue}let J=Z.match(/\*\*\/(.+?)\/\*\*$/);if(J){Y.push({raw:Z,kind:"segment",value:J[1]});continue}let H=Z.match(/\*\*\/(.+)$/);if(H)Y.push({raw:Z,kind:"suffix",value:H[1].replace(/\/$/,"")})}return Y}function d($,Y=v.cwd()){if($.length===0)return()=>!1;let V=L0($);if(V.length===0)return()=>!1;let Z=new Set(A0);return(X)=>{let J=p(X),H=p(Y).replace(/\/$/,""),U=J!==H&&!J.startsWith(`${H}/`),Q=U?J:J.slice(H.length);for(let F of V){if(U&&!Z.has(F.raw))continue;if(F.kind==="extension"){if(Q.endsWith(`.${F.value}`))return!0;continue}if(F.kind==="segment"||F.kind==="suffix"){let z=F.value;if(Q.includes(`/${z}/`)||Q.endsWith(`/${z}`))return!0}}return!1}}function o0($,Y){return d(Y)($)}
|
|
33
33
|
export{qZ as i,o as j,_0 as k,T0 as l,C0 as m,H0 as n,f0 as o,h0 as p,g0 as q,M0 as r,A0 as s,m0 as t,T as u,O0 as v,N0 as w,j0 as x,I0 as y,R0 as z,w0 as A,u0 as B,_ as C,c0 as D,p0 as E,d0 as F,d as G,o0 as H};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{b as a,c as b,d as c,e as d,f as e,g as f}from"./chunk-
|
|
2
|
+
import{b as a,c as b,d as c,e as d,f as e,g as f}from"./chunk-vymeaw3a.js";import"./chunk-1r3qehn7.js";import"./chunk-bf2bz66g.js";import"./chunk-h6ac3d60.js";export{d as scanContentOptimized,e as scanContent,b as runLintProgrammatic,f as runLint,a as lintText,c as applyPlugins};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{I as a,J as b,K as c}from"./chunk-
|
|
2
|
+
import{I as a,J as b,K as c}from"./chunk-bf2bz66g.js";import"./chunk-h6ac3d60.js";export{b as getConfig,a as defaultConfig,c as config};
|
|
@@ -58,5 +58,5 @@ export type ConfigOf = Config
|
|
|
58
58
|
`;Y+=`| Variable | Type | Description | Example |
|
|
59
59
|
`,Y+=`|----------|------|-------------|----------|
|
|
60
60
|
`;for(let Z of Q)Y+=`| \`${Z.key}\` | ${Z.type} | ${Z.description} | \`${Z.example}\` |
|
|
61
|
-
`;return Y}}function L8(Q,X,Y={}){return _Z(Q,X,Y,new WeakMap)}function _Z(Q,X,Y,Z){let{arrayMergeMode:$="replace",skipNullish:H=!1,customMerger:U}=Y;if(X===null||X===void 0)return H?Q:X;if(U){let G=U(Q,X);if(G!==void 0)return G}if(Array.isArray(X)||Array.isArray(Q))return qZ(Q,X,$,Z);if(!f(X)||!f(Q))return X;return F8(Q,X,Y,Z)}function qZ(Q,X,Y,Z){if(Array.isArray(X)&&!Array.isArray(Q))return X;if(Array.isArray(Q)&&!Array.isArray(X))return X;if(Array.isArray(X)&&Array.isArray(Q))switch(Y){case"replace":return X;case"concat":return K8(Q,X);case"smart":return j8(Q,X,Z);default:return X}return X}function K8(Q,X){let Y=[...X];for(let Z of Q)if(!Y.some(($)=>bX($,Z)))Y.push(Z);return Y}function j8(Q,X,Y){if(X.length===0)return Q;if(Q.length===0)return X;if(f(X[0])&&f(Q[0]))return I8(Q,X,Y);if(X.every((Z)=>typeof Z==="string")&&Q.every((Z)=>typeof Z==="string")){let Z=[...X];for(let $ of Q)if(!Z.includes($))Z.push($);return Z}return X}function I8(Q,X,Y){let Z=[...X];for(let $ of Q){if(!f($)){Z.push($);continue}let H=["id","name","key","path","type"],U=!1;for(let G of H)if(G in $){if(Z.find((_)=>f(_)&&(G in _)&&_[G]===$[G])){U=!0;break}}if(!U)Z.push($)}return Z}function F8(Q,X,Y,Z){let $=X;if(f($)&&Z.has($))return Z.get($);let H={...Q};if(f($))Z.set($,H);for(let U in $){if(!Object.prototype.hasOwnProperty.call($,U))continue;let G=$[U],J=H[U];if(Y.skipNullish&&(G===null||G===void 0))continue;if(G===null||G===void 0){H[U]=G;continue}if(f(G)&&f(J))H[U]=_Z(J,G,Y,Z);else if(Array.isArray(G)||Array.isArray(J))H[U]=qZ(J,G,Y.arrayMergeMode||"smart",Z);else H[U]=G}return H}function WZ(Q,X,Y="replace"){return L8(Q,X,{arrayMergeMode:Y==="replace"?"replace":"smart",skipNullish:!0})}function bX(Q,X){if(Q===X)return!0;if(Array.isArray(Q)&&Array.isArray(X)){if(Q.length!==X.length)return!1;for(let Y=0;Y<Q.length;Y++)if(!bX(Q[Y],X[Y]))return!1;return!0}if(f(Q)&&f(X)){let Y=Object.keys(Q),Z=Object.keys(X);if(Y.length!==Z.length)return!1;for(let $ of Y){if(!Object.prototype.hasOwnProperty.call(X,$))return!1;if(!bX(Q[$],X[$]))return!1}return!0}return!1}function f(Q){return Boolean(Q&&typeof Q==="object"&&!Array.isArray(Q))}class AZ{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(Q,X,Y={}){let{arrayStrategy:Z="replace",useCache:$=!0,cacheTtl:H,trackPerformance:U=!0,verbose:G=!1}=Y;if($){let _=fQ.getWithFileCheck("file",Q);if(_){if(G)console.log(`Configuration loaded from cache: ${Q}`);return _}}let J=async()=>{if(!kQ(Q))return null;try{let _=`?t=${Date.now()}`,q=await import(Q+_),W=q.default||q,z="default"in q,A=Object.keys(q).length>0;if(!z&&!A)throw new rQ(Q,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof W!=="object"||W===null||Array.isArray(W))throw new rQ(Q,Error("Configuration must export a valid object"),"unknown");let K={config:WZ(X,W,Z),source:{type:"file",path:Q,priority:100,timestamp:new Date}};if($)fQ.setWithFileCheck("file",K,Q,H);return K}catch(_){throw _ instanceof Error?BQ.configLoad(Q,_):BQ.configLoad(Q,Error(String(_)))}};if(U)return yX.track("loadFromPath",J,{path:Q});return J()}async tryLoadFromPaths(Q,X,Y={}){for(let Z of Q)try{let $=await this.loadFromPath(Z,X,Y);if($)return $}catch($){if($ instanceof Error&&$.name==="ConfigLoadError")throw $;if(Y.verbose)console.warn(`Failed to load config from ${Z}:`,$)}return null}generateConfigPaths(Q,X,Y){let Z=this.generateNamePatterns(Q,Y),$=[];for(let H of Z)for(let U of this.extensions)$.push(FX(X,`${H}${U}`));return $}generateNamePatterns(Q,X){let Y=[];if(Y.push("config",".config"),Q)Y.push(Q,`.${Q}.config`,`${Q}.config`,`.${Q}`);let Z=X===void 0?[]:Array.isArray(X)?X:[X];for(let H of Z){if(!H)continue;if(Y.push(H,`.${H}.config`,`${H}.config`,`.${H}`),Q)Y.push(`${Q}.${H}.config`,`.${Q}.${H}.config`)}let $=new Set;return Y.filter((H)=>{if(!H||$.has(H))return!1;return $.add(H),!0})}checkFileAccess(Q){return w8(async()=>{return kQ(Q)},{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(Q,X,Y){let Z=[];if(!kQ(Q))return Z;if(X||Y){let $=this.generateNamePatterns(X||"",Y);for(let H of $)for(let U of this.extensions){let G=FX(Q,`${H}${U}`);if(await this.checkFileAccess(G))Z.push(G)}}else try{let{readdirSync:$}=await import("fs"),H=$(Q);for(let U of H)if(this.looksLikeConfigFile(U)){let G=FX(Q,U);if(await this.checkFileAccess(G))Z.push(G)}}catch{return[]}return Z}looksLikeConfigFile(Q){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((Y)=>Y.test(Q))}async validateConfigFile(Q){let X=[];try{if(!kQ(Q))return X.push("Configuration file does not exist"),X;let Y=await import(Q),Z=Y.default||Y;if(Z===void 0)X.push("Configuration file must export a default value or named exports");else if(typeof Z!=="object"||Z===null)X.push("Configuration must be an object");else if(Array.isArray(Z))X.push("Configuration cannot be an array at the root level");if(Q.endsWith(".json"))try{let{readFileSync:$}=await import("fs"),H=$(Q,"utf8");JSON.parse(H)}catch($){X.push(`Invalid JSON syntax: ${$}`)}}catch(Y){X.push(`Failed to load configuration file: ${Y}`)}return X}async getFileModificationTime(Q){try{let{statSync:X}=await import("fs");return X(Q).mtime}catch{return null}}async preloadConfigurations(Q,X={}){let Y=new Map;return await Promise.allSettled(Q.map(async(Z)=>{try{let $=await this.loadFromPath(Z,{},X);if($)Y.set(Z,$.config)}catch($){if(X.verbose)console.warn(`Failed to preload ${Z}:`,$)}})),Y}}var D8=/^https?:\/\//;class zZ{async validateConfiguration(Q,X,Y={}){let{stopOnFirstError:Z=!1,validateRequired:$=!0,validateTypes:H=!0,customRules:U=[],trackPerformance:G=!0,verbose:J=!1}=Y,_=async()=>{let q=[],W=[],z={stopOnFirstError:Z,validateRequired:$,validateTypes:H,customRules:U,trackPerformance:G,verbose:J};try{if(typeof X==="string")return await this.validateWithSchemaFile(Q,X,z);else if(Array.isArray(X))return this.validateWithRules(Q,[...X,...U],z);else return this.validateWithJSONSchema(Q,X,z)}catch(A){return q.push({path:"",message:`Validation failed: ${A}`,rule:"system"}),{isValid:!1,errors:q,warnings:W}}};if(G)return await yX.track("validateConfiguration",_);return _()}async validateWithSchemaFile(Q,X,Y){try{if(!M8(X))throw new aQ(X,[{path:"",message:"Schema file does not exist"}]);let Z=await import(X),$=Z.default||Z;if(Array.isArray($))return this.validateWithRules(Q,$,Y);else return this.validateWithJSONSchema(Q,$,Y)}catch(Z){throw new aQ(X,[{path:"",message:`Failed to load schema: ${Z}`}])}}validateWithJSONSchema(Q,X,Y){let Z=[],$=[];return this.validateObjectAgainstSchema(Q,X,"",Z,$,Y),{isValid:Z.length===0,errors:Z,warnings:$}}validateObjectAgainstSchema(Q,X,Y,Z,$,H){if(H.validateTypes&&X.type){let U=Array.isArray(Q)?"array":typeof Q,G=Array.isArray(X.type)?X.type:[X.type];if(!G.includes(U)){if(Z.push({path:Y,message:`Expected type ${G.join(" or ")}, got ${U}`,expected:G.join(" or "),actual:U,rule:"type"}),H.stopOnFirstError)return}}if(X.enum&&!X.enum.includes(Q)){if(Z.push({path:Y,message:`Value must be one of: ${X.enum.join(", ")}`,expected:X.enum.join(", "),actual:Q,rule:"enum"}),H.stopOnFirstError)return}if(typeof Q==="string"){if(X.minLength!==void 0&&Q.length<X.minLength)Z.push({path:Y,message:`String length must be at least ${X.minLength}`,expected:`>= ${X.minLength}`,actual:Q.length,rule:"minLength"});if(X.maxLength!==void 0&&Q.length>X.maxLength)Z.push({path:Y,message:`String length must not exceed ${X.maxLength}`,expected:`<= ${X.maxLength}`,actual:Q.length,rule:"maxLength"});if(X.pattern){if(!new RegExp(X.pattern).test(Q))Z.push({path:Y,message:`String does not match pattern ${X.pattern}`,expected:X.pattern,actual:Q,rule:"pattern"})}}if(typeof Q==="number"){if(X.minimum!==void 0&&Q<X.minimum)Z.push({path:Y,message:`Value must be at least ${X.minimum}`,expected:`>= ${X.minimum}`,actual:Q,rule:"minimum"});if(X.maximum!==void 0&&Q>X.maximum)Z.push({path:Y,message:`Value must not exceed ${X.maximum}`,expected:`<= ${X.maximum}`,actual:Q,rule:"maximum"})}if(Array.isArray(Q)&&X.items)for(let U=0;U<Q.length;U++){let G=Y?`${Y}[${U}]`:`[${U}]`;if(this.validateObjectAgainstSchema(Q[U],X.items,G,Z,$,H),H.stopOnFirstError&&Z.length>0)return}if(Q&&typeof Q==="object"&&!Array.isArray(Q)){let U=Q;if(H.validateRequired&&X.required){for(let G of X.required)if(!(G in U)){if(Z.push({path:Y?`${Y}.${G}`:G,message:`Missing required property '${G}'`,expected:"required",rule:"required"}),H.stopOnFirstError)return}}if(X.properties){for(let[G,J]of Object.entries(X.properties))if(G in U){let _=Y?`${Y}.${G}`:G;if(this.validateObjectAgainstSchema(U[G],J,_,Z,$,H),H.stopOnFirstError&&Z.length>0)return}}if(X.additionalProperties===!1){let G=new Set(Object.keys(X.properties||{}));for(let J of Object.keys(U))if(!G.has(J))$.push({path:Y?`${Y}.${J}`:J,message:`Additional property '${J}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(Q,X,Y){let Z=[],$=[];for(let H of X)try{let U=this.getValueByPath(Q,H.path),G=this.validateWithRule(U,H,H.path);if(Z.push(...G),Y.stopOnFirstError&&Z.length>0)break}catch(U){Z.push({path:H.path,message:`Rule validation failed: ${U}`,rule:"system"})}return{isValid:Z.length===0,errors:Z,warnings:$}}validateWithRule(Q,X,Y){let Z=[];if(X.required&&(Q===void 0||Q===null))return Z.push({path:Y,message:X.message||`Property '${Y}' is required`,expected:"required",rule:"required"}),Z;if(Q===void 0||Q===null)return Z;if(X.type){let $=Array.isArray(Q)?"array":typeof Q;if($!==X.type)Z.push({path:Y,message:X.message||`Expected type ${X.type}, got ${$}`,expected:X.type,actual:$,rule:"type"})}if(X.min!==void 0){let $=Array.isArray(Q)?Q.length:typeof Q==="string"?Q.length:typeof Q==="number"?Q:0;if($<X.min)Z.push({path:Y,message:X.message||`Value must be at least ${X.min}`,expected:`>= ${X.min}`,actual:$,rule:"min"})}if(X.max!==void 0){let $=Array.isArray(Q)?Q.length:typeof Q==="string"?Q.length:typeof Q==="number"?Q:0;if($>X.max)Z.push({path:Y,message:X.message||`Value must not exceed ${X.max}`,expected:`<= ${X.max}`,actual:$,rule:"max"})}if(X.pattern&&typeof Q==="string"){if(!X.pattern.test(Q))Z.push({path:Y,message:X.message||`Value does not match pattern ${X.pattern}`,expected:X.pattern.toString(),actual:Q,rule:"pattern"})}if(X.enum&&!X.enum.includes(Q))Z.push({path:Y,message:X.message||`Value must be one of: ${X.enum.join(", ")}`,expected:X.enum.join(", "),actual:Q,rule:"enum"});if(X.validator){let $=X.validator(Q);if($)Z.push({path:Y,message:X.message||$,rule:"custom"})}return Z}getValueByPath(Q,X){if(!X)return Q;let Y=X.split("."),Z=Q;for(let $ of Y)if(Z&&typeof Z==="object"&&$ in Z)Z=Z[$];else return;return Z}generateRulesFromInterface(Q){let X=[],Y=Q.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let Z of Y){let[,$,H,U]=Z;X.push({path:$,required:!H,type:this.mapTypeScriptType(U)})}return X}mapTypeScriptType(Q){switch(Q.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:D8},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}var c=new YX("bunfig",{showTags:!0});function V8(Q){if(!Q)return"";let X=Array.isArray(Q)?Q.filter(Boolean):[Q];if(X.length===0)return"";if(X.length===1)return` or alias "${X[0]}"`;return` or aliases ${X.map((Y)=>`"${Y}"`).join(", ")}`}class BZ{fileLoader=new AZ;envProcessor=new cX;validator=new zZ;async loadConfig(Q){let X=Date.now(),{cache:Y,performance:Z,schema:$,validate:H,...U}=Q;try{if(Y?.enabled){let J=this.checkCache(U.name||"",U);if(J)return J}let G;try{G=await this.loadConfigurationStrategies(U,!0,Y)}catch(J){let _=U.__strictErrorHandling;if(J instanceof Error&&J.name==="ConfigNotFoundError"){if(_)throw J;G={...await this.applyEnvironmentVariables(U.name||"",U.defaultConfig,U.checkEnv!==!1,U.verbose||!1),warnings:[`No configuration file found for "${U.name||"config"}", using defaults with environment variables`]}}else if(J instanceof Error&&J.name==="ConfigLoadError"){let q=J.message.includes("EACCES")||J.message.includes("EPERM")||J.message.includes("permission denied"),W=!q&&(J.message.includes("syntax")||J.message.includes("Expected")||J.message.includes("Unexpected")||J.message.includes("BuildMessage")||J.message.includes("errors building")),z=J.message.includes("Configuration must export a valid object")||J.message.includes("Configuration file is empty and exports nothing");if(_&&(z||q))throw J;if(W&&(!_||!z))G={...await this.applyEnvironmentVariables(U.name||"",U.defaultConfig,U.checkEnv!==!1,U.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!_)G={...await this.applyEnvironmentVariables(U.name||"",U.defaultConfig,U.checkEnv!==!1,U.verbose||!1),warnings:[`Configuration loading error, using defaults: ${J.message}`]};else throw J}else G={...await this.applyEnvironmentVariables(U.name||"",U.defaultConfig,U.checkEnv!==!1,U.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${J instanceof Error?J.message:String(J)}`]}}if($||H)await this.validateConfiguration(G.config,$,H,U.name);if(Y?.enabled&&G)this.cacheResult(U.name||"",G,Y,U);if(Z?.enabled){let J={operation:"loadConfig",duration:Date.now()-X,configName:U.name,timestamp:new Date};if(Z.onMetrics)Z.onMetrics(J);if(Z.slowThreshold&&J.duration>Z.slowThreshold)c.warn(`Slow configuration loading detected: ${J.duration}ms for ${U.name}`);G.metrics=J}return G}catch(G){if(G instanceof Error&&G.name==="ConfigNotFoundError")throw G;let J=Date.now()-X;throw c.error(`Configuration loading failed after ${J}ms:`,[G instanceof Error?G:Error(String(G))]),G}}async loadConfigurationStrategies(Q,X=!1,Y){let{name:Z="",alias:$,cwd:H,configDir:U,defaultConfig:G,checkEnv:J=!0,arrayStrategy:_="replace",verbose:q=!1}=Q,W=H||eQ.cwd(),z=[],A=await this.loadLocalConfiguration(Z,$,W,U,G,_,q,J,Y);if(A)return z.push(...this.getLocalSearchPaths(Z,$,W,U)),this.finalizeResult(A,z,J,Z,q);let I=await this.loadHomeConfiguration(Z,$,G,_,q,J);if(I)return z.push(...this.getHomeSearchPaths(Z,$)),this.finalizeResult(I,z,J,Z,q);let B=await this.loadPackageJsonConfiguration(Z,$,W,G,_,q,J);if(B)return z.push(d(W,"package.json")),this.finalizeResult(B,z,J,Z,q);if(z.push(...this.getAllSearchPaths(Z,$,W,U)),X)throw BQ.configNotFound(Z,z,$);return{...await this.applyEnvironmentVariables(Z,G,J,q),warnings:[`No configuration file found for "${Z}"${V8($)}, using defaults with environment variables`]}}async loadLocalConfiguration(Q,X,Y,Z,$,H,U,G,J){let _=G?PQ(Q,$,U):$,q=this.getLocalDirectories(Y,Z);for(let W of q){if(U)c.info(`Searching for configuration in: ${W}`);let z=this.fileLoader.generateConfigPaths(Q,W,X),A=await this.fileLoader.tryLoadFromPaths(z,_,{arrayStrategy:H,verbose:U,cacheTtl:J?.ttl,useCache:!J?.ttl||J.ttl>100});if(A){if(U)c.success(`Configuration loaded from: ${A.source.path}`);return A}}return null}async loadHomeConfiguration(Q,X,Y,Z,$,H){if(!Q)return null;let U=H?PQ(Q,Y,$):Y,G=[d(YQ(),".config",Q),d(YQ(),".config"),YQ()];for(let J of G){if($)c.info(`Checking home directory: ${J}`);let _=this.fileLoader.generateConfigPaths(Q,J,X),q=await this.fileLoader.tryLoadFromPaths(_,U,{arrayStrategy:Z,verbose:$});if(q){if($)c.success(`Configuration loaded from home directory: ${q.source.path}`);return q}}return null}async loadPackageJsonConfiguration(Q,X,Y,Z,$,H,U){let G=U?PQ(Q,Z,H):Z;try{let J=d(Y,"package.json");if(!LZ(J))return null;let _={};try{_=JSON.parse(KZ(J,"utf8"))}catch(z){if(H)c.warn("Failed to parse package.json:",[z instanceof Error?z:Error(String(z))]);return null}let q=_[Q],W=Q;if(!q&&X){let z=Array.isArray(X)?X:[X];for(let A of z){if(!A)continue;if(_[A]){q=_[A],W=A;break}}}if(q&&typeof q==="object"&&!Array.isArray(q)){if(H)c.success(`Configuration loaded from package.json: ${W}`);return{config:WZ(G,q,$),source:{type:"package.json",path:J,priority:30,timestamp:new Date}}}}catch(J){if(H)c.warn("Failed to load package.json:",[J instanceof Error?J:Error(String(J))])}return null}async applyEnvironmentVariables(Q,X,Y,Z){if(!Y||!Q||typeof X!=="object"||X===null||Array.isArray(X))return{config:X,source:{type:"default",priority:10,timestamp:new Date}};return{config:PQ(Q,X,Z),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(Q,X,Y,Z,$){return{config:Q.config,source:Q.source,path:Q.source.path}}async validateConfiguration(Q,X,Y,Z){let $=[];if(Y){let H=Y(Q);if(H)$.push(...H)}if(X){let H=await this.validator.validateConfiguration(Q,X);if(!H.isValid)$.push(...H.errors.map((U)=>U.path?`${U.path}: ${U.message}`:U.message))}if($.length>0)throw BQ.configValidation(Z||"unknown",$,Z)}checkCache(Q,X){let Y=this.generateCacheKey(Q,X);return fQ.get(Y)||null}cacheResult(Q,X,Y,Z){let $=this.generateCacheKey(Q,Z);fQ.set($,X,void 0,Y.ttl)}generateCacheKey(Q,X){let Y=[Q];if(X.alias){let Z=Array.isArray(X.alias)?X.alias.join(","):X.alias;Y.push(`alias:${Z}`)}if(X.cwd)Y.push(`cwd:${X.cwd}`);if(X.configDir)Y.push(`configDir:${X.configDir}`);if("checkEnv"in X)Y.push(`checkEnv:${X.checkEnv}`);return Y.join("|")}getLocalDirectories(Q,X){return Array.from(new Set([Q,d(Q,"config"),d(Q,".config"),X?d(Q,X):void 0].filter(Boolean)))}getAllSearchPaths(Q,X,Y,Z){let $=[];return $.push(...this.getLocalSearchPaths(Q,X,Y,Z)),$.push(...this.getHomeSearchPaths(Q,X)),$.push(d(Y,"package.json")),$}getLocalSearchPaths(Q,X,Y,Z){let $=this.getLocalDirectories(Y,Z),H=[];for(let U of $)H.push(...this.fileLoader.generateConfigPaths(Q,U,X));return H}getHomeSearchPaths(Q,X){if(!Q)return[];let Y=[d(YQ(),".config",Q),d(YQ(),".config"),YQ()],Z=[];for(let $ of Y)Z.push(...this.fileLoader.generateConfigPaths(Q,$,X));return Z}async loadConfigWithResult(Q){return this.loadConfig(Q)}}var MX=new BZ;async function RZ(Q){let X="defaultConfig"in Q&&Q.defaultConfig!==void 0?Q.defaultConfig:{},Y="cache"in Q||"performance"in Q||"schema"in Q||"validate"in Q;try{let Z;if(Y)Z=await MX.loadConfig(Q);else Z=await MX.loadConfig({...Q,defaultConfig:X,cache:{enabled:!0},performance:{enabled:!1}});return Z?.config??X}catch(Z){let $=Z instanceof Error?Z.name:"UnknownError",H=Z instanceof Error?Z.message:String(Z);if(!($==="ConfigNotFoundError"||$==="ConfigLoadError"||$==="ConfigValidationError"||H.includes("config"))&&Q.verbose)c.warn("Unexpected error loading config, using defaults:",[Z instanceof Error?Z:Error(String(Z))]);let G=Y?{...Q,defaultConfig:X}:{...Q,defaultConfig:X,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in Q?Q.checkEnv!==!1:!0)return(await MX.applyEnvironmentVariables(G.name||"",X,!0,G.verbose||!1))?.config??X;return X}}function PQ(Q,X,Y=!1){let Z=new cX,$=Q.toUpperCase().replace(/[^A-Z0-9]/g,"_");function H(U,G=[]){let J={...U};for(let[_,q]of Object.entries(U)){let W=[...G,_],z=[`${$}_${W.join("_").toUpperCase()}`,`${$}_${W.map((B)=>B.toUpperCase()).join("")}`,`${$}_${W.map((B)=>B.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],A,I;for(let B of z)if(A=eQ.env[B],A!==void 0){I=B;break}if(A!==void 0&&I)if(typeof q==="boolean")J[_]=["true","1","yes"].includes(A.toLowerCase());else if(typeof q==="number"){let B=Number(A);if(!Number.isNaN(B))J[_]=B}else if(Array.isArray(q))try{J[_]=JSON.parse(A)}catch{J[_]=A.split(",").map((B)=>B.trim())}else J[_]=A;else if(q&&typeof q==="object"&&!Array.isArray(q))J[_]=H(q,W)}return J}return H(X)}var J$=d(eQ.cwd(),"config"),G$=d(eQ.cwd(),"src/generated");var S8=["code-style","lint"],wZ={ignores:["**/node_modules/**","**/.pnpm/**","**/.yarn/**","**/dist/**","**/build/**","**/out/**","**/.output/**","**/.next/**","**/.nuxt/**","**/.vite/**","**/.turbo/**","**/.cache/**","**/coverage/**","**/vendor/**","**/pantry/**","**/tmp/**","**/.git/**","**/.idea/**","**/.vscode/**","**/.zed/**","**/.cursor/**","**/.claude/**","**/.github/**","**/*.test.ts","**/*.spec.ts","**/.bunpress/**","**/.vitepress/cache/**","**/storage/framework/stx/**","**/storage/framework/runtime/**","**/*.lock","**/package-lock.json","**/pnpm-lock.yaml"],lint:{extensions:["ts","js","html","css","json","jsonc","md","yaml","yml","stx","sh","bash","zsh"],reporter:"stylish",cache:!1,maxWarnings:-1},format:{extensions:["ts","js","html","css","json","jsonc","md","yaml","yml","stx","sh","bash","zsh"],trimTrailingWhitespace:!0,maxConsecutiveBlankLines:1,finalNewline:"one",indent:2,indentStyle:"spaces",preserveCodeIndentation:!1,quotes:"single",semi:!1},rules:{noDebugger:"error",noConsole:"warn"},pluginRules:{"style/brace-style":"warn","style/curly":"off","style/if-newline":"off","style/max-statements-per-line":"warn","pickier/import-dedupe":"warn","pickier/no-import-node-modules-by-path":"error","pickier/no-import-dist":"error","pickier/prefer-const":"error","pickier/prefer-template":"warn","pickier/no-unused-vars":"error","pickier/sort-tailwind-classes":"warn","regexp/no-unused-capturing-group":"error","regexp/no-super-linear-backtracking":"error","regexp/no-useless-lazy":"error","ts/no-top-level-await":"error","ts/member-delimiter-style":"off","ts/type-annotation-spacing":"off","style/comma-dangle":"off","style/keyword-spacing":"off","style/arrow-spacing":"off","style/space-infix-ops":"off","style/object-curly-spacing":"off","style/spaced-comment":"off","style/block-spacing":"off","style/space-before-blocks":"off","style/comma-spacing":"off","style/semi-spacing":"off","style/rest-spread-spacing":"off","style/key-spacing":"off","style/computed-property-spacing":"off","style/array-bracket-spacing":"off","style/space-in-parens":"off","style/template-curly-spacing":"off","style/space-unary-ops":"off","style/switch-colon-spacing":"off","style/arrow-parens":"off","style/space-before-function-paren":"off","style/quote-props":"off","style/no-floating-decimal":"off","style/new-parens":"off","style/no-extra-parens":"off","style/wrap-iife":"off","style/comma-style":"off","style/dot-location":"off","style/operator-linebreak":"off","style/multiline-ternary":"off","style/padded-blocks":"off","style/lines-between-class-members":"off","style/no-tabs":"off","style/no-mixed-spaces-and-tabs":"off","style/generator-star-spacing":"off","style/yield-star-spacing":"off","style/function-call-spacing":"off","style/template-tag-spacing":"off","style/no-whitespace-before-property":"off","style/no-mixed-operators":"off","style/indent-binary-ops":"off","ts/type-generic-spacing":"off","ts/type-named-tuple-spacing":"off","markdown/heading-increment":"warn","markdown/heading-style":"warn","markdown/no-missing-space-atx":"error","markdown/no-multiple-space-atx":"error","markdown/no-missing-space-closed-atx":"error","markdown/no-multiple-space-closed-atx":"error","markdown/blanks-around-headings":"warn","markdown/heading-start-left":"warn","markdown/no-duplicate-heading":"warn","markdown/single-title":"warn","markdown/no-trailing-punctuation":"warn","markdown/ul-style":"warn","markdown/list-indent":"error","markdown/ul-indent":"warn","markdown/ol-prefix":"warn","markdown/list-marker-space":"error","markdown/blanks-around-lists":"warn","markdown/no-trailing-spaces":"error","markdown/no-hard-tabs":"error","markdown/no-multiple-blanks":"warn","markdown/no-multiple-space-blockquote":"error","markdown/no-blanks-blockquote":"warn","markdown/blanks-around-fences":"warn","markdown/single-trailing-newline":"error","markdown/blanks-around-tables":"warn","markdown/no-reversed-links":"error","markdown/no-bare-urls":"warn","markdown/no-space-in-links":"error","markdown/no-empty-links":"error","markdown/link-fragments":"warn","markdown/reference-links-images":"warn","markdown/link-image-reference-definitions":"warn","markdown/link-image-style":"warn","markdown/descriptive-link-text":"warn","markdown/line-length":"off","markdown/commands-show-output":"warn","markdown/fenced-code-language":"warn","markdown/code-block-style":"off","markdown/code-fence-style":"warn","markdown/no-emphasis-as-heading":"warn","markdown/no-space-in-emphasis":"warn","markdown/no-space-in-code":"warn","markdown/emphasis-style":"warn","markdown/strong-style":"warn","markdown/no-inline-html":"off","markdown/hr-style":"warn","markdown/first-line-heading":"off","markdown/required-headings":"off","markdown/proper-names":"off","markdown/no-alt-text":"warn","markdown/table-pipe-style":"warn","markdown/table-column-count":"warn","markdown/table-column-style":"warn","lockfile/validate-host":["warn",{allowedHosts:["npm","yarn"]}],"lockfile/validate-https":"error","lockfile/validate-integrity":["warn",{requiredAlgorithm:"sha512"}],"lockfile/validate-package-names":"error","lockfile/validate-scheme":["error",{allowedSchemes:["https:","git+https:","git+ssh:"]}],"publint/exports-types-should-be-first":"error","publint/exports-default-should-be-last":"error","publint/exports-module-should-precede-require":"error","publint/exports-value-invalid":"error","publint/imports-key-invalid":"error","publint/imports-value-invalid":"error","publint/imports-default-should-be-last":"error","publint/imports-module-should-precede-require":"error","publint/use-type":"warn","publint/deprecated-field-jsnext":"warn","publint/field-invalid-value-type":"error","publint/local-dependency":"error","publint/has-module-but-no-exports":"warn","publint/exports-missing-root-entrypoint":"warn","publint/exports-fallback-array-use":"warn","publint/file-does-not-exist":"warn","publint/file-invalid-format":"warn","publint/module-should-be-esm":"error","publint/bin-file-not-executable":"error","publint/exports-module-should-be-esm":"error","shell/command-substitution":"error","shell/quote-variables":"warn","shell/no-cd-without-check":"warn","shell/no-eval":"error","shell/no-useless-cat":"warn","shell/shebang":"warn","shell/indent":"warn","shell/function-style":"warn","shell/operator-spacing":"warn","shell/keyword-spacing":"warn","shell/no-trailing-semicolons":"warn","shell/no-trailing-whitespace":"error","shell/prefer-double-brackets":"warn","shell/set-options":"off","shell/prefer-printf":"warn","shell/consistent-case-terminators":"warn","shell/no-broken-redirect":"error","shell/heredoc-indent":"warn","shell/no-ls-parsing":"warn","shell/no-variable-in-single-quotes":"warn","shell/no-exit-in-subshell":"warn","spell/check":"off","spell/check-comments":"off","spell/check-markdown":"off"},verbose:!0},lX=null;async function W$(){if(!lX)lX=await RZ({name:"pickier",alias:[...S8],defaultConfig:wZ});return lX}var A$=wZ;
|
|
61
|
+
`;return Y}}function L8(Q,X,Y={}){return _Z(Q,X,Y,new WeakMap)}function _Z(Q,X,Y,Z){let{arrayMergeMode:$="replace",skipNullish:H=!1,customMerger:U}=Y;if(X===null||X===void 0)return H?Q:X;if(U){let G=U(Q,X);if(G!==void 0)return G}if(Array.isArray(X)||Array.isArray(Q))return qZ(Q,X,$,Z);if(!f(X)||!f(Q))return X;return F8(Q,X,Y,Z)}function qZ(Q,X,Y,Z){if(Array.isArray(X)&&!Array.isArray(Q))return X;if(Array.isArray(Q)&&!Array.isArray(X))return X;if(Array.isArray(X)&&Array.isArray(Q))switch(Y){case"replace":return X;case"concat":return K8(Q,X);case"smart":return j8(Q,X,Z);default:return X}return X}function K8(Q,X){let Y=[...X];for(let Z of Q)if(!Y.some(($)=>bX($,Z)))Y.push(Z);return Y}function j8(Q,X,Y){if(X.length===0)return Q;if(Q.length===0)return X;if(f(X[0])&&f(Q[0]))return I8(Q,X,Y);if(X.every((Z)=>typeof Z==="string")&&Q.every((Z)=>typeof Z==="string")){let Z=[...X];for(let $ of Q)if(!Z.includes($))Z.push($);return Z}return X}function I8(Q,X,Y){let Z=[...X];for(let $ of Q){if(!f($)){Z.push($);continue}let H=["id","name","key","path","type"],U=!1;for(let G of H)if(G in $){if(Z.find((_)=>f(_)&&(G in _)&&_[G]===$[G])){U=!0;break}}if(!U)Z.push($)}return Z}function F8(Q,X,Y,Z){let $=X;if(f($)&&Z.has($))return Z.get($);let H={...Q};if(f($))Z.set($,H);for(let U in $){if(!Object.prototype.hasOwnProperty.call($,U))continue;let G=$[U],J=H[U];if(Y.skipNullish&&(G===null||G===void 0))continue;if(G===null||G===void 0){H[U]=G;continue}if(f(G)&&f(J))H[U]=_Z(J,G,Y,Z);else if(Array.isArray(G)||Array.isArray(J))H[U]=qZ(J,G,Y.arrayMergeMode||"smart",Z);else H[U]=G}return H}function WZ(Q,X,Y="replace"){return L8(Q,X,{arrayMergeMode:Y==="replace"?"replace":"smart",skipNullish:!0})}function bX(Q,X){if(Q===X)return!0;if(Array.isArray(Q)&&Array.isArray(X)){if(Q.length!==X.length)return!1;for(let Y=0;Y<Q.length;Y++)if(!bX(Q[Y],X[Y]))return!1;return!0}if(f(Q)&&f(X)){let Y=Object.keys(Q),Z=Object.keys(X);if(Y.length!==Z.length)return!1;for(let $ of Y){if(!Object.prototype.hasOwnProperty.call(X,$))return!1;if(!bX(Q[$],X[$]))return!1}return!0}return!1}function f(Q){return Boolean(Q&&typeof Q==="object"&&!Array.isArray(Q))}class AZ{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(Q,X,Y={}){let{arrayStrategy:Z="replace",useCache:$=!0,cacheTtl:H,trackPerformance:U=!0,verbose:G=!1}=Y;if($){let _=fQ.getWithFileCheck("file",Q);if(_){if(G)console.log(`Configuration loaded from cache: ${Q}`);return _}}let J=async()=>{if(!kQ(Q))return null;try{let _=`?t=${Date.now()}`,q=await import(Q+_),W=q.default||q,z="default"in q,A=Object.keys(q).length>0;if(!z&&!A)throw new rQ(Q,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof W!=="object"||W===null||Array.isArray(W))throw new rQ(Q,Error("Configuration must export a valid object"),"unknown");let K={config:WZ(X,W,Z),source:{type:"file",path:Q,priority:100,timestamp:new Date}};if($)fQ.setWithFileCheck("file",K,Q,H);return K}catch(_){throw _ instanceof Error?BQ.configLoad(Q,_):BQ.configLoad(Q,Error(String(_)))}};if(U)return yX.track("loadFromPath",J,{path:Q});return J()}async tryLoadFromPaths(Q,X,Y={}){for(let Z of Q)try{let $=await this.loadFromPath(Z,X,Y);if($)return $}catch($){if($ instanceof Error&&$.name==="ConfigLoadError")throw $;if(Y.verbose)console.warn(`Failed to load config from ${Z}:`,$)}return null}generateConfigPaths(Q,X,Y){let Z=this.generateNamePatterns(Q,Y),$=[];for(let H of Z)for(let U of this.extensions)$.push(FX(X,`${H}${U}`));return $}generateNamePatterns(Q,X){let Y=[];if(Y.push("config",".config"),Q)Y.push(Q,`.${Q}.config`,`${Q}.config`,`.${Q}`);let Z=X===void 0?[]:Array.isArray(X)?X:[X];for(let H of Z){if(!H)continue;if(Y.push(H,`.${H}.config`,`${H}.config`,`.${H}`),Q)Y.push(`${Q}.${H}.config`,`.${Q}.${H}.config`)}let $=new Set;return Y.filter((H)=>{if(!H||$.has(H))return!1;return $.add(H),!0})}checkFileAccess(Q){return w8(async()=>{return kQ(Q)},{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(Q,X,Y){let Z=[];if(!kQ(Q))return Z;if(X||Y){let $=this.generateNamePatterns(X||"",Y);for(let H of $)for(let U of this.extensions){let G=FX(Q,`${H}${U}`);if(await this.checkFileAccess(G))Z.push(G)}}else try{let{readdirSync:$}=await import("fs"),H=$(Q);for(let U of H)if(this.looksLikeConfigFile(U)){let G=FX(Q,U);if(await this.checkFileAccess(G))Z.push(G)}}catch{return[]}return Z}looksLikeConfigFile(Q){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((Y)=>Y.test(Q))}async validateConfigFile(Q){let X=[];try{if(!kQ(Q))return X.push("Configuration file does not exist"),X;let Y=await import(Q),Z=Y.default||Y;if(Z===void 0)X.push("Configuration file must export a default value or named exports");else if(typeof Z!=="object"||Z===null)X.push("Configuration must be an object");else if(Array.isArray(Z))X.push("Configuration cannot be an array at the root level");if(Q.endsWith(".json"))try{let{readFileSync:$}=await import("fs"),H=$(Q,"utf8");JSON.parse(H)}catch($){X.push(`Invalid JSON syntax: ${$}`)}}catch(Y){X.push(`Failed to load configuration file: ${Y}`)}return X}async getFileModificationTime(Q){try{let{statSync:X}=await import("fs");return X(Q).mtime}catch{return null}}async preloadConfigurations(Q,X={}){let Y=new Map;return await Promise.allSettled(Q.map(async(Z)=>{try{let $=await this.loadFromPath(Z,{},X);if($)Y.set(Z,$.config)}catch($){if(X.verbose)console.warn(`Failed to preload ${Z}:`,$)}})),Y}}var D8=/^https?:\/\//;class zZ{async validateConfiguration(Q,X,Y={}){let{stopOnFirstError:Z=!1,validateRequired:$=!0,validateTypes:H=!0,customRules:U=[],trackPerformance:G=!0,verbose:J=!1}=Y,_=async()=>{let q=[],W=[],z={stopOnFirstError:Z,validateRequired:$,validateTypes:H,customRules:U,trackPerformance:G,verbose:J};try{if(typeof X==="string")return await this.validateWithSchemaFile(Q,X,z);else if(Array.isArray(X))return this.validateWithRules(Q,[...X,...U],z);else return this.validateWithJSONSchema(Q,X,z)}catch(A){return q.push({path:"",message:`Validation failed: ${A}`,rule:"system"}),{isValid:!1,errors:q,warnings:W}}};if(G)return await yX.track("validateConfiguration",_);return _()}async validateWithSchemaFile(Q,X,Y){try{if(!M8(X))throw new aQ(X,[{path:"",message:"Schema file does not exist"}]);let Z=await import(X),$=Z.default||Z;if(Array.isArray($))return this.validateWithRules(Q,$,Y);else return this.validateWithJSONSchema(Q,$,Y)}catch(Z){throw new aQ(X,[{path:"",message:`Failed to load schema: ${Z}`}])}}validateWithJSONSchema(Q,X,Y){let Z=[],$=[];return this.validateObjectAgainstSchema(Q,X,"",Z,$,Y),{isValid:Z.length===0,errors:Z,warnings:$}}validateObjectAgainstSchema(Q,X,Y,Z,$,H){if(H.validateTypes&&X.type){let U=Array.isArray(Q)?"array":typeof Q,G=Array.isArray(X.type)?X.type:[X.type];if(!G.includes(U)){if(Z.push({path:Y,message:`Expected type ${G.join(" or ")}, got ${U}`,expected:G.join(" or "),actual:U,rule:"type"}),H.stopOnFirstError)return}}if(X.enum&&!X.enum.includes(Q)){if(Z.push({path:Y,message:`Value must be one of: ${X.enum.join(", ")}`,expected:X.enum.join(", "),actual:Q,rule:"enum"}),H.stopOnFirstError)return}if(typeof Q==="string"){if(X.minLength!==void 0&&Q.length<X.minLength)Z.push({path:Y,message:`String length must be at least ${X.minLength}`,expected:`>= ${X.minLength}`,actual:Q.length,rule:"minLength"});if(X.maxLength!==void 0&&Q.length>X.maxLength)Z.push({path:Y,message:`String length must not exceed ${X.maxLength}`,expected:`<= ${X.maxLength}`,actual:Q.length,rule:"maxLength"});if(X.pattern){if(!new RegExp(X.pattern).test(Q))Z.push({path:Y,message:`String does not match pattern ${X.pattern}`,expected:X.pattern,actual:Q,rule:"pattern"})}}if(typeof Q==="number"){if(X.minimum!==void 0&&Q<X.minimum)Z.push({path:Y,message:`Value must be at least ${X.minimum}`,expected:`>= ${X.minimum}`,actual:Q,rule:"minimum"});if(X.maximum!==void 0&&Q>X.maximum)Z.push({path:Y,message:`Value must not exceed ${X.maximum}`,expected:`<= ${X.maximum}`,actual:Q,rule:"maximum"})}if(Array.isArray(Q)&&X.items)for(let U=0;U<Q.length;U++){let G=Y?`${Y}[${U}]`:`[${U}]`;if(this.validateObjectAgainstSchema(Q[U],X.items,G,Z,$,H),H.stopOnFirstError&&Z.length>0)return}if(Q&&typeof Q==="object"&&!Array.isArray(Q)){let U=Q;if(H.validateRequired&&X.required){for(let G of X.required)if(!(G in U)){if(Z.push({path:Y?`${Y}.${G}`:G,message:`Missing required property '${G}'`,expected:"required",rule:"required"}),H.stopOnFirstError)return}}if(X.properties){for(let[G,J]of Object.entries(X.properties))if(G in U){let _=Y?`${Y}.${G}`:G;if(this.validateObjectAgainstSchema(U[G],J,_,Z,$,H),H.stopOnFirstError&&Z.length>0)return}}if(X.additionalProperties===!1){let G=new Set(Object.keys(X.properties||{}));for(let J of Object.keys(U))if(!G.has(J))$.push({path:Y?`${Y}.${J}`:J,message:`Additional property '${J}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(Q,X,Y){let Z=[],$=[];for(let H of X)try{let U=this.getValueByPath(Q,H.path),G=this.validateWithRule(U,H,H.path);if(Z.push(...G),Y.stopOnFirstError&&Z.length>0)break}catch(U){Z.push({path:H.path,message:`Rule validation failed: ${U}`,rule:"system"})}return{isValid:Z.length===0,errors:Z,warnings:$}}validateWithRule(Q,X,Y){let Z=[];if(X.required&&(Q===void 0||Q===null))return Z.push({path:Y,message:X.message||`Property '${Y}' is required`,expected:"required",rule:"required"}),Z;if(Q===void 0||Q===null)return Z;if(X.type){let $=Array.isArray(Q)?"array":typeof Q;if($!==X.type)Z.push({path:Y,message:X.message||`Expected type ${X.type}, got ${$}`,expected:X.type,actual:$,rule:"type"})}if(X.min!==void 0){let $=Array.isArray(Q)?Q.length:typeof Q==="string"?Q.length:typeof Q==="number"?Q:0;if($<X.min)Z.push({path:Y,message:X.message||`Value must be at least ${X.min}`,expected:`>= ${X.min}`,actual:$,rule:"min"})}if(X.max!==void 0){let $=Array.isArray(Q)?Q.length:typeof Q==="string"?Q.length:typeof Q==="number"?Q:0;if($>X.max)Z.push({path:Y,message:X.message||`Value must not exceed ${X.max}`,expected:`<= ${X.max}`,actual:$,rule:"max"})}if(X.pattern&&typeof Q==="string"){if(!X.pattern.test(Q))Z.push({path:Y,message:X.message||`Value does not match pattern ${X.pattern}`,expected:X.pattern.toString(),actual:Q,rule:"pattern"})}if(X.enum&&!X.enum.includes(Q))Z.push({path:Y,message:X.message||`Value must be one of: ${X.enum.join(", ")}`,expected:X.enum.join(", "),actual:Q,rule:"enum"});if(X.validator){let $=X.validator(Q);if($)Z.push({path:Y,message:X.message||$,rule:"custom"})}return Z}getValueByPath(Q,X){if(!X)return Q;let Y=X.split("."),Z=Q;for(let $ of Y)if(Z&&typeof Z==="object"&&$ in Z)Z=Z[$];else return;return Z}generateRulesFromInterface(Q){let X=[],Y=Q.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let Z of Y){let[,$,H,U]=Z;X.push({path:$,required:!H,type:this.mapTypeScriptType(U)})}return X}mapTypeScriptType(Q){switch(Q.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:D8},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}var c=new YX("bunfig",{showTags:!0});function V8(Q){if(!Q)return"";let X=Array.isArray(Q)?Q.filter(Boolean):[Q];if(X.length===0)return"";if(X.length===1)return` or alias "${X[0]}"`;return` or aliases ${X.map((Y)=>`"${Y}"`).join(", ")}`}class BZ{fileLoader=new AZ;envProcessor=new cX;validator=new zZ;async loadConfig(Q){let X=Date.now(),{cache:Y,performance:Z,schema:$,validate:H,...U}=Q;try{if(Y?.enabled){let J=this.checkCache(U.name||"",U);if(J)return J}let G;try{G=await this.loadConfigurationStrategies(U,!0,Y)}catch(J){let _=U.__strictErrorHandling;if(J instanceof Error&&J.name==="ConfigNotFoundError"){if(_)throw J;G={...await this.applyEnvironmentVariables(U.name||"",U.defaultConfig,U.checkEnv!==!1,U.verbose||!1),warnings:[`No configuration file found for "${U.name||"config"}", using defaults with environment variables`]}}else if(J instanceof Error&&J.name==="ConfigLoadError"){let q=J.message.includes("EACCES")||J.message.includes("EPERM")||J.message.includes("permission denied"),W=!q&&(J.message.includes("syntax")||J.message.includes("Expected")||J.message.includes("Unexpected")||J.message.includes("BuildMessage")||J.message.includes("errors building")),z=J.message.includes("Configuration must export a valid object")||J.message.includes("Configuration file is empty and exports nothing");if(_&&(z||q))throw J;if(W&&(!_||!z))G={...await this.applyEnvironmentVariables(U.name||"",U.defaultConfig,U.checkEnv!==!1,U.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!_)G={...await this.applyEnvironmentVariables(U.name||"",U.defaultConfig,U.checkEnv!==!1,U.verbose||!1),warnings:[`Configuration loading error, using defaults: ${J.message}`]};else throw J}else G={...await this.applyEnvironmentVariables(U.name||"",U.defaultConfig,U.checkEnv!==!1,U.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${J instanceof Error?J.message:String(J)}`]}}if($||H)await this.validateConfiguration(G.config,$,H,U.name);if(Y?.enabled&&G)this.cacheResult(U.name||"",G,Y,U);if(Z?.enabled){let J={operation:"loadConfig",duration:Date.now()-X,configName:U.name,timestamp:new Date};if(Z.onMetrics)Z.onMetrics(J);if(Z.slowThreshold&&J.duration>Z.slowThreshold)c.warn(`Slow configuration loading detected: ${J.duration}ms for ${U.name}`);G.metrics=J}return G}catch(G){if(G instanceof Error&&G.name==="ConfigNotFoundError")throw G;let J=Date.now()-X;throw c.error(`Configuration loading failed after ${J}ms:`,[G instanceof Error?G:Error(String(G))]),G}}async loadConfigurationStrategies(Q,X=!1,Y){let{name:Z="",alias:$,cwd:H,configDir:U,defaultConfig:G,checkEnv:J=!0,arrayStrategy:_="replace",verbose:q=!1}=Q,W=H||eQ.cwd(),z=[],A=await this.loadLocalConfiguration(Z,$,W,U,G,_,q,J,Y);if(A)return z.push(...this.getLocalSearchPaths(Z,$,W,U)),this.finalizeResult(A,z,J,Z,q);let I=await this.loadHomeConfiguration(Z,$,G,_,q,J);if(I)return z.push(...this.getHomeSearchPaths(Z,$)),this.finalizeResult(I,z,J,Z,q);let B=await this.loadPackageJsonConfiguration(Z,$,W,G,_,q,J);if(B)return z.push(d(W,"package.json")),this.finalizeResult(B,z,J,Z,q);if(z.push(...this.getAllSearchPaths(Z,$,W,U)),X)throw BQ.configNotFound(Z,z,$);return{...await this.applyEnvironmentVariables(Z,G,J,q),warnings:[`No configuration file found for "${Z}"${V8($)}, using defaults with environment variables`]}}async loadLocalConfiguration(Q,X,Y,Z,$,H,U,G,J){let _=G?PQ(Q,$,U):$,q=this.getLocalDirectories(Y,Z);for(let W of q){if(U)c.info(`Searching for configuration in: ${W}`);let z=this.fileLoader.generateConfigPaths(Q,W,X),A=await this.fileLoader.tryLoadFromPaths(z,_,{arrayStrategy:H,verbose:U,cacheTtl:J?.ttl,useCache:!J?.ttl||J.ttl>100});if(A){if(U)c.success(`Configuration loaded from: ${A.source.path}`);return A}}return null}async loadHomeConfiguration(Q,X,Y,Z,$,H){if(!Q)return null;let U=H?PQ(Q,Y,$):Y,G=[d(YQ(),".config",Q),d(YQ(),".config"),YQ()];for(let J of G){if($)c.info(`Checking home directory: ${J}`);let _=this.fileLoader.generateConfigPaths(Q,J,X),q=await this.fileLoader.tryLoadFromPaths(_,U,{arrayStrategy:Z,verbose:$});if(q){if($)c.success(`Configuration loaded from home directory: ${q.source.path}`);return q}}return null}async loadPackageJsonConfiguration(Q,X,Y,Z,$,H,U){let G=U?PQ(Q,Z,H):Z;try{let J=d(Y,"package.json");if(!LZ(J))return null;let _={};try{_=JSON.parse(KZ(J,"utf8"))}catch(z){if(H)c.warn("Failed to parse package.json:",[z instanceof Error?z:Error(String(z))]);return null}let q=_[Q],W=Q;if(!q&&X){let z=Array.isArray(X)?X:[X];for(let A of z){if(!A)continue;if(_[A]){q=_[A],W=A;break}}}if(q&&typeof q==="object"&&!Array.isArray(q)){if(H)c.success(`Configuration loaded from package.json: ${W}`);return{config:WZ(G,q,$),source:{type:"package.json",path:J,priority:30,timestamp:new Date}}}}catch(J){if(H)c.warn("Failed to load package.json:",[J instanceof Error?J:Error(String(J))])}return null}async applyEnvironmentVariables(Q,X,Y,Z){if(!Y||!Q||typeof X!=="object"||X===null||Array.isArray(X))return{config:X,source:{type:"default",priority:10,timestamp:new Date}};return{config:PQ(Q,X,Z),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(Q,X,Y,Z,$){return{config:Q.config,source:Q.source,path:Q.source.path}}async validateConfiguration(Q,X,Y,Z){let $=[];if(Y){let H=Y(Q);if(H)$.push(...H)}if(X){let H=await this.validator.validateConfiguration(Q,X);if(!H.isValid)$.push(...H.errors.map((U)=>U.path?`${U.path}: ${U.message}`:U.message))}if($.length>0)throw BQ.configValidation(Z||"unknown",$,Z)}checkCache(Q,X){let Y=this.generateCacheKey(Q,X);return fQ.get(Y)||null}cacheResult(Q,X,Y,Z){let $=this.generateCacheKey(Q,Z);fQ.set($,X,void 0,Y.ttl)}generateCacheKey(Q,X){let Y=[Q];if(X.alias){let Z=Array.isArray(X.alias)?X.alias.join(","):X.alias;Y.push(`alias:${Z}`)}if(X.cwd)Y.push(`cwd:${X.cwd}`);if(X.configDir)Y.push(`configDir:${X.configDir}`);if("checkEnv"in X)Y.push(`checkEnv:${X.checkEnv}`);return Y.join("|")}getLocalDirectories(Q,X){return Array.from(new Set([Q,d(Q,"config"),d(Q,".config"),X?d(Q,X):void 0].filter(Boolean)))}getAllSearchPaths(Q,X,Y,Z){let $=[];return $.push(...this.getLocalSearchPaths(Q,X,Y,Z)),$.push(...this.getHomeSearchPaths(Q,X)),$.push(d(Y,"package.json")),$}getLocalSearchPaths(Q,X,Y,Z){let $=this.getLocalDirectories(Y,Z),H=[];for(let U of $)H.push(...this.fileLoader.generateConfigPaths(Q,U,X));return H}getHomeSearchPaths(Q,X){if(!Q)return[];let Y=[d(YQ(),".config",Q),d(YQ(),".config"),YQ()],Z=[];for(let $ of Y)Z.push(...this.fileLoader.generateConfigPaths(Q,$,X));return Z}async loadConfigWithResult(Q){return this.loadConfig(Q)}}var MX=new BZ;async function RZ(Q){let X="defaultConfig"in Q&&Q.defaultConfig!==void 0?Q.defaultConfig:{},Y="cache"in Q||"performance"in Q||"schema"in Q||"validate"in Q;try{let Z;if(Y)Z=await MX.loadConfig(Q);else Z=await MX.loadConfig({...Q,defaultConfig:X,cache:{enabled:!0},performance:{enabled:!1}});return Z?.config??X}catch(Z){let $=Z instanceof Error?Z.name:"UnknownError",H=Z instanceof Error?Z.message:String(Z);if(!($==="ConfigNotFoundError"||$==="ConfigLoadError"||$==="ConfigValidationError"||H.includes("config"))&&Q.verbose)c.warn("Unexpected error loading config, using defaults:",[Z instanceof Error?Z:Error(String(Z))]);let G=Y?{...Q,defaultConfig:X}:{...Q,defaultConfig:X,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in Q?Q.checkEnv!==!1:!0)return(await MX.applyEnvironmentVariables(G.name||"",X,!0,G.verbose||!1))?.config??X;return X}}function PQ(Q,X,Y=!1){let Z=new cX,$=Q.toUpperCase().replace(/[^A-Z0-9]/g,"_");function H(U,G=[]){let J={...U};for(let[_,q]of Object.entries(U)){let W=[...G,_],z=[`${$}_${W.join("_").toUpperCase()}`,`${$}_${W.map((B)=>B.toUpperCase()).join("")}`,`${$}_${W.map((B)=>B.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],A,I;for(let B of z)if(A=eQ.env[B],A!==void 0){I=B;break}if(A!==void 0&&I)if(typeof q==="boolean")J[_]=["true","1","yes"].includes(A.toLowerCase());else if(typeof q==="number"){let B=Number(A);if(!Number.isNaN(B))J[_]=B}else if(Array.isArray(q))try{J[_]=JSON.parse(A)}catch{J[_]=A.split(",").map((B)=>B.trim())}else J[_]=A;else if(q&&typeof q==="object"&&!Array.isArray(q))J[_]=H(q,W)}return J}return H(X)}var J$=d(eQ.cwd(),"config"),G$=d(eQ.cwd(),"src/generated");var S8=["code-style","lint"],wZ={ignores:["**/node_modules/**","**/.pnpm/**","**/.yarn/**","**/dist/**","**/build/**","**/out/**","**/.output/**","**/.next/**","**/.nuxt/**","**/.vite/**","**/.turbo/**","**/.cache/**","**/coverage/**","**/vendor/**","**/pantry/**","**/tmp/**","**/.git/**","**/.idea/**","**/.vscode/**","**/.zed/**","**/.cursor/**","**/.claude/**","**/.github/**","**/*.test.ts","**/*.spec.ts","**/.bunpress/**","**/.vitepress/cache/**","**/storage/framework/stx/**","**/storage/framework/runtime/**","**/storage/cloud/**","**/*.lock","**/package-lock.json","**/pnpm-lock.yaml"],lint:{extensions:["ts","js","html","css","json","jsonc","md","yaml","yml","stx","sh","bash","zsh"],reporter:"stylish",cache:!1,maxWarnings:-1},format:{extensions:["ts","js","html","css","json","jsonc","md","yaml","yml","stx","sh","bash","zsh"],trimTrailingWhitespace:!0,maxConsecutiveBlankLines:1,finalNewline:"one",indent:2,indentStyle:"spaces",preserveCodeIndentation:!1,quotes:"single",semi:!1},rules:{noDebugger:"error",noConsole:"warn"},pluginRules:{"style/brace-style":"warn","style/curly":"off","style/if-newline":"off","style/max-statements-per-line":"warn","pickier/import-dedupe":"warn","pickier/no-import-node-modules-by-path":"error","pickier/no-import-dist":"error","pickier/prefer-const":"error","pickier/prefer-template":"warn","pickier/no-unused-vars":"error","pickier/sort-tailwind-classes":"warn","regexp/no-unused-capturing-group":"error","regexp/no-super-linear-backtracking":"error","regexp/no-useless-lazy":"error","ts/no-top-level-await":"error","ts/member-delimiter-style":"off","ts/type-annotation-spacing":"off","style/comma-dangle":"off","style/keyword-spacing":"off","style/arrow-spacing":"off","style/space-infix-ops":"off","style/object-curly-spacing":"off","style/spaced-comment":"off","style/block-spacing":"off","style/space-before-blocks":"off","style/comma-spacing":"off","style/semi-spacing":"off","style/rest-spread-spacing":"off","style/key-spacing":"off","style/computed-property-spacing":"off","style/array-bracket-spacing":"off","style/space-in-parens":"off","style/template-curly-spacing":"off","style/space-unary-ops":"off","style/switch-colon-spacing":"off","style/arrow-parens":"off","style/space-before-function-paren":"off","style/quote-props":"off","style/no-floating-decimal":"off","style/new-parens":"off","style/no-extra-parens":"off","style/wrap-iife":"off","style/comma-style":"off","style/dot-location":"off","style/operator-linebreak":"off","style/multiline-ternary":"off","style/padded-blocks":"off","style/lines-between-class-members":"off","style/no-tabs":"off","style/no-mixed-spaces-and-tabs":"off","style/generator-star-spacing":"off","style/yield-star-spacing":"off","style/function-call-spacing":"off","style/template-tag-spacing":"off","style/no-whitespace-before-property":"off","style/no-mixed-operators":"off","style/indent-binary-ops":"off","ts/type-generic-spacing":"off","ts/type-named-tuple-spacing":"off","markdown/heading-increment":"warn","markdown/heading-style":"warn","markdown/no-missing-space-atx":"error","markdown/no-multiple-space-atx":"error","markdown/no-missing-space-closed-atx":"error","markdown/no-multiple-space-closed-atx":"error","markdown/blanks-around-headings":"warn","markdown/heading-start-left":"warn","markdown/no-duplicate-heading":"warn","markdown/single-title":"warn","markdown/no-trailing-punctuation":"warn","markdown/ul-style":"warn","markdown/list-indent":"error","markdown/ul-indent":"warn","markdown/ol-prefix":"warn","markdown/list-marker-space":"error","markdown/blanks-around-lists":"warn","markdown/no-trailing-spaces":"error","markdown/no-hard-tabs":"error","markdown/no-multiple-blanks":"warn","markdown/no-multiple-space-blockquote":"error","markdown/no-blanks-blockquote":"warn","markdown/blanks-around-fences":"warn","markdown/single-trailing-newline":"error","markdown/blanks-around-tables":"warn","markdown/no-reversed-links":"error","markdown/no-bare-urls":"warn","markdown/no-space-in-links":"error","markdown/no-empty-links":"error","markdown/link-fragments":"warn","markdown/reference-links-images":"warn","markdown/link-image-reference-definitions":"warn","markdown/link-image-style":"warn","markdown/descriptive-link-text":"warn","markdown/line-length":"off","markdown/commands-show-output":"warn","markdown/fenced-code-language":"warn","markdown/code-block-style":"off","markdown/code-fence-style":"warn","markdown/no-emphasis-as-heading":"warn","markdown/no-space-in-emphasis":"warn","markdown/no-space-in-code":"warn","markdown/emphasis-style":"warn","markdown/strong-style":"warn","markdown/no-inline-html":"off","markdown/hr-style":"warn","markdown/first-line-heading":"off","markdown/required-headings":"off","markdown/proper-names":"off","markdown/no-alt-text":"warn","markdown/table-pipe-style":"warn","markdown/table-column-count":"warn","markdown/table-column-style":"warn","lockfile/validate-host":["warn",{allowedHosts:["npm","yarn"]}],"lockfile/validate-https":"error","lockfile/validate-integrity":["warn",{requiredAlgorithm:"sha512"}],"lockfile/validate-package-names":"error","lockfile/validate-scheme":["error",{allowedSchemes:["https:","git+https:","git+ssh:"]}],"publint/exports-types-should-be-first":"error","publint/exports-default-should-be-last":"error","publint/exports-module-should-precede-require":"error","publint/exports-value-invalid":"error","publint/imports-key-invalid":"error","publint/imports-value-invalid":"error","publint/imports-default-should-be-last":"error","publint/imports-module-should-precede-require":"error","publint/use-type":"warn","publint/deprecated-field-jsnext":"warn","publint/field-invalid-value-type":"error","publint/local-dependency":"error","publint/has-module-but-no-exports":"warn","publint/exports-missing-root-entrypoint":"warn","publint/exports-fallback-array-use":"warn","publint/file-does-not-exist":"warn","publint/file-invalid-format":"warn","publint/module-should-be-esm":"error","publint/bin-file-not-executable":"error","publint/exports-module-should-be-esm":"error","shell/command-substitution":"error","shell/quote-variables":"warn","shell/no-cd-without-check":"warn","shell/no-eval":"error","shell/no-useless-cat":"warn","shell/shebang":"warn","shell/indent":"warn","shell/function-style":"warn","shell/operator-spacing":"warn","shell/keyword-spacing":"warn","shell/no-trailing-semicolons":"warn","shell/no-trailing-whitespace":"error","shell/prefer-double-brackets":"warn","shell/set-options":"off","shell/prefer-printf":"warn","shell/consistent-case-terminators":"warn","shell/no-broken-redirect":"error","shell/heredoc-indent":"warn","shell/no-ls-parsing":"warn","shell/no-variable-in-single-quotes":"warn","shell/no-exit-in-subshell":"warn","spell/check":"off","spell/check-comments":"off","spell/check-markdown":"off"},verbose:!0},lX=null;async function W$(){if(!lX)lX=await RZ({name:"pickier",alias:[...S8],defaultConfig:wZ});return lX}var A$=wZ;
|
|
62
62
|
export{wZ as I,W$ as J,A$ as K};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-h6ac3d60.js";var e="pickier",u="module",t="0.1.
|
|
2
|
+
import"./chunk-h6ac3d60.js";var e="pickier",u="module",t="0.1.45",r="Format, lint and more in a fraction of seconds.",s="Chris Breuer <chris@stacksjs.org>",l="MIT",p="https://github.com/pickier/pickier#readme",b={type:"git",url:"git+https://github.com/pickier/pickier.git"},m={url:"https://github.com/pickier/pickier/issues"},c=["pickier","linter","formatter","bun","fast"],o={".":{types:"./dist/index.d.ts",import:"./dist/src/index.js"},"./*":{import:"./dist/*"}},a="./dist/src/index.js",x="./dist/index.d.ts",d={pickier:"./dist/bin/cli.js"},w=["README.md","dist"],k={build:"bun --bun build.ts","build:bin":"bun --bun build.ts && bun run compile",compile:"bun build ./bin/cli.ts --compile --minify --outfile bin/pickier","compile:all":"bun run compile:linux-x64 && bun run compile:linux-arm64 && bun run compile:linux-x64-musl && bun run compile:linux-arm64-musl && bun run compile:windows-x64 && bun run compile:windows-arm64 && bun run compile:darwin-x64 && bun run compile:darwin-arm64","compile:linux-x64":"bun build ./bin/cli.ts --compile --minify --target=bun-linux-x64 --outfile bin/pickier-linux-x64","compile:linux-arm64":"bun build ./bin/cli.ts --compile --minify --target=bun-linux-arm64 --outfile bin/pickier-linux-arm64","compile:linux-x64-musl":"bun build ./bin/cli.ts --compile --minify --target=bun-linux-x64-musl --outfile bin/pickier-linux-x64-musl","compile:linux-arm64-musl":"bun build ./bin/cli.ts --compile --minify --target=bun-linux-arm64-musl --outfile bin/pickier-linux-arm64-musl","compile:windows-x64":"bun build ./bin/cli.ts --compile --minify --target=bun-windows-x64 --outfile bin/pickier-windows-x64.exe","compile:windows-arm64":"bun build ./bin/cli.ts --compile --minify --target=bun-windows-arm64 --outfile bin/pickier-windows-arm64.exe","compile:darwin-x64":"bun build ./bin/cli.ts --compile --minify --target=bun-darwin-x64 --outfile bin/pickier-darwin-x64","compile:darwin-arm64":"bun build ./bin/cli.ts --compile --minify --target=bun-darwin-arm64 --outfile bin/pickier-darwin-arm64",zip:"bun run zip:all","zip:all":"bun run zip:linux-x64 && bun run zip:linux-arm64 && bun run zip:linux-x64-musl && bun run zip:linux-arm64-musl && bun run zip:windows-x64 && bun run zip:windows-arm64 && bun run zip:darwin-x64 && bun run zip:darwin-arm64","zip:linux-x64":"zip -j bin/pickier-linux-x64.zip bin/pickier-linux-x64","zip:linux-arm64":"zip -j bin/pickier-linux-arm64.zip bin/pickier-linux-arm64","zip:linux-x64-musl":"zip -j bin/pickier-linux-x64-musl.zip bin/pickier-linux-x64-musl","zip:linux-arm64-musl":"zip -j bin/pickier-linux-arm64-musl.zip bin/pickier-linux-arm64-musl","zip:windows-x64":"zip -j bin/pickier-windows-x64.zip bin/pickier-windows-x64.exe","zip:windows-arm64":"zip -j bin/pickier-windows-arm64.zip bin/pickier-windows-arm64.exe","zip:darwin-x64":"zip -j bin/pickier-darwin-x64.zip bin/pickier-darwin-x64","zip:darwin-arm64":"zip -j bin/pickier-darwin-arm64.zip bin/pickier-darwin-arm64",prepublishOnly:"bun --bun run build && bun run compile:all && bun run zip",test:"PICKIER_NO_AUTO_CONFIG=1 bun test --coverage","test:core":"PICKIER_NO_AUTO_CONFIG=1 bun test test/core","test:format":"PICKIER_NO_AUTO_CONFIG=1 bun test test/format","test:lint":"PICKIER_NO_AUTO_CONFIG=1 bun test test/lint","test:rules":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules","test:rules:sort":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/sort","test:rules:style":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/style","test:rules:quality":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/quality","test:rules:imports":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/imports","test:rules:typescript":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/typescript","test:rules:regexp":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/regexp","test:plugin":"PICKIER_NO_AUTO_CONFIG=1 bun test test/plugin","test:watch":"PICKIER_NO_AUTO_CONFIG=1 bun test --watch"},I={"@stacksjs/clarity":"^0.3.24","@stacksjs/clapp":"^0.2.3"},O={"@stacksjs/ts-spell-check":"^0.1.0"},_={bunfig:"^0.15.13"},z={name:e,type:u,version:t,description:r,author:s,license:l,homepage:p,repository:b,bugs:m,keywords:c,exports:o,module:a,types:x,bin:d,files:w,scripts:k,dependencies:I,optionalDependencies:O,devDependencies:_};export{t as version,x as types,u as type,k as scripts,b as repository,O as optionalDependencies,e as name,a as module,l as license,c as keywords,p as homepage,w as files,o as exports,_ as devDependencies,r as description,I as dependencies,z as default,m as bugs,d as bin,s as author};
|