eslint-cli-bundle 2.0.0 → 2.0.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/config.d.ts CHANGED
@@ -5,8 +5,16 @@
5
5
 
6
6
  import {
7
7
  type Config,
8
+ type ConfigObject,
8
9
  defineConfig,
9
10
  globalIgnores,
11
+ includeIgnoreFile,
10
12
  } from "@eslint/config-helpers";
11
13
 
12
- export { type Config, defineConfig, globalIgnores };
14
+ export {
15
+ type Config,
16
+ type ConfigObject,
17
+ defineConfig,
18
+ globalIgnores,
19
+ includeIgnoreFile,
20
+ };
package/dist/config.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./chunk-qnHZjHhP.js";var t=e((e=>{let t=[`env`,`extends`,`globals`,`ignorePatterns`,`noInlineConfig`,`overrides`,`parser`,`parserOptions`,`reportUnusedDisableDirectives`,`root`],n=new Set([`basePath`,`ignores`,`name`]);function r(e,t){return e.name?e.name:`UserConfig${t}`}function i(e,t){return typeof e==`string`?e:e.name?e.name:`ExtendedConfig${t}`}function a(e){if(Array.isArray(e.plugins))return!0;for(let n of t)if(n in e)return!0;return!1}function o(e){return Object.keys(e).every(e=>n.has(e))}function s(e){let t=e.indexOf(`/`);if(t===-1)return{namespace:``,name:e};let n=e.slice(0,t);if(n[0]===`@`&&n!==`@`){let r=e.indexOf(`/`,t+1);if(r!==-1)return n=e.slice(0,r),{namespace:n,name:e.slice(r+1)}}let r=e.slice(t+1);return{namespace:n,name:r}}function c(e,t,n){let r=t.meta?.namespace;if(!r||r===e||!n.rules&&!n.processor&&!n.language)return n;let i={...n};if(i.rules){let t=Object.keys(i.rules),n={};for(let a=0;a<t.length;a++){let o=t[a],{namespace:c,name:l}=s(o);c===r?n[`${e}/${l}`]=i.rules[o]:n[o]=i.rules[o]}i.rules=n}if(typeof i.processor==`string`){let{namespace:t,name:n}=s(i.processor);t&&t===r&&(i.processor=`${e}/${n}`)}if(typeof i.language==`string`){let{namespace:t,name:n}=s(i.language);t===r&&(i.language=`${e}/${n}`)}return i}function l(e,t,n,r){if(Array.isArray(n))return n.map(n=>l(e,t,n,r));if(a(n))throw TypeError(`Plugin config "${r}" is an eslintrc config and cannot be used in this context.`);return c(e,t,n)}function u(e,t){let{namespace:n,name:r}=s(t),i=e.plugins?.[n];if(!i)throw TypeError(`Plugin "${n}" not found.`);let o=i.configs?.[r];if(o&&(Array.isArray(o)||!a(o)))return l(n,i,o,t);let c=i.configs?.[`flat/${r}`];if(c&&(Array.isArray(c)||!a(c)))return l(n,i,c,t);let u=o||c?`Plugin config "${r}" in plugin "${n}" is an eslintrc config and cannot be used in this context.`:`Plugin config "${r}" not found in plugin "${n}".`;throw TypeError(u)}function*d(e,t=``){for(let n=0;n<e.length;n++){let r=t?`${t}[${n}]`:`[${n}]`;if(Array.isArray(e[n])){yield*d(e[n],r);continue}yield{indexPath:r,value:e[n]}}}function f(e=[],t=[]){if(!t.length)return e.concat();if(!e.length)return t.concat();let n=[];for(let r of e)for(let e of t){let t=[];Array.isArray(r)?t.push(...r):t.push(r),Array.isArray(e)?t.push(...e):t.push(e),n.push(t)}return n}function p(e,t,n,r){let i={...n};return o(n)||(e.files&&(i.files=f(e.files,n.files)),e.ignores&&(i.ignores=e.ignores.concat(n.ignores??[]))),i.name=`${t} > ${r}`,e.basePath&&(i.basePath=e.basePath),i}function m(e,t){if(!e.extends)return[e];if(!Array.isArray(e.extends))throw TypeError("The `extends` property must be an array.");let{extends:n,...r}=e,a=new WeakMap,s=n.map(t=>{if(typeof t==`string`){let n=u(e,t);return Array.isArray(n)?n.forEach((e,n)=>{a.set(e,`${t}[${n}]`)}):a.set(n,t),n}return t}),c=[];for(let{indexPath:n,value:o}of d(s)){let s=o;if(`basePath`in s)throw TypeError("'basePath' in `extends` is not allowed.");if(`extends`in s)throw TypeError(`Nested 'extends' is not allowed.`);let l=t.get(e),u=a.get(o)??i(o,n);c.push(p(r,l,s,u))}return o(r)||c.push(r),c.flat()}function h(e,t){return e.flatMap(e=>m(e,t))}function g(...e){let t=new WeakMap,n=[];if(e.length===0)throw TypeError(`Expected one or more arguments.`);for(let{indexPath:i,value:a}of d(e)){if(typeof a!=`object`||!a)throw TypeError(`Expected an object but received ${String(a)}.`);let e=a;t.set(e,r(e,i)),n.push(e)}return h(n,t)}let _=0;function v(e,t){if(!Array.isArray(e))throw TypeError(`ignorePatterns must be an array`);if(e.length===0)throw TypeError(`ignorePatterns must contain at least one pattern`);let n=_++;return{name:t||`globalIgnores ${n}`,ignores:e}}e.defineConfig=g,e.globalIgnores=v})),n=e(((e,n)=>{let{defineConfig:r,globalIgnores:i}=t();n.exports={defineConfig:r,globalIgnores:i}}))(),r=n.defineConfig,i=n.globalIgnores;export{r as defineConfig,i as globalIgnores};
1
+ import{i as e,t}from"./rolldown-runtime-CN7XbDR5.js";var n=/* @__PURE__ */ t((t=>{var n=e(`node:fs`),r=e(`node:path`);let i=[`env`,`extends`,`globals`,`ignorePatterns`,`noInlineConfig`,`overrides`,`parser`,`parserOptions`,`reportUnusedDisableDirectives`,`root`],a=/* @__PURE__ */ new Set([`basePath`,`ignores`,`name`]);function o(e,t){return e.name?e.name:`UserConfig${t}`}function s(e,t){return typeof e==`string`?e:e.name?e.name:`ExtendedConfig${t}`}function c(e){if(Array.isArray(e.plugins))return!0;for(let t of i)if(t in e)return!0;return!1}function l(e){return Object.keys(e).every(e=>a.has(e))}function u(e){let t=e.indexOf(`/`);if(t===-1)return{namespace:``,name:e};let n=e.slice(0,t);if(n[0]===`@`&&n!==`@`){let r=e.indexOf(`/`,t+1);if(r!==-1)return n=e.slice(0,r),{namespace:n,name:e.slice(r+1)}}let r=e.slice(t+1);return{namespace:n,name:r}}function d(e,t,n){let r=t.meta?.namespace;if(!r||r===e||!n.rules&&!n.processor&&!n.language)return n;let i={...n};if(i.rules){let t=Object.keys(i.rules),n={};for(let a=0;a<t.length;a++){let o=t[a],{namespace:s,name:c}=u(o);s===r?n[`${e}/${c}`]=i.rules[o]:n[o]=i.rules[o]}i.rules=n}if(typeof i.processor==`string`){let{namespace:t,name:n}=u(i.processor);t&&t===r&&(i.processor=`${e}/${n}`)}if(typeof i.language==`string`){let{namespace:t,name:n}=u(i.language);t===r&&(i.language=`${e}/${n}`)}return i}function f(e,t,n,r){if(Array.isArray(n))return n.map(n=>f(e,t,n,r));if(c(n))throw TypeError(`Plugin config "${r}" is an eslintrc config and cannot be used in this context.`);return d(e,t,n)}function p(e,t){let{namespace:n,name:r}=u(t),i=e.plugins?.[n];if(!i)throw TypeError(`Plugin "${n}" not found.`);let a=i.configs?.[r];if(a&&(Array.isArray(a)||!c(a)))return f(n,i,a,t);let o=i.configs?.[`flat/${r}`];if(o&&(Array.isArray(o)||!c(o)))return f(n,i,o,t);let s=a||o?`Plugin config "${r}" in plugin "${n}" is an eslintrc config and cannot be used in this context.`:`Plugin config "${r}" not found in plugin "${n}".`;throw TypeError(s)}function*m(e,t=``){for(let n=0;n<e.length;n++){let r=t?`${t}[${n}]`:`[${n}]`;if(Array.isArray(e[n])){yield*m(e[n],r);continue}yield{indexPath:r,value:e[n]}}}function h(e=[],t=[]){if(!t.length)return e.concat();if(!e.length)return t.concat();let n=[];for(let r of e)for(let e of t){let t=[];Array.isArray(r)?t.push(...r):t.push(r),Array.isArray(e)?t.push(...e):t.push(e),n.push(t)}return n}function g(e,t,n,r){let i={...n};return l(n)||(e.files&&(i.files=h(e.files,n.files)),e.ignores&&(i.ignores=e.ignores.concat(n.ignores??[]))),i.name=`${t} > ${r}`,e.basePath&&(i.basePath=e.basePath),i}function _(e,t){if(!e.extends)return[e];if(!Array.isArray(e.extends))throw TypeError("The `extends` property must be an array.");let{extends:n,...r}=e,i=/* @__PURE__ */ new WeakMap,a=n.map(t=>{if(typeof t==`string`){let n=p(e,t);return Array.isArray(n)?n.forEach((e,n)=>{i.set(e,`${t}[${n}]`)}):i.set(n,t),n}return t}),o=[];for(let{indexPath:n,value:c}of m(a)){let a=c;if(`basePath`in a)throw TypeError("'basePath' in `extends` is not allowed.");if(`extends`in a)throw TypeError(`Nested 'extends' is not allowed.`);let l=t.get(e),u=i.get(c)??s(c,n);o.push(g(r,l,a,u))}return l(r)||o.push(r),o.flat()}function v(e,t){return e.flatMap(e=>_(e,t))}function y(...e){let t=/* @__PURE__ */ new WeakMap,n=[];if(e.length===0)throw TypeError(`Expected one or more arguments.`);for(let{indexPath:r,value:i}of m(e)){if(typeof i!=`object`||!i)throw TypeError(`Expected an object but received ${String(i)}.`);let e=i;t.set(e,o(e,r)),n.push(e)}return v(n,t)}let b=0;function x(e,t){if(!Array.isArray(e))throw TypeError(`ignorePatterns must be an array`);if(e.length===0)throw TypeError(`ignorePatterns must contain at least one pattern`);let n=b++;return{name:t||`globalIgnores ${n}`,ignores:e}}function S(e){let t=e.startsWith(`!`),n=t?`!`:``,r=(t?e.slice(1):e).trimEnd();if([``,`**`,`/**`,`**/`].includes(r))return`${n}${r}`;let i=r.indexOf(`/`);return`${n}${i<0||i===r.length-1?`**/`:``}${(i===0?r.slice(1):r).replaceAll(/(?=((?:\\.|[^{(])*))\1([{(])/guy,`$1\\$2`)}${r.endsWith(`/**`)?`/*`:``}`}function C(e){return n.readFileSync(e,`utf8`).split(/\r?\n/u).map(e=>e.trim()).filter(e=>e&&!e.startsWith(`#`)).map(S)}function w(e){if(typeof e==`string`)return{gitignoreResolution:!1,name:e};let t=e??{};if(typeof t!=`object`||Array.isArray(t))throw TypeError("The options argument to `includeIgnoreFile()` should be an object or a string.");let n=t.gitignoreResolution??!1;if(typeof n!=`boolean`)throw TypeError("The `gitignoreResolution` option must be specified a boolean or omitted");let r=t.name??`Imported .gitignore patterns`;if(typeof r!=`string`)throw TypeError("The `name` option must be specified as a string or omitted.");return{gitignoreResolution:n,name:r}}function T(e,t){let n=!Array.isArray(e),i=Array.isArray(e)?e:[e];for(let e of i){if(typeof e!=`string`)throw TypeError("The first argument to `includeIgnoreFile()` should be a string or array of strings");if(!r.isAbsolute(e))throw Error(`The ignore file location must be an absolute path. Received ${e}`)}let{gitignoreResolution:a,name:o}=w(t);return n?{name:o,ignores:C(e),...a?{basePath:r.dirname(e)}:{}}:i.map((e,t)=>({name:`${o} (${t})`,ignores:C(e),...a?{basePath:r.dirname(e)}:{}}))}t.convertIgnorePatternToMinimatch=S,t.defineConfig=y,t.globalIgnores=x,t.includeIgnoreFile=T})),r=(/* @__PURE__ */ t(((e,t)=>{let{defineConfig:r,globalIgnores:i,includeIgnoreFile:a}=n();t.exports={defineConfig:r,globalIgnores:i,includeIgnoreFile:a}})))(),i=r.defineConfig,a=r.globalIgnores;export{i as defineConfig,a as globalIgnores};