eslint-cli-bundle 1.0.3 → 1.0.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/api.d.ts +1473 -0
- package/dist/api.js +5 -0
- package/dist/chunk-qnHZjHhP.js +1 -0
- package/dist/config.d.ts +12 -0
- package/dist/config.js +1 -0
- package/dist/eslint.js +14 -290
- package/dist/jiti-DyCiGFB9.js +9 -0
- package/dist/legacy-eslint-DYfSFaC6.js +269 -0
- package/dist/src-FNB-unmu.js +1 -0
- package/dist/types-CRoZH7Is.d.ts +1336 -0
- package/package.json +12 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-qnHZjHhP.js";import t from"node:path";import{fileURLToPath as n}from"node:url";import r from"node:fs/promises";function i(e){if(!e||!(e instanceof URL)&&typeof e!=`string`)throw TypeError(`Path must be a non-empty string or URL.`)}function a(e){if(typeof e!=`string`&&!(e instanceof ArrayBuffer)&&!ArrayBuffer.isView(e))throw TypeError(`File contents must be a string, ArrayBuffer, or ArrayBuffer view.`)}function o(e){if(e instanceof Uint8Array)return e;if(typeof e==`string`)return c.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e)){let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}throw TypeError(`Invalid contents type. Expected string or ArrayBuffer.`)}var s,c,l,u,d,f,p,m=e((()=>{s=new TextDecoder,c=new TextEncoder,l=class extends Error{constructor(e){super(`Method "${e}" does not exist on impl.`)}},u=class extends Error{constructor(e){super(`Method "${e}" is not supported on this impl.`)}},d=class extends Error{constructor(){super(`Implementation already set.`)}},f=class{type;data;timestamp=Date.now();constructor(e,t){this.type=e,this.data=t}},p=class{#e;#t;#n=new Map;constructor({impl:e}){this.#e=e,this.#t=e}#r(e,...t){for(let n of this.#n.values())n.push(new f(`call`,{methodName:e,args:t}))}logStart(e){if(!e||typeof e!=`string`)throw TypeError(`Log name must be a non-empty string.`);if(this.#n.has(e))throw Error(`Log "${e}" already exists.`);this.#n.set(e,[])}logEnd(e){if(this.#n.has(e)){let t=this.#n.get(e);return this.#n.delete(e),t}throw Error(`Log "${e}" does not exist.`)}isBaseImpl(){return this.#t===this.#e}setImpl(e){if(this.#r(`implSet`,e),this.#t!==this.#e)throw new d;this.#t=e}resetImpl(){this.#r(`implReset`),this.#t=this.#e}#i(e){if(typeof this.#t[e]!=`function`)throw new l(e)}#a(e,t){if(typeof this.#t[e]!=`function`)throw new u(t)}#o(e,...t){return this.#r(e,...t),this.#i(e),this.#t[e](...t)}#s(e,...t){return this.#i(e),this.#t[e](...t)}#c(e,t,...n){return this.#r(t,...n),this.#a(e,t),this.#t[e](...n)}async text(e){i(e);let t=await this.#c(`bytes`,`text`,e);return t?s.decode(t):void 0}async json(e){i(e);let t=await this.#c(`bytes`,`json`,e);return t?JSON.parse(s.decode(t)):void 0}async arrayBuffer(e){return i(e),(await this.#c(`bytes`,`arrayBuffer`,e))?.buffer}async bytes(e){return i(e),this.#o(`bytes`,e)}async write(e,t){i(e),a(t),this.#r(`write`,e,t);let n=o(t);return this.#s(`write`,e,n)}async append(e,t){i(e),a(t),this.#r(`append`,e,t);let n=o(t);return this.#s(`append`,e,n)}async isFile(e){return i(e),this.#o(`isFile`,e)}async isDirectory(e){return i(e),this.#o(`isDirectory`,e)}async createDirectory(e){return i(e),this.#o(`createDirectory`,e)}async delete(e){return i(e),this.#o(`delete`,e)}async deleteAll(e){return i(e),this.#o(`deleteAll`,e)}async*list(e){i(e),yield*await this.#o(`list`,e)}async*walk(e,{directoryFilter:t=()=>!0,entryFilter:n=()=>!0}={}){i(e),this.#r(`walk`,e,{directoryFilter:t,entryFilter:n});let r=async function*(e,{directoryFilter:t,entryFilter:n,parentPath:i=``,depth:a=1}){let o;try{o=await this.#s(`list`,e)}catch(e){if(e.code===`ENOENT`)return;throw e}for await(let s of o){let o={path:s.name,depth:a,...s};i&&(o.path=`${i}/${o.path}`);let c=n(o);if(c.then&&(c=await c),c&&(yield o),s.isDirectory){let i=t(o);if(i.then&&(i=await i),!i)continue;yield*r(e instanceof URL?new URL(s.name,e.href.endsWith(`/`)?e.href:`${e.href}/`):`${e.endsWith(`/`)?e:`${e}/`}${s.name}`,{directoryFilter:t,entryFilter:n,parentPath:o.path,depth:a+1})}}}.bind(this);yield*r(e,{directoryFilter:t,entryFilter:n})}async size(e){return i(e),this.#o(`size`,e)}async lastModified(e){return i(e),this.#o(`lastModified`,e)}async copy(e,t){return i(e),i(t),this.#o(`copy`,e,t)}async copyAll(e,t){return i(e),i(t),this.#o(`copyAll`,e,t)}async move(e,t){return i(e),i(t),this.#o(`move`,e,t)}async moveAll(e,t){return i(e),i(t),this.#o(`moveAll`,e,t)}}})),h=e((()=>{})),g=e((()=>{m(),h()}));function _(e){globalThis?.process?.env.DEBUG===`@hwc/retry`&&console.debug(e)}function v(e,t){let n=Date.now()-e.lastAttempt,r=Math.max(e.lastAttempt-e.timestamp,1);return n>=Math.min(r*1.2,t)}function y(e,t){return e.age>t}function b(){if(Promise.withResolvers)return Promise.withResolvers();let e,t,n=new Promise((n,r)=>{e=n,t=r});if(e===void 0||t===void 0)throw Error(`Promise executor did not initialize resolve or reject.`);return{promise:n,resolve:e,reject:t}}var x,S,C,w,T,E=e((()=>{x=6e4,S=100,C=1e3,w=class{id=Math.random().toString(36).slice(2);fn;error;timestamp=Date.now();lastAttempt=this.timestamp;resolve;reject;signal;constructor(e,t,n,r,i){this.fn=e,this.error=t,this.timestamp=Date.now(),this.lastAttempt=Date.now(),this.resolve=n,this.reject=r,this.signal=i}get age(){return Date.now()-this.timestamp}},T=class{#e=[];#t=[];#n=0;#r;#i;#a;#o;#s;constructor(e,{timeout:t=x,maxDelay:n=S,concurrency:r=C}={}){if(typeof e!=`function`)throw Error(`Missing function to check errors`);this.#o=e,this.#r=t,this.#i=n,this.#s=r}get retrying(){return this.#e.length}get pending(){return this.#t.length}get working(){return this.#n}#c(e,{signal:t,promise:n,resolve:r,reject:i}){let a;try{a=e()}catch(e){return i(Error(`Synchronous error: ${e.message}`,{cause:e})),n}return!a||typeof a.then!=`function`?(i(Error(`Result is not a promise.`)),n):(this.#n++,n.finally(()=>{this.#n--,this.#u()}).catch(()=>{}),Promise.resolve(a).then(e=>{_(`Function called successfully without retry.`),r(e)}).catch(n=>{if(!this.#o(n)){i(n);return}let a=new w(e,n,r,i,t);_(`Function failed, queuing for retry with task ${a.id}.`),this.#e.push(a),t?.addEventListener(`abort`,()=>{_(`Task ${a.id} was aborted due to AbortSignal.`),i(t.reason)}),this.#d()}),n)}retry(e,{signal:t}={}){t?.throwIfAborted();let{promise:n,resolve:r,reject:i}=b();return this.#t.push(()=>this.#c(e,{signal:t,promise:n,resolve:r,reject:i})),this.#u(),n}#l(){this.pending&&this.#u(),this.retrying&&this.#d()}#u(){_(`Processing pending tasks: ${this.pending} pending, ${this.working} working.`);let e=this.#s-this.working;if(e<=0)return;let t=Math.min(this.pending,e);for(let e=0;e<t;e++)this.#t.shift()?.();_(`Processed pending tasks: ${this.pending} pending, ${this.working} working.`)}#d(){clearTimeout(this.#a),this.#a=void 0,_(`Processing retry queue: ${this.retrying} retrying, ${this.working} working.`);let e=()=>{this.#a=setTimeout(()=>this.#l(),0)},t=this.#e.shift();if(!t){_(`Queue is empty, exiting.`),this.pending&&e();return}if(y(t,this.#r)){_(`Task ${t.id} was abandoned due to timeout.`),t.reject(t.error),e();return}if(!v(t,this.#i)){_(`Task ${t.id} is not ready to retry, skipping.`),this.#e.push(t),e();return}t.lastAttempt=Date.now(),Promise.resolve(t.fn()).then(e=>{_(`Task ${t.id} succeeded after ${t.age}ms.`),t.resolve(e)}).catch(e=>{if(!this.#o(e)){_(`Task ${t.id} failed with non-retryable error: ${e.message}.`),t.reject(e);return}t.lastAttempt=Date.now(),this.#e.push(t),_(`Task ${t.id} failed, requeueing to try again.`)}).finally(()=>{this.#l()})}}})),D,O,k,A,j,M=e((()=>{g(),E(),D=new Set([`ENFILE`,`EMFILE`]),O=class{name;isFile;isDirectory;isSymlink;constructor(e){this.name=e.name,this.isFile=e.isFile(),this.isDirectory=e.isDirectory(),this.isSymlink=e.isSymbolicLink()}},k=class{#e;#t;constructor({fsp:e=r}={}){this.#e=e,this.#t=new T(e=>D.has(e.code))}bytes(e){return this.#t.retry(()=>this.#e.readFile(e)).then(e=>new Uint8Array(e.buffer)).catch(e=>{if(e.code!==`ENOENT`)throw e})}async write(e,r){let i=Buffer.from(r);return this.#t.retry(()=>this.#e.writeFile(e,i)).catch(r=>{if(r.code===`ENOENT`){let r=t.dirname(e instanceof URL?n(e):e);return this.#e.mkdir(r,{recursive:!0}).then(()=>this.#e.writeFile(e,i))}throw r})}async append(e,r){let i=Buffer.from(r);return this.#t.retry(()=>this.#e.appendFile(e,i)).catch(r=>{if(r.code===`ENOENT`){let r=t.dirname(e instanceof URL?n(e):e);return this.#e.mkdir(r,{recursive:!0}).then(()=>this.#e.appendFile(e,i))}throw r})}isFile(e){return this.#e.stat(e).then(e=>e.isFile()).catch(e=>{if(e.code===`ENOENT`)return!1;throw e})}isDirectory(e){return this.#e.stat(e).then(e=>e.isDirectory()).catch(e=>{if(e.code===`ENOENT`)return!1;throw e})}async createDirectory(e){await this.#e.mkdir(e,{recursive:!0})}delete(e){return this.#e.rm(e).then(()=>!0).catch(t=>{if(t.code===`ERR_FS_EISDIR`)return this.#e.rmdir(e).then(()=>!0);if(t.code===`ENOENT`)return!1;throw t})}deleteAll(e){return this.#e.rm(e,{recursive:!0}).then(()=>!0).catch(e=>{if(e.code===`ENOENT`)return!1;throw e})}async*list(e){let t=await this.#e.readdir(e,{withFileTypes:!0});for(let e of t)yield new O(e)}size(e){return this.#e.stat(e).then(e=>e.size).catch(e=>{if(e.code!==`ENOENT`)throw e})}lastModified(e){return this.#e.stat(e).then(e=>e.mtime).catch(e=>{if(e.code!==`ENOENT`)throw e})}copy(e,t){return this.#e.copyFile(e,t)}async copyAll(e,r){if(await this.isFile(e))return this.copy(e,r);let i=e instanceof URL?n(e):e,a=r instanceof URL?n(r):r;await this.createDirectory(r);for await(let n of this.list(e)){let e=t.join(i,n.name),r=t.join(a,n.name);n.isDirectory?await this.copyAll(e,r):await this.copy(e,r)}}move(e,t){return this.#e.stat(e).then(n=>{if(n.isDirectory())throw Error(`EISDIR: illegal operation on a directory, move '${e}' -> '${t}'`);return this.#e.rename(e,t)})}async moveAll(e,t){return this.#e.rename(e,t)}},A=class extends p{constructor({fsp:e}={}){super({impl:new k({fsp:e})})}},j=new A}));e((()=>{M(),g()}))();export{j as hfs};
|