mirror of
https://github.com/deployphp/action.git
synced 2024-11-26 21:59:02 +00:00
Add node_modules
This commit is contained in:
parent
e1f786311a
commit
554eb0b122
1
node_modules/.bin/ps-tree
generated
vendored
Symbolic link
1
node_modules/.bin/ps-tree
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../ps-tree/bin/ps-tree.js
|
1
node_modules/.bin/uuid
generated
vendored
Symbolic link
1
node_modules/.bin/uuid
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../uuid/dist/bin/uuid
|
1
node_modules/.bin/zx
generated
vendored
Symbolic link
1
node_modules/.bin/zx
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../zx/build/cli.js
|
25
node_modules/@actions/core/lib/path-utils.d.ts
generated
vendored
Normal file
25
node_modules/@actions/core/lib/path-utils.d.ts
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* toPosixPath converts the given path to the posix form. On Windows, \\ will be
|
||||||
|
* replaced with /.
|
||||||
|
*
|
||||||
|
* @param pth. Path to transform.
|
||||||
|
* @return string Posix path.
|
||||||
|
*/
|
||||||
|
export declare function toPosixPath(pth: string): string;
|
||||||
|
/**
|
||||||
|
* toWin32Path converts the given path to the win32 form. On Linux, / will be
|
||||||
|
* replaced with \\.
|
||||||
|
*
|
||||||
|
* @param pth. Path to transform.
|
||||||
|
* @return string Win32 path.
|
||||||
|
*/
|
||||||
|
export declare function toWin32Path(pth: string): string;
|
||||||
|
/**
|
||||||
|
* toPlatformPath converts the given path to a platform-specific path. It does
|
||||||
|
* this by replacing instances of / and \ with the platform-specific path
|
||||||
|
* separator.
|
||||||
|
*
|
||||||
|
* @param pth The path to platformize.
|
||||||
|
* @return string The platform-specific path.
|
||||||
|
*/
|
||||||
|
export declare function toPlatformPath(pth: string): string;
|
58
node_modules/@actions/core/lib/path-utils.js
generated
vendored
Normal file
58
node_modules/@actions/core/lib/path-utils.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0;
|
||||||
|
const path = __importStar(require("path"));
|
||||||
|
/**
|
||||||
|
* toPosixPath converts the given path to the posix form. On Windows, \\ will be
|
||||||
|
* replaced with /.
|
||||||
|
*
|
||||||
|
* @param pth. Path to transform.
|
||||||
|
* @return string Posix path.
|
||||||
|
*/
|
||||||
|
function toPosixPath(pth) {
|
||||||
|
return pth.replace(/[\\]/g, '/');
|
||||||
|
}
|
||||||
|
exports.toPosixPath = toPosixPath;
|
||||||
|
/**
|
||||||
|
* toWin32Path converts the given path to the win32 form. On Linux, / will be
|
||||||
|
* replaced with \\.
|
||||||
|
*
|
||||||
|
* @param pth. Path to transform.
|
||||||
|
* @return string Win32 path.
|
||||||
|
*/
|
||||||
|
function toWin32Path(pth) {
|
||||||
|
return pth.replace(/[/]/g, '\\');
|
||||||
|
}
|
||||||
|
exports.toWin32Path = toWin32Path;
|
||||||
|
/**
|
||||||
|
* toPlatformPath converts the given path to a platform-specific path. It does
|
||||||
|
* this by replacing instances of / and \ with the platform-specific path
|
||||||
|
* separator.
|
||||||
|
*
|
||||||
|
* @param pth The path to platformize.
|
||||||
|
* @return string The platform-specific path.
|
||||||
|
*/
|
||||||
|
function toPlatformPath(pth) {
|
||||||
|
return pth.replace(/[/\\]/g, path.sep);
|
||||||
|
}
|
||||||
|
exports.toPlatformPath = toPlatformPath;
|
||||||
|
//# sourceMappingURL=path-utils.js.map
|
1
node_modules/@actions/core/lib/path-utils.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/path-utils.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"path-utils.js","sourceRoot":"","sources":["../src/path-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4B;AAE5B;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;AAClC,CAAC;AAFD,kCAEC;AAED;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AAClC,CAAC;AAFD,kCAEC;AAED;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,GAAW;IACxC,OAAO,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,wCAEC"}
|
202
node_modules/@actions/core/lib/summary.d.ts
generated
vendored
Normal file
202
node_modules/@actions/core/lib/summary.d.ts
generated
vendored
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
export declare const SUMMARY_ENV_VAR = "GITHUB_STEP_SUMMARY";
|
||||||
|
export declare const SUMMARY_DOCS_URL = "https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";
|
||||||
|
export declare type SummaryTableRow = (SummaryTableCell | string)[];
|
||||||
|
export interface SummaryTableCell {
|
||||||
|
/**
|
||||||
|
* Cell content
|
||||||
|
*/
|
||||||
|
data: string;
|
||||||
|
/**
|
||||||
|
* Render cell as header
|
||||||
|
* (optional) default: false
|
||||||
|
*/
|
||||||
|
header?: boolean;
|
||||||
|
/**
|
||||||
|
* Number of columns the cell extends
|
||||||
|
* (optional) default: '1'
|
||||||
|
*/
|
||||||
|
colspan?: string;
|
||||||
|
/**
|
||||||
|
* Number of rows the cell extends
|
||||||
|
* (optional) default: '1'
|
||||||
|
*/
|
||||||
|
rowspan?: string;
|
||||||
|
}
|
||||||
|
export interface SummaryImageOptions {
|
||||||
|
/**
|
||||||
|
* The width of the image in pixels. Must be an integer without a unit.
|
||||||
|
* (optional)
|
||||||
|
*/
|
||||||
|
width?: string;
|
||||||
|
/**
|
||||||
|
* The height of the image in pixels. Must be an integer without a unit.
|
||||||
|
* (optional)
|
||||||
|
*/
|
||||||
|
height?: string;
|
||||||
|
}
|
||||||
|
export interface SummaryWriteOptions {
|
||||||
|
/**
|
||||||
|
* Replace all existing content in summary file with buffer contents
|
||||||
|
* (optional) default: false
|
||||||
|
*/
|
||||||
|
overwrite?: boolean;
|
||||||
|
}
|
||||||
|
declare class Summary {
|
||||||
|
private _buffer;
|
||||||
|
private _filePath?;
|
||||||
|
constructor();
|
||||||
|
/**
|
||||||
|
* Finds the summary file path from the environment, rejects if env var is not found or file does not exist
|
||||||
|
* Also checks r/w permissions.
|
||||||
|
*
|
||||||
|
* @returns step summary file path
|
||||||
|
*/
|
||||||
|
private filePath;
|
||||||
|
/**
|
||||||
|
* Wraps content in an HTML tag, adding any HTML attributes
|
||||||
|
*
|
||||||
|
* @param {string} tag HTML tag to wrap
|
||||||
|
* @param {string | null} content content within the tag
|
||||||
|
* @param {[attribute: string]: string} attrs key-value list of HTML attributes to add
|
||||||
|
*
|
||||||
|
* @returns {string} content wrapped in HTML element
|
||||||
|
*/
|
||||||
|
private wrap;
|
||||||
|
/**
|
||||||
|
* Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.
|
||||||
|
*
|
||||||
|
* @param {SummaryWriteOptions} [options] (optional) options for write operation
|
||||||
|
*
|
||||||
|
* @returns {Promise<Summary>} summary instance
|
||||||
|
*/
|
||||||
|
write(options?: SummaryWriteOptions): Promise<Summary>;
|
||||||
|
/**
|
||||||
|
* Clears the summary buffer and wipes the summary file
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
clear(): Promise<Summary>;
|
||||||
|
/**
|
||||||
|
* Returns the current summary buffer as a string
|
||||||
|
*
|
||||||
|
* @returns {string} string of summary buffer
|
||||||
|
*/
|
||||||
|
stringify(): string;
|
||||||
|
/**
|
||||||
|
* If the summary buffer is empty
|
||||||
|
*
|
||||||
|
* @returns {boolen} true if the buffer is empty
|
||||||
|
*/
|
||||||
|
isEmptyBuffer(): boolean;
|
||||||
|
/**
|
||||||
|
* Resets the summary buffer without writing to summary file
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
emptyBuffer(): Summary;
|
||||||
|
/**
|
||||||
|
* Adds raw text to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} text content to add
|
||||||
|
* @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addRaw(text: string, addEOL?: boolean): Summary;
|
||||||
|
/**
|
||||||
|
* Adds the operating system-specific end-of-line marker to the buffer
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addEOL(): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML codeblock to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} code content to render within fenced code block
|
||||||
|
* @param {string} lang (optional) language to syntax highlight code
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addCodeBlock(code: string, lang?: string): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML list to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string[]} items list of items to render
|
||||||
|
* @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addList(items: string[], ordered?: boolean): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML table to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {SummaryTableCell[]} rows table rows
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addTable(rows: SummaryTableRow[]): Summary;
|
||||||
|
/**
|
||||||
|
* Adds a collapsable HTML details element to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} label text for the closed state
|
||||||
|
* @param {string} content collapsable content
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addDetails(label: string, content: string): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML image tag to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} src path to the image you to embed
|
||||||
|
* @param {string} alt text description of the image
|
||||||
|
* @param {SummaryImageOptions} options (optional) addition image attributes
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addImage(src: string, alt: string, options?: SummaryImageOptions): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML section heading element
|
||||||
|
*
|
||||||
|
* @param {string} text heading text
|
||||||
|
* @param {number | string} [level=1] (optional) the heading level, default: 1
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addHeading(text: string, level?: number | string): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML thematic break (<hr>) to the summary buffer
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addSeparator(): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML line break (<br>) to the summary buffer
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addBreak(): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML blockquote to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} text quote text
|
||||||
|
* @param {string} cite (optional) citation url
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addQuote(text: string, cite?: string): Summary;
|
||||||
|
/**
|
||||||
|
* Adds an HTML anchor tag to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} text link text/content
|
||||||
|
* @param {string} href hyperlink
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addLink(text: string, href: string): Summary;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @deprecated use `core.summary`
|
||||||
|
*/
|
||||||
|
export declare const markdownSummary: Summary;
|
||||||
|
export declare const summary: Summary;
|
||||||
|
export {};
|
283
node_modules/@actions/core/lib/summary.js
generated
vendored
Normal file
283
node_modules/@actions/core/lib/summary.js
generated
vendored
Normal file
@ -0,0 +1,283 @@
|
|||||||
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0;
|
||||||
|
const os_1 = require("os");
|
||||||
|
const fs_1 = require("fs");
|
||||||
|
const { access, appendFile, writeFile } = fs_1.promises;
|
||||||
|
exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY';
|
||||||
|
exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary';
|
||||||
|
class Summary {
|
||||||
|
constructor() {
|
||||||
|
this._buffer = '';
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Finds the summary file path from the environment, rejects if env var is not found or file does not exist
|
||||||
|
* Also checks r/w permissions.
|
||||||
|
*
|
||||||
|
* @returns step summary file path
|
||||||
|
*/
|
||||||
|
filePath() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (this._filePath) {
|
||||||
|
return this._filePath;
|
||||||
|
}
|
||||||
|
const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR];
|
||||||
|
if (!pathFromEnv) {
|
||||||
|
throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK);
|
||||||
|
}
|
||||||
|
catch (_a) {
|
||||||
|
throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`);
|
||||||
|
}
|
||||||
|
this._filePath = pathFromEnv;
|
||||||
|
return this._filePath;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Wraps content in an HTML tag, adding any HTML attributes
|
||||||
|
*
|
||||||
|
* @param {string} tag HTML tag to wrap
|
||||||
|
* @param {string | null} content content within the tag
|
||||||
|
* @param {[attribute: string]: string} attrs key-value list of HTML attributes to add
|
||||||
|
*
|
||||||
|
* @returns {string} content wrapped in HTML element
|
||||||
|
*/
|
||||||
|
wrap(tag, content, attrs = {}) {
|
||||||
|
const htmlAttrs = Object.entries(attrs)
|
||||||
|
.map(([key, value]) => ` ${key}="${value}"`)
|
||||||
|
.join('');
|
||||||
|
if (!content) {
|
||||||
|
return `<${tag}${htmlAttrs}>`;
|
||||||
|
}
|
||||||
|
return `<${tag}${htmlAttrs}>${content}</${tag}>`;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.
|
||||||
|
*
|
||||||
|
* @param {SummaryWriteOptions} [options] (optional) options for write operation
|
||||||
|
*
|
||||||
|
* @returns {Promise<Summary>} summary instance
|
||||||
|
*/
|
||||||
|
write(options) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);
|
||||||
|
const filePath = yield this.filePath();
|
||||||
|
const writeFunc = overwrite ? writeFile : appendFile;
|
||||||
|
yield writeFunc(filePath, this._buffer, { encoding: 'utf8' });
|
||||||
|
return this.emptyBuffer();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Clears the summary buffer and wipes the summary file
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
clear() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.emptyBuffer().write({ overwrite: true });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the current summary buffer as a string
|
||||||
|
*
|
||||||
|
* @returns {string} string of summary buffer
|
||||||
|
*/
|
||||||
|
stringify() {
|
||||||
|
return this._buffer;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* If the summary buffer is empty
|
||||||
|
*
|
||||||
|
* @returns {boolen} true if the buffer is empty
|
||||||
|
*/
|
||||||
|
isEmptyBuffer() {
|
||||||
|
return this._buffer.length === 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Resets the summary buffer without writing to summary file
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
emptyBuffer() {
|
||||||
|
this._buffer = '';
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds raw text to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} text content to add
|
||||||
|
* @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addRaw(text, addEOL = false) {
|
||||||
|
this._buffer += text;
|
||||||
|
return addEOL ? this.addEOL() : this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds the operating system-specific end-of-line marker to the buffer
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addEOL() {
|
||||||
|
return this.addRaw(os_1.EOL);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML codeblock to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} code content to render within fenced code block
|
||||||
|
* @param {string} lang (optional) language to syntax highlight code
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addCodeBlock(code, lang) {
|
||||||
|
const attrs = Object.assign({}, (lang && { lang }));
|
||||||
|
const element = this.wrap('pre', this.wrap('code', code), attrs);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML list to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string[]} items list of items to render
|
||||||
|
* @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addList(items, ordered = false) {
|
||||||
|
const tag = ordered ? 'ol' : 'ul';
|
||||||
|
const listItems = items.map(item => this.wrap('li', item)).join('');
|
||||||
|
const element = this.wrap(tag, listItems);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML table to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {SummaryTableCell[]} rows table rows
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addTable(rows) {
|
||||||
|
const tableBody = rows
|
||||||
|
.map(row => {
|
||||||
|
const cells = row
|
||||||
|
.map(cell => {
|
||||||
|
if (typeof cell === 'string') {
|
||||||
|
return this.wrap('td', cell);
|
||||||
|
}
|
||||||
|
const { header, data, colspan, rowspan } = cell;
|
||||||
|
const tag = header ? 'th' : 'td';
|
||||||
|
const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan }));
|
||||||
|
return this.wrap(tag, data, attrs);
|
||||||
|
})
|
||||||
|
.join('');
|
||||||
|
return this.wrap('tr', cells);
|
||||||
|
})
|
||||||
|
.join('');
|
||||||
|
const element = this.wrap('table', tableBody);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds a collapsable HTML details element to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} label text for the closed state
|
||||||
|
* @param {string} content collapsable content
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addDetails(label, content) {
|
||||||
|
const element = this.wrap('details', this.wrap('summary', label) + content);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML image tag to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} src path to the image you to embed
|
||||||
|
* @param {string} alt text description of the image
|
||||||
|
* @param {SummaryImageOptions} options (optional) addition image attributes
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addImage(src, alt, options) {
|
||||||
|
const { width, height } = options || {};
|
||||||
|
const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height }));
|
||||||
|
const element = this.wrap('img', null, Object.assign({ src, alt }, attrs));
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML section heading element
|
||||||
|
*
|
||||||
|
* @param {string} text heading text
|
||||||
|
* @param {number | string} [level=1] (optional) the heading level, default: 1
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addHeading(text, level) {
|
||||||
|
const tag = `h${level}`;
|
||||||
|
const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)
|
||||||
|
? tag
|
||||||
|
: 'h1';
|
||||||
|
const element = this.wrap(allowedTag, text);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML thematic break (<hr>) to the summary buffer
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addSeparator() {
|
||||||
|
const element = this.wrap('hr', null);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML line break (<br>) to the summary buffer
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addBreak() {
|
||||||
|
const element = this.wrap('br', null);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML blockquote to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} text quote text
|
||||||
|
* @param {string} cite (optional) citation url
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addQuote(text, cite) {
|
||||||
|
const attrs = Object.assign({}, (cite && { cite }));
|
||||||
|
const element = this.wrap('blockquote', text, attrs);
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds an HTML anchor tag to the summary buffer
|
||||||
|
*
|
||||||
|
* @param {string} text link text/content
|
||||||
|
* @param {string} href hyperlink
|
||||||
|
*
|
||||||
|
* @returns {Summary} summary instance
|
||||||
|
*/
|
||||||
|
addLink(text, href) {
|
||||||
|
const element = this.wrap('a', text, { href });
|
||||||
|
return this.addRaw(element).addEOL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const _summary = new Summary();
|
||||||
|
/**
|
||||||
|
* @deprecated use `core.summary`
|
||||||
|
*/
|
||||||
|
exports.markdownSummary = _summary;
|
||||||
|
exports.summary = _summary;
|
||||||
|
//# sourceMappingURL=summary.js.map
|
1
node_modules/@actions/core/lib/summary.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/summary.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
26
node_modules/@actions/http-client/lib/auth.d.ts
generated
vendored
Normal file
26
node_modules/@actions/http-client/lib/auth.d.ts
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import * as http from 'http';
|
||||||
|
import * as ifm from './interfaces';
|
||||||
|
import { HttpClientResponse } from './index';
|
||||||
|
export declare class BasicCredentialHandler implements ifm.RequestHandler {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
constructor(username: string, password: string);
|
||||||
|
prepareRequest(options: http.RequestOptions): void;
|
||||||
|
canHandleAuthentication(): boolean;
|
||||||
|
handleAuthentication(): Promise<HttpClientResponse>;
|
||||||
|
}
|
||||||
|
export declare class BearerCredentialHandler implements ifm.RequestHandler {
|
||||||
|
token: string;
|
||||||
|
constructor(token: string);
|
||||||
|
prepareRequest(options: http.RequestOptions): void;
|
||||||
|
canHandleAuthentication(): boolean;
|
||||||
|
handleAuthentication(): Promise<HttpClientResponse>;
|
||||||
|
}
|
||||||
|
export declare class PersonalAccessTokenCredentialHandler implements ifm.RequestHandler {
|
||||||
|
token: string;
|
||||||
|
constructor(token: string);
|
||||||
|
prepareRequest(options: http.RequestOptions): void;
|
||||||
|
canHandleAuthentication(): boolean;
|
||||||
|
handleAuthentication(): Promise<HttpClientResponse>;
|
||||||
|
}
|
81
node_modules/@actions/http-client/lib/auth.js
generated
vendored
Normal file
81
node_modules/@actions/http-client/lib/auth.js
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0;
|
||||||
|
class BasicCredentialHandler {
|
||||||
|
constructor(username, password) {
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
prepareRequest(options) {
|
||||||
|
if (!options.headers) {
|
||||||
|
throw Error('The request has no headers');
|
||||||
|
}
|
||||||
|
options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`;
|
||||||
|
}
|
||||||
|
// This handler cannot handle 401
|
||||||
|
canHandleAuthentication() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
handleAuthentication() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
throw new Error('not implemented');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.BasicCredentialHandler = BasicCredentialHandler;
|
||||||
|
class BearerCredentialHandler {
|
||||||
|
constructor(token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
// currently implements pre-authorization
|
||||||
|
// TODO: support preAuth = false where it hooks on 401
|
||||||
|
prepareRequest(options) {
|
||||||
|
if (!options.headers) {
|
||||||
|
throw Error('The request has no headers');
|
||||||
|
}
|
||||||
|
options.headers['Authorization'] = `Bearer ${this.token}`;
|
||||||
|
}
|
||||||
|
// This handler cannot handle 401
|
||||||
|
canHandleAuthentication() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
handleAuthentication() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
throw new Error('not implemented');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.BearerCredentialHandler = BearerCredentialHandler;
|
||||||
|
class PersonalAccessTokenCredentialHandler {
|
||||||
|
constructor(token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
// currently implements pre-authorization
|
||||||
|
// TODO: support preAuth = false where it hooks on 401
|
||||||
|
prepareRequest(options) {
|
||||||
|
if (!options.headers) {
|
||||||
|
throw Error('The request has no headers');
|
||||||
|
}
|
||||||
|
options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;
|
||||||
|
}
|
||||||
|
// This handler cannot handle 401
|
||||||
|
canHandleAuthentication() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
handleAuthentication() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
throw new Error('not implemented');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
|
||||||
|
//# sourceMappingURL=auth.js.map
|
1
node_modules/@actions/http-client/lib/auth.js.map
generated
vendored
Normal file
1
node_modules/@actions/http-client/lib/auth.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,MAAa,sBAAsB;IAIjC,YAAY,QAAgB,EAAE,QAAgB;QAC5C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,MAAM,CAAC,IAAI,CACrD,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CACpC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;IACxB,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AA1BD,wDA0BC;AAED,MAAa,uBAAuB;IAGlC,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,yCAAyC;IACzC,sDAAsD;IACtD,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,IAAI,CAAC,KAAK,EAAE,CAAA;IAC3D,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AAxBD,0DAwBC;AAED,MAAa,oCAAoC;IAI/C,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,yCAAyC;IACzC,sDAAsD;IACtD,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,MAAM,CAAC,IAAI,CACrD,OAAO,IAAI,CAAC,KAAK,EAAE,CACpB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;IACxB,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AA3BD,oFA2BC"}
|
123
node_modules/@actions/http-client/lib/index.d.ts
generated
vendored
Normal file
123
node_modules/@actions/http-client/lib/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import * as http from 'http';
|
||||||
|
import * as ifm from './interfaces';
|
||||||
|
export declare enum HttpCodes {
|
||||||
|
OK = 200,
|
||||||
|
MultipleChoices = 300,
|
||||||
|
MovedPermanently = 301,
|
||||||
|
ResourceMoved = 302,
|
||||||
|
SeeOther = 303,
|
||||||
|
NotModified = 304,
|
||||||
|
UseProxy = 305,
|
||||||
|
SwitchProxy = 306,
|
||||||
|
TemporaryRedirect = 307,
|
||||||
|
PermanentRedirect = 308,
|
||||||
|
BadRequest = 400,
|
||||||
|
Unauthorized = 401,
|
||||||
|
PaymentRequired = 402,
|
||||||
|
Forbidden = 403,
|
||||||
|
NotFound = 404,
|
||||||
|
MethodNotAllowed = 405,
|
||||||
|
NotAcceptable = 406,
|
||||||
|
ProxyAuthenticationRequired = 407,
|
||||||
|
RequestTimeout = 408,
|
||||||
|
Conflict = 409,
|
||||||
|
Gone = 410,
|
||||||
|
TooManyRequests = 429,
|
||||||
|
InternalServerError = 500,
|
||||||
|
NotImplemented = 501,
|
||||||
|
BadGateway = 502,
|
||||||
|
ServiceUnavailable = 503,
|
||||||
|
GatewayTimeout = 504
|
||||||
|
}
|
||||||
|
export declare enum Headers {
|
||||||
|
Accept = "accept",
|
||||||
|
ContentType = "content-type"
|
||||||
|
}
|
||||||
|
export declare enum MediaTypes {
|
||||||
|
ApplicationJson = "application/json"
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
||||||
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||||
|
*/
|
||||||
|
export declare function getProxyUrl(serverUrl: string): string;
|
||||||
|
export declare class HttpClientError extends Error {
|
||||||
|
constructor(message: string, statusCode: number);
|
||||||
|
statusCode: number;
|
||||||
|
result?: any;
|
||||||
|
}
|
||||||
|
export declare class HttpClientResponse {
|
||||||
|
constructor(message: http.IncomingMessage);
|
||||||
|
message: http.IncomingMessage;
|
||||||
|
readBody(): Promise<string>;
|
||||||
|
}
|
||||||
|
export declare function isHttps(requestUrl: string): boolean;
|
||||||
|
export declare class HttpClient {
|
||||||
|
userAgent: string | undefined;
|
||||||
|
handlers: ifm.RequestHandler[];
|
||||||
|
requestOptions: ifm.RequestOptions | undefined;
|
||||||
|
private _ignoreSslError;
|
||||||
|
private _socketTimeout;
|
||||||
|
private _allowRedirects;
|
||||||
|
private _allowRedirectDowngrade;
|
||||||
|
private _maxRedirects;
|
||||||
|
private _allowRetries;
|
||||||
|
private _maxRetries;
|
||||||
|
private _agent;
|
||||||
|
private _proxyAgent;
|
||||||
|
private _keepAlive;
|
||||||
|
private _disposed;
|
||||||
|
constructor(userAgent?: string, handlers?: ifm.RequestHandler[], requestOptions?: ifm.RequestOptions);
|
||||||
|
options(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
get(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
del(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
post(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
patch(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
put(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
head(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
/**
|
||||||
|
* Gets a typed object from an endpoint
|
||||||
|
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
||||||
|
*/
|
||||||
|
getJson<T>(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>;
|
||||||
|
postJson<T>(requestUrl: string, obj: any, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>;
|
||||||
|
putJson<T>(requestUrl: string, obj: any, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>;
|
||||||
|
patchJson<T>(requestUrl: string, obj: any, additionalHeaders?: http.OutgoingHttpHeaders): Promise<ifm.TypedResponse<T>>;
|
||||||
|
/**
|
||||||
|
* Makes a raw http request.
|
||||||
|
* All other methods such as get, post, patch, and request ultimately call this.
|
||||||
|
* Prefer get, del, post and patch
|
||||||
|
*/
|
||||||
|
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream | null, headers?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
/**
|
||||||
|
* Needs to be called if keepAlive is set to true in request options.
|
||||||
|
*/
|
||||||
|
dispose(): void;
|
||||||
|
/**
|
||||||
|
* Raw request.
|
||||||
|
* @param info
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
requestRaw(info: ifm.RequestInfo, data: string | NodeJS.ReadableStream | null): Promise<HttpClientResponse>;
|
||||||
|
/**
|
||||||
|
* Raw request with callback.
|
||||||
|
* @param info
|
||||||
|
* @param data
|
||||||
|
* @param onResult
|
||||||
|
*/
|
||||||
|
requestRawWithCallback(info: ifm.RequestInfo, data: string | NodeJS.ReadableStream | null, onResult: (err?: Error, res?: HttpClientResponse) => void): void;
|
||||||
|
/**
|
||||||
|
* Gets an http agent. This function is useful when you need an http agent that handles
|
||||||
|
* routing through a proxy server - depending upon the url and proxy environment variables.
|
||||||
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||||
|
*/
|
||||||
|
getAgent(serverUrl: string): http.Agent;
|
||||||
|
private _prepareRequest;
|
||||||
|
private _mergeHeaders;
|
||||||
|
private _getExistingOrDefaultHeader;
|
||||||
|
private _getAgent;
|
||||||
|
private _performExponentialBackoff;
|
||||||
|
private _processResponse;
|
||||||
|
}
|
605
node_modules/@actions/http-client/lib/index.js
generated
vendored
Normal file
605
node_modules/@actions/http-client/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,605 @@
|
|||||||
|
"use strict";
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0;
|
||||||
|
const http = __importStar(require("http"));
|
||||||
|
const https = __importStar(require("https"));
|
||||||
|
const pm = __importStar(require("./proxy"));
|
||||||
|
const tunnel = __importStar(require("tunnel"));
|
||||||
|
var HttpCodes;
|
||||||
|
(function (HttpCodes) {
|
||||||
|
HttpCodes[HttpCodes["OK"] = 200] = "OK";
|
||||||
|
HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices";
|
||||||
|
HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently";
|
||||||
|
HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved";
|
||||||
|
HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther";
|
||||||
|
HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified";
|
||||||
|
HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy";
|
||||||
|
HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy";
|
||||||
|
HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
||||||
|
HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect";
|
||||||
|
HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest";
|
||||||
|
HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized";
|
||||||
|
HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired";
|
||||||
|
HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden";
|
||||||
|
HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound";
|
||||||
|
HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
||||||
|
HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable";
|
||||||
|
HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
||||||
|
HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout";
|
||||||
|
HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict";
|
||||||
|
HttpCodes[HttpCodes["Gone"] = 410] = "Gone";
|
||||||
|
HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests";
|
||||||
|
HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError";
|
||||||
|
HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented";
|
||||||
|
HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
|
||||||
|
HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
||||||
|
HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
|
||||||
|
})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {}));
|
||||||
|
var Headers;
|
||||||
|
(function (Headers) {
|
||||||
|
Headers["Accept"] = "accept";
|
||||||
|
Headers["ContentType"] = "content-type";
|
||||||
|
})(Headers = exports.Headers || (exports.Headers = {}));
|
||||||
|
var MediaTypes;
|
||||||
|
(function (MediaTypes) {
|
||||||
|
MediaTypes["ApplicationJson"] = "application/json";
|
||||||
|
})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {}));
|
||||||
|
/**
|
||||||
|
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
||||||
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||||
|
*/
|
||||||
|
function getProxyUrl(serverUrl) {
|
||||||
|
const proxyUrl = pm.getProxyUrl(new URL(serverUrl));
|
||||||
|
return proxyUrl ? proxyUrl.href : '';
|
||||||
|
}
|
||||||
|
exports.getProxyUrl = getProxyUrl;
|
||||||
|
const HttpRedirectCodes = [
|
||||||
|
HttpCodes.MovedPermanently,
|
||||||
|
HttpCodes.ResourceMoved,
|
||||||
|
HttpCodes.SeeOther,
|
||||||
|
HttpCodes.TemporaryRedirect,
|
||||||
|
HttpCodes.PermanentRedirect
|
||||||
|
];
|
||||||
|
const HttpResponseRetryCodes = [
|
||||||
|
HttpCodes.BadGateway,
|
||||||
|
HttpCodes.ServiceUnavailable,
|
||||||
|
HttpCodes.GatewayTimeout
|
||||||
|
];
|
||||||
|
const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
|
||||||
|
const ExponentialBackoffCeiling = 10;
|
||||||
|
const ExponentialBackoffTimeSlice = 5;
|
||||||
|
class HttpClientError extends Error {
|
||||||
|
constructor(message, statusCode) {
|
||||||
|
super(message);
|
||||||
|
this.name = 'HttpClientError';
|
||||||
|
this.statusCode = statusCode;
|
||||||
|
Object.setPrototypeOf(this, HttpClientError.prototype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.HttpClientError = HttpClientError;
|
||||||
|
class HttpClientResponse {
|
||||||
|
constructor(message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
readBody() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let output = Buffer.alloc(0);
|
||||||
|
this.message.on('data', (chunk) => {
|
||||||
|
output = Buffer.concat([output, chunk]);
|
||||||
|
});
|
||||||
|
this.message.on('end', () => {
|
||||||
|
resolve(output.toString());
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.HttpClientResponse = HttpClientResponse;
|
||||||
|
function isHttps(requestUrl) {
|
||||||
|
const parsedUrl = new URL(requestUrl);
|
||||||
|
return parsedUrl.protocol === 'https:';
|
||||||
|
}
|
||||||
|
exports.isHttps = isHttps;
|
||||||
|
class HttpClient {
|
||||||
|
constructor(userAgent, handlers, requestOptions) {
|
||||||
|
this._ignoreSslError = false;
|
||||||
|
this._allowRedirects = true;
|
||||||
|
this._allowRedirectDowngrade = false;
|
||||||
|
this._maxRedirects = 50;
|
||||||
|
this._allowRetries = false;
|
||||||
|
this._maxRetries = 1;
|
||||||
|
this._keepAlive = false;
|
||||||
|
this._disposed = false;
|
||||||
|
this.userAgent = userAgent;
|
||||||
|
this.handlers = handlers || [];
|
||||||
|
this.requestOptions = requestOptions;
|
||||||
|
if (requestOptions) {
|
||||||
|
if (requestOptions.ignoreSslError != null) {
|
||||||
|
this._ignoreSslError = requestOptions.ignoreSslError;
|
||||||
|
}
|
||||||
|
this._socketTimeout = requestOptions.socketTimeout;
|
||||||
|
if (requestOptions.allowRedirects != null) {
|
||||||
|
this._allowRedirects = requestOptions.allowRedirects;
|
||||||
|
}
|
||||||
|
if (requestOptions.allowRedirectDowngrade != null) {
|
||||||
|
this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;
|
||||||
|
}
|
||||||
|
if (requestOptions.maxRedirects != null) {
|
||||||
|
this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);
|
||||||
|
}
|
||||||
|
if (requestOptions.keepAlive != null) {
|
||||||
|
this._keepAlive = requestOptions.keepAlive;
|
||||||
|
}
|
||||||
|
if (requestOptions.allowRetries != null) {
|
||||||
|
this._allowRetries = requestOptions.allowRetries;
|
||||||
|
}
|
||||||
|
if (requestOptions.maxRetries != null) {
|
||||||
|
this._maxRetries = requestOptions.maxRetries;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
options(requestUrl, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
get(requestUrl, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request('GET', requestUrl, null, additionalHeaders || {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
del(requestUrl, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request('DELETE', requestUrl, null, additionalHeaders || {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
post(requestUrl, data, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request('POST', requestUrl, data, additionalHeaders || {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
patch(requestUrl, data, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request('PATCH', requestUrl, data, additionalHeaders || {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
put(requestUrl, data, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request('PUT', requestUrl, data, additionalHeaders || {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
head(requestUrl, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request('HEAD', requestUrl, null, additionalHeaders || {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
sendStream(verb, requestUrl, stream, additionalHeaders) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.request(verb, requestUrl, stream, additionalHeaders);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets a typed object from an endpoint
|
||||||
|
* Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise
|
||||||
|
*/
|
||||||
|
getJson(requestUrl, additionalHeaders = {}) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||||
|
const res = yield this.get(requestUrl, additionalHeaders);
|
||||||
|
return this._processResponse(res, this.requestOptions);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
postJson(requestUrl, obj, additionalHeaders = {}) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const data = JSON.stringify(obj, null, 2);
|
||||||
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||||
|
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
||||||
|
const res = yield this.post(requestUrl, data, additionalHeaders);
|
||||||
|
return this._processResponse(res, this.requestOptions);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
putJson(requestUrl, obj, additionalHeaders = {}) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const data = JSON.stringify(obj, null, 2);
|
||||||
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||||
|
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
||||||
|
const res = yield this.put(requestUrl, data, additionalHeaders);
|
||||||
|
return this._processResponse(res, this.requestOptions);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
patchJson(requestUrl, obj, additionalHeaders = {}) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const data = JSON.stringify(obj, null, 2);
|
||||||
|
additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);
|
||||||
|
additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);
|
||||||
|
const res = yield this.patch(requestUrl, data, additionalHeaders);
|
||||||
|
return this._processResponse(res, this.requestOptions);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Makes a raw http request.
|
||||||
|
* All other methods such as get, post, patch, and request ultimately call this.
|
||||||
|
* Prefer get, del, post and patch
|
||||||
|
*/
|
||||||
|
request(verb, requestUrl, data, headers) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (this._disposed) {
|
||||||
|
throw new Error('Client has already been disposed.');
|
||||||
|
}
|
||||||
|
const parsedUrl = new URL(requestUrl);
|
||||||
|
let info = this._prepareRequest(verb, parsedUrl, headers);
|
||||||
|
// Only perform retries on reads since writes may not be idempotent.
|
||||||
|
const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)
|
||||||
|
? this._maxRetries + 1
|
||||||
|
: 1;
|
||||||
|
let numTries = 0;
|
||||||
|
let response;
|
||||||
|
do {
|
||||||
|
response = yield this.requestRaw(info, data);
|
||||||
|
// Check if it's an authentication challenge
|
||||||
|
if (response &&
|
||||||
|
response.message &&
|
||||||
|
response.message.statusCode === HttpCodes.Unauthorized) {
|
||||||
|
let authenticationHandler;
|
||||||
|
for (const handler of this.handlers) {
|
||||||
|
if (handler.canHandleAuthentication(response)) {
|
||||||
|
authenticationHandler = handler;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (authenticationHandler) {
|
||||||
|
return authenticationHandler.handleAuthentication(this, info, data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// We have received an unauthorized response but have no handlers to handle it.
|
||||||
|
// Let the response return to the caller.
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let redirectsRemaining = this._maxRedirects;
|
||||||
|
while (response.message.statusCode &&
|
||||||
|
HttpRedirectCodes.includes(response.message.statusCode) &&
|
||||||
|
this._allowRedirects &&
|
||||||
|
redirectsRemaining > 0) {
|
||||||
|
const redirectUrl = response.message.headers['location'];
|
||||||
|
if (!redirectUrl) {
|
||||||
|
// if there's no location to redirect to, we won't
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const parsedRedirectUrl = new URL(redirectUrl);
|
||||||
|
if (parsedUrl.protocol === 'https:' &&
|
||||||
|
parsedUrl.protocol !== parsedRedirectUrl.protocol &&
|
||||||
|
!this._allowRedirectDowngrade) {
|
||||||
|
throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');
|
||||||
|
}
|
||||||
|
// we need to finish reading the response before reassigning response
|
||||||
|
// which will leak the open socket.
|
||||||
|
yield response.readBody();
|
||||||
|
// strip authorization header if redirected to a different hostname
|
||||||
|
if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {
|
||||||
|
for (const header in headers) {
|
||||||
|
// header names are case insensitive
|
||||||
|
if (header.toLowerCase() === 'authorization') {
|
||||||
|
delete headers[header];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// let's make the request with the new redirectUrl
|
||||||
|
info = this._prepareRequest(verb, parsedRedirectUrl, headers);
|
||||||
|
response = yield this.requestRaw(info, data);
|
||||||
|
redirectsRemaining--;
|
||||||
|
}
|
||||||
|
if (!response.message.statusCode ||
|
||||||
|
!HttpResponseRetryCodes.includes(response.message.statusCode)) {
|
||||||
|
// If not a retry code, return immediately instead of retrying
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
numTries += 1;
|
||||||
|
if (numTries < maxTries) {
|
||||||
|
yield response.readBody();
|
||||||
|
yield this._performExponentialBackoff(numTries);
|
||||||
|
}
|
||||||
|
} while (numTries < maxTries);
|
||||||
|
return response;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Needs to be called if keepAlive is set to true in request options.
|
||||||
|
*/
|
||||||
|
dispose() {
|
||||||
|
if (this._agent) {
|
||||||
|
this._agent.destroy();
|
||||||
|
}
|
||||||
|
this._disposed = true;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Raw request.
|
||||||
|
* @param info
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
requestRaw(info, data) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
function callbackForResult(err, res) {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
else if (!res) {
|
||||||
|
// If `err` is not passed, then `res` must be passed.
|
||||||
|
reject(new Error('Unknown error'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resolve(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.requestRawWithCallback(info, data, callbackForResult);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Raw request with callback.
|
||||||
|
* @param info
|
||||||
|
* @param data
|
||||||
|
* @param onResult
|
||||||
|
*/
|
||||||
|
requestRawWithCallback(info, data, onResult) {
|
||||||
|
if (typeof data === 'string') {
|
||||||
|
if (!info.options.headers) {
|
||||||
|
info.options.headers = {};
|
||||||
|
}
|
||||||
|
info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
|
||||||
|
}
|
||||||
|
let callbackCalled = false;
|
||||||
|
function handleResult(err, res) {
|
||||||
|
if (!callbackCalled) {
|
||||||
|
callbackCalled = true;
|
||||||
|
onResult(err, res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const req = info.httpModule.request(info.options, (msg) => {
|
||||||
|
const res = new HttpClientResponse(msg);
|
||||||
|
handleResult(undefined, res);
|
||||||
|
});
|
||||||
|
let socket;
|
||||||
|
req.on('socket', sock => {
|
||||||
|
socket = sock;
|
||||||
|
});
|
||||||
|
// If we ever get disconnected, we want the socket to timeout eventually
|
||||||
|
req.setTimeout(this._socketTimeout || 3 * 60000, () => {
|
||||||
|
if (socket) {
|
||||||
|
socket.end();
|
||||||
|
}
|
||||||
|
handleResult(new Error(`Request timeout: ${info.options.path}`));
|
||||||
|
});
|
||||||
|
req.on('error', function (err) {
|
||||||
|
// err has statusCode property
|
||||||
|
// res should have headers
|
||||||
|
handleResult(err);
|
||||||
|
});
|
||||||
|
if (data && typeof data === 'string') {
|
||||||
|
req.write(data, 'utf8');
|
||||||
|
}
|
||||||
|
if (data && typeof data !== 'string') {
|
||||||
|
data.on('close', function () {
|
||||||
|
req.end();
|
||||||
|
});
|
||||||
|
data.pipe(req);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
req.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets an http agent. This function is useful when you need an http agent that handles
|
||||||
|
* routing through a proxy server - depending upon the url and proxy environment variables.
|
||||||
|
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||||
|
*/
|
||||||
|
getAgent(serverUrl) {
|
||||||
|
const parsedUrl = new URL(serverUrl);
|
||||||
|
return this._getAgent(parsedUrl);
|
||||||
|
}
|
||||||
|
_prepareRequest(method, requestUrl, headers) {
|
||||||
|
const info = {};
|
||||||
|
info.parsedUrl = requestUrl;
|
||||||
|
const usingSsl = info.parsedUrl.protocol === 'https:';
|
||||||
|
info.httpModule = usingSsl ? https : http;
|
||||||
|
const defaultPort = usingSsl ? 443 : 80;
|
||||||
|
info.options = {};
|
||||||
|
info.options.host = info.parsedUrl.hostname;
|
||||||
|
info.options.port = info.parsedUrl.port
|
||||||
|
? parseInt(info.parsedUrl.port)
|
||||||
|
: defaultPort;
|
||||||
|
info.options.path =
|
||||||
|
(info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');
|
||||||
|
info.options.method = method;
|
||||||
|
info.options.headers = this._mergeHeaders(headers);
|
||||||
|
if (this.userAgent != null) {
|
||||||
|
info.options.headers['user-agent'] = this.userAgent;
|
||||||
|
}
|
||||||
|
info.options.agent = this._getAgent(info.parsedUrl);
|
||||||
|
// gives handlers an opportunity to participate
|
||||||
|
if (this.handlers) {
|
||||||
|
for (const handler of this.handlers) {
|
||||||
|
handler.prepareRequest(info.options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
_mergeHeaders(headers) {
|
||||||
|
if (this.requestOptions && this.requestOptions.headers) {
|
||||||
|
return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {}));
|
||||||
|
}
|
||||||
|
return lowercaseKeys(headers || {});
|
||||||
|
}
|
||||||
|
_getExistingOrDefaultHeader(additionalHeaders, header, _default) {
|
||||||
|
let clientHeader;
|
||||||
|
if (this.requestOptions && this.requestOptions.headers) {
|
||||||
|
clientHeader = lowercaseKeys(this.requestOptions.headers)[header];
|
||||||
|
}
|
||||||
|
return additionalHeaders[header] || clientHeader || _default;
|
||||||
|
}
|
||||||
|
_getAgent(parsedUrl) {
|
||||||
|
let agent;
|
||||||
|
const proxyUrl = pm.getProxyUrl(parsedUrl);
|
||||||
|
const useProxy = proxyUrl && proxyUrl.hostname;
|
||||||
|
if (this._keepAlive && useProxy) {
|
||||||
|
agent = this._proxyAgent;
|
||||||
|
}
|
||||||
|
if (this._keepAlive && !useProxy) {
|
||||||
|
agent = this._agent;
|
||||||
|
}
|
||||||
|
// if agent is already assigned use that agent.
|
||||||
|
if (agent) {
|
||||||
|
return agent;
|
||||||
|
}
|
||||||
|
const usingSsl = parsedUrl.protocol === 'https:';
|
||||||
|
let maxSockets = 100;
|
||||||
|
if (this.requestOptions) {
|
||||||
|
maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;
|
||||||
|
}
|
||||||
|
// This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis.
|
||||||
|
if (proxyUrl && proxyUrl.hostname) {
|
||||||
|
const agentOptions = {
|
||||||
|
maxSockets,
|
||||||
|
keepAlive: this._keepAlive,
|
||||||
|
proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && {
|
||||||
|
proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`
|
||||||
|
})), { host: proxyUrl.hostname, port: proxyUrl.port })
|
||||||
|
};
|
||||||
|
let tunnelAgent;
|
||||||
|
const overHttps = proxyUrl.protocol === 'https:';
|
||||||
|
if (usingSsl) {
|
||||||
|
tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;
|
||||||
|
}
|
||||||
|
agent = tunnelAgent(agentOptions);
|
||||||
|
this._proxyAgent = agent;
|
||||||
|
}
|
||||||
|
// if reusing agent across request and tunneling agent isn't assigned create a new agent
|
||||||
|
if (this._keepAlive && !agent) {
|
||||||
|
const options = { keepAlive: this._keepAlive, maxSockets };
|
||||||
|
agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
|
||||||
|
this._agent = agent;
|
||||||
|
}
|
||||||
|
// if not using private agent and tunnel agent isn't setup then use global agent
|
||||||
|
if (!agent) {
|
||||||
|
agent = usingSsl ? https.globalAgent : http.globalAgent;
|
||||||
|
}
|
||||||
|
if (usingSsl && this._ignoreSslError) {
|
||||||
|
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
|
||||||
|
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
|
||||||
|
// we have to cast it to any and change it directly
|
||||||
|
agent.options = Object.assign(agent.options || {}, {
|
||||||
|
rejectUnauthorized: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return agent;
|
||||||
|
}
|
||||||
|
_performExponentialBackoff(retryNumber) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);
|
||||||
|
const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);
|
||||||
|
return new Promise(resolve => setTimeout(() => resolve(), ms));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_processResponse(res, options) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const statusCode = res.message.statusCode || 0;
|
||||||
|
const response = {
|
||||||
|
statusCode,
|
||||||
|
result: null,
|
||||||
|
headers: {}
|
||||||
|
};
|
||||||
|
// not found leads to null obj returned
|
||||||
|
if (statusCode === HttpCodes.NotFound) {
|
||||||
|
resolve(response);
|
||||||
|
}
|
||||||
|
// get the result from the body
|
||||||
|
function dateTimeDeserializer(key, value) {
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
const a = new Date(value);
|
||||||
|
if (!isNaN(a.valueOf())) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
let obj;
|
||||||
|
let contents;
|
||||||
|
try {
|
||||||
|
contents = yield res.readBody();
|
||||||
|
if (contents && contents.length > 0) {
|
||||||
|
if (options && options.deserializeDates) {
|
||||||
|
obj = JSON.parse(contents, dateTimeDeserializer);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
obj = JSON.parse(contents);
|
||||||
|
}
|
||||||
|
response.result = obj;
|
||||||
|
}
|
||||||
|
response.headers = res.message.headers;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// Invalid resource (contents not json); leaving result obj null
|
||||||
|
}
|
||||||
|
// note that 3xx redirects are handled by the http layer.
|
||||||
|
if (statusCode > 299) {
|
||||||
|
let msg;
|
||||||
|
// if exception/error in body, attempt to get better error
|
||||||
|
if (obj && obj.message) {
|
||||||
|
msg = obj.message;
|
||||||
|
}
|
||||||
|
else if (contents && contents.length > 0) {
|
||||||
|
// it may be the case that the exception is in the body message as string
|
||||||
|
msg = contents;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
msg = `Failed request: (${statusCode})`;
|
||||||
|
}
|
||||||
|
const err = new HttpClientError(msg, statusCode);
|
||||||
|
err.result = response.result;
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resolve(response);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.HttpClient = HttpClient;
|
||||||
|
const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});
|
||||||
|
//# sourceMappingURL=index.js.map
|
1
node_modules/@actions/http-client/lib/index.js.map
generated
vendored
Normal file
1
node_modules/@actions/http-client/lib/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
44
node_modules/@actions/http-client/lib/interfaces.d.ts
generated
vendored
Normal file
44
node_modules/@actions/http-client/lib/interfaces.d.ts
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import * as http from 'http';
|
||||||
|
import * as https from 'https';
|
||||||
|
import { HttpClientResponse } from './index';
|
||||||
|
export interface HttpClient {
|
||||||
|
options(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
get(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
del(requestUrl: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
post(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
patch(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
put(requestUrl: string, data: string, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: http.OutgoingHttpHeaders): Promise<HttpClientResponse>;
|
||||||
|
requestRaw(info: RequestInfo, data: string | NodeJS.ReadableStream): Promise<HttpClientResponse>;
|
||||||
|
requestRawWithCallback(info: RequestInfo, data: string | NodeJS.ReadableStream, onResult: (err?: Error, res?: HttpClientResponse) => void): void;
|
||||||
|
}
|
||||||
|
export interface RequestHandler {
|
||||||
|
prepareRequest(options: http.RequestOptions): void;
|
||||||
|
canHandleAuthentication(response: HttpClientResponse): boolean;
|
||||||
|
handleAuthentication(httpClient: HttpClient, requestInfo: RequestInfo, data: string | NodeJS.ReadableStream | null): Promise<HttpClientResponse>;
|
||||||
|
}
|
||||||
|
export interface RequestInfo {
|
||||||
|
options: http.RequestOptions;
|
||||||
|
parsedUrl: URL;
|
||||||
|
httpModule: typeof http | typeof https;
|
||||||
|
}
|
||||||
|
export interface RequestOptions {
|
||||||
|
headers?: http.OutgoingHttpHeaders;
|
||||||
|
socketTimeout?: number;
|
||||||
|
ignoreSslError?: boolean;
|
||||||
|
allowRedirects?: boolean;
|
||||||
|
allowRedirectDowngrade?: boolean;
|
||||||
|
maxRedirects?: number;
|
||||||
|
maxSockets?: number;
|
||||||
|
keepAlive?: boolean;
|
||||||
|
deserializeDates?: boolean;
|
||||||
|
allowRetries?: boolean;
|
||||||
|
maxRetries?: number;
|
||||||
|
}
|
||||||
|
export interface TypedResponse<T> {
|
||||||
|
statusCode: number;
|
||||||
|
result: T | null;
|
||||||
|
headers: http.IncomingHttpHeaders;
|
||||||
|
}
|
3
node_modules/@actions/http-client/lib/interfaces.js
generated
vendored
Normal file
3
node_modules/@actions/http-client/lib/interfaces.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
//# sourceMappingURL=interfaces.js.map
|
1
node_modules/@actions/http-client/lib/interfaces.js.map
generated
vendored
Normal file
1
node_modules/@actions/http-client/lib/interfaces.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}
|
2
node_modules/@actions/http-client/lib/proxy.d.ts
generated
vendored
Normal file
2
node_modules/@actions/http-client/lib/proxy.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export declare function getProxyUrl(reqUrl: URL): URL | undefined;
|
||||||
|
export declare function checkBypass(reqUrl: URL): boolean;
|
61
node_modules/@actions/http-client/lib/proxy.js
generated
vendored
Normal file
61
node_modules/@actions/http-client/lib/proxy.js
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.checkBypass = exports.getProxyUrl = void 0;
|
||||||
|
function getProxyUrl(reqUrl) {
|
||||||
|
const usingSsl = reqUrl.protocol === 'https:';
|
||||||
|
if (checkBypass(reqUrl)) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
const proxyVar = (() => {
|
||||||
|
if (usingSsl) {
|
||||||
|
return process.env['https_proxy'] || process.env['HTTPS_PROXY'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return process.env['http_proxy'] || process.env['HTTP_PROXY'];
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
if (proxyVar) {
|
||||||
|
return new URL(proxyVar);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.getProxyUrl = getProxyUrl;
|
||||||
|
function checkBypass(reqUrl) {
|
||||||
|
if (!reqUrl.hostname) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';
|
||||||
|
if (!noProxy) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Determine the request port
|
||||||
|
let reqPort;
|
||||||
|
if (reqUrl.port) {
|
||||||
|
reqPort = Number(reqUrl.port);
|
||||||
|
}
|
||||||
|
else if (reqUrl.protocol === 'http:') {
|
||||||
|
reqPort = 80;
|
||||||
|
}
|
||||||
|
else if (reqUrl.protocol === 'https:') {
|
||||||
|
reqPort = 443;
|
||||||
|
}
|
||||||
|
// Format the request hostname and hostname with port
|
||||||
|
const upperReqHosts = [reqUrl.hostname.toUpperCase()];
|
||||||
|
if (typeof reqPort === 'number') {
|
||||||
|
upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
|
||||||
|
}
|
||||||
|
// Compare request host against noproxy
|
||||||
|
for (const upperNoProxyItem of noProxy
|
||||||
|
.split(',')
|
||||||
|
.map(x => x.trim().toUpperCase())
|
||||||
|
.filter(x => x)) {
|
||||||
|
if (upperReqHosts.some(x => x === upperNoProxyItem)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
exports.checkBypass = checkBypass;
|
||||||
|
//# sourceMappingURL=proxy.js.map
|
1
node_modules/@actions/http-client/lib/proxy.js.map
generated
vendored
Normal file
1
node_modules/@actions/http-client/lib/proxy.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAC,MAAW;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAA;IAE7C,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QACvB,OAAO,SAAS,CAAA;KACjB;IAED,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE;QACrB,IAAI,QAAQ,EAAE;YACZ,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;SAChE;aAAM;YACL,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;SAC9D;IACH,CAAC,CAAC,EAAE,CAAA;IAEJ,IAAI,QAAQ,EAAE;QACZ,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAA;KACzB;SAAM;QACL,OAAO,SAAS,CAAA;KACjB;AACH,CAAC;AApBD,kCAoBC;AAED,SAAgB,WAAW,CAAC,MAAW;IACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;QACpB,OAAO,KAAK,CAAA;KACb;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAA;IACxE,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAA;KACb;IAED,6BAA6B;IAC7B,IAAI,OAA2B,CAAA;IAC/B,IAAI,MAAM,CAAC,IAAI,EAAE;QACf,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;KAC9B;SAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,EAAE;QACtC,OAAO,GAAG,EAAE,CAAA;KACb;SAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE;QACvC,OAAO,GAAG,GAAG,CAAA;KACd;IAED,qDAAqD;IACrD,MAAM,aAAa,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAA;IACrD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,aAAa,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC,CAAA;KACrD;IAED,uCAAuC;IACvC,KAAK,MAAM,gBAAgB,IAAI,OAAO;SACnC,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;SAChC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;QACjB,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,gBAAgB,CAAC,EAAE;YACnD,OAAO,IAAI,CAAA;SACZ;KACF;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AArCD,kCAqCC"}
|
21
node_modules/@nodelib/fs.scandir/LICENSE
generated
vendored
Normal file
21
node_modules/@nodelib/fs.scandir/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) Denis Malinochkin
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
171
node_modules/@nodelib/fs.scandir/README.md
generated
vendored
Normal file
171
node_modules/@nodelib/fs.scandir/README.md
generated
vendored
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
# @nodelib/fs.scandir
|
||||||
|
|
||||||
|
> List files and directories inside the specified directory.
|
||||||
|
|
||||||
|
## :bulb: Highlights
|
||||||
|
|
||||||
|
The package is aimed at obtaining information about entries in the directory.
|
||||||
|
|
||||||
|
* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional).
|
||||||
|
* :gear: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type. See [`old` and `modern` mode](#old-and-modern-mode).
|
||||||
|
* :link: Can safely work with broken symbolic links.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```console
|
||||||
|
npm install @nodelib/fs.scandir
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import * as fsScandir from '@nodelib/fs.scandir';
|
||||||
|
|
||||||
|
fsScandir.scandir('path', (error, stats) => { /* … */ });
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### .scandir(path, [optionsOrSettings], callback)
|
||||||
|
|
||||||
|
Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path with standard callback-style.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
fsScandir.scandir('path', (error, entries) => { /* … */ });
|
||||||
|
fsScandir.scandir('path', {}, (error, entries) => { /* … */ });
|
||||||
|
fsScandir.scandir('path', new fsScandir.Settings(), (error, entries) => { /* … */ });
|
||||||
|
```
|
||||||
|
|
||||||
|
### .scandirSync(path, [optionsOrSettings])
|
||||||
|
|
||||||
|
Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const entries = fsScandir.scandirSync('path');
|
||||||
|
const entries = fsScandir.scandirSync('path', {});
|
||||||
|
const entries = fsScandir.scandirSync(('path', new fsScandir.Settings());
|
||||||
|
```
|
||||||
|
|
||||||
|
#### path
|
||||||
|
|
||||||
|
* Required: `true`
|
||||||
|
* Type: `string | Buffer | URL`
|
||||||
|
|
||||||
|
A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||||
|
|
||||||
|
#### optionsOrSettings
|
||||||
|
|
||||||
|
* Required: `false`
|
||||||
|
* Type: `Options | Settings`
|
||||||
|
* Default: An instance of `Settings` class
|
||||||
|
|
||||||
|
An [`Options`](#options) object or an instance of [`Settings`](#settingsoptions) class.
|
||||||
|
|
||||||
|
> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class.
|
||||||
|
|
||||||
|
### Settings([options])
|
||||||
|
|
||||||
|
A class of full settings of the package.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const settings = new fsScandir.Settings({ followSymbolicLinks: false });
|
||||||
|
|
||||||
|
const entries = fsScandir.scandirSync('path', settings);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Entry
|
||||||
|
|
||||||
|
* `name` — The name of the entry (`unknown.txt`).
|
||||||
|
* `path` — The path of the entry relative to call directory (`root/unknown.txt`).
|
||||||
|
* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class. On Node.js below 10.10 will be emulated by [`DirentFromStats`](./src/utils/fs.ts) class.
|
||||||
|
* `stats` (optional) — An instance of `fs.Stats` class.
|
||||||
|
|
||||||
|
For example, the `scandir` call for `tools` directory with one directory inside:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
{
|
||||||
|
dirent: Dirent { name: 'typedoc', /* … */ },
|
||||||
|
name: 'typedoc',
|
||||||
|
path: 'tools/typedoc'
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
### stats
|
||||||
|
|
||||||
|
* Type: `boolean`
|
||||||
|
* Default: `false`
|
||||||
|
|
||||||
|
Adds an instance of `fs.Stats` class to the [`Entry`](#entry).
|
||||||
|
|
||||||
|
> :book: Always use `fs.readdir` without the `withFileTypes` option. ??TODO??
|
||||||
|
|
||||||
|
### followSymbolicLinks
|
||||||
|
|
||||||
|
* Type: `boolean`
|
||||||
|
* Default: `false`
|
||||||
|
|
||||||
|
Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`.
|
||||||
|
|
||||||
|
### `throwErrorOnBrokenSymbolicLink`
|
||||||
|
|
||||||
|
* Type: `boolean`
|
||||||
|
* Default: `true`
|
||||||
|
|
||||||
|
Throw an error when symbolic link is broken if `true` or safely use `lstat` call if `false`.
|
||||||
|
|
||||||
|
### `pathSegmentSeparator`
|
||||||
|
|
||||||
|
* Type: `string`
|
||||||
|
* Default: `path.sep`
|
||||||
|
|
||||||
|
By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead.
|
||||||
|
|
||||||
|
### `fs`
|
||||||
|
|
||||||
|
* Type: [`FileSystemAdapter`](./src/adapters/fs.ts)
|
||||||
|
* Default: A default FS methods
|
||||||
|
|
||||||
|
By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
interface FileSystemAdapter {
|
||||||
|
lstat?: typeof fs.lstat;
|
||||||
|
stat?: typeof fs.stat;
|
||||||
|
lstatSync?: typeof fs.lstatSync;
|
||||||
|
statSync?: typeof fs.statSync;
|
||||||
|
readdir?: typeof fs.readdir;
|
||||||
|
readdirSync?: typeof fs.readdirSync;
|
||||||
|
}
|
||||||
|
|
||||||
|
const settings = new fsScandir.Settings({
|
||||||
|
fs: { lstat: fakeLstat }
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## `old` and `modern` mode
|
||||||
|
|
||||||
|
This package has two modes that are used depending on the environment and parameters of use.
|
||||||
|
|
||||||
|
### old
|
||||||
|
|
||||||
|
* Node.js below `10.10` or when the `stats` option is enabled
|
||||||
|
|
||||||
|
When working in the old mode, the directory is read first (`fs.readdir`), then the type of entries is determined (`fs.lstat` and/or `fs.stat` for symbolic links).
|
||||||
|
|
||||||
|
### modern
|
||||||
|
|
||||||
|
* Node.js 10.10+ and the `stats` option is disabled
|
||||||
|
|
||||||
|
In the modern mode, reading the directory (`fs.readdir` with the `withFileTypes` option) is combined with obtaining information about its entries. An additional call for symbolic links (`fs.stat`) is still present.
|
||||||
|
|
||||||
|
This mode makes fewer calls to the file system. It's faster.
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This software is released under the terms of the MIT license.
|
20
node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts
generated
vendored
Normal file
20
node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import type * as fsStat from '@nodelib/fs.stat';
|
||||||
|
import type { Dirent, ErrnoException } from '../types';
|
||||||
|
export interface ReaddirAsynchronousMethod {
|
||||||
|
(filepath: string, options: {
|
||||||
|
withFileTypes: true;
|
||||||
|
}, callback: (error: ErrnoException | null, files: Dirent[]) => void): void;
|
||||||
|
(filepath: string, callback: (error: ErrnoException | null, files: string[]) => void): void;
|
||||||
|
}
|
||||||
|
export interface ReaddirSynchronousMethod {
|
||||||
|
(filepath: string, options: {
|
||||||
|
withFileTypes: true;
|
||||||
|
}): Dirent[];
|
||||||
|
(filepath: string): string[];
|
||||||
|
}
|
||||||
|
export declare type FileSystemAdapter = fsStat.FileSystemAdapter & {
|
||||||
|
readdir: ReaddirAsynchronousMethod;
|
||||||
|
readdirSync: ReaddirSynchronousMethod;
|
||||||
|
};
|
||||||
|
export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter;
|
||||||
|
export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter;
|
19
node_modules/@nodelib/fs.scandir/out/adapters/fs.js
generated
vendored
Normal file
19
node_modules/@nodelib/fs.scandir/out/adapters/fs.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
||||||
|
const fs = require("fs");
|
||||||
|
exports.FILE_SYSTEM_ADAPTER = {
|
||||||
|
lstat: fs.lstat,
|
||||||
|
stat: fs.stat,
|
||||||
|
lstatSync: fs.lstatSync,
|
||||||
|
statSync: fs.statSync,
|
||||||
|
readdir: fs.readdir,
|
||||||
|
readdirSync: fs.readdirSync
|
||||||
|
};
|
||||||
|
function createFileSystemAdapter(fsMethods) {
|
||||||
|
if (fsMethods === undefined) {
|
||||||
|
return exports.FILE_SYSTEM_ADAPTER;
|
||||||
|
}
|
||||||
|
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
||||||
|
}
|
||||||
|
exports.createFileSystemAdapter = createFileSystemAdapter;
|
4
node_modules/@nodelib/fs.scandir/out/constants.d.ts
generated
vendored
Normal file
4
node_modules/@nodelib/fs.scandir/out/constants.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* IS `true` for Node.js 10.10 and greater.
|
||||||
|
*/
|
||||||
|
export declare const IS_SUPPORT_READDIR_WITH_FILE_TYPES: boolean;
|
17
node_modules/@nodelib/fs.scandir/out/constants.js
generated
vendored
Normal file
17
node_modules/@nodelib/fs.scandir/out/constants.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
|
||||||
|
const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.');
|
||||||
|
if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) {
|
||||||
|
throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
|
||||||
|
}
|
||||||
|
const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
|
||||||
|
const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
|
||||||
|
const SUPPORTED_MAJOR_VERSION = 10;
|
||||||
|
const SUPPORTED_MINOR_VERSION = 10;
|
||||||
|
const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
|
||||||
|
const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
|
||||||
|
/**
|
||||||
|
* IS `true` for Node.js 10.10 and greater.
|
||||||
|
*/
|
||||||
|
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
|
12
node_modules/@nodelib/fs.scandir/out/index.d.ts
generated
vendored
Normal file
12
node_modules/@nodelib/fs.scandir/out/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import type { FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod } from './adapters/fs';
|
||||||
|
import * as async from './providers/async';
|
||||||
|
import Settings, { Options } from './settings';
|
||||||
|
import type { Dirent, Entry } from './types';
|
||||||
|
declare type AsyncCallback = async.AsyncCallback;
|
||||||
|
declare function scandir(path: string, callback: AsyncCallback): void;
|
||||||
|
declare function scandir(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void;
|
||||||
|
declare namespace scandir {
|
||||||
|
function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Entry[]>;
|
||||||
|
}
|
||||||
|
declare function scandirSync(path: string, optionsOrSettings?: Options | Settings): Entry[];
|
||||||
|
export { scandir, scandirSync, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod, Options };
|
26
node_modules/@nodelib/fs.scandir/out/index.js
generated
vendored
Normal file
26
node_modules/@nodelib/fs.scandir/out/index.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.Settings = exports.scandirSync = exports.scandir = void 0;
|
||||||
|
const async = require("./providers/async");
|
||||||
|
const sync = require("./providers/sync");
|
||||||
|
const settings_1 = require("./settings");
|
||||||
|
exports.Settings = settings_1.default;
|
||||||
|
function scandir(path, optionsOrSettingsOrCallback, callback) {
|
||||||
|
if (typeof optionsOrSettingsOrCallback === 'function') {
|
||||||
|
async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
|
||||||
|
}
|
||||||
|
exports.scandir = scandir;
|
||||||
|
function scandirSync(path, optionsOrSettings) {
|
||||||
|
const settings = getSettings(optionsOrSettings);
|
||||||
|
return sync.read(path, settings);
|
||||||
|
}
|
||||||
|
exports.scandirSync = scandirSync;
|
||||||
|
function getSettings(settingsOrOptions = {}) {
|
||||||
|
if (settingsOrOptions instanceof settings_1.default) {
|
||||||
|
return settingsOrOptions;
|
||||||
|
}
|
||||||
|
return new settings_1.default(settingsOrOptions);
|
||||||
|
}
|
7
node_modules/@nodelib/fs.scandir/out/providers/async.d.ts
generated
vendored
Normal file
7
node_modules/@nodelib/fs.scandir/out/providers/async.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import type Settings from '../settings';
|
||||||
|
import type { Entry } from '../types';
|
||||||
|
export declare type AsyncCallback = (error: NodeJS.ErrnoException, entries: Entry[]) => void;
|
||||||
|
export declare function read(directory: string, settings: Settings, callback: AsyncCallback): void;
|
||||||
|
export declare function readdirWithFileTypes(directory: string, settings: Settings, callback: AsyncCallback): void;
|
||||||
|
export declare function readdir(directory: string, settings: Settings, callback: AsyncCallback): void;
|
104
node_modules/@nodelib/fs.scandir/out/providers/async.js
generated
vendored
Normal file
104
node_modules/@nodelib/fs.scandir/out/providers/async.js
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
|
||||||
|
const fsStat = require("@nodelib/fs.stat");
|
||||||
|
const rpl = require("run-parallel");
|
||||||
|
const constants_1 = require("../constants");
|
||||||
|
const utils = require("../utils");
|
||||||
|
const common = require("./common");
|
||||||
|
function read(directory, settings, callback) {
|
||||||
|
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
||||||
|
readdirWithFileTypes(directory, settings, callback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
readdir(directory, settings, callback);
|
||||||
|
}
|
||||||
|
exports.read = read;
|
||||||
|
function readdirWithFileTypes(directory, settings, callback) {
|
||||||
|
settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
|
||||||
|
if (readdirError !== null) {
|
||||||
|
callFailureCallback(callback, readdirError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const entries = dirents.map((dirent) => ({
|
||||||
|
dirent,
|
||||||
|
name: dirent.name,
|
||||||
|
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
|
||||||
|
}));
|
||||||
|
if (!settings.followSymbolicLinks) {
|
||||||
|
callSuccessCallback(callback, entries);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
|
||||||
|
rpl(tasks, (rplError, rplEntries) => {
|
||||||
|
if (rplError !== null) {
|
||||||
|
callFailureCallback(callback, rplError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
callSuccessCallback(callback, rplEntries);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
||||||
|
function makeRplTaskEntry(entry, settings) {
|
||||||
|
return (done) => {
|
||||||
|
if (!entry.dirent.isSymbolicLink()) {
|
||||||
|
done(null, entry);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
settings.fs.stat(entry.path, (statError, stats) => {
|
||||||
|
if (statError !== null) {
|
||||||
|
if (settings.throwErrorOnBrokenSymbolicLink) {
|
||||||
|
done(statError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
done(null, entry);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
||||||
|
done(null, entry);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function readdir(directory, settings, callback) {
|
||||||
|
settings.fs.readdir(directory, (readdirError, names) => {
|
||||||
|
if (readdirError !== null) {
|
||||||
|
callFailureCallback(callback, readdirError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const tasks = names.map((name) => {
|
||||||
|
const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
||||||
|
return (done) => {
|
||||||
|
fsStat.stat(path, settings.fsStatSettings, (error, stats) => {
|
||||||
|
if (error !== null) {
|
||||||
|
done(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const entry = {
|
||||||
|
name,
|
||||||
|
path,
|
||||||
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
||||||
|
};
|
||||||
|
if (settings.stats) {
|
||||||
|
entry.stats = stats;
|
||||||
|
}
|
||||||
|
done(null, entry);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
rpl(tasks, (rplError, entries) => {
|
||||||
|
if (rplError !== null) {
|
||||||
|
callFailureCallback(callback, rplError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
callSuccessCallback(callback, entries);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.readdir = readdir;
|
||||||
|
function callFailureCallback(callback, error) {
|
||||||
|
callback(error);
|
||||||
|
}
|
||||||
|
function callSuccessCallback(callback, result) {
|
||||||
|
callback(null, result);
|
||||||
|
}
|
1
node_modules/@nodelib/fs.scandir/out/providers/common.d.ts
generated
vendored
Normal file
1
node_modules/@nodelib/fs.scandir/out/providers/common.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export declare function joinPathSegments(a: string, b: string, separator: string): string;
|
13
node_modules/@nodelib/fs.scandir/out/providers/common.js
generated
vendored
Normal file
13
node_modules/@nodelib/fs.scandir/out/providers/common.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.joinPathSegments = void 0;
|
||||||
|
function joinPathSegments(a, b, separator) {
|
||||||
|
/**
|
||||||
|
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
|
||||||
|
*/
|
||||||
|
if (a.endsWith(separator)) {
|
||||||
|
return a + b;
|
||||||
|
}
|
||||||
|
return a + separator + b;
|
||||||
|
}
|
||||||
|
exports.joinPathSegments = joinPathSegments;
|
5
node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts
generated
vendored
Normal file
5
node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import type Settings from '../settings';
|
||||||
|
import type { Entry } from '../types';
|
||||||
|
export declare function read(directory: string, settings: Settings): Entry[];
|
||||||
|
export declare function readdirWithFileTypes(directory: string, settings: Settings): Entry[];
|
||||||
|
export declare function readdir(directory: string, settings: Settings): Entry[];
|
54
node_modules/@nodelib/fs.scandir/out/providers/sync.js
generated
vendored
Normal file
54
node_modules/@nodelib/fs.scandir/out/providers/sync.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
|
||||||
|
const fsStat = require("@nodelib/fs.stat");
|
||||||
|
const constants_1 = require("../constants");
|
||||||
|
const utils = require("../utils");
|
||||||
|
const common = require("./common");
|
||||||
|
function read(directory, settings) {
|
||||||
|
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
||||||
|
return readdirWithFileTypes(directory, settings);
|
||||||
|
}
|
||||||
|
return readdir(directory, settings);
|
||||||
|
}
|
||||||
|
exports.read = read;
|
||||||
|
function readdirWithFileTypes(directory, settings) {
|
||||||
|
const dirents = settings.fs.readdirSync(directory, { withFileTypes: true });
|
||||||
|
return dirents.map((dirent) => {
|
||||||
|
const entry = {
|
||||||
|
dirent,
|
||||||
|
name: dirent.name,
|
||||||
|
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
|
||||||
|
};
|
||||||
|
if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
|
||||||
|
try {
|
||||||
|
const stats = settings.fs.statSync(entry.path);
|
||||||
|
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
if (settings.throwErrorOnBrokenSymbolicLink) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return entry;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.readdirWithFileTypes = readdirWithFileTypes;
|
||||||
|
function readdir(directory, settings) {
|
||||||
|
const names = settings.fs.readdirSync(directory);
|
||||||
|
return names.map((name) => {
|
||||||
|
const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
||||||
|
const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
|
||||||
|
const entry = {
|
||||||
|
name,
|
||||||
|
path: entryPath,
|
||||||
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
||||||
|
};
|
||||||
|
if (settings.stats) {
|
||||||
|
entry.stats = stats;
|
||||||
|
}
|
||||||
|
return entry;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.readdir = readdir;
|
20
node_modules/@nodelib/fs.scandir/out/settings.d.ts
generated
vendored
Normal file
20
node_modules/@nodelib/fs.scandir/out/settings.d.ts
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import * as fsStat from '@nodelib/fs.stat';
|
||||||
|
import * as fs from './adapters/fs';
|
||||||
|
export interface Options {
|
||||||
|
followSymbolicLinks?: boolean;
|
||||||
|
fs?: Partial<fs.FileSystemAdapter>;
|
||||||
|
pathSegmentSeparator?: string;
|
||||||
|
stats?: boolean;
|
||||||
|
throwErrorOnBrokenSymbolicLink?: boolean;
|
||||||
|
}
|
||||||
|
export default class Settings {
|
||||||
|
private readonly _options;
|
||||||
|
readonly followSymbolicLinks: boolean;
|
||||||
|
readonly fs: fs.FileSystemAdapter;
|
||||||
|
readonly pathSegmentSeparator: string;
|
||||||
|
readonly stats: boolean;
|
||||||
|
readonly throwErrorOnBrokenSymbolicLink: boolean;
|
||||||
|
readonly fsStatSettings: fsStat.Settings;
|
||||||
|
constructor(_options?: Options);
|
||||||
|
private _getValue;
|
||||||
|
}
|
24
node_modules/@nodelib/fs.scandir/out/settings.js
generated
vendored
Normal file
24
node_modules/@nodelib/fs.scandir/out/settings.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const path = require("path");
|
||||||
|
const fsStat = require("@nodelib/fs.stat");
|
||||||
|
const fs = require("./adapters/fs");
|
||||||
|
class Settings {
|
||||||
|
constructor(_options = {}) {
|
||||||
|
this._options = _options;
|
||||||
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
||||||
|
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
||||||
|
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
|
||||||
|
this.stats = this._getValue(this._options.stats, false);
|
||||||
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
||||||
|
this.fsStatSettings = new fsStat.Settings({
|
||||||
|
followSymbolicLink: this.followSymbolicLinks,
|
||||||
|
fs: this.fs,
|
||||||
|
throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_getValue(option, value) {
|
||||||
|
return option !== null && option !== void 0 ? option : value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.default = Settings;
|
20
node_modules/@nodelib/fs.scandir/out/types/index.d.ts
generated
vendored
Normal file
20
node_modules/@nodelib/fs.scandir/out/types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import type * as fs from 'fs';
|
||||||
|
export interface Entry {
|
||||||
|
dirent: Dirent;
|
||||||
|
name: string;
|
||||||
|
path: string;
|
||||||
|
stats?: Stats;
|
||||||
|
}
|
||||||
|
export declare type Stats = fs.Stats;
|
||||||
|
export declare type ErrnoException = NodeJS.ErrnoException;
|
||||||
|
export interface Dirent {
|
||||||
|
isBlockDevice: () => boolean;
|
||||||
|
isCharacterDevice: () => boolean;
|
||||||
|
isDirectory: () => boolean;
|
||||||
|
isFIFO: () => boolean;
|
||||||
|
isFile: () => boolean;
|
||||||
|
isSocket: () => boolean;
|
||||||
|
isSymbolicLink: () => boolean;
|
||||||
|
name: string;
|
||||||
|
}
|
2
node_modules/@nodelib/fs.scandir/out/types/index.js
generated
vendored
Normal file
2
node_modules/@nodelib/fs.scandir/out/types/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2
node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts
generated
vendored
Normal file
2
node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import type { Dirent, Stats } from '../types';
|
||||||
|
export declare function createDirentFromStats(name: string, stats: Stats): Dirent;
|
19
node_modules/@nodelib/fs.scandir/out/utils/fs.js
generated
vendored
Normal file
19
node_modules/@nodelib/fs.scandir/out/utils/fs.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.createDirentFromStats = void 0;
|
||||||
|
class DirentFromStats {
|
||||||
|
constructor(name, stats) {
|
||||||
|
this.name = name;
|
||||||
|
this.isBlockDevice = stats.isBlockDevice.bind(stats);
|
||||||
|
this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
|
||||||
|
this.isDirectory = stats.isDirectory.bind(stats);
|
||||||
|
this.isFIFO = stats.isFIFO.bind(stats);
|
||||||
|
this.isFile = stats.isFile.bind(stats);
|
||||||
|
this.isSocket = stats.isSocket.bind(stats);
|
||||||
|
this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function createDirentFromStats(name, stats) {
|
||||||
|
return new DirentFromStats(name, stats);
|
||||||
|
}
|
||||||
|
exports.createDirentFromStats = createDirentFromStats;
|
2
node_modules/@nodelib/fs.scandir/out/utils/index.d.ts
generated
vendored
Normal file
2
node_modules/@nodelib/fs.scandir/out/utils/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import * as fs from './fs';
|
||||||
|
export { fs };
|
5
node_modules/@nodelib/fs.scandir/out/utils/index.js
generated
vendored
Normal file
5
node_modules/@nodelib/fs.scandir/out/utils/index.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.fs = void 0;
|
||||||
|
const fs = require("./fs");
|
||||||
|
exports.fs = fs;
|
44
node_modules/@nodelib/fs.scandir/package.json
generated
vendored
Normal file
44
node_modules/@nodelib/fs.scandir/package.json
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"name": "@nodelib/fs.scandir",
|
||||||
|
"version": "2.1.5",
|
||||||
|
"description": "List files and directories inside the specified directory",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir",
|
||||||
|
"keywords": [
|
||||||
|
"NodeLib",
|
||||||
|
"fs",
|
||||||
|
"FileSystem",
|
||||||
|
"file system",
|
||||||
|
"scandir",
|
||||||
|
"readdir",
|
||||||
|
"dirent"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"out/**",
|
||||||
|
"!out/**/*.map",
|
||||||
|
"!out/**/*.spec.*"
|
||||||
|
],
|
||||||
|
"main": "out/index.js",
|
||||||
|
"typings": "out/index.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"clean": "rimraf {tsconfig.tsbuildinfo,out}",
|
||||||
|
"lint": "eslint \"src/**/*.ts\" --cache",
|
||||||
|
"compile": "tsc -b .",
|
||||||
|
"compile:watch": "tsc -p . --watch --sourceMap",
|
||||||
|
"test": "mocha \"out/**/*.spec.js\" -s 0",
|
||||||
|
"build": "npm run clean && npm run compile && npm run lint && npm test",
|
||||||
|
"watch": "npm run clean && npm run compile:watch"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@nodelib/fs.stat": "2.0.5",
|
||||||
|
"run-parallel": "^1.1.9"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@nodelib/fs.macchiato": "1.0.4",
|
||||||
|
"@types/run-parallel": "^1.1.0"
|
||||||
|
},
|
||||||
|
"gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562"
|
||||||
|
}
|
21
node_modules/@nodelib/fs.stat/LICENSE
generated
vendored
Normal file
21
node_modules/@nodelib/fs.stat/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) Denis Malinochkin
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
126
node_modules/@nodelib/fs.stat/README.md
generated
vendored
Normal file
126
node_modules/@nodelib/fs.stat/README.md
generated
vendored
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
# @nodelib/fs.stat
|
||||||
|
|
||||||
|
> Get the status of a file with some features.
|
||||||
|
|
||||||
|
## :bulb: Highlights
|
||||||
|
|
||||||
|
Wrapper around standard method `fs.lstat` and `fs.stat` with some features.
|
||||||
|
|
||||||
|
* :beginner: Normally follows symbolic link.
|
||||||
|
* :gear: Can safely work with broken symbolic link.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```console
|
||||||
|
npm install @nodelib/fs.stat
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import * as fsStat from '@nodelib/fs.stat';
|
||||||
|
|
||||||
|
fsStat.stat('path', (error, stats) => { /* … */ });
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### .stat(path, [optionsOrSettings], callback)
|
||||||
|
|
||||||
|
Returns an instance of `fs.Stats` class for provided path with standard callback-style.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
fsStat.stat('path', (error, stats) => { /* … */ });
|
||||||
|
fsStat.stat('path', {}, (error, stats) => { /* … */ });
|
||||||
|
fsStat.stat('path', new fsStat.Settings(), (error, stats) => { /* … */ });
|
||||||
|
```
|
||||||
|
|
||||||
|
### .statSync(path, [optionsOrSettings])
|
||||||
|
|
||||||
|
Returns an instance of `fs.Stats` class for provided path.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const stats = fsStat.stat('path');
|
||||||
|
const stats = fsStat.stat('path', {});
|
||||||
|
const stats = fsStat.stat('path', new fsStat.Settings());
|
||||||
|
```
|
||||||
|
|
||||||
|
#### path
|
||||||
|
|
||||||
|
* Required: `true`
|
||||||
|
* Type: `string | Buffer | URL`
|
||||||
|
|
||||||
|
A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||||
|
|
||||||
|
#### optionsOrSettings
|
||||||
|
|
||||||
|
* Required: `false`
|
||||||
|
* Type: `Options | Settings`
|
||||||
|
* Default: An instance of `Settings` class
|
||||||
|
|
||||||
|
An [`Options`](#options) object or an instance of [`Settings`](#settings) class.
|
||||||
|
|
||||||
|
> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class.
|
||||||
|
|
||||||
|
### Settings([options])
|
||||||
|
|
||||||
|
A class of full settings of the package.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const settings = new fsStat.Settings({ followSymbolicLink: false });
|
||||||
|
|
||||||
|
const stats = fsStat.stat('path', settings);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
### `followSymbolicLink`
|
||||||
|
|
||||||
|
* Type: `boolean`
|
||||||
|
* Default: `true`
|
||||||
|
|
||||||
|
Follow symbolic link or not. Call `fs.stat` on symbolic link if `true`.
|
||||||
|
|
||||||
|
### `markSymbolicLink`
|
||||||
|
|
||||||
|
* Type: `boolean`
|
||||||
|
* Default: `false`
|
||||||
|
|
||||||
|
Mark symbolic link by setting the return value of `isSymbolicLink` function to always `true` (even after `fs.stat`).
|
||||||
|
|
||||||
|
> :book: Can be used if you want to know what is hidden behind a symbolic link, but still continue to know that it is a symbolic link.
|
||||||
|
|
||||||
|
### `throwErrorOnBrokenSymbolicLink`
|
||||||
|
|
||||||
|
* Type: `boolean`
|
||||||
|
* Default: `true`
|
||||||
|
|
||||||
|
Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`.
|
||||||
|
|
||||||
|
### `fs`
|
||||||
|
|
||||||
|
* Type: [`FileSystemAdapter`](./src/adapters/fs.ts)
|
||||||
|
* Default: A default FS methods
|
||||||
|
|
||||||
|
By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
interface FileSystemAdapter {
|
||||||
|
lstat?: typeof fs.lstat;
|
||||||
|
stat?: typeof fs.stat;
|
||||||
|
lstatSync?: typeof fs.lstatSync;
|
||||||
|
statSync?: typeof fs.statSync;
|
||||||
|
}
|
||||||
|
|
||||||
|
const settings = new fsStat.Settings({
|
||||||
|
fs: { lstat: fakeLstat }
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This software is released under the terms of the MIT license.
|
13
node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts
generated
vendored
Normal file
13
node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import type { ErrnoException } from '../types';
|
||||||
|
export declare type StatAsynchronousMethod = (path: string, callback: (error: ErrnoException | null, stats: fs.Stats) => void) => void;
|
||||||
|
export declare type StatSynchronousMethod = (path: string) => fs.Stats;
|
||||||
|
export interface FileSystemAdapter {
|
||||||
|
lstat: StatAsynchronousMethod;
|
||||||
|
stat: StatAsynchronousMethod;
|
||||||
|
lstatSync: StatSynchronousMethod;
|
||||||
|
statSync: StatSynchronousMethod;
|
||||||
|
}
|
||||||
|
export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter;
|
||||||
|
export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter;
|
17
node_modules/@nodelib/fs.stat/out/adapters/fs.js
generated
vendored
Normal file
17
node_modules/@nodelib/fs.stat/out/adapters/fs.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
||||||
|
const fs = require("fs");
|
||||||
|
exports.FILE_SYSTEM_ADAPTER = {
|
||||||
|
lstat: fs.lstat,
|
||||||
|
stat: fs.stat,
|
||||||
|
lstatSync: fs.lstatSync,
|
||||||
|
statSync: fs.statSync
|
||||||
|
};
|
||||||
|
function createFileSystemAdapter(fsMethods) {
|
||||||
|
if (fsMethods === undefined) {
|
||||||
|
return exports.FILE_SYSTEM_ADAPTER;
|
||||||
|
}
|
||||||
|
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
||||||
|
}
|
||||||
|
exports.createFileSystemAdapter = createFileSystemAdapter;
|
12
node_modules/@nodelib/fs.stat/out/index.d.ts
generated
vendored
Normal file
12
node_modules/@nodelib/fs.stat/out/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import type { FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod } from './adapters/fs';
|
||||||
|
import * as async from './providers/async';
|
||||||
|
import Settings, { Options } from './settings';
|
||||||
|
import type { Stats } from './types';
|
||||||
|
declare type AsyncCallback = async.AsyncCallback;
|
||||||
|
declare function stat(path: string, callback: AsyncCallback): void;
|
||||||
|
declare function stat(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void;
|
||||||
|
declare namespace stat {
|
||||||
|
function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Stats>;
|
||||||
|
}
|
||||||
|
declare function statSync(path: string, optionsOrSettings?: Options | Settings): Stats;
|
||||||
|
export { Settings, stat, statSync, AsyncCallback, FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod, Options, Stats };
|
26
node_modules/@nodelib/fs.stat/out/index.js
generated
vendored
Normal file
26
node_modules/@nodelib/fs.stat/out/index.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.statSync = exports.stat = exports.Settings = void 0;
|
||||||
|
const async = require("./providers/async");
|
||||||
|
const sync = require("./providers/sync");
|
||||||
|
const settings_1 = require("./settings");
|
||||||
|
exports.Settings = settings_1.default;
|
||||||
|
function stat(path, optionsOrSettingsOrCallback, callback) {
|
||||||
|
if (typeof optionsOrSettingsOrCallback === 'function') {
|
||||||
|
async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
|
||||||
|
}
|
||||||
|
exports.stat = stat;
|
||||||
|
function statSync(path, optionsOrSettings) {
|
||||||
|
const settings = getSettings(optionsOrSettings);
|
||||||
|
return sync.read(path, settings);
|
||||||
|
}
|
||||||
|
exports.statSync = statSync;
|
||||||
|
function getSettings(settingsOrOptions = {}) {
|
||||||
|
if (settingsOrOptions instanceof settings_1.default) {
|
||||||
|
return settingsOrOptions;
|
||||||
|
}
|
||||||
|
return new settings_1.default(settingsOrOptions);
|
||||||
|
}
|
4
node_modules/@nodelib/fs.stat/out/providers/async.d.ts
generated
vendored
Normal file
4
node_modules/@nodelib/fs.stat/out/providers/async.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import type Settings from '../settings';
|
||||||
|
import type { ErrnoException, Stats } from '../types';
|
||||||
|
export declare type AsyncCallback = (error: ErrnoException, stats: Stats) => void;
|
||||||
|
export declare function read(path: string, settings: Settings, callback: AsyncCallback): void;
|
36
node_modules/@nodelib/fs.stat/out/providers/async.js
generated
vendored
Normal file
36
node_modules/@nodelib/fs.stat/out/providers/async.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.read = void 0;
|
||||||
|
function read(path, settings, callback) {
|
||||||
|
settings.fs.lstat(path, (lstatError, lstat) => {
|
||||||
|
if (lstatError !== null) {
|
||||||
|
callFailureCallback(callback, lstatError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
||||||
|
callSuccessCallback(callback, lstat);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
settings.fs.stat(path, (statError, stat) => {
|
||||||
|
if (statError !== null) {
|
||||||
|
if (settings.throwErrorOnBrokenSymbolicLink) {
|
||||||
|
callFailureCallback(callback, statError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
callSuccessCallback(callback, lstat);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (settings.markSymbolicLink) {
|
||||||
|
stat.isSymbolicLink = () => true;
|
||||||
|
}
|
||||||
|
callSuccessCallback(callback, stat);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.read = read;
|
||||||
|
function callFailureCallback(callback, error) {
|
||||||
|
callback(error);
|
||||||
|
}
|
||||||
|
function callSuccessCallback(callback, result) {
|
||||||
|
callback(null, result);
|
||||||
|
}
|
3
node_modules/@nodelib/fs.stat/out/providers/sync.d.ts
generated
vendored
Normal file
3
node_modules/@nodelib/fs.stat/out/providers/sync.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import type Settings from '../settings';
|
||||||
|
import type { Stats } from '../types';
|
||||||
|
export declare function read(path: string, settings: Settings): Stats;
|
23
node_modules/@nodelib/fs.stat/out/providers/sync.js
generated
vendored
Normal file
23
node_modules/@nodelib/fs.stat/out/providers/sync.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.read = void 0;
|
||||||
|
function read(path, settings) {
|
||||||
|
const lstat = settings.fs.lstatSync(path);
|
||||||
|
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
||||||
|
return lstat;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const stat = settings.fs.statSync(path);
|
||||||
|
if (settings.markSymbolicLink) {
|
||||||
|
stat.isSymbolicLink = () => true;
|
||||||
|
}
|
||||||
|
return stat;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
if (!settings.throwErrorOnBrokenSymbolicLink) {
|
||||||
|
return lstat;
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.read = read;
|
16
node_modules/@nodelib/fs.stat/out/settings.d.ts
generated
vendored
Normal file
16
node_modules/@nodelib/fs.stat/out/settings.d.ts
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import * as fs from './adapters/fs';
|
||||||
|
export interface Options {
|
||||||
|
followSymbolicLink?: boolean;
|
||||||
|
fs?: Partial<fs.FileSystemAdapter>;
|
||||||
|
markSymbolicLink?: boolean;
|
||||||
|
throwErrorOnBrokenSymbolicLink?: boolean;
|
||||||
|
}
|
||||||
|
export default class Settings {
|
||||||
|
private readonly _options;
|
||||||
|
readonly followSymbolicLink: boolean;
|
||||||
|
readonly fs: fs.FileSystemAdapter;
|
||||||
|
readonly markSymbolicLink: boolean;
|
||||||
|
readonly throwErrorOnBrokenSymbolicLink: boolean;
|
||||||
|
constructor(_options?: Options);
|
||||||
|
private _getValue;
|
||||||
|
}
|
16
node_modules/@nodelib/fs.stat/out/settings.js
generated
vendored
Normal file
16
node_modules/@nodelib/fs.stat/out/settings.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const fs = require("./adapters/fs");
|
||||||
|
class Settings {
|
||||||
|
constructor(_options = {}) {
|
||||||
|
this._options = _options;
|
||||||
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
||||||
|
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
||||||
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
||||||
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
||||||
|
}
|
||||||
|
_getValue(option, value) {
|
||||||
|
return option !== null && option !== void 0 ? option : value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.default = Settings;
|
4
node_modules/@nodelib/fs.stat/out/types/index.d.ts
generated
vendored
Normal file
4
node_modules/@nodelib/fs.stat/out/types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import type * as fs from 'fs';
|
||||||
|
export declare type Stats = fs.Stats;
|
||||||
|
export declare type ErrnoException = NodeJS.ErrnoException;
|
2
node_modules/@nodelib/fs.stat/out/types/index.js
generated
vendored
Normal file
2
node_modules/@nodelib/fs.stat/out/types/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
37
node_modules/@nodelib/fs.stat/package.json
generated
vendored
Normal file
37
node_modules/@nodelib/fs.stat/package.json
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"name": "@nodelib/fs.stat",
|
||||||
|
"version": "2.0.5",
|
||||||
|
"description": "Get the status of a file with some features",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.stat",
|
||||||
|
"keywords": [
|
||||||
|
"NodeLib",
|
||||||
|
"fs",
|
||||||
|
"FileSystem",
|
||||||
|
"file system",
|
||||||
|
"stat"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"out/**",
|
||||||
|
"!out/**/*.map",
|
||||||
|
"!out/**/*.spec.*"
|
||||||
|
],
|
||||||
|
"main": "out/index.js",
|
||||||
|
"typings": "out/index.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"clean": "rimraf {tsconfig.tsbuildinfo,out}",
|
||||||
|
"lint": "eslint \"src/**/*.ts\" --cache",
|
||||||
|
"compile": "tsc -b .",
|
||||||
|
"compile:watch": "tsc -p . --watch --sourceMap",
|
||||||
|
"test": "mocha \"out/**/*.spec.js\" -s 0",
|
||||||
|
"build": "npm run clean && npm run compile && npm run lint && npm test",
|
||||||
|
"watch": "npm run clean && npm run compile:watch"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@nodelib/fs.macchiato": "1.0.4"
|
||||||
|
},
|
||||||
|
"gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562"
|
||||||
|
}
|
21
node_modules/@nodelib/fs.walk/LICENSE
generated
vendored
Normal file
21
node_modules/@nodelib/fs.walk/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) Denis Malinochkin
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
215
node_modules/@nodelib/fs.walk/README.md
generated
vendored
Normal file
215
node_modules/@nodelib/fs.walk/README.md
generated
vendored
Normal file
@ -0,0 +1,215 @@
|
|||||||
|
# @nodelib/fs.walk
|
||||||
|
|
||||||
|
> A library for efficiently walking a directory recursively.
|
||||||
|
|
||||||
|
## :bulb: Highlights
|
||||||
|
|
||||||
|
* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional).
|
||||||
|
* :rocket: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type for performance reasons. See [`old` and `modern` mode](https://github.com/nodelib/nodelib/blob/master/packages/fs/fs.scandir/README.md#old-and-modern-mode).
|
||||||
|
* :gear: Built-in directories/files and error filtering system.
|
||||||
|
* :link: Can safely work with broken symbolic links.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```console
|
||||||
|
npm install @nodelib/fs.walk
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import * as fsWalk from '@nodelib/fs.walk';
|
||||||
|
|
||||||
|
fsWalk.walk('path', (error, entries) => { /* … */ });
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### .walk(path, [optionsOrSettings], callback)
|
||||||
|
|
||||||
|
Reads the directory recursively and asynchronously. Requires a callback function.
|
||||||
|
|
||||||
|
> :book: If you want to use the Promise API, use `util.promisify`.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
fsWalk.walk('path', (error, entries) => { /* … */ });
|
||||||
|
fsWalk.walk('path', {}, (error, entries) => { /* … */ });
|
||||||
|
fsWalk.walk('path', new fsWalk.Settings(), (error, entries) => { /* … */ });
|
||||||
|
```
|
||||||
|
|
||||||
|
### .walkStream(path, [optionsOrSettings])
|
||||||
|
|
||||||
|
Reads the directory recursively and asynchronously. [Readable Stream](https://nodejs.org/dist/latest-v12.x/docs/api/stream.html#stream_readable_streams) is used as a provider.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const stream = fsWalk.walkStream('path');
|
||||||
|
const stream = fsWalk.walkStream('path', {});
|
||||||
|
const stream = fsWalk.walkStream('path', new fsWalk.Settings());
|
||||||
|
```
|
||||||
|
|
||||||
|
### .walkSync(path, [optionsOrSettings])
|
||||||
|
|
||||||
|
Reads the directory recursively and synchronously. Returns an array of entries.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const entries = fsWalk.walkSync('path');
|
||||||
|
const entries = fsWalk.walkSync('path', {});
|
||||||
|
const entries = fsWalk.walkSync('path', new fsWalk.Settings());
|
||||||
|
```
|
||||||
|
|
||||||
|
#### path
|
||||||
|
|
||||||
|
* Required: `true`
|
||||||
|
* Type: `string | Buffer | URL`
|
||||||
|
|
||||||
|
A path to a file. If a URL is provided, it must use the `file:` protocol.
|
||||||
|
|
||||||
|
#### optionsOrSettings
|
||||||
|
|
||||||
|
* Required: `false`
|
||||||
|
* Type: `Options | Settings`
|
||||||
|
* Default: An instance of `Settings` class
|
||||||
|
|
||||||
|
An [`Options`](#options) object or an instance of [`Settings`](#settings) class.
|
||||||
|
|
||||||
|
> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class.
|
||||||
|
|
||||||
|
### Settings([options])
|
||||||
|
|
||||||
|
A class of full settings of the package.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const settings = new fsWalk.Settings({ followSymbolicLinks: true });
|
||||||
|
|
||||||
|
const entries = fsWalk.walkSync('path', settings);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Entry
|
||||||
|
|
||||||
|
* `name` — The name of the entry (`unknown.txt`).
|
||||||
|
* `path` — The path of the entry relative to call directory (`root/unknown.txt`).
|
||||||
|
* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class.
|
||||||
|
* [`stats`] — An instance of `fs.Stats` class.
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
### basePath
|
||||||
|
|
||||||
|
* Type: `string`
|
||||||
|
* Default: `undefined`
|
||||||
|
|
||||||
|
By default, all paths are built relative to the root path. You can use this option to set custom root path.
|
||||||
|
|
||||||
|
In the example below we read the files from the `root` directory, but in the results the root path will be `custom`.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
fsWalk.walkSync('root'); // → ['root/file.txt']
|
||||||
|
fsWalk.walkSync('root', { basePath: 'custom' }); // → ['custom/file.txt']
|
||||||
|
```
|
||||||
|
|
||||||
|
### concurrency
|
||||||
|
|
||||||
|
* Type: `number`
|
||||||
|
* Default: `Infinity`
|
||||||
|
|
||||||
|
The maximum number of concurrent calls to `fs.readdir`.
|
||||||
|
|
||||||
|
> :book: The higher the number, the higher performance and the load on the File System. If you want to read in quiet mode, set the value to `4 * os.cpus().length` (4 is default size of [thread pool work scheduling](http://docs.libuv.org/en/v1.x/threadpool.html#thread-pool-work-scheduling)).
|
||||||
|
|
||||||
|
### deepFilter
|
||||||
|
|
||||||
|
* Type: [`DeepFilterFunction`](./src/settings.ts)
|
||||||
|
* Default: `undefined`
|
||||||
|
|
||||||
|
A function that indicates whether the directory will be read deep or not.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// Skip all directories that starts with `node_modules`
|
||||||
|
const filter: DeepFilterFunction = (entry) => !entry.path.startsWith('node_modules');
|
||||||
|
```
|
||||||
|
|
||||||
|
### entryFilter
|
||||||
|
|
||||||
|
* Type: [`EntryFilterFunction`](./src/settings.ts)
|
||||||
|
* Default: `undefined`
|
||||||
|
|
||||||
|
A function that indicates whether the entry will be included to results or not.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// Exclude all `.js` files from results
|
||||||
|
const filter: EntryFilterFunction = (entry) => !entry.name.endsWith('.js');
|
||||||
|
```
|
||||||
|
|
||||||
|
### errorFilter
|
||||||
|
|
||||||
|
* Type: [`ErrorFilterFunction`](./src/settings.ts)
|
||||||
|
* Default: `undefined`
|
||||||
|
|
||||||
|
A function that allows you to skip errors that occur when reading directories.
|
||||||
|
|
||||||
|
For example, you can skip `ENOENT` errors if required:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// Skip all ENOENT errors
|
||||||
|
const filter: ErrorFilterFunction = (error) => error.code == 'ENOENT';
|
||||||
|
```
|
||||||
|
|
||||||
|
### stats
|
||||||
|
|
||||||
|
* Type: `boolean`
|
||||||
|
* Default: `false`
|
||||||
|
|
||||||
|
Adds an instance of `fs.Stats` class to the [`Entry`](#entry).
|
||||||
|
|
||||||
|
> :book: Always use `fs.readdir` with additional `fs.lstat/fs.stat` calls to determine the entry type.
|
||||||
|
|
||||||
|
### followSymbolicLinks
|
||||||
|
|
||||||
|
* Type: `boolean`
|
||||||
|
* Default: `false`
|
||||||
|
|
||||||
|
Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`.
|
||||||
|
|
||||||
|
### `throwErrorOnBrokenSymbolicLink`
|
||||||
|
|
||||||
|
* Type: `boolean`
|
||||||
|
* Default: `true`
|
||||||
|
|
||||||
|
Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`.
|
||||||
|
|
||||||
|
### `pathSegmentSeparator`
|
||||||
|
|
||||||
|
* Type: `string`
|
||||||
|
* Default: `path.sep`
|
||||||
|
|
||||||
|
By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead.
|
||||||
|
|
||||||
|
### `fs`
|
||||||
|
|
||||||
|
* Type: `FileSystemAdapter`
|
||||||
|
* Default: A default FS methods
|
||||||
|
|
||||||
|
By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
interface FileSystemAdapter {
|
||||||
|
lstat: typeof fs.lstat;
|
||||||
|
stat: typeof fs.stat;
|
||||||
|
lstatSync: typeof fs.lstatSync;
|
||||||
|
statSync: typeof fs.statSync;
|
||||||
|
readdir: typeof fs.readdir;
|
||||||
|
readdirSync: typeof fs.readdirSync;
|
||||||
|
}
|
||||||
|
|
||||||
|
const settings = new fsWalk.Settings({
|
||||||
|
fs: { lstat: fakeLstat }
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This software is released under the terms of the MIT license.
|
14
node_modules/@nodelib/fs.walk/out/index.d.ts
generated
vendored
Normal file
14
node_modules/@nodelib/fs.walk/out/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import type { Readable } from 'stream';
|
||||||
|
import type { Dirent, FileSystemAdapter } from '@nodelib/fs.scandir';
|
||||||
|
import { AsyncCallback } from './providers/async';
|
||||||
|
import Settings, { DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction, Options } from './settings';
|
||||||
|
import type { Entry } from './types';
|
||||||
|
declare function walk(directory: string, callback: AsyncCallback): void;
|
||||||
|
declare function walk(directory: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void;
|
||||||
|
declare namespace walk {
|
||||||
|
function __promisify__(directory: string, optionsOrSettings?: Options | Settings): Promise<Entry[]>;
|
||||||
|
}
|
||||||
|
declare function walkSync(directory: string, optionsOrSettings?: Options | Settings): Entry[];
|
||||||
|
declare function walkStream(directory: string, optionsOrSettings?: Options | Settings): Readable;
|
||||||
|
export { walk, walkSync, walkStream, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, Options, DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction };
|
34
node_modules/@nodelib/fs.walk/out/index.js
generated
vendored
Normal file
34
node_modules/@nodelib/fs.walk/out/index.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0;
|
||||||
|
const async_1 = require("./providers/async");
|
||||||
|
const stream_1 = require("./providers/stream");
|
||||||
|
const sync_1 = require("./providers/sync");
|
||||||
|
const settings_1 = require("./settings");
|
||||||
|
exports.Settings = settings_1.default;
|
||||||
|
function walk(directory, optionsOrSettingsOrCallback, callback) {
|
||||||
|
if (typeof optionsOrSettingsOrCallback === 'function') {
|
||||||
|
new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
|
||||||
|
}
|
||||||
|
exports.walk = walk;
|
||||||
|
function walkSync(directory, optionsOrSettings) {
|
||||||
|
const settings = getSettings(optionsOrSettings);
|
||||||
|
const provider = new sync_1.default(directory, settings);
|
||||||
|
return provider.read();
|
||||||
|
}
|
||||||
|
exports.walkSync = walkSync;
|
||||||
|
function walkStream(directory, optionsOrSettings) {
|
||||||
|
const settings = getSettings(optionsOrSettings);
|
||||||
|
const provider = new stream_1.default(directory, settings);
|
||||||
|
return provider.read();
|
||||||
|
}
|
||||||
|
exports.walkStream = walkStream;
|
||||||
|
function getSettings(settingsOrOptions = {}) {
|
||||||
|
if (settingsOrOptions instanceof settings_1.default) {
|
||||||
|
return settingsOrOptions;
|
||||||
|
}
|
||||||
|
return new settings_1.default(settingsOrOptions);
|
||||||
|
}
|
12
node_modules/@nodelib/fs.walk/out/providers/async.d.ts
generated
vendored
Normal file
12
node_modules/@nodelib/fs.walk/out/providers/async.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import AsyncReader from '../readers/async';
|
||||||
|
import type Settings from '../settings';
|
||||||
|
import type { Entry, Errno } from '../types';
|
||||||
|
export declare type AsyncCallback = (error: Errno, entries: Entry[]) => void;
|
||||||
|
export default class AsyncProvider {
|
||||||
|
private readonly _root;
|
||||||
|
private readonly _settings;
|
||||||
|
protected readonly _reader: AsyncReader;
|
||||||
|
private readonly _storage;
|
||||||
|
constructor(_root: string, _settings: Settings);
|
||||||
|
read(callback: AsyncCallback): void;
|
||||||
|
}
|
30
node_modules/@nodelib/fs.walk/out/providers/async.js
generated
vendored
Normal file
30
node_modules/@nodelib/fs.walk/out/providers/async.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const async_1 = require("../readers/async");
|
||||||
|
class AsyncProvider {
|
||||||
|
constructor(_root, _settings) {
|
||||||
|
this._root = _root;
|
||||||
|
this._settings = _settings;
|
||||||
|
this._reader = new async_1.default(this._root, this._settings);
|
||||||
|
this._storage = [];
|
||||||
|
}
|
||||||
|
read(callback) {
|
||||||
|
this._reader.onError((error) => {
|
||||||
|
callFailureCallback(callback, error);
|
||||||
|
});
|
||||||
|
this._reader.onEntry((entry) => {
|
||||||
|
this._storage.push(entry);
|
||||||
|
});
|
||||||
|
this._reader.onEnd(() => {
|
||||||
|
callSuccessCallback(callback, this._storage);
|
||||||
|
});
|
||||||
|
this._reader.read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.default = AsyncProvider;
|
||||||
|
function callFailureCallback(callback, error) {
|
||||||
|
callback(error);
|
||||||
|
}
|
||||||
|
function callSuccessCallback(callback, entries) {
|
||||||
|
callback(null, entries);
|
||||||
|
}
|
4
node_modules/@nodelib/fs.walk/out/providers/index.d.ts
generated
vendored
Normal file
4
node_modules/@nodelib/fs.walk/out/providers/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import AsyncProvider from './async';
|
||||||
|
import StreamProvider from './stream';
|
||||||
|
import SyncProvider from './sync';
|
||||||
|
export { AsyncProvider, StreamProvider, SyncProvider };
|
9
node_modules/@nodelib/fs.walk/out/providers/index.js
generated
vendored
Normal file
9
node_modules/@nodelib/fs.walk/out/providers/index.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.SyncProvider = exports.StreamProvider = exports.AsyncProvider = void 0;
|
||||||
|
const async_1 = require("./async");
|
||||||
|
exports.AsyncProvider = async_1.default;
|
||||||
|
const stream_1 = require("./stream");
|
||||||
|
exports.StreamProvider = stream_1.default;
|
||||||
|
const sync_1 = require("./sync");
|
||||||
|
exports.SyncProvider = sync_1.default;
|
12
node_modules/@nodelib/fs.walk/out/providers/stream.d.ts
generated
vendored
Normal file
12
node_modules/@nodelib/fs.walk/out/providers/stream.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import { Readable } from 'stream';
|
||||||
|
import AsyncReader from '../readers/async';
|
||||||
|
import type Settings from '../settings';
|
||||||
|
export default class StreamProvider {
|
||||||
|
private readonly _root;
|
||||||
|
private readonly _settings;
|
||||||
|
protected readonly _reader: AsyncReader;
|
||||||
|
protected readonly _stream: Readable;
|
||||||
|
constructor(_root: string, _settings: Settings);
|
||||||
|
read(): Readable;
|
||||||
|
}
|
34
node_modules/@nodelib/fs.walk/out/providers/stream.js
generated
vendored
Normal file
34
node_modules/@nodelib/fs.walk/out/providers/stream.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const stream_1 = require("stream");
|
||||||
|
const async_1 = require("../readers/async");
|
||||||
|
class StreamProvider {
|
||||||
|
constructor(_root, _settings) {
|
||||||
|
this._root = _root;
|
||||||
|
this._settings = _settings;
|
||||||
|
this._reader = new async_1.default(this._root, this._settings);
|
||||||
|
this._stream = new stream_1.Readable({
|
||||||
|
objectMode: true,
|
||||||
|
read: () => { },
|
||||||
|
destroy: () => {
|
||||||
|
if (!this._reader.isDestroyed) {
|
||||||
|
this._reader.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
read() {
|
||||||
|
this._reader.onError((error) => {
|
||||||
|
this._stream.emit('error', error);
|
||||||
|
});
|
||||||
|
this._reader.onEntry((entry) => {
|
||||||
|
this._stream.push(entry);
|
||||||
|
});
|
||||||
|
this._reader.onEnd(() => {
|
||||||
|
this._stream.push(null);
|
||||||
|
});
|
||||||
|
this._reader.read();
|
||||||
|
return this._stream;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.default = StreamProvider;
|
10
node_modules/@nodelib/fs.walk/out/providers/sync.d.ts
generated
vendored
Normal file
10
node_modules/@nodelib/fs.walk/out/providers/sync.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import SyncReader from '../readers/sync';
|
||||||
|
import type Settings from '../settings';
|
||||||
|
import type { Entry } from '../types';
|
||||||
|
export default class SyncProvider {
|
||||||
|
private readonly _root;
|
||||||
|
private readonly _settings;
|
||||||
|
protected readonly _reader: SyncReader;
|
||||||
|
constructor(_root: string, _settings: Settings);
|
||||||
|
read(): Entry[];
|
||||||
|
}
|
14
node_modules/@nodelib/fs.walk/out/providers/sync.js
generated
vendored
Normal file
14
node_modules/@nodelib/fs.walk/out/providers/sync.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const sync_1 = require("../readers/sync");
|
||||||
|
class SyncProvider {
|
||||||
|
constructor(_root, _settings) {
|
||||||
|
this._root = _root;
|
||||||
|
this._settings = _settings;
|
||||||
|
this._reader = new sync_1.default(this._root, this._settings);
|
||||||
|
}
|
||||||
|
read() {
|
||||||
|
return this._reader.read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.default = SyncProvider;
|
30
node_modules/@nodelib/fs.walk/out/readers/async.d.ts
generated
vendored
Normal file
30
node_modules/@nodelib/fs.walk/out/readers/async.d.ts
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import { EventEmitter } from 'events';
|
||||||
|
import * as fsScandir from '@nodelib/fs.scandir';
|
||||||
|
import type Settings from '../settings';
|
||||||
|
import type { Entry, Errno } from '../types';
|
||||||
|
import Reader from './reader';
|
||||||
|
declare type EntryEventCallback = (entry: Entry) => void;
|
||||||
|
declare type ErrorEventCallback = (error: Errno) => void;
|
||||||
|
declare type EndEventCallback = () => void;
|
||||||
|
export default class AsyncReader extends Reader {
|
||||||
|
protected readonly _settings: Settings;
|
||||||
|
protected readonly _scandir: typeof fsScandir.scandir;
|
||||||
|
protected readonly _emitter: EventEmitter;
|
||||||
|
private readonly _queue;
|
||||||
|
private _isFatalError;
|
||||||
|
private _isDestroyed;
|
||||||
|
constructor(_root: string, _settings: Settings);
|
||||||
|
read(): EventEmitter;
|
||||||
|
get isDestroyed(): boolean;
|
||||||
|
destroy(): void;
|
||||||
|
onEntry(callback: EntryEventCallback): void;
|
||||||
|
onError(callback: ErrorEventCallback): void;
|
||||||
|
onEnd(callback: EndEventCallback): void;
|
||||||
|
private _pushToQueue;
|
||||||
|
private _worker;
|
||||||
|
private _handleError;
|
||||||
|
private _handleEntry;
|
||||||
|
private _emitEntry;
|
||||||
|
}
|
||||||
|
export {};
|
97
node_modules/@nodelib/fs.walk/out/readers/async.js
generated
vendored
Normal file
97
node_modules/@nodelib/fs.walk/out/readers/async.js
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const events_1 = require("events");
|
||||||
|
const fsScandir = require("@nodelib/fs.scandir");
|
||||||
|
const fastq = require("fastq");
|
||||||
|
const common = require("./common");
|
||||||
|
const reader_1 = require("./reader");
|
||||||
|
class AsyncReader extends reader_1.default {
|
||||||
|
constructor(_root, _settings) {
|
||||||
|
super(_root, _settings);
|
||||||
|
this._settings = _settings;
|
||||||
|
this._scandir = fsScandir.scandir;
|
||||||
|
this._emitter = new events_1.EventEmitter();
|
||||||
|
this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
|
||||||
|
this._isFatalError = false;
|
||||||
|
this._isDestroyed = false;
|
||||||
|
this._queue.drain = () => {
|
||||||
|
if (!this._isFatalError) {
|
||||||
|
this._emitter.emit('end');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
read() {
|
||||||
|
this._isFatalError = false;
|
||||||
|
this._isDestroyed = false;
|
||||||
|
setImmediate(() => {
|
||||||
|
this._pushToQueue(this._root, this._settings.basePath);
|
||||||
|
});
|
||||||
|
return this._emitter;
|
||||||
|
}
|
||||||
|
get isDestroyed() {
|
||||||
|
return this._isDestroyed;
|
||||||
|
}
|
||||||
|
destroy() {
|
||||||
|
if (this._isDestroyed) {
|
||||||
|
throw new Error('The reader is already destroyed');
|
||||||
|
}
|
||||||
|
this._isDestroyed = true;
|
||||||
|
this._queue.killAndDrain();
|
||||||
|
}
|
||||||
|
onEntry(callback) {
|
||||||
|
this._emitter.on('entry', callback);
|
||||||
|
}
|
||||||
|
onError(callback) {
|
||||||
|
this._emitter.once('error', callback);
|
||||||
|
}
|
||||||
|
onEnd(callback) {
|
||||||
|
this._emitter.once('end', callback);
|
||||||
|
}
|
||||||
|
_pushToQueue(directory, base) {
|
||||||
|
const queueItem = { directory, base };
|
||||||
|
this._queue.push(queueItem, (error) => {
|
||||||
|
if (error !== null) {
|
||||||
|
this._handleError(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_worker(item, done) {
|
||||||
|
this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
|
||||||
|
if (error !== null) {
|
||||||
|
done(error, undefined);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (const entry of entries) {
|
||||||
|
this._handleEntry(entry, item.base);
|
||||||
|
}
|
||||||
|
done(null, undefined);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_handleError(error) {
|
||||||
|
if (this._isDestroyed || !common.isFatalError(this._settings, error)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._isFatalError = true;
|
||||||
|
this._isDestroyed = true;
|
||||||
|
this._emitter.emit('error', error);
|
||||||
|
}
|
||||||
|
_handleEntry(entry, base) {
|
||||||
|
if (this._isDestroyed || this._isFatalError) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const fullpath = entry.path;
|
||||||
|
if (base !== undefined) {
|
||||||
|
entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
|
||||||
|
}
|
||||||
|
if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
|
||||||
|
this._emitEntry(entry);
|
||||||
|
}
|
||||||
|
if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
|
||||||
|
this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_emitEntry(entry) {
|
||||||
|
this._emitter.emit('entry', entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.default = AsyncReader;
|
7
node_modules/@nodelib/fs.walk/out/readers/common.d.ts
generated
vendored
Normal file
7
node_modules/@nodelib/fs.walk/out/readers/common.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import type { FilterFunction } from '../settings';
|
||||||
|
import type Settings from '../settings';
|
||||||
|
import type { Errno } from '../types';
|
||||||
|
export declare function isFatalError(settings: Settings, error: Errno): boolean;
|
||||||
|
export declare function isAppliedFilter<T>(filter: FilterFunction<T> | null, value: T): boolean;
|
||||||
|
export declare function replacePathSegmentSeparator(filepath: string, separator: string): string;
|
||||||
|
export declare function joinPathSegments(a: string, b: string, separator: string): string;
|
31
node_modules/@nodelib/fs.walk/out/readers/common.js
generated
vendored
Normal file
31
node_modules/@nodelib/fs.walk/out/readers/common.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
|
||||||
|
function isFatalError(settings, error) {
|
||||||
|
if (settings.errorFilter === null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !settings.errorFilter(error);
|
||||||
|
}
|
||||||
|
exports.isFatalError = isFatalError;
|
||||||
|
function isAppliedFilter(filter, value) {
|
||||||
|
return filter === null || filter(value);
|
||||||
|
}
|
||||||
|
exports.isAppliedFilter = isAppliedFilter;
|
||||||
|
function replacePathSegmentSeparator(filepath, separator) {
|
||||||
|
return filepath.split(/[/\\]/).join(separator);
|
||||||
|
}
|
||||||
|
exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
||||||
|
function joinPathSegments(a, b, separator) {
|
||||||
|
if (a === '') {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
|
||||||
|
*/
|
||||||
|
if (a.endsWith(separator)) {
|
||||||
|
return a + b;
|
||||||
|
}
|
||||||
|
return a + separator + b;
|
||||||
|
}
|
||||||
|
exports.joinPathSegments = joinPathSegments;
|
6
node_modules/@nodelib/fs.walk/out/readers/reader.d.ts
generated
vendored
Normal file
6
node_modules/@nodelib/fs.walk/out/readers/reader.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import type Settings from '../settings';
|
||||||
|
export default class Reader {
|
||||||
|
protected readonly _root: string;
|
||||||
|
protected readonly _settings: Settings;
|
||||||
|
constructor(_root: string, _settings: Settings);
|
||||||
|
}
|
11
node_modules/@nodelib/fs.walk/out/readers/reader.js
generated
vendored
Normal file
11
node_modules/@nodelib/fs.walk/out/readers/reader.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const common = require("./common");
|
||||||
|
class Reader {
|
||||||
|
constructor(_root, _settings) {
|
||||||
|
this._root = _root;
|
||||||
|
this._settings = _settings;
|
||||||
|
this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.default = Reader;
|
15
node_modules/@nodelib/fs.walk/out/readers/sync.d.ts
generated
vendored
Normal file
15
node_modules/@nodelib/fs.walk/out/readers/sync.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import * as fsScandir from '@nodelib/fs.scandir';
|
||||||
|
import type { Entry } from '../types';
|
||||||
|
import Reader from './reader';
|
||||||
|
export default class SyncReader extends Reader {
|
||||||
|
protected readonly _scandir: typeof fsScandir.scandirSync;
|
||||||
|
private readonly _storage;
|
||||||
|
private readonly _queue;
|
||||||
|
read(): Entry[];
|
||||||
|
private _pushToQueue;
|
||||||
|
private _handleQueue;
|
||||||
|
private _handleDirectory;
|
||||||
|
private _handleError;
|
||||||
|
private _handleEntry;
|
||||||
|
private _pushToStorage;
|
||||||
|
}
|
59
node_modules/@nodelib/fs.walk/out/readers/sync.js
generated
vendored
Normal file
59
node_modules/@nodelib/fs.walk/out/readers/sync.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const fsScandir = require("@nodelib/fs.scandir");
|
||||||
|
const common = require("./common");
|
||||||
|
const reader_1 = require("./reader");
|
||||||
|
class SyncReader extends reader_1.default {
|
||||||
|
constructor() {
|
||||||
|
super(...arguments);
|
||||||
|
this._scandir = fsScandir.scandirSync;
|
||||||
|
this._storage = [];
|
||||||
|
this._queue = new Set();
|
||||||
|
}
|
||||||
|
read() {
|
||||||
|
this._pushToQueue(this._root, this._settings.basePath);
|
||||||
|
this._handleQueue();
|
||||||
|
return this._storage;
|
||||||
|
}
|
||||||
|
_pushToQueue(directory, base) {
|
||||||
|
this._queue.add({ directory, base });
|
||||||
|
}
|
||||||
|
_handleQueue() {
|
||||||
|
for (const item of this._queue.values()) {
|
||||||
|
this._handleDirectory(item.directory, item.base);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_handleDirectory(directory, base) {
|
||||||
|
try {
|
||||||
|
const entries = this._scandir(directory, this._settings.fsScandirSettings);
|
||||||
|
for (const entry of entries) {
|
||||||
|
this._handleEntry(entry, base);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
this._handleError(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_handleError(error) {
|
||||||
|
if (!common.isFatalError(this._settings, error)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
_handleEntry(entry, base) {
|
||||||
|
const fullpath = entry.path;
|
||||||
|
if (base !== undefined) {
|
||||||
|
entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
|
||||||
|
}
|
||||||
|
if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
|
||||||
|
this._pushToStorage(entry);
|
||||||
|
}
|
||||||
|
if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
|
||||||
|
this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_pushToStorage(entry) {
|
||||||
|
this._storage.push(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.default = SyncReader;
|
30
node_modules/@nodelib/fs.walk/out/settings.d.ts
generated
vendored
Normal file
30
node_modules/@nodelib/fs.walk/out/settings.d.ts
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import * as fsScandir from '@nodelib/fs.scandir';
|
||||||
|
import type { Entry, Errno } from './types';
|
||||||
|
export declare type FilterFunction<T> = (value: T) => boolean;
|
||||||
|
export declare type DeepFilterFunction = FilterFunction<Entry>;
|
||||||
|
export declare type EntryFilterFunction = FilterFunction<Entry>;
|
||||||
|
export declare type ErrorFilterFunction = FilterFunction<Errno>;
|
||||||
|
export interface Options {
|
||||||
|
basePath?: string;
|
||||||
|
concurrency?: number;
|
||||||
|
deepFilter?: DeepFilterFunction;
|
||||||
|
entryFilter?: EntryFilterFunction;
|
||||||
|
errorFilter?: ErrorFilterFunction;
|
||||||
|
followSymbolicLinks?: boolean;
|
||||||
|
fs?: Partial<fsScandir.FileSystemAdapter>;
|
||||||
|
pathSegmentSeparator?: string;
|
||||||
|
stats?: boolean;
|
||||||
|
throwErrorOnBrokenSymbolicLink?: boolean;
|
||||||
|
}
|
||||||
|
export default class Settings {
|
||||||
|
private readonly _options;
|
||||||
|
readonly basePath?: string;
|
||||||
|
readonly concurrency: number;
|
||||||
|
readonly deepFilter: DeepFilterFunction | null;
|
||||||
|
readonly entryFilter: EntryFilterFunction | null;
|
||||||
|
readonly errorFilter: ErrorFilterFunction | null;
|
||||||
|
readonly pathSegmentSeparator: string;
|
||||||
|
readonly fsScandirSettings: fsScandir.Settings;
|
||||||
|
constructor(_options?: Options);
|
||||||
|
private _getValue;
|
||||||
|
}
|
26
node_modules/@nodelib/fs.walk/out/settings.js
generated
vendored
Normal file
26
node_modules/@nodelib/fs.walk/out/settings.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const path = require("path");
|
||||||
|
const fsScandir = require("@nodelib/fs.scandir");
|
||||||
|
class Settings {
|
||||||
|
constructor(_options = {}) {
|
||||||
|
this._options = _options;
|
||||||
|
this.basePath = this._getValue(this._options.basePath, undefined);
|
||||||
|
this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
|
||||||
|
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
||||||
|
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
||||||
|
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
||||||
|
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
|
||||||
|
this.fsScandirSettings = new fsScandir.Settings({
|
||||||
|
followSymbolicLinks: this._options.followSymbolicLinks,
|
||||||
|
fs: this._options.fs,
|
||||||
|
pathSegmentSeparator: this._options.pathSegmentSeparator,
|
||||||
|
stats: this._options.stats,
|
||||||
|
throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_getValue(option, value) {
|
||||||
|
return option !== null && option !== void 0 ? option : value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.default = Settings;
|
8
node_modules/@nodelib/fs.walk/out/types/index.d.ts
generated
vendored
Normal file
8
node_modules/@nodelib/fs.walk/out/types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import type * as scandir from '@nodelib/fs.scandir';
|
||||||
|
export declare type Entry = scandir.Entry;
|
||||||
|
export declare type Errno = NodeJS.ErrnoException;
|
||||||
|
export interface QueueItem {
|
||||||
|
directory: string;
|
||||||
|
base?: string;
|
||||||
|
}
|
2
node_modules/@nodelib/fs.walk/out/types/index.js
generated
vendored
Normal file
2
node_modules/@nodelib/fs.walk/out/types/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
44
node_modules/@nodelib/fs.walk/package.json
generated
vendored
Normal file
44
node_modules/@nodelib/fs.walk/package.json
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"name": "@nodelib/fs.walk",
|
||||||
|
"version": "1.2.8",
|
||||||
|
"description": "A library for efficiently walking a directory recursively",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.walk",
|
||||||
|
"keywords": [
|
||||||
|
"NodeLib",
|
||||||
|
"fs",
|
||||||
|
"FileSystem",
|
||||||
|
"file system",
|
||||||
|
"walk",
|
||||||
|
"scanner",
|
||||||
|
"crawler"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"out/**",
|
||||||
|
"!out/**/*.map",
|
||||||
|
"!out/**/*.spec.*",
|
||||||
|
"!out/**/tests/**"
|
||||||
|
],
|
||||||
|
"main": "out/index.js",
|
||||||
|
"typings": "out/index.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"clean": "rimraf {tsconfig.tsbuildinfo,out}",
|
||||||
|
"lint": "eslint \"src/**/*.ts\" --cache",
|
||||||
|
"compile": "tsc -b .",
|
||||||
|
"compile:watch": "tsc -p . --watch --sourceMap",
|
||||||
|
"test": "mocha \"out/**/*.spec.js\" -s 0",
|
||||||
|
"build": "npm run clean && npm run compile && npm run lint && npm test",
|
||||||
|
"watch": "npm run clean && npm run compile:watch"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@nodelib/fs.scandir": "2.1.5",
|
||||||
|
"fastq": "^1.6.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@nodelib/fs.macchiato": "1.0.4"
|
||||||
|
},
|
||||||
|
"gitHead": "1e5bad48565da2b06b8600e744324ea240bf49d8"
|
||||||
|
}
|
21
node_modules/@types/fs-extra/LICENSE
generated
vendored
Executable file
21
node_modules/@types/fs-extra/LICENSE
generated
vendored
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE
|
16
node_modules/@types/fs-extra/README.md
generated
vendored
Executable file
16
node_modules/@types/fs-extra/README.md
generated
vendored
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
# Installation
|
||||||
|
> `npm install --save @types/fs-extra`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for fs-extra (https://github.com/jprichardson/node-fs-extra).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra.
|
||||||
|
|
||||||
|
### Additional Details
|
||||||
|
* Last updated: Tue, 21 Sep 2021 19:02:14 GMT
|
||||||
|
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
||||||
|
* Global values: none
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by [Alan Agius](https://github.com/alan-agius4), [midknight41](https://github.com/midknight41), [Brendan Forster](https://github.com/shiftkey), [Mees van Dijk](https://github.com/mees-), [Justin Rockwood](https://github.com/jrockwood), [Sang Dang](https://github.com/sangdth), [Florian Keller](https://github.com/ffflorian), [Piotr Błażejewicz](https://github.com/peterblazejewicz), and [Tiger Oakes](https://github.com/NotWoods).
|
563
node_modules/@types/fs-extra/index.d.ts
generated
vendored
Executable file
563
node_modules/@types/fs-extra/index.d.ts
generated
vendored
Executable file
@ -0,0 +1,563 @@
|
|||||||
|
// Type definitions for fs-extra 9.0
|
||||||
|
// Project: https://github.com/jprichardson/node-fs-extra
|
||||||
|
// Definitions by: Alan Agius <https://github.com/alan-agius4>,
|
||||||
|
// midknight41 <https://github.com/midknight41>,
|
||||||
|
// Brendan Forster <https://github.com/shiftkey>,
|
||||||
|
// Mees van Dijk <https://github.com/mees->,
|
||||||
|
// Justin Rockwood <https://github.com/jrockwood>,
|
||||||
|
// Sang Dang <https://github.com/sangdth>,
|
||||||
|
// Florian Keller <https://github.com/ffflorian>
|
||||||
|
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
||||||
|
// Tiger Oakes <https://github.com/NotWoods>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
// Minimum TypeScript Version: 3.9
|
||||||
|
|
||||||
|
/// <reference types="node" />
|
||||||
|
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import Stats = fs.Stats;
|
||||||
|
import PathLike = fs.PathLike;
|
||||||
|
|
||||||
|
export * from 'fs';
|
||||||
|
|
||||||
|
export function copy(src: string, dest: string, options?: CopyOptions): Promise<void>;
|
||||||
|
export function copy(src: string, dest: string, callback: (err: Error) => void): void;
|
||||||
|
export function copy(src: string, dest: string, options: CopyOptions, callback: (err: Error) => void): void;
|
||||||
|
export function copySync(src: string, dest: string, options?: CopyOptionsSync): void;
|
||||||
|
|
||||||
|
export function copyFile(src: string, dest: string, flags?: number): Promise<void>;
|
||||||
|
export function copyFile(src: string, dest: string, callback: (err: Error) => void): void;
|
||||||
|
export function copyFile(src: string, dest: string, flags: number, callback: (err: Error) => void): void;
|
||||||
|
|
||||||
|
export function move(src: string, dest: string, options?: MoveOptions): Promise<void>;
|
||||||
|
export function move(src: string, dest: string, callback: (err: Error) => void): void;
|
||||||
|
export function move(src: string, dest: string, options: MoveOptions, callback: (err: Error) => void): void;
|
||||||
|
export function moveSync(src: string, dest: string, options?: MoveOptions): void;
|
||||||
|
|
||||||
|
export function createFile(file: string): Promise<void>;
|
||||||
|
export function createFile(file: string, callback: (err: Error) => void): void;
|
||||||
|
export function createFileSync(file: string): void;
|
||||||
|
|
||||||
|
export function createSymlink(src: string, dest: string, type: SymlinkType): Promise<void>;
|
||||||
|
export function createSymlink(src: string, dest: string, type: SymlinkType, callback?: (err: Error) => void): void;
|
||||||
|
export function createSymlinkSync(src: string, dest: string, type: SymlinkType): void;
|
||||||
|
|
||||||
|
export function ensureDir(path: string, options?: EnsureOptions | number): Promise<void>;
|
||||||
|
export function ensureDir(path: string, callback?: (err: Error) => void): void;
|
||||||
|
export function ensureDir(path: string, options?: EnsureOptions | number, callback?: (err: Error) => void): void;
|
||||||
|
export function ensureDirSync(path: string, options?: EnsureOptions | number): void;
|
||||||
|
|
||||||
|
export function mkdirs(dir: string): Promise<void>;
|
||||||
|
export function mkdirs(dir: string, callback: (err: Error) => void): void;
|
||||||
|
export function mkdirp(dir: string): Promise<void>;
|
||||||
|
export function mkdirp(dir: string, callback: (err: Error) => void): void;
|
||||||
|
export function mkdirsSync(dir: string): void;
|
||||||
|
export function mkdirpSync(dir: string): void;
|
||||||
|
|
||||||
|
export function outputFile(
|
||||||
|
file: string,
|
||||||
|
data: any,
|
||||||
|
options?: WriteFileOptions | BufferEncoding | string,
|
||||||
|
): Promise<void>;
|
||||||
|
export function outputFile(file: string, data: any, callback: (err: Error) => void): void;
|
||||||
|
export function outputFile(
|
||||||
|
file: string,
|
||||||
|
data: any,
|
||||||
|
options: WriteFileOptions | string,
|
||||||
|
callback: (err: Error) => void,
|
||||||
|
): void;
|
||||||
|
export function outputFileSync(file: string, data: any, options?: WriteFileOptions | BufferEncoding | string): void;
|
||||||
|
|
||||||
|
export function readJson(file: string, options?: ReadOptions | BufferEncoding | string): Promise<any>;
|
||||||
|
export function readJson(file: string, callback: (err: Error, jsonObject: any) => void): void;
|
||||||
|
export function readJson(
|
||||||
|
file: string,
|
||||||
|
options: ReadOptions | BufferEncoding | string,
|
||||||
|
callback: (err: Error, jsonObject: any) => void,
|
||||||
|
): void;
|
||||||
|
export function readJSON(file: string, options?: ReadOptions | BufferEncoding | string): Promise<any>;
|
||||||
|
export function readJSON(file: string, callback: (err: Error, jsonObject: any) => void): void;
|
||||||
|
export function readJSON(
|
||||||
|
file: string,
|
||||||
|
options: ReadOptions | BufferEncoding | string,
|
||||||
|
callback: (err: Error, jsonObject: any) => void,
|
||||||
|
): void;
|
||||||
|
|
||||||
|
export function readJsonSync(file: string, options?: ReadOptions | BufferEncoding | string): any;
|
||||||
|
export function readJSONSync(file: string, options?: ReadOptions | BufferEncoding | string): any;
|
||||||
|
|
||||||
|
export function remove(dir: string, callback: (err: Error) => void): void;
|
||||||
|
export function remove(dir: string, callback?: (err: Error) => void): Promise<void>;
|
||||||
|
export function removeSync(dir: string): void;
|
||||||
|
|
||||||
|
export function outputJSON(file: string, data: any, options?: WriteOptions | BufferEncoding | string): Promise<void>;
|
||||||
|
export function outputJSON(
|
||||||
|
file: string,
|
||||||
|
data: any,
|
||||||
|
options: WriteOptions | BufferEncoding | string,
|
||||||
|
callback: (err: Error) => void,
|
||||||
|
): void;
|
||||||
|
export function outputJSON(file: string, data: any, callback: (err: Error) => void): void;
|
||||||
|
export function outputJson(file: string, data: any, options?: WriteOptions | BufferEncoding | string): Promise<void>;
|
||||||
|
export function outputJson(
|
||||||
|
file: string,
|
||||||
|
data: any,
|
||||||
|
options: WriteOptions | BufferEncoding | string,
|
||||||
|
callback: (err: Error) => void,
|
||||||
|
): void;
|
||||||
|
export function outputJson(file: string, data: any, callback: (err: Error) => void): void;
|
||||||
|
export function outputJsonSync(file: string, data: any, options?: WriteOptions | BufferEncoding | string): void;
|
||||||
|
export function outputJSONSync(file: string, data: any, options?: WriteOptions | BufferEncoding | string): void;
|
||||||
|
|
||||||
|
export function writeJSON(file: string, object: any, options?: WriteOptions | BufferEncoding | string): Promise<void>;
|
||||||
|
export function writeJSON(file: string, object: any, callback: (err: Error) => void): void;
|
||||||
|
export function writeJSON(
|
||||||
|
file: string,
|
||||||
|
object: any,
|
||||||
|
options: WriteOptions | BufferEncoding | string,
|
||||||
|
callback: (err: Error) => void,
|
||||||
|
): void;
|
||||||
|
export function writeJson(file: string, object: any, options?: WriteOptions | BufferEncoding | string): Promise<void>;
|
||||||
|
export function writeJson(file: string, object: any, callback: (err: Error) => void): void;
|
||||||
|
export function writeJson(
|
||||||
|
file: string,
|
||||||
|
object: any,
|
||||||
|
options: WriteOptions | BufferEncoding | string,
|
||||||
|
callback: (err: Error) => void,
|
||||||
|
): void;
|
||||||
|
|
||||||
|
export function writeJsonSync(file: string, object: any, options?: WriteOptions | BufferEncoding | string): void;
|
||||||
|
export function writeJSONSync(file: string, object: any, options?: WriteOptions | BufferEncoding | string): void;
|
||||||
|
|
||||||
|
export function ensureFile(path: string): Promise<void>;
|
||||||
|
export function ensureFile(path: string, callback: (err: Error) => void): void;
|
||||||
|
export function ensureFileSync(path: string): void;
|
||||||
|
|
||||||
|
export function ensureLink(src: string, dest: string): Promise<void>;
|
||||||
|
export function ensureLink(src: string, dest: string, callback: (err: Error) => void): void;
|
||||||
|
// alias for ensureLink
|
||||||
|
export const createLink: typeof ensureLink;
|
||||||
|
export function ensureLinkSync(src: string, dest: string): void;
|
||||||
|
// aliased as
|
||||||
|
export const createLinkSync: typeof ensureLinkSync;
|
||||||
|
|
||||||
|
export function ensureSymlink(src: string, dest: string, type?: SymlinkType): Promise<void>;
|
||||||
|
export function ensureSymlink(src: string, dest: string, type: SymlinkType, callback: (err: Error) => void): void;
|
||||||
|
export function ensureSymlink(src: string, dest: string, callback: (err: Error) => void): void;
|
||||||
|
export function ensureSymlinkSync(src: string, dest: string, type?: SymlinkType): void;
|
||||||
|
|
||||||
|
export function emptyDir(path: string): Promise<void>;
|
||||||
|
export function emptyDir(path: string, callback: (err: Error) => void): void;
|
||||||
|
export const emptydir: typeof emptyDir;
|
||||||
|
|
||||||
|
export function emptyDirSync(path: string): void;
|
||||||
|
export const emptydirSync: typeof emptyDirSync;
|
||||||
|
|
||||||
|
export function pathExists(path: string): Promise<boolean>;
|
||||||
|
export function pathExists(path: string, callback: (err: Error, exists: boolean) => void): void;
|
||||||
|
export function pathExistsSync(path: string): boolean;
|
||||||
|
|
||||||
|
// fs async methods
|
||||||
|
// copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v6/index.d.ts
|
||||||
|
|
||||||
|
export function access(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function access(path: PathLike, mode: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function access(path: PathLike, mode?: number): Promise<void>;
|
||||||
|
|
||||||
|
export function appendFile(
|
||||||
|
file: PathLike | number,
|
||||||
|
data: any,
|
||||||
|
options: {
|
||||||
|
encoding?: BufferEncoding | string | undefined;
|
||||||
|
mode?: number | string | undefined;
|
||||||
|
flag?: string | undefined;
|
||||||
|
},
|
||||||
|
callback: (err: NodeJS.ErrnoException) => void,
|
||||||
|
): void;
|
||||||
|
export function appendFile(file: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function appendFile(
|
||||||
|
file: PathLike | number,
|
||||||
|
data: any,
|
||||||
|
options?:
|
||||||
|
| {
|
||||||
|
encoding?: BufferEncoding | string | undefined;
|
||||||
|
mode?: number | string | undefined;
|
||||||
|
flag?: string | undefined;
|
||||||
|
}
|
||||||
|
| BufferEncoding
|
||||||
|
| string,
|
||||||
|
): Promise<void>;
|
||||||
|
|
||||||
|
export function chmod(path: PathLike, mode: Mode, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function chmod(path: PathLike, mode: Mode): Promise<void>;
|
||||||
|
|
||||||
|
export function chown(path: PathLike, uid: number, gid: number): Promise<void>;
|
||||||
|
export function chown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
|
||||||
|
export function close(fd: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function close(fd: number): Promise<void>;
|
||||||
|
|
||||||
|
export function fchmod(fd: number, mode: Mode, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function fchmod(fd: number, mode: Mode): Promise<void>;
|
||||||
|
|
||||||
|
export function fchown(fd: number, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function fchown(fd: number, uid: number, gid: number): Promise<void>;
|
||||||
|
|
||||||
|
export function fdatasync(fd: number, callback: () => void): void;
|
||||||
|
export function fdatasync(fd: number): Promise<void>;
|
||||||
|
|
||||||
|
export function fstat(fd: number, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
||||||
|
export function fstat(fd: number): Promise<Stats>;
|
||||||
|
|
||||||
|
export function fsync(fd: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function fsync(fd: number): Promise<void>;
|
||||||
|
|
||||||
|
export function ftruncate(fd: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function ftruncate(fd: number, len: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function ftruncate(fd: number, len?: number): Promise<void>;
|
||||||
|
|
||||||
|
export function futimes(fd: number, atime: number, mtime: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function futimes(fd: number, atime: Date, mtime: Date, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function futimes(fd: number, atime: number, mtime: number): Promise<void>;
|
||||||
|
export function futimes(fd: number, atime: Date, mtime: Date): Promise<void>;
|
||||||
|
|
||||||
|
export function lchown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function lchown(path: PathLike, uid: number, gid: number): Promise<void>;
|
||||||
|
|
||||||
|
export function link(existingPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function link(existingPath: PathLike, newPath: PathLike): Promise<void>;
|
||||||
|
|
||||||
|
export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
||||||
|
export function lstat(path: PathLike): Promise<Stats>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||||
|
*
|
||||||
|
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||||
|
*/
|
||||||
|
export function mkdir(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
/**
|
||||||
|
* Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
|
||||||
|
*
|
||||||
|
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||||
|
*/
|
||||||
|
export function mkdir(
|
||||||
|
path: PathLike,
|
||||||
|
options: Mode | fs.MakeDirectoryOptions | null,
|
||||||
|
callback: (err: NodeJS.ErrnoException) => void,
|
||||||
|
): void;
|
||||||
|
export function mkdir(path: PathLike, options?: Mode | fs.MakeDirectoryOptions | null): Promise<void>;
|
||||||
|
export function mkdirSync(path: PathLike, options?: Mode | fs.MakeDirectoryOptions | null): void;
|
||||||
|
|
||||||
|
export function open(
|
||||||
|
path: PathLike,
|
||||||
|
flags: string | number,
|
||||||
|
callback: (err: NodeJS.ErrnoException, fd: number) => void,
|
||||||
|
): void;
|
||||||
|
export function open(
|
||||||
|
path: PathLike,
|
||||||
|
flags: string | number,
|
||||||
|
mode: Mode,
|
||||||
|
callback: (err: NodeJS.ErrnoException, fd: number) => void,
|
||||||
|
): void;
|
||||||
|
export function open(path: PathLike, flags: string | number, mode?: Mode | null): Promise<number>;
|
||||||
|
|
||||||
|
export function opendir(path: string, cb: (err: NodeJS.ErrnoException | null, dir: fs.Dir) => void): void;
|
||||||
|
export function opendir(
|
||||||
|
path: string,
|
||||||
|
options: fs.OpenDirOptions,
|
||||||
|
cb: (err: NodeJS.ErrnoException | null, dir: fs.Dir) => void,
|
||||||
|
): void;
|
||||||
|
export function opendir(path: string, options?: fs.OpenDirOptions): Promise<fs.Dir>;
|
||||||
|
|
||||||
|
export function read<TBuffer extends ArrayBufferView>(
|
||||||
|
fd: number,
|
||||||
|
buffer: TBuffer,
|
||||||
|
offset: number,
|
||||||
|
length: number,
|
||||||
|
position: number | null,
|
||||||
|
callback: (err: NodeJS.ErrnoException, bytesRead: number, buffer: TBuffer) => void,
|
||||||
|
): void;
|
||||||
|
export function read<TBuffer extends ArrayBufferView>(
|
||||||
|
fd: number,
|
||||||
|
buffer: TBuffer,
|
||||||
|
offset: number,
|
||||||
|
length: number,
|
||||||
|
position: number | null,
|
||||||
|
): Promise<{ bytesRead: number; buffer: TBuffer }>;
|
||||||
|
|
||||||
|
export function readFile(file: PathLike | number, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
|
||||||
|
export function readFile(
|
||||||
|
file: PathLike | number,
|
||||||
|
encoding: BufferEncoding | string,
|
||||||
|
callback: (err: NodeJS.ErrnoException, data: string) => void,
|
||||||
|
): void;
|
||||||
|
export function readFile(
|
||||||
|
file: PathLike | number,
|
||||||
|
options: { flag?: string | undefined } | { encoding: BufferEncoding | string; flag?: string | undefined },
|
||||||
|
callback: (err: NodeJS.ErrnoException, data: Buffer) => void,
|
||||||
|
): void;
|
||||||
|
export function readFile(
|
||||||
|
file: PathLike | number,
|
||||||
|
options: { flag?: string | undefined } | { encoding: BufferEncoding | string; flag?: string | undefined },
|
||||||
|
): Promise<string>;
|
||||||
|
// tslint:disable-next-line:unified-signatures
|
||||||
|
export function readFile(file: PathLike | number, encoding: BufferEncoding | string): Promise<string>;
|
||||||
|
export function readFile(file: PathLike | number): Promise<Buffer>;
|
||||||
|
|
||||||
|
export function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void;
|
||||||
|
export function readdir(
|
||||||
|
path: PathLike,
|
||||||
|
options: 'buffer' | { encoding: 'buffer'; withFileTypes?: false | undefined },
|
||||||
|
): Promise<Buffer[]>;
|
||||||
|
export function readdir(
|
||||||
|
path: PathLike,
|
||||||
|
options?:
|
||||||
|
| { encoding: BufferEncoding | string | null; withFileTypes?: false | undefined }
|
||||||
|
| BufferEncoding
|
||||||
|
| string
|
||||||
|
| null,
|
||||||
|
): Promise<string[]>;
|
||||||
|
export function readdir(
|
||||||
|
path: PathLike,
|
||||||
|
options?: { encoding?: BufferEncoding | string | null | undefined; withFileTypes?: false | undefined },
|
||||||
|
): Promise<string[] | Buffer[]>;
|
||||||
|
export function readdir(
|
||||||
|
path: PathLike,
|
||||||
|
options: { encoding?: BufferEncoding | string | null | undefined; withFileTypes: true },
|
||||||
|
): Promise<fs.Dirent[]>;
|
||||||
|
|
||||||
|
export function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException, linkString: string) => any): void;
|
||||||
|
export function readlink(path: PathLike): Promise<string>;
|
||||||
|
|
||||||
|
export function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
|
||||||
|
export function realpath(
|
||||||
|
path: PathLike,
|
||||||
|
cache: { [path: string]: string },
|
||||||
|
callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any,
|
||||||
|
): void;
|
||||||
|
export function realpath(path: PathLike, cache?: { [path: string]: string }): Promise<string>;
|
||||||
|
|
||||||
|
/* tslint:disable:unified-signatures */
|
||||||
|
export namespace realpath {
|
||||||
|
const native: {
|
||||||
|
(path: PathLike, options: { encoding: 'buffer' } | 'buffer'): Promise<Buffer>;
|
||||||
|
(
|
||||||
|
path: PathLike,
|
||||||
|
options: { encoding: BufferEncoding | string | null } | BufferEncoding | string | undefined | null,
|
||||||
|
): Promise<string>;
|
||||||
|
(path: PathLike, options: { encoding: BufferEncoding | string | null } | string | undefined | null): Promise<
|
||||||
|
string | Buffer
|
||||||
|
>;
|
||||||
|
(path: PathLike): Promise<string>;
|
||||||
|
} & typeof fs.realpath.native;
|
||||||
|
}
|
||||||
|
/* tslint:enable:unified-signatures */
|
||||||
|
|
||||||
|
export function rename(oldPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function rename(oldPath: PathLike, newPath: PathLike): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronously removes files and directories (modeled on the standard POSIX
|
||||||
|
* `rm` utility).
|
||||||
|
*
|
||||||
|
* Only available in node >= v14.14.0
|
||||||
|
*/
|
||||||
|
export function rm(
|
||||||
|
path: PathLike,
|
||||||
|
options?: {
|
||||||
|
force?: boolean | undefined;
|
||||||
|
maxRetries?: number | undefined;
|
||||||
|
recursive?: boolean | undefined;
|
||||||
|
retryDelay?: number | undefined;
|
||||||
|
},
|
||||||
|
): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronous rmdir - removes the directory specified in {path}
|
||||||
|
*
|
||||||
|
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||||
|
*/
|
||||||
|
export function rmdir(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function rmdir(path: PathLike, options?: fs.RmDirOptions): Promise<void>;
|
||||||
|
|
||||||
|
export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
|
||||||
|
export function stat(path: PathLike): Promise<Stats>;
|
||||||
|
|
||||||
|
export function symlink(
|
||||||
|
target: PathLike,
|
||||||
|
path: PathLike,
|
||||||
|
type: SymlinkType | undefined,
|
||||||
|
callback: (err: NodeJS.ErrnoException) => void,
|
||||||
|
): void;
|
||||||
|
export function symlink(target: PathLike, path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function symlink(target: PathLike, path: PathLike, type?: SymlinkType): Promise<void>;
|
||||||
|
|
||||||
|
export function truncate(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function truncate(path: PathLike, len: number, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function truncate(path: PathLike, len?: number): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronous unlink - deletes the file specified in {path}
|
||||||
|
*
|
||||||
|
* @param callback No arguments other than a possible exception are given to the completion callback.
|
||||||
|
*/
|
||||||
|
export function unlink(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function unlink(path: PathLike): Promise<void>;
|
||||||
|
|
||||||
|
export function utimes(
|
||||||
|
path: PathLike,
|
||||||
|
atime: number,
|
||||||
|
mtime: number,
|
||||||
|
callback: (err: NodeJS.ErrnoException) => void,
|
||||||
|
): void;
|
||||||
|
export function utimes(path: PathLike, atime: Date, mtime: Date, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function utimes(path: PathLike, atime: number, mtime: number): Promise<void>;
|
||||||
|
export function utimes(path: PathLike, atime: Date, mtime: Date): Promise<void>;
|
||||||
|
|
||||||
|
export function write<TBuffer extends ArrayBufferView>(
|
||||||
|
fd: number,
|
||||||
|
buffer: TBuffer,
|
||||||
|
offset: number,
|
||||||
|
length: number,
|
||||||
|
position: number | null,
|
||||||
|
callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void,
|
||||||
|
): void;
|
||||||
|
export function write<TBuffer extends ArrayBufferView>(
|
||||||
|
fd: number,
|
||||||
|
buffer: TBuffer,
|
||||||
|
offset: number,
|
||||||
|
length: number,
|
||||||
|
callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void,
|
||||||
|
): void;
|
||||||
|
export function write(
|
||||||
|
fd: number,
|
||||||
|
data: any,
|
||||||
|
callback: (err: NodeJS.ErrnoException, written: number, str: string) => void,
|
||||||
|
): void;
|
||||||
|
export function write(
|
||||||
|
fd: number,
|
||||||
|
data: any,
|
||||||
|
offset: number,
|
||||||
|
callback: (err: NodeJS.ErrnoException, written: number, str: string) => void,
|
||||||
|
): void;
|
||||||
|
export function write(
|
||||||
|
fd: number,
|
||||||
|
data: any,
|
||||||
|
offset: number,
|
||||||
|
encoding: BufferEncoding | string,
|
||||||
|
callback: (err: NodeJS.ErrnoException, written: number, str: string) => void,
|
||||||
|
): void;
|
||||||
|
export function write<TBuffer extends ArrayBufferView>(
|
||||||
|
fd: number,
|
||||||
|
buffer: TBuffer,
|
||||||
|
offset?: number,
|
||||||
|
length?: number,
|
||||||
|
position?: number | null,
|
||||||
|
): Promise<{ bytesWritten: number; buffer: TBuffer }>;
|
||||||
|
export function write(
|
||||||
|
fd: number,
|
||||||
|
data: any,
|
||||||
|
offset?: number,
|
||||||
|
encoding?: BufferEncoding | string,
|
||||||
|
): Promise<{ bytesWritten: number; buffer: string }>;
|
||||||
|
|
||||||
|
export function writeFile(file: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||||
|
export function writeFile(
|
||||||
|
file: PathLike | number,
|
||||||
|
data: any,
|
||||||
|
options?: WriteFileOptions | BufferEncoding | string,
|
||||||
|
): Promise<void>;
|
||||||
|
export function writeFile(
|
||||||
|
file: PathLike | number,
|
||||||
|
data: any,
|
||||||
|
options: WriteFileOptions | BufferEncoding | string,
|
||||||
|
callback: (err: NodeJS.ErrnoException) => void,
|
||||||
|
): void;
|
||||||
|
|
||||||
|
export function writev(
|
||||||
|
fd: number,
|
||||||
|
buffers: NodeJS.ArrayBufferView[],
|
||||||
|
position: number,
|
||||||
|
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void,
|
||||||
|
): void;
|
||||||
|
export function writev(
|
||||||
|
fd: number,
|
||||||
|
buffers: NodeJS.ArrayBufferView[],
|
||||||
|
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void,
|
||||||
|
): void;
|
||||||
|
export function writev(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): Promise<WritevResult>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
||||||
|
*
|
||||||
|
* @param callback The created folder path is passed as a string to the callback's second parameter.
|
||||||
|
*/
|
||||||
|
export function mkdtemp(prefix: string): Promise<string>;
|
||||||
|
export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException, folder: string) => void): void;
|
||||||
|
|
||||||
|
export interface PathEntry {
|
||||||
|
path: string;
|
||||||
|
stats: Stats;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PathEntryStream {
|
||||||
|
read(): PathEntry | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type CopyFilterSync = (src: string, dest: string) => boolean;
|
||||||
|
export type CopyFilterAsync = (src: string, dest: string) => Promise<boolean>;
|
||||||
|
|
||||||
|
export type SymlinkType = 'dir' | 'file' | 'junction';
|
||||||
|
|
||||||
|
export type Mode = string | number;
|
||||||
|
|
||||||
|
export type ArrayBufferView = NodeJS.TypedArray | DataView;
|
||||||
|
|
||||||
|
export interface CopyOptions {
|
||||||
|
dereference?: boolean | undefined;
|
||||||
|
overwrite?: boolean | undefined;
|
||||||
|
preserveTimestamps?: boolean | undefined;
|
||||||
|
errorOnExist?: boolean | undefined;
|
||||||
|
filter?: CopyFilterSync | CopyFilterAsync | undefined;
|
||||||
|
recursive?: boolean | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CopyOptionsSync extends CopyOptions {
|
||||||
|
filter?: CopyFilterSync | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EnsureOptions {
|
||||||
|
mode?: number | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MoveOptions {
|
||||||
|
overwrite?: boolean | undefined;
|
||||||
|
limit?: number | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ReadOptions {
|
||||||
|
throws?: boolean | undefined;
|
||||||
|
fs?: object | undefined;
|
||||||
|
reviver?: any;
|
||||||
|
encoding?: BufferEncoding | string | undefined;
|
||||||
|
flag?: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WriteFileOptions {
|
||||||
|
encoding?: BufferEncoding | string | null | undefined;
|
||||||
|
flag?: string | undefined;
|
||||||
|
mode?: number | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WriteOptions extends WriteFileOptions {
|
||||||
|
fs?: object | undefined;
|
||||||
|
replacer?: any;
|
||||||
|
spaces?: number | string | undefined;
|
||||||
|
EOL?: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WritevResult {
|
||||||
|
bytesWritten: number;
|
||||||
|
buffers: ArrayBufferView[];
|
||||||
|
}
|
67
node_modules/@types/fs-extra/package.json
generated
vendored
Executable file
67
node_modules/@types/fs-extra/package.json
generated
vendored
Executable file
@ -0,0 +1,67 @@
|
|||||||
|
{
|
||||||
|
"name": "@types/fs-extra",
|
||||||
|
"version": "9.0.13",
|
||||||
|
"description": "TypeScript definitions for fs-extra",
|
||||||
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra",
|
||||||
|
"license": "MIT",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Alan Agius",
|
||||||
|
"url": "https://github.com/alan-agius4",
|
||||||
|
"githubUsername": "alan-agius4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "midknight41",
|
||||||
|
"url": "https://github.com/midknight41",
|
||||||
|
"githubUsername": "midknight41"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Brendan Forster",
|
||||||
|
"url": "https://github.com/shiftkey",
|
||||||
|
"githubUsername": "shiftkey"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Mees van Dijk",
|
||||||
|
"url": "https://github.com/mees-",
|
||||||
|
"githubUsername": "mees-"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Justin Rockwood",
|
||||||
|
"url": "https://github.com/jrockwood",
|
||||||
|
"githubUsername": "jrockwood"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Sang Dang",
|
||||||
|
"url": "https://github.com/sangdth",
|
||||||
|
"githubUsername": "sangdth"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Florian Keller",
|
||||||
|
"url": "https://github.com/ffflorian",
|
||||||
|
"githubUsername": "ffflorian"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Piotr Błażejewicz",
|
||||||
|
"url": "https://github.com/peterblazejewicz",
|
||||||
|
"githubUsername": "peterblazejewicz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Tiger Oakes",
|
||||||
|
"url": "https://github.com/NotWoods",
|
||||||
|
"githubUsername": "NotWoods"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"main": "",
|
||||||
|
"types": "index.d.ts",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||||
|
"directory": "types/fs-extra"
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*"
|
||||||
|
},
|
||||||
|
"typesPublisherContentHash": "75e10d16a18d936a50e54414024604aa9484e8345b37c2027921869f254523ee",
|
||||||
|
"typeScriptVersion": "3.9"
|
||||||
|
}
|
21
node_modules/@types/minimist/LICENSE
generated
vendored
Executable file
21
node_modules/@types/minimist/LICENSE
generated
vendored
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE
|
16
node_modules/@types/minimist/README.md
generated
vendored
Executable file
16
node_modules/@types/minimist/README.md
generated
vendored
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
# Installation
|
||||||
|
> `npm install --save @types/minimist`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for minimist (https://github.com/substack/minimist).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/minimist.
|
||||||
|
|
||||||
|
### Additional Details
|
||||||
|
* Last updated: Wed, 07 Jul 2021 00:01:41 GMT
|
||||||
|
* Dependencies: none
|
||||||
|
* Global values: none
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by [Bart van der Schoor](https://github.com/Bartvds), [Necroskillz](https://github.com/Necroskillz), [kamranayub](https://github.com/kamranayub), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
|
95
node_modules/@types/minimist/index.d.ts
generated
vendored
Executable file
95
node_modules/@types/minimist/index.d.ts
generated
vendored
Executable file
@ -0,0 +1,95 @@
|
|||||||
|
// Type definitions for minimist 1.2
|
||||||
|
// Project: https://github.com/substack/minimist
|
||||||
|
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||||
|
// Necroskillz <https://github.com/Necroskillz>
|
||||||
|
// kamranayub <https://github.com/kamranayub>
|
||||||
|
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an argument object populated with the array arguments from args
|
||||||
|
*
|
||||||
|
* @param [args] An optional argument array (typically `process.argv.slice(2)`)
|
||||||
|
* @param [opts] An optional options object to customize the parsing
|
||||||
|
*/
|
||||||
|
declare function minimist(args?: string[], opts?: minimist.Opts): minimist.ParsedArgs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an argument object populated with the array arguments from args. Strongly-typed
|
||||||
|
* to be the intersect of type T with minimist.ParsedArgs.
|
||||||
|
*
|
||||||
|
* `T` The type that will be intersected with minimist.ParsedArgs to represent the argument object
|
||||||
|
*
|
||||||
|
* @param [args] An optional argument array (typically `process.argv.slice(2)`)
|
||||||
|
* @param [opts] An optional options object to customize the parsing
|
||||||
|
*/
|
||||||
|
declare function minimist<T>(args?: string[], opts?: minimist.Opts): T & minimist.ParsedArgs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an argument object populated with the array arguments from args. Strongly-typed
|
||||||
|
* to be the the type T which should extend minimist.ParsedArgs
|
||||||
|
*
|
||||||
|
* `T` The type that extends minimist.ParsedArgs and represents the argument object
|
||||||
|
*
|
||||||
|
* @param [args] An optional argument array (typically `process.argv.slice(2)`)
|
||||||
|
* @param [opts] An optional options object to customize the parsing
|
||||||
|
*/
|
||||||
|
declare function minimist<T extends minimist.ParsedArgs>(args?: string[], opts?: minimist.Opts): T;
|
||||||
|
|
||||||
|
declare namespace minimist {
|
||||||
|
interface Opts {
|
||||||
|
/**
|
||||||
|
* A string or array of strings argument names to always treat as strings
|
||||||
|
*/
|
||||||
|
string?: string | string[] | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A boolean, string or array of strings to always treat as booleans. If true will treat
|
||||||
|
* all double hyphenated arguments without equals signs as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`)
|
||||||
|
*/
|
||||||
|
boolean?: boolean | string | string[] | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An object mapping string names to strings or arrays of string argument names to use as aliases
|
||||||
|
*/
|
||||||
|
alias?: { [key: string]: string | string[] } | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An object mapping string argument names to default values
|
||||||
|
*/
|
||||||
|
default?: { [key: string]: any } | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When true, populate argv._ with everything after the first non-option
|
||||||
|
*/
|
||||||
|
stopEarly?: boolean | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function which is invoked with a command line parameter not defined in the opts
|
||||||
|
* configuration object. If the function returns false, the unknown option is not added to argv
|
||||||
|
*/
|
||||||
|
unknown?: ((arg: string) => boolean) | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When true, populate argv._ with everything before the -- and argv['--'] with everything after the --.
|
||||||
|
* Note that with -- set, parsing for arguments still stops after the `--`.
|
||||||
|
*/
|
||||||
|
'--'?: boolean | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ParsedArgs {
|
||||||
|
[arg: string]: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If opts['--'] is true, populated with everything after the --
|
||||||
|
*/
|
||||||
|
'--'?: string[] | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains all the arguments that didn't have an option associated with them
|
||||||
|
*/
|
||||||
|
_: string[];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export = minimist;
|
40
node_modules/@types/minimist/package.json
generated
vendored
Executable file
40
node_modules/@types/minimist/package.json
generated
vendored
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"name": "@types/minimist",
|
||||||
|
"version": "1.2.2",
|
||||||
|
"description": "TypeScript definitions for minimist",
|
||||||
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/minimist",
|
||||||
|
"license": "MIT",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Bart van der Schoor",
|
||||||
|
"url": "https://github.com/Bartvds",
|
||||||
|
"githubUsername": "Bartvds"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Necroskillz",
|
||||||
|
"url": "https://github.com/Necroskillz",
|
||||||
|
"githubUsername": "Necroskillz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "kamranayub",
|
||||||
|
"url": "https://github.com/kamranayub",
|
||||||
|
"githubUsername": "kamranayub"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Piotr Błażejewicz",
|
||||||
|
"url": "https://github.com/peterblazejewicz",
|
||||||
|
"githubUsername": "peterblazejewicz"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"main": "",
|
||||||
|
"types": "index.d.ts",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||||
|
"directory": "types/minimist"
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"dependencies": {},
|
||||||
|
"typesPublisherContentHash": "9032205d52417d0f537f1e52af6f7ac447acb4b87dca0ab5840b83ec7818232e",
|
||||||
|
"typeScriptVersion": "3.6"
|
||||||
|
}
|
21
node_modules/@types/node/LICENSE
generated
vendored
Executable file
21
node_modules/@types/node/LICENSE
generated
vendored
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE
|
16
node_modules/@types/node/README.md
generated
vendored
Executable file
16
node_modules/@types/node/README.md
generated
vendored
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
# Installation
|
||||||
|
> `npm install --save @types/node`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for Node.js (https://nodejs.org/).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
||||||
|
|
||||||
|
### Additional Details
|
||||||
|
* Last updated: Mon, 26 Dec 2022 17:32:37 GMT
|
||||||
|
* Dependencies: none
|
||||||
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky).
|
961
node_modules/@types/node/assert.d.ts
generated
vendored
Executable file
961
node_modules/@types/node/assert.d.ts
generated
vendored
Executable file
@ -0,0 +1,961 @@
|
|||||||
|
/**
|
||||||
|
* The `assert` module provides a set of assertion functions for verifying
|
||||||
|
* invariants.
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/assert.js)
|
||||||
|
*/
|
||||||
|
declare module 'assert' {
|
||||||
|
/**
|
||||||
|
* An alias of {@link ok}.
|
||||||
|
* @since v0.5.9
|
||||||
|
* @param value The input that is checked for being truthy.
|
||||||
|
*/
|
||||||
|
function assert(value: unknown, message?: string | Error): asserts value;
|
||||||
|
namespace assert {
|
||||||
|
/**
|
||||||
|
* Indicates the failure of an assertion. All errors thrown by the `assert` module
|
||||||
|
* will be instances of the `AssertionError` class.
|
||||||
|
*/
|
||||||
|
class AssertionError extends Error {
|
||||||
|
actual: unknown;
|
||||||
|
expected: unknown;
|
||||||
|
operator: string;
|
||||||
|
generatedMessage: boolean;
|
||||||
|
code: 'ERR_ASSERTION';
|
||||||
|
constructor(options?: {
|
||||||
|
/** If provided, the error message is set to this value. */
|
||||||
|
message?: string | undefined;
|
||||||
|
/** The `actual` property on the error instance. */
|
||||||
|
actual?: unknown | undefined;
|
||||||
|
/** The `expected` property on the error instance. */
|
||||||
|
expected?: unknown | undefined;
|
||||||
|
/** The `operator` property on the error instance. */
|
||||||
|
operator?: string | undefined;
|
||||||
|
/** If provided, the generated stack trace omits frames before this function. */
|
||||||
|
// tslint:disable-next-line:ban-types
|
||||||
|
stackStartFn?: Function | undefined;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This feature is currently experimental and behavior might still change.
|
||||||
|
* @since v14.2.0, v12.19.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
class CallTracker {
|
||||||
|
/**
|
||||||
|
* The wrapper function is expected to be called exactly `exact` times. If the
|
||||||
|
* function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an
|
||||||
|
* error.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert';
|
||||||
|
*
|
||||||
|
* // Creates call tracker.
|
||||||
|
* const tracker = new assert.CallTracker();
|
||||||
|
*
|
||||||
|
* function func() {}
|
||||||
|
*
|
||||||
|
* // Returns a function that wraps func() that must be called exact times
|
||||||
|
* // before tracker.verify().
|
||||||
|
* const callsfunc = tracker.calls(func);
|
||||||
|
* ```
|
||||||
|
* @since v14.2.0, v12.19.0
|
||||||
|
* @param [fn='A no-op function']
|
||||||
|
* @param [exact=1]
|
||||||
|
* @return that wraps `fn`.
|
||||||
|
*/
|
||||||
|
calls(exact?: number): () => void;
|
||||||
|
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
|
||||||
|
/**
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert';
|
||||||
|
*
|
||||||
|
* const tracker = new assert.CallTracker();
|
||||||
|
*
|
||||||
|
* function func() {}
|
||||||
|
* const callsfunc = tracker.calls(func);
|
||||||
|
* callsfunc(1, 2, 3);
|
||||||
|
*
|
||||||
|
* assert.deepStrictEqual(tracker.getCalls(callsfunc),
|
||||||
|
* [{ thisArg: this, arguments: [1, 2, 3 ] }]);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @since v18.8.0, v16.18.0
|
||||||
|
* @params fn
|
||||||
|
* @returns An Array with the calls to a tracked function.
|
||||||
|
*/
|
||||||
|
getCalls(fn: Function): CallTrackerCall[];
|
||||||
|
/**
|
||||||
|
* The arrays contains information about the expected and actual number of calls of
|
||||||
|
* the functions that have not been called the expected number of times.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert';
|
||||||
|
*
|
||||||
|
* // Creates call tracker.
|
||||||
|
* const tracker = new assert.CallTracker();
|
||||||
|
*
|
||||||
|
* function func() {}
|
||||||
|
*
|
||||||
|
* function foo() {}
|
||||||
|
*
|
||||||
|
* // Returns a function that wraps func() that must be called exact times
|
||||||
|
* // before tracker.verify().
|
||||||
|
* const callsfunc = tracker.calls(func, 2);
|
||||||
|
*
|
||||||
|
* // Returns an array containing information on callsfunc()
|
||||||
|
* tracker.report();
|
||||||
|
* // [
|
||||||
|
* // {
|
||||||
|
* // message: 'Expected the func function to be executed 2 time(s) but was
|
||||||
|
* // executed 0 time(s).',
|
||||||
|
* // actual: 0,
|
||||||
|
* // expected: 2,
|
||||||
|
* // operator: 'func',
|
||||||
|
* // stack: stack trace
|
||||||
|
* // }
|
||||||
|
* // ]
|
||||||
|
* ```
|
||||||
|
* @since v14.2.0, v12.19.0
|
||||||
|
* @return of objects containing information about the wrapper functions returned by `calls`.
|
||||||
|
*/
|
||||||
|
report(): CallTrackerReportInformation[];
|
||||||
|
/**
|
||||||
|
* Reset calls of the call tracker.
|
||||||
|
* If a tracked function is passed as an argument, the calls will be reset for it.
|
||||||
|
* If no arguments are passed, all tracked functions will be reset.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert';
|
||||||
|
*
|
||||||
|
* const tracker = new assert.CallTracker();
|
||||||
|
*
|
||||||
|
* function func() {}
|
||||||
|
* const callsfunc = tracker.calls(func);
|
||||||
|
*
|
||||||
|
* callsfunc();
|
||||||
|
* // Tracker was called once
|
||||||
|
* tracker.getCalls(callsfunc).length === 1;
|
||||||
|
*
|
||||||
|
* tracker.reset(callsfunc);
|
||||||
|
* tracker.getCalls(callsfunc).length === 0;
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @since v18.8.0, v16.18.0
|
||||||
|
* @param fn a tracked function to reset.
|
||||||
|
*/
|
||||||
|
reset(fn?: Function): void;
|
||||||
|
/**
|
||||||
|
* Iterates through the list of functions passed to `tracker.calls()` and will throw an error for functions that
|
||||||
|
* have not been called the expected number of times.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert';
|
||||||
|
*
|
||||||
|
* // Creates call tracker.
|
||||||
|
* const tracker = new assert.CallTracker();
|
||||||
|
*
|
||||||
|
* function func() {}
|
||||||
|
*
|
||||||
|
* // Returns a function that wraps func() that must be called exact times
|
||||||
|
* // before tracker.verify().
|
||||||
|
* const callsfunc = tracker.calls(func, 2);
|
||||||
|
*
|
||||||
|
* callsfunc();
|
||||||
|
*
|
||||||
|
* // Will throw an error since callsfunc() was only called once.
|
||||||
|
* tracker.verify();
|
||||||
|
* ```
|
||||||
|
* @since v14.2.0, v12.19.0
|
||||||
|
*/
|
||||||
|
verify(): void;
|
||||||
|
}
|
||||||
|
interface CallTrackerCall {
|
||||||
|
thisArg: object;
|
||||||
|
arguments: unknown[];
|
||||||
|
}
|
||||||
|
interface CallTrackerReportInformation {
|
||||||
|
message: string;
|
||||||
|
/** The actual number of times the function was called. */
|
||||||
|
actual: number;
|
||||||
|
/** The number of times the function was expected to be called. */
|
||||||
|
expected: number;
|
||||||
|
/** The name of the function that is wrapped. */
|
||||||
|
operator: string;
|
||||||
|
/** A stack trace of the function. */
|
||||||
|
stack: object;
|
||||||
|
}
|
||||||
|
type AssertPredicate = RegExp | (new () => object) | ((thrown: unknown) => boolean) | object | Error;
|
||||||
|
/**
|
||||||
|
* Throws an `AssertionError` with the provided error message or a default
|
||||||
|
* error message. If the `message` parameter is an instance of an `Error` then
|
||||||
|
* it will be thrown instead of the `AssertionError`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.fail();
|
||||||
|
* // AssertionError [ERR_ASSERTION]: Failed
|
||||||
|
*
|
||||||
|
* assert.fail('boom');
|
||||||
|
* // AssertionError [ERR_ASSERTION]: boom
|
||||||
|
*
|
||||||
|
* assert.fail(new TypeError('need array'));
|
||||||
|
* // TypeError: need array
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Using `assert.fail()` with more than two arguments is possible but deprecated.
|
||||||
|
* See below for further details.
|
||||||
|
* @since v0.1.21
|
||||||
|
* @param [message='Failed']
|
||||||
|
*/
|
||||||
|
function fail(message?: string | Error): never;
|
||||||
|
/** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
|
||||||
|
function fail(
|
||||||
|
actual: unknown,
|
||||||
|
expected: unknown,
|
||||||
|
message?: string | Error,
|
||||||
|
operator?: string,
|
||||||
|
// tslint:disable-next-line:ban-types
|
||||||
|
stackStartFn?: Function
|
||||||
|
): never;
|
||||||
|
/**
|
||||||
|
* Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`.
|
||||||
|
*
|
||||||
|
* If `value` is not truthy, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is `undefined`, a default
|
||||||
|
* error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
|
||||||
|
* If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``.
|
||||||
|
*
|
||||||
|
* Be aware that in the `repl` the error message will be different to the one
|
||||||
|
* thrown in a file! See below for further details.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.ok(true);
|
||||||
|
* // OK
|
||||||
|
* assert.ok(1);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.ok();
|
||||||
|
* // AssertionError: No value argument passed to `assert.ok()`
|
||||||
|
*
|
||||||
|
* assert.ok(false, 'it\'s false');
|
||||||
|
* // AssertionError: it's false
|
||||||
|
*
|
||||||
|
* // In the repl:
|
||||||
|
* assert.ok(typeof 123 === 'string');
|
||||||
|
* // AssertionError: false == true
|
||||||
|
*
|
||||||
|
* // In a file (e.g. test.js):
|
||||||
|
* assert.ok(typeof 123 === 'string');
|
||||||
|
* // AssertionError: The expression evaluated to a falsy value:
|
||||||
|
* //
|
||||||
|
* // assert.ok(typeof 123 === 'string')
|
||||||
|
*
|
||||||
|
* assert.ok(false);
|
||||||
|
* // AssertionError: The expression evaluated to a falsy value:
|
||||||
|
* //
|
||||||
|
* // assert.ok(false)
|
||||||
|
*
|
||||||
|
* assert.ok(0);
|
||||||
|
* // AssertionError: The expression evaluated to a falsy value:
|
||||||
|
* //
|
||||||
|
* // assert.ok(0)
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* // Using `assert()` works the same:
|
||||||
|
* assert(0);
|
||||||
|
* // AssertionError: The expression evaluated to a falsy value:
|
||||||
|
* //
|
||||||
|
* // assert(0)
|
||||||
|
* ```
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function ok(value: unknown, message?: string | Error): asserts value;
|
||||||
|
/**
|
||||||
|
* **Strict assertion mode**
|
||||||
|
*
|
||||||
|
* An alias of {@link strictEqual}.
|
||||||
|
*
|
||||||
|
* **Legacy assertion mode**
|
||||||
|
*
|
||||||
|
* > Stability: 3 - Legacy: Use {@link strictEqual} instead.
|
||||||
|
*
|
||||||
|
* Tests shallow, coercive equality between the `actual` and `expected` parameters
|
||||||
|
* using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled
|
||||||
|
* and treated as being identical if both sides are `NaN`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert';
|
||||||
|
*
|
||||||
|
* assert.equal(1, 1);
|
||||||
|
* // OK, 1 == 1
|
||||||
|
* assert.equal(1, '1');
|
||||||
|
* // OK, 1 == '1'
|
||||||
|
* assert.equal(NaN, NaN);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.equal(1, 2);
|
||||||
|
* // AssertionError: 1 == 2
|
||||||
|
* assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
|
||||||
|
* // AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are not equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default
|
||||||
|
* error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function equal(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* **Strict assertion mode**
|
||||||
|
*
|
||||||
|
* An alias of {@link notStrictEqual}.
|
||||||
|
*
|
||||||
|
* **Legacy assertion mode**
|
||||||
|
*
|
||||||
|
* > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
|
||||||
|
*
|
||||||
|
* Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is
|
||||||
|
* specially handled and treated as being identical if both sides are `NaN`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert';
|
||||||
|
*
|
||||||
|
* assert.notEqual(1, 2);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.notEqual(1, 1);
|
||||||
|
* // AssertionError: 1 != 1
|
||||||
|
*
|
||||||
|
* assert.notEqual(1, '1');
|
||||||
|
* // AssertionError: 1 != '1'
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default error
|
||||||
|
* message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* **Strict assertion mode**
|
||||||
|
*
|
||||||
|
* An alias of {@link deepStrictEqual}.
|
||||||
|
*
|
||||||
|
* **Legacy assertion mode**
|
||||||
|
*
|
||||||
|
* > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead.
|
||||||
|
*
|
||||||
|
* Tests for deep equality between the `actual` and `expected` parameters. Consider
|
||||||
|
* using {@link deepStrictEqual} instead. {@link deepEqual} can have
|
||||||
|
* surprising results.
|
||||||
|
*
|
||||||
|
* _Deep equality_ means that the enumerable "own" properties of child objects
|
||||||
|
* are also recursively evaluated by the following rules.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* **Strict assertion mode**
|
||||||
|
*
|
||||||
|
* An alias of {@link notDeepStrictEqual}.
|
||||||
|
*
|
||||||
|
* **Legacy assertion mode**
|
||||||
|
*
|
||||||
|
* > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead.
|
||||||
|
*
|
||||||
|
* Tests for any deep inequality. Opposite of {@link deepEqual}.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert';
|
||||||
|
*
|
||||||
|
* const obj1 = {
|
||||||
|
* a: {
|
||||||
|
* b: 1
|
||||||
|
* }
|
||||||
|
* };
|
||||||
|
* const obj2 = {
|
||||||
|
* a: {
|
||||||
|
* b: 2
|
||||||
|
* }
|
||||||
|
* };
|
||||||
|
* const obj3 = {
|
||||||
|
* a: {
|
||||||
|
* b: 1
|
||||||
|
* }
|
||||||
|
* };
|
||||||
|
* const obj4 = Object.create(obj1);
|
||||||
|
*
|
||||||
|
* assert.notDeepEqual(obj1, obj1);
|
||||||
|
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
|
||||||
|
*
|
||||||
|
* assert.notDeepEqual(obj1, obj2);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.notDeepEqual(obj1, obj3);
|
||||||
|
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
|
||||||
|
*
|
||||||
|
* assert.notDeepEqual(obj1, obj4);
|
||||||
|
* // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are deeply equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a default
|
||||||
|
* error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
|
||||||
|
* instead of the `AssertionError`.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Tests strict equality between the `actual` and `expected` parameters as
|
||||||
|
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.strictEqual(1, 2);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
|
||||||
|
* //
|
||||||
|
* // 1 !== 2
|
||||||
|
*
|
||||||
|
* assert.strictEqual(1, 1);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.strictEqual('Hello foobar', 'Hello World!');
|
||||||
|
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
|
||||||
|
* // + actual - expected
|
||||||
|
* //
|
||||||
|
* // + 'Hello foobar'
|
||||||
|
* // - 'Hello World!'
|
||||||
|
* // ^
|
||||||
|
*
|
||||||
|
* const apples = 1;
|
||||||
|
* const oranges = 2;
|
||||||
|
* assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2
|
||||||
|
*
|
||||||
|
* assert.strictEqual(1, '1', new TypeError('Inputs are not identical'));
|
||||||
|
* // TypeError: Inputs are not identical
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are not strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
|
||||||
|
* default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
|
||||||
|
* instead of the `AssertionError`.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
||||||
|
/**
|
||||||
|
* Tests strict inequality between the `actual` and `expected` parameters as
|
||||||
|
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.notStrictEqual(1, 2);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.notStrictEqual(1, 1);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to:
|
||||||
|
* //
|
||||||
|
* // 1
|
||||||
|
*
|
||||||
|
* assert.notStrictEqual(1, '1');
|
||||||
|
* // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
|
||||||
|
* default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
|
||||||
|
* instead of the `AssertionError`.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Tests for deep equality between the `actual` and `expected` parameters.
|
||||||
|
* "Deep" equality means that the enumerable "own" properties of child objects
|
||||||
|
* are recursively evaluated also by the following rules.
|
||||||
|
* @since v1.2.0
|
||||||
|
*/
|
||||||
|
function deepStrictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
||||||
|
/**
|
||||||
|
* Tests for deep strict inequality. Opposite of {@link deepStrictEqual}.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
|
||||||
|
* // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are deeply and strictly equal, an `AssertionError` is thrown
|
||||||
|
* with a `message` property set equal to the value of the `message` parameter. If
|
||||||
|
* the `message` parameter is undefined, a default error message is assigned. If
|
||||||
|
* the `message` parameter is an instance of an `Error` then it will be thrown
|
||||||
|
* instead of the `AssertionError`.
|
||||||
|
* @since v1.2.0
|
||||||
|
*/
|
||||||
|
function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Expects the function `fn` to throw an error.
|
||||||
|
*
|
||||||
|
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
||||||
|
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
|
||||||
|
* a validation object where each property will be tested for strict deep equality,
|
||||||
|
* or an instance of error where each property will be tested for strict deep
|
||||||
|
* equality including the non-enumerable `message` and `name` properties. When
|
||||||
|
* using an object, it is also possible to use a regular expression, when
|
||||||
|
* validating against a string property. See below for examples.
|
||||||
|
*
|
||||||
|
* If specified, `message` will be appended to the message provided by the`AssertionError` if the `fn` call fails to throw or in case the error validation
|
||||||
|
* fails.
|
||||||
|
*
|
||||||
|
* Custom validation object/error instance:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* const err = new TypeError('Wrong value');
|
||||||
|
* err.code = 404;
|
||||||
|
* err.foo = 'bar';
|
||||||
|
* err.info = {
|
||||||
|
* nested: true,
|
||||||
|
* baz: 'text'
|
||||||
|
* };
|
||||||
|
* err.reg = /abc/i;
|
||||||
|
*
|
||||||
|
* assert.throws(
|
||||||
|
* () => {
|
||||||
|
* throw err;
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* name: 'TypeError',
|
||||||
|
* message: 'Wrong value',
|
||||||
|
* info: {
|
||||||
|
* nested: true,
|
||||||
|
* baz: 'text'
|
||||||
|
* }
|
||||||
|
* // Only properties on the validation object will be tested for.
|
||||||
|
* // Using nested objects requires all properties to be present. Otherwise
|
||||||
|
* // the validation is going to fail.
|
||||||
|
* }
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* // Using regular expressions to validate error properties:
|
||||||
|
* throws(
|
||||||
|
* () => {
|
||||||
|
* throw err;
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* // The `name` and `message` properties are strings and using regular
|
||||||
|
* // expressions on those will match against the string. If they fail, an
|
||||||
|
* // error is thrown.
|
||||||
|
* name: /^TypeError$/,
|
||||||
|
* message: /Wrong/,
|
||||||
|
* foo: 'bar',
|
||||||
|
* info: {
|
||||||
|
* nested: true,
|
||||||
|
* // It is not possible to use regular expressions for nested properties!
|
||||||
|
* baz: 'text'
|
||||||
|
* },
|
||||||
|
* // The `reg` property contains a regular expression and only if the
|
||||||
|
* // validation object contains an identical regular expression, it is going
|
||||||
|
* // to pass.
|
||||||
|
* reg: /abc/i
|
||||||
|
* }
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* // Fails due to the different `message` and `name` properties:
|
||||||
|
* throws(
|
||||||
|
* () => {
|
||||||
|
* const otherErr = new Error('Not found');
|
||||||
|
* // Copy all enumerable properties from `err` to `otherErr`.
|
||||||
|
* for (const [key, value] of Object.entries(err)) {
|
||||||
|
* otherErr[key] = value;
|
||||||
|
* }
|
||||||
|
* throw otherErr;
|
||||||
|
* },
|
||||||
|
* // The error's `message` and `name` properties will also be checked when using
|
||||||
|
* // an error as validation object.
|
||||||
|
* err
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Validate instanceof using constructor:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.throws(
|
||||||
|
* () => {
|
||||||
|
* throw new Error('Wrong value');
|
||||||
|
* },
|
||||||
|
* Error
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions):
|
||||||
|
*
|
||||||
|
* Using a regular expression runs `.toString` on the error object, and will
|
||||||
|
* therefore also include the error name.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.throws(
|
||||||
|
* () => {
|
||||||
|
* throw new Error('Wrong value');
|
||||||
|
* },
|
||||||
|
* /^Error: Wrong value$/
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Custom error validation:
|
||||||
|
*
|
||||||
|
* The function must return `true` to indicate all internal validations passed.
|
||||||
|
* It will otherwise fail with an `AssertionError`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.throws(
|
||||||
|
* () => {
|
||||||
|
* throw new Error('Wrong value');
|
||||||
|
* },
|
||||||
|
* (err) => {
|
||||||
|
* assert(err instanceof Error);
|
||||||
|
* assert(/value/.test(err));
|
||||||
|
* // Avoid returning anything from validation functions besides `true`.
|
||||||
|
* // Otherwise, it's not clear what part of the validation failed. Instead,
|
||||||
|
* // throw an error about the specific validation that failed (as done in this
|
||||||
|
* // example) and add as much helpful debugging information to that error as
|
||||||
|
* // possible.
|
||||||
|
* return true;
|
||||||
|
* },
|
||||||
|
* 'unexpected error'
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* `error` cannot be a string. If a string is provided as the second
|
||||||
|
* argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Using the same
|
||||||
|
* message as the thrown error message is going to result in an`ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
|
||||||
|
* a string as the second argument gets considered:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* function throwingFirst() {
|
||||||
|
* throw new Error('First');
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* function throwingSecond() {
|
||||||
|
* throw new Error('Second');
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* function notThrowing() {}
|
||||||
|
*
|
||||||
|
* // The second argument is a string and the input function threw an Error.
|
||||||
|
* // The first case will not throw as it does not match for the error message
|
||||||
|
* // thrown by the input function!
|
||||||
|
* assert.throws(throwingFirst, 'Second');
|
||||||
|
* // In the next example the message has no benefit over the message from the
|
||||||
|
* // error and since it is not clear if the user intended to actually match
|
||||||
|
* // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error.
|
||||||
|
* assert.throws(throwingSecond, 'Second');
|
||||||
|
* // TypeError [ERR_AMBIGUOUS_ARGUMENT]
|
||||||
|
*
|
||||||
|
* // The string is only used (as message) in case the function does not throw:
|
||||||
|
* assert.throws(notThrowing, 'Second');
|
||||||
|
* // AssertionError [ERR_ASSERTION]: Missing expected exception: Second
|
||||||
|
*
|
||||||
|
* // If it was intended to match for the error message do this instead:
|
||||||
|
* // It does not throw because the error messages match.
|
||||||
|
* assert.throws(throwingSecond, /Second$/);
|
||||||
|
*
|
||||||
|
* // If the error message does not match, an AssertionError is thrown.
|
||||||
|
* assert.throws(throwingFirst, /Second$/);
|
||||||
|
* // AssertionError [ERR_ASSERTION]
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Due to the confusing error-prone notation, avoid a string as the second
|
||||||
|
* argument.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function throws(block: () => unknown, message?: string | Error): void;
|
||||||
|
function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Asserts that the function `fn` does not throw an error.
|
||||||
|
*
|
||||||
|
* Using `assert.doesNotThrow()` is actually not useful because there
|
||||||
|
* is no benefit in catching an error and then rethrowing it. Instead, consider
|
||||||
|
* adding a comment next to the specific code path that should not throw and keep
|
||||||
|
* error messages as expressive as possible.
|
||||||
|
*
|
||||||
|
* When `assert.doesNotThrow()` is called, it will immediately call the `fn`function.
|
||||||
|
*
|
||||||
|
* If an error is thrown and it is the same type as that specified by the `error`parameter, then an `AssertionError` is thrown. If the error is of a
|
||||||
|
* different type, or if the `error` parameter is undefined, the error is
|
||||||
|
* propagated back to the caller.
|
||||||
|
*
|
||||||
|
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
||||||
|
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
|
||||||
|
* function. See {@link throws} for more details.
|
||||||
|
*
|
||||||
|
* The following, for instance, will throw the `TypeError` because there is no
|
||||||
|
* matching error type in the assertion:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.doesNotThrow(
|
||||||
|
* () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* SyntaxError
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* However, the following will result in an `AssertionError` with the message
|
||||||
|
* 'Got unwanted exception...':
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.doesNotThrow(
|
||||||
|
* () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* TypeError
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.doesNotThrow(
|
||||||
|
* () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* /Wrong value/,
|
||||||
|
* 'Whoops'
|
||||||
|
* );
|
||||||
|
* // Throws: AssertionError: Got unwanted exception: Whoops
|
||||||
|
* ```
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function doesNotThrow(block: () => unknown, message?: string | Error): void;
|
||||||
|
function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Throws `value` if `value` is not `undefined` or `null`. This is useful when
|
||||||
|
* testing the `error` argument in callbacks. The stack trace contains all frames
|
||||||
|
* from the error passed to `ifError()` including the potential new frames for`ifError()` itself.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.ifError(null);
|
||||||
|
* // OK
|
||||||
|
* assert.ifError(0);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0
|
||||||
|
* assert.ifError('error');
|
||||||
|
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error'
|
||||||
|
* assert.ifError(new Error());
|
||||||
|
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error
|
||||||
|
*
|
||||||
|
* // Create some random error frames.
|
||||||
|
* let err;
|
||||||
|
* (function errorFrame() {
|
||||||
|
* err = new Error('test error');
|
||||||
|
* })();
|
||||||
|
*
|
||||||
|
* (function ifErrorFrame() {
|
||||||
|
* assert.ifError(err);
|
||||||
|
* })();
|
||||||
|
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error
|
||||||
|
* // at ifErrorFrame
|
||||||
|
* // at errorFrame
|
||||||
|
* ```
|
||||||
|
* @since v0.1.97
|
||||||
|
*/
|
||||||
|
function ifError(value: unknown): asserts value is null | undefined;
|
||||||
|
/**
|
||||||
|
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
|
||||||
|
* calls the function and awaits the returned promise to complete. It will then
|
||||||
|
* check that the promise is rejected.
|
||||||
|
*
|
||||||
|
* If `asyncFn` is a function and it throws an error synchronously,`assert.rejects()` will return a rejected `Promise` with that error. If the
|
||||||
|
* function does not return a promise, `assert.rejects()` will return a rejected`Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases the error
|
||||||
|
* handler is skipped.
|
||||||
|
*
|
||||||
|
* Besides the async nature to await the completion behaves identically to {@link throws}.
|
||||||
|
*
|
||||||
|
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
||||||
|
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
|
||||||
|
* an object where each property will be tested for, or an instance of error where
|
||||||
|
* each property will be tested for including the non-enumerable `message` and`name` properties.
|
||||||
|
*
|
||||||
|
* If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* await assert.rejects(
|
||||||
|
* async () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* name: 'TypeError',
|
||||||
|
* message: 'Wrong value'
|
||||||
|
* }
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* await assert.rejects(
|
||||||
|
* async () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* (err) => {
|
||||||
|
* assert.strictEqual(err.name, 'TypeError');
|
||||||
|
* assert.strictEqual(err.message, 'Wrong value');
|
||||||
|
* return true;
|
||||||
|
* }
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.rejects(
|
||||||
|
* Promise.reject(new Error('Wrong value')),
|
||||||
|
* Error
|
||||||
|
* ).then(() => {
|
||||||
|
* // ...
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* `error` cannot be a string. If a string is provided as the second
|
||||||
|
* argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Please read the
|
||||||
|
* example in {@link throws} carefully if using a string as the second
|
||||||
|
* argument gets considered.
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function rejects(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
|
||||||
|
function rejects(block: (() => Promise<unknown>) | Promise<unknown>, error: AssertPredicate, message?: string | Error): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
|
||||||
|
* calls the function and awaits the returned promise to complete. It will then
|
||||||
|
* check that the promise is not rejected.
|
||||||
|
*
|
||||||
|
* If `asyncFn` is a function and it throws an error synchronously,`assert.doesNotReject()` will return a rejected `Promise` with that error. If
|
||||||
|
* the function does not return a promise, `assert.doesNotReject()` will return a
|
||||||
|
* rejected `Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases
|
||||||
|
* the error handler is skipped.
|
||||||
|
*
|
||||||
|
* Using `assert.doesNotReject()` is actually not useful because there is little
|
||||||
|
* benefit in catching a rejection and then rejecting it again. Instead, consider
|
||||||
|
* adding a comment next to the specific code path that should not reject and keep
|
||||||
|
* error messages as expressive as possible.
|
||||||
|
*
|
||||||
|
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
||||||
|
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
|
||||||
|
* function. See {@link throws} for more details.
|
||||||
|
*
|
||||||
|
* Besides the async nature to await the completion behaves identically to {@link doesNotThrow}.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* await assert.doesNotReject(
|
||||||
|
* async () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* SyntaxError
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
|
||||||
|
* .then(() => {
|
||||||
|
* // ...
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
|
||||||
|
function doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>, error: AssertPredicate, message?: string | Error): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Expects the `string` input to match the regular expression.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.match('I will fail', /pass/);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: The input did not match the regular ...
|
||||||
|
*
|
||||||
|
* assert.match(123, /pass/);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
|
||||||
|
*
|
||||||
|
* assert.match('I will pass', /pass/);
|
||||||
|
* // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values do not match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
|
||||||
|
* to the value of the `message` parameter. If the `message` parameter is
|
||||||
|
* undefined, a default error message is assigned. If the `message` parameter is an
|
||||||
|
* instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
||||||
|
* @since v13.6.0, v12.16.0
|
||||||
|
*/
|
||||||
|
function match(value: string, regExp: RegExp, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Expects the `string` input not to match the regular expression.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.doesNotMatch('I will fail', /fail/);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: The input was expected to not match the ...
|
||||||
|
*
|
||||||
|
* assert.doesNotMatch(123, /pass/);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
|
||||||
|
*
|
||||||
|
* assert.doesNotMatch('I will pass', /different/);
|
||||||
|
* // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values do match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
|
||||||
|
* to the value of the `message` parameter. If the `message` parameter is
|
||||||
|
* undefined, a default error message is assigned. If the `message` parameter is an
|
||||||
|
* instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
||||||
|
* @since v13.6.0, v12.16.0
|
||||||
|
*/
|
||||||
|
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
|
||||||
|
const strict: Omit<typeof assert, 'equal' | 'notEqual' | 'deepEqual' | 'notDeepEqual' | 'ok' | 'strictEqual' | 'deepStrictEqual' | 'ifError' | 'strict'> & {
|
||||||
|
(value: unknown, message?: string | Error): asserts value;
|
||||||
|
equal: typeof strictEqual;
|
||||||
|
notEqual: typeof notStrictEqual;
|
||||||
|
deepEqual: typeof deepStrictEqual;
|
||||||
|
notDeepEqual: typeof notDeepStrictEqual;
|
||||||
|
// Mapped types and assertion functions are incompatible?
|
||||||
|
// TS2775: Assertions require every name in the call target
|
||||||
|
// to be declared with an explicit type annotation.
|
||||||
|
ok: typeof ok;
|
||||||
|
strictEqual: typeof strictEqual;
|
||||||
|
deepStrictEqual: typeof deepStrictEqual;
|
||||||
|
ifError: typeof ifError;
|
||||||
|
strict: typeof strict;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export = assert;
|
||||||
|
}
|
||||||
|
declare module 'node:assert' {
|
||||||
|
import assert = require('assert');
|
||||||
|
export = assert;
|
||||||
|
}
|
8
node_modules/@types/node/assert/strict.d.ts
generated
vendored
Executable file
8
node_modules/@types/node/assert/strict.d.ts
generated
vendored
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
declare module 'assert/strict' {
|
||||||
|
import { strict } from 'node:assert';
|
||||||
|
export = strict;
|
||||||
|
}
|
||||||
|
declare module 'node:assert/strict' {
|
||||||
|
import { strict } from 'node:assert';
|
||||||
|
export = strict;
|
||||||
|
}
|
501
node_modules/@types/node/async_hooks.d.ts
generated
vendored
Executable file
501
node_modules/@types/node/async_hooks.d.ts
generated
vendored
Executable file
@ -0,0 +1,501 @@
|
|||||||
|
/**
|
||||||
|
* The `async_hooks` module provides an API to track asynchronous resources. It
|
||||||
|
* can be accessed using:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import async_hooks from 'async_hooks';
|
||||||
|
* ```
|
||||||
|
* @experimental
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/async_hooks.js)
|
||||||
|
*/
|
||||||
|
declare module 'async_hooks' {
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* import { executionAsyncId } from 'async_hooks';
|
||||||
|
*
|
||||||
|
* console.log(executionAsyncId()); // 1 - bootstrap
|
||||||
|
* fs.open(path, 'r', (err, fd) => {
|
||||||
|
* console.log(executionAsyncId()); // 6 - open()
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The ID returned from `executionAsyncId()` is related to execution timing, not
|
||||||
|
* causality (which is covered by `triggerAsyncId()`):
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const server = net.createServer((conn) => {
|
||||||
|
* // Returns the ID of the server, not of the new connection, because the
|
||||||
|
* // callback runs in the execution scope of the server's MakeCallback().
|
||||||
|
* async_hooks.executionAsyncId();
|
||||||
|
*
|
||||||
|
* }).listen(port, () => {
|
||||||
|
* // Returns the ID of a TickObject (process.nextTick()) because all
|
||||||
|
* // callbacks passed to .listen() are wrapped in a nextTick().
|
||||||
|
* async_hooks.executionAsyncId();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Promise contexts may not get precise `executionAsyncIds` by default.
|
||||||
|
* See the section on `promise execution tracking`.
|
||||||
|
* @since v8.1.0
|
||||||
|
* @return The `asyncId` of the current execution context. Useful to track when something calls.
|
||||||
|
*/
|
||||||
|
function executionAsyncId(): number;
|
||||||
|
/**
|
||||||
|
* Resource objects returned by `executionAsyncResource()` are most often internal
|
||||||
|
* Node.js handle objects with undocumented APIs. Using any functions or properties
|
||||||
|
* on the object is likely to crash your application and should be avoided.
|
||||||
|
*
|
||||||
|
* Using `executionAsyncResource()` in the top-level execution context will
|
||||||
|
* return an empty object as there is no handle or request object to use,
|
||||||
|
* but having an object representing the top-level can be helpful.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { open } from 'fs';
|
||||||
|
* import { executionAsyncId, executionAsyncResource } from 'async_hooks';
|
||||||
|
*
|
||||||
|
* console.log(executionAsyncId(), executionAsyncResource()); // 1 {}
|
||||||
|
* open(new URL(import.meta.url), 'r', (err, fd) => {
|
||||||
|
* console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* This can be used to implement continuation local storage without the
|
||||||
|
* use of a tracking `Map` to store the metadata:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { createServer } from 'http';
|
||||||
|
* import {
|
||||||
|
* executionAsyncId,
|
||||||
|
* executionAsyncResource,
|
||||||
|
* createHook
|
||||||
|
* } from 'async_hooks';
|
||||||
|
* const sym = Symbol('state'); // Private symbol to avoid pollution
|
||||||
|
*
|
||||||
|
* createHook({
|
||||||
|
* init(asyncId, type, triggerAsyncId, resource) {
|
||||||
|
* const cr = executionAsyncResource();
|
||||||
|
* if (cr) {
|
||||||
|
* resource[sym] = cr[sym];
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }).enable();
|
||||||
|
*
|
||||||
|
* const server = createServer((req, res) => {
|
||||||
|
* executionAsyncResource()[sym] = { state: req.url };
|
||||||
|
* setTimeout(function() {
|
||||||
|
* res.end(JSON.stringify(executionAsyncResource()[sym]));
|
||||||
|
* }, 100);
|
||||||
|
* }).listen(3000);
|
||||||
|
* ```
|
||||||
|
* @since v13.9.0, v12.17.0
|
||||||
|
* @return The resource representing the current execution. Useful to store data within the resource.
|
||||||
|
*/
|
||||||
|
function executionAsyncResource(): object;
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* const server = net.createServer((conn) => {
|
||||||
|
* // The resource that caused (or triggered) this callback to be called
|
||||||
|
* // was that of the new connection. Thus the return value of triggerAsyncId()
|
||||||
|
* // is the asyncId of "conn".
|
||||||
|
* async_hooks.triggerAsyncId();
|
||||||
|
*
|
||||||
|
* }).listen(port, () => {
|
||||||
|
* // Even though all callbacks passed to .listen() are wrapped in a nextTick()
|
||||||
|
* // the callback itself exists because the call to the server's .listen()
|
||||||
|
* // was made. So the return value would be the ID of the server.
|
||||||
|
* async_hooks.triggerAsyncId();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Promise contexts may not get valid `triggerAsyncId`s by default. See
|
||||||
|
* the section on `promise execution tracking`.
|
||||||
|
* @return The ID of the resource responsible for calling the callback that is currently being executed.
|
||||||
|
*/
|
||||||
|
function triggerAsyncId(): number;
|
||||||
|
interface HookCallbacks {
|
||||||
|
/**
|
||||||
|
* Called when a class is constructed that has the possibility to emit an asynchronous event.
|
||||||
|
* @param asyncId a unique ID for the async resource
|
||||||
|
* @param type the type of the async resource
|
||||||
|
* @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
|
||||||
|
* @param resource reference to the resource representing the async operation, needs to be released during destroy
|
||||||
|
*/
|
||||||
|
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
|
||||||
|
/**
|
||||||
|
* When an asynchronous operation is initiated or completes a callback is called to notify the user.
|
||||||
|
* The before callback is called just before said callback is executed.
|
||||||
|
* @param asyncId the unique identifier assigned to the resource about to execute the callback.
|
||||||
|
*/
|
||||||
|
before?(asyncId: number): void;
|
||||||
|
/**
|
||||||
|
* Called immediately after the callback specified in before is completed.
|
||||||
|
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
|
||||||
|
*/
|
||||||
|
after?(asyncId: number): void;
|
||||||
|
/**
|
||||||
|
* Called when a promise has resolve() called. This may not be in the same execution id
|
||||||
|
* as the promise itself.
|
||||||
|
* @param asyncId the unique id for the promise that was resolve()d.
|
||||||
|
*/
|
||||||
|
promiseResolve?(asyncId: number): void;
|
||||||
|
/**
|
||||||
|
* Called after the resource corresponding to asyncId is destroyed
|
||||||
|
* @param asyncId a unique ID for the async resource
|
||||||
|
*/
|
||||||
|
destroy?(asyncId: number): void;
|
||||||
|
}
|
||||||
|
interface AsyncHook {
|
||||||
|
/**
|
||||||
|
* Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
|
||||||
|
*/
|
||||||
|
enable(): this;
|
||||||
|
/**
|
||||||
|
* Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
|
||||||
|
*/
|
||||||
|
disable(): this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Registers functions to be called for different lifetime events of each async
|
||||||
|
* operation.
|
||||||
|
*
|
||||||
|
* The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the
|
||||||
|
* respective asynchronous event during a resource's lifetime.
|
||||||
|
*
|
||||||
|
* All callbacks are optional. For example, if only resource cleanup needs to
|
||||||
|
* be tracked, then only the `destroy` callback needs to be passed. The
|
||||||
|
* specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { createHook } from 'async_hooks';
|
||||||
|
*
|
||||||
|
* const asyncHook = createHook({
|
||||||
|
* init(asyncId, type, triggerAsyncId, resource) { },
|
||||||
|
* destroy(asyncId) { }
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The callbacks will be inherited via the prototype chain:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* class MyAsyncCallbacks {
|
||||||
|
* init(asyncId, type, triggerAsyncId, resource) { }
|
||||||
|
* destroy(asyncId) {}
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class MyAddedCallbacks extends MyAsyncCallbacks {
|
||||||
|
* before(asyncId) { }
|
||||||
|
* after(asyncId) { }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* const asyncHook = async_hooks.createHook(new MyAddedCallbacks());
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Because promises are asynchronous resources whose lifecycle is tracked
|
||||||
|
* via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises.
|
||||||
|
* @since v8.1.0
|
||||||
|
* @param callbacks The `Hook Callbacks` to register
|
||||||
|
* @return Instance used for disabling and enabling hooks
|
||||||
|
*/
|
||||||
|
function createHook(callbacks: HookCallbacks): AsyncHook;
|
||||||
|
interface AsyncResourceOptions {
|
||||||
|
/**
|
||||||
|
* The ID of the execution context that created this async event.
|
||||||
|
* @default executionAsyncId()
|
||||||
|
*/
|
||||||
|
triggerAsyncId?: number | undefined;
|
||||||
|
/**
|
||||||
|
* Disables automatic `emitDestroy` when the object is garbage collected.
|
||||||
|
* This usually does not need to be set (even if `emitDestroy` is called
|
||||||
|
* manually), unless the resource's `asyncId` is retrieved and the
|
||||||
|
* sensitive API's `emitDestroy` is called with it.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
requireManualDestroy?: boolean | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The class `AsyncResource` is designed to be extended by the embedder's async
|
||||||
|
* resources. Using this, users can easily trigger the lifetime events of their
|
||||||
|
* own resources.
|
||||||
|
*
|
||||||
|
* The `init` hook will trigger when an `AsyncResource` is instantiated.
|
||||||
|
*
|
||||||
|
* The following is an overview of the `AsyncResource` API.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { AsyncResource, executionAsyncId } from 'async_hooks';
|
||||||
|
*
|
||||||
|
* // AsyncResource() is meant to be extended. Instantiating a
|
||||||
|
* // new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
||||||
|
* // async_hook.executionAsyncId() is used.
|
||||||
|
* const asyncResource = new AsyncResource(
|
||||||
|
* type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* // Run a function in the execution context of the resource. This will
|
||||||
|
* // * establish the context of the resource
|
||||||
|
* // * trigger the AsyncHooks before callbacks
|
||||||
|
* // * call the provided function `fn` with the supplied arguments
|
||||||
|
* // * trigger the AsyncHooks after callbacks
|
||||||
|
* // * restore the original execution context
|
||||||
|
* asyncResource.runInAsyncScope(fn, thisArg, ...args);
|
||||||
|
*
|
||||||
|
* // Call AsyncHooks destroy callbacks.
|
||||||
|
* asyncResource.emitDestroy();
|
||||||
|
*
|
||||||
|
* // Return the unique ID assigned to the AsyncResource instance.
|
||||||
|
* asyncResource.asyncId();
|
||||||
|
*
|
||||||
|
* // Return the trigger ID for the AsyncResource instance.
|
||||||
|
* asyncResource.triggerAsyncId();
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
class AsyncResource {
|
||||||
|
/**
|
||||||
|
* AsyncResource() is meant to be extended. Instantiating a
|
||||||
|
* new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
||||||
|
* async_hook.executionAsyncId() is used.
|
||||||
|
* @param type The type of async event.
|
||||||
|
* @param triggerAsyncId The ID of the execution context that created
|
||||||
|
* this async event (default: `executionAsyncId()`), or an
|
||||||
|
* AsyncResourceOptions object (since v9.3.0)
|
||||||
|
*/
|
||||||
|
constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions);
|
||||||
|
/**
|
||||||
|
* Binds the given function to the current execution context.
|
||||||
|
*
|
||||||
|
* The returned function will have an `asyncResource` property referencing
|
||||||
|
* the `AsyncResource` to which the function is bound.
|
||||||
|
* @since v14.8.0, v12.19.0
|
||||||
|
* @param fn The function to bind to the current execution context.
|
||||||
|
* @param type An optional name to associate with the underlying `AsyncResource`.
|
||||||
|
*/
|
||||||
|
static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(
|
||||||
|
fn: Func,
|
||||||
|
type?: string,
|
||||||
|
thisArg?: ThisArg
|
||||||
|
): Func & {
|
||||||
|
asyncResource: AsyncResource;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Binds the given function to execute to this `AsyncResource`'s scope.
|
||||||
|
*
|
||||||
|
* The returned function will have an `asyncResource` property referencing
|
||||||
|
* the `AsyncResource` to which the function is bound.
|
||||||
|
* @since v14.8.0, v12.19.0
|
||||||
|
* @param fn The function to bind to the current `AsyncResource`.
|
||||||
|
*/
|
||||||
|
bind<Func extends (...args: any[]) => any>(
|
||||||
|
fn: Func
|
||||||
|
): Func & {
|
||||||
|
asyncResource: AsyncResource;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Call the provided function with the provided arguments in the execution context
|
||||||
|
* of the async resource. This will establish the context, trigger the AsyncHooks
|
||||||
|
* before callbacks, call the function, trigger the AsyncHooks after callbacks, and
|
||||||
|
* then restore the original execution context.
|
||||||
|
* @since v9.6.0
|
||||||
|
* @param fn The function to call in the execution context of this async resource.
|
||||||
|
* @param thisArg The receiver to be used for the function call.
|
||||||
|
* @param args Optional arguments to pass to the function.
|
||||||
|
*/
|
||||||
|
runInAsyncScope<This, Result>(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result;
|
||||||
|
/**
|
||||||
|
* Call all `destroy` hooks. This should only ever be called once. An error will
|
||||||
|
* be thrown if it is called more than once. This **must** be manually called. If
|
||||||
|
* the resource is left to be collected by the GC then the `destroy` hooks will
|
||||||
|
* never be called.
|
||||||
|
* @return A reference to `asyncResource`.
|
||||||
|
*/
|
||||||
|
emitDestroy(): this;
|
||||||
|
/**
|
||||||
|
* @return The unique `asyncId` assigned to the resource.
|
||||||
|
*/
|
||||||
|
asyncId(): number;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor.
|
||||||
|
*/
|
||||||
|
triggerAsyncId(): number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This class creates stores that stay coherent through asynchronous operations.
|
||||||
|
*
|
||||||
|
* While you can create your own implementation on top of the `async_hooks` module,`AsyncLocalStorage` should be preferred as it is a performant and memory safe
|
||||||
|
* implementation that involves significant optimizations that are non-obvious to
|
||||||
|
* implement.
|
||||||
|
*
|
||||||
|
* The following example uses `AsyncLocalStorage` to build a simple logger
|
||||||
|
* that assigns IDs to incoming HTTP requests and includes them in messages
|
||||||
|
* logged within each request.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import http from 'http';
|
||||||
|
* import { AsyncLocalStorage } from 'async_hooks';
|
||||||
|
*
|
||||||
|
* const asyncLocalStorage = new AsyncLocalStorage();
|
||||||
|
*
|
||||||
|
* function logWithId(msg) {
|
||||||
|
* const id = asyncLocalStorage.getStore();
|
||||||
|
* console.log(`${id !== undefined ? id : '-'}:`, msg);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* let idSeq = 0;
|
||||||
|
* http.createServer((req, res) => {
|
||||||
|
* asyncLocalStorage.run(idSeq++, () => {
|
||||||
|
* logWithId('start');
|
||||||
|
* // Imagine any chain of async operations here
|
||||||
|
* setImmediate(() => {
|
||||||
|
* logWithId('finish');
|
||||||
|
* res.end();
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* }).listen(8080);
|
||||||
|
*
|
||||||
|
* http.get('http://localhost:8080');
|
||||||
|
* http.get('http://localhost:8080');
|
||||||
|
* // Prints:
|
||||||
|
* // 0: start
|
||||||
|
* // 1: start
|
||||||
|
* // 0: finish
|
||||||
|
* // 1: finish
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Each instance of `AsyncLocalStorage` maintains an independent storage context.
|
||||||
|
* Multiple instances can safely exist simultaneously without risk of interfering
|
||||||
|
* with each other's data.
|
||||||
|
* @since v13.10.0, v12.17.0
|
||||||
|
*/
|
||||||
|
class AsyncLocalStorage<T> {
|
||||||
|
/**
|
||||||
|
* Disables the instance of `AsyncLocalStorage`. All subsequent calls
|
||||||
|
* to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
|
||||||
|
*
|
||||||
|
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
|
||||||
|
* instance will be exited.
|
||||||
|
*
|
||||||
|
* Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores
|
||||||
|
* provided by the `asyncLocalStorage`, as those objects are garbage collected
|
||||||
|
* along with the corresponding async resources.
|
||||||
|
*
|
||||||
|
* Use this method when the `asyncLocalStorage` is not in use anymore
|
||||||
|
* in the current process.
|
||||||
|
* @since v13.10.0, v12.17.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
disable(): void;
|
||||||
|
/**
|
||||||
|
* Returns the current store.
|
||||||
|
* If called outside of an asynchronous context initialized by
|
||||||
|
* calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it
|
||||||
|
* returns `undefined`.
|
||||||
|
* @since v13.10.0, v12.17.0
|
||||||
|
*/
|
||||||
|
getStore(): T | undefined;
|
||||||
|
/**
|
||||||
|
* Runs a function synchronously within a context and returns its
|
||||||
|
* return value. The store is not accessible outside of the callback function.
|
||||||
|
* The store is accessible to any asynchronous operations created within the
|
||||||
|
* callback.
|
||||||
|
*
|
||||||
|
* The optional `args` are passed to the callback function.
|
||||||
|
*
|
||||||
|
* If the callback function throws an error, the error is thrown by `run()` too.
|
||||||
|
* The stacktrace is not impacted by this call and the context is exited.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const store = { id: 2 };
|
||||||
|
* try {
|
||||||
|
* asyncLocalStorage.run(store, () => {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the store object
|
||||||
|
* setTimeout(() => {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the store object
|
||||||
|
* }, 200);
|
||||||
|
* throw new Error();
|
||||||
|
* });
|
||||||
|
* } catch (e) {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns undefined
|
||||||
|
* // The error will be caught here
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v13.10.0, v12.17.0
|
||||||
|
*/
|
||||||
|
run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
|
||||||
|
/**
|
||||||
|
* Runs a function synchronously outside of a context and returns its
|
||||||
|
* return value. The store is not accessible within the callback function or
|
||||||
|
* the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`.
|
||||||
|
*
|
||||||
|
* The optional `args` are passed to the callback function.
|
||||||
|
*
|
||||||
|
* If the callback function throws an error, the error is thrown by `exit()` too.
|
||||||
|
* The stacktrace is not impacted by this call and the context is re-entered.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* // Within a call to run
|
||||||
|
* try {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the store object or value
|
||||||
|
* asyncLocalStorage.exit(() => {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns undefined
|
||||||
|
* throw new Error();
|
||||||
|
* });
|
||||||
|
* } catch (e) {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the same object or value
|
||||||
|
* // The error will be caught here
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v13.10.0, v12.17.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
exit<R, TArgs extends any[]>(callback: (...args: TArgs) => R, ...args: TArgs): R;
|
||||||
|
/**
|
||||||
|
* Transitions into the context for the remainder of the current
|
||||||
|
* synchronous execution and then persists the store through any following
|
||||||
|
* asynchronous calls.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const store = { id: 1 };
|
||||||
|
* // Replaces previous store with the given store object
|
||||||
|
* asyncLocalStorage.enterWith(store);
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the store object
|
||||||
|
* someAsyncOperation(() => {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the same object
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* This transition will continue for the _entire_ synchronous execution.
|
||||||
|
* This means that if, for example, the context is entered within an event
|
||||||
|
* handler subsequent event handlers will also run within that context unless
|
||||||
|
* specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons
|
||||||
|
* to use the latter method.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const store = { id: 1 };
|
||||||
|
*
|
||||||
|
* emitter.on('my-event', () => {
|
||||||
|
* asyncLocalStorage.enterWith(store);
|
||||||
|
* });
|
||||||
|
* emitter.on('my-event', () => {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the same object
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* asyncLocalStorage.getStore(); // Returns undefined
|
||||||
|
* emitter.emit('my-event');
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the same object
|
||||||
|
* ```
|
||||||
|
* @since v13.11.0, v12.17.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
enterWith(store: T): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module 'node:async_hooks' {
|
||||||
|
export * from 'async_hooks';
|
||||||
|
}
|
2258
node_modules/@types/node/buffer.d.ts
generated
vendored
Executable file
2258
node_modules/@types/node/buffer.d.ts
generated
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1369
node_modules/@types/node/child_process.d.ts
generated
vendored
Executable file
1369
node_modules/@types/node/child_process.d.ts
generated
vendored
Executable file
File diff suppressed because it is too large
Load Diff
410
node_modules/@types/node/cluster.d.ts
generated
vendored
Executable file
410
node_modules/@types/node/cluster.d.ts
generated
vendored
Executable file
@ -0,0 +1,410 @@
|
|||||||
|
/**
|
||||||
|
* Clusters of Node.js processes can be used to run multiple instances of Node.js
|
||||||
|
* that can distribute workloads among their application threads. When process
|
||||||
|
* isolation is not needed, use the `worker_threads` module instead, which
|
||||||
|
* allows running multiple application threads within a single Node.js instance.
|
||||||
|
*
|
||||||
|
* The cluster module allows easy creation of child processes that all share
|
||||||
|
* server ports.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import cluster from 'cluster';
|
||||||
|
* import http from 'http';
|
||||||
|
* import { cpus } from 'os';
|
||||||
|
* import process from 'process';
|
||||||
|
*
|
||||||
|
* const numCPUs = cpus().length;
|
||||||
|
*
|
||||||
|
* if (cluster.isPrimary) {
|
||||||
|
* console.log(`Primary ${process.pid} is running`);
|
||||||
|
*
|
||||||
|
* // Fork workers.
|
||||||
|
* for (let i = 0; i < numCPUs; i++) {
|
||||||
|
* cluster.fork();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* cluster.on('exit', (worker, code, signal) => {
|
||||||
|
* console.log(`worker ${worker.process.pid} died`);
|
||||||
|
* });
|
||||||
|
* } else {
|
||||||
|
* // Workers can share any TCP connection
|
||||||
|
* // In this case it is an HTTP server
|
||||||
|
* http.createServer((req, res) => {
|
||||||
|
* res.writeHead(200);
|
||||||
|
* res.end('hello world\n');
|
||||||
|
* }).listen(8000);
|
||||||
|
*
|
||||||
|
* console.log(`Worker ${process.pid} started`);
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Running Node.js will now share port 8000 between the workers:
|
||||||
|
*
|
||||||
|
* ```console
|
||||||
|
* $ node server.js
|
||||||
|
* Primary 3596 is running
|
||||||
|
* Worker 4324 started
|
||||||
|
* Worker 4520 started
|
||||||
|
* Worker 6056 started
|
||||||
|
* Worker 5644 started
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* On Windows, it is not yet possible to set up a named pipe server in a worker.
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/cluster.js)
|
||||||
|
*/
|
||||||
|
declare module 'cluster' {
|
||||||
|
import * as child from 'node:child_process';
|
||||||
|
import EventEmitter = require('node:events');
|
||||||
|
import * as net from 'node:net';
|
||||||
|
export interface ClusterSettings {
|
||||||
|
execArgv?: string[] | undefined; // default: process.execArgv
|
||||||
|
exec?: string | undefined;
|
||||||
|
args?: string[] | undefined;
|
||||||
|
silent?: boolean | undefined;
|
||||||
|
stdio?: any[] | undefined;
|
||||||
|
uid?: number | undefined;
|
||||||
|
gid?: number | undefined;
|
||||||
|
inspectPort?: number | (() => number) | undefined;
|
||||||
|
}
|
||||||
|
export interface Address {
|
||||||
|
address: string;
|
||||||
|
port: number;
|
||||||
|
addressType: number | 'udp4' | 'udp6'; // 4, 6, -1, "udp4", "udp6"
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A `Worker` object contains all public information and method about a worker.
|
||||||
|
* In the primary it can be obtained using `cluster.workers`. In a worker
|
||||||
|
* it can be obtained using `cluster.worker`.
|
||||||
|
* @since v0.7.0
|
||||||
|
*/
|
||||||
|
export class Worker extends EventEmitter {
|
||||||
|
/**
|
||||||
|
* Each new worker is given its own unique id, this id is stored in the`id`.
|
||||||
|
*
|
||||||
|
* While a worker is alive, this is the key that indexes it in`cluster.workers`.
|
||||||
|
* @since v0.8.0
|
||||||
|
*/
|
||||||
|
id: number;
|
||||||
|
/**
|
||||||
|
* All workers are created using `child_process.fork()`, the returned object
|
||||||
|
* from this function is stored as `.process`. In a worker, the global `process`is stored.
|
||||||
|
*
|
||||||
|
* See: `Child Process module`.
|
||||||
|
*
|
||||||
|
* Workers will call `process.exit(0)` if the `'disconnect'` event occurs
|
||||||
|
* on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
|
||||||
|
* accidental disconnection.
|
||||||
|
* @since v0.7.0
|
||||||
|
*/
|
||||||
|
process: child.ChildProcess;
|
||||||
|
/**
|
||||||
|
* Send a message to a worker or primary, optionally with a handle.
|
||||||
|
*
|
||||||
|
* In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
|
||||||
|
*
|
||||||
|
* In a worker, this sends a message to the primary. It is identical to`process.send()`.
|
||||||
|
*
|
||||||
|
* This example will echo back all messages from the primary:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* if (cluster.isPrimary) {
|
||||||
|
* const worker = cluster.fork();
|
||||||
|
* worker.send('hi there');
|
||||||
|
*
|
||||||
|
* } else if (cluster.isWorker) {
|
||||||
|
* process.on('message', (msg) => {
|
||||||
|
* process.send(msg);
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.7.0
|
||||||
|
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
|
||||||
|
*/
|
||||||
|
send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
|
||||||
|
send(message: child.Serializable, sendHandle: child.SendHandle, callback?: (error: Error | null) => void): boolean;
|
||||||
|
send(message: child.Serializable, sendHandle: child.SendHandle, options?: child.MessageOptions, callback?: (error: Error | null) => void): boolean;
|
||||||
|
/**
|
||||||
|
* This function will kill the worker. In the primary worker, it does this by
|
||||||
|
* disconnecting the `worker.process`, and once disconnected, killing with`signal`. In the worker, it does it by killing the process with `signal`.
|
||||||
|
*
|
||||||
|
* The `kill()` function kills the worker process without waiting for a graceful
|
||||||
|
* disconnect, it has the same behavior as `worker.process.kill()`.
|
||||||
|
*
|
||||||
|
* This method is aliased as `worker.destroy()` for backwards compatibility.
|
||||||
|
*
|
||||||
|
* In a worker, `process.kill()` exists, but it is not this function;
|
||||||
|
* it is `kill()`.
|
||||||
|
* @since v0.9.12
|
||||||
|
* @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
|
||||||
|
*/
|
||||||
|
kill(signal?: string): void;
|
||||||
|
destroy(signal?: string): void;
|
||||||
|
/**
|
||||||
|
* In a worker, this function will close all servers, wait for the `'close'` event
|
||||||
|
* on those servers, and then disconnect the IPC channel.
|
||||||
|
*
|
||||||
|
* In the primary, an internal message is sent to the worker causing it to call`.disconnect()` on itself.
|
||||||
|
*
|
||||||
|
* Causes `.exitedAfterDisconnect` to be set.
|
||||||
|
*
|
||||||
|
* After a server is closed, it will no longer accept new connections,
|
||||||
|
* but connections may be accepted by any other listening worker. Existing
|
||||||
|
* connections will be allowed to close as usual. When no more connections exist,
|
||||||
|
* see `server.close()`, the IPC channel to the worker will close allowing it
|
||||||
|
* to die gracefully.
|
||||||
|
*
|
||||||
|
* The above applies _only_ to server connections, client connections are not
|
||||||
|
* automatically closed by workers, and disconnect does not wait for them to close
|
||||||
|
* before exiting.
|
||||||
|
*
|
||||||
|
* In a worker, `process.disconnect` exists, but it is not this function;
|
||||||
|
* it is `disconnect()`.
|
||||||
|
*
|
||||||
|
* Because long living server connections may block workers from disconnecting, it
|
||||||
|
* may be useful to send a message, so application specific actions may be taken to
|
||||||
|
* close them. It also may be useful to implement a timeout, killing a worker if
|
||||||
|
* the `'disconnect'` event has not been emitted after some time.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* if (cluster.isPrimary) {
|
||||||
|
* const worker = cluster.fork();
|
||||||
|
* let timeout;
|
||||||
|
*
|
||||||
|
* worker.on('listening', (address) => {
|
||||||
|
* worker.send('shutdown');
|
||||||
|
* worker.disconnect();
|
||||||
|
* timeout = setTimeout(() => {
|
||||||
|
* worker.kill();
|
||||||
|
* }, 2000);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* worker.on('disconnect', () => {
|
||||||
|
* clearTimeout(timeout);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* } else if (cluster.isWorker) {
|
||||||
|
* const net = require('net');
|
||||||
|
* const server = net.createServer((socket) => {
|
||||||
|
* // Connections never end
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* server.listen(8000);
|
||||||
|
*
|
||||||
|
* process.on('message', (msg) => {
|
||||||
|
* if (msg === 'shutdown') {
|
||||||
|
* // Initiate graceful close of any connections to server
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.7.7
|
||||||
|
* @return A reference to `worker`.
|
||||||
|
*/
|
||||||
|
disconnect(): void;
|
||||||
|
/**
|
||||||
|
* This function returns `true` if the worker is connected to its primary via its
|
||||||
|
* IPC channel, `false` otherwise. A worker is connected to its primary after it
|
||||||
|
* has been created. It is disconnected after the `'disconnect'` event is emitted.
|
||||||
|
* @since v0.11.14
|
||||||
|
*/
|
||||||
|
isConnected(): boolean;
|
||||||
|
/**
|
||||||
|
* This function returns `true` if the worker's process has terminated (either
|
||||||
|
* because of exiting or being signaled). Otherwise, it returns `false`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import cluster from 'cluster';
|
||||||
|
* import http from 'http';
|
||||||
|
* import { cpus } from 'os';
|
||||||
|
* import process from 'process';
|
||||||
|
*
|
||||||
|
* const numCPUs = cpus().length;
|
||||||
|
*
|
||||||
|
* if (cluster.isPrimary) {
|
||||||
|
* console.log(`Primary ${process.pid} is running`);
|
||||||
|
*
|
||||||
|
* // Fork workers.
|
||||||
|
* for (let i = 0; i < numCPUs; i++) {
|
||||||
|
* cluster.fork();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* cluster.on('fork', (worker) => {
|
||||||
|
* console.log('worker is dead:', worker.isDead());
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* cluster.on('exit', (worker, code, signal) => {
|
||||||
|
* console.log('worker is dead:', worker.isDead());
|
||||||
|
* });
|
||||||
|
* } else {
|
||||||
|
* // Workers can share any TCP connection. In this case, it is an HTTP server.
|
||||||
|
* http.createServer((req, res) => {
|
||||||
|
* res.writeHead(200);
|
||||||
|
* res.end(`Current process\n ${process.pid}`);
|
||||||
|
* process.kill(process.pid);
|
||||||
|
* }).listen(8000);
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.11.14
|
||||||
|
*/
|
||||||
|
isDead(): boolean;
|
||||||
|
/**
|
||||||
|
* This property is `true` if the worker exited due to `.disconnect()`.
|
||||||
|
* If the worker exited any other way, it is `false`. If the
|
||||||
|
* worker has not exited, it is `undefined`.
|
||||||
|
*
|
||||||
|
* The boolean `worker.exitedAfterDisconnect` allows distinguishing between
|
||||||
|
* voluntary and accidental exit, the primary may choose not to respawn a worker
|
||||||
|
* based on this value.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* cluster.on('exit', (worker, code, signal) => {
|
||||||
|
* if (worker.exitedAfterDisconnect === true) {
|
||||||
|
* console.log('Oh, it was just voluntary – no need to worry');
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // kill worker
|
||||||
|
* worker.kill();
|
||||||
|
* ```
|
||||||
|
* @since v6.0.0
|
||||||
|
*/
|
||||||
|
exitedAfterDisconnect: boolean;
|
||||||
|
/**
|
||||||
|
* events.EventEmitter
|
||||||
|
* 1. disconnect
|
||||||
|
* 2. error
|
||||||
|
* 3. exit
|
||||||
|
* 4. listening
|
||||||
|
* 5. message
|
||||||
|
* 6. online
|
||||||
|
*/
|
||||||
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
addListener(event: 'disconnect', listener: () => void): this;
|
||||||
|
addListener(event: 'error', listener: (error: Error) => void): this;
|
||||||
|
addListener(event: 'exit', listener: (code: number, signal: string) => void): this;
|
||||||
|
addListener(event: 'listening', listener: (address: Address) => void): this;
|
||||||
|
addListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
addListener(event: 'online', listener: () => void): this;
|
||||||
|
emit(event: string | symbol, ...args: any[]): boolean;
|
||||||
|
emit(event: 'disconnect'): boolean;
|
||||||
|
emit(event: 'error', error: Error): boolean;
|
||||||
|
emit(event: 'exit', code: number, signal: string): boolean;
|
||||||
|
emit(event: 'listening', address: Address): boolean;
|
||||||
|
emit(event: 'message', message: any, handle: net.Socket | net.Server): boolean;
|
||||||
|
emit(event: 'online'): boolean;
|
||||||
|
on(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
on(event: 'disconnect', listener: () => void): this;
|
||||||
|
on(event: 'error', listener: (error: Error) => void): this;
|
||||||
|
on(event: 'exit', listener: (code: number, signal: string) => void): this;
|
||||||
|
on(event: 'listening', listener: (address: Address) => void): this;
|
||||||
|
on(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
on(event: 'online', listener: () => void): this;
|
||||||
|
once(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
once(event: 'disconnect', listener: () => void): this;
|
||||||
|
once(event: 'error', listener: (error: Error) => void): this;
|
||||||
|
once(event: 'exit', listener: (code: number, signal: string) => void): this;
|
||||||
|
once(event: 'listening', listener: (address: Address) => void): this;
|
||||||
|
once(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
once(event: 'online', listener: () => void): this;
|
||||||
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
prependListener(event: 'disconnect', listener: () => void): this;
|
||||||
|
prependListener(event: 'error', listener: (error: Error) => void): this;
|
||||||
|
prependListener(event: 'exit', listener: (code: number, signal: string) => void): this;
|
||||||
|
prependListener(event: 'listening', listener: (address: Address) => void): this;
|
||||||
|
prependListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
prependListener(event: 'online', listener: () => void): this;
|
||||||
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
prependOnceListener(event: 'disconnect', listener: () => void): this;
|
||||||
|
prependOnceListener(event: 'error', listener: (error: Error) => void): this;
|
||||||
|
prependOnceListener(event: 'exit', listener: (code: number, signal: string) => void): this;
|
||||||
|
prependOnceListener(event: 'listening', listener: (address: Address) => void): this;
|
||||||
|
prependOnceListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
prependOnceListener(event: 'online', listener: () => void): this;
|
||||||
|
}
|
||||||
|
export interface Cluster extends EventEmitter {
|
||||||
|
disconnect(callback?: () => void): void;
|
||||||
|
fork(env?: any): Worker;
|
||||||
|
/** @deprecated since v16.0.0 - use isPrimary. */
|
||||||
|
readonly isMaster: boolean;
|
||||||
|
readonly isPrimary: boolean;
|
||||||
|
readonly isWorker: boolean;
|
||||||
|
schedulingPolicy: number;
|
||||||
|
readonly settings: ClusterSettings;
|
||||||
|
/** @deprecated since v16.0.0 - use setupPrimary. */
|
||||||
|
setupMaster(settings?: ClusterSettings): void;
|
||||||
|
/**
|
||||||
|
* `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings.
|
||||||
|
*/
|
||||||
|
setupPrimary(settings?: ClusterSettings): void;
|
||||||
|
readonly worker?: Worker | undefined;
|
||||||
|
readonly workers?: NodeJS.Dict<Worker> | undefined;
|
||||||
|
readonly SCHED_NONE: number;
|
||||||
|
readonly SCHED_RR: number;
|
||||||
|
/**
|
||||||
|
* events.EventEmitter
|
||||||
|
* 1. disconnect
|
||||||
|
* 2. exit
|
||||||
|
* 3. fork
|
||||||
|
* 4. listening
|
||||||
|
* 5. message
|
||||||
|
* 6. online
|
||||||
|
* 7. setup
|
||||||
|
*/
|
||||||
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
addListener(event: 'disconnect', listener: (worker: Worker) => void): this;
|
||||||
|
addListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||||
|
addListener(event: 'fork', listener: (worker: Worker) => void): this;
|
||||||
|
addListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
|
||||||
|
addListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
addListener(event: 'online', listener: (worker: Worker) => void): this;
|
||||||
|
addListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
|
||||||
|
emit(event: string | symbol, ...args: any[]): boolean;
|
||||||
|
emit(event: 'disconnect', worker: Worker): boolean;
|
||||||
|
emit(event: 'exit', worker: Worker, code: number, signal: string): boolean;
|
||||||
|
emit(event: 'fork', worker: Worker): boolean;
|
||||||
|
emit(event: 'listening', worker: Worker, address: Address): boolean;
|
||||||
|
emit(event: 'message', worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
|
||||||
|
emit(event: 'online', worker: Worker): boolean;
|
||||||
|
emit(event: 'setup', settings: ClusterSettings): boolean;
|
||||||
|
on(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
on(event: 'disconnect', listener: (worker: Worker) => void): this;
|
||||||
|
on(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||||
|
on(event: 'fork', listener: (worker: Worker) => void): this;
|
||||||
|
on(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
|
||||||
|
on(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
on(event: 'online', listener: (worker: Worker) => void): this;
|
||||||
|
on(event: 'setup', listener: (settings: ClusterSettings) => void): this;
|
||||||
|
once(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
once(event: 'disconnect', listener: (worker: Worker) => void): this;
|
||||||
|
once(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||||
|
once(event: 'fork', listener: (worker: Worker) => void): this;
|
||||||
|
once(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
|
||||||
|
once(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
once(event: 'online', listener: (worker: Worker) => void): this;
|
||||||
|
once(event: 'setup', listener: (settings: ClusterSettings) => void): this;
|
||||||
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
prependListener(event: 'disconnect', listener: (worker: Worker) => void): this;
|
||||||
|
prependListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||||
|
prependListener(event: 'fork', listener: (worker: Worker) => void): this;
|
||||||
|
prependListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
|
||||||
|
// the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
prependListener(event: 'message', listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void): this;
|
||||||
|
prependListener(event: 'online', listener: (worker: Worker) => void): this;
|
||||||
|
prependListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
|
||||||
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
prependOnceListener(event: 'disconnect', listener: (worker: Worker) => void): this;
|
||||||
|
prependOnceListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||||
|
prependOnceListener(event: 'fork', listener: (worker: Worker) => void): this;
|
||||||
|
prependOnceListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
|
||||||
|
// the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
prependOnceListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this;
|
||||||
|
prependOnceListener(event: 'online', listener: (worker: Worker) => void): this;
|
||||||
|
prependOnceListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
|
||||||
|
}
|
||||||
|
const cluster: Cluster;
|
||||||
|
export default cluster;
|
||||||
|
}
|
||||||
|
declare module 'node:cluster' {
|
||||||
|
export * from 'cluster';
|
||||||
|
export { default as default } from 'cluster';
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user