mejora 2.3.4 → 2.3.5
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/{check-registry-DHd4j450.mjs → check-registry-BJlMzCIV.mjs} +1 -1
- package/dist/{index-Dr3lmWeD.d.mts → index-DL3YfUFl.d.mts} +4 -5
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/run.mjs +2 -2
- package/dist/workers/check.d.mts +1 -1
- package/dist/workers/check.mjs +1 -1
- package/package.json +1 -5
- /package/dist/{typescript-sQ82Cu7A.mjs → typescript-JQUGT569.mjs} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./typescript-
|
|
1
|
+
import{r as e,t}from"./typescript-JQUGT569.mjs";var n=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)}init(n={}){if(this.register(new e),this.register(new t),n.runners)for(let e of n.runners)this.register(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)}};export{n as t};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as eslint from "eslint";
|
|
2
2
|
import { Linter } from "eslint";
|
|
3
|
-
import * as
|
|
3
|
+
import * as typescript from "typescript";
|
|
4
4
|
import { CompilerOptions } from "typescript";
|
|
5
5
|
|
|
6
6
|
//#region src/types.d.ts
|
|
@@ -336,7 +336,7 @@ declare class ESLintCheckRunner implements CheckRunner {
|
|
|
336
336
|
declare function eslintCheck(config: ESLintCheckConfig): {
|
|
337
337
|
concurrency?: "auto" | "off" | number;
|
|
338
338
|
files: string[];
|
|
339
|
-
overrides?:
|
|
339
|
+
overrides?: eslint.Linter.Config | eslint.Linter.Config[];
|
|
340
340
|
type: "eslint";
|
|
341
341
|
};
|
|
342
342
|
//#endregion
|
|
@@ -362,7 +362,7 @@ declare class TypeScriptCheckRunner implements CheckRunner {
|
|
|
362
362
|
*/
|
|
363
363
|
declare function typescriptCheck(config: TypeScriptCheckConfig): {
|
|
364
364
|
overrides?: {
|
|
365
|
-
compilerOptions?:
|
|
365
|
+
compilerOptions?: typescript.CompilerOptions;
|
|
366
366
|
};
|
|
367
367
|
tsconfig?: string;
|
|
368
368
|
type: "typescript";
|
|
@@ -407,7 +407,6 @@ declare class RegexCheckRunner implements CheckRunner {
|
|
|
407
407
|
type: "items";
|
|
408
408
|
}>;
|
|
409
409
|
setup(): Promise<void>;
|
|
410
|
-
validate(): Promise<void>;
|
|
411
410
|
}
|
|
412
411
|
declare const regexRunner: () => RegexCheckRunner;
|
|
413
412
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as eslintCheck, c as Issue, d as Snapshot, i as typescriptCheck, l as IssueInput, n as regexRunner, o as CheckRunner, r as defineConfig, s as Config, t as regexCheck, u as RawSnapshot } from "./index-
|
|
1
|
+
import { a as eslintCheck, c as Issue, d as Snapshot, i as typescriptCheck, l as IssueInput, n as regexRunner, o as CheckRunner, r as defineConfig, s as Config, t as regexCheck, u as RawSnapshot } from "./index-DL3YfUFl.mjs";
|
|
2
2
|
export { CheckRunner, Config, Issue, IssueInput, RawSnapshot, Snapshot, defineConfig, eslintCheck as eslint, eslintCheck, regexCheck as regex, regexCheck, regexRunner, typescriptCheck as typescript, typescriptCheck };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,h as n,i as r,l as i,n as a,o,p as s,s as c}from"./typescript-
|
|
1
|
+
import{a as e,c as t,h as n,i as r,l as i,n as a,o,p as s,s as c}from"./typescript-JQUGT569.mjs";import{glob as l,mkdir as u}from"node:fs/promises";import{createReadStream as d}from"node:fs";import{createInterface as f}from"node:readline/promises";const p=[`**/node_modules/**`,`**/dist/**`,`**/.git/**`];function m(e,t){if(t?.length)return t;let n=e.map(e=>/^([^*]+\/)/.exec(e)?.[1]).filter(e=>e!==void 0);return[...p,...n.flatMap(e=>p.map(t=>t.replace(/^\*\*\//,e)))]}async function h(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}var g=class{type=`regex`;async run(n){let r=process.cwd(),a=Array.isArray(n.files)?n.files:[n.files],u=m(a,n.ignore),p=new Set;for(let e of a){let t=l(e,{cwd:r,exclude:u});for await(let e of t)p.add(e)}let g=[...p],_=n.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}}),v=s(o(this.type,r),`${e(n)}.json`),y=await t(v),b={},x=await h(g,n.concurrency??10,async e=>{let t=s(r,e),n=await c(t);if(!n)return[];let i=y[e];if(i?.hash===n)return b[e]=i,i.items;try{let r=[],i=f({crlfDelay:1/0,input:d(t,{encoding:`utf8`})}),a=0;try{for await(let t of i){a++;for(let n of _){n.regex.lastIndex=0;let i;for(;(i=n.regex.exec(t))!==null;){let t=i.index+1,o=typeof n.message==`function`?n.message(i):n.message??`Pattern matched: ${i[0]}`;r.push({column:t,file:e,line:a,message:o,rule:n.ruleText})}}}}finally{i.close()}return b[e]={hash:n,items:r},r}catch{return[]}}),S=[];for(let e of x)S.push(...e);return await i(v,b),{items:S,type:`items`}}async setup(){let e=process.cwd();await u(o(this.type,e),{recursive:!0})}};const _=()=>new g;function v(e){return{type:`regex`,...e}}export{n as defineConfig,r as eslint,r as eslintCheck,v as regex,v as regexCheck,_ as regexRunner,a as typescript,a as typescriptCheck};
|
package/dist/run.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{d as e,f as t,g as n,m as r,u as i}from"./typescript-
|
|
2
|
+
import{d as e,f as t,g as n,m as r,u as i}from"./typescript-JQUGT569.mjs";import{t as a}from"./check-registry-BJlMzCIV.mjs";import{fileURLToPath as o}from"node:url";import{mkdir as s,readFile as c,writeFile as l}from"node:fs/promises";import{inspect as u,parseArgs as d,styleText as f}from"node:util";import{Tinypool as p}from"tinypool";import{env as m}from"node:process";const h=e=>t=>f(e,typeof t==`number`?t.toString():t),g=h(`blue`),_=h(`bold`),ee=h(`cyan`),v=h(`dim`),y=h(`green`),b=h(`red`),x=h(`gray`),te=h(`underline`),ne=h(`yellow`);function re(e){let t=[e.message];if(e.stack){let n=e.stack.split(`
|
|
3
3
|
`).slice(1).map(e=>v(e.trim())).join(`
|
|
4
4
|
`);t.push(n)}return t.join(`
|
|
5
|
-
`)}function S(...e){return e.map(e=>typeof e==`string`?e:e instanceof Error?re(e):u(e,{colors:!1,depth:10})).join(` `)}const C={error:(...e)=>{console.error(b(`✖`),S(...e))},log:(...e)=>{console.log(S(...e))},start:(...e)=>{console.log(ee(`◐`),S(...e))},success:(...e)=>{console.log(y(`✔`),S(...e))}};function w(e,t){return e.file===t.file?e.line===t.line?e.column-t.column:e.line-t.line:e.file.localeCompare(t.file)}function ie(e){let t=Map.groupBy(e,e=>e.signature),n=[];for(let[e,r]of t){r.sort(w);for(let[t,{signature:a,...o}]of r.entries())n.push({...o,id:i(`${e}:${t}`)})}return n}function T(e){return{items:ie(e.items.map(e=>({...e,signature:`${e.file} - ${e.rule}: ${e.message}`}))).toSorted(w),type:`items`}}const E=e=>e in m&&m[e]!==`0`&&m[e]!==`false
|
|
5
|
+
`)}function S(...e){return e.map(e=>typeof e==`string`?e:e instanceof Error?re(e):u(e,{colors:!1,depth:10})).join(` `)}const C={error:(...e)=>{console.error(b(`✖`),S(...e))},log:(...e)=>{console.log(S(...e))},start:(...e)=>{console.log(ee(`◐`),S(...e))},success:(...e)=>{console.log(y(`✔`),S(...e))}};function w(e,t){return e.file===t.file?e.line===t.line?e.column-t.column:e.line-t.line:e.file.localeCompare(t.file)}function ie(e){let t=Map.groupBy(e,e=>e.signature),n=[];for(let[e,r]of t){r.sort(w);for(let[t,{signature:a,...o}]of r.entries())n.push({...o,id:i(`${e}:${t}`)})}return n}function T(e){return{items:ie(e.items.map(e=>({...e,signature:`${e.file} - ${e.rule}: ${e.message}`}))).toSorted(w),type:`items`}}const E=e=>e in m&&m[e]!==`0`&&m[e]!==`false`,ae=E(`CI`)||E(`CONTINUOUS_INTEGRATION`);function D(e,t){return e===1?t:`${t}s`}const O=`__unparsable__`;function k(e){return e.replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`[`,`[`).replaceAll(`]`,`]`)}function A(e,t,n){let i=r(t,e);return n?`${i}#L${n}`:i}function j(e,t){return`[${e}](${t})`}function oe(e,t){let n=A(e.file,t,e.line);return`- ${j(e.line?`Line ${e.line}`:e.file,n)} - ${`${e.rule}: ${k(e.message)}`}`}function M(e){let t=Object.groupBy(e,e=>e.file||O);return Object.entries(t).map(([e,t=[]])=>({filePath:e,items:t})).toSorted((e,t)=>e.filePath===O?1:t.filePath===O?-1:e.filePath.localeCompare(t.filePath))}function N(e,t){let n=e.length,r=D(n,`issue`),i=[`\n### Other Issues · ${t}\n`];for(let t of e)i.push(`- ${t.rule}: ${k(t.message)}`);return i.push(`\n${n} ${r} in Other Issues`,``),i.join(`
|
|
6
6
|
`)}function se(e,t,n){if(e.filePath===O)return N(e.items,n);let r=A(e.filePath,t),i=j(e.filePath,r),a=e.items.length,o=D(a,`issue`),s=[`\n### ${i} · ${n}\n`];for(let n of e.items)s.push(oe(n,t));return s.push(`\n${a} ${o} in ${e.filePath}`,``),s.join(`
|
|
7
7
|
`)}function ce(e,t,n){let r=t.length,i=D(r,`issue`),a=[`\n## ${e}\n`];if(t.length===0)return a.push(`No issues`),a.join(`
|
|
8
8
|
`);let o=M(t);for(let t of o)a.push(se(t,n,e));return a.push(`---\n${r} total ${i} for ${e}`),a.join(`
|
package/dist/workers/check.d.mts
CHANGED
package/dist/workers/check.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e}from"../typescript-
|
|
1
|
+
import{g as e}from"../typescript-JQUGT569.mjs";import{t}from"../check-registry-BJlMzCIV.mjs";let n=null,r=null;const i=new Map;async function a({checkId:a}){n||(r??=(async()=>{n=await e()})(),await r);let o=n?.checks[a];if(!o)throw Error(`Check not found in config: ${a}`);let s=i.get(o.type);if(!s){s=new t,s.init(n);let e=new Set([o.type]);await Promise.all([s.setup(e),s.validate(e)]),i.set(o.type,s)}let c=performance.now(),l=await s.get(o.type).run(o);return{duration:performance.now()-c,snapshot:l}}export{a as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mejora",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.5",
|
|
4
4
|
"description": "Prevent regressions. Allow improvement.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"regression",
|
|
@@ -41,16 +41,12 @@
|
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"eslint": "^9.34.0",
|
|
44
|
-
"tinyglobby": "^0.2.0",
|
|
45
44
|
"typescript": "^5.0.0"
|
|
46
45
|
},
|
|
47
46
|
"peerDependenciesMeta": {
|
|
48
47
|
"eslint": {
|
|
49
48
|
"optional": true
|
|
50
49
|
},
|
|
51
|
-
"tinyglobby": {
|
|
52
|
-
"optional": true
|
|
53
|
-
},
|
|
54
50
|
"typescript": {
|
|
55
51
|
"optional": true
|
|
56
52
|
}
|
|
File without changes
|