pickier 0.1.63 → 0.1.64
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-n894mzne.js → chunk-1x4nw0af.js} +1 -1
- package/dist/chunk-abs1kewd.js +2 -0
- package/dist/{chunk-7z24ymeh.js → chunk-djgqvaq1.js} +1 -1
- package/dist/{chunk-qakf04d3.js → chunk-dsmbhdmt.js} +134 -132
- package/dist/{chunk-3j5z4940.js → chunk-gy6wyx8t.js} +1 -1
- package/dist/{chunk-b369mtka.js → chunk-vdbbvx8x.js} +2 -2
- package/dist/{chunk-kr178acy.js → chunk-yx80g50v.js} +1 -1
- package/dist/{chunk-mat3gcn4.js → chunk-z7exyj5z.js} +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/rules/imports/no-unused-imports.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chunk-n33b14rc.js +0 -2
|
@@ -58,5 +58,5 @@ export type ConfigOf = Config
|
|
|
58
58
|
`;r+=`| Variable | Type | Description | Example |
|
|
59
59
|
`,r+=`|----------|------|-------------|----------|
|
|
60
60
|
`;for(let n of e)r+=`| \`${n.key}\` | ${n.type} | ${n.description} | \`${n.example}\` |
|
|
61
|
-
`;return r}}function vi(e,t,r={}){return un(e,t,r,new WeakMap)}function un(e,t,r,n){let{arrayMergeMode:s="replace",skipNullish:i=!1,customMerger:o}=r;if(t===null||t===void 0)return i?e:t;if(o){let c=o(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return gn(e,t,s,n);if(!_(t)||!_(e))return t;return Ei(e,t,r,n)}function gn(e,t,r,n){if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(e)&&!Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e))switch(r){case"replace":return t;case"concat":return $i(e,t);case"smart":return bi(e,t,n);default:return t}return t}function $i(e,t){let r=[...t];for(let n of e)if(!r.some((s)=>Mt(s,n)))r.push(n);return r}function bi(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(_(t[0])&&_(e[0]))return Ci(e,t,r);if(t.every((n)=>typeof n==="string")&&e.every((n)=>typeof n==="string")){let n=[...t];for(let s of e)if(!n.includes(s))n.push(s);return n}return t}function Ci(e,t,r){let n=[...t];for(let s of e){if(!_(s)){n.push(s);continue}let i=["id","name","key","path","type"],o=!1;for(let c of i)if(c in s){if(n.find((l)=>_(l)&&(c in l)&&l[c]===s[c])){o=!0;break}}if(!o)n.push(s)}return n}function Ei(e,t,r,n){let s=t;if(_(s)&&n.has(s))return n.get(s);let i={...e};if(_(s))n.set(s,i);for(let o in s){if(!Object.prototype.hasOwnProperty.call(s,o))continue;let c=s[o],a=i[o];if(r.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){i[o]=c;continue}if(_(c)&&_(a))i[o]=un(a,c,r,n);else if(Array.isArray(c)||Array.isArray(a))i[o]=gn(a,c,r.arrayMergeMode||"smart",n);else i[o]=c}return i}function hn(e,t,r="replace"){return vi(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function Mt(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Mt(e[r],t[r]))return!1;return!0}if(_(e)&&_(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let s of r){if(!Object.prototype.hasOwnProperty.call(t,s))return!1;if(!Mt(e[s],t[s]))return!1}return!0}return!1}function _(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class mn{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:s=!0,cacheTtl:i,trackPerformance:o=!0,verbose:c=!1}=r;if(s){let l=_e.getWithFileCheck("file",e);if(l){if(c)console.log(`Configuration loaded from cache: ${e}`);return l}}let a=async()=>{if(!Pe(e))return null;try{let l=`?t=${Date.now()}`,f=await import(e+l),u=f.default||f,h="default"in f,g=Object.keys(f).length>0;if(!h&&!g)throw new Xe(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof u!=="object"||u===null||Array.isArray(u))throw new Xe(e,Error("Configuration must export a valid object"),"unknown");let w={config:hn(t,u,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(s)_e.setWithFileCheck("file",w,e,i);return w}catch(l){throw l instanceof Error?de.configLoad(e,l):de.configLoad(e,Error(String(l)))}};if(o)return jt.track("loadFromPath",a,{path:e});return a()}async tryLoadFromPaths(e,t,r={}){for(let n of e)try{let s=await this.loadFromPath(n,t,r);if(s)return s}catch(s){if(s instanceof Error&&s.name==="ConfigLoadError")throw s;if(r.verbose)console.warn(`Failed to load config from ${n}:`,s)}return null}generateConfigPaths(e,t,r){let n=this.generateNamePatterns(e,r),s=[];for(let i of n)for(let o of this.extensions)s.push(Ct(t,`${i}${o}`));return s}generateNamePatterns(e,t){let r=[];if(r.push("config",".config"),e)r.push(e,`.${e}.config`,`${e}.config`,`.${e}`);let n=t===void 0?[]:Array.isArray(t)?t:[t];for(let i of n){if(!i)continue;if(r.push(i,`.${i}.config`,`${i}.config`,`.${i}`),e)r.push(`${e}.${i}.config`,`.${e}.${i}.config`)}let s=new Set;return r.filter((i)=>{if(!i||s.has(i))return!1;return s.add(i),!0})}checkFileAccess(e){return wi(async()=>Pe(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!Pe(e))return n;if(t||r){let s=this.generateNamePatterns(t||"",r);for(let i of s)for(let o of this.extensions){let c=Ct(e,`${i}${o}`);if(await this.checkFileAccess(c))n.push(c)}}else try{let{readdirSync:s}=await import("fs"),i=s(e);for(let o of i)if(this.looksLikeConfigFile(o)){let c=Ct(e,o);if(await this.checkFileAccess(c))n.push(c)}}catch{return[]}return n}looksLikeConfigFile(e){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((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!Pe(e))return t.push("Configuration file does not exist"),t;let r=await import(e),n=r.default||r;if(n===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof n!=="object"||n===null)t.push("Configuration must be an object");else if(Array.isArray(n))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:s}=await import("fs"),i=s(e,"utf8");JSON.parse(i)}catch(s){t.push(`Invalid JSON syntax: ${s}`)}}catch(r){t.push(`Failed to load configuration file: ${r}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let r=new Map;return await Promise.allSettled(e.map(async(n)=>{try{let s=await this.loadFromPath(n,{},t);if(s)r.set(n,s.config)}catch(s){if(t.verbose)console.warn(`Failed to preload ${n}:`,s)}})),r}}var ki=/^https?:\/\//;class dn{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:s=!0,validateTypes:i=!0,customRules:o=[],trackPerformance:c=!0,verbose:a=!1}=r,l=async()=>{let f=[],u=[],h={stopOnFirstError:n,validateRequired:s,validateTypes:i,customRules:o,trackPerformance:c,verbose:a};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,h);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...o],h);else return this.validateWithJSONSchema(e,t,h)}catch(g){return f.push({path:"",message:`Validation failed: ${g}`,rule:"system"}),{isValid:!1,errors:f,warnings:u}}};if(c)return await jt.track("validateConfiguration",l);return l()}async validateWithSchemaFile(e,t,r){try{if(!xi(t))throw new Qe(t,[{path:"",message:"Schema file does not exist"}]);let n=await import(t),s=n.default||n;if(Array.isArray(s))return this.validateWithRules(e,s,r);else return this.validateWithJSONSchema(e,s,r)}catch(n){throw new Qe(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],s=[];return this.validateObjectAgainstSchema(e,t,"",n,s,r),{isValid:n.length===0,errors:n,warnings:s}}validateObjectAgainstSchema(e,t,r,n,s,i){if(i.validateTypes&&t.type){let o=Array.isArray(e)?"array":typeof e,c=Array.isArray(t.type)?t.type:[t.type];if(!c.includes(o)){if(n.push({path:r,message:`Expected type ${c.join(" or ")}, got ${o}`,expected:c.join(" or "),actual:o,rule:"type"}),i.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),i.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let o=0;o<e.length;o++){let c=r?`${r}[${o}]`:`[${o}]`;if(this.validateObjectAgainstSchema(e[o],t.items,c,n,s,i),i.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let o=e;if(i.validateRequired&&t.required){for(let c of t.required)if(!(c in o)){if(n.push({path:r?`${r}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),i.stopOnFirstError)return}}if(t.properties){for(let[c,a]of Object.entries(t.properties))if(c in o){let l=r?`${r}.${c}`:c;if(this.validateObjectAgainstSchema(o[c],a,l,n,s,i),i.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let a of Object.keys(o))if(!c.has(a))s.push({path:r?`${r}.${a}`:a,message:`Additional property '${a}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],s=[];for(let i of t)try{let o=this.getValueByPath(e,i.path),c=this.validateWithRule(o,i,i.path);if(n.push(...c),r.stopOnFirstError&&n.length>0)break}catch(o){n.push({path:i.path,message:`Rule validation failed: ${o}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:s}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let s=Array.isArray(e)?"array":typeof e;if(s!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${s}`,expected:t.type,actual:s,rule:"type"})}if(t.min!==void 0){let s=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(s<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:s,rule:"min"})}if(t.max!==void 0){let s=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(s>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:s,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let s=t.validator(e);if(s)n.push({path:r,message:t.message||s,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let s of r)if(n&&typeof n==="object"&&s in n)n=n[s];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,s,i,o]=n;t.push({path:s,required:!i,type:this.mapTypeScriptType(o)})}return t}mapTypeScriptType(e){switch(e.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:ki},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}var U=new nt("bunfig",{showTags:!0});function Si(e){if(!e)return"";let t=Array.isArray(e)?e.filter(Boolean):[e];if(t.length===0)return"";if(t.length===1)return` or alias "${t[0]}"`;return` or aliases ${t.map((r)=>`"${r}"`).join(", ")}`}class pn{fileLoader=new mn;envProcessor=new Ut;validator=new dn;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:s,validate:i,...o}=e;try{if(r?.enabled){let a=this.checkCache(o.name||"",o);if(a)return a}let c;try{c=await this.loadConfigurationStrategies(o,!0,r)}catch(a){let l=o.__strictErrorHandling;if(a instanceof Error&&a.name==="ConfigNotFoundError"){if(l)throw a;c={...await this.applyEnvironmentVariables(o.name||"",o.defaultConfig,o.checkEnv!==!1,o.verbose||!1),warnings:[`No configuration file found for "${o.name||"config"}", using defaults with environment variables`]}}else if(a instanceof Error&&a.name==="ConfigLoadError"){let f=a.message.includes("EACCES")||a.message.includes("EPERM")||a.message.includes("permission denied"),u=!f&&(a.message.includes("syntax")||a.message.includes("Expected")||a.message.includes("Unexpected")||a.message.includes("BuildMessage")||a.message.includes("errors building")),h=a.message.includes("Configuration must export a valid object")||a.message.includes("Configuration file is empty and exports nothing");if(l&&(h||f))throw a;if(u&&(!l||!h))c={...await this.applyEnvironmentVariables(o.name||"",o.defaultConfig,o.checkEnv!==!1,o.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!l)c={...await this.applyEnvironmentVariables(o.name||"",o.defaultConfig,o.checkEnv!==!1,o.verbose||!1),warnings:[`Configuration loading error, using defaults: ${a.message}`]};else throw a}else c={...await this.applyEnvironmentVariables(o.name||"",o.defaultConfig,o.checkEnv!==!1,o.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${a instanceof Error?a.message:String(a)}`]}}if(s||i)await this.validateConfiguration(c.config,s,i,o.name);if(r?.enabled&&c)this.cacheResult(o.name||"",c,r,o);if(n?.enabled){let a={operation:"loadConfig",duration:Date.now()-t,configName:o.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(a);if(n.slowThreshold&&a.duration>n.slowThreshold)U.warn(`Slow configuration loading detected: ${a.duration}ms for ${o.name}`);c.metrics=a}return c}catch(c){if(c instanceof Error&&c.name==="ConfigNotFoundError")throw c;let a=Date.now()-t;throw U.error(`Configuration loading failed after ${a}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:s,cwd:i,configDir:o,defaultConfig:c,checkEnv:a=!0,arrayStrategy:l="replace",verbose:f=!1}=e,u=i||et.cwd(),h=[],g=await this.loadLocalConfiguration(n,s,u,o,c,l,f,a,r);if(g)return h.push(...this.getLocalSearchPaths(n,s,u,o)),this.finalizeResult(g,h,a,n,f);let b=await this.loadHomeConfiguration(n,s,c,l,f,a);if(b)return h.push(...this.getHomeSearchPaths(n,s)),this.finalizeResult(b,h,a,n,f);let m=await this.loadPackageJsonConfiguration(n,s,u,c,l,f,a);if(m)return h.push(B(u,"package.json")),this.finalizeResult(m,h,a,n,f);if(h.push(...this.getAllSearchPaths(n,s,u,o)),t)throw de.configNotFound(n,h,s);return{...await this.applyEnvironmentVariables(n,c,a,f),warnings:[`No configuration file found for "${n}"${Si(s)}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,s,i,o,c,a){let l=c?De(e,s,o):s,f=this.getLocalDirectories(r,n);for(let u of f){if(o)U.info(`Searching for configuration in: ${u}`);let h=this.fileLoader.generateConfigPaths(e,u,t),g=await this.fileLoader.tryLoadFromPaths(h,l,{arrayStrategy:i,verbose:o,cacheTtl:a?.ttl,useCache:!a?.ttl||a.ttl>100});if(g){if(o)U.success(`Configuration loaded from: ${g.source.path}`);return g}}return null}async loadHomeConfiguration(e,t,r,n,s,i){if(!e)return null;let o=i?De(e,r,s):r,c=[B(ne(),".config",e),B(ne(),".config"),ne()];for(let a of c){if(s)U.info(`Checking home directory: ${a}`);let l=this.fileLoader.generateConfigPaths(e,a,t),f=await this.fileLoader.tryLoadFromPaths(l,o,{arrayStrategy:n,verbose:s});if(f){if(s)U.success(`Configuration loaded from home directory: ${f.source.path}`);return f}}return null}async loadPackageJsonConfiguration(e,t,r,n,s,i,o){let c=o?De(e,n,i):n;try{let a=B(r,"package.json");if(!vn(a))return null;let l={};try{l=JSON.parse($n(a,"utf8"))}catch(h){if(i)U.warn("Failed to parse package.json:",[h instanceof Error?h:Error(String(h))]);return null}let f=l[e],u=e;if(!f&&t){let h=Array.isArray(t)?t:[t];for(let g of h){if(!g)continue;if(l[g]){f=l[g],u=g;break}}}if(f&&typeof f==="object"&&!Array.isArray(f)){if(i)U.success(`Configuration loaded from package.json: ${u}`);return{config:hn(c,f,s),source:{type:"package.json",path:a,priority:30,timestamp:new Date}}}}catch(a){if(i)U.warn("Failed to load package.json:",[a instanceof Error?a:Error(String(a))])}return null}async applyEnvironmentVariables(e,t,r,n){if(!r||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:De(e,t,n),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,r,n,s){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,r,n){let s=[];if(r){let i=r(e);if(i)s.push(...i)}if(t){let i=await this.validator.validateConfiguration(e,t);if(!i.isValid)s.push(...i.errors.map((o)=>o.path?`${o.path}: ${o.message}`:o.message))}if(s.length>0)throw de.configValidation(n||"unknown",s,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return _e.get(r)||null}cacheResult(e,t,r,n){let s=this.generateCacheKey(e,n);_e.set(s,t,void 0,r.ttl)}generateCacheKey(e,t){let r=[e];if(t.alias){let n=Array.isArray(t.alias)?t.alias.join(","):t.alias;r.push(`alias:${n}`)}if(t.cwd)r.push(`cwd:${t.cwd}`);if(t.configDir)r.push(`configDir:${t.configDir}`);if("checkEnv"in t)r.push(`checkEnv:${t.checkEnv}`);return r.join("|")}getLocalDirectories(e,t){return Array.from(new Set([e,B(e,"config"),B(e,".config"),t?B(e,t):void 0].filter(Boolean)))}getAllSearchPaths(e,t,r,n){let s=[];return s.push(...this.getLocalSearchPaths(e,t,r,n)),s.push(...this.getHomeSearchPaths(e,t)),s.push(B(r,"package.json")),s}getLocalSearchPaths(e,t,r,n){let s=this.getLocalDirectories(r,n),i=[];for(let o of s)i.push(...this.fileLoader.generateConfigPaths(e,o,t));return i}getHomeSearchPaths(e,t){if(!e)return[];let r=[B(ne(),".config",e),B(ne(),".config"),ne()],n=[];for(let s of r)n.push(...this.fileLoader.generateConfigPaths(e,s,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}var Et=new pn;async function yn(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},r="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let n;if(r)n=await Et.loadConfig(e);else n=await Et.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return n?.config??t}catch(n){let s=n instanceof Error?n.name:"UnknownError",i=n instanceof Error?n.message:String(n);if(!(s==="ConfigNotFoundError"||s==="ConfigLoadError"||s==="ConfigValidationError"||i.includes("config"))&&e.verbose)U.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let c=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await Et.applyEnvironmentVariables(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}function De(e,t,r=!1){let n=new Ut,s=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function i(o,c=[]){let a={...o};for(let[l,f]of Object.entries(o)){let u=[...c,l],h=[`${s}_${u.join("_").toUpperCase()}`,`${s}_${u.map((m)=>m.toUpperCase()).join("")}`,`${s}_${u.map((m)=>m.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],g,b;for(let m of h)if(g=et.env[m],g!==void 0){b=m;break}if(g!==void 0&&b)if(typeof f==="boolean")a[l]=["true","1","yes"].includes(g.toLowerCase());else if(typeof f==="number"){let m=Number(g);if(!Number.isNaN(m))a[l]=m}else if(Array.isArray(f))try{a[l]=JSON.parse(g)}catch{a[l]=g.split(",").map((m)=>m.trim())}else a[l]=g;else if(f&&typeof f==="object"&&!Array.isArray(f))a[l]=i(f,u)}return a}return i(t)}var fa=B(et.cwd(),"config"),ua=B(et.cwd(),"src/generated");var Ti=["code-style","lint"],wn={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},qt=null;async function ma(){if(!qt)qt=await yn({name:"pickier",alias:[...Ti],defaultConfig:wn});return qt}var da=wn;
|
|
61
|
+
`;return r}}function vi(e,t,r={}){return un(e,t,r,new WeakMap)}function un(e,t,r,n){let{arrayMergeMode:s="replace",skipNullish:i=!1,customMerger:o}=r;if(t===null||t===void 0)return i?e:t;if(o){let c=o(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return gn(e,t,s,n);if(!_(t)||!_(e))return t;return Ei(e,t,r,n)}function gn(e,t,r,n){if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(e)&&!Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e))switch(r){case"replace":return t;case"concat":return $i(e,t);case"smart":return bi(e,t,n);default:return t}return t}function $i(e,t){let r=[...t];for(let n of e)if(!r.some((s)=>Mt(s,n)))r.push(n);return r}function bi(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(_(t[0])&&_(e[0]))return Ci(e,t,r);if(t.every((n)=>typeof n==="string")&&e.every((n)=>typeof n==="string")){let n=[...t];for(let s of e)if(!n.includes(s))n.push(s);return n}return t}function Ci(e,t,r){let n=[...t];for(let s of e){if(!_(s)){n.push(s);continue}let i=["id","name","key","path","type"],o=!1;for(let c of i)if(c in s){if(n.find((l)=>_(l)&&(c in l)&&l[c]===s[c])){o=!0;break}}if(!o)n.push(s)}return n}function Ei(e,t,r,n){let s=t;if(_(s)&&n.has(s))return n.get(s);let i={...e};if(_(s))n.set(s,i);for(let o in s){if(!Object.prototype.hasOwnProperty.call(s,o))continue;let c=s[o],a=i[o];if(r.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){i[o]=c;continue}if(_(c)&&_(a))i[o]=un(a,c,r,n);else if(Array.isArray(c)||Array.isArray(a))i[o]=gn(a,c,r.arrayMergeMode||"smart",n);else i[o]=c}return i}function hn(e,t,r="replace"){return vi(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function Mt(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Mt(e[r],t[r]))return!1;return!0}if(_(e)&&_(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let s of r){if(!Object.prototype.hasOwnProperty.call(t,s))return!1;if(!Mt(e[s],t[s]))return!1}return!0}return!1}function _(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class mn{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:s=!0,cacheTtl:i,trackPerformance:o=!0,verbose:c=!1}=r;if(s){let l=_e.getWithFileCheck("file",e);if(l){if(c)console.log(`Configuration loaded from cache: ${e}`);return l}}let a=async()=>{if(!Pe(e))return null;try{let l=`?t=${Date.now()}`,f=await import(e+l),u=f.default||f,h="default"in f,g=Object.keys(f).length>0;if(!h&&!g)throw new Xe(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof u!=="object"||u===null||Array.isArray(u))throw new Xe(e,Error("Configuration must export a valid object"),"unknown");let w={config:hn(t,u,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(s)_e.setWithFileCheck("file",w,e,i);return w}catch(l){throw l instanceof Error?de.configLoad(e,l):de.configLoad(e,Error(String(l)))}};if(o)return jt.track("loadFromPath",a,{path:e});return a()}async tryLoadFromPaths(e,t,r={}){for(let n of e)try{let s=await this.loadFromPath(n,t,r);if(s)return s}catch(s){if(s instanceof Error&&s.name==="ConfigLoadError")throw s;if(r.verbose)console.warn(`Failed to load config from ${n}:`,s)}return null}generateConfigPaths(e,t,r){let n=this.generateNamePatterns(e,r),s=[];for(let i of n)for(let o of this.extensions)s.push(Ct(t,`${i}${o}`));return s}generateNamePatterns(e,t){let r=[];if(r.push("config",".config"),e)r.push(e,`.${e}.config`,`${e}.config`,`.${e}`);let n=t===void 0?[]:Array.isArray(t)?t:[t];for(let i of n){if(!i)continue;if(r.push(i,`.${i}.config`,`${i}.config`,`.${i}`),e)r.push(`${e}.${i}.config`,`.${e}.${i}.config`)}let s=new Set;return r.filter((i)=>{if(!i||s.has(i))return!1;return s.add(i),!0})}checkFileAccess(e){return wi(async()=>Pe(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!Pe(e))return n;if(t||r){let s=this.generateNamePatterns(t||"",r);for(let i of s)for(let o of this.extensions){let c=Ct(e,`${i}${o}`);if(await this.checkFileAccess(c))n.push(c)}}else try{let{readdirSync:s}=await import("fs"),i=s(e);for(let o of i)if(this.looksLikeConfigFile(o)){let c=Ct(e,o);if(await this.checkFileAccess(c))n.push(c)}}catch{return[]}return n}looksLikeConfigFile(e){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((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!Pe(e))return t.push("Configuration file does not exist"),t;let r=await import(e),n=r.default||r;if(n===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof n!=="object"||n===null)t.push("Configuration must be an object");else if(Array.isArray(n))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:s}=await import("fs"),i=s(e,"utf8");JSON.parse(i)}catch(s){t.push(`Invalid JSON syntax: ${s}`)}}catch(r){t.push(`Failed to load configuration file: ${r}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let r=new Map;return await Promise.allSettled(e.map(async(n)=>{try{let s=await this.loadFromPath(n,{},t);if(s)r.set(n,s.config)}catch(s){if(t.verbose)console.warn(`Failed to preload ${n}:`,s)}})),r}}var ki=/^https?:\/\//;class dn{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:s=!0,validateTypes:i=!0,customRules:o=[],trackPerformance:c=!0,verbose:a=!1}=r,l=async()=>{let f=[],u=[],h={stopOnFirstError:n,validateRequired:s,validateTypes:i,customRules:o,trackPerformance:c,verbose:a};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,h);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...o],h);else return this.validateWithJSONSchema(e,t,h)}catch(g){return f.push({path:"",message:`Validation failed: ${g}`,rule:"system"}),{isValid:!1,errors:f,warnings:u}}};if(c)return await jt.track("validateConfiguration",l);return l()}async validateWithSchemaFile(e,t,r){try{if(!xi(t))throw new Qe(t,[{path:"",message:"Schema file does not exist"}]);let n=await import(t),s=n.default||n;if(Array.isArray(s))return this.validateWithRules(e,s,r);else return this.validateWithJSONSchema(e,s,r)}catch(n){throw new Qe(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],s=[];return this.validateObjectAgainstSchema(e,t,"",n,s,r),{isValid:n.length===0,errors:n,warnings:s}}validateObjectAgainstSchema(e,t,r,n,s,i){if(i.validateTypes&&t.type){let o=Array.isArray(e)?"array":typeof e,c=Array.isArray(t.type)?t.type:[t.type];if(!c.includes(o)){if(n.push({path:r,message:`Expected type ${c.join(" or ")}, got ${o}`,expected:c.join(" or "),actual:o,rule:"type"}),i.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),i.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let o=0;o<e.length;o++){let c=r?`${r}[${o}]`:`[${o}]`;if(this.validateObjectAgainstSchema(e[o],t.items,c,n,s,i),i.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let o=e;if(i.validateRequired&&t.required){for(let c of t.required)if(!(c in o)){if(n.push({path:r?`${r}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),i.stopOnFirstError)return}}if(t.properties){for(let[c,a]of Object.entries(t.properties))if(c in o){let l=r?`${r}.${c}`:c;if(this.validateObjectAgainstSchema(o[c],a,l,n,s,i),i.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let a of Object.keys(o))if(!c.has(a))s.push({path:r?`${r}.${a}`:a,message:`Additional property '${a}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],s=[];for(let i of t)try{let o=this.getValueByPath(e,i.path),c=this.validateWithRule(o,i,i.path);if(n.push(...c),r.stopOnFirstError&&n.length>0)break}catch(o){n.push({path:i.path,message:`Rule validation failed: ${o}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:s}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let s=Array.isArray(e)?"array":typeof e;if(s!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${s}`,expected:t.type,actual:s,rule:"type"})}if(t.min!==void 0){let s=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(s<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:s,rule:"min"})}if(t.max!==void 0){let s=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(s>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:s,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let s=t.validator(e);if(s)n.push({path:r,message:t.message||s,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let s of r)if(n&&typeof n==="object"&&s in n)n=n[s];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,s,i,o]=n;t.push({path:s,required:!i,type:this.mapTypeScriptType(o)})}return t}mapTypeScriptType(e){switch(e.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:ki},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}var U=new nt("bunfig",{showTags:!0});function Si(e){if(!e)return"";let t=Array.isArray(e)?e.filter(Boolean):[e];if(t.length===0)return"";if(t.length===1)return` or alias "${t[0]}"`;return` or aliases ${t.map((r)=>`"${r}"`).join(", ")}`}class pn{fileLoader=new mn;envProcessor=new Ut;validator=new dn;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:s,validate:i,...o}=e;try{if(r?.enabled){let a=this.checkCache(o.name||"",o);if(a)return a}let c;try{c=await this.loadConfigurationStrategies(o,!0,r)}catch(a){let l=o.__strictErrorHandling;if(a instanceof Error&&a.name==="ConfigNotFoundError"){if(l)throw a;c={...await this.applyEnvironmentVariables(o.name||"",o.defaultConfig,o.checkEnv!==!1,o.verbose||!1),warnings:[`No configuration file found for "${o.name||"config"}", using defaults with environment variables`]}}else if(a instanceof Error&&a.name==="ConfigLoadError"){let f=a.message.includes("EACCES")||a.message.includes("EPERM")||a.message.includes("permission denied"),u=!f&&(a.message.includes("syntax")||a.message.includes("Expected")||a.message.includes("Unexpected")||a.message.includes("BuildMessage")||a.message.includes("errors building")),h=a.message.includes("Configuration must export a valid object")||a.message.includes("Configuration file is empty and exports nothing");if(l&&(h||f))throw a;if(u&&(!l||!h))c={...await this.applyEnvironmentVariables(o.name||"",o.defaultConfig,o.checkEnv!==!1,o.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!l)c={...await this.applyEnvironmentVariables(o.name||"",o.defaultConfig,o.checkEnv!==!1,o.verbose||!1),warnings:[`Configuration loading error, using defaults: ${a.message}`]};else throw a}else c={...await this.applyEnvironmentVariables(o.name||"",o.defaultConfig,o.checkEnv!==!1,o.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${a instanceof Error?a.message:String(a)}`]}}if(s||i)await this.validateConfiguration(c.config,s,i,o.name);if(r?.enabled&&c)this.cacheResult(o.name||"",c,r,o);if(n?.enabled){let a={operation:"loadConfig",duration:Date.now()-t,configName:o.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(a);if(n.slowThreshold&&a.duration>n.slowThreshold)U.warn(`Slow configuration loading detected: ${a.duration}ms for ${o.name}`);c.metrics=a}return c}catch(c){if(c instanceof Error&&c.name==="ConfigNotFoundError")throw c;let a=Date.now()-t;throw U.error(`Configuration loading failed after ${a}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:s,cwd:i,configDir:o,defaultConfig:c,checkEnv:a=!0,arrayStrategy:l="replace",verbose:f=!1}=e,u=i||et.cwd(),h=[],g=await this.loadLocalConfiguration(n,s,u,o,c,l,f,a,r);if(g)return h.push(...this.getLocalSearchPaths(n,s,u,o)),this.finalizeResult(g,h,a,n,f);let b=await this.loadHomeConfiguration(n,s,c,l,f,a);if(b)return h.push(...this.getHomeSearchPaths(n,s)),this.finalizeResult(b,h,a,n,f);let m=await this.loadPackageJsonConfiguration(n,s,u,c,l,f,a);if(m)return h.push(B(u,"package.json")),this.finalizeResult(m,h,a,n,f);if(h.push(...this.getAllSearchPaths(n,s,u,o)),t)throw de.configNotFound(n,h,s);return{...await this.applyEnvironmentVariables(n,c,a,f),warnings:[`No configuration file found for "${n}"${Si(s)}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,s,i,o,c,a){let l=c?De(e,s,o):s,f=this.getLocalDirectories(r,n);for(let u of f){if(o)U.info(`Searching for configuration in: ${u}`);let h=this.fileLoader.generateConfigPaths(e,u,t),g=await this.fileLoader.tryLoadFromPaths(h,l,{arrayStrategy:i,verbose:o,cacheTtl:a?.ttl,useCache:!a?.ttl||a.ttl>100});if(g){if(o)U.success(`Configuration loaded from: ${g.source.path}`);return g}}return null}async loadHomeConfiguration(e,t,r,n,s,i){if(!e)return null;let o=i?De(e,r,s):r,c=[B(ne(),".config",e),B(ne(),".config"),ne()];for(let a of c){if(s)U.info(`Checking home directory: ${a}`);let l=this.fileLoader.generateConfigPaths(e,a,t),f=await this.fileLoader.tryLoadFromPaths(l,o,{arrayStrategy:n,verbose:s});if(f){if(s)U.success(`Configuration loaded from home directory: ${f.source.path}`);return f}}return null}async loadPackageJsonConfiguration(e,t,r,n,s,i,o){let c=o?De(e,n,i):n;try{let a=B(r,"package.json");if(!vn(a))return null;let l={};try{l=JSON.parse($n(a,"utf8"))}catch(h){if(i)U.warn("Failed to parse package.json:",[h instanceof Error?h:Error(String(h))]);return null}let f=l[e],u=e;if(!f&&t){let h=Array.isArray(t)?t:[t];for(let g of h){if(!g)continue;if(l[g]){f=l[g],u=g;break}}}if(f&&typeof f==="object"&&!Array.isArray(f)){if(i)U.success(`Configuration loaded from package.json: ${u}`);return{config:hn(c,f,s),source:{type:"package.json",path:a,priority:30,timestamp:new Date}}}}catch(a){if(i)U.warn("Failed to load package.json:",[a instanceof Error?a:Error(String(a))])}return null}async applyEnvironmentVariables(e,t,r,n){if(!r||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:De(e,t,n),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,r,n,s){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,r,n){let s=[];if(r){let i=r(e);if(i)s.push(...i)}if(t){let i=await this.validator.validateConfiguration(e,t);if(!i.isValid)s.push(...i.errors.map((o)=>o.path?`${o.path}: ${o.message}`:o.message))}if(s.length>0)throw de.configValidation(n||"unknown",s,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return _e.get(r)||null}cacheResult(e,t,r,n){let s=this.generateCacheKey(e,n);_e.set(s,t,void 0,r.ttl)}generateCacheKey(e,t){let r=[e];if(t.alias){let n=Array.isArray(t.alias)?t.alias.join(","):t.alias;r.push(`alias:${n}`)}if(t.cwd)r.push(`cwd:${t.cwd}`);if(t.configDir)r.push(`configDir:${t.configDir}`);if("checkEnv"in t)r.push(`checkEnv:${t.checkEnv}`);return r.join("|")}getLocalDirectories(e,t){return Array.from(new Set([e,B(e,"config"),B(e,".config"),t?B(e,t):void 0].filter(Boolean)))}getAllSearchPaths(e,t,r,n){let s=[];return s.push(...this.getLocalSearchPaths(e,t,r,n)),s.push(...this.getHomeSearchPaths(e,t)),s.push(B(r,"package.json")),s}getLocalSearchPaths(e,t,r,n){let s=this.getLocalDirectories(r,n),i=[];for(let o of s)i.push(...this.fileLoader.generateConfigPaths(e,o,t));return i}getHomeSearchPaths(e,t){if(!e)return[];let r=[B(ne(),".config",e),B(ne(),".config"),ne()],n=[];for(let s of r)n.push(...this.fileLoader.generateConfigPaths(e,s,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}var Et=new pn;async function yn(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},r="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let n;if(r)n=await Et.loadConfig(e);else n=await Et.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return n?.config??t}catch(n){let s=n instanceof Error?n.name:"UnknownError",i=n instanceof Error?n.message:String(n);if(!(s==="ConfigNotFoundError"||s==="ConfigLoadError"||s==="ConfigValidationError"||i.includes("config"))&&e.verbose)U.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let c=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await Et.applyEnvironmentVariables(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}function De(e,t,r=!1){let n=new Ut,s=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function i(o,c=[]){let a={...o};for(let[l,f]of Object.entries(o)){let u=[...c,l],h=[`${s}_${u.join("_").toUpperCase()}`,`${s}_${u.map((m)=>m.toUpperCase()).join("")}`,`${s}_${u.map((m)=>m.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],g,b;for(let m of h)if(g=et.env[m],g!==void 0){b=m;break}if(g!==void 0&&b)if(typeof f==="boolean")a[l]=["true","1","yes"].includes(g.toLowerCase());else if(typeof f==="number"){let m=Number(g);if(!Number.isNaN(m))a[l]=m}else if(Array.isArray(f))try{a[l]=JSON.parse(g)}catch{a[l]=g.split(",").map((m)=>m.trim())}else a[l]=g;else if(f&&typeof f==="object"&&!Array.isArray(f))a[l]=i(f,u)}return a}return i(t)}var fa=B(et.cwd(),"config"),ua=B(et.cwd(),"src/generated");var Ti=["code-style","lint"],wn={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/no-unused-imports":"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},qt=null;async function ma(){if(!qt)qt=await yn({name:"pickier",alias:[...Ti],defaultConfig:wn});return qt}var da=wn;
|
|
62
62
|
export{wn as N,ma as O,da as P};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{N as I}from"./chunk-
|
|
2
|
+
import{N as I}from"./chunk-gy6wyx8t.js";import{Q as dt}from"./chunk-awmb5sg5.js";function ue(e){let s=e.length,n=Array.from({length:s},(r,i)=>e[i]),t=0;while(t<s){let r=e[t];if(r==="#"&&(t===0||/\s/.test(e[t-1]))){while(t<s)n[t]=" ",t++;break}if(r==="$"&&e[t+1]==="'"){t+=2;while(t<s){if(e[t]==="\\"&&t+1<s){n[t]=" ",n[t+1]=" ",t+=2;continue}if(e[t]==="'"){t++;break}n[t]=" ",t++}continue}if(r==="$"&&e[t+1]==='"'){t++,t=A(e,t,n);continue}if(r==="$"&&e[t+1]==="{"){t+=2;let i=1;while(t<s&&i>0){let o=e[t];if(o==="\\"&&t+1<s){n[t]=" ",n[t+1]=" ",t+=2;continue}if(o==="'"){t++;while(t<s&&e[t]!=="'")n[t]=" ",t++;if(t<s)t++;continue}if(o==='"'){t=A(e,t,n);continue}if(o==="{"){i++,t++;continue}if(o==="}"){i--,t++;continue}n[t]=" ",t++}continue}if(r==="$"&&e[t+1]==="("&&e[t+2]==="("){t+=3;let i=2;while(t<s&&i>0){let o=e[t];if(o==="("){i++,t++;continue}if(o===")"){i--,t++;continue}n[t]=" ",t++}continue}if(r==="$"&&e[t+1]==="("){t+=2;let i=1;while(t<s&&i>0){let o=e[t];if(o==="\\"&&t+1<s){n[t]=" ",n[t+1]=" ",t+=2;continue}if(o==="'"){t++;while(t<s&&e[t]!=="'")n[t]=" ",t++;if(t<s)t++;continue}if(o==='"'){t=A(e,t,n);continue}if(o==="("){i++,t++;continue}if(o===")"){i--,t++;continue}n[t]=" ",t++}continue}if(r==="'"){t++;while(t<s&&e[t]!=="'")n[t]=" ",t++;if(t<s)t++;continue}if(r==='"'){t=A(e,t,n);continue}if(r==="`"){t++;while(t<s&&e[t]!=="`"){if(e[t]==="\\"&&t+1<s){n[t]=" ",n[t+1]=" ",t+=2;continue}n[t]=" ",t++}if(t<s)t++;continue}t++}return n.join("")}function A(e,s,n){let t=e.length,r=s+1;while(r<t){let i=e[r];if(i==="\\"&&r+1<t){n[r]=" ",n[r+1]=" ",r+=2;continue}if(i==='"')return r+1;if(i==="$"&&e[r+1]==="("&&e[r+2]==="("){r+=3;let o=2;while(r<t&&o>0){let c=e[r];if(c==="("){o++,r++;continue}if(c===")"){o--,r++;continue}n[r]=" ",r++}continue}if(i==="$"&&e[r+1]==="("){r+=2;let o=1;while(r<t&&o>0){let c=e[r];if(c==="\\"&&r+1<t){n[r]=" ",n[r+1]=" ",r+=2;continue}if(c==="'"){r++;while(r<t&&e[r]!=="'")n[r]=" ",r++;if(r<t)r++;continue}if(c==='"'){r=A(e,r,n);continue}if(c==="("){o++,r++;continue}if(c===")"){o--,r++;continue}n[r]=" ",r++}continue}if(i==="$"&&e[r+1]==="{"){r+=2;let o=1;while(r<t&&o>0){let c=e[r];if(c==="{"){o++,r++;continue}if(c==="}"){o--,r++;continue}n[r]=" ",r++}continue}n[r]=" ",r++}return r}function Y(e){let n=ue(e).match(/<<-?/);if(!n||n.index===void 0)return null;let r=e.slice(n.index+n[0].length).match(/^\s*(['"]?)(\w+)\1/);if(!r)return null;return r[2]}var ge=new Set([".ts",".js"]),pe=new Set([".json",".jsonc"]),de=new Set([".yaml",".yml"]),me=new Set([".sh",".bash",".zsh",".ksh",".dash"]),he=/^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/;var ye=/^[}\])]/,be=/[{[(]\s*$/,we=/\s*\/\/.*$/,Se=/^(?:if|else\s+if|for|while)\s*\(/,xe=/^(?:\.[\w$[]|\?[\s.:]|:\s|&&|\|\|)/;function Ce(e){let s=Se.exec(e);if(!s)return/^(?:else|do)\s*$/.test(e);let n=0,t=null;for(let r=s[0].length-1;r<e.length;r++){let i=e[r];if(t){if(i==="\\"){r++;continue}if(i===t)t=null;continue}if(i==="'"||i==='"'||i==="`"){t=i;continue}if(i==="(")n++;else if(i===")"){if(n--,n===0)return e.slice(r+1).trim().length===0}}return!1}var Ee=/^\s*for\s*\(/,ke=new RegExp("^\\s*;\\s*$"),$e=new RegExp(";{2,}\\s*$"),Re=/([\w)])\{/g,_e=/\{(return|if|for|while|switch|const|let|var|function)\b/g,Ie=/,(\S)/g,Oe=/(?<![=!<>+\-*/%&|^?])=(?![=><])/g,Te=/(\w)\+(\w)/g,Ne=/(\w)-(\w)/g,ve=/(\w)\*(\w)/g,Ae=/(\w)\/(\w)/g,Pe=new RegExp("(?<=\\S);([^\\s;])","g"),Me=/([\w)\]])<(\d)/g,Le=/([\w)\]])>(\d)/g,H=/\s{2,}/g,Q=/^\s*$/,je=/^\s*\/\//,X=/^\s*\/\*/,De=/^\s*import\b/,V=/\bfrom\s*['"][^'"]+['"]|^\s*import\s+['"][^'"]+['"]/,Fe=/package\.json$/i,Ue=/[jt]sconfig(?:\..+)?\.json$/i,D=/[ \t]+$/,Ge=/^\n+/;function L(e){let s=e.lastIndexOf(".");return s>=0?e.slice(s):""}function F(e){return ge.has(L(e))}function We(e){return pe.has(L(e))}function Be(e){return de.has(L(e))}function Je(e){return me.has(L(e))}function Ke(e,s){return Je(e)||he.test(s)}function ze(e,s){let n=e.split(`
|
|
3
3
|
`),t=n.length,r=Array(t),i=s.format.indent,o=s.format.indentStyle==="tabs",c=0,f=!1,g="",p=!1,m=0;for(let a=0;a<t;a++){let h=n[a];if(h.length===0||/^\s*$/.test(h)){r[a]="";continue}if(f){if(r[a]=h,h.trim()===g)f=!1,g="";continue}let b=Y(h);if(b)f=!0,g=b;let w=0;while(w<h.length&&(h.charCodeAt(w)===32||h.charCodeAt(w)===9))w++;let d=h.slice(w).trimEnd();if(d.startsWith("#")&&a>0){let v=o?"\t".repeat(c):" ".repeat(c*i);r[a]=v+d;continue}if(/^case\b/.test(d)&&/\bin\s*$/.test(d))m++,p=!0;if(/^esac\b/.test(d)){if(m=Math.max(0,m-1),m===0)p=!1}let C=p&&/\)\s*$/.test(d)&&!/\$\(/.test(d)&&!/^\s*\(/.test(d)&&!d.startsWith("#"),E=/^;[;&]\s*$/.test(d);if(/^(?:fi|done|esac|elif|else)\b/.test(d)||/^\}/.test(d))c=Math.max(0,c-1);if(E)c=Math.max(0,c-1);let N=o?"\t".repeat(c):" ".repeat(c*i);if(r[a]=N+d,/^then\b/.test(d)||/^do\b/.test(d)||/^else\b/.test(d))c++;else if(/^if\b/.test(d)&&/\bthen\s*$/.test(d))c++;else if(/^elif\b/.test(d)&&/\bthen\s*$/.test(d))c++;else if(/^(?:while|for|until)\b/.test(d)&&/\bdo\s*$/.test(d))c++;else if(/^case\b/.test(d)&&/\bin\s*$/.test(d))c++;else if(C)c++;else if(/\{\s*$/.test(d)&&!d.startsWith("#"))c++}return r.join(`
|
|
4
4
|
`)}function Ye(e,s){try{let n=Bun.YAML.parse(e),t=s.format.indentStyle==="tabs"?"\t":s.format.indent;return Bun.YAML.stringify(n,null,t).split(`
|
|
5
5
|
`).map((i)=>i.replace(/[ \t]+$/,"")).join(`
|
|
@@ -29,5 +29,5 @@ ${i.join(`
|
|
|
29
29
|
`)}`:"",_=m.replace(/^\n+/,""),fe=_.length>0?`
|
|
30
30
|
|
|
31
31
|
`:`
|
|
32
|
-
`;return`${k}${N}${v}${fe}${_}`}function lt(e){if(e.kind==="side-effect")return`import '${e.source}'`;if(e.kind==="type")return`import type { ${e.namedTypes.map((r)=>r.alias?`${r.name} as ${r.alias}`:r.name).join(", ")} } from '${e.source}'`;let s=[];if(e.defaultName)s.push(e.defaultName);if(e.namespaceName)s.push(`* as ${e.namespaceName}`);if(e.named.length>0){let t=e.named.map((r)=>r.alias?`${r.name} as ${r.alias}`:r.name).join(", ");s.push(`{ ${t} }`)}return`import ${s.join(", ")} from '${e.source}'`}function ft(e){let s=e.match(/^\s*import\s+['"]([^'"]+)['"]/);if(s)return{kind:"side-effect",source:s[1],named:[],namedTypes:[],original:e};if(s=e.match(/^\s*import\s+type\s+\{([^}]*)\}\s+from\s+['"]([^'"]+)['"]/),s){let a=s[1],h=s[2],b=a.split(",").map((w)=>w.trim()).filter(Boolean).map((w)=>{let d=w.match(/^(\w+)(?:\s+as\s+(\w+))?$/);return{name:d?.[1]||w,alias:d?.[2]}});return{kind:"type",source:h,named:[],namedTypes:b,original:e}}let n=e.match(/^\s*import\s+/),t=new RegExp(`\\sfrom\\s+['"]([^'"]+)['"]\\s*;?$`),r=e.match(t);if(!n||!r)return;let i=r[1],o=e.slice(n[0].length,r.index).trim(),c,f,g=[],p=[],m=o.match(/\{([^}]*)\}/);if(m){let h=m[1].split(",").map((b)=>b.trim()).filter(Boolean);for(let b of h){let w=/^type\s+/.test(b),C=b.replace(/^type\s+/,"").match(/^(\w+)(?:\s+as\s+(\w+))?$/);if(!C)continue;let E={name:C[1],alias:C[2]};if(w)p.push(E);else g.push(E)}o=o.replace(/\{[\s\S]*?\}/,"").trim()}if(o.length>0){let a=o.split(",").map((h)=>h.trim()).filter(Boolean);for(let h of a)if(h.startsWith("* as "))f=h.slice(5).trim();else if(/^\w+$/.test(h))c=h}return{kind:"value",source:i,defaultName:c,namespaceName:f,named:g,namedTypes:p,original:e}}function ut(e,s){if(Fe.test(s))return gt(e);if(Ue.test(s))return pt(e);return null}function oe(e){try{return JSON.parse(e)}catch{return null}}function P(e,s,n=[]){let t={};for(let i of s)if(Object.prototype.hasOwnProperty.call(e,i))t[i]=e[i];for(let i of n){let o=Object.keys(e).filter((c)=>i.test(c)&&!(c in t)).sort();for(let c of o)t[c]=e[c]}let r=Object.keys(e).filter((i)=>!(i in t)).sort();for(let i of r)t[i]=e[i];return t}function ee(e){let s={};for(let n of Object.keys(e).sort())s[n]=e[n];return s}function gt(e){let s=oe(e);if(!s||typeof s!=="object")return e;let t=P(s,["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(t.files)){if(t.files.every((o)=>typeof o==="string"))t.files=[...t.files].sort()}for(let i of Object.keys(t))if(/^(?:dev|peer|optional|bundled)?[Dd]ependencies(?:Meta)?$/.test(i)||/^(?:resolutions|overrides|pnpm\.overrides)$/.test(i)){if(t[i]&&typeof t[i]==="object")t[i]=ee(t[i])}if(t.pnpm&&typeof t.pnpm==="object"&&t.pnpm.overrides&&typeof t.pnpm.overrides==="object")t.pnpm.overrides=ee(t.pnpm.overrides);if(t.exports&&typeof t.exports==="object"){let i=t.exports,o=["types","import","require","default"];if(!Array.isArray(i)){let c={};for(let f of Object.keys(i)){let g=i[f];if(g&&typeof g==="object"&&!Array.isArray(g))c[f]=P(g,o);else c[f]=g}t.exports=c}}let r=["pre-commit","prepare-commit-msg","commit-msg","post-commit","pre-rebase","post-rewrite","post-checkout","post-merge","pre-push","pre-auto-gc"];for(let i of["gitHooks","husky","simple-git-hooks"])if(t[i]&&typeof t[i]==="object")t[i]=P(t[i],r);return JSON.stringify(t,null,2)}function pt(e){let s=oe(e);if(!s||typeof s!=="object")return e;let t=P(s,["extends","compilerOptions","references","files","include","exclude"]);if(t.compilerOptions&&typeof t.compilerOptions==="object"){let r=["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"];t.compilerOptions=P(t.compilerOptions,r)}return JSON.stringify(t,null,2)}import{readdirSync as mt,readFileSync as ht,statSync as ae}from"fs";import{extname as yt,isAbsolute as W,join as B,resolve as bt}from"path";var Dt=5;function wt(e){let s="",n=0;while(n<e.length){let t=e[n];if(t==="*")if(e[n+1]==="*"){if(s+=".*",n+=2,e[n]==="/")n++}else s+="[^/]*",n++;else if(t==="?")s+="[^/]",n++;else if(t==="["){let r=e.indexOf("]",n);if(r===-1)s+="\\[",n++;else s+=e.slice(n,r+1),n=r+1}else if(".+^${}()|\\".includes(t))s+=`\\${t}`,n++;else s+=t,n++}return new RegExp(`^${s}$`)}function*le(e,s,n){let t;try{t=mt(e)}catch{return}for(let r of t){if(!n&&r.startsWith("."))continue;let i=B(e,r);if(s(i))continue;let o;try{o=ae(i)}catch{continue}if(o.isDirectory())yield*le(i,s,n);else yield i}}function*ce(e,s,n,t){yield*le(e,z(s,t),n)}async function Ft(e,s={}){let n=s.cwd??process.cwd(),t=s.ignore??[],r=s.dot??!1,i=s.absolute??!0,o=z(t,n);if(typeof globalThis.Bun?.Glob<"u"){let f=globalThis.Bun.Glob,g=[];for(let p of e){let m=new f(p);for await(let a of m.scan({cwd:n,dot:r,onlyFiles:s.onlyFiles??!0,followSymlinks:!1})){let h=W(a)?a:B(n,a),b=h.startsWith(`${n}/`)?h.slice(n.length+1):h;if(o(h))continue;g.push(i?h:b)}}return g}let c=[];for(let f of e){if(!/[*?[{]/.test(f)){let p=W(f)?f:B(n,f);try{if(!ae(p).isDirectory()){let a=p.startsWith(`${n}/`)?p.slice(n.length+1):p;if(!o(p))c.push(i?p:a)}else for(let a of ce(p,t,r,n))c.push(i?a:a.startsWith(`${n}/`)?a.slice(n.length+1):a)}catch{}continue}let g=wt(f);for(let p of ce(n,t,r,n)){let m=p.startsWith(`${n}/`)?p.slice(n.length+1):p;if(g.test(m)||g.test(m.replace(/\\/g,"/")))c.push(i?p:m)}}return c}function Ut(e){let s=0,n=[],t=()=>{if(n.length>0&&s<e)s++,n.shift()()};return(r)=>new Promise((i,o)=>{let c=()=>{r().then((f)=>{s--,i(f),t()},(f)=>{s--,o(f),t()})};if(s<e)s++,c();else n.push(c)})}var St={get TRACE(){return process.env.PICKIER_TRACE==="1"},get TIMEOUT_MS(){return Number(process.env.PICKIER_TIMEOUT_MS||"8000")},get RULE_TIMEOUT_MS(){return Number(process.env.PICKIER_RULE_TIMEOUT_MS||"5000")},get CONCURRENCY(){return Number(process.env.PICKIER_CONCURRENCY)||8},get DIAGNOSTICS(){return process.env.PICKIER_DIAGNOSTICS==="1"},get FAIL_ON_WARNINGS(){return process.env.PICKIER_FAIL_ON_WARNINGS==="1"},get NO_AUTO_CONFIG(){return process.env.PICKIER_NO_AUTO_CONFIG==="1"}},J=["**/node_modules/**","**/.git/**"],xt=["**/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 Gt(e,s){let n=e[s];if(n===void 0){let i=s.indexOf("/");if(i>0){let o=s.slice(0,i),c=s.slice(i+1),f=o==="general"?"pickier":o==="pickier"?"general":null;if(f)n=e[`${f}/${c}`];if(n===void 0)n=e[c]}}let t,r;if(typeof n==="string"){if(n==="error")t="error";else if(n==="warn"||n==="warning")t="warning"}else if(Array.isArray(n)&&typeof n[0]==="string"){let i=n[0];if(i==="error")t="error";else if(i==="warn"||i==="warning")t="warning";r=n[1]}return{enabled:!!t,severity:t,options:r}}function M(e){let s=Array.isArray(e)?e[0]:e;if(typeof s!=="string")return;if(s==="off")return"off";if(s==="error")return"error";if(s==="warn"||s==="warning")return"warning";return}function Wt(e,s,n=[],t){for(let i of[s,...n]){let o=M(e.rules?.[i])??M(e.pluginRules?.[i]);if(o)return o==="off"?void 0:o}let r=M(t);return r==="off"?void 0:r}function Bt(e,s){return M(e.rules?.[s])==="off"||M(e.pluginRules?.[s])==="off"}function T(e,s){return`\x1B[${e}m${s}\x1B[0m`}function Ct(e){return T("32",e)}function Et(e){return T("31",e)}function kt(e){return T("33",e)}function $t(e){return T("34",e)}function Rt(e){return T("90",e)}function _t(e){return T("1",e)}var Jt={green:Ct,red:Et,yellow:kt,blue:$t,gray:Rt,bold:_t};function O(e,s){let n=s.ignores?[...new Set([...e.ignores||[],...s.ignores])]:e.ignores,t={...e.pluginRules||{},...s.pluginRules||{}};if((s.tailwind??e.tailwind)?.enabled&&!Object.prototype.hasOwnProperty.call(t,"pickier/sort-tailwind-classes"))t["pickier/sort-tailwind-classes"]="warn";return{...e,...s,verbose:s.verbose??e.verbose,ignores:n,lint:{...e.lint,...s.lint||{}},format:{...e.format,...s.format||{}},rules:{...e.rules,...s.rules||{}},pluginRules:t}}var G=null;async function Kt(e){if(!e){if(St.NO_AUTO_CONFIG){if(!G)G=O(I,{});return G}try{let{getConfig:t}=await import("./chunk-mat3gcn4.js"),r=await t();return O(I,r)}catch{}return O(I,{})}let s=W(e)?e:bt(process.cwd(),e);if(yt(s).toLowerCase()===".json")try{let t=ht(s,"utf8");return O(I,JSON.parse(t))}catch{return console.warn(`[pickier:warn] Config file not found: ${s}. Using default config values.`),O(I,{})}try{let t=await import(s);return O(I,t.default||t)}catch{return console.warn(`[pickier:warn] Config file not found: ${s}. Using default config values.`),O(I,{})}}function zt(e){return e.map((s)=>{if(/[*?[\]{}()!]/.test(s))return s;if(/\.[A-Z0-9]+$/i.test(s))return s;return`${s.replace(/\/$/,"")}/**/*`})}function Yt(e,s){let n=e.lastIndexOf(".");if(n<0)return!1;let t=e.slice(n);return s.has(t)}function K(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/")}function It(e){let s=[];for(let n of e){let t=K(n.trim());if(!t)continue;let r=t.match(/\*\*\/\*\.(.+)$/);if(r){s.push({raw:t,kind:"extension",value:r[1]});continue}let i=t.match(/\*\*\/(.+?)\/\*\*$/);if(i){s.push({raw:t,kind:"segment",value:i[1]});continue}let o=t.match(/\*\*\/(.+)$/);if(o)s.push({raw:t,kind:"suffix",value:o[1].replace(/\/$/,"")})}return s}function Ht(e){return[...new Set([...J,...e])]}function z(e,s=process.cwd()){let n=It([...J,...e]);if(n.length===0)return()=>!1;let t=new Set([...xt,...J]);return(r)=>{let i=K(r),o=K(s).replace(/\/$/,""),c=i!==o&&!i.startsWith(`${o}/`),f=c?i:i.slice(o.length);for(let g of n){if(c&&!t.has(g.raw))continue;if(g.kind==="extension"){if(f.endsWith(`.${g.value}`))return!0;continue}if(g.kind==="segment"||g.kind==="suffix"){let p=g.value;if(f.includes(`/${p}/`)||f.endsWith(`/${p}`))return!0}}return!1}}function Qt(e,s){return z(s)(e)}
|
|
32
|
+
`;return`${k}${N}${v}${fe}${_}`}function lt(e){if(e.kind==="side-effect")return`import '${e.source}'`;if(e.kind==="type")return`import type { ${e.namedTypes.map((r)=>r.alias?`${r.name} as ${r.alias}`:r.name).join(", ")} } from '${e.source}'`;let s=[];if(e.defaultName)s.push(e.defaultName);if(e.namespaceName)s.push(`* as ${e.namespaceName}`);if(e.named.length>0){let t=e.named.map((r)=>r.alias?`${r.name} as ${r.alias}`:r.name).join(", ");s.push(`{ ${t} }`)}return`import ${s.join(", ")} from '${e.source}'`}function ft(e){let s=e.match(/^\s*import\s+['"]([^'"]+)['"]/);if(s)return{kind:"side-effect",source:s[1],named:[],namedTypes:[],original:e};if(s=e.match(/^\s*import\s+type\s+\{([^}]*)\}\s+from\s+['"]([^'"]+)['"]/),s){let a=s[1],h=s[2],b=a.split(",").map((w)=>w.trim()).filter(Boolean).map((w)=>{let d=w.match(/^(\w+)(?:\s+as\s+(\w+))?$/);return{name:d?.[1]||w,alias:d?.[2]}});return{kind:"type",source:h,named:[],namedTypes:b,original:e}}let n=e.match(/^\s*import\s+/),t=new RegExp(`\\sfrom\\s+['"]([^'"]+)['"]\\s*;?$`),r=e.match(t);if(!n||!r)return;let i=r[1],o=e.slice(n[0].length,r.index).trim(),c,f,g=[],p=[],m=o.match(/\{([^}]*)\}/);if(m){let h=m[1].split(",").map((b)=>b.trim()).filter(Boolean);for(let b of h){let w=/^type\s+/.test(b),C=b.replace(/^type\s+/,"").match(/^(\w+)(?:\s+as\s+(\w+))?$/);if(!C)continue;let E={name:C[1],alias:C[2]};if(w)p.push(E);else g.push(E)}o=o.replace(/\{[\s\S]*?\}/,"").trim()}if(o.length>0){let a=o.split(",").map((h)=>h.trim()).filter(Boolean);for(let h of a)if(h.startsWith("* as "))f=h.slice(5).trim();else if(/^\w+$/.test(h))c=h}return{kind:"value",source:i,defaultName:c,namespaceName:f,named:g,namedTypes:p,original:e}}function ut(e,s){if(Fe.test(s))return gt(e);if(Ue.test(s))return pt(e);return null}function oe(e){try{return JSON.parse(e)}catch{return null}}function P(e,s,n=[]){let t={};for(let i of s)if(Object.prototype.hasOwnProperty.call(e,i))t[i]=e[i];for(let i of n){let o=Object.keys(e).filter((c)=>i.test(c)&&!(c in t)).sort();for(let c of o)t[c]=e[c]}let r=Object.keys(e).filter((i)=>!(i in t)).sort();for(let i of r)t[i]=e[i];return t}function ee(e){let s={};for(let n of Object.keys(e).sort())s[n]=e[n];return s}function gt(e){let s=oe(e);if(!s||typeof s!=="object")return e;let t=P(s,["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(t.files)){if(t.files.every((o)=>typeof o==="string"))t.files=[...t.files].sort()}for(let i of Object.keys(t))if(/^(?:dev|peer|optional|bundled)?[Dd]ependencies(?:Meta)?$/.test(i)||/^(?:resolutions|overrides|pnpm\.overrides)$/.test(i)){if(t[i]&&typeof t[i]==="object")t[i]=ee(t[i])}if(t.pnpm&&typeof t.pnpm==="object"&&t.pnpm.overrides&&typeof t.pnpm.overrides==="object")t.pnpm.overrides=ee(t.pnpm.overrides);if(t.exports&&typeof t.exports==="object"){let i=t.exports,o=["types","import","require","default"];if(!Array.isArray(i)){let c={};for(let f of Object.keys(i)){let g=i[f];if(g&&typeof g==="object"&&!Array.isArray(g))c[f]=P(g,o);else c[f]=g}t.exports=c}}let r=["pre-commit","prepare-commit-msg","commit-msg","post-commit","pre-rebase","post-rewrite","post-checkout","post-merge","pre-push","pre-auto-gc"];for(let i of["gitHooks","husky","simple-git-hooks"])if(t[i]&&typeof t[i]==="object")t[i]=P(t[i],r);return JSON.stringify(t,null,2)}function pt(e){let s=oe(e);if(!s||typeof s!=="object")return e;let t=P(s,["extends","compilerOptions","references","files","include","exclude"]);if(t.compilerOptions&&typeof t.compilerOptions==="object"){let r=["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"];t.compilerOptions=P(t.compilerOptions,r)}return JSON.stringify(t,null,2)}import{readdirSync as mt,readFileSync as ht,statSync as ae}from"fs";import{extname as yt,isAbsolute as W,join as B,resolve as bt}from"path";var Dt=5;function wt(e){let s="",n=0;while(n<e.length){let t=e[n];if(t==="*")if(e[n+1]==="*"){if(s+=".*",n+=2,e[n]==="/")n++}else s+="[^/]*",n++;else if(t==="?")s+="[^/]",n++;else if(t==="["){let r=e.indexOf("]",n);if(r===-1)s+="\\[",n++;else s+=e.slice(n,r+1),n=r+1}else if(".+^${}()|\\".includes(t))s+=`\\${t}`,n++;else s+=t,n++}return new RegExp(`^${s}$`)}function*le(e,s,n){let t;try{t=mt(e)}catch{return}for(let r of t){if(!n&&r.startsWith("."))continue;let i=B(e,r);if(s(i))continue;let o;try{o=ae(i)}catch{continue}if(o.isDirectory())yield*le(i,s,n);else yield i}}function*ce(e,s,n,t){yield*le(e,z(s,t),n)}async function Ft(e,s={}){let n=s.cwd??process.cwd(),t=s.ignore??[],r=s.dot??!1,i=s.absolute??!0,o=z(t,n);if(typeof globalThis.Bun?.Glob<"u"){let f=globalThis.Bun.Glob,g=[];for(let p of e){let m=new f(p);for await(let a of m.scan({cwd:n,dot:r,onlyFiles:s.onlyFiles??!0,followSymlinks:!1})){let h=W(a)?a:B(n,a),b=h.startsWith(`${n}/`)?h.slice(n.length+1):h;if(o(h))continue;g.push(i?h:b)}}return g}let c=[];for(let f of e){if(!/[*?[{]/.test(f)){let p=W(f)?f:B(n,f);try{if(!ae(p).isDirectory()){let a=p.startsWith(`${n}/`)?p.slice(n.length+1):p;if(!o(p))c.push(i?p:a)}else for(let a of ce(p,t,r,n))c.push(i?a:a.startsWith(`${n}/`)?a.slice(n.length+1):a)}catch{}continue}let g=wt(f);for(let p of ce(n,t,r,n)){let m=p.startsWith(`${n}/`)?p.slice(n.length+1):p;if(g.test(m)||g.test(m.replace(/\\/g,"/")))c.push(i?p:m)}}return c}function Ut(e){let s=0,n=[],t=()=>{if(n.length>0&&s<e)s++,n.shift()()};return(r)=>new Promise((i,o)=>{let c=()=>{r().then((f)=>{s--,i(f),t()},(f)=>{s--,o(f),t()})};if(s<e)s++,c();else n.push(c)})}var St={get TRACE(){return process.env.PICKIER_TRACE==="1"},get TIMEOUT_MS(){return Number(process.env.PICKIER_TIMEOUT_MS||"8000")},get RULE_TIMEOUT_MS(){return Number(process.env.PICKIER_RULE_TIMEOUT_MS||"5000")},get CONCURRENCY(){return Number(process.env.PICKIER_CONCURRENCY)||8},get DIAGNOSTICS(){return process.env.PICKIER_DIAGNOSTICS==="1"},get FAIL_ON_WARNINGS(){return process.env.PICKIER_FAIL_ON_WARNINGS==="1"},get NO_AUTO_CONFIG(){return process.env.PICKIER_NO_AUTO_CONFIG==="1"}},J=["**/node_modules/**","**/.git/**"],xt=["**/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 Gt(e,s){let n=e[s];if(n===void 0){let i=s.indexOf("/");if(i>0){let o=s.slice(0,i),c=s.slice(i+1),f=o==="general"?"pickier":o==="pickier"?"general":null;if(f)n=e[`${f}/${c}`];if(n===void 0)n=e[c]}}let t,r;if(typeof n==="string"){if(n==="error")t="error";else if(n==="warn"||n==="warning")t="warning"}else if(Array.isArray(n)&&typeof n[0]==="string"){let i=n[0];if(i==="error")t="error";else if(i==="warn"||i==="warning")t="warning";r=n[1]}return{enabled:!!t,severity:t,options:r}}function M(e){let s=Array.isArray(e)?e[0]:e;if(typeof s!=="string")return;if(s==="off")return"off";if(s==="error")return"error";if(s==="warn"||s==="warning")return"warning";return}function Wt(e,s,n=[],t){for(let i of[s,...n]){let o=M(e.rules?.[i])??M(e.pluginRules?.[i]);if(o)return o==="off"?void 0:o}let r=M(t);return r==="off"?void 0:r}function Bt(e,s){return M(e.rules?.[s])==="off"||M(e.pluginRules?.[s])==="off"}function T(e,s){return`\x1B[${e}m${s}\x1B[0m`}function Ct(e){return T("32",e)}function Et(e){return T("31",e)}function kt(e){return T("33",e)}function $t(e){return T("34",e)}function Rt(e){return T("90",e)}function _t(e){return T("1",e)}var Jt={green:Ct,red:Et,yellow:kt,blue:$t,gray:Rt,bold:_t};function O(e,s){let n=s.ignores?[...new Set([...e.ignores||[],...s.ignores])]:e.ignores,t={...e.pluginRules||{},...s.pluginRules||{}};if((s.tailwind??e.tailwind)?.enabled&&!Object.prototype.hasOwnProperty.call(t,"pickier/sort-tailwind-classes"))t["pickier/sort-tailwind-classes"]="warn";return{...e,...s,verbose:s.verbose??e.verbose,ignores:n,lint:{...e.lint,...s.lint||{}},format:{...e.format,...s.format||{}},rules:{...e.rules,...s.rules||{}},pluginRules:t}}var G=null;async function Kt(e){if(!e){if(St.NO_AUTO_CONFIG){if(!G)G=O(I,{});return G}try{let{getConfig:t}=await import("./chunk-z7exyj5z.js"),r=await t();return O(I,r)}catch{}return O(I,{})}let s=W(e)?e:bt(process.cwd(),e);if(yt(s).toLowerCase()===".json")try{let t=ht(s,"utf8");return O(I,JSON.parse(t))}catch{return console.warn(`[pickier:warn] Config file not found: ${s}. Using default config values.`),O(I,{})}try{let t=await import(s);return O(I,t.default||t)}catch{return console.warn(`[pickier:warn] Config file not found: ${s}. Using default config values.`),O(I,{})}}function zt(e){return e.map((s)=>{if(/[*?[\]{}()!]/.test(s))return s;if(/\.[A-Z0-9]+$/i.test(s))return s;return`${s.replace(/\/$/,"")}/**/*`})}function Yt(e,s){let n=e.lastIndexOf(".");if(n<0)return!1;let t=e.slice(n);return s.has(t)}function K(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/")}function It(e){let s=[];for(let n of e){let t=K(n.trim());if(!t)continue;let r=t.match(/\*\*\/\*\.(.+)$/);if(r){s.push({raw:t,kind:"extension",value:r[1]});continue}let i=t.match(/\*\*\/(.+?)\/\*\*$/);if(i){s.push({raw:t,kind:"segment",value:i[1]});continue}let o=t.match(/\*\*\/(.+)$/);if(o)s.push({raw:t,kind:"suffix",value:o[1].replace(/\/$/,"")})}return s}function Ht(e){return[...new Set([...J,...e])]}function z(e,s=process.cwd()){let n=It([...J,...e]);if(n.length===0)return()=>!1;let t=new Set([...xt,...J]);return(r)=>{let i=K(r),o=K(s).replace(/\/$/,""),c=i!==o&&!i.startsWith(`${o}/`),f=c?i:i.slice(o.length);for(let g of n){if(c&&!t.has(g.raw))continue;if(g.kind==="extension"){if(f.endsWith(`.${g.value}`))return!0;continue}if(g.kind==="segment"||g.kind==="suffix"){let p=g.value;if(f.includes(`/${p}/`)||f.endsWith(`/${p}`))return!0}}return!1}}function Qt(e,s){return z(s)(e)}
|
|
33
33
|
export{ue as i,Y as j,Nt as k,vt as l,At as m,at as n,Dt as o,Ft as p,Ut as q,St as r,J as s,xt as t,Gt as u,M as v,Wt as w,Bt as x,T as y,Ct as z,Et as A,kt as B,$t as C,Rt as D,_t as E,Jt as F,O as G,Kt as H,zt as I,Yt as J,Ht as K,z as L,Qt as M};
|
|
@@ -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-dsmbhdmt.js";import"./chunk-vdbbvx8x.js";import"./chunk-gy6wyx8t.js";import"./chunk-awmb5sg5.js";export{c as applyPlugins,a as lintText,f as runLint,b as runLintProgrammatic,e as scanContent,d as scanContentOptimized};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{N as a,O as b,P as c}from"./chunk-
|
|
2
|
+
import{N as a,O as b,P as c}from"./chunk-gy6wyx8t.js";import"./chunk-awmb5sg5.js";export{c as config,a as defaultConfig,b as getConfig};
|
package/dist/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a as i,b as r,c as t,g as o}from"../chunk-
|
|
2
|
+
import{a as i,b as r,c as t,g as o}from"../chunk-dsmbhdmt.js";import{h as s}from"../chunk-djgqvaq1.js";import{A as F,B as I,C as O,D as A,E,F as W,G as U,H as q,I as z,J as B,K as D,L as G,M as N,k as m,l as b,m as P,n as C,o as R,p as d,q as y,r as k,s as h,t as v,u as w,v as S,w as L,x as M,y as T,z as j}from"../chunk-vdbbvx8x.js";import{N as e,P as n}from"../chunk-gy6wyx8t.js";import"../chunk-awmb5sg5.js";export{h as ALWAYS_IGNORES,k as ENV,R as MAX_FIXER_PASSES,v as UNIVERSAL_IGNORES,O as blue,E as bold,T as colorize,W as colors,n as config,G as createIgnoreMatcher,y as createLimiter,e as defaultConfig,b as detectQuoteIssues,z as expandPatterns,m as formatCode,C as formatImports,w as getRuleSetting,d as glob,A as gray,j as green,P as hasIndentIssue,B as isCodeFile,M as isRuleOff,r as lintText,q as loadConfigFromPath,U as mergeConfig,S as normalizeRuleSeverity,F as red,L as resolveRuleSeverity,s as run,i as runFormat,o as runLint,t as runLintProgrammatic,N as shouldIgnorePath,D as withAlwaysIgnores,I as yellow};
|
package/package.json
CHANGED
package/dist/chunk-n33b14rc.js
DELETED