mejora 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,l as t,n}from"./typescript-
|
|
1
|
+
import{i as e,l as t,n}from"./typescript-CSuD-WGR.mjs";export{t as defineConfig,e as eslint,e as eslintCheck,n as typescript,n as typescriptCheck};
|
package/dist/run.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as e,c as t,o as n,r,s as i,t as a,u as o}from"./typescript-
|
|
2
|
+
import{a as e,c as t,o as n,r,s as i,t as a,u as o}from"./typescript-CSuD-WGR.mjs";import{inspect as s,parseArgs as c,styleText as l}from"node:util";import{mkdir as u,readFile as d,writeFile as f}from"node:fs/promises";import{env as p}from"node:process";var m=class{runners=new Map;static getRequiredTypes(e){return new Set(Object.values(e).map(e=>e.type))}get(e){let t=this.runners.get(e);if(!t)throw Error(`Unknown check type: ${e}`);return t}getTypes(){return new Set(this.runners.keys())}has(e){return this.runners.has(e)}register(e){if(this.runners.has(e.type))throw Error(`Check runner already registered: ${e.type}`);this.runners.set(e.type,e)}async setup(e){await this.runLifecycle(e,`setup`)}async validate(e){await this.runLifecycle(e,`validate`)}async runLifecycle(e,t){let n=[];for(let r of e){let e=this.get(r)[t]?.();e&&n.push(e)}await Promise.all(n)}};function h(e,t){if(!(e===void 0||t===0))return e/t}function g(e){let{results:t,totalDuration:n}=e,r=t.length,i=[],a=[],o=[],s=[],c=0,l=0,u=0,d=0,f=0,p=[];for(let e of t){let t=e.snapshot.items.length;f+=t,e.isInitial?(u+=t,o.push(e.checkId)):(e.hasImprovement&&(c+=e.removedIssues.length,i.push(e.checkId)),e.hasRegression&&(l+=e.newIssues.length,a.push(e.checkId)),!e.hasImprovement&&!e.hasRegression&&(d+=t,s.push(e.checkId))),p.push({checkId:e.checkId,duration:e.duration,hasImprovement:e.hasImprovement,hasRegression:e.hasRegression,isInitial:e.isInitial,newIssues:e.newIssues,removedIssues:e.removedIssues,totalIssues:t})}let m={checks:p,exitCode:e.exitCode,hasImprovement:e.hasImprovement,hasRegression:e.hasRegression,summary:{avgDuration:h(n,r),checksRun:r,improvementChecks:i,improvements:c,initial:u,initialChecks:o,regressionChecks:a,regressions:l,totalIssues:f,unchanged:d,unchangedChecks:s},totalDuration:n};return JSON.stringify(m,null,2)}const _=e=>t=>l(e,typeof t==`number`?t.toString():t),v=_(`blue`),y=_(`bold`),b=_(`cyan`),x=_(`dim`),S=_(`green`),C=_(`red`),w=_(`gray`),ee=_(`underline`),te=_(`yellow`);function ne(e){if(e<1e3)return`${e}ms`;let t=e/1e3;if(t<60)return t%1==0?`${t}s`:`${t.toFixed(1)}s`;let n=e/6e4;if(n<60)return n%1==0?`${n}m`:`${n.toFixed(1)}m`;let r=e/36e5;return r%1==0?`${r}h`:`${r.toFixed(1)}h`}function T(e){let t=Math.round(e);return t<1?`<1ms`:ne(t)}function E(e,t){return e===1?t:`${t}s`}const D=` `,re=`${D} `;function ie(e){return e===`initial`?x(`→`):e===`improvement`?S(`↑`):C(`↓`)}function ae(e,t,r){let a=i(e),o=n(e),s=t>0?`:${t}:${r>0?r:1}`:``;return`${a===`.`?``:x(`${a}/`)}${ee(o)}${s?x(s):``}`}function oe(e,t){return[`${ie(t)} ${ae(e.file,e.line,e.column)} ${x(e.rule)}`,e.message]}function O(e,t){let n=[],r=e.slice(0,10);for(let e of r){let[r,i]=oe(e,t);n.push(`${D}${r}`,`${re}${i}`)}let i=e.length-r.length;return i>0&&n.push(`${D}${x(`... and ${i} more`)}`),n}function se(e){return e===void 0?[]:[` ${x(`Duration`)} ${T(e)}`]}function ce(e){return[` ${x(`Issues`)} ${y(e)}`]}function k(e){return[...se(e.duration),...ce(e.snapshot.items.length)]}function le(e){if(!e.hasRegression)return[];let t=e.newIssues.length;return[` ${C(t)} new ${E(t,`issue`)} (${E(t,`regression`)}):`,...O(e.newIssues,`regression`)]}function ue(e){if(!e.hasImprovement)return[];let t=e.removedIssues.length;return[` ${S(t)} ${E(t,`issue`)} fixed (${E(t,`improvement`)}):`,...O(e.removedIssues,`improvement`)]}function de(e,t){let n=t?``:`
|
|
3
3
|
`,r=e.snapshot.items.length,i=[`${n}${v(`ℹ`)} ${e.checkId}:`,` Initial baseline created with ${v(r)} ${E(r,`issue`)}`];return e.snapshot.items.length>0&&i.push(...O(e.snapshot.items,`initial`)),i.push(``,...k(e)),i}function fe(e,t){return[`${t?``:`
|
|
4
4
|
`}${e.hasRegression?C(`✖`):S(`✔`)} ${e.checkId}:`,...le(e),...ue(e),``,...k(e)]}function pe(e,t){let n=t?``:`
|
|
5
5
|
`,r=e.snapshot.items.length;return e.duration===void 0?[`${n}${w(`ℹ`)} ${e.checkId} (${y(r)})`]:[`${n}${w(`ℹ`)} ${e.checkId} (${y(r)}) ${x(T(e.duration))}`]}function me(e,t){return e.isInitial?de(e,t):e.hasRegression||e.hasImprovement?fe(e,t):pe(e,t)}function he(e,t,n){return t?v(`✔ Initial baseline created successfully`):e.hasRegression?n?te(`⚠ Regressions detected (forced)`):`${C(`✗ Regressions detected`)} - Run failed`:e.hasImprovement?`${S(`✔ Improvements detected`)} - Baseline updated`:S(`✔ All checks passed`)}function ge(e,t){let n={hasAnyInitial:!1,totalImprovements:0,totalInitial:0,totalIssues:0,totalRegressions:0};for(let t of e.results){let e=t.snapshot.items.length;if(n.totalIssues+=e,t.isInitial){n.hasAnyInitial=!0,n.totalInitial+=e;continue}let{hasImprovement:r,hasRegression:i}=t;r&&(n.totalImprovements+=t.removedIssues.length),i&&(n.totalRegressions+=t.newIssues.length)}let r=[` ${x(`Improvements`)} ${S(n.totalImprovements)}`,` ${x(`Regressions`)} ${C(n.totalRegressions)}`,` ${x(`Initial`)} ${v(n.totalInitial)}`,` ${x(`Checks`)} ${e.results.length}`,` ${x(`Issues`)} ${y(n.totalIssues)}`],i=h(e.totalDuration,e.results.length);return e.totalDuration!==void 0&&i!==void 0&&r.push(` ${x(`Duration`)} ${T(e.totalDuration)} ${w(`(avg ${T(i)})`)}`),r.push(``,he(e,n.hasAnyInitial,t)),r.join(`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createRequire as e}from"node:module";import{pathToFileURL as t}from"node:url";import{hash as n}from"node:crypto";var r=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),i=e(import.meta.url),a=r(((e,t)=>{let n=i(`path`),r=i(`fs`),a=i(`os`),o=i(`url`),s=r.promises.readFile;function c(e,t){return[`package.json`,`.${e}rc.json`,`.${e}rc.js`,`.${e}rc.cjs`,...t?[]:[`.${e}rc.mjs`],`.config/${e}rc`,`.config/${e}rc.json`,`.config/${e}rc.js`,`.config/${e}rc.cjs`,...t?[]:[`.config/${e}rc.mjs`],`${e}.config.js`,`${e}.config.cjs`,...t?[]:[`${e}.config.mjs`]]}function l(e){return n.dirname(e)||n.sep}let u=(e,t)=>JSON.parse(t),d=typeof __webpack_require__==`function`?__non_webpack_require__:i,f=Object.freeze({".js":d,".json":d,".cjs":d,noExt:u});t.exports.defaultLoadersSync=f;let p=async e=>{try{return(await import(o.pathToFileURL(e).href)).default}catch(t){try{return d(e)}catch(e){throw e.code===`ERR_REQUIRE_ESM`||e instanceof SyntaxError&&e.toString().includes(`Cannot use import statement outside a module`)?t:e}}},m=Object.freeze({".js":p,".mjs":p,".cjs":p,".json":u,noExt:u});t.exports.defaultLoaders=m;function h(e,t,r){let i={stopDir:a.homedir(),searchPlaces:c(e,r),ignoreEmptySearchPlaces:!0,cache:!0,transform:e=>e,packageProp:[e],...t,loaders:{...r?f:m,...t.loaders}};return i.searchPlaces.forEach(e=>{let t=n.extname(e)||`noExt`,r=i.loaders[t];if(!r)throw Error(`Missing loader for extension "${e}"`);if(typeof r!=`function`)throw Error(`Loader for extension "${e}" is not a function: Received ${typeof r}.`)}),i}function g(e,t){return typeof e==`string`&&e in t?t[e]:(Array.isArray(e)?e:e.split(`.`)).reduce((e,t)=>e===void 0?e:e[t],t)||null}function _(e){if(!e)throw Error(`load must pass a non-empty string`)}function v(e,t){if(!e)throw Error(`No loader specified for extension "${t}"`);if(typeof e!=`function`)throw Error(`loader is not a function`)}let y=e=>(t,n,r)=>(e&&t.set(n,r),r);t.exports.lilconfig=function(e,t){let{ignoreEmptySearchPlaces:i,loaders:a,packageProp:o,searchPlaces:c,stopDir:u,transform:d,cache:f}=h(e,t??{},!1),p=new Map,m=new Map,b=y(f);return{async search(e=process.cwd()){let t={config:null,filepath:``},m=new Set,h=e;dirLoop:for(;;){if(f){let e=p.get(h);if(e!==void 0){for(let t of m)p.set(t,e);return e}m.add(h)}for(let e of c){let c=n.join(h,e);try{await r.promises.access(c)}catch{continue}let l=String(await s(c)),u=n.extname(e)||`noExt`,d=a[u];if(e===`package.json`){let e=g(o,await d(c,l));if(e!=null){t.config=e,t.filepath=c;break dirLoop}continue}let f=l.trim()===``;if(!(f&&i)){f?(t.isEmpty=!0,t.config=void 0):(v(d,u),t.config=await d(c,l)),t.filepath=c;break dirLoop}}if(h===u||h===l(h))break dirLoop;h=l(h)}let _=t.filepath===``&&t.config===null?d(null):d(t);if(f)for(let e of m)p.set(e,_);return _},async load(e){_(e);let t=n.resolve(process.cwd(),e);if(f&&m.has(t))return m.get(t);let{base:r,ext:c}=n.parse(t),l=c||`noExt`,u=a[l];v(u,l);let p=String(await s(t));if(r===`package.json`)return b(m,t,d({config:g(o,await u(t,p)),filepath:t}));let h={config:null,filepath:t},y=p.trim()===``;return y&&i?b(m,t,d({config:void 0,filepath:t,isEmpty:!0})):(h.config=y?void 0:await u(t,p),b(m,t,d(y?{...h,isEmpty:y,config:void 0}:h)))},clearLoadCache(){f&&m.clear()},clearSearchCache(){f&&p.clear()},clearCaches(){f&&(m.clear(),p.clear())}}},t.exports.lilconfigSync=function(e,t){let{ignoreEmptySearchPlaces:i,loaders:a,packageProp:o,searchPlaces:s,stopDir:c,transform:u,cache:d}=h(e,t??{},!0),f=new Map,p=new Map,m=y(d);return{search(e=process.cwd()){let t={config:null,filepath:``},p=new Set,m=e;dirLoop:for(;;){if(d){let e=f.get(m);if(e!==void 0){for(let t of p)f.set(t,e);return e}p.add(m)}for(let e of s){let s=n.join(m,e);try{r.accessSync(s)}catch{continue}let c=n.extname(e)||`noExt`,l=a[c],u=String(r.readFileSync(s));if(e===`package.json`){let e=g(o,l(s,u));if(e!=null){t.config=e,t.filepath=s;break dirLoop}continue}let d=u.trim()===``;if(!(d&&i)){d?(t.isEmpty=!0,t.config=void 0):(v(l,c),t.config=l(s,u)),t.filepath=s;break dirLoop}}if(m===c||m===l(m))break dirLoop;m=l(m)}let h=t.filepath===``&&t.config===null?u(null):u(t);if(d)for(let e of p)f.set(e,h);return h},load(e){_(e);let t=n.resolve(process.cwd(),e);if(d&&p.has(t))return p.get(t);let{base:s,ext:c}=n.parse(t),l=c||`noExt`,f=a[l];v(f,l);let h=String(r.readFileSync(t));if(s===`package.json`)return u({config:g(o,f(t,h)),filepath:t});let y={config:null,filepath:t},b=h.trim()===``;return b&&i?m(p,t,u({filepath:t,config:void 0,isEmpty:!0})):(y.config=b?void 0:f(t,h),m(p,t,u(b?{...y,isEmpty:b,config:void 0}:y)))},clearLoadCache(){d&&p.clear()},clearSearchCache(){d&&f.clear()},clearCaches(){d&&(p.clear(),f.clear())}}}}))();const o=async e=>{let n=await import(t(e).href);return n&&typeof n==`object`&&`default`in n?n.default:n};function s(e){return e}const c=async()=>{let e=await(0,a.lilconfig)(`mejora`,{loaders:{".js":o,".mjs":o,".mts":o,".ts":o},searchPlaces:[`mejora.config.ts`,`mejora.config.mts`,`mejora.config.js`,`mejora.config.mjs`]}).search(process.cwd());if(!e?.config)throw Error(`No configuration file found.`);return e.config},l=/^[A-Za-z]:\//;function u(e=``){return e&&e.replace(/\\/g,`/`).replace(l,e=>e.toUpperCase())}const d=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,f=/^[A-Za-z]:$/,p=/^\/([A-Za-z]:)?$/;function m(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const h=function(...e){e=e.map(e=>u(e));let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:m();!i||i.length===0||(t=`${i}/${t}`,n=_(i))}return t=g(t,!n),n&&!_(t)?`/${t}`:t.length>0?t:`.`};function g(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const _=function(e){return d.test(e)},v=function(e,t){let n=h(e).replace(p,`$1`).split(`/`),r=h(t).replace(p,`$1`).split(`/`);if(r[0][1]===`:`&&n[0][1]===`:`&&n[0]!==r[0])return r.join(`/`);let i=[...n];for(let e of i){if(r[0]!==e)break;n.shift(),r.shift()}return[...n.map(()=>`..`),...r].join(`/`)},y=function(e){let t=u(e).replace(/\/$/,``).split(`/`).slice(0,-1);return t.length===1&&f.test(t[0])&&(t[0]+=`/`),t.join(`/`)||(_(e)?`/`:`.`)},b=function(e,t){let n=u(e).split(`/`),r=``;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t){r=t;break}}return t&&r.endsWith(t)?r.slice(0,-t.length):r},x=e=>n(`sha256`,e,`hex`),S=(e,t)=>{if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t,n={};for(let t of Object.keys(e).toSorted())n[t]=e[t];return n}return t};function C(e){return x(JSON.stringify(e??null,S))}function w(e,t=process.cwd()){return h(t,`node_modules`,`.cache`,`mejora`,e)}var T=class{type=`eslint`;async run(e){let{ESLint:t}=await import(`eslint`),n=process.cwd(),r=await new t({cache:!0,cacheLocation:`${
|
|
1
|
+
import{createRequire as e}from"node:module";import{pathToFileURL as t}from"node:url";import{hash as n}from"node:crypto";var r=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),i=e(import.meta.url),a=r(((e,t)=>{let n=i(`path`),r=i(`fs`),a=i(`os`),o=i(`url`),s=r.promises.readFile;function c(e,t){return[`package.json`,`.${e}rc.json`,`.${e}rc.js`,`.${e}rc.cjs`,...t?[]:[`.${e}rc.mjs`],`.config/${e}rc`,`.config/${e}rc.json`,`.config/${e}rc.js`,`.config/${e}rc.cjs`,...t?[]:[`.config/${e}rc.mjs`],`${e}.config.js`,`${e}.config.cjs`,...t?[]:[`${e}.config.mjs`]]}function l(e){return n.dirname(e)||n.sep}let u=(e,t)=>JSON.parse(t),d=typeof __webpack_require__==`function`?__non_webpack_require__:i,f=Object.freeze({".js":d,".json":d,".cjs":d,noExt:u});t.exports.defaultLoadersSync=f;let p=async e=>{try{return(await import(o.pathToFileURL(e).href)).default}catch(t){try{return d(e)}catch(e){throw e.code===`ERR_REQUIRE_ESM`||e instanceof SyntaxError&&e.toString().includes(`Cannot use import statement outside a module`)?t:e}}},m=Object.freeze({".js":p,".mjs":p,".cjs":p,".json":u,noExt:u});t.exports.defaultLoaders=m;function h(e,t,r){let i={stopDir:a.homedir(),searchPlaces:c(e,r),ignoreEmptySearchPlaces:!0,cache:!0,transform:e=>e,packageProp:[e],...t,loaders:{...r?f:m,...t.loaders}};return i.searchPlaces.forEach(e=>{let t=n.extname(e)||`noExt`,r=i.loaders[t];if(!r)throw Error(`Missing loader for extension "${e}"`);if(typeof r!=`function`)throw Error(`Loader for extension "${e}" is not a function: Received ${typeof r}.`)}),i}function g(e,t){return typeof e==`string`&&e in t?t[e]:(Array.isArray(e)?e:e.split(`.`)).reduce((e,t)=>e===void 0?e:e[t],t)||null}function _(e){if(!e)throw Error(`load must pass a non-empty string`)}function v(e,t){if(!e)throw Error(`No loader specified for extension "${t}"`);if(typeof e!=`function`)throw Error(`loader is not a function`)}let y=e=>(t,n,r)=>(e&&t.set(n,r),r);t.exports.lilconfig=function(e,t){let{ignoreEmptySearchPlaces:i,loaders:a,packageProp:o,searchPlaces:c,stopDir:u,transform:d,cache:f}=h(e,t??{},!1),p=new Map,m=new Map,b=y(f);return{async search(e=process.cwd()){let t={config:null,filepath:``},m=new Set,h=e;dirLoop:for(;;){if(f){let e=p.get(h);if(e!==void 0){for(let t of m)p.set(t,e);return e}m.add(h)}for(let e of c){let c=n.join(h,e);try{await r.promises.access(c)}catch{continue}let l=String(await s(c)),u=n.extname(e)||`noExt`,d=a[u];if(e===`package.json`){let e=g(o,await d(c,l));if(e!=null){t.config=e,t.filepath=c;break dirLoop}continue}let f=l.trim()===``;if(!(f&&i)){f?(t.isEmpty=!0,t.config=void 0):(v(d,u),t.config=await d(c,l)),t.filepath=c;break dirLoop}}if(h===u||h===l(h))break dirLoop;h=l(h)}let _=t.filepath===``&&t.config===null?d(null):d(t);if(f)for(let e of m)p.set(e,_);return _},async load(e){_(e);let t=n.resolve(process.cwd(),e);if(f&&m.has(t))return m.get(t);let{base:r,ext:c}=n.parse(t),l=c||`noExt`,u=a[l];v(u,l);let p=String(await s(t));if(r===`package.json`)return b(m,t,d({config:g(o,await u(t,p)),filepath:t}));let h={config:null,filepath:t},y=p.trim()===``;return y&&i?b(m,t,d({config:void 0,filepath:t,isEmpty:!0})):(h.config=y?void 0:await u(t,p),b(m,t,d(y?{...h,isEmpty:y,config:void 0}:h)))},clearLoadCache(){f&&m.clear()},clearSearchCache(){f&&p.clear()},clearCaches(){f&&(m.clear(),p.clear())}}},t.exports.lilconfigSync=function(e,t){let{ignoreEmptySearchPlaces:i,loaders:a,packageProp:o,searchPlaces:s,stopDir:c,transform:u,cache:d}=h(e,t??{},!0),f=new Map,p=new Map,m=y(d);return{search(e=process.cwd()){let t={config:null,filepath:``},p=new Set,m=e;dirLoop:for(;;){if(d){let e=f.get(m);if(e!==void 0){for(let t of p)f.set(t,e);return e}p.add(m)}for(let e of s){let s=n.join(m,e);try{r.accessSync(s)}catch{continue}let c=n.extname(e)||`noExt`,l=a[c],u=String(r.readFileSync(s));if(e===`package.json`){let e=g(o,l(s,u));if(e!=null){t.config=e,t.filepath=s;break dirLoop}continue}let d=u.trim()===``;if(!(d&&i)){d?(t.isEmpty=!0,t.config=void 0):(v(l,c),t.config=l(s,u)),t.filepath=s;break dirLoop}}if(m===c||m===l(m))break dirLoop;m=l(m)}let h=t.filepath===``&&t.config===null?u(null):u(t);if(d)for(let e of p)f.set(e,h);return h},load(e){_(e);let t=n.resolve(process.cwd(),e);if(d&&p.has(t))return p.get(t);let{base:s,ext:c}=n.parse(t),l=c||`noExt`,f=a[l];v(f,l);let h=String(r.readFileSync(t));if(s===`package.json`)return u({config:g(o,f(t,h)),filepath:t});let y={config:null,filepath:t},b=h.trim()===``;return b&&i?m(p,t,u({filepath:t,config:void 0,isEmpty:!0})):(y.config=b?void 0:f(t,h),m(p,t,u(b?{...y,isEmpty:b,config:void 0}:y)))},clearLoadCache(){d&&p.clear()},clearSearchCache(){d&&f.clear()},clearCaches(){d&&(p.clear(),f.clear())}}}}))();const o=async e=>{let n=await import(t(e).href);return n&&typeof n==`object`&&`default`in n?n.default:n};function s(e){return e}const c=async()=>{let e=await(0,a.lilconfig)(`mejora`,{loaders:{".js":o,".mjs":o,".mts":o,".ts":o},searchPlaces:[`mejora.config.ts`,`mejora.config.mts`,`mejora.config.js`,`mejora.config.mjs`]}).search(process.cwd());if(!e?.config)throw Error(`No configuration file found.`);return e.config},l=/^[A-Za-z]:\//;function u(e=``){return e&&e.replace(/\\/g,`/`).replace(l,e=>e.toUpperCase())}const d=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,f=/^[A-Za-z]:$/,p=/^\/([A-Za-z]:)?$/;function m(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const h=function(...e){e=e.map(e=>u(e));let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:m();!i||i.length===0||(t=`${i}/${t}`,n=_(i))}return t=g(t,!n),n&&!_(t)?`/${t}`:t.length>0?t:`.`};function g(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const _=function(e){return d.test(e)},v=function(e,t){let n=h(e).replace(p,`$1`).split(`/`),r=h(t).replace(p,`$1`).split(`/`);if(r[0][1]===`:`&&n[0][1]===`:`&&n[0]!==r[0])return r.join(`/`);let i=[...n];for(let e of i){if(r[0]!==e)break;n.shift(),r.shift()}return[...n.map(()=>`..`),...r].join(`/`)},y=function(e){let t=u(e).replace(/\/$/,``).split(`/`).slice(0,-1);return t.length===1&&f.test(t[0])&&(t[0]+=`/`),t.join(`/`)||(_(e)?`/`:`.`)},b=function(e,t){let n=u(e).split(`/`),r=``;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t){r=t;break}}return t&&r.endsWith(t)?r.slice(0,-t.length):r},x=e=>n(`sha256`,e,`hex`),S=(e,t)=>{if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t,n={};for(let t of Object.keys(e).toSorted())n[t]=e[t];return n}return t};function C(e){return x(JSON.stringify(e??null,S))}function w(e,t=process.cwd()){return h(t,`node_modules`,`.cache`,`mejora`,e)}var T=class{type=`eslint`;async run(e){let{ESLint:t}=await import(`eslint`),n=process.cwd(),r=w(this.type,n),i=C(e),a=new Set;if(e.overrides){let t=Array.isArray(e.overrides)?e.overrides:[e.overrides];for(let e of t)if(e.rules)for(let t of Object.keys(e.rules))a.add(t)}let o=a.size>0,s=await new t({cache:!0,cacheLocation:`${r}/${i}.eslintcache`,overrideConfig:e.overrides,...!o&&{concurrency:e.concurrency??`auto`},...o&&{ruleFilter:({ruleId:e})=>a.has(e)}}).lintFiles(e.files),c=[];for(let{filePath:e,messages:t}of s){let r=v(n,e);for(let{column:e,line:n,message:i,ruleId:a}of t)a&&c.push({column:e,file:r,line:n,message:i,rule:a})}return{items:c,type:`items`}}async setup(){let e=process.cwd(),t=w(this.type,e),{mkdir:n}=await import(`node:fs/promises`);await n(t,{recursive:!0})}async validate(){try{await import(`eslint`)}catch{throw Error(`${this.type} check requires "eslint" package to be installed. Run: npm install eslint`)}}};function E(e){return{type:`eslint`,...e}}function D(e,t){return e.replaceAll(/import\("([^"]+)"\)/g,(e,n)=>{try{if(_(n)){let e=v(t,n);if(!e.startsWith(`..`))return`import("${e||`.`}")`}}catch{}return e})}var O=class{type=`typescript`;async run(e){let{createIncrementalCompilerHost:t,createIncrementalProgram:n,findConfigFile:r,flattenDiagnosticMessageText:i,getPreEmitDiagnostics:a,parseJsonConfigFileContent:o,readConfigFile:s,sys:c,version:l}=await import(`typescript`),u=process.cwd(),d=c.fileExists.bind(c),f=c.readFile.bind(c),p=e.tsconfig?h(e.tsconfig):r(u,d,`tsconfig.json`);if(!p)throw Error(`TypeScript config file not found`);let{config:m,error:g}=s(p,f);if(g){let e=typeof g.messageText==`string`?g.messageText:i(g.messageText,`
|
|
2
2
|
`);throw TypeError(`Failed to read TypeScript config: ${e}`)}let _=o(m,c,u,e.overrides?.compilerOptions),y=h(w(this.type,u),`${C({configPath:p,overrides:e.overrides?.compilerOptions??{},parsedOptions:_.options,typescriptVersion:l})}.tsbuildinfo`),b={..._.options,incremental:!0,noEmit:!0,skipLibCheck:_.options.skipLibCheck??!0,tsBuildInfoFile:y},x=t(b,c),S=x.writeFile.bind(x);x.writeFile=(e,t,...n)=>{h(e)===y&&S(e,t,...n)};let T=n({host:x,options:b,projectReferences:_.projectReferences??[],rootNames:_.fileNames}),E=a(T.getProgram());T.emit();let O=h(u),k=O+`/`,A=E.filter(e=>{if(!e.file)return!0;let t=h(e.file.fileName);return t===O||t.startsWith(k)}),j=[];for(let e of A){let t=i(e.messageText,`
|
|
3
3
|
`),n=`TS${e.code}`;if(e.file&&e.start!==void 0){let{character:r,line:i}=e.file.getLineAndCharacterOfPosition(e.start),a=v(u,e.file.fileName);j.push({column:r+1,file:a,line:i+1,message:D(t,u),rule:n})}else j.push({column:0,file:`(global)`,line:0,message:D(t,u),rule:n})}return{items:j,type:`items`}}async setup(){let e=process.cwd(),t=w(this.type,e),{mkdir:n}=await import(`node:fs/promises`);await n(t,{recursive:!0})}async validate(){try{await import(`typescript`)}catch{throw Error(`${this.type} check requires "typescript" package to be installed. Run: npm install typescript`)}}};function k(e){return{type:`typescript`,...e}}export{x as a,v as c,E as i,s as l,k as n,b as o,T as r,y as s,O as t,c as u};
|