1
0

run npm install to generate a package lock

This commit is contained in:
sashinexists
2024-12-07 13:18:31 +11:00
parent e7d08a91b5
commit 23437d228e
2501 changed files with 290663 additions and 0 deletions

3
node_modules/stubborn-fs/dist/attemptify.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
declare const attemptifyAsync: <FN extends Function>(fn: FN, onError: (error: unknown) => undefined) => FN;
declare const attemptifySync: <FN extends Function>(fn: FN, onError: (error: unknown) => undefined) => FN;
export { attemptifyAsync, attemptifySync };

19
node_modules/stubborn-fs/dist/attemptify.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
/* MAIN */
//FIXME: The return type of these functions is wrong, it doesn't account for returning "undefined", but a correct type cannot be written because generics cannot be extended properly, it seems
const attemptifyAsync = (fn, onError) => {
return function attemptified(...args) {
return fn.apply(undefined, args).catch(onError);
};
};
const attemptifySync = (fn, onError) => {
return function attemptified(...args) {
try {
return fn.apply(undefined, args);
}
catch (error) {
return onError(error);
}
};
};
/* EXPORT */
export { attemptifyAsync, attemptifySync };

4
node_modules/stubborn-fs/dist/constants.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
declare const IS_USER_ROOT: boolean;
declare const LIMIT_FILES_DESCRIPTORS = 10000;
declare const NOOP: () => undefined;
export { IS_USER_ROOT, LIMIT_FILES_DESCRIPTORS, NOOP };

8
node_modules/stubborn-fs/dist/constants.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/* IMPORT */
import process from 'node:process';
/* MAIN */
const IS_USER_ROOT = process.getuid ? !process.getuid() : false;
const LIMIT_FILES_DESCRIPTORS = 10000; //TODO: Fetch the real limit from the filesystem, somehow
const NOOP = () => undefined;
/* EXPORT */
export { IS_USER_ROOT, LIMIT_FILES_DESCRIPTORS, NOOP };

8
node_modules/stubborn-fs/dist/handlers.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/// <reference types="node" />
declare const Handlers: {
isChangeErrorOk: (error: unknown) => boolean;
isNodeError: (error: unknown) => error is NodeJS.ErrnoException;
isRetriableError: (error: unknown) => boolean;
onChangeError: (error: unknown) => undefined;
};
export default Handlers;

36
node_modules/stubborn-fs/dist/handlers.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
/* IMPORT */
import { IS_USER_ROOT } from './constants.js';
/* MAIN */
const Handlers = {
/* API */
isChangeErrorOk: (error) => {
if (!Handlers.isNodeError(error))
return false;
const { code } = error;
if (code === 'ENOSYS')
return true;
if (!IS_USER_ROOT && (code === 'EINVAL' || code === 'EPERM'))
return true;
return false;
},
isNodeError: (error) => {
return (error instanceof Error);
},
isRetriableError: (error) => {
if (!Handlers.isNodeError(error))
return false;
const { code } = error;
if (code === 'EMFILE' || code === 'ENFILE' || code === 'EAGAIN' || code === 'EBUSY' || code === 'EACCESS' || code === 'EACCES' || code === 'EACCS' || code === 'EPERM')
return true;
return false;
},
onChangeError: (error) => {
if (!Handlers.isNodeError(error))
throw error;
if (Handlers.isChangeErrorOk(error))
return;
throw error;
}
};
/* EXPORT */
export default Handlers;

42
node_modules/stubborn-fs/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,42 @@
/// <reference types="node" />
import fs from 'node:fs';
declare const FS: {
attempt: {
chmod: typeof fs.chmod.__promisify__;
chown: typeof fs.chown.__promisify__;
close: typeof fs.close.__promisify__;
fsync: typeof fs.fsync.__promisify__;
mkdir: typeof fs.mkdir.__promisify__;
realpath: typeof fs.realpath.__promisify__;
stat: typeof fs.stat.__promisify__;
unlink: typeof fs.unlink.__promisify__;
chmodSync: typeof fs.chmodSync;
chownSync: typeof fs.chownSync;
closeSync: typeof fs.closeSync;
existsSync: typeof fs.existsSync;
fsyncSync: typeof fs.fsync;
mkdirSync: typeof fs.mkdirSync;
realpathSync: typeof fs.realpathSync;
statSync: fs.StatSyncFn;
unlinkSync: typeof fs.unlinkSync;
};
retry: {
close: (timeout: number) => typeof fs.close.__promisify__;
fsync: (timeout: number) => typeof fs.fsync.__promisify__;
open: (timeout: number) => typeof fs.open.__promisify__;
readFile: (timeout: number) => typeof fs.readFile.__promisify__;
rename: (timeout: number) => typeof fs.rename.__promisify__;
stat: (timeout: number) => typeof fs.stat.__promisify__;
write: (timeout: number) => typeof fs.write.__promisify__;
writeFile: (timeout: number) => typeof fs.writeFile.__promisify__;
closeSync: (timeout: number) => typeof fs.closeSync;
fsyncSync: (timeout: number) => typeof fs.fsyncSync;
openSync: (timeout: number) => typeof fs.openSync;
readFileSync: (timeout: number) => typeof fs.readFileSync;
renameSync: (timeout: number) => typeof fs.renameSync;
statSync: (timeout: number) => fs.StatSyncFn;
writeSync: (timeout: number) => typeof fs.writeSync;
writeFileSync: (timeout: number) => typeof fs.writeFileSync;
};
};
export default FS;

53
node_modules/stubborn-fs/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,53 @@
/* IMPORT */
import fs from 'node:fs';
import { promisify } from 'node:util';
import { attemptifyAsync, attemptifySync } from './attemptify.js';
import { NOOP } from './constants.js';
import Handlers from './handlers.js';
import { retryifyAsync, retryifySync } from './retryify.js';
/* MAIN */
const FS = {
attempt: {
/* ASYNC */
chmod: attemptifyAsync(promisify(fs.chmod), Handlers.onChangeError),
chown: attemptifyAsync(promisify(fs.chown), Handlers.onChangeError),
close: attemptifyAsync(promisify(fs.close), NOOP),
fsync: attemptifyAsync(promisify(fs.fsync), NOOP),
mkdir: attemptifyAsync(promisify(fs.mkdir), NOOP),
realpath: attemptifyAsync(promisify(fs.realpath), NOOP),
stat: attemptifyAsync(promisify(fs.stat), NOOP),
unlink: attemptifyAsync(promisify(fs.unlink), NOOP),
/* SYNC */
chmodSync: attemptifySync(fs.chmodSync, Handlers.onChangeError),
chownSync: attemptifySync(fs.chownSync, Handlers.onChangeError),
closeSync: attemptifySync(fs.closeSync, NOOP),
existsSync: attemptifySync(fs.existsSync, NOOP),
fsyncSync: attemptifySync(fs.fsync, NOOP),
mkdirSync: attemptifySync(fs.mkdirSync, NOOP),
realpathSync: attemptifySync(fs.realpathSync, NOOP),
statSync: attemptifySync(fs.statSync, NOOP),
unlinkSync: attemptifySync(fs.unlinkSync, NOOP)
},
retry: {
/* ASYNC */
close: retryifyAsync(promisify(fs.close), Handlers.isRetriableError),
fsync: retryifyAsync(promisify(fs.fsync), Handlers.isRetriableError),
open: retryifyAsync(promisify(fs.open), Handlers.isRetriableError),
readFile: retryifyAsync(promisify(fs.readFile), Handlers.isRetriableError),
rename: retryifyAsync(promisify(fs.rename), Handlers.isRetriableError),
stat: retryifyAsync(promisify(fs.stat), Handlers.isRetriableError),
write: retryifyAsync(promisify(fs.write), Handlers.isRetriableError),
writeFile: retryifyAsync(promisify(fs.writeFile), Handlers.isRetriableError),
/* SYNC */
closeSync: retryifySync(fs.closeSync, Handlers.isRetriableError),
fsyncSync: retryifySync(fs.fsyncSync, Handlers.isRetriableError),
openSync: retryifySync(fs.openSync, Handlers.isRetriableError),
readFileSync: retryifySync(fs.readFileSync, Handlers.isRetriableError),
renameSync: retryifySync(fs.renameSync, Handlers.isRetriableError),
statSync: retryifySync(fs.statSync, Handlers.isRetriableError),
writeSync: retryifySync(fs.writeSync, Handlers.isRetriableError),
writeFileSync: retryifySync(fs.writeFileSync, Handlers.isRetriableError)
}
};
/* EXPORT */
export default FS;

3
node_modules/stubborn-fs/dist/retryify.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
declare const retryifyAsync: <FN extends Function>(fn: FN, isRetriableError: (error: unknown) => boolean | void) => (timeout: number) => FN;
declare const retryifySync: <FN extends Function>(fn: FN, isRetriableError: (error: unknown) => boolean | void) => (timeout: number) => FN;
export { retryifyAsync, retryifySync };

46
node_modules/stubborn-fs/dist/retryify.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
/* IMPORT */
import RetryfyQueue from './retryify_queue.js';
/* MAIN */
//FIXME: There are a boatload of anys here, but apparently generics cannot be extended properly, so...
const retryifyAsync = (fn, isRetriableError) => {
return function retrified(timestamp) {
return function attempt(...args) {
return RetryfyQueue.schedule().then(cleanup => {
const onResolve = (result) => {
cleanup();
return result;
};
const onReject = (error) => {
cleanup();
if (Date.now() >= timestamp)
throw error;
if (isRetriableError(error)) {
const delay = Math.round(100 * Math.random());
const delayPromise = new Promise(resolve => setTimeout(resolve, delay));
return delayPromise.then(() => attempt.apply(undefined, args));
}
throw error;
};
return fn.apply(undefined, args).then(onResolve, onReject);
});
};
};
};
const retryifySync = (fn, isRetriableError) => {
return function retrified(timestamp) {
return function attempt(...args) {
try {
return fn.apply(undefined, args);
}
catch (error) {
if (Date.now() > timestamp)
throw error;
if (isRetriableError(error))
return attempt.apply(undefined, args);
throw error;
}
};
};
};
/* EXPORT */
export { retryifyAsync, retryifySync };

15
node_modules/stubborn-fs/dist/retryify_queue.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
declare class RetryfyQueue {
private interval;
private intervalId?;
private limit;
private queueActive;
private queueWaiting;
init: () => void;
reset: () => void;
add: (fn: Function) => void;
remove: (fn: Function) => void;
schedule: () => Promise<Function>;
tick: () => void;
}
declare const _default: RetryfyQueue;
export default _default;

62
node_modules/stubborn-fs/dist/retryify_queue.js generated vendored Normal file
View File

@@ -0,0 +1,62 @@
/* IMPORT */
import { LIMIT_FILES_DESCRIPTORS } from './constants.js';
/* MAIN */
class RetryfyQueue {
constructor() {
/* VARIABLES */
this.interval = 25;
this.intervalId = undefined;
this.limit = LIMIT_FILES_DESCRIPTORS;
this.queueActive = new Set();
this.queueWaiting = new Set();
/* LIFECYCLE API */
this.init = () => {
if (this.intervalId)
return;
this.intervalId = setInterval(this.tick, this.interval);
};
this.reset = () => {
if (!this.intervalId)
return;
clearInterval(this.intervalId);
delete this.intervalId;
};
/* API */
this.add = (fn) => {
this.queueWaiting.add(fn);
if (this.queueActive.size < (this.limit / 2)) { // Active queue not under preassure, executing immediately
this.tick();
}
else {
this.init();
}
};
this.remove = (fn) => {
this.queueWaiting.delete(fn);
this.queueActive.delete(fn);
};
this.schedule = () => {
return new Promise(resolve => {
const cleanup = () => this.remove(resolver);
const resolver = () => resolve(cleanup);
this.add(resolver);
});
};
this.tick = () => {
if (this.queueActive.size >= this.limit)
return;
if (!this.queueWaiting.size)
return this.reset();
for (const fn of this.queueWaiting) {
if (this.queueActive.size >= this.limit)
break;
this.queueWaiting.delete(fn);
this.queueActive.add(fn);
fn();
}
};
}
}
;
/* EXPORT */
export default new RetryfyQueue();