pickier 0.1.71 → 0.1.73
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 +2 -2
- package/dist/{chunk-c82emw32.js → chunk-0rxvmb2a.js} +2 -2
- package/dist/chunk-2ja6xfzf.js +2 -0
- package/dist/chunk-3d4jgaj2.js +2 -0
- package/dist/{chunk-wx92kdf9.js → chunk-513cs23x.js} +5 -5
- package/dist/chunk-7ydmmwjq.js +2 -0
- package/dist/chunk-96vhwdwy.js +3 -0
- package/dist/chunk-d1qeak2x.js +3 -0
- package/dist/chunk-dnn0da5m.js +124 -0
- package/dist/chunk-fn87cp4c.js +2 -0
- package/dist/{chunk-5c026tb4.js → chunk-kn5s3eh8.js} +1 -1
- package/dist/{chunk-8m82hwdv.js → chunk-qq03kpe0.js} +2 -2
- package/dist/{chunk-99jrtc0c.js → chunk-ra9jn7j5.js} +2 -2
- package/dist/chunk-rx0b7k57.js +29 -0
- package/dist/{chunk-qjzzx1m2.js → chunk-t0w79bj5.js} +25 -25
- package/dist/chunk-wz6hqyhd.js +2 -0
- package/dist/native/darwin-arm64/pickier-native +0 -0
- package/dist/native/darwin-x64/pickier-native +0 -0
- package/dist/native/linux-arm64/pickier-native +0 -0
- package/dist/native/linux-x64/pickier-native +0 -0
- package/dist/native/win32-arm64/pickier-native.exe +0 -0
- package/dist/native/win32-x64/pickier-native.exe +0 -0
- package/dist/src/index.js +1 -1
- package/dist/src/lint-worker.js +1 -1
- package/dist/src/parallel.d.ts +4 -0
- package/dist/src/rules/general/prefer-template.d.ts +12 -0
- package/package.json +1 -1
- package/dist/chunk-0b2yx624.js +0 -3
- package/dist/chunk-1jtr81zg.js +0 -25
- package/dist/chunk-3h389bm4.js +0 -2
- package/dist/chunk-6vptsmta.js +0 -128
- package/dist/chunk-gpfjzx90.js +0 -2
- package/dist/chunk-jerw13hn.js +0 -2
- package/dist/chunk-m9ym248d.js +0 -2
- package/dist/chunk-vrbz87a8.js +0 -3
- package/dist/chunk-xgm5reee.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{s}from"./chunk-
|
|
2
|
+
import{s}from"./chunk-qq03kpe0.js";import{dirname as ne,resolve as ue}from"path";function c(e){try{let r=JSON.parse(e);if(typeof r!=="object"||r===null||Array.isArray(r))return null;return r}catch{return null}}function le(e,r){let t=e.split(`
|
|
3
3
|
`),o=1,n=0;for(let u of r){let i=new RegExp(`"${ce(u)}"\\s*:`);for(let l=n;l<t.length;l++)if(i.test(t[l])){o=l+1,n=l+1;break}}return o}function k(e){return ne(e)}function b(e,r){return ue(e,r)}function f(e){let r="pkg";for(let t of e)if(/^\d+$/.test(t))r+=`[${t}]`;else if(!/^[a-z_$][a-z0-9_$]*$/i.test(t))r+=`["${t}"]`;else r+=`.${t}`;return r}function d(e,r){if(e.publishConfig?.[r]!==void 0)return[e.publishConfig[r],["publishConfig",r]];return[e[r],[r]]}var ae=new RegExp(`(?:[\\s;]|^)(?:import[\\w,{}\\s*]*from|import\\s*['"*{]|export\\b\\s*(?:[*{]|default|type|function|const|var|let|async function)|import\\.meta\\b)`,"m"),pe=new RegExp("(?:[\\s;]|^)(?:module.exports\\b|exports\\.\\w|require\\s*\\(|global\\.\\w|Object\\.(?:defineProperty|defineProperties|assign)\\s*\\(\\s*exports\\b)","m");function I(e){let r=de(e),t=ae.test(r),o=pe.test(r);if(t&&o)return"mixed";if(t)return"ESM";if(o)return"CJS";return"unknown"}function H(e,r){if(e.endsWith(".mjs"))return"ESM";if(e.endsWith(".cjs"))return"CJS";return r==="module"?"ESM":"CJS"}function X(e){if(e==="ESM")return".mjs";if(e==="CJS")return".cjs";return".js"}function Y(e){return e===".mjs"||e===".cjs"}function P(e){return e.endsWith(".js")||e.endsWith(".mjs")||e.endsWith(".cjs")}function G(e){return/^#!\s*\//.test(e)}function de(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*/g,"")}function x(e,r,t,o){E(e,r,t,o)}function E(e,r,t,o){if(typeof e==="string"){o(e,{path:r,isImports:t});return}if(Array.isArray(e)){o(e,{path:r,isImports:t});for(let n=0;n<e.length;n++)E(e[n],r.concat(String(n)),t,o);return}if(e!==null&&typeof e==="object"){let n=Object.keys(e);o(e,{path:r,isImports:t},n);for(let u of n)E(e[u],r.concat(u),t,o)}}function p(e,r,t,o,n,u,i){return{filePath:e,line:le(r,t),column:1,ruleId:o,message:n,severity:u,...i&&{help:i}}}function ce(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var L={meta:{docs:"Disallow deprecated jsnext:main and jsnext fields",recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[];if(t["jsnext:main"]!=null)o.push(p(r.filePath,e,["jsnext:main"],"publint/deprecated-field-jsnext",'pkg["jsnext:main"] is deprecated. pkg.module should be used instead.',"warning",'The jsnext:main field is no longer recognized by modern bundlers. Use "module" instead.'));if(t.jsnext!=null)o.push(p(r.filePath,e,["jsnext"],"publint/deprecated-field-jsnext","pkg.jsnext is deprecated. pkg.module should be used instead.","warning",'The jsnext field is no longer recognized by modern bundlers. Use "module" instead.'));return o}};var M={meta:{docs:'Ensure "default" condition is last in exports objects',recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[],[n,u]=d(t,"exports");if(n==null)return[];return x(n,u,!1,(i,l,a)=>{if(!a||typeof i!=="object"||Array.isArray(i))return;if(!("default"in i))return;if(a[a.length-1]!=="default")o.push(p(r.filePath,e,l.path.concat("default"),"publint/exports-default-should-be-last",`${f(l.path.concat("default"))} should be the last condition in the object so it doesn't take precedence over the keys following it.`,"error",'Conditions are resolved in order. "default" acts as a fallback and should come last.'))}),o}};var S={meta:{docs:"Warn against using fallback arrays in exports",recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[],[n,u]=d(t,"exports");if(n==null)return[];return x(n,u,!1,(i,l)=>{if(!Array.isArray(i))return;o.push(p(r.filePath,e,l.path,"publint/exports-fallback-array-use",`${f(l.path)} uses fallback arrays which is not recommended. It works differently in some tools and may face inconsistent behaviors.`,"warning","Fallback arrays pick the first parseable value and have no practical use case in Node.js currently."))}),o}};var F={meta:{docs:"Ensure exports has a root entrypoint when main/module exist",recommended:!0},check(e,r){let t=c(e);if(!t)return[];let[o]=d(t,"main"),[n]=d(t,"module"),[u,i]=d(t,"exports");if(o==null&&n==null||u==null)return[];if(typeof u!=="object"||Array.isArray(u))return[];let l=Object.keys(u);if(l.length===0)return[];if(!l[0]?.startsWith("."))return[];if(l.includes("."))return[];let m=[];if(o)m.push("main");if(n)m.push("module");return[p(r.filePath,e,i,"publint/exports-missing-root-entrypoint",`${f(i)} is missing the root entrypoint export, which is defined in pkg.${m[0]}. Environments that support "exports" will ignore pkg.${m[0]} as "exports" takes the highest priority.`,"warning",`Add ${f(i.concat("."))} to ensure the root entrypoint is accessible.`)]}};var w={meta:{docs:'Ensure "module" condition precedes "require" in exports',recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[],[n,u]=d(t,"exports");if(n==null)return[];return x(n,u,!1,(i,l,a)=>{if(!a||typeof i!=="object"||Array.isArray(i))return;if(!("module"in i)||!("require"in i))return;if(a.indexOf("module")>a.indexOf("require"))o.push(p(r.filePath,e,l.path.concat("module"),"publint/exports-module-should-precede-require",`${f(l.path.concat("module"))} should come before the "require" condition so it can take precedence when used by a bundler.`,"error",'Bundlers prioritize conditions by order. "module" should precede "require" to ensure ESM is preferred.'))}),o}};var j={meta:{docs:'Ensure "types" condition is first in exports objects',recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[],[n,u]=d(t,"exports");if(n==null)return[];return x(n,u,!1,(i,l,a)=>{if(!a||typeof i!=="object"||Array.isArray(i))return;if(!("types"in i))return;let m=a.indexOf("types");if(m===0)return;if(a.slice(0,m).filter((g)=>{if(g.startsWith("types"))return!1;if(typeof i[g]==="object"&&i[g]!==null&&Q(i[g],"types"))return!1;return!0}).length>0)o.push(p(r.filePath,e,l.path.concat("types"),"publint/exports-types-should-be-first",`${f(l.path.concat("types"))} should be the first condition in the object so it can be resolved by TypeScript.`,"error",'TypeScript resolves conditions in order. The "types" condition must come first to ensure correct type resolution.'))}),o}};function Q(e,r){for(let t in e){if(t===r)return!0;if(typeof e[t]==="object"&&e[t]!==null&&Q(e[t],r))return!0}return!1}var T={meta:{docs:'Ensure exports values start with "./"',recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[],[n,u]=d(t,"exports");if(n==null)return[];return x(n,u,!1,(i,l)=>{if(typeof i!=="string")return;if(i.startsWith("./"))return;let a=`./${i.replace(/^[/]+/,"")}`;o.push(p(r.filePath,e,l.path,"publint/exports-value-invalid",`${f(l.path)} is "${i}" which is invalid as it does not start with "./". Use "${a}" instead.`,"error",'All exports values must be relative paths starting with "./".'))}),o}};var fe=[{field:"main",expectTypes:["string"]},{field:"module",expectTypes:["string"]},{field:"types",expectTypes:["string"]},{field:"typings",expectTypes:["string"]},{field:"browser",expectTypes:["string","object"]},{field:"bin",expectTypes:["string","object"]},{field:"exports",expectTypes:["string","object"]},{field:"imports",expectTypes:["object"]},{field:"name",expectTypes:["string"]},{field:"version",expectTypes:["string"]},{field:"description",expectTypes:["string"]},{field:"license",expectTypes:["string"]}],J={meta:{docs:"Ensure package.json fields have correct value types",recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[];for(let{field:n,expectTypes:u}of fe){let[i,l]=d(t,n);if(i==null)continue;let a=typeof i;if(!u.includes(a)){let m=u.length===1?u[0]:`${u.slice(0,-1).join(", ")} or ${u[u.length-1]}`;o.push(p(r.filePath,e,l,"publint/field-invalid-value-type",`${f(l)} has an invalid ${a} type. Expected a ${m} type instead.`,"error",`The "${n}" field must be of type ${m}.`))}}return o}};var V={meta:{docs:"Suggest adding exports when module field is present",recommended:!0},check(e,r){let t=c(e);if(!t)return[];let[o,n]=d(t,"module"),[u]=d(t,"exports");if(o!=null&&u==null)return[p(r.filePath,e,n,"publint/has-module-but-no-exports","pkg.module is used to output ESM, but pkg.exports is not defined. As Node.js doesn't read pkg.module, the ESM output may be skipped. Consider adding pkg.exports to export the ESM output.","warning",'Node.js only reads "exports" for module resolution. Without it, the ESM entry point in "module" is ignored by Node.js.')];return[]}};var A={meta:{docs:'Ensure "default" condition is last in imports objects',recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[],[n,u]=d(t,"imports");if(n==null||typeof n!=="object")return[];return x(n,u,!0,(i,l,a)=>{if(!a||typeof i!=="object"||Array.isArray(i))return;if(!("default"in i))return;if(a[a.length-1]!=="default")o.push(p(r.filePath,e,l.path.concat("default"),"publint/imports-default-should-be-last",`${f(l.path.concat("default"))} should be the last condition in the object so it doesn't take precedence over the keys following it.`,"error",'Conditions are resolved in order. "default" acts as a fallback and should come last.'))}),o}};var D={meta:{docs:'Ensure imports keys start with "#"',recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[],[n,u]=d(t,"imports");if(n==null||typeof n!=="object"||Array.isArray(n))return[];for(let i of Object.keys(n))if(!i.startsWith("#")){let l=`#${i.replace(/^[/]+/,"")}`,a=u.concat(i);o.push(p(r.filePath,e,a,"publint/imports-key-invalid",`${f(a)} is invalid as the imports key does not start with "#". Use "${l}" instead.`,"error",'All imports keys must start with "#" to distinguish them from package specifiers.'))}return o}};var O={meta:{docs:'Ensure "module" condition precedes "require" in imports',recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[],[n,u]=d(t,"imports");if(n==null||typeof n!=="object")return[];return x(n,u,!0,(i,l,a)=>{if(!a||typeof i!=="object"||Array.isArray(i))return;if(!("module"in i)||!("require"in i))return;if(a.indexOf("module")>a.indexOf("require"))o.push(p(r.filePath,e,l.path.concat("module"),"publint/imports-module-should-precede-require",`${f(l.path.concat("module"))} should come before the "require" condition so it can take precedence when used by a bundler.`,"error",'Bundlers prioritize conditions by order. "module" should precede "require" to ensure ESM is preferred.'))}),o}};var W={meta:{docs:'Ensure imports values start with "./"',recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[],[n,u]=d(t,"imports");if(n==null||typeof n!=="object")return[];return x(n,u,!0,(i,l)=>{if(typeof i!=="string")return;if(!i.startsWith("."))return;if(i.startsWith("./"))return;let a=`./${i.replace(/^[/]+/,"")}`;o.push(p(r.filePath,e,l.path,"publint/imports-value-invalid",`${f(l.path)} is "${i}" which is invalid as it does not start with "./". Use "${a}" instead.`,"error",'Relative imports values must start with "./".'))}),o}};var v={meta:{docs:"Disallow local file references in dependencies",recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[],n=["dependencies","optionalDependencies","peerDependencies"];for(let u of n){let i=t[u];if(!i||typeof i!=="object")continue;for(let l of Object.keys(i)){let a=i[l];if(typeof a==="string"&&(a.startsWith("file:")||a.startsWith("link:")))o.push(p(r.filePath,e,[u,l],"publint/local-dependency",`The "${l}" dependency references "${a}" that will likely not work when installed by end-users.`,"error","Local file references (file: or link:) are not portable and will fail for consumers of the package."))}}return o}};var N={meta:{docs:'Suggest specifying the "type" field in package.json',recommended:!0},check(e,r){let t=c(e);if(!t)return[];if(t.type==null)return[p(r.filePath,e,["name"],"publint/use-type",'The package does not specify the "type" field. Node.js may attempt to detect the package type causing a small performance hit. Consider adding "type": "commonjs" or "type": "module".',"warning",'Adding "type" helps Node.js resolve module format without detection overhead.')];return[]}};import{existsSync as me,readFileSync as he}from"fs";var B={meta:{docs:"Ensure bin files have a shebang for executability",recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[],n=k(r.filePath),[u,i]=d(t,"bin");if(u==null)return[];if(typeof u==="string")Z(u,i,n,o,r.filePath,e);else if(typeof u==="object"){for(let l of Object.keys(u))if(typeof u[l]==="string")Z(u[l],i.concat(l),n,o,r.filePath,e)}return o}};function Z(e,r,t,o,n,u){let i=b(t,e);if(!me(i))return;if(!P(e))return;let l;try{l=he(i,"utf8")}catch{return}if(!G(l))o.push(p(n,u,r,"publint/bin-file-not-executable",`${f(r)} is "${e}" but the file is not executable. It should start with a shebang, e.g. #!/usr/bin/env node.`,"error","Bin files must start with a shebang (e.g. #!/usr/bin/env node) to be executable."))}import{existsSync as ee,readFileSync as te}from"fs";var q={meta:{docs:'Ensure files under "module" condition in exports are ESM',recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[],n=k(r.filePath),[u,i]=d(t,"exports");if(u==null)return[];x(u,i,!1,(m,h)=>{if(typeof m!=="string")return;if(!h.path.includes("module"))return;if(!m.startsWith("./")&&!m.startsWith("../"))return;if(m.includes("*"))return;let g=b(n,m);if(!ee(g))return;if(!P(m))return;let y;try{y=te(g,"utf8")}catch{return}if(I(y)==="CJS")o.push(p(r.filePath,e,h.path,"publint/exports-module-should-be-esm",`${f(h.path)} should be ESM, but the code is written in CJS.`,"error",'The "module" condition is only used by bundlers and must contain ESM code.'))});let[l,a]=d(t,"imports");if(l!=null&&typeof l==="object")x(l,a,!0,(m,h)=>{if(typeof m!=="string")return;if(!h.path.includes("module"))return;if(!m.startsWith("./"))return;if(m.includes("*"))return;let g=b(n,m);if(!ee(g))return;if(!P(m))return;let y;try{y=te(g,"utf8")}catch{return}if(I(y)==="CJS")o.push(p(r.filePath,e,h.path,"publint/exports-module-should-be-esm",`${f(h.path)} should be ESM, but the code is written in CJS.`,"error",'The "module" condition is only used by bundlers and must contain ESM code.'))});return o}};import{existsSync as R}from"fs";import{dirname as ge,isAbsolute as xe,resolve as ye}from"path";function _(e,r){let t=r;while(t.startsWith("./"))t=t.slice(2);let o=t.split("/")[0];if(!o||o===".."||o.startsWith("."))return!1;let n=xe(r)?ge(r).split("/")[0]||"/":ye(e,o);return!R(n)}var U={meta:{docs:"Ensure files referenced in package.json exist",recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[],n=k(r.filePath),u=["main","module","types","typings","unpkg","jsdelivr"];for(let h of u){let[g,y]=d(t,h);if(g==null||typeof g!=="string")continue;if(_(n,g))continue;let C=b(n,g);if(!se(C))o.push(p(r.filePath,e,y,"publint/file-does-not-exist",`${f(y)} is "${g}" but the file does not exist.`,"error","The referenced file path cannot be found. Check the path for typos."))}let[i,l]=d(t,"bin");if(i!=null){if(typeof i==="string")re(i,l,o,r.filePath,e,n);else if(typeof i==="object"){for(let h of Object.keys(i))if(typeof i[h]==="string")re(i[h],l.concat(h),o,r.filePath,e,n)}}let[a,m]=d(t,"exports");if(a!=null)x(a,m,!1,(h,g)=>{if(typeof h!=="string")return;if(!h.startsWith("./")&&!h.startsWith("../"))return;if(h.includes("*"))return;if(_(n,h))return;let y=b(n,h);if(!R(y))o.push(p(r.filePath,e,g.path,"publint/file-does-not-exist",`${f(g.path)} is "${h}" but the file does not exist.`,"error","The referenced file path cannot be found. Check the path for typos."))});return o}};function re(e,r,t,o,n,u){if(_(u,e))return;let i=b(u,e);if(!se(i))t.push(p(o,n,r,"publint/file-does-not-exist",`${f(r)} is "${e}" but the file does not exist.`,"error","The referenced file path cannot be found. Check the path for typos."))}function se(e){if(R(e))return!0;if(R(`${e}.js`))return!0;if(R(`${e}/index.js`))return!0;return!1}import{existsSync as be,readFileSync as ke}from"fs";import{extname as Pe}from"path";var z={meta:{docs:"Ensure file code format matches its extension and package type",recommended:!0},check(e,r){let t=c(e);if(!t)return[];let o=[],n=k(r.filePath),u=t.type,[i,l]=d(t,"main");if(i!=null&&typeof i==="string")oe(i,l,n,u,o,r.filePath,e);let[a,m]=d(t,"exports");if(a!=null)x(a,m,!1,(h,g)=>{if(typeof h!=="string")return;if(!h.startsWith("./")&&!h.startsWith("../"))return;if(h.includes("*"))return;if(g.path.includes("browser"))return;oe(h,g.path,n,u,o,r.filePath,e)});return o}};function oe(e,r,t,o,n,u,i){let l=b(t,e);if(!be(l))return;if(!P(e))return;let a;try{a=ke(l,"utf8")}catch{return}let m=I(a);if(m==="unknown"||m==="mixed")return;let h=H(l,o);if(m===h)return;let g=Pe(l),y=X(m),ie=(Y(g)?"FILE_INVALID_EXPLICIT_FORMAT":"FILE_INVALID_FORMAT")==="FILE_INVALID_EXPLICIT_FORMAT"?`${f(r)} is "${e}" and ends with the ${g} extension, but the code is written in ${m}. Consider using the ${y} extension.`:`${f(r)} is "${e}" and is written in ${m}, but is interpreted as ${h}. Consider using the ${y} extension.`;n.push(p(u,i,r,"publint/file-invalid-format",ie,"warning",`The file's code format (${m}) doesn't match the expected format (${h}) based on its extension and package type.`))}import{existsSync as Ie,readFileSync as Re}from"fs";var K={meta:{docs:'Ensure the "module" field points to an ESM file',recommended:!0},check(e,r){let t=c(e);if(!t)return[];let[o,n]=d(t,"module");if(o==null||typeof o!=="string")return[];let u=k(r.filePath),i=b(u,o);if(!Ie(i))return[];if(!P(o))return[];let l;try{l=Re(i,"utf8")}catch{return[]}if(I(l)==="CJS")return[p(r.filePath,e,n,"publint/module-should-be-esm",`${f(n)} should be ESM, but the code is written in CJS.`,"error",'The "module" field is intended for ESM output used by bundlers. It should point to an ESM file.')];return[]}};var Bt={name:"publint",rules:{"use-type":s(N),"local-dependency":s(v),"deprecated-field-jsnext":s(L),"has-module-but-no-exports":s(V),"field-invalid-value-type":s(J),"exports-types-should-be-first":s(j),"exports-default-should-be-last":s(M),"exports-module-should-precede-require":s(w),"exports-value-invalid":s(T),"exports-missing-root-entrypoint":s(F),"exports-fallback-array-use":s(S),"imports-key-invalid":s(D),"imports-value-invalid":s(W),"imports-default-should-be-last":s(A),"imports-module-should-precede-require":s(O),"file-does-not-exist":s(U),"file-invalid-format":s(z),"module-should-be-esm":s(K),"bin-file-not-executable":s(B),"exports-module-should-be-esm":s(q)}};export{Bt as publintPlugin};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var u=/\.(?:ts|js|tsx|jsx|mts|mjs|cts|cjs)$/;function e(r){return{meta:r.meta,check:(i,t)=>{if(!u.test(t.filePath))return[];return r.check(i,t)},fix:r.fix?(i,t)=>{if(!u.test(t.filePath))return i;return r.fix(i,t)}:void 0}}var f=/\.(?:md|mdx|markdown)$/i;function
|
|
3
|
-
export{e,
|
|
2
|
+
var u=/\.(?:ts|js|tsx|jsx|mts|mjs|cts|cjs)$/;function e(r){return{meta:r.meta,check:(i,t)=>{if(!u.test(t.filePath))return[];return r.check(i,t)},fix:r.fix?(i,t)=>{if(!u.test(t.filePath))return i;return r.fix(i,t)}:void 0}}var f=/\.(?:md|mdx|markdown)$/i;function k(r){return{meta:r.meta,check:(i,t)=>{if(f.test(t.filePath))return[];return r.check(i,t)},fix:r.fix?(i,t)=>{if(f.test(t.filePath))return i;return r.fix(i,t)}:void 0}}var l=/\.(?:sh|bash|zsh|ksh|dash)$/,a=/^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/;function n(r){return{meta:r.meta,check:(i,t)=>{if(!l.test(t.filePath)&&!a.test(i))return[];return r.check(i,t)},fix:r.fix?(i,t)=>{if(!l.test(t.filePath)&&!a.test(i))return i;return r.fix(i,t)}:void 0}}var o=/(?:^|[/\\])package\.json$/;function s(r){return{meta:r.meta,check:(i,t)=>{if(!o.test(t.filePath))return[];return r.check(i,t)},fix:r.fix?(i,t)=>{if(!o.test(t.filePath))return i;return r.fix(i,t)}:void 0}}
|
|
3
|
+
export{e,k,n,s};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
3
|
-
export{
|
|
2
|
+
var oe="pickier",ae="module",F="0.1.73",le="Format, lint and more in a fraction of seconds.",ce="Chris Breuer <chris@stacksjs.org>",ue="MIT",fe="https://github.com/pickier/pickier#readme",me={type:"git",url:"git+https://github.com/pickier/pickier.git"},he={url:"https://github.com/pickier/pickier/issues"},de=["pickier","linter","formatter","bun","fast"],pe={".":{types:"./dist/src/index.d.ts",import:"./dist/src/index.js"},"./*":{import:"./dist/*"}},ge="./dist/src/index.js",ye="./dist/src/index.d.ts",be={pickier:"./dist/bin/cli.js"},we=["README.md","dist"],xe={build:"bun --bun build.ts","build:bin":"bun --bun build.ts && bun run compile","build:native":"bun scripts/build-native.ts",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 scripts/build-native.ts --required && 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"},ke={"@stacksjs/clarity":"^0.3.24","@stacksjs/clapp":"^0.2.3"},Re={"@stacksjs/ts-spell-check":"^0.1.0"},$e={bunfig:"^0.15.13"},ve={name:oe,type:ae,version:F,description:le,author:ce,license:ue,homepage:fe,repository:me,bugs:he,keywords:de,exports:pe,module:ge,types:ye,bin:be,files:we,scripts:xe,dependencies:ke,optionalDependencies:Re,devDependencies:$e};
|
|
3
|
+
export{oe,ae,F,le,ce,ue,fe,me,he,de,pe,ge,ye,be,we,xe,ke,Re,$e,ve};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{i,b}from"./chunk-0rxvmb2a.js";import{readdirSync as fn,readFileSync as un}from"fs";import{homedir as dn}from"os";import{join as we}from"path";var je=["code-style","lint"],l={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},pn=new Set(["PICKIER_CONCURRENCY","PICKIER_DIAGNOSTICS","PICKIER_FAIL_ON_WARNINGS","PICKIER_NO_AUTO_CONFIG","PICKIER_RULE_TIMEOUT_MS","PICKIER_TIMEOUT_MS","PICKIER_TRACE","PICKIER_WORKERS"]),mn=/^\.?(?:pickier|code-style|lint|config)(?:\.(?:pickier|code-style|lint|config))*\.(?:ts|js|mjs|cjs|mts|cts|json|jsonc)$/i,gn=new Set(["pickier",...je]);function hn(e){for(let k of Object.keys(process.env))if(k.startsWith("PICKIER_")&&!pn.has(k))return!0;let a=dn(),n=[e,we(e,"config"),we(e,".config"),we(a,".config","pickier"),we(a,".config"),a];for(let k of n){let R;try{R=fn(k,{withFileTypes:!0})}catch{continue}for(let v of R){if(v.isDirectory())continue;if(mn.test(v.name))return!0}}let s;try{s=un(we(e,"package.json"),"utf8")}catch{return!1}try{let k=JSON.parse(s);return k!==null&&typeof k==="object"&&Object.keys(k).some((R)=>gn.has(R))}catch{return!0}}var Ee=null;async function ne(){if(!Ee)if(!hn(process.cwd()))Ee=l;else{let{loadConfig:e}=await import("./chunk-t0w79bj5.js");Ee=await e({name:"pickier",alias:[...je],defaultConfig:l})}return Ee}var z=l;var yn=new Set(["return","typeof","instanceof","in","of","new","delete","void","case","do","else","yield","await","throw"]);function ve(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95||e===36||e>=160}function ke(e){return e===`
|
|
3
|
+
`||e==="\r"||e==="\u2028"||e==="\u2029"}function wn(e,a){let n=a+1,s=!1;while(n<e.length){let k=e[n];if(ke(k))return-1;if(k==="\\"){if(ke(e[n+1]))return-1;n+=2;continue}if(s){if(k==="]")s=!1}else if(k==="[")s=!0;else if(k==="/"){n+=1;while(n<e.length&&ve(e.charCodeAt(n)))n+=1;return n}n+=1}return-1}var be=null;function g(e){if(be!==null&&be.text===e)return be.result;let a=bn(e);return be={text:e,result:a},a}function bn(e){let a=[],n=[],s=e.length,k=[],R=-1,v="operator",A=0;if(e.startsWith("#!")){let F=2;while(F<s&&!ke(e[F]))F+=1;a.push({kind:"comment",start:2,end:F}),A=F}let W=(F)=>{if(k.length===0)R=F;k.push(-1)},K=()=>{let F=A;while(A<s){let B=e[A];if(B==="\\"){A+=2;continue}if(B==="`"){if(a.push({kind:"template",start:F,end:A}),k.pop(),k.length===0)n.push([R,A]);A+=1,v="value";return}if(B==="$"&&e[A+1]==="{"){a.push({kind:"template",start:F,end:A}),k.push(0),A+=2,v="operator";return}A+=1}A=Math.min(A,s),a.push({kind:"template",start:F,end:A}),k.length=0,n.push([R,s])};while(A<s){if(k.length>0&&k[k.length-1]===-1){K();continue}let F=e[A],B=e[A+1];if(F==="/"&&B==="/"){let U=A+2;while(U<s&&!ke(e[U]))U+=1;a.push({kind:"comment",start:A+2,end:U}),A=U;continue}if(F==="/"&&B==="*"){let U=e.indexOf("*/",A+2),P=U<0?s:U;a.push({kind:"comment",start:A+2,end:P}),A=U<0?s:U+2;continue}if(F==="'"||F==='"'){let U=A+1,P=U;while(P<s){let V=e[P];if(V==="\\"){P+=e[P+1]==="\r"&&e[P+2]===`
|
|
4
|
+
`?3:2;continue}if(V===F||ke(V))break;P+=1}P=Math.min(P,s),a.push({kind:"string",start:U,end:P}),A=e[P]===F?P+1:P,v="value";continue}if(F==="`"){W(A),A+=1;continue}if(F==="/"){let U=v==="operator"?wn(e,A):-1;if(U>0){let P=U;while(P>A&&e[P-1]!=="/")P-=1;a.push({kind:"regex",start:A+1,end:P-1}),A=U,v="value";continue}A+=1,v="operator";continue}if(k.length>0){if(F==="{"){k[k.length-1]+=1,A+=1,v="operator";continue}if(F==="}"){let U=k[k.length-1];if(U>0)k[k.length-1]=U-1,v="operator";else k.pop();A+=1;continue}}if(ve(e.charCodeAt(A))){let U=A+1;while(U<s&&ve(e.charCodeAt(U)))U+=1;let P=e.slice(A,U);v=yn.has(P)?"operator":"value",A=U;continue}if(F===")"||F==="]")v="value";else if(!(F===" "||F>="\t"&&F<="\r"))v="operator";A+=1}return{regions:a,templates:n}}function I(e,a={comments:!0},n=g(e)){let s=new Set;if(a.comments)s.add("comment");if(a.strings)s.add("string");if(a.templates)s.add("template");if(a.regex)s.add("regex");if(s.size===0)return e;let k=(a.comments?1:0)|(a.strings?2:0)|(a.templates?4:0)|(a.regex?8:0),R=Ae.get(k);if(R!==void 0&&R.text===e)return R.masked;let v=kn(e,s,n);return Ae.set(k,{text:e,masked:v}),v}var Ae=new Map;function q(){be=null,Ae.clear()}function kn(e,a,n){let s="",k=0;for(let R of n.regions){if(!a.has(R.kind))continue;let v=Math.max(R.start,k),A=Math.min(R.end,e.length);if(v>=A)continue;s+=e.slice(k,v)+xn(e.slice(v,A)),k=A}return k===0?e:s+e.slice(k)}var Cn=/[^\n\r\u2028\u2029]/g;function xn(e){return e.replace(Cn," ")}function G(e){return I(e,{comments:!0})}function c(e){return I(e,{comments:!0,strings:!0,templates:!0,regex:!0})}function S(e,a=g(e)){let n=[0];for(let v=e.indexOf(`
|
|
5
|
+
`);v!==-1;v=e.indexOf(`
|
|
6
|
+
`,v+1))n.push(v+1);let s=Array.from({length:n.length}).fill(!1),k=a.regions.filter((v)=>v.kind==="template"),R=0;for(let v=0;v<n.length;v+=1){let A=n[v];while(R<k.length&&k[R].end<A)R+=1;let W=k[R];s[v]=W!==void 0&&W.start<=A&&A<=W.end&&A>0}return s}var En=new Set([".ts",".js"]),Sn=new Set([".json",".jsonc"]),Rn=new Set([".yaml",".yml"]),_n=new Set([".sh",".bash",".zsh",".ksh",".dash"]),In=new Set([".md",".mdx",".markdown"]),On=/^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/;var vn=/^[}\])]/,An=/\s*\/\/.*$/,Tn=/^(?:if|else\s+if|for|while)\s*\(/,Nn=/^(?:if|else|for|while|do)\b/,Pn=/^(?:\.[\w$[]|\?[\s.:]|:\s|&&|\|\|)/;function $n(e){let a=e.charCodeAt(0);if(a!==105&&a!==101&&a!==102&&a!==119&&a!==100)return!1;let n=Tn.exec(e);if(!n)return/^(?:else|do)\s*$/.test(e);let s=0,k=null;for(let R=n[0].length-1;R<e.length;R++){let v=e[R];if(k){if(v==="\\"){R++;continue}if(v===k)k=null;continue}if(v==="'"||v==='"'||v==="`"){k=v;continue}if(v==="(")s++;else if(v===")"){if(s--,s===0)return e.slice(R+1).trim().length===0}}return!1}var Mn=/^\s*for\s*\(/,Ln=new RegExp("^\\s*;\\s*$"),jn=new RegExp(";{2,}\\s*$"),Dn=/([\w)])\{/g,Fn=/\{(return|if|for|while|switch|const|let|var|function)\b/g,Wn=/,(\S)/g,Un=/(?<![=!<>+\-*/%&|^?])=(?![=><])/g,Gn=/(\w)\+(\w)/g,Kn=/(\w)-(\w)/g,Bn=/(\w)\*(\w)/g,zn=/(\w)\/(\w)/g,Hn=new RegExp("(?<=\\S);([^\\s;])","g"),Jn=/([\w)\]])<(\d)/g,qn=/([\w)\]])>(\d)/g,De=/\s{2,}/g,Fe=/^\s*$/,Yn=/^\s*\/\//,We=/^\s*\/\*/,Xn=/^\s*import\b/,Ue=/\bfrom\s*['"][^'"]+['"]|^\s*import\s+['"][^'"]+['"]/,Qn=/package\.json$/i,Vn=/[jt]sconfig(?:\..+)?\.json$/i,ye=/[ \t]+$/,Zn=/^\n+/;function xe(e){let a=e.lastIndexOf(".");return a>=0?e.slice(a):""}function Se(e){return En.has(xe(e))}function et(e){return Sn.has(xe(e))}function nt(e){return Rn.has(xe(e))}function tt(e){return In.has(xe(e))}function rt(e){return _n.has(xe(e))}function st(e,a){return rt(e)||On.test(a)}function ot(e,a){let n=e.split(`
|
|
7
|
+
`),s=n.length,k=Array(s),R=a.format.indent,v=a.format.indentStyle==="tabs",A=0,W=new b,K=!1,F="",B=!1,U=0;for(let P=0;P<s;P++){let V=n[P];if(V.length===0||/^\s*$/.test(V)){k[P]="";continue}if(K){if(k[P]=V,V.trim()===F)K=!1,F="";continue}let oe=i(V);if(oe)K=!0,F=oe;let le=0;while(le<V.length&&(V.charCodeAt(le)===32||V.charCodeAt(le)===9))le++;let H=V.slice(le).trimEnd();if(H.startsWith("#")&&P>0){let D=v?"\t".repeat(A):" ".repeat(A*R);k[P]=D+H;continue}let fe=W.read(H);if(/^case\b/.test(H)&&/\bin\s*$/.test(H))U++,B=!0;if(/^esac\b/.test(H)){if(U=Math.max(0,U-1),U===0)B=!1}let me=B&&/\)\s*$/.test(H)&&!/\$\(/.test(H)&&!/^\s*\(/.test(H)&&!H.startsWith("#"),ce=/^;[;&]\s*$/.test(H),ge=/^(?:fi|done|esac|elif|else)\b/.test(H)||/^\}/.test(H);if(!fe.continuation&&ge)A=Math.max(0,A-1);if(!fe.continuation&&ce)A=Math.max(0,A-1);let he=A+Number(fe.continuation),de=v?"\t".repeat(he):" ".repeat(he*R);if(k[P]=de+H,fe.continuation){if(fe.closesHeader)A++;continue}if(/^then\b/.test(H)||/^do\b/.test(H)||/^else\b/.test(H))A++;else if(/^if\b/.test(H)&&/\bthen\s*$/.test(H))A++;else if(/^elif\b/.test(H)&&/\bthen\s*$/.test(H))A++;else if(/^(?:while|for|until)\b/.test(H)&&/\bdo\s*$/.test(H))A++;else if(/^case\b/.test(H)&&/\bin\s*$/.test(H))A++;else if(me)A++;else if(/\{\s*$/.test(H)&&!H.startsWith("#"))A++}return k.join(`
|
|
8
|
+
`)}var it=/(?:^|\s)#/;function lt(e,a){if(it.test(e))return e;try{let n=Bun.YAML.parse(e),s=a.format.indentStyle==="tabs"?"\t":a.format.indent;return Bun.YAML.stringify(n,null,s).split(`
|
|
9
|
+
`).map((R)=>R.replace(/[ \t]+$/,"")).join(`
|
|
10
|
+
`)}catch{return e}}var Ge=Array.from({length:129},(e,a)=>" ".repeat(a));function at(e){if(e<=0)return"";return e<Ge.length?Ge[e]:" ".repeat(e)}function ct(e,a){if((a.format.indentStyle||"spaces")==="tabs")return"\t".repeat(Math.max(0,e));return at(Math.max(0,e*a.format.indent))}function ft(e){return`'${e.slice(1,-1).replace(/\\"/g,'"')}'`}function ut(e){return`"${e.slice(1,-1).replace(/\\'/g,"'")}"`}function dt(e,a){for(let n=0;n<e.length;n++){if(e[n]==="\\"){n++;continue}if(e[n]===a)return!0}return!1}function pt(e,a,n){if(!Se(n))return e;let s=e.split(`
|
|
11
|
+
`);for(let k=0;k<s.length;k++)s[k]=Xe(s[k],a);return s.join(`
|
|
12
|
+
`)}function Xe(e,a){let n=a==="single";if(n?!e.includes('"'):!e.includes("'"))return e;let s=[],k=0,R=0,v=0,A=0;while(k<e.length){let W=e[k];if(v===0){if(W==="/"){let K=e[k+1];if(K==="/")break;if(K==="*"){let F=e.indexOf("*/",k+2);k=F===-1?e.length:F+2;continue}if(Pe(e,k)){let F=$e(e,k);if(F!==-1){k=F;continue}}k++;continue}if(W==='"'){v=2,A=k,k++;continue}if(W==="'"){v=1,A=k,k++;continue}if(W==="`"){v=3,k++;continue}k++}else if(v===3){if(W==="\\"){k+=2;continue}if(W==="`")v=0;k++}else{if(W==="\\"){k+=2;continue}if(W===(v===1?"'":'"')){let F=e.slice(A+1,k);if((v===2&&n||v===1&&!n)&&!dt(F,n?"'":'"')){if(A>R)s.push(e.slice(R,A));if(v===2)s.push(ft(`"${F}"`));else s.push(ut(`'${F}'`));R=k+1}v=0,k++;continue}k++}}if(s.length===0)return e;if(R<e.length)s.push(e.slice(R));return s.join("")}function mt(e){return e===123||e===44||e===61||e===43||e===45||e===42||e===47||e===59||e===60||e===62}var gt=/\s/;function ht(e,a){let n=!1;for(let s=a;s<e.length;s++){let k=e.charCodeAt(s),R=k===32||k>=9&&k<=13||k>=128&>.test(e[s]);if(R&&n)return!0;n=R}return!1}var Qe=1,Ve=2,Ze=4,en=8,nn=16,tn=32;function Te(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95}function yt(e){let a=0;for(let n=1;n<e.length-1;n++){let s=e.charCodeAt(n);if(s===43||s===45||s===42||s===47){if(Te(e.charCodeAt(n-1))&&Te(e.charCodeAt(n+1)))a|=s===43?Qe:s===45?Ve:s===42?Ze:en}else if(s===60||s===62){let k=e.charCodeAt(n+1),R=e.charCodeAt(n-1);if(k>=48&&k<=57&&(Te(R)||R===41||R===93))a|=s===60?nn:tn}}return a}function wt(e,a){if(a+e.length<4)return e;let n=0;while(n<e.length&&(e[n]===" "||e[n]==="\t"))n++;if(n<e.length){let W=e[n];if(W==="/"&&(e[n+1]==="/"||e[n+1]==="*"))return e;if(W==="*")return e}let s=!1;for(let W=n;W<e.length;W++)if(mt(e.charCodeAt(W))){s=!0;break}if(!s)return e;let{text:k,strings:R}=Et(e),v=k;if(v.includes("{"))v=v.replace(Dn,"$1 {"),v=v.replace(Fn,"{ $1");if(v.includes(","))v=v.replace(Wn,", $1");if(v.includes("="))v=v.replace(Un," = ");let A=yt(v);if(A&Qe)v=v.replace(Gn,"$1 + $2");if(A&Ve)v=v.replace(Kn,"$1 - $2");if(A&Ze)v=v.replace(Bn,"$1 * $2");if(A&en)v=v.replace(zn,"$1 / $2");if(v.includes(";"))v=v.replace(Hn,"; $1");if(A&nn)v=v.replace(Jn,"$1 < $2");if(A&tn)v=v.replace(qn,"$1 > $2");if(ht(v,n))if(n>0){let W=v.slice(n);v=v.slice(0,n)+W.replace(De," ")}else v=v.replace(De," ");return R.length>0?St(v,R):v}function Re(e){let a=e[e.length-1];return a!==void 0&&a.t==="tmpl"}function rn(e,a,n){a++;while(a<e.length){let s=e[a];if(s==="\\"){a+=2;continue}if(s===n)return a+1;a++}return a}function Ne(e,a){for(let s of a)if(s.t==="tmpl")s.start=-1;let n=0;while(n<e.length){let s=a[a.length-1],k=e[n];if(s===void 0||s.t==="interp"){if(k==="`"){a.push({t:"tmpl",start:n}),n++;continue}if(k==="'"||k==='"'){n=rn(e,n,k);continue}if(k==="/"){if(e[n+1]==="/")break;if(e[n+1]==="*"){let R=e.indexOf("*/",n+2);if(R===-1)break;n=R+2;continue}if(Pe(e,n)){let R=$e(e,n);if(R!==-1){n=R;continue}}n++;continue}if(s!==void 0){if(k==="{"){s.braces++,n++;continue}if(k==="}"){if(s.braces===0)a.pop();else s.braces--;n++;continue}}n++}else{if(k==="\\"){n+=2;continue}if(k==="`"){a.pop(),n++;continue}if(k==="$"&&e[n+1]==="{"){a.push({t:"interp",braces:0}),n+=2;continue}n++}}if(Re(a)){for(let s of a)if(s.t==="tmpl"&&s.start>=0)return s.start}return-1}function Ke(e,a){let n=a,s=null,k=0;while(k<e.length){let R=e[k];if(n){if(R==="*"&&e[k+1]==="/"){n=!1,k+=2;continue}k++;continue}if(s){if(R==="\\"){k+=2;continue}if(R===s)s=null;k++;continue}if(R==="'"||R==='"'||R==="`"){s=R,k++;continue}if(R==="/"){if(e[k+1]==="/")break;if(e[k+1]==="*"){n=!0,k+=2;continue}}k++}return n}function Be(e,a){let n=e.length,s=Array(n),k=a.format.quotes,R=a.format.semi===!0,v=0,A=0,W=!1,K=[],F=0,B=[];for(let U=0;U<n;U++){let P=e[U];if(W){W=Ke(P,!0),s[U]=P;continue}let V=Re(B),oe=-1;if(B.length>0||P.indexOf("`")!==-1)oe=Ne(P,B);if(V){s[U]=P;continue}if(oe<0&&B.length===0)W=P.includes("/*")&&Ke(P,!1);let le="",H=!1,fe="";if(oe>=0){le=P.slice(oe);let te=P.slice(0,oe);if(te.length===0){s[U]=le;continue}if(H=ye.test(te),te.trim().length===0)fe=te;P=te}if(P.length===0){s[U]="";continue}P=Xe(P,k);let me=0;while(me<P.length&&(P.charCodeAt(me)===32||P.charCodeAt(me)===9))me++;let ce=P.slice(me).trimEnd(),ge=0;if(vn.test(ce))v=Math.max(0,v-1),ge=K.pop()??0;let he=Pn.test(ce)?1:0,de=a.format.preserveCodeIndentation?P.slice(0,me):ct(v+F+A+he,a);F-=ge;let D=ce.charCodeAt(ce.length-1);if(D===123||D===91||D===40){v+=1;let te=he===1&&ce.charCodeAt(0)===46?1:0;K.push(te),F+=te,A=0}else if(!ce.startsWith("//")&&!ce.startsWith("*")&&!ce.startsWith("/*"))if(!Nn.test(ce))A=0;else{let te=c(ce),ue=te.includes("//")?te.replace(An,""):te;A=$n(ue)?A+1:0}let j=wt(ce,de.length),ae=!1;if(R){if(!Mn.test(j))if(Ln.test(j))ae=!0;else j=j.replace(jn,";")}if(ae)P="";else if(a.format.trimTrailingWhitespace)j=j.trimEnd(),P=j.length===0?"":de+j;else P=de+j;if(oe>=0){if(fe)P=fe;else if(H&&!ye.test(P))P+=" ";P+=le}s[U]=P}return s}var ze=/^[ \t]*(`{3,}|~{3,})(.*)$/,bt=/^ {0,3}#{1,6}(?:[ \t]|$)/;function kt(e,a){let n=a.format.trimTrailingWhitespace,s=Math.max(0,a.format.maxConsecutiveBlankLines),k=[],R=0,v="",A=0;for(let W=0;W<e.length;W++){let K=e[W];if(v!==""){let V=K.indexOf(v)!==-1?ze.exec(K):null;if(V&&V[1][0]===v&&V[1].length>=A&&V[2].trim()==="")v="",k.push(n?K.replace(ye,""):K);else k.push(K);continue}if(K.length===0||K.trim()===""){if(R++,R<=s)k.push("");continue}if(R=0,K.indexOf("```")!==-1||K.indexOf("~~~")!==-1){let V=ze.exec(K);if(V&&!(V[1][0]==="`"&&V[2].includes("`"))){v=V[1][0],A=V[1].length,k.push(n?K.replace(ye,""):K);continue}}let F=K.charCodeAt(K.length-1);if(!n||F!==32&&F!==9){k.push(K);continue}let B=K.replace(ye,""),U=e[W+1],P=K.endsWith(" ")&&U!==void 0&&U.trim()!==""&&!bt.test(K);k.push(P?`${B} `:B)}return k}function Ct(e,a){let n=[],s=0,k=[];for(let R of e){let v=Re(k);if(k.length>0||R.indexOf("`")!==-1)Ne(R,k);if(v){n.push(R),s=0;continue}if(R===""){if(s++,s<=a)n.push("")}else s=0,n.push(R)}return n}function p(e,a,n){if(e.length===0)return"";let k=(e.includes("\r")?e.replace(/\r\n/g,`
|
|
13
|
+
`):e).split(`
|
|
14
|
+
`),R;if(tt(n))R=kt(k,a);else if(a.format.trimTrailingWhitespace){R=[];let A=0,W=Math.max(0,a.format.maxConsecutiveBlankLines),K=[];for(let F of k){let B=Re(K),U=!1;if(K.length>0||F.indexOf("`")!==-1)U=Ne(F,K)>=0;if(B||U){R.push(F),A=0;continue}let P=F[F.length-1],V=P===" "||P==="\t"?F.replace(ye,""):F;if(V===""){if(A++,A<=W)R.push("")}else A=0,R.push(V)}}else R=Ct(k,Math.max(0,a.format.maxConsecutiveBlankLines));let v;if(Se(n)&&!(R.length>0&&R[0].startsWith("#!"))){let A=0;while(A<R.length&&R[A]==="")A++;if(A>0)R=R.slice(A);return R=on(R)??R,v=Be(R,a).join(`
|
|
15
|
+
`),He(v,a)}if(v=R.join(`
|
|
16
|
+
`),v=v.replace(Zn,""),Se(n))v=C(v);if(nt(n)){let A=lt(v,a);if(A!==v)v=A}if(et(n)){let A=Ot(v,n);if(A!=null)v=A}if(st(n,v))v=ot(v,a);else if(Se(n))v=Be(v.split(`
|
|
17
|
+
`),a).join(`
|
|
18
|
+
`);else v=pt(v,a.format.quotes,n);return He(v,a)}function He(e,a){let n=e.length;while(n>0&&e.charCodeAt(n-1)===10)n--;if(a.format.finalNewline==="none")return n===e.length?e:e.slice(0,n);let s=a.format.finalNewline==="two"?`
|
|
19
|
+
|
|
20
|
+
`:`
|
|
21
|
+
`;if(e.length-n===s.length)return e;return e.slice(0,n)+s}function Je(e,a,n,s){for(let k=a+1;k<e.length;k++){let R=e[k];if(R==="\\"){k++;continue}if(R===n)return!0;if(R===s)return!1}return!0}function O(e,a){if(/^\s*\/\/\/\s*<reference/.test(e))return[];let n=[],s=null,k=!1;for(let R=0;R<e.length;R++){let v=e[R];if(k){k=!1;continue}if(v==="\\"){k=!0;continue}if(!s){if(v==="/"&&e[R+1]==="/")break;if(v==="'"){if(a==="double"&&Je(e,R,"'",'"'))n.push(R);s="single";continue}else if(v==='"'){if(a==="single"&&Je(e,R,'"',"'"))n.push(R);s="double";continue}else if(v==="`"){s="template";continue}}else if(s==="single"&&v==="'"||s==="double"&&v==='"'||s==="template"&&v==="`"){s=null;continue}}return n}function M(e,a,n="spaces",s){if(n==="tabs")return/[^\t]/.test(e);if(/\t/.test(e))return!0;let k=e.length;if(s&&k%a===1){let R=s.trimStart();if(R.startsWith("* ")||R.startsWith("*/")||R==="*")return!1}return k%a!==0}function sn(e,a){let n=a+1;while(n<e.length){let s=e[n];if(s==="\\"){n+=2;continue}if(s==="`")return n+1;if(s==="$"&&e[n+1]==="{"){n+=2;let k=1;while(n<e.length&&k>0){let R=e[n];if(R==="\\"){n+=2;continue}if(R==="`"){n=sn(e,n);continue}if(R==="'"||R==='"'){n=rn(e,n,R);continue}if(R==="{")k++;else if(R==="}")k--;n++}continue}n++}return n}var xt=new Set(["return","typeof","instanceof","in","of","new","delete","void","do","else","case","yield","await"]);function Pe(e,a){let n=a-1;while(n>=0&&(e[n]===" "||e[n]==="\t"))n--;if(n<0)return!0;let s=e[n];if("(,=:[!&|?;{}<>+-*%^~".includes(s))return!0;if(/[\w$]/.test(s)){let k=n;while(k>=0&&/[\w$]/.test(e[k]))k--;return xt.has(e.slice(k+1,n+1))}return!1}function $e(e,a){let n=a+1,s=!1,k=-1;while(n<e.length){let R=e[n];if(R==="\\"){n+=2;continue}if(R==="["&&!s)s=!0,k=n;else if(R==="]"&&s){let v=e[k+1]==="^"?k+2:k+1;if(n!==v)s=!1}else if(R==="/"&&!s){n++;while(n<e.length&&/[a-z]/i.test(e[n]))n++;return n}n++}return-1}function Et(e){if(!e.includes("'")&&!e.includes('"')&&!e.includes("`")&&!e.includes("/"))return{text:e,strings:[]};let a=[],n=[],s=0,k=0;while(s<e.length){let R=e[s];if(R==="/"){let v=e[s+1];if(v==="/"){if(s>k)n.push(e.slice(k,s));a.push(e.slice(s)),n.push(`@@S${a.length-1}@@`),k=e.length;break}if(v==="*"){let A=e.indexOf("*/",s+2),W=A===-1?e.length:A+2;if(s>k)n.push(e.slice(k,s));a.push(e.slice(s,W)),n.push(`@@S${a.length-1}@@`),s=W,k=s;continue}if(Pe(e,s)){let A=$e(e,s);if(A!==-1){if(s>k)n.push(e.slice(k,s));a.push(e.slice(s,A)),n.push(`@@S${a.length-1}@@`),s=A,k=s;continue}}s++;continue}if(R==="'"||R==='"'||R==="`"){if(s>k)n.push(e.slice(k,s));let v=s;if(R==="`")s=sn(e,s);else{let A=R;s++;while(s<e.length){if(e[s]==="\\"){s+=2;continue}if(e[s]===A){s++;break}s++}}a.push(e.slice(v,s)),n.push(`@@S${a.length-1}@@`),k=s;continue}s++}if(k<e.length)n.push(e.slice(k));return{text:n.join(""),strings:a}}function St(e,a){if(a.length===0)return e;let n="",s=0,k=e.indexOf("@@S");while(k!==-1){let R=k+3;while(R<e.length&&e.charCodeAt(R)>=48&&e.charCodeAt(R)<=57)R++;if(R>k+3&&e.charCodeAt(R)===64&&e.charCodeAt(R+1)===64)n+=e.slice(s,k)+(a[Number(e.slice(k+3,R))]??""),s=R+2,k=e.indexOf("@@S",s);else k=e.indexOf("@@S",k+1)}return s===0?e:n+e.slice(s)}function qe(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95||e===36}function Rt(e,a){let n=0;while(!0){let s=e.indexOf(a,n);if(s===-1)return!1;if(n=s+1,qe(e.charCodeAt(s+a.length)))continue;let k=s-1,R=!0;while(k>=0){let v=e.charCodeAt(k);if(!qe(v))break;if(v<48||v>57){R=!1;break}k--}if(R)return!0}}function C(e){let a=e[0];if(a!=="i"&&a!==" "&&a!=="\t"&&a!=="/"&&a!==`
|
|
22
|
+
`)return e;let n=on(e.split(`
|
|
23
|
+
`));return n===null?e:n.join(`
|
|
24
|
+
`)}function on(e){let a=e.length===0?void 0:e[0].length>0?e[0][0]:e.length>1?`
|
|
25
|
+
`:void 0;if(a!=="i"&&a!==" "&&a!=="\t"&&a!=="/"&&a!==`
|
|
26
|
+
`)return null;let n=[],s=[],k=[],R=0,v=0,A=-1,W=!1;while(R<e.length){let D=e[R];if(Fe.test(D)){R++;continue}if(Yn.test(D)||We.test(D)){let ue=R;if(We.test(D)){while(R<e.length&&!e[R].includes("*/"))R++;R++}else R++;if(!W){for(let pe=ue;pe<R&&pe<e.length;pe++)s.push(e[pe]);v=R}else if(A<0)A=ue;continue}if(!Xn.test(D))break;let j=D.trim(),ae=R+1;while(!Ue.test(j)&&ae<e.length&&ae-R<50)j+=` ${e[ae].trim()}`,ae++;if(!Ue.test(j))return null;let te=It(j);if(!te)return null;if(A>=0){let ue=[];for(let pe=A;pe<R;pe++)if(!Fe.test(e[pe]))ue.push(e[pe]);if(ue.length>0)te.comments=ue;A=-1}n.push(te),R=ae,v=R,W=!0}if(n.length===0)return null;let K=A>=0?A:v,F=e.slice(K),B=0;while(B<F.length&&F[B]==="")B++;let U=B===0?F:F.slice(B),P=new Map,V=(D)=>{let j=P.get(D);if(j===void 0){j=!1;for(let ae of F)if(Rt(ae,D)){j=!0;break}P.set(D,j)}return j};for(let D of n){if(D.kind!=="value")continue;D.named=D.named.filter((j)=>{if(j.alias)return!0;return V(j.name)})}let oe=n.filter((D)=>{if(D.kind==="side-effect")return!0;if(D.kind==="type")return D.namedTypes.length>0;return Boolean(D.defaultName||D.namespaceName||D.named.length>0)}),le=new Set(oe),H=[];for(let D of n){let j=H.length>0?[...H,...D.comments??[]]:D.comments;if(!le.has(D)){H=j??[];continue}if(j&&j.length>0)D.comments=j;H=[]}if(H.length>0)k.push(...H);let fe=new Map,me=(D,j)=>{if(!j.comments)return;D.comments=D.comments?[...D.comments,...j.comments]:[...j.comments]};for(let D of oe){let j=fe.get(D.source)||{};if(D.kind==="side-effect")j.side=j.side||[],j.side.push(D);else if(D.kind==="type"){if(!j.type)j.type={kind:"type",source:D.source,named:[],namedTypes:[],original:""};me(j.type,D),j.type.namedTypes=(j.type.namedTypes||[]).concat(D.namedTypes)}else{if(!j.value)j.value={kind:"value",source:D.source,named:[],namedTypes:[],original:""};if(me(j.value,D),D.defaultName)j.value.defaultName=D.defaultName;if(D.namespaceName)j.value.namespaceName=D.namespaceName;if(j.value.named=(j.value.named||[]).concat(D.named),D.namedTypes.length>0){if(!j.type)j.type={kind:"type",source:D.source,named:[],namedTypes:[],original:""};j.type.namedTypes=j.type.namedTypes.concat(D.namedTypes)}}fe.set(D.source,j)}let ce=[];for(let[D,j]of fe){if(j.side)ce.push(...j.side);if(j.value)j.value.named.sort((ae,te)=>ae.name.localeCompare(te.name)),ce.push(j.value);if(j.type&&j.type.namedTypes.length>0){let ae=new Set;j.type.namedTypes=j.type.namedTypes.filter((te)=>{let ue=`${te.name}|${te.alias||""}`;if(ae.has(ue))return!1;return ae.add(ue),!0}),j.type.namedTypes.sort((te,ue)=>te.name.localeCompare(ue.name)),ce.push(j.type)}}let ge=(D)=>D.startsWith(".")?2:D.startsWith("node:")?0:1,he=(D)=>{if(D.kind!=="value")return 99;if(D.defaultName)return 0;if(D.namespaceName)return 1;return 2};if(ce.sort((D,j)=>{if(D.kind!==j.kind){if(D.kind==="type")return-1;if(j.kind==="type")return 1;if(D.kind==="side-effect")return-1;if(j.kind==="side-effect")return 1}if(D.kind==="type"&&j.kind==="type"){let ae=ge(D.source),te=ge(j.source);if(ae!==te)return ae-te;return D.source.localeCompare(j.source)}if(D.kind==="value"&&j.kind==="value"){let ae=ge(D.source),te=ge(j.source);if(ae!==te)return ae-te;let ue=he(D),pe=he(j);if(ue!==pe)return ue-pe;return D.source.localeCompare(j.source)}return D.source.localeCompare(j.source)}),ce.length===0){if(s.length>0||k.length>0)return[...s,...k,...U.length>0?U:[""]];return U}let de=[...s];for(let D of ce){if(D.comments)de.push(...D.comments);let j=_t(D);if(j.includes(`
|
|
27
|
+
`))de.push(...j.split(`
|
|
28
|
+
`));else de.push(j)}if(k.length>0)de.push(""),de.push(...k);return de.push(""),de.push(...U),de}function _t(e){if(e.kind==="side-effect")return`import '${e.source}'`;if(e.kind==="type")return`import type { ${e.namedTypes.map((k)=>k.alias?`${k.name} as ${k.alias}`:k.name).join(", ")} } from '${e.source}'`;let a=[];if(e.defaultName)a.push(e.defaultName);if(e.namespaceName)a.push(`* as ${e.namespaceName}`);if(e.named.length>0){let s=e.named.map((k)=>k.alias?`${k.name} as ${k.alias}`:k.name).join(", ");a.push(`{ ${s} }`)}return`import ${a.join(", ")} from '${e.source}'`}function It(e){let a=e.match(/^\s*import\s+['"]([^'"]+)['"]/);if(a)return{kind:"side-effect",source:a[1],named:[],namedTypes:[],original:e};if(a=e.match(/^\s*import\s+type\s+\{([^}]*)\}\s+from\s+['"]([^'"]+)['"]/),a){let U=a[1],P=a[2],V=U.split(",").map((oe)=>oe.trim()).filter(Boolean).map((oe)=>{let le=oe.match(/^(\w+)(?:\s+as\s+(\w+))?$/);return{name:le?.[1]||oe,alias:le?.[2]}});return{kind:"type",source:P,named:[],namedTypes:V,original:e}}let n=e.match(/^\s*import\s+/),s=new RegExp(`\\sfrom\\s+['"]([^'"]+)['"]\\s*;?$`),k=e.match(s);if(!n||!k)return;let R=k[1],v=e.slice(n[0].length,k.index).trim(),A,W,K=[],F=[],B=v.match(/\{([^}]*)\}/);if(B){let P=B[1].split(",").map((V)=>V.trim()).filter(Boolean);for(let V of P){let oe=/^type\s+/.test(V),H=V.replace(/^type\s+/,"").match(/^(\w+)(?:\s+as\s+(\w+))?$/);if(!H)continue;let fe={name:H[1],alias:H[2]};if(oe)F.push(fe);else K.push(fe)}v=v.replace(/\{[\s\S]*?\}/,"").trim()}if(v.length>0){let U=v.split(",").map((P)=>P.trim()).filter(Boolean);for(let P of U)if(P.startsWith("* as "))W=P.slice(5).trim();else if(/^\w+$/.test(P))A=P}return{kind:"value",source:R,defaultName:A,namespaceName:W,named:K,namedTypes:F,original:e}}function Ot(e,a){if(Qn.test(a))return vt(e);if(Vn.test(a))return At(e);return null}function ln(e){try{return JSON.parse(e)}catch{return null}}function Ce(e,a,n=[]){let s={};for(let R of a)if(Object.prototype.hasOwnProperty.call(e,R))s[R]=e[R];for(let R of n){let v=Object.keys(e).filter((A)=>R.test(A)&&!(A in s)).sort();for(let A of v)s[A]=e[A]}let k=Object.keys(e).filter((R)=>!(R in s)).sort();for(let R of k)s[R]=e[R];return s}function Ye(e){let a={};for(let n of Object.keys(e).sort())a[n]=e[n];return a}function vt(e){let a=ln(e);if(!a||typeof a!=="object")return e;let s=Ce(a,["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(s.files)){if(s.files.every((v)=>typeof v==="string"))s.files=[...s.files].sort()}for(let R of Object.keys(s))if(/^(?:dev|peer|optional|bundled)?[Dd]ependencies(?:Meta)?$/.test(R)||/^(?:resolutions|overrides|pnpm\.overrides)$/.test(R)){if(s[R]&&typeof s[R]==="object")s[R]=Ye(s[R])}if(s.pnpm&&typeof s.pnpm==="object"&&s.pnpm.overrides&&typeof s.pnpm.overrides==="object")s.pnpm.overrides=Ye(s.pnpm.overrides);if(s.exports&&typeof s.exports==="object"){let R=s.exports,v=["types","import","require","default"];if(!Array.isArray(R)){let A={};for(let W of Object.keys(R)){let K=R[W];if(K&&typeof K==="object"&&!Array.isArray(K))A[W]=Ce(K,v);else A[W]=K}s.exports=A}}let k=["pre-commit","prepare-commit-msg","commit-msg","post-commit","pre-rebase","post-rewrite","post-checkout","post-merge","pre-push","pre-auto-gc"];for(let R of["gitHooks","husky","simple-git-hooks"])if(s[R]&&typeof s[R]==="object")s[R]=Ce(s[R],k);return JSON.stringify(s,null,2)}function At(e){let a=ln(e);if(!a||typeof a!=="object")return e;let s=Ce(a,["extends","compilerOptions","references","files","include","exclude"]);if(s.compilerOptions&&typeof s.compilerOptions==="object"){let k=["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"];s.compilerOptions=Ce(s.compilerOptions,k)}return JSON.stringify(s,null,2)}import{readdirSync as Tt,readFileSync as Nt,statSync as _e}from"fs";import{extname as Pt,isAbsolute as Ie,join as Oe,resolve as $t}from"path";var L=5;function Mt(e){let a="",n=0;while(n<e.length){let s=e[n];if(s==="*")if(e[n+1]==="*"){if(a+=".*",n+=2,e[n]==="/")n++}else a+="[^/]*",n++;else if(s==="?")a+="[^/]",n++;else if(s==="["){let k=e.indexOf("]",n);if(k===-1)a+="\\[",n++;else a+=e.slice(n,k+1),n=k+1}else if(".+^${}()|\\".includes(s))a+=`\\${s}`,n++;else a+=s,n++}return new RegExp(`^${a}$`)}function*cn(e,a,n){let s;try{s=Tt(e)}catch{return}for(let k of s){if(!n&&k.startsWith("."))continue;let R=Oe(e,k);if(a(R))continue;let v;try{v=_e(R)}catch{continue}if(v.isDirectory())yield*cn(R,a,n);else yield R}}function*an(e,a,n,s){yield*cn(e,d(a,s),n)}async function f(e,a={}){let n=a.cwd??process.cwd(),s=a.ignore??[],k=a.dot??!1,R=a.absolute??!0,v=d(s,n);if(typeof globalThis.Bun?.Glob<"u"){let W=globalThis.Bun.Glob,K=[];for(let F of e){let B=Ie(F)?F:Oe(n,F),U=_e(B,{throwIfNoEntry:!1});if(U?.isFile()){if(!v(B))K.push(R?B:B.startsWith(`${n}/`)?B.slice(n.length+1):B);continue}let P=U?.isDirectory()?B:n,V=new W(U?.isDirectory()?"**/*":F);for await(let oe of V.scan({cwd:P,dot:k,onlyFiles:a.onlyFiles??!0,followSymlinks:!1})){let le=Ie(oe)?oe:Oe(P,oe),H=le.startsWith(`${n}/`)?le.slice(n.length+1):le;if(v(le))continue;K.push(R?le:H)}}return K}let A=[];for(let W of e){let K=Ie(W)?W:Oe(n,W);if(_e(K,{throwIfNoEntry:!1})||!/[*?[{]/.test(W)){try{if(!_e(K).isDirectory()){let P=K.startsWith(`${n}/`)?K.slice(n.length+1):K;if(!v(K))A.push(R?K:P)}else for(let P of an(K,s,k,n))A.push(R?P:P.startsWith(`${n}/`)?P.slice(n.length+1):P)}catch{}continue}let B=Mt(W);for(let U of an(n,s,k,n)){let P=U.startsWith(`${n}/`)?U.slice(n.length+1):U;if(B.test(P)||B.test(P.replace(/\\/g,"/")))A.push(R?U:P)}}return A}function se(e){let a=0,n=[],s=()=>{if(n.length>0&&a<e)a++,n.shift()()};return(k)=>new Promise((R,v)=>{let A=()=>{k().then((W)=>{a--,R(W),s()},(W)=>{a--,v(W),s()})};if(a<e)a++,A();else n.push(A)})}var r={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"},get WORKERS(){let e=process.env.PICKIER_WORKERS;if(e===void 0||e==="")return null;let a=Number(e);return Number.isFinite(a)?Math.max(0,Math.floor(a)):null}},_=["**/node_modules/**","**/.git/**"],m=["**/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 N(e,a){let n=e[a];if(n===void 0){let R=a.indexOf("/");if(R>0){let v=a.slice(0,R),A=a.slice(R+1),W=v==="general"?"pickier":v==="pickier"?"general":null;if(W)n=e[`${W}/${A}`];if(n===void 0)n=e[A]}}let s,k;if(typeof n==="string"){if(n==="error")s="error";else if(n==="warn"||n==="warning")s="warning"}else if(Array.isArray(n)&&typeof n[0]==="string"){let R=n[0];if(R==="error")s="error";else if(R==="warn"||R==="warning")s="warning";k=n[1]}return{enabled:!!s,severity:s,options:k}}function E(e){let a=Array.isArray(e)?e[0]:e;if(typeof a!=="string")return;if(a==="off")return"off";if(a==="error")return"error";if(a==="warn"||a==="warning")return"warning";return}function o(e,a,n=[],s){for(let R of[a,...n]){let v=E(e.rules?.[R])??E(e.pluginRules?.[R]);if(v)return v==="off"?void 0:v}let k=E(s);return k==="off"?void 0:k}function re(e,a){return E(e.rules?.[a])==="off"||E(e.pluginRules?.[a])==="off"}function w(e,a){return`\x1B[${e}m${a}\x1B[0m`}function J(e){return w("32",e)}function Y(e){return w("31",e)}function Z(e){return w("33",e)}function X(e){return w("34",e)}function Q(e){return w("90",e)}function ee(e){return w("1",e)}var t={green:J,red:Y,yellow:Z,blue:X,gray:Q,bold:ee};function y(e,a){let n=a.ignores?[...new Set([...e.ignores||[],...a.ignores])]:e.ignores,s={...e.pluginRules||{},...a.pluginRules||{}};if((a.tailwind??e.tailwind)?.enabled&&!Object.prototype.hasOwnProperty.call(s,"pickier/sort-tailwind-classes"))s["pickier/sort-tailwind-classes"]="warn";return{...e,...a,verbose:a.verbose??e.verbose,ignores:n,lint:{...e.lint,...a.lint||{}},format:{...e.format,...a.format||{}},rules:{...e.rules,...a.rules||{}},pluginRules:s}}var Me=null;async function u(e){if(!e){if(r.NO_AUTO_CONFIG){if(!Me)Me=y(l,{});return Me}try{let{getConfig:s}=await import("./chunk-fn87cp4c.js"),k=await s();return y(l,k)}catch{}return y(l,{})}let a=Ie(e)?e:$t(process.cwd(),e);if(Pt(a).toLowerCase()===".json")try{let s=Nt(a,"utf8");return y(l,JSON.parse(s))}catch{return console.warn(`[pickier:warn] Config file not found: ${a}. Using default config values.`),y(l,{})}try{let s=await import(a);return y(l,s.default||s)}catch{return console.warn(`[pickier:warn] Config file not found: ${a}. Using default config values.`),y(l,{})}}function x(e){return e.map((a)=>{if(/[*?[\]{}()!]/.test(a))return a;if(/\.[A-Z0-9]+$/i.test(a))return a;return`${a.replace(/\/$/,"")}/**/*`})}function T(e,a){let n=e.lastIndexOf(".");if(n<0)return!1;let s=e.slice(n);return a.has(s)}function Le(e){if(!e.includes("\\")&&!e.includes("//"))return e;return e.replace(/\\/g,"/").replace(/\/+/g,"/")}function Lt(e){let a=[];for(let n of e){let s=Le(n.trim());if(!s)continue;let k=s.match(/\*\*\/\*\.(.+)$/);if(k){a.push({raw:s,kind:"extension",value:k[1]});continue}let R=s.match(/\*\*\/(.+?)\/\*\*$/);if(R){a.push({raw:s,kind:"segment",value:R[1]});continue}let v=s.match(/\*\*\/(.+)$/);if(v)a.push({raw:s,kind:"suffix",value:v[1].replace(/\/$/,"")})}return a}function h(e){return[...new Set([..._,...e])]}function d(e,a=process.cwd()){let n=Lt([..._,...e]);if(n.length===0)return()=>!1;let s=new Set([...m,..._]),k=Le(a).replace(/\/$/,""),R=`${k}/`,v=n.map((A)=>({pattern:A,universal:s.has(A.raw),suffix:A.kind==="extension"?`.${A.value}`:`/${A.value}`,inner:`/${A.value}/`}));return(A)=>{let W=Le(A),K=W!==k&&!W.startsWith(R),F=K?W:W.slice(k.length);for(let{pattern:B,universal:U,suffix:P,inner:V}of v){if(K&&!U)continue;if(B.kind==="extension"){if(F.endsWith(P))return!0;continue}if(B.kind==="segment"||B.kind==="suffix"){if(F.includes(V)||F.endsWith(P))return!0}}return!1}}function ie(e,a){return d(a)(e)}
|
|
29
|
+
export{l,ne,z,g,I,q,G,c,S,p,O,M,C,L,f,se,r,_,m,N,E,o,re,w,J,Y,Z,X,Q,ee,t,y,u,x,T,h,d,ie};
|