mejora 3.2.0 → 3.2.1
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/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/run-lzz8I8UG.mjs +18 -0
- package/dist/run.mjs +1 -1
- package/package.json +1 -1
- package/dist/run-B9dk_cJ1.mjs +0 -18
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./config-VQG8vlqE.mjs";import{a as e,c as t,d as n,f as r,i,l as a,m as o,o as s,p as c,r as l,s as u,t as d,u as f}from"./run-
|
|
2
|
+
import"./config-VQG8vlqE.mjs";import{a as e,c as t,d as n,f as r,i,l as a,m as o,o as s,p as c,r as l,s as u,t as d,u as f}from"./run-lzz8I8UG.mjs";import{parseArgs as p}from"node:util";function m(e,t){if(!(e===void 0||t===0))return e/t}function h(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})}return{checks:p,exitCode:e.exitCode,hasImprovement:e.hasImprovement,hasRegression:e.hasRegression,summary:{avgDuration:m(n,r),checksRun:r,improvementChecks:i,improvements:c,initial:u,initialChecks:o,regressionChecks:a,regressions:l,totalIssues:f,unchanged:d,unchangedChecks:s},totalDuration:n}}function g(e){return JSON.stringify(h(e),null,2)}function _(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 v(e){let t=Math.round(e);return t<1?`<1ms`:_(t)}const y=` `,b=`${y} `;function x(e){return e===`initial`?u(`→`):e===`improvement`?a(`↑`):f(`↓`)}function S(e,t,r){let i=o(e),a=c(e),s=t>0?`:${t}:${r>0?r:1}`:``;return`${i===`.`?``:u(`${i}/`)}${n(a)}${s?u(s):``}`}function C(e,t){return[`${x(t)} ${S(e.file,e.line,e.column)} ${u(e.rule)}`,e.message]}function w(e,t){let n=[],r=e.slice(0,10);for(let e of r){let[r,i]=C(e,t);n.push(`${y}${r}`,`${b}${i}`)}let i=e.length-r.length;return i>0&&n.push(`${y}${u(`... and ${i} more`)}`),n}function T(e){return e===void 0?[]:[` ${u(`Duration`)} ${v(e)}`]}function E(e){return[` ${u(`Issues`)} ${s(e)}`]}function D(e){return[...T(e.duration),...E(e.snapshot.items.length)]}function O(e){if(!e.hasRegression)return[];let t=e.newIssues.length;return[` ${f(t)} new ${i(t,`issue`)} (${i(t,`regression`)}):`,...w(e.newIssues,`regression`)]}function k(e){if(!e.hasImprovement)return[];let t=e.removedIssues.length;return[` ${a(t)} ${i(t,`issue`)} fixed (${i(t,`improvement`)}):`,...w(e.removedIssues,`improvement`)]}function A(t,n){let r=n?``:`
|
|
3
3
|
`,a=t.snapshot.items.length,o=[`${r}${e(`ℹ`)} ${t.checkId}:`,` Initial baseline created with ${e(a)} ${i(a,`issue`)}`];return t.snapshot.items.length>0&&o.push(...w(t.snapshot.items,`initial`)),o.push(``,...D(t)),o}function j(e,t){return[`${t?``:`
|
|
4
4
|
`}${e.hasRegression?f(`✖`):a(`✔`)} ${e.checkId}:`,...O(e),...k(e),``,...D(e)]}function M(e,n){let r=n?``:`
|
|
5
5
|
`,i=e.snapshot.items.length,o=i===0?a(`✔`):t(`ℹ`),c=i===0?a(i):s(i);return e.duration===void 0?[`${r}${o} ${e.checkId} (${c})`]:[`${r}${o} ${e.checkId} (${c}) ${u(v(e.duration))}`]}function N(e,t){return e.isInitial?A(e,t):e.hasRegression||e.hasImprovement?j(e,t):M(e,t)}function P(t,n,i){return n?e(`✔ Initial baseline created successfully`):t.hasRegression?i?r(`⚠ Regressions detected (forced)`):`${f(`✗ Regressions detected`)} - Run failed`:t.hasImprovement?`${a(`✔ Improvements detected`)} - Baseline updated`:a(`✔ All checks passed`)}function F(n,r){let i={hasAnyInitial:!1,totalImprovements:0,totalInitial:0,totalIssues:0,totalRegressions:0};for(let e of n.results){let t=e.snapshot.items.length;if(i.totalIssues+=t,e.isInitial){i.hasAnyInitial=!0,i.totalInitial+=t;continue}let{hasImprovement:n,hasRegression:r}=e;n&&(i.totalImprovements+=e.removedIssues.length),r&&(i.totalRegressions+=e.newIssues.length)}let o=[` ${u(`Improvements`)} ${a(i.totalImprovements)}`,` ${u(`Regressions`)} ${f(i.totalRegressions)}`,` ${u(`Initial`)} ${e(i.totalInitial)}`,` ${u(`Checks`)} ${n.results.length}`,` ${u(`Issues`)} ${s(i.totalIssues)}`],c=m(n.totalDuration,n.results.length);return n.totalDuration!==void 0&&c!==void 0&&o.push(` ${u(`Duration`)} ${v(n.totalDuration)} ${t(`(avg ${v(c)})`)}`),o.push(``,P(n,i.hasAnyInitial,r)),o.join(`
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{t as e}from"./config-VQG8vlqE.mjs";import{_ as t,g as n,h as r,n as i,t as a,v as o,y as s}from"./run-
|
|
1
|
+
import{t as e}from"./config-VQG8vlqE.mjs";import{_ as t,g as n,h as r,n as i,t as a,v as o,y as s}from"./run-lzz8I8UG.mjs";import{glob as c,mkdir as l,readFile as u,stat as d,writeFile as f}from"node:fs/promises";import{createReadStream as p}from"node:fs";import{createInterface as m}from"node:readline/promises";function h(e){let{defaults:t,type:n}=e,r=()=>{let t={async run(t){let{type:n,...r}=t;return{items:await e.run(r),type:`items`}},type:n};return e.setup&&(t.setup=e.setup),e.validate&&(t.validate=e.validate),t};return e=>{let{name:i,...a}=e;return{__runnerFactory:r,config:{type:n,...t,...a},id:i}}}function g(){let e=new WeakSet;return(t,n)=>{if(n&&typeof n==`object`){if(e.has(n))return`[Circular]`;if(e.add(n),!Array.isArray(n)){let e=n,t={};for(let n of Object.keys(e).toSorted()){let r=e[n];typeof r==`function`||typeof r==`symbol`||(t[n]=r)}return t}}return n}}function _(e){return i(JSON.stringify(e??null,g()))}function v(e,t=process.cwd()){return o(t,`node_modules`,`.cache`,`mejora`,e)}async function y(e){try{let t=await u(e,`utf8`);return JSON.parse(t)}catch{return{}}}async function b(e,t){try{await f(e,JSON.stringify(t),`utf8`)}catch{}}async function x(e){try{let t=await d(e);return`${t.mtimeMs}-${t.size}`}catch{return null}}const S=h({async run(e){let{ESLint:n}=await import(`eslint`),r=process.cwd(),i=v(`eslint`,r),a=_(e),{concurrency:o,...s}=e,c=new Set;if(s.rules)for(let e of Object.keys(s.rules))c.add(e);let l=c.size>0,u=await new n({cache:!0,cacheLocation:`${i}/${a}.eslintcache`,overrideConfig:s,...!l&&{concurrency:o??`auto`},...l&&{ruleFilter:({ruleId:e})=>c.has(e)}}).lintFiles(s.files),d=[];for(let{filePath:e,messages:n}of u){let i=t(r,e);for(let{column:e,line:t,message:r,ruleId:a}of n)a&&d.push({column:e,file:i,line:t,message:r,rule:a})}return d},async setup(){let e=v(`eslint`,process.cwd()),{mkdir:t}=await import(`node:fs/promises`);await t(e,{recursive:!0})},type:`eslint`,async validate(){try{await import(`eslint`)}catch{throw Error(`eslint check requires "eslint" package to be installed. Run: npm install eslint`)}}}),C=[`**/node_modules/**`,`**/dist/**`,`**/.git/**`],w=/^([^*]+\/)/,T=/^\*\*\//;function E(e,t){if(t?.length)return t;let n=e.map(e=>w.exec(e)?.[1]).filter(e=>e!==void 0);return[...C,...n.flatMap(e=>C.map(t=>t.replace(T,e)))]}async function D(e,t,n){let r=Array.from({length:e.length}),i=0;return await Promise.all(Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let t=i++;r[t]=await n(e[t])}})),r}const O=h({async run(e){let t=process.cwd(),r=Array.isArray(e.files)?e.files:[e.files],i=E(r,e.ignore),a=await Promise.all(r.map(e=>Array.fromAsync(c(e,{cwd:t,exclude:i})))),o=[...new Set(a.flat())],s=e.patterns.map(({message:e,pattern:t,rule:n})=>{let r=t.flags.includes(`g`)?t.flags:`${t.flags}g`;return{message:e,regex:new RegExp(t.source,r),ruleText:n??t.source}}),l=n(v(`regex`,t),`${_(e)}.json`),u=await y(l),d={},f=(await D(o,e.concurrency??10,async e=>{let r=n(t,e),i=await x(r);if(!i)return[];let a=u[e];if(a?.hash===i)return d[e]=a,a.items;try{let t=[],n=m({crlfDelay:1/0,input:p(r,{encoding:`utf8`})}),a=0;try{for await(let r of n){a++;for(let n of s){n.regex.lastIndex=0;let i;for(;(i=n.regex.exec(r))!==null;){let r=i.index+1,o=typeof n.message==`function`?n.message(i):n.message??`Pattern matched: ${i[0]}`;t.push({column:r,file:e,line:a,message:o,rule:n.ruleText})}}}}finally{n.close()}return d[e]={hash:i,items:t},t}catch{return[]}})).flat();return await b(l,d),f},async setup(){await l(v(`regex`,process.cwd()),{recursive:!0})},type:`regex`}),k=/import\("([^"]+)"\)/g;function A(e,n){return e.replaceAll(k,(e,i)=>{try{if(r(i)){let e=t(n,i);if(!e.startsWith(`..`))return`import("${e||`.`}")`}}catch{}return e})}const j=h({async run(e){let{createIncrementalCompilerHost:n,createIncrementalProgram:r,findConfigFile:i,flattenDiagnosticMessageText:a,getPreEmitDiagnostics:c,parseJsonConfigFileContent:l,readConfigFile:u,sys:d,version:f}=await import(`typescript`),p=process.cwd(),m=d.fileExists.bind(d),h=d.readFile.bind(d),g=e.tsconfig?o(e.tsconfig):i(p,m,`tsconfig.json`);if(!g)throw Error(`TypeScript config file not found`);let{config:y,error:b}=u(g,h);if(b){let e=typeof b.messageText==`string`?b.messageText:a(b.messageText,`
|
|
2
2
|
`);throw TypeError(`Failed to read TypeScript config: ${e}`)}let x=l(y,d,p,e.compilerOptions),S=o(v(`typescript`,p),`${_({compilerOptions:e.compilerOptions??{},configPath:g,parsedOptions:x.options,typescriptVersion:f})}.tsbuildinfo`),C={...x.options,incremental:!0,noEmit:!0,skipLibCheck:x.options.skipLibCheck??!0,tsBuildInfoFile:S},w=n(C,d),T=w.writeFile.bind(w);w.writeFile=(e,t,...n)=>{o(e)===S&&T(e,t,...n)};let E=r({host:w,options:C,projectReferences:x.projectReferences??[],rootNames:x.fileNames}),D=c(E.getProgram());E.emit();let O=o(p),k=O+s,j=D.filter(e=>{if(!e.file)return!0;let t=o(e.file.fileName);return t===O||t.startsWith(k)}),M=[];for(let e of j){let n=a(e.messageText,`
|
|
3
3
|
`),r=`TS${e.code}`;if(e.file&&e.start!==void 0){let{character:i,line:a}=e.file.getLineAndCharacterOfPosition(e.start),o=t(p,e.file.fileName);M.push({column:i+1,file:o,line:a+1,message:A(n,p),rule:r})}else M.push({column:0,file:`(global)`,line:0,message:A(n,p),rule:r})}return M},async setup(){let e=v(`typescript`,process.cwd()),{mkdir:t}=await import(`node:fs/promises`);await t(e,{recursive:!0})},type:`typescript`,async validate(){try{await import(`typescript`)}catch{throw Error(`typescript check requires "typescript" package to be installed. Run: npm install typescript`)}}});export{h as defineCheck,e as defineConfig,S as eslint,O as regex,a as run,j as typescript};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{n as e,r as t}from"./config-VQG8vlqE.mjs";import{inspect as n,styleText as r}from"node:util";import{fileURLToPath as i}from"node:url";import{Worker as a}from"node:worker_threads";import{hash as o}from"node:crypto";import{mkdir as s,readFile as c,writeFile as l}from"node:fs/promises";const u=/^[A-Za-z]:\//;function d(e=``){return e&&e.replace(/\\/g,`/`).replace(u,e=>e.toUpperCase())}const f=/^[/\\]{2}/,p=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,m=/^[A-Za-z]:$/,h=/^\/([A-Za-z]:)?$/,ee=`/`,te=function(e){if(e.length===0)return`.`;e=d(e);let t=e.match(f),n=v(e),r=e[e.length-1]===`/`;return e=_(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),m.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!v(e)?`/${e}`:e)},ne=function(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return te(t)};function re(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const g=function(...e){e=e.map(e=>d(e));let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:re();!i||i.length===0||(t=`${i}/${t}`,n=v(i))}return t=_(t,!n),n&&!v(t)?`/${t}`:t.length>0?t:`.`};function _(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 v=function(e){return p.test(e)},y=function(e,t){let n=g(e).replace(h,`$1`).split(`/`),r=g(t).replace(h,`$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(`/`)},b=function(e){let t=d(e).replace(/\/$/,``).split(`/`).slice(0,-1);return t.length===1&&m.test(t[0])&&(t[0]+=`/`),t.join(`/`)||(v(e)?`/`:`.`)},ie=function(e,t){let n=d(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=>t=>r(e,typeof t==`number`?t.toString():t),ae=x(`blue`),oe=x(`bold`),se=x(`cyan`),S=x(`dim`),C=x(`green`),w=x(`red`),ce=x(`gray`),le=x(`underline`),ue=x(`yellow`);function T(e,t){return e===1?t:`${t}s`}function de(e){let t=[e.message];if(e.stack){let n=e.stack.split(`
|
|
2
|
+
`).slice(1).map(e=>S(e.trim())).join(`
|
|
3
|
+
`);t.push(n)}return t.join(`
|
|
4
|
+
`)}function E(...e){return e.map(e=>typeof e==`string`?e:e instanceof Error?de(e):n(e,{colors:!1,depth:10})).join(` `)}const D={error:(...e)=>{console.error(w(`✖`),E(...e))},log:(...e)=>{console.log(E(...e))},start:(...e)=>{console.error(se(`◐`),E(...e))},success:(...e)=>{console.error(C(`✔`),E(...e))}},O=e=>o(`sha256`,e,`hex`);function k(e,t){return e.file===t.file?e.line===t.line?e.column-t.column:e.line-t.line:e.file<t.file?-1:1}function fe(e){return`${e.file} - ${e.rule}: ${e.message}`}function pe(e){let t=Map.groupBy(e,fe),n=[];for(let[e,r]of t){r.sort(k);for(let[t,i]of r.entries())n.push({...i,id:O(`${e}:${t}`)})}return n}function A(e){return{items:pe(e.items).toSorted(k),type:`items`}}const j=`__unparsable__`,me={"<":`<`,">":`>`,"[":`[`,"]":`]`},he=/[<>[\]]/g;function M(e){return e.replaceAll(he,e=>me[e])}function N(e,t,n){let r=y(t,e);return n?`${r}#L${n}`:r}function P(e,t){return`[${e}](${t})`}function F(e,t){let n=N(e.file,t,e.line);return`- ${P(e.line?`Line ${e.line}`:e.file,n)} - ${`${e.rule}: ${M(e.message)}`}`}function I(e){let t=Object.groupBy(e,e=>e.file||j);return Object.entries(t).map(([e,t=[]])=>({filePath:e,items:t})).toSorted((e,t)=>e.filePath===j?1:t.filePath===j||e.filePath<t.filePath?-1:e.filePath>t.filePath?1:0)}function L(e,t){let n=e.length,r=T(n,`issue`),i=[`\n### Other Issues · ${t}\n`];for(let t of e)i.push(`- ${t.rule}: ${M(t.message)}`);return i.push(`\n${n} ${r} in Other Issues`,``),i.join(`
|
|
5
|
+
`)}function R(e,t,n){if(e.filePath===j)return L(e.items,n);let r=N(e.filePath,t),i=P(e.filePath,r),a=e.items.length,o=T(a,`issue`),s=[`\n### ${i} · ${n}\n`];for(let n of e.items)s.push(F(n,t));return s.push(`\n${a} ${o} in ${e.filePath}`,``),s.join(`
|
|
6
|
+
`)}function ge(e,t,n){let r=t.length,i=T(r,`issue`),a=[`\n## ${e}\n`];if(t.length===0)return a.push(`No issues`),a.join(`
|
|
7
|
+
`);let o=I(t);for(let t of o)a.push(R(t,n,e));return a.push(`---\n${r} total ${i} for ${e}`),a.join(`
|
|
8
|
+
`)}function z(e){return`${e.replaceAll(/\n{3,}/g,`
|
|
9
|
+
|
|
10
|
+
`).trimEnd()}\n`}function B(e,t){let n=[`<!-- prettier-ignore-start -->
|
|
11
|
+
`,`# Mejora Baseline
|
|
12
|
+
`,`This file represents the current accepted state of the codebase.`];for(let[r,{items:i=[]}]of Object.entries(e.checks))n.push(ge(r,i,t));return n.push(`
|
|
13
|
+
<!-- prettier-ignore-end -->`),z(n.join(`
|
|
14
|
+
`))}const _e=[`CI`,`CONTINUOUS_INTEGRATION`].some(e=>process.env[e]&&process.env[e]!==`0`&&process.env[e]!==`false`),V=(e,t)=>e.id<t.id?-1:e.id>t.id?1:0;function ve(){return{hasImprovement:!1,hasRegression:!1,hasRelocation:!1,isInitial:!0,newIssues:[],removedIssues:[]}}function ye(e,t,n){return{hasImprovement:t.length>0,hasRegression:e.length>0,hasRelocation:n,isInitial:!1,newIssues:e.toSorted(V),removedIssues:t.toSorted(V)}}function H(e=[]){return new Map(e.map(e=>[e.id,e]))}function U(e){return new Set(e.keys())}function W(e,t){let n=[];for(let r of t){let t=e.get(r);n.push(t)}return n}function be(e,t){for(let[n,r]of e){let e=t.get(n);if(e&&(r.line!==e.line||r.column!==e.column))return!0}return!1}function xe(e,t){let n=H(e.items),r=H(t.items),i=U(n),a=U(r),o=i.difference(a),s=a.difference(i);return ye(W(n,o),W(r,s),i.size>o.size?be(n,r):!1)}function G(e,t){return t?xe(e,t):ve()}const K=(e,t)=>{if(!t)return!1;let n=e.items,r=t.items;if(n.length!==r.length)return!1;let i=n.toSorted(V),a=r.toSorted(V);return i.every((e,t)=>{let n=a[t];return e.id===n.id&&e.file===n.file&&e.line===n.line&&e.column===n.column&&e.rule===n.rule&&e.message===n.message})};function Se(e,t){let n=e;for(let e=0;e<t;e++){let e=n.trimEnd();if(!e.endsWith(`}`))break;n=e.slice(0,-1)}return n}function Ce(e,t){return`${e}${`
|
|
15
|
+
}`.repeat(t)}`}function we(e){let t=0;for(let n of e)n===`{`?t++:n===`}`&&t--;return t===0?e:t<0?Se(e,-t):Ce(e,t)}function q(e){try{return JSON.parse(e)}catch{return}}function J(e){let t=e.trim();return t.endsWith(`,`)?t.slice(0,-1):t}function Te(e){let t=J(e);return`{
|
|
16
|
+
"version": ${JSON.stringify(2)},
|
|
17
|
+
${t}
|
|
18
|
+
}`}function Ee(e){return`checks`in e&&e.checks!==null&&typeof e.checks==`object`}function Y(e){if(typeof e!=`object`||!e)throw TypeError(`Baseline must be an object`);if(Ee(e))return{checks:e.checks,version:2};let t={};for(let[n,r]of Object.entries(e))n!==`version`&&(t[n]=r);return{checks:t,version:2}}const De={checks:{},version:2};function X(e){try{let t=e.trim();if(t===``)return De;let n=q(t);if(n!==void 0)return Y(n);let r=Te(we(J(t)));return Y(JSON.parse(r))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to parse baseline during conflict resolution: ${t}`,{cause:e})}}const Z=/^<<<<<<< .+\r?\n([\s\S]*?)^=======(?:\r?\n([\s\S]*?)\r?\n?^>>>>>>> .+$|>>>>>>> .+$)/gm;function Oe(e,t){let n=e;for(let e=t.length-1;e>=0;e--){let r=t[e];if(!r)continue;let i=(r[1]??``).trim(),a=(r[2]??``).trim(),o=r.index,s=o+r[0].length,c=i&&a?`${i},\n${a}`:i||a;n=n.slice(0,o)+c+n.slice(s)}let r=q(n);if(r!==void 0)try{return Q([Y(r)])}catch{return}}function ke(e){let t=[...e.matchAll(Z)];if(t.length===0)return;for(let[,n=``,r=``]of t)if(n.includes(`{`)||r.includes(`{`)){let i=q(`[${J(n.trim())}]`),a=q(`[${J(r.trim())}]`);return Array.isArray(i)&&Array.isArray(a)?Oe(e,t):void 0}let n=e;for(let e=t.length-1;e>=0;e--){let r=t[e];if(!r)continue;let i=(r[1]??``).trimEnd(),a=r.index,o=a+r[0].length;n=n.slice(0,a)+i+n.slice(o)}let r=q(n);if(r!==void 0)try{return Y(r)}catch{return}}function Ae(e){let t=[...e.matchAll(Z)];if(t.length===0)throw Error(`Could not parse conflict markers in baseline`);return t.map(([,e=``,t=``])=>({ours:e,theirs:t}))}function Q(e){let t=new Map;for(let n of e)for(let[e,{items:r=[]}]of Object.entries(n.checks)){if(r.length===0)continue;let n=t.get(e);n===void 0&&(n=new Map,t.set(e,n));for(let e of r)n.set(e.id,e)}let n={};for(let[e,r]of t)n[e]={items:[...r.values()].toSorted(V),type:`items`};return{checks:n,version:2}}function je(e){let t=ke(e);if(t!==void 0)return t;let n=Ae(e),r=[];for(let{ours:e,theirs:t}of n)r.push(X(e),X(t));return Q(r)}var $=class e{baselineDir;baselinePath;mdPath;constructor(e=`.mejora/baseline.json`){this.baselinePath=e,this.baselineDir=b(e),this.mdPath=e.replace(/\.json$/,`.md`)}static batchUpdate(t,n){let r=t??e.create({}),i={...r.checks},a=!1;for(let{checkId:e,entry:t}of n)K(t,r.checks[e])||(i[e]=t,a=!0);return a?{...r,checks:i}:r}static create(e){return{checks:e,version:2}}static getEntry(e,t){return e?.checks[t]}static prune(e,t){let n=new Set(t),r=Object.keys(e.checks).filter(e=>!n.has(e));if(r.length===0)return{baseline:e,prunedIds:r};let i=Object.fromEntries(Object.entries(e.checks).filter(([e])=>n.has(e)));return{baseline:{...e,checks:i},prunedIds:r}}static update(t,n,r){let i=t??e.create({}),a=i.checks[n];return K(r,a)?i:{...i,checks:{...i.checks,[n]:r}}}async load(){try{let e=await c(this.baselinePath,`utf8`);if(e.includes(`<<<<<<<`)){D.start(`Merge conflict detected in baseline, auto-resolving...`);let t=je(e);return await this.save(t,!0),D.success(`Baseline conflict resolved`),t}let t=JSON.parse(e);return await this.resolveMarkdownConflictIfNeeded(t),t}catch(e){if(e.code===`ENOENT`)return null;throw e}}async save(e,t=!1){if(_e&&!t)return;let n=`${JSON.stringify(e,null,2)}\n`,r=B(e,this.baselineDir);await s(this.baselineDir,{recursive:!0}),await Promise.all([l(this.baselinePath,n,`utf8`),l(this.mdPath,r,`utf8`)])}async resolveMarkdownConflictIfNeeded(e){try{if((await c(this.mdPath,`utf8`)).includes(`<<<<<<<`)){D.start(`Merge conflict detected in markdown report, regenerating...`);let t=B(e,this.baselineDir);await l(this.mdPath,t,`utf8`),D.success(`Markdown report regenerated`)}}catch{}}};const Me=i(new URL(`workers/check.mjs`,import.meta.url));var Ne=class e{baselineManager;cwd;registry;constructor(e,t,n=process.cwd()){this.registry=e,this.baselineManager=new $(t),this.cwd=n}static async executeChecksParallel(t,n,r){try{let i=t.map(async t=>{let i=await e.executeWorker(t.id,r),a=A(i.snapshot),o=$.getEntry(n,t.id),s=G(a,o);return{baseline:o,checkId:t.id,duration:i.duration,hasImprovement:s.hasImprovement,hasRegression:s.hasRegression,hasRelocation:s.hasRelocation,isInitial:s.isInitial,newIssues:s.newIssues,removedIssues:s.removedIssues,snapshot:a}});return await Promise.all(i)}catch(e){return D.error(`Parallel execution failed:`,e),null}}static async executeWorker(e,t){return new Promise((n,r)=>{let i=new a(Me,{workerData:{checkId:e,cwd:t}});i.on(`message`,n),i.on(`error`,r),i.on(`exit`,e=>{e!==0&&r(Error(`Worker stopped with exit code ${e}`))})})}static filterChecks=(t,n)=>{let r=n.only?e.resolveRegex(n.only,`--only`):null,i=n.skip?e.resolveRegex(n.skip,`--skip`):null;return!r&&!i?t:t.filter(e=>!(r&&!r.test(e.id)||i?.test(e.id)))};static resolveRegex(e,t){try{return new RegExp(e)}catch{throw Error(`Invalid regex pattern for ${t}: "${e}"`)}}async run(t,n={}){let r=performance.now(),i=await this.baselineManager.load(),a=e.filterChecks(t.checks,n),o=a.length;D.start(`Running ${o} check${o===1?``:`s`}...`);let s=o>1?await e.executeChecksParallel(a,i,this.cwd):await this.executeChecksSequential(a,i);if(!s)return{exitCode:2,hasImprovement:!1,hasRegression:!0,results:[],totalDuration:performance.now()-r};let c=!1,l=!1,u=!1,d=[];for(let e of s)e.hasRegression&&(c=!0),e.hasImprovement&&(l=!0),e.isInitial&&(u=!0),(e.hasImprovement||e.hasRelocation||n.force||e.isInitial)&&d.push({checkId:e.checkId,entry:{items:e.snapshot.items,type:e.snapshot.type}});let f=d.length>0?$.batchUpdate(i,d):i??(s.length>0?$.create({}):null),p=!!(n.only??n.skip),{baseline:m,prunedIds:h}=f!==null&&!p?$.prune(f,t.checks.map(e=>e.id)):{baseline:f,prunedIds:[]};return m!==null&&m!==i&&(!c||(n.force??!1)||u||h.length>0)&&await this.baselineManager.save(m,n.force),{exitCode:c&&!n.force?1:0,hasImprovement:l,hasRegression:c,results:s,totalDuration:performance.now()-r}}async executeChecksSequential(e,n){try{let n=t.getRequiredTypes(e);await Promise.all([this.registry.setup(n),this.registry.validate(n)])}catch(e){return D.error(`Setup failed:`,e),null}let r=[];for(let t of e)try{let e=performance.now(),i=await this.registry.get(t.config.type).run(t.config),a=performance.now()-e,o=A(i),s=$.getEntry(n,t.id),c=G(o,s);r.push({baseline:s,checkId:t.id,duration:a,hasImprovement:c.hasImprovement,hasRegression:c.hasRegression,hasRelocation:c.hasRelocation,isInitial:c.isInitial,newIssues:c.newIssues,removedIssues:c.removedIssues,snapshot:o})}catch(e){return D.error(`Error running check "${t.id}":`,e),null}return r}};async function Pe(n={}){let{config:r,...i}=n,a=r??await e(),o=new t;return o.init(a),new Ne(o).run(a,i)}export{y as _,ae as a,ce as c,le as d,ue as f,ne as g,v as h,T as i,C as l,b as m,O as n,oe as o,ie as p,D as r,S as s,Pe as t,w as u,g as v,ee as y};
|
package/dist/run.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./config-VQG8vlqE.mjs";import{t as e}from"./run-
|
|
1
|
+
import"./config-VQG8vlqE.mjs";import{t as e}from"./run-lzz8I8UG.mjs";export{e as run};
|
package/package.json
CHANGED
package/dist/run-B9dk_cJ1.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./config-VQG8vlqE.mjs";import{inspect as n,styleText as r}from"node:util";import{fileURLToPath as i}from"node:url";import{Worker as a}from"node:worker_threads";import{hash as o}from"node:crypto";import{mkdir as s,readFile as c,writeFile as l}from"node:fs/promises";import{env as u}from"node:process";const d=/^[A-Za-z]:\//;function f(e=``){return e&&e.replace(/\\/g,`/`).replace(d,e=>e.toUpperCase())}const p=/^[/\\]{2}/,m=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,h=/^[A-Za-z]:$/,g=/^\/([A-Za-z]:)?$/,ee=`/`,te=function(e){if(e.length===0)return`.`;e=f(e);let t=e.match(p),n=b(e),r=e[e.length-1]===`/`;return e=y(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),h.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!b(e)?`/${e}`:e)},_=function(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return te(t)};function ne(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const v=function(...e){e=e.map(e=>f(e));let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:ne();!i||i.length===0||(t=`${i}/${t}`,n=b(i))}return t=y(t,!n),n&&!b(t)?`/${t}`:t.length>0?t:`.`};function y(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 b=function(e){return m.test(e)},x=function(e,t){let n=v(e).replace(g,`$1`).split(`/`),r=v(t).replace(g,`$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(`/`)},S=function(e){let t=f(e).replace(/\/$/,``).split(`/`).slice(0,-1);return t.length===1&&h.test(t[0])&&(t[0]+=`/`),t.join(`/`)||(b(e)?`/`:`.`)},re=function(e,t){let n=f(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},C=e=>t=>r(e,typeof t==`number`?t.toString():t),ie=C(`blue`),ae=C(`bold`),oe=C(`cyan`),w=C(`dim`),T=C(`green`),E=C(`red`),D=C(`gray`),O=C(`underline`),k=C(`yellow`);function A(e,t){return e===1?t:`${t}s`}function se(e){let t=[e.message];if(e.stack){let n=e.stack.split(`
|
|
2
|
-
`).slice(1).map(e=>w(e.trim())).join(`
|
|
3
|
-
`);t.push(n)}return t.join(`
|
|
4
|
-
`)}function j(...e){return e.map(e=>typeof e==`string`?e:e instanceof Error?se(e):n(e,{colors:!1,depth:10})).join(` `)}const M={error:(...e)=>{console.error(E(`✖`),j(...e))},log:(...e)=>{console.log(j(...e))},start:(...e)=>{console.error(oe(`◐`),j(...e))},success:(...e)=>{console.error(T(`✔`),j(...e))}},N=e=>o(`sha256`,e,`hex`);function P(e,t){return e.file===t.file?e.line===t.line?e.column-t.column:e.line-t.line:e.file<t.file?-1:1}function ce(e){return`${e.file} - ${e.rule}: ${e.message}`}function le(e){let t=Map.groupBy(e,ce),n=[];for(let[e,r]of t){r.sort(P);for(let[t,i]of r.entries())n.push({...i,id:N(`${e}:${t}`)})}return n}function F(e){return{items:le(e.items).toSorted(P),type:`items`}}const I=`__unparsable__`,ue={"<":`<`,">":`>`,"[":`[`,"]":`]`},de=/[<>[\]]/g;function L(e){return e.replaceAll(de,e=>ue[e])}function R(e,t,n){let r=x(t,e);return n?`${r}#L${n}`:r}function z(e,t){return`[${e}](${t})`}function B(e,t){let n=R(e.file,t,e.line);return`- ${z(e.line?`Line ${e.line}`:e.file,n)} - ${`${e.rule}: ${L(e.message)}`}`}function V(e){let t=Object.groupBy(e,e=>e.file||I);return Object.entries(t).map(([e,t=[]])=>({filePath:e,items:t})).toSorted((e,t)=>e.filePath===I?1:t.filePath===I||e.filePath<t.filePath?-1:e.filePath>t.filePath?1:0)}function H(e,t){let n=e.length,r=A(n,`issue`),i=[`\n### Other Issues · ${t}\n`];for(let t of e)i.push(`- ${t.rule}: ${L(t.message)}`);return i.push(`\n${n} ${r} in Other Issues`,``),i.join(`
|
|
5
|
-
`)}function fe(e,t,n){if(e.filePath===I)return H(e.items,n);let r=R(e.filePath,t),i=z(e.filePath,r),a=e.items.length,o=A(a,`issue`),s=[`\n### ${i} · ${n}\n`];for(let n of e.items)s.push(B(n,t));return s.push(`\n${a} ${o} in ${e.filePath}`,``),s.join(`
|
|
6
|
-
`)}function pe(e,t,n){let r=t.length,i=A(r,`issue`),a=[`\n## ${e}\n`];if(t.length===0)return a.push(`No issues`),a.join(`
|
|
7
|
-
`);let o=V(t);for(let t of o)a.push(fe(t,n,e));return a.push(`---\n${r} total ${i} for ${e}`),a.join(`
|
|
8
|
-
`)}function me(e){return`${e.replaceAll(/\n{3,}/g,`
|
|
9
|
-
|
|
10
|
-
`).trimEnd()}\n`}function U(e,t){let n=[`<!-- prettier-ignore-start -->
|
|
11
|
-
`,`# Mejora Baseline
|
|
12
|
-
`,`This file represents the current accepted state of the codebase.`];for(let[r,{items:i=[]}]of Object.entries(e.checks))n.push(pe(r,i,t));return n.push(`
|
|
13
|
-
<!-- prettier-ignore-end -->`),me(n.join(`
|
|
14
|
-
`))}const he=[`CI`,`CONTINUOUS_INTEGRATION`].some(e=>u[e]&&u[e]!==`0`&&u[e]!==`false`),W=(e,t)=>e.id<t.id?-1:e.id>t.id?1:0;function ge(){return{hasImprovement:!1,hasRegression:!1,hasRelocation:!1,isInitial:!0,newIssues:[],removedIssues:[]}}function _e(e,t,n){return{hasImprovement:t.length>0,hasRegression:e.length>0,hasRelocation:n,isInitial:!1,newIssues:e.toSorted(W),removedIssues:t.toSorted(W)}}function G(e=[]){return new Map(e.map(e=>[e.id,e]))}function K(e){return new Set(e.keys())}function q(e,t){let n=[];for(let r of t){let t=e.get(r);n.push(t)}return n}function ve(e,t){for(let[n,r]of e){let e=t.get(n);if(e&&(r.line!==e.line||r.column!==e.column))return!0}return!1}function ye(e,t){let n=G(e.items),r=G(t.items),i=K(n),a=K(r),o=i.difference(a),s=a.difference(i);return _e(q(n,o),q(r,s),i.size>o.size?ve(n,r):!1)}function J(e,t){return t?ye(e,t):ge()}const Y=(e,t)=>{if(!t)return!1;let n=e.items,r=t.items;if(n.length!==r.length)return!1;let i=n.toSorted(W),a=r.toSorted(W);return i.every((e,t)=>{let n=a[t];return e.id===n.id&&e.file===n.file&&e.line===n.line&&e.column===n.column&&e.rule===n.rule&&e.message===n.message})};function be(e,t){let n=e;for(let e=0;e<t;e++){let e=n.trimEnd();if(!e.endsWith(`}`))break;n=e.slice(0,-1)}return n}function xe(e,t){return`${e}${`
|
|
15
|
-
}`.repeat(t)}`}function Se(e){let t=0;for(let n of e)n===`{`?t++:n===`}`&&t--;return t===0?e:t<0?be(e,-t):xe(e,t)}function Ce(e){try{return JSON.parse(e)}catch{return}}function X(e){let t=e.trim();return t.endsWith(`,`)?t.slice(0,-1):t}function we(e){return`{
|
|
16
|
-
"version": 2,
|
|
17
|
-
${X(e)}
|
|
18
|
-
}`}function Z(e){if(typeof e!=`object`||!e)throw TypeError(`Baseline must be an object`);if(`checks`in e&&e.checks&&typeof e.checks==`object`)return{checks:e.checks,version:2};let t={};for(let[n,r]of Object.entries(e))n!==`version`&&(t[n]=r);return{checks:t,version:2}}function Q(e){try{let t=e.trim();if(t===``)return{checks:{},version:2};let n=Ce(t);if(n)return Z(n);let r=we(Se(X(t)));return Z(JSON.parse(r))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to parse baseline during conflict resolution: ${t}`,{cause:e})}}function Te(e){let t=[...e.matchAll(/^<<<<<<< .+\r?\n([\s\S]*?)^=======(?:\r?\n([\s\S]*?)\r?\n?^>>>>>>> .+$|>>>>>>> .+$)/gm)];if(t.length===0)throw Error(`Could not parse conflict markers in baseline`);return t.map(([,e=``,t=``])=>({ours:e,theirs:t}))}function Ee(e){let t=new Map;for(let n of e)for(let[e,{items:r=[]}]of Object.entries(n.checks)){if(r.length===0)continue;let n=t.get(e);n||(n=new Map,t.set(e,n));for(let e of r)n.set(e.id,e)}let n={};for(let[e,r]of t)n[e]={items:[...r.values()].toSorted(W),type:`items`};return{checks:n,version:2}}function De(e){let t=Te(e),n=[];for(let{ours:e,theirs:r}of t)n.push(Q(e),Q(r));return Ee(n)}var $=class e{baselineDir;baselinePath;mdPath;constructor(e=`.mejora/baseline.json`){this.baselinePath=e,this.baselineDir=S(e),this.mdPath=e.replace(/\.json$/,`.md`)}static batchUpdate(t,n){let r=t??e.create({}),i={...r.checks},a=!1;for(let{checkId:e,entry:t}of n)Y(t,r.checks[e])||(i[e]=t,a=!0);return a?{...r,checks:i}:r}static create(e){return{checks:e,version:2}}static getEntry(e,t){return e?.checks[t]}static prune(e,t){let n=new Set(t),r=Object.keys(e.checks).filter(e=>!n.has(e));if(r.length===0)return{baseline:e,prunedIds:r};let i=Object.fromEntries(Object.entries(e.checks).filter(([e])=>n.has(e)));return{baseline:{...e,checks:i},prunedIds:r}}static update(t,n,r){let i=t??e.create({}),a=i.checks[n];return Y(r,a)?i:{...i,checks:{...i.checks,[n]:r}}}async load(){try{let e=await c(this.baselinePath,`utf8`);if(e.includes(`<<<<<<<`)){M.start(`Merge conflict detected in baseline, auto-resolving...`);let t=De(e);return await this.save(t,!0),M.success(`Baseline conflict resolved`),t}let t=JSON.parse(e);return await this.resolveMarkdownConflictIfNeeded(t),t}catch(e){if(e.code===`ENOENT`)return null;throw e}}async save(e,t=!1){if(he&&!t)return;let n=`${JSON.stringify(e,null,2)}\n`,r=U(e,this.baselineDir);await s(this.baselineDir,{recursive:!0}),await Promise.all([l(this.baselinePath,n,`utf8`),l(this.mdPath,r,`utf8`)])}async resolveMarkdownConflictIfNeeded(e){try{if((await c(this.mdPath,`utf8`)).includes(`<<<<<<<`)){M.start(`Merge conflict detected in markdown report, regenerating...`);let t=U(e,this.baselineDir);await l(this.mdPath,t,`utf8`),M.success(`Markdown report regenerated`)}}catch{}}};const Oe=i(new URL(`workers/check.mjs`,import.meta.url));var ke=class e{baselineManager;cwd;registry;constructor(e,t,n=process.cwd()){this.registry=e,this.baselineManager=new $(t),this.cwd=n}static async executeChecksParallel(t,n,r){try{let i=t.map(async t=>{let i=await e.executeWorker(t.id,r),a=F(i.snapshot),o=$.getEntry(n,t.id),s=J(a,o);return{baseline:o,checkId:t.id,duration:i.duration,hasImprovement:s.hasImprovement,hasRegression:s.hasRegression,hasRelocation:s.hasRelocation,isInitial:s.isInitial,newIssues:s.newIssues,removedIssues:s.removedIssues,snapshot:a}});return await Promise.all(i)}catch(e){return M.error(`Parallel execution failed:`,e),null}}static async executeWorker(e,t){return new Promise((n,r)=>{let i=new a(Oe,{workerData:{checkId:e,cwd:t}});i.on(`message`,n),i.on(`error`,r),i.on(`exit`,e=>{e!==0&&r(Error(`Worker stopped with exit code ${e}`))})})}static filterChecks=(t,n)=>{let r=n.only?e.resolveRegex(n.only,`--only`):null,i=n.skip?e.resolveRegex(n.skip,`--skip`):null;return!r&&!i?t:t.filter(e=>!(r&&!r.test(e.id)||i?.test(e.id)))};static resolveRegex(e,t){try{return new RegExp(e)}catch{throw Error(`Invalid regex pattern for ${t}: "${e}"`)}}async run(t,n={}){let r=performance.now(),i=await this.baselineManager.load(),a=e.filterChecks(t.checks,n),o=a.length;M.start(`Running ${o} check${o===1?``:`s`}...`);let s=o>1?await e.executeChecksParallel(a,i,this.cwd):await this.executeChecksSequential(a,i);if(!s)return{exitCode:2,hasImprovement:!1,hasRegression:!0,results:[],totalDuration:performance.now()-r};let c=!1,l=!1,u=!1,d=[];for(let e of s)e.hasRegression&&(c=!0),e.hasImprovement&&(l=!0),e.isInitial&&(u=!0),(e.hasImprovement||e.hasRelocation||n.force||e.isInitial)&&d.push({checkId:e.checkId,entry:{items:e.snapshot.items,type:e.snapshot.type}});let f=d.length>0?$.batchUpdate(i,d):i??(s.length>0?$.create({}):null),p=!!(n.only??n.skip),{baseline:m,prunedIds:h}=f!==null&&!p?$.prune(f,t.checks.map(e=>e.id)):{baseline:f,prunedIds:[]};return m!==null&&m!==i&&(!c||(n.force??!1)||u||h.length>0)&&await this.baselineManager.save(m,n.force),{exitCode:c&&!n.force?1:0,hasImprovement:l,hasRegression:c,results:s,totalDuration:performance.now()-r}}async executeChecksSequential(e,n){try{let n=t.getRequiredTypes(e);await Promise.all([this.registry.setup(n),this.registry.validate(n)])}catch(e){return M.error(`Setup failed:`,e),null}let r=[];for(let t of e)try{let e=performance.now(),i=await this.registry.get(t.config.type).run(t.config),a=performance.now()-e,o=F(i),s=$.getEntry(n,t.id),c=J(o,s);r.push({baseline:s,checkId:t.id,duration:a,hasImprovement:c.hasImprovement,hasRegression:c.hasRegression,hasRelocation:c.hasRelocation,isInitial:c.isInitial,newIssues:c.newIssues,removedIssues:c.removedIssues,snapshot:o})}catch(e){return M.error(`Error running check "${t.id}":`,e),null}return r}};async function Ae(n={}){let{config:r,...i}=n,a=r??await e(),o=new t;return o.init(a),new ke(o).run(a,i)}export{x as _,ie as a,D as c,O as d,k as f,_ as g,b as h,A as i,T as l,S as m,N as n,ae as o,re as p,M as r,w as s,Ae as t,E as u,v,ee as y};
|