pickier 0.1.66 → 0.1.67
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-vbmkrdh6.js → chunk-13r0v0m9.js} +153 -153
- package/dist/{chunk-0byqg5rc.js → chunk-bxyt25b3.js} +1 -1
- package/dist/{chunk-rg0g2fzg.js → chunk-by60fzz0.js} +3 -3
- package/dist/chunk-rtzfbwtn.js +2 -0
- package/dist/chunk-tvt73e07.js +2 -0
- package/dist/chunk-xf6t6ene.js +2 -0
- package/dist/src/index.js +1 -1
- package/dist/src/lexer.d.ts +44 -0
- package/dist/src/rules/general/_template-tracking.d.ts +5 -18
- package/dist/src/rules/general/no-unused-vars.d.ts +12 -0
- package/dist/src/rules/ts/no-top-level-await.d.ts +7 -1
- package/package.json +1 -1
- package/dist/chunk-nke9r0j5.js +0 -2
- package/dist/chunk-p5zbyxq6.js +0 -2
- package/dist/chunk-zzacmw52.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var e="pickier",u="module",t="0.1.
|
|
2
|
+
var e="pickier",u="module",t="0.1.67",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"},c={url:"https://github.com/pickier/pickier/issues"},m=["pickier","linter","formatter","bun","fast"],o={".":{types:"./dist/src/index.d.ts",import:"./dist/src/index.js"},"./*":{import:"./dist/*"}},a="./dist/src/index.js",x="./dist/src/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:c,keywords:m,exports:o,module:a,types:x,bin:d,files:w,scripts:k,dependencies:I,optionalDependencies:O,devDependencies:_};export{s as author,d as bin,c as bugs,z as default,I as dependencies,r as description,_ as devDependencies,o as exports,w as files,p as homepage,m as keywords,l as license,a as module,e as name,O as optionalDependencies,b as repository,k as scripts,u as type,x as types,t as version};
|
|
@@ -58,7 +58,7 @@ export type ConfigOf = Config
|
|
|
58
58
|
`;P+=`| Variable | Type | Description | Example |
|
|
59
59
|
`,P+=`|----------|------|-------------|----------|
|
|
60
60
|
`;for(let x of C)P+=`| \`${x.key}\` | ${x.type} | ${x.description} | \`${x.example}\` |
|
|
61
|
-
`;return P}}function Po(C,E,P={}){return cs(C,E,P,new WeakMap)}function cs(C,E,P,x){let{arrayMergeMode:M="replace",skipNullish:K=!1,customMerger:W}=P;if(E===null||E===void 0)return K?C:E;if(W){let V=W(C,E);if(V!==void 0)return V}if(Array.isArray(E)||Array.isArray(C))return ls(C,E,M,x);if(!Fe(E)||!Fe(C))return E;return Io(C,E,P,x)}function ls(C,E,P,x){if(Array.isArray(E)&&!Array.isArray(C))return E;if(Array.isArray(C)&&!Array.isArray(E))return E;if(Array.isArray(E)&&Array.isArray(C))switch(P){case"replace":return E;case"concat":return Mo(C,E);case"smart":return Do(C,E,x);default:return E}return E}function Mo(C,E){let P=[...E];for(let x of C)if(!P.some((M)=>Sr(M,x)))P.push(x);return P}function Do(C,E,P){if(E.length===0)return C;if(C.length===0)return E;if(Fe(E[0])&&Fe(C[0]))return Lo(C,E,P);if(E.every((x)=>typeof x==="string")&&C.every((x)=>typeof x==="string")){let x=[...E];for(let M of C)if(!x.includes(M))x.push(M);return x}return E}function Lo(C,E,P){let x=[...E];for(let M of C){if(!Fe(M)){x.push(M);continue}let K=["id","name","key","path","type"],W=!1;for(let V of K)if(V in M){if(x.find((z)=>Fe(z)&&(V in z)&&z[V]===M[V])){W=!0;break}}if(!W)x.push(M)}return x}function Io(C,E,P,x){let M=E;if(Fe(M)&&x.has(M))return x.get(M);let K={...C};if(Fe(M))x.set(M,K);for(let W in M){if(!Object.prototype.hasOwnProperty.call(M,W))continue;let V=M[W],U=K[W];if(P.skipNullish&&(V===null||V===void 0))continue;if(V===null||V===void 0){K[W]=V;continue}if(Fe(V)&&Fe(U))K[W]=cs(U,V,P,x);else if(Array.isArray(V)||Array.isArray(U))K[W]=ls(U,V,P.arrayMergeMode||"smart",x);else K[W]=V}return K}function fs(C,E,P="replace"){return Po(C,E,{arrayMergeMode:P==="replace"?"replace":"smart",skipNullish:!0})}function Sr(C,E){if(C===E)return!0;if(Array.isArray(C)&&Array.isArray(E)){if(C.length!==E.length)return!1;for(let P=0;P<C.length;P++)if(!Sr(C[P],E[P]))return!1;return!0}if(Fe(C)&&Fe(E)){let P=Object.keys(C),x=Object.keys(E);if(P.length!==x.length)return!1;for(let M of P){if(!Object.prototype.hasOwnProperty.call(E,M))return!1;if(!Sr(C[M],E[M]))return!1}return!0}return!1}function Fe(C){return Boolean(C&&typeof C==="object"&&!Array.isArray(C))}class us{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(C,E,P={}){let{arrayStrategy:x="replace",useCache:M=!0,cacheTtl:K,trackPerformance:W=!0,verbose:V=!1}=P;if(M){let z=Ot.getWithFileCheck("file",C);if(z){if(V)console.log(`Configuration loaded from cache: ${C}`);return z}}let U=async()=>{if(!Ct(C))return null;try{let z=`?t=${Date.now()}`,G=await import(C+z),J=G.default||G,q="default"in G,Y=Object.keys(G).length>0;if(!q&&!Y)throw new Kt(C,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof J!=="object"||J===null||Array.isArray(J))throw new Kt(C,Error("Configuration must export a valid object"),"unknown");let Z={config:fs(E,J,x),source:{type:"file",path:C,priority:100,timestamp:new Date}};if(M)Ot.setWithFileCheck("file",Z,C,K);return Z}catch(z){throw z instanceof Error?rt.configLoad(C,z):rt.configLoad(C,Error(String(z)))}};if(W)return Tr.track("loadFromPath",U,{path:C});return U()}async tryLoadFromPaths(C,E,P={}){for(let x of C)try{let M=await this.loadFromPath(x,E,P);if(M)return M}catch(M){if(M instanceof Error&&M.name==="ConfigLoadError")throw M;if(P.verbose)console.warn(`Failed to load config from ${x}:`,M)}return null}generateConfigPaths(C,E,P){let x=this.generateNamePatterns(C,P),M=[];for(let K of x)for(let W of this.extensions)M.push(mr(E,`${K}${W}`));return M}generateNamePatterns(C,E){let P=[];if(P.push("config",".config"),C)P.push(C,`.${C}.config`,`${C}.config`,`.${C}`);let x=E===void 0?[]:Array.isArray(E)?E:[E];for(let K of x){if(!K)continue;if(P.push(K,`.${K}.config`,`${K}.config`,`.${K}`),C)P.push(`${C}.${K}.config`,`.${C}.${K}.config`)}let M=new Set;return P.filter((K)=>{if(!K||M.has(K))return!1;return M.add(K),!0})}checkFileAccess(C){return No(async()=>Ct(C),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(C,E,P){let x=[];if(!Ct(C))return x;if(E||P){let M=this.generateNamePatterns(E||"",P);for(let K of M)for(let W of this.extensions){let V=mr(C,`${K}${W}`);if(await this.checkFileAccess(V))x.push(V)}}else try{let{readdirSync:M}=await import("fs"),K=M(C);for(let W of K)if(this.looksLikeConfigFile(W)){let V=mr(C,W);if(await this.checkFileAccess(V))x.push(V)}}catch{return[]}return x}looksLikeConfigFile(C){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((P)=>P.test(C))}async validateConfigFile(C){let E=[];try{if(!Ct(C))return E.push("Configuration file does not exist"),E;let P=await import(C),x=P.default||P;if(x===void 0)E.push("Configuration file must export a default value or named exports");else if(typeof x!=="object"||x===null)E.push("Configuration must be an object");else if(Array.isArray(x))E.push("Configuration cannot be an array at the root level");if(C.endsWith(".json"))try{let{readFileSync:M}=await import("fs"),K=M(C,"utf8");JSON.parse(K)}catch(M){E.push(`Invalid JSON syntax: ${M}`)}}catch(P){E.push(`Failed to load configuration file: ${P}`)}return E}async getFileModificationTime(C){try{let{statSync:E}=await import("fs");return E(C).mtime}catch{return null}}async preloadConfigurations(C,E={}){let P=new Map;return await Promise.allSettled(C.map(async(x)=>{try{let M=await this.loadFromPath(x,{},E);if(M)P.set(x,M.config)}catch(M){if(E.verbose)console.warn(`Failed to preload ${x}:`,M)}})),P}}var _o=/^https?:\/\//;class gs{async validateConfiguration(C,E,P={}){let{stopOnFirstError:x=!1,validateRequired:M=!0,validateTypes:K=!0,customRules:W=[],trackPerformance:V=!0,verbose:U=!1}=P,z=async()=>{let G=[],J=[],q={stopOnFirstError:x,validateRequired:M,validateTypes:K,customRules:W,trackPerformance:V,verbose:U};try{if(typeof E==="string")return await this.validateWithSchemaFile(C,E,q);else if(Array.isArray(E))return this.validateWithRules(C,[...E,...W],q);else return this.validateWithJSONSchema(C,E,q)}catch(Y){return G.push({path:"",message:`Validation failed: ${Y}`,rule:"system"}),{isValid:!1,errors:G,warnings:J}}};if(V)return await Tr.track("validateConfiguration",z);return z()}async validateWithSchemaFile(C,E,P){try{if(!jo(E))throw new Wt(E,[{path:"",message:"Schema file does not exist"}]);let x=await import(E),M=x.default||x;if(Array.isArray(M))return this.validateWithRules(C,M,P);else return this.validateWithJSONSchema(C,M,P)}catch(x){throw new Wt(E,[{path:"",message:`Failed to load schema: ${x}`}])}}validateWithJSONSchema(C,E,P){let x=[],M=[];return this.validateObjectAgainstSchema(C,E,"",x,M,P),{isValid:x.length===0,errors:x,warnings:M}}validateObjectAgainstSchema(C,E,P,x,M,K){if(K.validateTypes&&E.type){let W=Array.isArray(C)?"array":typeof C,V=Array.isArray(E.type)?E.type:[E.type];if(!V.includes(W)){if(x.push({path:P,message:`Expected type ${V.join(" or ")}, got ${W}`,expected:V.join(" or "),actual:W,rule:"type"}),K.stopOnFirstError)return}}if(E.enum&&!E.enum.includes(C)){if(x.push({path:P,message:`Value must be one of: ${E.enum.join(", ")}`,expected:E.enum.join(", "),actual:C,rule:"enum"}),K.stopOnFirstError)return}if(typeof C==="string"){if(E.minLength!==void 0&&C.length<E.minLength)x.push({path:P,message:`String length must be at least ${E.minLength}`,expected:`>= ${E.minLength}`,actual:C.length,rule:"minLength"});if(E.maxLength!==void 0&&C.length>E.maxLength)x.push({path:P,message:`String length must not exceed ${E.maxLength}`,expected:`<= ${E.maxLength}`,actual:C.length,rule:"maxLength"});if(E.pattern){if(!new RegExp(E.pattern).test(C))x.push({path:P,message:`String does not match pattern ${E.pattern}`,expected:E.pattern,actual:C,rule:"pattern"})}}if(typeof C==="number"){if(E.minimum!==void 0&&C<E.minimum)x.push({path:P,message:`Value must be at least ${E.minimum}`,expected:`>= ${E.minimum}`,actual:C,rule:"minimum"});if(E.maximum!==void 0&&C>E.maximum)x.push({path:P,message:`Value must not exceed ${E.maximum}`,expected:`<= ${E.maximum}`,actual:C,rule:"maximum"})}if(Array.isArray(C)&&E.items)for(let W=0;W<C.length;W++){let V=P?`${P}[${W}]`:`[${W}]`;if(this.validateObjectAgainstSchema(C[W],E.items,V,x,M,K),K.stopOnFirstError&&x.length>0)return}if(C&&typeof C==="object"&&!Array.isArray(C)){let W=C;if(K.validateRequired&&E.required){for(let V of E.required)if(!(V in W)){if(x.push({path:P?`${P}.${V}`:V,message:`Missing required property '${V}'`,expected:"required",rule:"required"}),K.stopOnFirstError)return}}if(E.properties){for(let[V,U]of Object.entries(E.properties))if(V in W){let z=P?`${P}.${V}`:V;if(this.validateObjectAgainstSchema(W[V],U,z,x,M,K),K.stopOnFirstError&&x.length>0)return}}if(E.additionalProperties===!1){let V=new Set(Object.keys(E.properties||{}));for(let U of Object.keys(W))if(!V.has(U))M.push({path:P?`${P}.${U}`:U,message:`Additional property '${U}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(C,E,P){let x=[],M=[];for(let K of E)try{let W=this.getValueByPath(C,K.path),V=this.validateWithRule(W,K,K.path);if(x.push(...V),P.stopOnFirstError&&x.length>0)break}catch(W){x.push({path:K.path,message:`Rule validation failed: ${W}`,rule:"system"})}return{isValid:x.length===0,errors:x,warnings:M}}validateWithRule(C,E,P){let x=[];if(E.required&&(C===void 0||C===null))return x.push({path:P,message:E.message||`Property '${P}' is required`,expected:"required",rule:"required"}),x;if(C===void 0||C===null)return x;if(E.type){let M=Array.isArray(C)?"array":typeof C;if(M!==E.type)x.push({path:P,message:E.message||`Expected type ${E.type}, got ${M}`,expected:E.type,actual:M,rule:"type"})}if(E.min!==void 0){let M=Array.isArray(C)?C.length:typeof C==="string"?C.length:typeof C==="number"?C:0;if(M<E.min)x.push({path:P,message:E.message||`Value must be at least ${E.min}`,expected:`>= ${E.min}`,actual:M,rule:"min"})}if(E.max!==void 0){let M=Array.isArray(C)?C.length:typeof C==="string"?C.length:typeof C==="number"?C:0;if(M>E.max)x.push({path:P,message:E.message||`Value must not exceed ${E.max}`,expected:`<= ${E.max}`,actual:M,rule:"max"})}if(E.pattern&&typeof C==="string"){if(!E.pattern.test(C))x.push({path:P,message:E.message||`Value does not match pattern ${E.pattern}`,expected:E.pattern.toString(),actual:C,rule:"pattern"})}if(E.enum&&!E.enum.includes(C))x.push({path:P,message:E.message||`Value must be one of: ${E.enum.join(", ")}`,expected:E.enum.join(", "),actual:C,rule:"enum"});if(E.validator){let M=E.validator(C);if(M)x.push({path:P,message:E.message||M,rule:"custom"})}return x}getValueByPath(C,E){if(!E)return C;let P=E.split("."),x=C;for(let M of P)if(x&&typeof x==="object"&&M in x)x=x[M];else return;return x}generateRulesFromInterface(C){let E=[],P=C.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let x of P){let[,M,K,W]=x;E.push({path:M,required:!K,type:this.mapTypeScriptType(W)})}return E}mapTypeScriptType(C){switch(C.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:_o},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}var Me=new Gt("bunfig",{showTags:!0});function Bo(C){if(!C)return"";let E=Array.isArray(C)?C.filter(Boolean):[C];if(E.length===0)return"";if(E.length===1)return` or alias "${E[0]}"`;return` or aliases ${E.map((P)=>`"${P}"`).join(", ")}`}class ms{fileLoader=new us;envProcessor=new Lr;validator=new gs;async loadConfig(C){let E=Date.now(),{cache:P,performance:x,schema:M,validate:K,...W}=C;try{if(P?.enabled){let U=this.checkCache(W.name||"",W);if(U)return U}let V;try{V=await this.loadConfigurationStrategies(W,!0,P)}catch(U){let z=W.__strictErrorHandling;if(U instanceof Error&&U.name==="ConfigNotFoundError"){if(z)throw U;V={...await this.applyEnvironmentVariables(W.name||"",W.defaultConfig,W.checkEnv!==!1,W.verbose||!1),warnings:[`No configuration file found for "${W.name||"config"}", using defaults with environment variables`]}}else if(U instanceof Error&&U.name==="ConfigLoadError"){let G=U.message.includes("EACCES")||U.message.includes("EPERM")||U.message.includes("permission denied"),J=!G&&(U.message.includes("syntax")||U.message.includes("Expected")||U.message.includes("Unexpected")||U.message.includes("BuildMessage")||U.message.includes("errors building")),q=U.message.includes("Configuration must export a valid object")||U.message.includes("Configuration file is empty and exports nothing");if(z&&(q||G))throw U;if(J&&(!z||!q))V={...await this.applyEnvironmentVariables(W.name||"",W.defaultConfig,W.checkEnv!==!1,W.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!z)V={...await this.applyEnvironmentVariables(W.name||"",W.defaultConfig,W.checkEnv!==!1,W.verbose||!1),warnings:[`Configuration loading error, using defaults: ${U.message}`]};else throw U}else V={...await this.applyEnvironmentVariables(W.name||"",W.defaultConfig,W.checkEnv!==!1,W.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${U instanceof Error?U.message:String(U)}`]}}if(M||K)await this.validateConfiguration(V.config,M,K,W.name);if(P?.enabled&&V)this.cacheResult(W.name||"",V,P,W);if(x?.enabled){let U={operation:"loadConfig",duration:Date.now()-E,configName:W.name,timestamp:new Date};if(x.onMetrics)x.onMetrics(U);if(x.slowThreshold&&U.duration>x.slowThreshold)Me.warn(`Slow configuration loading detected: ${U.duration}ms for ${W.name}`);V.metrics=U}return V}catch(V){if(V instanceof Error&&V.name==="ConfigNotFoundError")throw V;let U=Date.now()-E;throw Me.error(`Configuration loading failed after ${U}ms:`,[V instanceof Error?V:Error(String(V))]),V}}async loadConfigurationStrategies(C,E=!1,P){let{name:x="",alias:M,cwd:K,configDir:W,defaultConfig:V,checkEnv:U=!0,arrayStrategy:z="replace",verbose:G=!1}=C,J=K||Vt.cwd(),q=[],Y=await this.loadLocalConfiguration(x,M,J,W,V,z,G,U,P);if(Y)return q.push(...this.getLocalSearchPaths(x,M,J,W)),this.finalizeResult(Y,q,U,x,G);let ee=await this.loadHomeConfiguration(x,M,V,z,G,U);if(ee)return q.push(...this.getHomeSearchPaths(x,M)),this.finalizeResult(ee,q,U,x,G);let H=await this.loadPackageJsonConfiguration(x,M,J,V,z,G,U);if(H)return q.push(Oe(J,"package.json")),this.finalizeResult(H,q,U,x,G);if(q.push(...this.getAllSearchPaths(x,M,J,W)),E)throw rt.configNotFound(x,q,M);return{...await this.applyEnvironmentVariables(x,V,U,G),warnings:[`No configuration file found for "${x}"${Bo(M)}, using defaults with environment variables`]}}async loadLocalConfiguration(C,E,P,x,M,K,W,V,U){let z=V?Et(C,M,W):M,G=this.getLocalDirectories(P,x);for(let J of G){if(W)Me.info(`Searching for configuration in: ${J}`);let q=this.fileLoader.generateConfigPaths(C,J,E),Y=await this.fileLoader.tryLoadFromPaths(q,z,{arrayStrategy:K,verbose:W,cacheTtl:U?.ttl,useCache:!U?.ttl||U.ttl>100});if(Y){if(W)Me.success(`Configuration loaded from: ${Y.source.path}`);return Y}}return null}async loadHomeConfiguration(C,E,P,x,M,K){if(!C)return null;let W=K?Et(C,P,M):P,V=[Oe(Ue(),".config",C),Oe(Ue(),".config"),Ue()];for(let U of V){if(M)Me.info(`Checking home directory: ${U}`);let z=this.fileLoader.generateConfigPaths(C,U,E),G=await this.fileLoader.tryLoadFromPaths(z,W,{arrayStrategy:x,verbose:M});if(G){if(M)Me.success(`Configuration loaded from home directory: ${G.source.path}`);return G}}return null}async loadPackageJsonConfiguration(C,E,P,x,M,K,W){let V=W?Et(C,x,K):x;try{let U=Oe(P,"package.json");if(!Ns(U))return null;let z={};try{z=JSON.parse(Ps(U,"utf8"))}catch(q){if(K)Me.warn("Failed to parse package.json:",[q instanceof Error?q:Error(String(q))]);return null}let G=z[C],J=C;if(!G&&E){let q=Array.isArray(E)?E:[E];for(let Y of q){if(!Y)continue;if(z[Y]){G=z[Y],J=Y;break}}}if(G&&typeof G==="object"&&!Array.isArray(G)){if(K)Me.success(`Configuration loaded from package.json: ${J}`);return{config:fs(V,G,M),source:{type:"package.json",path:U,priority:30,timestamp:new Date}}}}catch(U){if(K)Me.warn("Failed to load package.json:",[U instanceof Error?U:Error(String(U))])}return null}async applyEnvironmentVariables(C,E,P,x){if(!P||!C||typeof E!=="object"||E===null||Array.isArray(E))return{config:E,source:{type:"default",priority:10,timestamp:new Date}};return{config:Et(C,E,x),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(C,E,P,x,M){return{config:C.config,source:C.source,path:C.source.path}}async validateConfiguration(C,E,P,x){let M=[];if(P){let K=P(C);if(K)M.push(...K)}if(E){let K=await this.validator.validateConfiguration(C,E);if(!K.isValid)M.push(...K.errors.map((W)=>W.path?`${W.path}: ${W.message}`:W.message))}if(M.length>0)throw rt.configValidation(x||"unknown",M,x)}checkCache(C,E){let P=this.generateCacheKey(C,E);return Ot.get(P)||null}cacheResult(C,E,P,x){let M=this.generateCacheKey(C,x);Ot.set(M,E,void 0,P.ttl)}generateCacheKey(C,E){let P=[C];if(E.alias){let x=Array.isArray(E.alias)?E.alias.join(","):E.alias;P.push(`alias:${x}`)}if(E.cwd)P.push(`cwd:${E.cwd}`);if(E.configDir)P.push(`configDir:${E.configDir}`);if("checkEnv"in E)P.push(`checkEnv:${E.checkEnv}`);return P.join("|")}getLocalDirectories(C,E){return Array.from(new Set([C,Oe(C,"config"),Oe(C,".config"),E?Oe(C,E):void 0].filter(Boolean)))}getAllSearchPaths(C,E,P,x){let M=[];return M.push(...this.getLocalSearchPaths(C,E,P,x)),M.push(...this.getHomeSearchPaths(C,E)),M.push(Oe(P,"package.json")),M}getLocalSearchPaths(C,E,P,x){let M=this.getLocalDirectories(P,x),K=[];for(let W of M)K.push(...this.fileLoader.generateConfigPaths(C,W,E));return K}getHomeSearchPaths(C,E){if(!C)return[];let P=[Oe(Ue(),".config",C),Oe(Ue(),".config"),Ue()],x=[];for(let M of P)x.push(...this.fileLoader.generateConfigPaths(C,M,E));return x}async loadConfigWithResult(C){return this.loadConfig(C)}}var hr=new ms;async function hs(C){let E="defaultConfig"in C&&C.defaultConfig!==void 0?C.defaultConfig:{},P="cache"in C||"performance"in C||"schema"in C||"validate"in C;try{let x;if(P)x=await hr.loadConfig(C);else x=await hr.loadConfig({...C,defaultConfig:E,cache:{enabled:!0},performance:{enabled:!1}});return x?.config??E}catch(x){let M=x instanceof Error?x.name:"UnknownError",K=x instanceof Error?x.message:String(x);if(!(M==="ConfigNotFoundError"||M==="ConfigLoadError"||M==="ConfigValidationError"||K.includes("config"))&&C.verbose)Me.warn("Unexpected error loading config, using defaults:",[x instanceof Error?x:Error(String(x))]);let V=P?{...C,defaultConfig:E}:{...C,defaultConfig:E,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in C?C.checkEnv!==!1:!0)return(await hr.applyEnvironmentVariables(V.name||"",E,!0,V.verbose||!1))?.config??E;return E}}function Et(C,E,P=!1){let x=new Lr,M=C.toUpperCase().replace(/[^A-Z0-9]/g,"_");function K(W,V=[]){let U={...W};for(let[z,G]of Object.entries(W)){let J=[...V,z],q=[`${M}_${J.join("_").toUpperCase()}`,`${M}_${J.map((H)=>H.toUpperCase()).join("")}`,`${M}_${J.map((H)=>H.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],Y,ee;for(let H of q)if(Y=Vt.env[H],Y!==void 0){ee=H;break}if(Y!==void 0&&ee)if(typeof G==="boolean")U[z]=["true","1","yes"].includes(Y.toLowerCase());else if(typeof G==="number"){let H=Number(Y);if(!Number.isNaN(H))U[z]=H}else if(Array.isArray(G))try{U[z]=JSON.parse(Y)}catch{U[z]=Y.split(",").map((H)=>H.trim())}else U[z]=Y;else if(G&&typeof G==="object"&&!Array.isArray(G))U[z]=K(G,J)}return U}return K(E)}var Dl=Oe(Vt.cwd(),"config"),Ll=Oe(Vt.cwd(),"src/generated");var Ko=["code-style","lint"],s={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},Ir=null;async function F(){if(!Ir)Ir=await hs({name:"pickier",alias:[...Ko],defaultConfig:s});return Ir}var S=s;import{readFileSync as Ya,statSync as Ha,writeFileSync as Za}from"fs";import{isAbsolute as Xa,resolve as Qa}from"path";function i(C){let E=C.length,P=Array.from({length:E},(M,K)=>C[K]),x=0;while(x<E){let M=C[x];if(M==="#"&&(x===0||/\s/.test(C[x-1]))){while(x<E)P[x]=" ",x++;break}if(M==="$"&&C[x+1]==="'"){x+=2;while(x<E){if(C[x]==="\\"&&x+1<E){P[x]=" ",P[x+1]=" ",x+=2;continue}if(C[x]==="'"){x++;break}P[x]=" ",x++}continue}if(M==="$"&&C[x+1]==='"'){x++,x=ct(C,x,P);continue}if(M==="$"&&C[x+1]==="{"){x+=2;let K=1;while(x<E&&K>0){let W=C[x];if(W==="\\"&&x+1<E){P[x]=" ",P[x+1]=" ",x+=2;continue}if(W==="'"){x++;while(x<E&&C[x]!=="'")P[x]=" ",x++;if(x<E)x++;continue}if(W==='"'){x=ct(C,x,P);continue}if(W==="{"){K++,x++;continue}if(W==="}"){K--,x++;continue}P[x]=" ",x++}continue}if(M==="$"&&C[x+1]==="("&&C[x+2]==="("){x+=3;let K=2;while(x<E&&K>0){let W=C[x];if(W==="("){K++,x++;continue}if(W===")"){K--,x++;continue}P[x]=" ",x++}continue}if(M==="$"&&C[x+1]==="("){x+=2;let K=1;while(x<E&&K>0){let W=C[x];if(W==="\\"&&x+1<E){P[x]=" ",P[x+1]=" ",x+=2;continue}if(W==="'"){x++;while(x<E&&C[x]!=="'")P[x]=" ",x++;if(x<E)x++;continue}if(W==='"'){x=ct(C,x,P);continue}if(W==="("){K++,x++;continue}if(W===")"){K--,x++;continue}P[x]=" ",x++}continue}if(M==="'"){x++;while(x<E&&C[x]!=="'")P[x]=" ",x++;if(x<E)x++;continue}if(M==='"'){x=ct(C,x,P);continue}if(M==="`"){x++;while(x<E&&C[x]!=="`"){if(C[x]==="\\"&&x+1<E){P[x]=" ",P[x+1]=" ",x+=2;continue}P[x]=" ",x++}if(x<E)x++;continue}x++}return P.join("")}function ct(C,E,P){let x=C.length,M=E+1;while(M<x){let K=C[M];if(K==="\\"&&M+1<x){P[M]=" ",P[M+1]=" ",M+=2;continue}if(K==='"')return M+1;if(K==="$"&&C[M+1]==="("&&C[M+2]==="("){M+=3;let W=2;while(M<x&&W>0){let V=C[M];if(V==="("){W++,M++;continue}if(V===")"){W--,M++;continue}P[M]=" ",M++}continue}if(K==="$"&&C[M+1]==="("){M+=2;let W=1;while(M<x&&W>0){let V=C[M];if(V==="\\"&&M+1<x){P[M]=" ",P[M+1]=" ",M+=2;continue}if(V==="'"){M++;while(M<x&&C[M]!=="'")P[M]=" ",M++;if(M<x)M++;continue}if(V==='"'){M=ct(C,M,P);continue}if(V==="("){W++,M++;continue}if(V===")"){W--,M++;continue}P[M]=" ",M++}continue}if(K==="$"&&C[M+1]==="{"){M+=2;let W=1;while(M<x&&W>0){let V=C[M];if(V==="{"){W++,M++;continue}if(V==="}"){W--,M++;continue}P[M]=" ",M++}continue}P[M]=" ",M++}return M}function t(C){let P=i(C).match(/<<-?/);if(!P||P.index===void 0)return null;let M=C.slice(P.index+P[0].length).match(/^\s*(['"]?)(\w+)\1/);if(!M)return null;return M[2]}var Wo=new Set([".ts",".js"]),Vo=new Set([".json",".jsonc"]),Uo=new Set([".yaml",".yml"]),zo=new Set([".sh",".bash",".zsh",".ksh",".dash"]),Go=/^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/;var Jo=/^[}\])]/,qo=/[{[(]\s*$/,Yo=/\s*\/\/.*$/,Ho=/^(?:if|else\s+if|for|while)\s*\(/,Zo=/^(?:\.[\w$[]|\?[\s.:]|:\s|&&|\|\|)/;function Xo(C){let E=Ho.exec(C);if(!E)return/^(?:else|do)\s*$/.test(C);let P=0,x=null;for(let M=E[0].length-1;M<C.length;M++){let K=C[M];if(x){if(K==="\\"){M++;continue}if(K===x)x=null;continue}if(K==="'"||K==='"'||K==="`"){x=K;continue}if(K==="(")P++;else if(K===")"){if(P--,P===0)return C.slice(M+1).trim().length===0}}return!1}var Qo=/^\s*for\s*\(/,ea=new RegExp("^\\s*;\\s*$"),ta=new RegExp(";{2,}\\s*$"),ra=/([\w)])\{/g,na=/\{(return|if|for|while|switch|const|let|var|function)\b/g,sa=/,(\S)/g,ia=/(?<![=!<>+\-*/%&|^?])=(?![=><])/g,oa=/(\w)\+(\w)/g,aa=/(\w)-(\w)/g,ca=/(\w)\*(\w)/g,la=/(\w)\/(\w)/g,fa=new RegExp("(?<=\\S);([^\\s;])","g"),ua=/([\w)\]])<(\d)/g,ga=/([\w)\]])>(\d)/g,ds=/\s{2,}/g,ps=/^\s*$/,ma=/^\s*\/\//,ys=/^\s*\/\*/,ha=/^\s*import\b/,ws=/\bfrom\s*['"][^'"]+['"]|^\s*import\s+['"][^'"]+['"]/,da=/package\.json$/i,pa=/[jt]sconfig(?:\..+)?\.json$/i,jr=/[ \t]+$/,ya=/^\n+/;function Jt(C){let E=C.lastIndexOf(".");return E>=0?C.slice(E):""}function _r(C){return Wo.has(Jt(C))}function wa(C){return Vo.has(Jt(C))}function ba(C){return Uo.has(Jt(C))}function va(C){return zo.has(Jt(C))}function $a(C,E){return va(C)||Go.test(E)}function Ca(C,E){let P=C.split(`
|
|
61
|
+
`;return P}}function Po(C,E,P={}){return cs(C,E,P,new WeakMap)}function cs(C,E,P,x){let{arrayMergeMode:M="replace",skipNullish:K=!1,customMerger:W}=P;if(E===null||E===void 0)return K?C:E;if(W){let V=W(C,E);if(V!==void 0)return V}if(Array.isArray(E)||Array.isArray(C))return ls(C,E,M,x);if(!Fe(E)||!Fe(C))return E;return Io(C,E,P,x)}function ls(C,E,P,x){if(Array.isArray(E)&&!Array.isArray(C))return E;if(Array.isArray(C)&&!Array.isArray(E))return E;if(Array.isArray(E)&&Array.isArray(C))switch(P){case"replace":return E;case"concat":return Mo(C,E);case"smart":return Do(C,E,x);default:return E}return E}function Mo(C,E){let P=[...E];for(let x of C)if(!P.some((M)=>Sr(M,x)))P.push(x);return P}function Do(C,E,P){if(E.length===0)return C;if(C.length===0)return E;if(Fe(E[0])&&Fe(C[0]))return Lo(C,E,P);if(E.every((x)=>typeof x==="string")&&C.every((x)=>typeof x==="string")){let x=[...E];for(let M of C)if(!x.includes(M))x.push(M);return x}return E}function Lo(C,E,P){let x=[...E];for(let M of C){if(!Fe(M)){x.push(M);continue}let K=["id","name","key","path","type"],W=!1;for(let V of K)if(V in M){if(x.find((z)=>Fe(z)&&(V in z)&&z[V]===M[V])){W=!0;break}}if(!W)x.push(M)}return x}function Io(C,E,P,x){let M=E;if(Fe(M)&&x.has(M))return x.get(M);let K={...C};if(Fe(M))x.set(M,K);for(let W in M){if(!Object.prototype.hasOwnProperty.call(M,W))continue;let V=M[W],U=K[W];if(P.skipNullish&&(V===null||V===void 0))continue;if(V===null||V===void 0){K[W]=V;continue}if(Fe(V)&&Fe(U))K[W]=cs(U,V,P,x);else if(Array.isArray(V)||Array.isArray(U))K[W]=ls(U,V,P.arrayMergeMode||"smart",x);else K[W]=V}return K}function fs(C,E,P="replace"){return Po(C,E,{arrayMergeMode:P==="replace"?"replace":"smart",skipNullish:!0})}function Sr(C,E){if(C===E)return!0;if(Array.isArray(C)&&Array.isArray(E)){if(C.length!==E.length)return!1;for(let P=0;P<C.length;P++)if(!Sr(C[P],E[P]))return!1;return!0}if(Fe(C)&&Fe(E)){let P=Object.keys(C),x=Object.keys(E);if(P.length!==x.length)return!1;for(let M of P){if(!Object.prototype.hasOwnProperty.call(E,M))return!1;if(!Sr(C[M],E[M]))return!1}return!0}return!1}function Fe(C){return Boolean(C&&typeof C==="object"&&!Array.isArray(C))}class us{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(C,E,P={}){let{arrayStrategy:x="replace",useCache:M=!0,cacheTtl:K,trackPerformance:W=!0,verbose:V=!1}=P;if(M){let z=Ot.getWithFileCheck("file",C);if(z){if(V)console.log(`Configuration loaded from cache: ${C}`);return z}}let U=async()=>{if(!Ct(C))return null;try{let z=`?t=${Date.now()}`,G=await import(C+z),J=G.default||G,q="default"in G,Y=Object.keys(G).length>0;if(!q&&!Y)throw new Kt(C,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof J!=="object"||J===null||Array.isArray(J))throw new Kt(C,Error("Configuration must export a valid object"),"unknown");let Z={config:fs(E,J,x),source:{type:"file",path:C,priority:100,timestamp:new Date}};if(M)Ot.setWithFileCheck("file",Z,C,K);return Z}catch(z){throw z instanceof Error?rt.configLoad(C,z):rt.configLoad(C,Error(String(z)))}};if(W)return Tr.track("loadFromPath",U,{path:C});return U()}async tryLoadFromPaths(C,E,P={}){for(let x of C)try{let M=await this.loadFromPath(x,E,P);if(M)return M}catch(M){if(M instanceof Error&&M.name==="ConfigLoadError")throw M;if(P.verbose)console.warn(`Failed to load config from ${x}:`,M)}return null}generateConfigPaths(C,E,P){let x=this.generateNamePatterns(C,P),M=[];for(let K of x)for(let W of this.extensions)M.push(mr(E,`${K}${W}`));return M}generateNamePatterns(C,E){let P=[];if(P.push("config",".config"),C)P.push(C,`.${C}.config`,`${C}.config`,`.${C}`);let x=E===void 0?[]:Array.isArray(E)?E:[E];for(let K of x){if(!K)continue;if(P.push(K,`.${K}.config`,`${K}.config`,`.${K}`),C)P.push(`${C}.${K}.config`,`.${C}.${K}.config`)}let M=new Set;return P.filter((K)=>{if(!K||M.has(K))return!1;return M.add(K),!0})}checkFileAccess(C){return No(async()=>Ct(C),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(C,E,P){let x=[];if(!Ct(C))return x;if(E||P){let M=this.generateNamePatterns(E||"",P);for(let K of M)for(let W of this.extensions){let V=mr(C,`${K}${W}`);if(await this.checkFileAccess(V))x.push(V)}}else try{let{readdirSync:M}=await import("fs"),K=M(C);for(let W of K)if(this.looksLikeConfigFile(W)){let V=mr(C,W);if(await this.checkFileAccess(V))x.push(V)}}catch{return[]}return x}looksLikeConfigFile(C){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((P)=>P.test(C))}async validateConfigFile(C){let E=[];try{if(!Ct(C))return E.push("Configuration file does not exist"),E;let P=await import(C),x=P.default||P;if(x===void 0)E.push("Configuration file must export a default value or named exports");else if(typeof x!=="object"||x===null)E.push("Configuration must be an object");else if(Array.isArray(x))E.push("Configuration cannot be an array at the root level");if(C.endsWith(".json"))try{let{readFileSync:M}=await import("fs"),K=M(C,"utf8");JSON.parse(K)}catch(M){E.push(`Invalid JSON syntax: ${M}`)}}catch(P){E.push(`Failed to load configuration file: ${P}`)}return E}async getFileModificationTime(C){try{let{statSync:E}=await import("fs");return E(C).mtime}catch{return null}}async preloadConfigurations(C,E={}){let P=new Map;return await Promise.allSettled(C.map(async(x)=>{try{let M=await this.loadFromPath(x,{},E);if(M)P.set(x,M.config)}catch(M){if(E.verbose)console.warn(`Failed to preload ${x}:`,M)}})),P}}var _o=/^https?:\/\//;class gs{async validateConfiguration(C,E,P={}){let{stopOnFirstError:x=!1,validateRequired:M=!0,validateTypes:K=!0,customRules:W=[],trackPerformance:V=!0,verbose:U=!1}=P,z=async()=>{let G=[],J=[],q={stopOnFirstError:x,validateRequired:M,validateTypes:K,customRules:W,trackPerformance:V,verbose:U};try{if(typeof E==="string")return await this.validateWithSchemaFile(C,E,q);else if(Array.isArray(E))return this.validateWithRules(C,[...E,...W],q);else return this.validateWithJSONSchema(C,E,q)}catch(Y){return G.push({path:"",message:`Validation failed: ${Y}`,rule:"system"}),{isValid:!1,errors:G,warnings:J}}};if(V)return await Tr.track("validateConfiguration",z);return z()}async validateWithSchemaFile(C,E,P){try{if(!jo(E))throw new Wt(E,[{path:"",message:"Schema file does not exist"}]);let x=await import(E),M=x.default||x;if(Array.isArray(M))return this.validateWithRules(C,M,P);else return this.validateWithJSONSchema(C,M,P)}catch(x){throw new Wt(E,[{path:"",message:`Failed to load schema: ${x}`}])}}validateWithJSONSchema(C,E,P){let x=[],M=[];return this.validateObjectAgainstSchema(C,E,"",x,M,P),{isValid:x.length===0,errors:x,warnings:M}}validateObjectAgainstSchema(C,E,P,x,M,K){if(K.validateTypes&&E.type){let W=Array.isArray(C)?"array":typeof C,V=Array.isArray(E.type)?E.type:[E.type];if(!V.includes(W)){if(x.push({path:P,message:`Expected type ${V.join(" or ")}, got ${W}`,expected:V.join(" or "),actual:W,rule:"type"}),K.stopOnFirstError)return}}if(E.enum&&!E.enum.includes(C)){if(x.push({path:P,message:`Value must be one of: ${E.enum.join(", ")}`,expected:E.enum.join(", "),actual:C,rule:"enum"}),K.stopOnFirstError)return}if(typeof C==="string"){if(E.minLength!==void 0&&C.length<E.minLength)x.push({path:P,message:`String length must be at least ${E.minLength}`,expected:`>= ${E.minLength}`,actual:C.length,rule:"minLength"});if(E.maxLength!==void 0&&C.length>E.maxLength)x.push({path:P,message:`String length must not exceed ${E.maxLength}`,expected:`<= ${E.maxLength}`,actual:C.length,rule:"maxLength"});if(E.pattern){if(!new RegExp(E.pattern).test(C))x.push({path:P,message:`String does not match pattern ${E.pattern}`,expected:E.pattern,actual:C,rule:"pattern"})}}if(typeof C==="number"){if(E.minimum!==void 0&&C<E.minimum)x.push({path:P,message:`Value must be at least ${E.minimum}`,expected:`>= ${E.minimum}`,actual:C,rule:"minimum"});if(E.maximum!==void 0&&C>E.maximum)x.push({path:P,message:`Value must not exceed ${E.maximum}`,expected:`<= ${E.maximum}`,actual:C,rule:"maximum"})}if(Array.isArray(C)&&E.items)for(let W=0;W<C.length;W++){let V=P?`${P}[${W}]`:`[${W}]`;if(this.validateObjectAgainstSchema(C[W],E.items,V,x,M,K),K.stopOnFirstError&&x.length>0)return}if(C&&typeof C==="object"&&!Array.isArray(C)){let W=C;if(K.validateRequired&&E.required){for(let V of E.required)if(!(V in W)){if(x.push({path:P?`${P}.${V}`:V,message:`Missing required property '${V}'`,expected:"required",rule:"required"}),K.stopOnFirstError)return}}if(E.properties){for(let[V,U]of Object.entries(E.properties))if(V in W){let z=P?`${P}.${V}`:V;if(this.validateObjectAgainstSchema(W[V],U,z,x,M,K),K.stopOnFirstError&&x.length>0)return}}if(E.additionalProperties===!1){let V=new Set(Object.keys(E.properties||{}));for(let U of Object.keys(W))if(!V.has(U))M.push({path:P?`${P}.${U}`:U,message:`Additional property '${U}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(C,E,P){let x=[],M=[];for(let K of E)try{let W=this.getValueByPath(C,K.path),V=this.validateWithRule(W,K,K.path);if(x.push(...V),P.stopOnFirstError&&x.length>0)break}catch(W){x.push({path:K.path,message:`Rule validation failed: ${W}`,rule:"system"})}return{isValid:x.length===0,errors:x,warnings:M}}validateWithRule(C,E,P){let x=[];if(E.required&&(C===void 0||C===null))return x.push({path:P,message:E.message||`Property '${P}' is required`,expected:"required",rule:"required"}),x;if(C===void 0||C===null)return x;if(E.type){let M=Array.isArray(C)?"array":typeof C;if(M!==E.type)x.push({path:P,message:E.message||`Expected type ${E.type}, got ${M}`,expected:E.type,actual:M,rule:"type"})}if(E.min!==void 0){let M=Array.isArray(C)?C.length:typeof C==="string"?C.length:typeof C==="number"?C:0;if(M<E.min)x.push({path:P,message:E.message||`Value must be at least ${E.min}`,expected:`>= ${E.min}`,actual:M,rule:"min"})}if(E.max!==void 0){let M=Array.isArray(C)?C.length:typeof C==="string"?C.length:typeof C==="number"?C:0;if(M>E.max)x.push({path:P,message:E.message||`Value must not exceed ${E.max}`,expected:`<= ${E.max}`,actual:M,rule:"max"})}if(E.pattern&&typeof C==="string"){if(!E.pattern.test(C))x.push({path:P,message:E.message||`Value does not match pattern ${E.pattern}`,expected:E.pattern.toString(),actual:C,rule:"pattern"})}if(E.enum&&!E.enum.includes(C))x.push({path:P,message:E.message||`Value must be one of: ${E.enum.join(", ")}`,expected:E.enum.join(", "),actual:C,rule:"enum"});if(E.validator){let M=E.validator(C);if(M)x.push({path:P,message:E.message||M,rule:"custom"})}return x}getValueByPath(C,E){if(!E)return C;let P=E.split("."),x=C;for(let M of P)if(x&&typeof x==="object"&&M in x)x=x[M];else return;return x}generateRulesFromInterface(C){let E=[],P=C.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let x of P){let[,M,K,W]=x;E.push({path:M,required:!K,type:this.mapTypeScriptType(W)})}return E}mapTypeScriptType(C){switch(C.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:_o},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}var Me=new Gt("bunfig",{showTags:!0});function Bo(C){if(!C)return"";let E=Array.isArray(C)?C.filter(Boolean):[C];if(E.length===0)return"";if(E.length===1)return` or alias "${E[0]}"`;return` or aliases ${E.map((P)=>`"${P}"`).join(", ")}`}class ms{fileLoader=new us;envProcessor=new Lr;validator=new gs;async loadConfig(C){let E=Date.now(),{cache:P,performance:x,schema:M,validate:K,...W}=C;try{if(P?.enabled){let U=this.checkCache(W.name||"",W);if(U)return U}let V;try{V=await this.loadConfigurationStrategies(W,!0,P)}catch(U){let z=W.__strictErrorHandling;if(U instanceof Error&&U.name==="ConfigNotFoundError"){if(z)throw U;V={...await this.applyEnvironmentVariables(W.name||"",W.defaultConfig,W.checkEnv!==!1,W.verbose||!1),warnings:[`No configuration file found for "${W.name||"config"}", using defaults with environment variables`]}}else if(U instanceof Error&&U.name==="ConfigLoadError"){let G=U.message.includes("EACCES")||U.message.includes("EPERM")||U.message.includes("permission denied"),J=!G&&(U.message.includes("syntax")||U.message.includes("Expected")||U.message.includes("Unexpected")||U.message.includes("BuildMessage")||U.message.includes("errors building")),q=U.message.includes("Configuration must export a valid object")||U.message.includes("Configuration file is empty and exports nothing");if(z&&(q||G))throw U;if(J&&(!z||!q))V={...await this.applyEnvironmentVariables(W.name||"",W.defaultConfig,W.checkEnv!==!1,W.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!z)V={...await this.applyEnvironmentVariables(W.name||"",W.defaultConfig,W.checkEnv!==!1,W.verbose||!1),warnings:[`Configuration loading error, using defaults: ${U.message}`]};else throw U}else V={...await this.applyEnvironmentVariables(W.name||"",W.defaultConfig,W.checkEnv!==!1,W.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${U instanceof Error?U.message:String(U)}`]}}if(M||K)await this.validateConfiguration(V.config,M,K,W.name);if(P?.enabled&&V)this.cacheResult(W.name||"",V,P,W);if(x?.enabled){let U={operation:"loadConfig",duration:Date.now()-E,configName:W.name,timestamp:new Date};if(x.onMetrics)x.onMetrics(U);if(x.slowThreshold&&U.duration>x.slowThreshold)Me.warn(`Slow configuration loading detected: ${U.duration}ms for ${W.name}`);V.metrics=U}return V}catch(V){if(V instanceof Error&&V.name==="ConfigNotFoundError")throw V;let U=Date.now()-E;throw Me.error(`Configuration loading failed after ${U}ms:`,[V instanceof Error?V:Error(String(V))]),V}}async loadConfigurationStrategies(C,E=!1,P){let{name:x="",alias:M,cwd:K,configDir:W,defaultConfig:V,checkEnv:U=!0,arrayStrategy:z="replace",verbose:G=!1}=C,J=K||Vt.cwd(),q=[],Y=await this.loadLocalConfiguration(x,M,J,W,V,z,G,U,P);if(Y)return q.push(...this.getLocalSearchPaths(x,M,J,W)),this.finalizeResult(Y,q,U,x,G);let ee=await this.loadHomeConfiguration(x,M,V,z,G,U);if(ee)return q.push(...this.getHomeSearchPaths(x,M)),this.finalizeResult(ee,q,U,x,G);let H=await this.loadPackageJsonConfiguration(x,M,J,V,z,G,U);if(H)return q.push(Oe(J,"package.json")),this.finalizeResult(H,q,U,x,G);if(q.push(...this.getAllSearchPaths(x,M,J,W)),E)throw rt.configNotFound(x,q,M);return{...await this.applyEnvironmentVariables(x,V,U,G),warnings:[`No configuration file found for "${x}"${Bo(M)}, using defaults with environment variables`]}}async loadLocalConfiguration(C,E,P,x,M,K,W,V,U){let z=V?Et(C,M,W):M,G=this.getLocalDirectories(P,x);for(let J of G){if(W)Me.info(`Searching for configuration in: ${J}`);let q=this.fileLoader.generateConfigPaths(C,J,E),Y=await this.fileLoader.tryLoadFromPaths(q,z,{arrayStrategy:K,verbose:W,cacheTtl:U?.ttl,useCache:!U?.ttl||U.ttl>100});if(Y){if(W)Me.success(`Configuration loaded from: ${Y.source.path}`);return Y}}return null}async loadHomeConfiguration(C,E,P,x,M,K){if(!C)return null;let W=K?Et(C,P,M):P,V=[Oe(Ue(),".config",C),Oe(Ue(),".config"),Ue()];for(let U of V){if(M)Me.info(`Checking home directory: ${U}`);let z=this.fileLoader.generateConfigPaths(C,U,E),G=await this.fileLoader.tryLoadFromPaths(z,W,{arrayStrategy:x,verbose:M});if(G){if(M)Me.success(`Configuration loaded from home directory: ${G.source.path}`);return G}}return null}async loadPackageJsonConfiguration(C,E,P,x,M,K,W){let V=W?Et(C,x,K):x;try{let U=Oe(P,"package.json");if(!Ns(U))return null;let z={};try{z=JSON.parse(Ps(U,"utf8"))}catch(q){if(K)Me.warn("Failed to parse package.json:",[q instanceof Error?q:Error(String(q))]);return null}let G=z[C],J=C;if(!G&&E){let q=Array.isArray(E)?E:[E];for(let Y of q){if(!Y)continue;if(z[Y]){G=z[Y],J=Y;break}}}if(G&&typeof G==="object"&&!Array.isArray(G)){if(K)Me.success(`Configuration loaded from package.json: ${J}`);return{config:fs(V,G,M),source:{type:"package.json",path:U,priority:30,timestamp:new Date}}}}catch(U){if(K)Me.warn("Failed to load package.json:",[U instanceof Error?U:Error(String(U))])}return null}async applyEnvironmentVariables(C,E,P,x){if(!P||!C||typeof E!=="object"||E===null||Array.isArray(E))return{config:E,source:{type:"default",priority:10,timestamp:new Date}};return{config:Et(C,E,x),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(C,E,P,x,M){return{config:C.config,source:C.source,path:C.source.path}}async validateConfiguration(C,E,P,x){let M=[];if(P){let K=P(C);if(K)M.push(...K)}if(E){let K=await this.validator.validateConfiguration(C,E);if(!K.isValid)M.push(...K.errors.map((W)=>W.path?`${W.path}: ${W.message}`:W.message))}if(M.length>0)throw rt.configValidation(x||"unknown",M,x)}checkCache(C,E){let P=this.generateCacheKey(C,E);return Ot.get(P)||null}cacheResult(C,E,P,x){let M=this.generateCacheKey(C,x);Ot.set(M,E,void 0,P.ttl)}generateCacheKey(C,E){let P=[C];if(E.alias){let x=Array.isArray(E.alias)?E.alias.join(","):E.alias;P.push(`alias:${x}`)}if(E.cwd)P.push(`cwd:${E.cwd}`);if(E.configDir)P.push(`configDir:${E.configDir}`);if("checkEnv"in E)P.push(`checkEnv:${E.checkEnv}`);return P.join("|")}getLocalDirectories(C,E){return Array.from(new Set([C,Oe(C,"config"),Oe(C,".config"),E?Oe(C,E):void 0].filter(Boolean)))}getAllSearchPaths(C,E,P,x){let M=[];return M.push(...this.getLocalSearchPaths(C,E,P,x)),M.push(...this.getHomeSearchPaths(C,E)),M.push(Oe(P,"package.json")),M}getLocalSearchPaths(C,E,P,x){let M=this.getLocalDirectories(P,x),K=[];for(let W of M)K.push(...this.fileLoader.generateConfigPaths(C,W,E));return K}getHomeSearchPaths(C,E){if(!C)return[];let P=[Oe(Ue(),".config",C),Oe(Ue(),".config"),Ue()],x=[];for(let M of P)x.push(...this.fileLoader.generateConfigPaths(C,M,E));return x}async loadConfigWithResult(C){return this.loadConfig(C)}}var hr=new ms;async function hs(C){let E="defaultConfig"in C&&C.defaultConfig!==void 0?C.defaultConfig:{},P="cache"in C||"performance"in C||"schema"in C||"validate"in C;try{let x;if(P)x=await hr.loadConfig(C);else x=await hr.loadConfig({...C,defaultConfig:E,cache:{enabled:!0},performance:{enabled:!1}});return x?.config??E}catch(x){let M=x instanceof Error?x.name:"UnknownError",K=x instanceof Error?x.message:String(x);if(!(M==="ConfigNotFoundError"||M==="ConfigLoadError"||M==="ConfigValidationError"||K.includes("config"))&&C.verbose)Me.warn("Unexpected error loading config, using defaults:",[x instanceof Error?x:Error(String(x))]);let V=P?{...C,defaultConfig:E}:{...C,defaultConfig:E,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in C?C.checkEnv!==!1:!0)return(await hr.applyEnvironmentVariables(V.name||"",E,!0,V.verbose||!1))?.config??E;return E}}function Et(C,E,P=!1){let x=new Lr,M=C.toUpperCase().replace(/[^A-Z0-9]/g,"_");function K(W,V=[]){let U={...W};for(let[z,G]of Object.entries(W)){let J=[...V,z],q=[`${M}_${J.join("_").toUpperCase()}`,`${M}_${J.map((H)=>H.toUpperCase()).join("")}`,`${M}_${J.map((H)=>H.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],Y,ee;for(let H of q)if(Y=Vt.env[H],Y!==void 0){ee=H;break}if(Y!==void 0&&ee)if(typeof G==="boolean")U[z]=["true","1","yes"].includes(Y.toLowerCase());else if(typeof G==="number"){let H=Number(Y);if(!Number.isNaN(H))U[z]=H}else if(Array.isArray(G))try{U[z]=JSON.parse(Y)}catch{U[z]=Y.split(",").map((H)=>H.trim())}else U[z]=Y;else if(G&&typeof G==="object"&&!Array.isArray(G))U[z]=K(G,J)}return U}return K(E)}var Dl=Oe(Vt.cwd(),"config"),Ll=Oe(Vt.cwd(),"src/generated");var Ko=["code-style","lint"],s={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},Ir=null;async function F(){if(!Ir)Ir=await hs({name:"pickier",alias:[...Ko],defaultConfig:s});return Ir}var S=s;import{readFileSync as Ya,statSync as Ha,writeFileSync as Za}from"fs";import{isAbsolute as Xa,resolve as Qa}from"path";function r(C){let E=C.length,P=Array.from({length:E},(M,K)=>C[K]),x=0;while(x<E){let M=C[x];if(M==="#"&&(x===0||/\s/.test(C[x-1]))){while(x<E)P[x]=" ",x++;break}if(M==="$"&&C[x+1]==="'"){x+=2;while(x<E){if(C[x]==="\\"&&x+1<E){P[x]=" ",P[x+1]=" ",x+=2;continue}if(C[x]==="'"){x++;break}P[x]=" ",x++}continue}if(M==="$"&&C[x+1]==='"'){x++,x=ct(C,x,P);continue}if(M==="$"&&C[x+1]==="{"){x+=2;let K=1;while(x<E&&K>0){let W=C[x];if(W==="\\"&&x+1<E){P[x]=" ",P[x+1]=" ",x+=2;continue}if(W==="'"){x++;while(x<E&&C[x]!=="'")P[x]=" ",x++;if(x<E)x++;continue}if(W==='"'){x=ct(C,x,P);continue}if(W==="{"){K++,x++;continue}if(W==="}"){K--,x++;continue}P[x]=" ",x++}continue}if(M==="$"&&C[x+1]==="("&&C[x+2]==="("){x+=3;let K=2;while(x<E&&K>0){let W=C[x];if(W==="("){K++,x++;continue}if(W===")"){K--,x++;continue}P[x]=" ",x++}continue}if(M==="$"&&C[x+1]==="("){x+=2;let K=1;while(x<E&&K>0){let W=C[x];if(W==="\\"&&x+1<E){P[x]=" ",P[x+1]=" ",x+=2;continue}if(W==="'"){x++;while(x<E&&C[x]!=="'")P[x]=" ",x++;if(x<E)x++;continue}if(W==='"'){x=ct(C,x,P);continue}if(W==="("){K++,x++;continue}if(W===")"){K--,x++;continue}P[x]=" ",x++}continue}if(M==="'"){x++;while(x<E&&C[x]!=="'")P[x]=" ",x++;if(x<E)x++;continue}if(M==='"'){x=ct(C,x,P);continue}if(M==="`"){x++;while(x<E&&C[x]!=="`"){if(C[x]==="\\"&&x+1<E){P[x]=" ",P[x+1]=" ",x+=2;continue}P[x]=" ",x++}if(x<E)x++;continue}x++}return P.join("")}function ct(C,E,P){let x=C.length,M=E+1;while(M<x){let K=C[M];if(K==="\\"&&M+1<x){P[M]=" ",P[M+1]=" ",M+=2;continue}if(K==='"')return M+1;if(K==="$"&&C[M+1]==="("&&C[M+2]==="("){M+=3;let W=2;while(M<x&&W>0){let V=C[M];if(V==="("){W++,M++;continue}if(V===")"){W--,M++;continue}P[M]=" ",M++}continue}if(K==="$"&&C[M+1]==="("){M+=2;let W=1;while(M<x&&W>0){let V=C[M];if(V==="\\"&&M+1<x){P[M]=" ",P[M+1]=" ",M+=2;continue}if(V==="'"){M++;while(M<x&&C[M]!=="'")P[M]=" ",M++;if(M<x)M++;continue}if(V==='"'){M=ct(C,M,P);continue}if(V==="("){W++,M++;continue}if(V===")"){W--,M++;continue}P[M]=" ",M++}continue}if(K==="$"&&C[M+1]==="{"){M+=2;let W=1;while(M<x&&W>0){let V=C[M];if(V==="{"){W++,M++;continue}if(V==="}"){W--,M++;continue}P[M]=" ",M++}continue}P[M]=" ",M++}return M}function t(C){let P=r(C).match(/<<-?/);if(!P||P.index===void 0)return null;let M=C.slice(P.index+P[0].length).match(/^\s*(['"]?)(\w+)\1/);if(!M)return null;return M[2]}var Wo=new Set([".ts",".js"]),Vo=new Set([".json",".jsonc"]),Uo=new Set([".yaml",".yml"]),zo=new Set([".sh",".bash",".zsh",".ksh",".dash"]),Go=/^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/;var Jo=/^[}\])]/,qo=/[{[(]\s*$/,Yo=/\s*\/\/.*$/,Ho=/^(?:if|else\s+if|for|while)\s*\(/,Zo=/^(?:\.[\w$[]|\?[\s.:]|:\s|&&|\|\|)/;function Xo(C){let E=Ho.exec(C);if(!E)return/^(?:else|do)\s*$/.test(C);let P=0,x=null;for(let M=E[0].length-1;M<C.length;M++){let K=C[M];if(x){if(K==="\\"){M++;continue}if(K===x)x=null;continue}if(K==="'"||K==='"'||K==="`"){x=K;continue}if(K==="(")P++;else if(K===")"){if(P--,P===0)return C.slice(M+1).trim().length===0}}return!1}var Qo=/^\s*for\s*\(/,ea=new RegExp("^\\s*;\\s*$"),ta=new RegExp(";{2,}\\s*$"),ra=/([\w)])\{/g,na=/\{(return|if|for|while|switch|const|let|var|function)\b/g,sa=/,(\S)/g,ia=/(?<![=!<>+\-*/%&|^?])=(?![=><])/g,oa=/(\w)\+(\w)/g,aa=/(\w)-(\w)/g,ca=/(\w)\*(\w)/g,la=/(\w)\/(\w)/g,fa=new RegExp("(?<=\\S);([^\\s;])","g"),ua=/([\w)\]])<(\d)/g,ga=/([\w)\]])>(\d)/g,ds=/\s{2,}/g,ps=/^\s*$/,ma=/^\s*\/\//,ys=/^\s*\/\*/,ha=/^\s*import\b/,ws=/\bfrom\s*['"][^'"]+['"]|^\s*import\s+['"][^'"]+['"]/,da=/package\.json$/i,pa=/[jt]sconfig(?:\..+)?\.json$/i,jr=/[ \t]+$/,ya=/^\n+/;function Jt(C){let E=C.lastIndexOf(".");return E>=0?C.slice(E):""}function _r(C){return Wo.has(Jt(C))}function wa(C){return Vo.has(Jt(C))}function ba(C){return Uo.has(Jt(C))}function va(C){return zo.has(Jt(C))}function $a(C,E){return va(C)||Go.test(E)}function Ca(C,E){let P=C.split(`
|
|
62
62
|
`),x=P.length,M=Array(x),K=E.format.indent,W=E.format.indentStyle==="tabs",V=0,U=!1,z="",G=!1,J=0;for(let q=0;q<x;q++){let Y=P[q];if(Y.length===0||/^\s*$/.test(Y)){M[q]="";continue}if(U){if(M[q]=Y,Y.trim()===z)U=!1,z="";continue}let ee=t(Y);if(ee)U=!0,z=ee;let H=0;while(H<Y.length&&(Y.charCodeAt(H)===32||Y.charCodeAt(H)===9))H++;let Z=Y.slice(H).trimEnd();if(Z.startsWith("#")&&q>0){let we=W?"\t".repeat(V):" ".repeat(V*K);M[q]=we+Z;continue}if(/^case\b/.test(Z)&&/\bin\s*$/.test(Z))J++,G=!0;if(/^esac\b/.test(Z)){if(J=Math.max(0,J-1),J===0)G=!1}let te=G&&/\)\s*$/.test(Z)&&!/\$\(/.test(Z)&&!/^\s*\(/.test(Z)&&!Z.startsWith("#"),re=/^;[;&]\s*$/.test(Z);if(/^(?:fi|done|esac|elif|else)\b/.test(Z)||/^\}/.test(Z))V=Math.max(0,V-1);if(re)V=Math.max(0,V-1);let Ce=W?"\t".repeat(V):" ".repeat(V*K);if(M[q]=Ce+Z,/^then\b/.test(Z)||/^do\b/.test(Z)||/^else\b/.test(Z))V++;else if(/^if\b/.test(Z)&&/\bthen\s*$/.test(Z))V++;else if(/^elif\b/.test(Z)&&/\bthen\s*$/.test(Z))V++;else if(/^(?:while|for|until)\b/.test(Z)&&/\bdo\s*$/.test(Z))V++;else if(/^case\b/.test(Z)&&/\bin\s*$/.test(Z))V++;else if(te)V++;else if(/\{\s*$/.test(Z)&&!Z.startsWith("#"))V++}return M.join(`
|
|
63
63
|
`)}function Ea(C,E){try{let P=Bun.YAML.parse(C),x=E.format.indentStyle==="tabs"?"\t":E.format.indent;return Bun.YAML.stringify(P,null,x).split(`
|
|
64
64
|
`).map((K)=>K.replace(/[ \t]+$/,"")).join(`
|
|
@@ -88,5 +88,5 @@ ${K.join(`
|
|
|
88
88
|
`)}`:"",Se=J.replace(/^\n+/,""),Fs=Se.length>0?`
|
|
89
89
|
|
|
90
90
|
`:`
|
|
91
|
-
`;return`${fe}${Ce}${we}${Fs}${Se}`}function ja(C){if(C.kind==="side-effect")return`import '${C.source}'`;if(C.kind==="type")return`import type { ${C.namedTypes.map((M)=>M.alias?`${M.name} as ${M.alias}`:M.name).join(", ")} } from '${C.source}'`;let E=[];if(C.defaultName)E.push(C.defaultName);if(C.namespaceName)E.push(`* as ${C.namespaceName}`);if(C.named.length>0){let x=C.named.map((M)=>M.alias?`${M.name} as ${M.alias}`:M.name).join(", ");E.push(`{ ${x} }`)}return`import ${E.join(", ")} from '${C.source}'`}function _a(C){let E=C.match(/^\s*import\s+['"]([^'"]+)['"]/);if(E)return{kind:"side-effect",source:E[1],named:[],namedTypes:[],original:C};if(E=C.match(/^\s*import\s+type\s+\{([^}]*)\}\s+from\s+['"]([^'"]+)['"]/),E){let q=E[1],Y=E[2],ee=q.split(",").map((H)=>H.trim()).filter(Boolean).map((H)=>{let Z=H.match(/^(\w+)(?:\s+as\s+(\w+))?$/);return{name:Z?.[1]||H,alias:Z?.[2]}});return{kind:"type",source:Y,named:[],namedTypes:ee,original:C}}let P=C.match(/^\s*import\s+/),x=new RegExp(`\\sfrom\\s+['"]([^'"]+)['"]\\s*;?$`),M=C.match(x);if(!P||!M)return;let K=M[1],W=C.slice(P[0].length,M.index).trim(),V,U,z=[],G=[],J=W.match(/\{([^}]*)\}/);if(J){let Y=J[1].split(",").map((ee)=>ee.trim()).filter(Boolean);for(let ee of Y){let H=/^type\s+/.test(ee),te=ee.replace(/^type\s+/,"").match(/^(\w+)(?:\s+as\s+(\w+))?$/);if(!te)continue;let re={name:te[1],alias:te[2]};if(H)G.push(re);else z.push(re)}W=W.replace(/\{[\s\S]*?\}/,"").trim()}if(W.length>0){let q=W.split(",").map((Y)=>Y.trim()).filter(Boolean);for(let Y of q)if(Y.startsWith("* as "))U=Y.slice(5).trim();else if(/^\w+$/.test(Y))V=Y}return{kind:"value",source:K,defaultName:V,namespaceName:U,named:z,namedTypes:G,original:C}}function Ba(C,E){if(da.test(E))return Ka(C);if(pa.test(E))return Wa(C);return null}function Ts(C){try{return JSON.parse(C)}catch{return null}}function lt(C,E,P=[]){let x={};for(let K of E)if(Object.prototype.hasOwnProperty.call(C,K))x[K]=C[K];for(let K of P){let W=Object.keys(C).filter((V)=>K.test(V)&&!(V in x)).sort();for(let V of W)x[V]=C[V]}let M=Object.keys(C).filter((K)=>!(K in x)).sort();for(let K of M)x[K]=C[K];return x}function $s(C){let E={};for(let P of Object.keys(C).sort())E[P]=C[P];return E}function Ka(C){let E=Ts(C);if(!E||typeof E!=="object")return C;let x=lt(E,["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(x.files)){if(x.files.every((W)=>typeof W==="string"))x.files=[...x.files].sort()}for(let K of Object.keys(x))if(/^(?:dev|peer|optional|bundled)?[Dd]ependencies(?:Meta)?$/.test(K)||/^(?:resolutions|overrides|pnpm\.overrides)$/.test(K)){if(x[K]&&typeof x[K]==="object")x[K]=$s(x[K])}if(x.pnpm&&typeof x.pnpm==="object"&&x.pnpm.overrides&&typeof x.pnpm.overrides==="object")x.pnpm.overrides=$s(x.pnpm.overrides);if(x.exports&&typeof x.exports==="object"){let K=x.exports,W=["types","import","require","default"];if(!Array.isArray(K)){let V={};for(let U of Object.keys(K)){let z=K[U];if(z&&typeof z==="object"&&!Array.isArray(z))V[U]=lt(z,W);else V[U]=z}x.exports=V}}let M=["pre-commit","prepare-commit-msg","commit-msg","post-commit","pre-rebase","post-rewrite","post-checkout","post-merge","pre-push","pre-auto-gc"];for(let K of["gitHooks","husky","simple-git-hooks"])if(x[K]&&typeof x[K]==="object")x[K]=lt(x[K],M);return JSON.stringify(x,null,2)}function Wa(C){let E=Ts(C);if(!E||typeof E!=="object")return C;let x=lt(E,["extends","compilerOptions","references","files","include","exclude"]);if(x.compilerOptions&&typeof x.compilerOptions==="object"){let M=["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"];x.compilerOptions=lt(x.compilerOptions,M)}return JSON.stringify(x,null,2)}import{readdirSync as Va,readFileSync as Ua,statSync as Os}from"fs";import{extname as za,isAbsolute as Wr,join as Vr,resolve as Ga}from"path";var b=5;function Ja(C){let E="",P=0;while(P<C.length){let x=C[P];if(x==="*")if(C[P+1]==="*"){if(E+=".*",P+=2,C[P]==="/")P++}else E+="[^/]*",P++;else if(x==="?")E+="[^/]",P++;else if(x==="["){let M=C.indexOf("]",P);if(M===-1)E+="\\[",P++;else E+=C.slice(P,M+1),P=M+1}else if(".+^${}()|\\".includes(x))E+=`\\${x}`,P++;else E+=x,P++}return new RegExp(`^${E}$`)}function*Rs(C,E,P){let x;try{x=Va(C)}catch{return}for(let M of x){if(!P&&M.startsWith("."))continue;let K=Vr(C,M);if(E(K))continue;let W;try{W=Os(K)}catch{continue}if(W.isDirectory())yield*Rs(K,E,P);else yield K}}function*As(C,E,P,x){yield*Rs(C,c(E,x),P)}async function r(C,E={}){let P=E.cwd??process.cwd(),x=E.ignore??[],M=E.dot??!1,K=E.absolute??!0,W=c(x,P);if(typeof globalThis.Bun?.Glob<"u"){let U=globalThis.Bun.Glob,z=[];for(let G of C){let J=new U(G);for await(let q of J.scan({cwd:P,dot:M,onlyFiles:E.onlyFiles??!0,followSymlinks:!1})){let Y=Wr(q)?q:Vr(P,q),ee=Y.startsWith(`${P}/`)?Y.slice(P.length+1):Y;if(W(Y))continue;z.push(K?Y:ee)}}return z}let V=[];for(let U of C){if(!/[*?[{]/.test(U)){let G=Wr(U)?U:Vr(P,U);try{if(!Os(G).isDirectory()){let q=G.startsWith(`${P}/`)?G.slice(P.length+1):G;if(!W(G))V.push(K?G:q)}else for(let q of As(G,x,M,P))V.push(K?q:q.startsWith(`${P}/`)?q.slice(P.length+1):q)}catch{}continue}let z=Ja(U);for(let G of As(P,x,M,P)){let J=G.startsWith(`${P}/`)?G.slice(P.length+1):G;if(z.test(J)||z.test(J.replace(/\\/g,"/")))V.push(K?G:J)}}return V}function D(C){let E=0,P=[],x=()=>{if(P.length>0&&E<C)E++,P.shift()()};return(M)=>new Promise((K,W)=>{let V=()=>{M().then((U)=>{E--,K(U),x()},(U)=>{E--,W(U),x()})};if(E<C)E++,V();else P.push(V)})}var n={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"}},R=["**/node_modules/**","**/.git/**"],o=["**/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 v(C,E){let P=C[E];if(P===void 0){let K=E.indexOf("/");if(K>0){let W=E.slice(0,K),V=E.slice(K+1),U=W==="general"?"pickier":W==="pickier"?"general":null;if(U)P=C[`${U}/${V}`];if(P===void 0)P=C[V]}}let x,M;if(typeof P==="string"){if(P==="error")x="error";else if(P==="warn"||P==="warning")x="warning"}else if(Array.isArray(P)&&typeof P[0]==="string"){let K=P[0];if(K==="error")x="error";else if(K==="warn"||K==="warning")x="warning";M=P[1]}return{enabled:!!x,severity:x,options:M}}function g(C){let E=Array.isArray(C)?C[0]:C;if(typeof E!=="string")return;if(E==="off")return"off";if(E==="error")return"error";if(E==="warn"||E==="warning")return"warning";return}function a(C,E,P=[],x){for(let K of[E,...P]){let W=g(C.rules?.[K])??g(C.pluginRules?.[K]);if(W)return W==="off"?void 0:W}let M=g(x);return M==="off"?void 0:M}function j(C,E){return g(C.rules?.[E])==="off"||g(C.pluginRules?.[E])==="off"}function h(C,E){return`\x1B[${C}m${E}\x1B[0m`}function T(C){return h("32",C)}function L(C){return h("31",C)}function A(C){return h("33",C)}function O(C){return h("34",C)}function _(C){return h("90",C)}function N(C){return h("1",C)}var e={green:T,red:L,yellow:A,blue:O,gray:_,bold:N};function m(C,E){let P=E.ignores?[...new Set([...C.ignores||[],...E.ignores])]:C.ignores,x={...C.pluginRules||{},...E.pluginRules||{}};if((E.tailwind??C.tailwind)?.enabled&&!Object.prototype.hasOwnProperty.call(x,"pickier/sort-tailwind-classes"))x["pickier/sort-tailwind-classes"]="warn";return{...C,...E,verbose:E.verbose??C.verbose,ignores:P,lint:{...C.lint,...E.lint||{}},format:{...C.format,...E.format||{}},rules:{...C.rules,...E.rules||{}},pluginRules:x}}var Kr=null;async function u(C){if(!C){if(n.NO_AUTO_CONFIG){if(!Kr)Kr=m(s,{});return Kr}try{let{getConfig:x}=await import("./chunk-nke9r0j5.js"),M=await x();return m(s,M)}catch{}return m(s,{})}let E=Wr(C)?C:Ga(process.cwd(),C);if(za(E).toLowerCase()===".json")try{let x=Ua(E,"utf8");return m(s,JSON.parse(x))}catch{return console.warn(`[pickier:warn] Config file not found: ${E}. Using default config values.`),m(s,{})}try{let x=await import(E);return m(s,x.default||x)}catch{return console.warn(`[pickier:warn] Config file not found: ${E}. Using default config values.`),m(s,{})}}function d(C){return C.map((E)=>{if(/[*?[\]{}()!]/.test(E))return E;if(/\.[A-Z0-9]+$/i.test(E))return E;return`${E.replace(/\/$/,"")}/**/*`})}function w(C,E){let P=C.lastIndexOf(".");if(P<0)return!1;let x=C.slice(P);return E.has(x)}function Ur(C){return C.replace(/\\/g,"/").replace(/\/+/g,"/")}function qa(C){let E=[];for(let P of C){let x=Ur(P.trim());if(!x)continue;let M=x.match(/\*\*\/\*\.(.+)$/);if(M){E.push({raw:x,kind:"extension",value:M[1]});continue}let K=x.match(/\*\*\/(.+?)\/\*\*$/);if(K){E.push({raw:x,kind:"segment",value:K[1]});continue}let W=x.match(/\*\*\/(.+)$/);if(W)E.push({raw:x,kind:"suffix",value:W[1].replace(/\/$/,"")})}return E}function l(C){return[...new Set([...R,...C])]}function c(C,E=process.cwd()){let P=qa([...R,...C]);if(P.length===0)return()=>!1;let x=new Set([...o,...R]);return(M)=>{let K=Ur(M),W=Ur(E).replace(/\/$/,""),V=K!==W&&!K.startsWith(`${W}/`),U=V?K:K.slice(W.length);for(let z of P){if(V&&!x.has(z.raw))continue;if(z.kind==="extension"){if(U.endsWith(`.${z.value}`))return!0;continue}if(z.kind==="segment"||z.kind==="suffix"){let G=z.value;if(U.includes(`/${G}/`)||U.endsWith(`/${G}`))return!0}}return!1}}function B(C,E){return c(E)(C)}async function I(C,E){let P=E.mode||"auto";if(P==="format"&&C.length===1&&!/[*?[\]{}()!]/.test(C[0]))try{let W=C[0],V=Xa(W)?W:Qa(process.cwd(),W);if(Ha(V).isFile()){let z=await u(E.config),G=Ya(V,"utf8"),J=f(G,z,V);if(E.check&&J!==G)return 1;if(E.write&&J!==G)Za(V,J,"utf8");return 0}}catch{}let{runLint:x}=await import("./chunk-zzacmw52.js");if(P==="lint")return x(C,E);if(P==="format"){let W={...E,fix:!0,dryRun:!!E.check,ext:E.ext,_formatOnly:!0};return x(C,W)}if(!(E.fix===!0||E.write===!0||E.check===!0))return x(C,E);let K={...E,fix:!0,dryRun:!!E.check,ext:E.ext};return x(C,K)}
|
|
92
|
-
export{s,F,S,
|
|
91
|
+
`;return`${fe}${Ce}${we}${Fs}${Se}`}function ja(C){if(C.kind==="side-effect")return`import '${C.source}'`;if(C.kind==="type")return`import type { ${C.namedTypes.map((M)=>M.alias?`${M.name} as ${M.alias}`:M.name).join(", ")} } from '${C.source}'`;let E=[];if(C.defaultName)E.push(C.defaultName);if(C.namespaceName)E.push(`* as ${C.namespaceName}`);if(C.named.length>0){let x=C.named.map((M)=>M.alias?`${M.name} as ${M.alias}`:M.name).join(", ");E.push(`{ ${x} }`)}return`import ${E.join(", ")} from '${C.source}'`}function _a(C){let E=C.match(/^\s*import\s+['"]([^'"]+)['"]/);if(E)return{kind:"side-effect",source:E[1],named:[],namedTypes:[],original:C};if(E=C.match(/^\s*import\s+type\s+\{([^}]*)\}\s+from\s+['"]([^'"]+)['"]/),E){let q=E[1],Y=E[2],ee=q.split(",").map((H)=>H.trim()).filter(Boolean).map((H)=>{let Z=H.match(/^(\w+)(?:\s+as\s+(\w+))?$/);return{name:Z?.[1]||H,alias:Z?.[2]}});return{kind:"type",source:Y,named:[],namedTypes:ee,original:C}}let P=C.match(/^\s*import\s+/),x=new RegExp(`\\sfrom\\s+['"]([^'"]+)['"]\\s*;?$`),M=C.match(x);if(!P||!M)return;let K=M[1],W=C.slice(P[0].length,M.index).trim(),V,U,z=[],G=[],J=W.match(/\{([^}]*)\}/);if(J){let Y=J[1].split(",").map((ee)=>ee.trim()).filter(Boolean);for(let ee of Y){let H=/^type\s+/.test(ee),te=ee.replace(/^type\s+/,"").match(/^(\w+)(?:\s+as\s+(\w+))?$/);if(!te)continue;let re={name:te[1],alias:te[2]};if(H)G.push(re);else z.push(re)}W=W.replace(/\{[\s\S]*?\}/,"").trim()}if(W.length>0){let q=W.split(",").map((Y)=>Y.trim()).filter(Boolean);for(let Y of q)if(Y.startsWith("* as "))U=Y.slice(5).trim();else if(/^\w+$/.test(Y))V=Y}return{kind:"value",source:K,defaultName:V,namespaceName:U,named:z,namedTypes:G,original:C}}function Ba(C,E){if(da.test(E))return Ka(C);if(pa.test(E))return Wa(C);return null}function Ts(C){try{return JSON.parse(C)}catch{return null}}function lt(C,E,P=[]){let x={};for(let K of E)if(Object.prototype.hasOwnProperty.call(C,K))x[K]=C[K];for(let K of P){let W=Object.keys(C).filter((V)=>K.test(V)&&!(V in x)).sort();for(let V of W)x[V]=C[V]}let M=Object.keys(C).filter((K)=>!(K in x)).sort();for(let K of M)x[K]=C[K];return x}function $s(C){let E={};for(let P of Object.keys(C).sort())E[P]=C[P];return E}function Ka(C){let E=Ts(C);if(!E||typeof E!=="object")return C;let x=lt(E,["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(x.files)){if(x.files.every((W)=>typeof W==="string"))x.files=[...x.files].sort()}for(let K of Object.keys(x))if(/^(?:dev|peer|optional|bundled)?[Dd]ependencies(?:Meta)?$/.test(K)||/^(?:resolutions|overrides|pnpm\.overrides)$/.test(K)){if(x[K]&&typeof x[K]==="object")x[K]=$s(x[K])}if(x.pnpm&&typeof x.pnpm==="object"&&x.pnpm.overrides&&typeof x.pnpm.overrides==="object")x.pnpm.overrides=$s(x.pnpm.overrides);if(x.exports&&typeof x.exports==="object"){let K=x.exports,W=["types","import","require","default"];if(!Array.isArray(K)){let V={};for(let U of Object.keys(K)){let z=K[U];if(z&&typeof z==="object"&&!Array.isArray(z))V[U]=lt(z,W);else V[U]=z}x.exports=V}}let M=["pre-commit","prepare-commit-msg","commit-msg","post-commit","pre-rebase","post-rewrite","post-checkout","post-merge","pre-push","pre-auto-gc"];for(let K of["gitHooks","husky","simple-git-hooks"])if(x[K]&&typeof x[K]==="object")x[K]=lt(x[K],M);return JSON.stringify(x,null,2)}function Wa(C){let E=Ts(C);if(!E||typeof E!=="object")return C;let x=lt(E,["extends","compilerOptions","references","files","include","exclude"]);if(x.compilerOptions&&typeof x.compilerOptions==="object"){let M=["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"];x.compilerOptions=lt(x.compilerOptions,M)}return JSON.stringify(x,null,2)}import{readdirSync as Va,readFileSync as Ua,statSync as Os}from"fs";import{extname as za,isAbsolute as Wr,join as Vr,resolve as Ga}from"path";var b=5;function Ja(C){let E="",P=0;while(P<C.length){let x=C[P];if(x==="*")if(C[P+1]==="*"){if(E+=".*",P+=2,C[P]==="/")P++}else E+="[^/]*",P++;else if(x==="?")E+="[^/]",P++;else if(x==="["){let M=C.indexOf("]",P);if(M===-1)E+="\\[",P++;else E+=C.slice(P,M+1),P=M+1}else if(".+^${}()|\\".includes(x))E+=`\\${x}`,P++;else E+=x,P++}return new RegExp(`^${E}$`)}function*Rs(C,E,P){let x;try{x=Va(C)}catch{return}for(let M of x){if(!P&&M.startsWith("."))continue;let K=Vr(C,M);if(E(K))continue;let W;try{W=Os(K)}catch{continue}if(W.isDirectory())yield*Rs(K,E,P);else yield K}}function*As(C,E,P,x){yield*Rs(C,c(E,x),P)}async function i(C,E={}){let P=E.cwd??process.cwd(),x=E.ignore??[],M=E.dot??!1,K=E.absolute??!0,W=c(x,P);if(typeof globalThis.Bun?.Glob<"u"){let U=globalThis.Bun.Glob,z=[];for(let G of C){let J=new U(G);for await(let q of J.scan({cwd:P,dot:M,onlyFiles:E.onlyFiles??!0,followSymlinks:!1})){let Y=Wr(q)?q:Vr(P,q),ee=Y.startsWith(`${P}/`)?Y.slice(P.length+1):Y;if(W(Y))continue;z.push(K?Y:ee)}}return z}let V=[];for(let U of C){if(!/[*?[{]/.test(U)){let G=Wr(U)?U:Vr(P,U);try{if(!Os(G).isDirectory()){let q=G.startsWith(`${P}/`)?G.slice(P.length+1):G;if(!W(G))V.push(K?G:q)}else for(let q of As(G,x,M,P))V.push(K?q:q.startsWith(`${P}/`)?q.slice(P.length+1):q)}catch{}continue}let z=Ja(U);for(let G of As(P,x,M,P)){let J=G.startsWith(`${P}/`)?G.slice(P.length+1):G;if(z.test(J)||z.test(J.replace(/\\/g,"/")))V.push(K?G:J)}}return V}function D(C){let E=0,P=[],x=()=>{if(P.length>0&&E<C)E++,P.shift()()};return(M)=>new Promise((K,W)=>{let V=()=>{M().then((U)=>{E--,K(U),x()},(U)=>{E--,W(U),x()})};if(E<C)E++,V();else P.push(V)})}var n={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"}},R=["**/node_modules/**","**/.git/**"],o=["**/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 v(C,E){let P=C[E];if(P===void 0){let K=E.indexOf("/");if(K>0){let W=E.slice(0,K),V=E.slice(K+1),U=W==="general"?"pickier":W==="pickier"?"general":null;if(U)P=C[`${U}/${V}`];if(P===void 0)P=C[V]}}let x,M;if(typeof P==="string"){if(P==="error")x="error";else if(P==="warn"||P==="warning")x="warning"}else if(Array.isArray(P)&&typeof P[0]==="string"){let K=P[0];if(K==="error")x="error";else if(K==="warn"||K==="warning")x="warning";M=P[1]}return{enabled:!!x,severity:x,options:M}}function g(C){let E=Array.isArray(C)?C[0]:C;if(typeof E!=="string")return;if(E==="off")return"off";if(E==="error")return"error";if(E==="warn"||E==="warning")return"warning";return}function a(C,E,P=[],x){for(let K of[E,...P]){let W=g(C.rules?.[K])??g(C.pluginRules?.[K]);if(W)return W==="off"?void 0:W}let M=g(x);return M==="off"?void 0:M}function j(C,E){return g(C.rules?.[E])==="off"||g(C.pluginRules?.[E])==="off"}function h(C,E){return`\x1B[${C}m${E}\x1B[0m`}function T(C){return h("32",C)}function L(C){return h("31",C)}function A(C){return h("33",C)}function O(C){return h("34",C)}function _(C){return h("90",C)}function N(C){return h("1",C)}var e={green:T,red:L,yellow:A,blue:O,gray:_,bold:N};function m(C,E){let P=E.ignores?[...new Set([...C.ignores||[],...E.ignores])]:C.ignores,x={...C.pluginRules||{},...E.pluginRules||{}};if((E.tailwind??C.tailwind)?.enabled&&!Object.prototype.hasOwnProperty.call(x,"pickier/sort-tailwind-classes"))x["pickier/sort-tailwind-classes"]="warn";return{...C,...E,verbose:E.verbose??C.verbose,ignores:P,lint:{...C.lint,...E.lint||{}},format:{...C.format,...E.format||{}},rules:{...C.rules,...E.rules||{}},pluginRules:x}}var Kr=null;async function u(C){if(!C){if(n.NO_AUTO_CONFIG){if(!Kr)Kr=m(s,{});return Kr}try{let{getConfig:x}=await import("./chunk-xf6t6ene.js"),M=await x();return m(s,M)}catch{}return m(s,{})}let E=Wr(C)?C:Ga(process.cwd(),C);if(za(E).toLowerCase()===".json")try{let x=Ua(E,"utf8");return m(s,JSON.parse(x))}catch{return console.warn(`[pickier:warn] Config file not found: ${E}. Using default config values.`),m(s,{})}try{let x=await import(E);return m(s,x.default||x)}catch{return console.warn(`[pickier:warn] Config file not found: ${E}. Using default config values.`),m(s,{})}}function d(C){return C.map((E)=>{if(/[*?[\]{}()!]/.test(E))return E;if(/\.[A-Z0-9]+$/i.test(E))return E;return`${E.replace(/\/$/,"")}/**/*`})}function w(C,E){let P=C.lastIndexOf(".");if(P<0)return!1;let x=C.slice(P);return E.has(x)}function Ur(C){return C.replace(/\\/g,"/").replace(/\/+/g,"/")}function qa(C){let E=[];for(let P of C){let x=Ur(P.trim());if(!x)continue;let M=x.match(/\*\*\/\*\.(.+)$/);if(M){E.push({raw:x,kind:"extension",value:M[1]});continue}let K=x.match(/\*\*\/(.+?)\/\*\*$/);if(K){E.push({raw:x,kind:"segment",value:K[1]});continue}let W=x.match(/\*\*\/(.+)$/);if(W)E.push({raw:x,kind:"suffix",value:W[1].replace(/\/$/,"")})}return E}function l(C){return[...new Set([...R,...C])]}function c(C,E=process.cwd()){let P=qa([...R,...C]);if(P.length===0)return()=>!1;let x=new Set([...o,...R]);return(M)=>{let K=Ur(M),W=Ur(E).replace(/\/$/,""),V=K!==W&&!K.startsWith(`${W}/`),U=V?K:K.slice(W.length);for(let z of P){if(V&&!x.has(z.raw))continue;if(z.kind==="extension"){if(U.endsWith(`.${z.value}`))return!0;continue}if(z.kind==="segment"||z.kind==="suffix"){let G=z.value;if(U.includes(`/${G}/`)||U.endsWith(`/${G}`))return!0}}return!1}}function B(C,E){return c(E)(C)}async function I(C,E){let P=E.mode||"auto";if(P==="format"&&C.length===1&&!/[*?[\]{}()!]/.test(C[0]))try{let W=C[0],V=Xa(W)?W:Qa(process.cwd(),W);if(Ha(V).isFile()){let z=await u(E.config),G=Ya(V,"utf8"),J=f(G,z,V);if(E.check&&J!==G)return 1;if(E.write&&J!==G)Za(V,J,"utf8");return 0}}catch{}let{runLint:x}=await import("./chunk-tvt73e07.js");if(P==="lint")return x(C,E);if(P==="format"){let W={...E,fix:!0,dryRun:!!E.check,ext:E.ext,_formatOnly:!0};return x(C,W)}if(!(E.fix===!0||E.write===!0||E.check===!0))return x(C,E);let K={...E,fix:!0,dryRun:!!E.check,ext:E.ext};return x(C,K)}
|
|
92
|
+
export{s,F,S,r,t,f,k,y,p,b,i,D,n,R,o,v,g,a,j,h,T,L,A,O,_,N,e,m,u,d,w,l,c,B,I};
|
package/dist/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{s,S,f,k,y,p,b,
|
|
2
|
+
import{s,S,f,k,y,p,b,i,D,n,R,o,v,g,a,j,h,T,L,A,O,_,N,e,m,u,d,w,l,c,B,I}from"../chunk-by60fzz0.js";import{M,C,x,E,P}from"../chunk-13r0v0m9.js";export{R as ALWAYS_IGNORES,n as ENV,b as MAX_FIXER_PASSES,o as UNIVERSAL_IGNORES,O as blue,N as bold,h as colorize,e as colors,S as config,c as createIgnoreMatcher,D as createLimiter,s as defaultConfig,k as detectQuoteIssues,d as expandPatterns,x as fixText,f as formatCode,p as formatImports,v as getRuleSetting,i as glob,_ as gray,T as green,y as hasIndentIssue,w as isCodeFile,j as isRuleOff,C as lintText,u as loadConfigFromPath,m as mergeConfig,g as normalizeRuleSeverity,L as red,a as resolveRuleSeverity,I as run,M as runFormat,P as runLint,E as runLintProgrammatic,B as shouldIgnorePath,l as withAlwaysIgnores,A as yellow};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lex `text` once, returning every comment, string, template-body and regex
|
|
3
|
+
* region. See the module comment for what is handled.
|
|
4
|
+
*/
|
|
5
|
+
export declare function lexSource(text: string): LexResult;
|
|
6
|
+
/**
|
|
7
|
+
* `text` with the contents of the chosen region kinds replaced by spaces.
|
|
8
|
+
*
|
|
9
|
+
* Line breaks, delimiters and length are unchanged. With no options only
|
|
10
|
+
* comments are blanked, which is the common need: prose can then never be
|
|
11
|
+
* mistaken for code. A template's `${}` expressions are code and are never
|
|
12
|
+
* blanked.
|
|
13
|
+
*/
|
|
14
|
+
export declare function maskSource(text: string, options?: MaskOptions, lexed?: LexResult): string;
|
|
15
|
+
/** Every comment's contents blanked; everything else as written. */
|
|
16
|
+
export declare function maskComments(text: string): string;
|
|
17
|
+
/** Only code left: comments, strings, template bodies and regex patterns blanked. */
|
|
18
|
+
export declare function maskNonCode(text: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* For each line, whether it begins inside a template-literal body - between
|
|
21
|
+
* a backtick (or the `}` closing a `${}`) and the next backtick or `${`.
|
|
22
|
+
*
|
|
23
|
+
* A line that begins inside a `${}` expression is code, not template text.
|
|
24
|
+
*/
|
|
25
|
+
export declare function lineStartsInTemplate(text: string, lexed?: LexResult): boolean[];
|
|
26
|
+
export declare interface Region {
|
|
27
|
+
kind: RegionKind
|
|
28
|
+
start: number
|
|
29
|
+
end: number
|
|
30
|
+
}
|
|
31
|
+
export declare interface LexResult {
|
|
32
|
+
regions: Region[]
|
|
33
|
+
templates: Array<[number, number]>
|
|
34
|
+
}
|
|
35
|
+
export declare interface MaskOptions {
|
|
36
|
+
comments?: boolean
|
|
37
|
+
strings?: boolean
|
|
38
|
+
templates?: boolean
|
|
39
|
+
regex?: boolean
|
|
40
|
+
}
|
|
41
|
+
/*` or a quote still
|
|
42
|
+
* find them.
|
|
43
|
+
*/
|
|
44
|
+
export type RegionKind = 'comment' | 'string' | 'template' | 'regex';
|
|
@@ -9,23 +9,10 @@
|
|
|
9
9
|
* applying lint rules to them produces false positives that fixers will
|
|
10
10
|
* happily turn into broken runtime code.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* character on the logical statement: `/` after operators / punctuation
|
|
18
|
-
* starts a regex; `/` after an identifier or closing bracket is division.
|
|
12
|
+
* This was a scanner of its own, and it got two things wrong that the shared
|
|
13
|
+
* lexer gets right: a regex after a keyword (`return /it's/`) read as
|
|
14
|
+
* division, so its quote opened a string, and a quoted string did not end at
|
|
15
|
+
* the end of its line. Either one left the state inverted for the rest of the
|
|
16
|
+
* file, so the lines *outside* every template were the ones skipped.
|
|
19
17
|
*/
|
|
20
18
|
export declare function computeLineStartsInTemplate(text: string): boolean[];
|
|
21
|
-
/**
|
|
22
|
-
* On a single line, return [start, end] ranges of characters that fall
|
|
23
|
-
* inside a backtick-bounded template literal. If a backtick opens but
|
|
24
|
-
* doesn't close on this line, the range extends to the line's end (it's
|
|
25
|
-
* the first line of a multi-line template).
|
|
26
|
-
*
|
|
27
|
-
* Used by per-line fixers to refuse to rewrite identifiers that fall
|
|
28
|
-
* inside an embedded code blob whose other usages live in the same
|
|
29
|
-
* template string and aren't visible to the syntactic rename.
|
|
30
|
-
*/
|
|
31
|
-
export declare function backtickRangesOnLine(line: string): Array<[number, number]>;
|
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
import type { RuleModule } from '../../types';
|
|
2
|
+
/*`, `*\/` and
|
|
3
|
+
* `//` delimiters stay, so the scanners that look for them still work; the
|
|
4
|
+
* length and the line breaks are unchanged, so every reported column still
|
|
5
|
+
* points where it did; and a name that appears only in a comment is now
|
|
6
|
+
* correctly not a use, which is what the rule meant all along.
|
|
7
|
+
*
|
|
8
|
+
* Finding the comments is the shared lexer's job ({@link maskComments}): it
|
|
9
|
+
* is the one place that knows a regex ending in `\/` is not a line comment, a
|
|
10
|
+
* template nested in `${}` is not the end of its parent, and a backtick or an
|
|
11
|
+
* apostrophe inside a comment is prose. This used to be a scanner of its own
|
|
12
|
+
* here, and every rule that had one got a different subset of that wrong.
|
|
13
|
+
*/
|
|
2
14
|
export declare function maskCommentText(text: string): string;
|
|
3
15
|
export declare const noUnusedVarsRule: RuleModule;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { RuleModule } from '../../types';
|
|
2
2
|
// Heuristic: flag 'await' only when at top level (brace depth 0),
|
|
3
|
-
// outside of comments/strings/templates, and not part of 'for await'.
|
|
3
|
+
// outside of comments/strings/templates/regexes, and not part of 'for await'.
|
|
4
|
+
//
|
|
5
|
+
// The scan runs over the shared lexer's code-only view of the file. It used to
|
|
6
|
+
// track strings and comments itself, without regex literals: the `/*` inside
|
|
7
|
+
// `/\/?\*\*\/*\*\*$/` opened a block comment, and from there a backtick or an
|
|
8
|
+
// apostrophe in a real comment further down decided the brace depth - so an
|
|
9
|
+
// `await` inside a function was reported as top-level, or a real one missed.
|
|
4
10
|
export declare const noTopLevelAwaitRule: RuleModule;
|
package/package.json
CHANGED
package/dist/chunk-nke9r0j5.js
DELETED
package/dist/chunk-p5zbyxq6.js
DELETED
package/dist/chunk-zzacmw52.js
DELETED