Deploy Production Code for Commit 1bca7e0bbf 🚀

This commit is contained in:
James Ives 2021-11-18 12:58:07 +00:00
parent 1bca7e0bbf
commit dbe7868ee4
77 changed files with 970 additions and 345 deletions

View File

@ -35,55 +35,55 @@ var TestFlag;
})(TestFlag = exports.TestFlag || (exports.TestFlag = {}));
/* Required action data that gets initialized when running within the GitHub Actions environment. */
exports.action = {
folder: core_1.getInput('folder'),
branch: core_1.getInput('branch'),
commitMessage: core_1.getInput('commit-message'),
dryRun: !util_1.isNullOrUndefined(core_1.getInput('dry-run'))
? core_1.getInput('dry-run').toLowerCase() === 'true'
folder: (0, core_1.getInput)('folder'),
branch: (0, core_1.getInput)('branch'),
commitMessage: (0, core_1.getInput)('commit-message'),
dryRun: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('dry-run'))
? (0, core_1.getInput)('dry-run').toLowerCase() === 'true'
: false,
clean: !util_1.isNullOrUndefined(core_1.getInput('clean'))
? core_1.getInput('clean').toLowerCase() === 'true'
clean: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('clean'))
? (0, core_1.getInput)('clean').toLowerCase() === 'true'
: false,
cleanExclude: (core_1.getInput('clean-exclude') || '')
cleanExclude: ((0, core_1.getInput)('clean-exclude') || '')
.split('\n')
.filter(l => l !== ''),
hostname: process.env.GITHUB_SERVER_URL
? util_1.stripProtocolFromUrl(process.env.GITHUB_SERVER_URL)
? (0, util_1.stripProtocolFromUrl)(process.env.GITHUB_SERVER_URL)
: 'github.com',
isTest: TestFlag.NONE,
email: !util_1.isNullOrUndefined(core_1.getInput('git-config-email'))
? core_1.getInput('git-config-email')
email: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('git-config-email'), true)
? (0, core_1.getInput)('git-config-email')
: pusher && pusher.email
? pusher.email
: `${process.env.GITHUB_ACTOR || 'github-pages-deploy-action'}@users.noreply.${process.env.GITHUB_SERVER_URL
? util_1.stripProtocolFromUrl(process.env.GITHUB_SERVER_URL)
? (0, util_1.stripProtocolFromUrl)(process.env.GITHUB_SERVER_URL)
: 'github.com'}`,
name: !util_1.isNullOrUndefined(core_1.getInput('git-config-name'))
? core_1.getInput('git-config-name')
name: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('git-config-name'))
? (0, core_1.getInput)('git-config-name')
: pusher && pusher.name
? pusher.name
: process.env.GITHUB_ACTOR
? process.env.GITHUB_ACTOR
: 'GitHub Pages Deploy Action',
repositoryName: !util_1.isNullOrUndefined(core_1.getInput('repository-name'))
? core_1.getInput('repository-name')
repositoryName: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('repository-name'))
? (0, core_1.getInput)('repository-name')
: repository && repository.full_name
? repository.full_name
: process.env.GITHUB_REPOSITORY,
token: core_1.getInput('token'),
singleCommit: !util_1.isNullOrUndefined(core_1.getInput('single-commit'))
? core_1.getInput('single-commit').toLowerCase() === 'true'
token: (0, core_1.getInput)('token'),
singleCommit: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('single-commit'))
? (0, core_1.getInput)('single-commit').toLowerCase() === 'true'
: false,
silent: !util_1.isNullOrUndefined(core_1.getInput('silent'))
? core_1.getInput('silent').toLowerCase() === 'true'
silent: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('silent'))
? (0, core_1.getInput)('silent').toLowerCase() === 'true'
: false,
sshKey: util_1.isNullOrUndefined(core_1.getInput('ssh-key'))
sshKey: (0, util_1.isNullOrUndefined)((0, core_1.getInput)('ssh-key'))
? false
: !util_1.isNullOrUndefined(core_1.getInput('ssh-key')) &&
core_1.getInput('ssh-key').toLowerCase() === 'true'
: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('ssh-key')) &&
(0, core_1.getInput)('ssh-key').toLowerCase() === 'true'
? true
: core_1.getInput('ssh-key'),
targetFolder: core_1.getInput('target-folder'),
: (0, core_1.getInput)('ssh-key'),
targetFolder: (0, core_1.getInput)('target-folder'),
workspace: process.env.GITHUB_WORKSPACE || ''
};
/** Status codes for the action. */

View File

@ -26,7 +26,7 @@ let output = '';
function execute(cmd, cwd, silent) {
return __awaiter(this, void 0, void 0, function* () {
output = '';
yield exec_1.exec(cmd, [], {
yield (0, exec_1.exec)(cmd, [], {
// Silences the input unless the INPUT_DEBUG flag is set.
silent,
cwd,

View File

@ -24,38 +24,38 @@ const util_1 = require("./util");
function init(action) {
return __awaiter(this, void 0, void 0, function* () {
try {
core_1.info(`Deploying using ${action.tokenType}… 🔑`);
core_1.info('Configuring git…');
yield execute_1.execute(`git config user.name "${action.name}"`, action.workspace, action.silent);
yield execute_1.execute(`git config user.email "${action.email}"`, action.workspace, action.silent);
(0, core_1.info)(`Deploying using ${action.tokenType}… 🔑`);
(0, core_1.info)('Configuring git…');
yield (0, execute_1.execute)(`git config user.name "${action.name}"`, action.workspace, action.silent);
yield (0, execute_1.execute)(`git config user.email "${action.email ? action.email : '<>'}"`, action.workspace, action.silent);
try {
if ((process.env.CI && !action.sshKey) || action.isTest) {
/* Ensures that previously set Git configs do not interfere with the deployment.
Only runs in the GitHub Actions CI environment if a user is not using an SSH key.
*/
yield execute_1.execute(`git config --local --unset-all http.https://${action.hostname}/.extraheader`, action.workspace, action.silent);
yield (0, execute_1.execute)(`git config --local --unset-all http.https://${action.hostname}/.extraheader`, action.workspace, action.silent);
}
if (action.isTest === constants_1.TestFlag.UNABLE_TO_UNSET_GIT_CONFIG) {
throw new Error();
}
}
catch (_a) {
core_1.info('Unable to unset previous git config authentication as it may not exist, continuing…');
(0, core_1.info)('Unable to unset previous git config authentication as it may not exist, continuing…');
}
try {
yield execute_1.execute(`git remote rm origin`, action.workspace, action.silent);
yield (0, execute_1.execute)(`git remote rm origin`, action.workspace, action.silent);
if (action.isTest === constants_1.TestFlag.UNABLE_TO_REMOVE_ORIGIN) {
throw new Error();
}
}
catch (_b) {
core_1.info('Attempted to remove origin but failed, continuing…');
(0, core_1.info)('Attempted to remove origin but failed, continuing…');
}
yield execute_1.execute(`git remote add origin ${action.repositoryPath}`, action.workspace, action.silent);
core_1.info('Git configured… 🔧');
yield (0, execute_1.execute)(`git remote add origin ${action.repositoryPath}`, action.workspace, action.silent);
(0, core_1.info)('Git configured… 🔧');
}
catch (error) {
throw new Error(`There was an error initializing the repository: ${util_1.suppressSensitiveInformation(error.message, action)}`);
throw new Error(`There was an error initializing the repository: ${(0, util_1.suppressSensitiveInformation)((0, util_1.extractErrorMessage)(error), action)}`);
}
});
}
@ -67,17 +67,17 @@ function deploy(action) {
const temporaryDeploymentBranch = `github-pages-deploy-action/${Math.random()
.toString(36)
.substr(2, 9)}`;
core_1.info('Starting to commit changes…');
(0, core_1.info)('Starting to commit changes…');
try {
const commitMessage = !util_1.isNullOrUndefined(action.commitMessage)
const commitMessage = !(0, util_1.isNullOrUndefined)(action.commitMessage)
? action.commitMessage
: `Deploying to ${action.branch}${process.env.GITHUB_SHA
? ` from @ ${process.env.GITHUB_REPOSITORY}@${process.env.GITHUB_SHA}`
: ''} 🚀`;
// Checks to see if the remote exists prior to deploying.
const branchExists = action.isTest & constants_1.TestFlag.HAS_REMOTE_BRANCH ||
(yield execute_1.execute(`git ls-remote --heads ${action.repositoryPath} refs/heads/${action.branch}`, action.workspace, action.silent));
yield worktree_1.generateWorktree(action, temporaryDeploymentDirectory, branchExists);
(yield (0, execute_1.execute)(`git ls-remote --heads ${action.repositoryPath} refs/heads/${action.branch}`, action.workspace, action.silent));
yield (0, worktree_1.generateWorktree)(action, temporaryDeploymentDirectory, branchExists);
// Ensures that items that need to be excluded from the clean job get parsed.
let excludes = '';
if (action.clean && action.cleanExclude) {
@ -86,14 +86,14 @@ function deploy(action) {
}
}
if (action.targetFolder) {
core_1.info(`Creating target folder if it doesn't already exist… 📌`);
yield io_1.mkdirP(`${temporaryDeploymentDirectory}/${action.targetFolder}`);
(0, core_1.info)(`Creating target folder if it doesn't already exist… 📌`);
yield (0, io_1.mkdirP)(`${temporaryDeploymentDirectory}/${action.targetFolder}`);
}
/*
Pushes all of the build files into the deployment directory.
Allows the user to specify the root if '.' is provided.
rsync is used to prevent file duplication. */
yield execute_1.execute(`rsync -q -av --checksum --progress ${action.folderPath}/. ${action.targetFolder
yield (0, execute_1.execute)(`rsync -q -av --checksum --progress ${action.folderPath}/. ${action.targetFolder
? `${temporaryDeploymentDirectory}/${action.targetFolder}`
: temporaryDeploymentDirectory} ${action.clean
? `--delete ${excludes} ${!fs_1.default.existsSync(`${action.folderPath}/CNAME`)
@ -105,7 +105,7 @@ function deploy(action) {
? `--exclude ${temporaryDeploymentDirectory}`
: ''}`, action.workspace, action.silent);
if (action.singleCommit) {
yield execute_1.execute(`git add --all .`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield (0, execute_1.execute)(`git add --all .`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
}
// Use git status to check if we have something to commit.
// Special case is singleCommit with existing history, when
@ -114,9 +114,9 @@ function deploy(action) {
const checkGitStatus = branchExists && action.singleCommit
? `git diff origin/${action.branch}`
: `git status --porcelain`;
core_1.info(`Checking if there are files to commit…`);
(0, core_1.info)(`Checking if there are files to commit…`);
const hasFilesToCommit = action.isTest & constants_1.TestFlag.HAS_CHANGED_FILES ||
(yield execute_1.execute(checkGitStatus, `${action.workspace}/${temporaryDeploymentDirectory}`, true // This output is always silenced due to the large output it creates.
(yield (0, execute_1.execute)(checkGitStatus, `${action.workspace}/${temporaryDeploymentDirectory}`, true // This output is always silenced due to the large output it creates.
));
if ((!action.singleCommit && !hasFilesToCommit) ||
// Ignores the case where single commit is true with a target folder to prevent incorrect early exiting.
@ -124,24 +124,25 @@ function deploy(action) {
return constants_1.Status.SKIPPED;
}
// Commits to GitHub.
yield execute_1.execute(`git add --all .`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield execute_1.execute(`git checkout -b ${temporaryDeploymentBranch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield execute_1.execute(`git commit -m "${commitMessage}" --quiet --no-verify`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield (0, execute_1.execute)(`git add --all .`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield (0, execute_1.execute)(`git checkout -b ${temporaryDeploymentBranch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield (0, execute_1.execute)(`git commit -m "${commitMessage}" --quiet --no-verify`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
if (!action.dryRun) {
yield execute_1.execute(`git push --force ${action.repositoryPath} ${temporaryDeploymentBranch}:${action.branch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield (0, execute_1.execute)(`git push --force ${action.repositoryPath} ${temporaryDeploymentBranch}:${action.branch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
}
core_1.info(`Changes committed to the ${action.branch} branch… 📦`);
(0, core_1.info)(`Changes committed to the ${action.branch} branch… 📦`);
return constants_1.Status.SUCCESS;
}
catch (error) {
throw new Error(`The deploy step encountered an error: ${util_1.suppressSensitiveInformation(error.message, action)}`);
throw new Error(`The deploy step encountered an error: ${(0, util_1.suppressSensitiveInformation)((0, util_1.extractErrorMessage)(error), action)}`);
}
finally {
// Cleans up temporary files/folders and restores the git state.
core_1.info('Running post deployment cleanup jobs… 🗑️');
yield execute_1.execute(`git checkout -B ${temporaryDeploymentBranch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield execute_1.execute(`git worktree remove ${temporaryDeploymentDirectory} --force`, action.workspace, action.silent);
yield io_1.rmRF(temporaryDeploymentDirectory);
(0, core_1.info)('Running post deployment cleanup jobs… 🗑️');
yield (0, execute_1.execute)(`git checkout -B ${temporaryDeploymentBranch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
yield (0, execute_1.execute)(`chmod -R 777 ${temporaryDeploymentDirectory}`, action.workspace, action.silent);
yield (0, execute_1.execute)(`git worktree remove ${temporaryDeploymentDirectory} --force`, action.workspace, action.silent);
yield (0, io_1.rmRF)(temporaryDeploymentDirectory);
}
});
}

View File

@ -22,7 +22,7 @@ function run(configuration) {
return __awaiter(this, void 0, void 0, function* () {
let status = constants_1.Status.RUNNING;
try {
core_1.info(`
(0, core_1.info)(`
GitHub Pages Deploy Action 🚀
🚀 Getting Started Guide: https://github.com/marketplace/actions/deploy-to-github-pages
@ -31,32 +31,32 @@ function run(configuration) {
📣 Maintained by James Ives: https://jamesiv.es
💖 Support: https://github.com/sponsors/JamesIves`);
core_1.info('Checking configuration and starting deployment… 🚦');
(0, core_1.info)('Checking configuration and starting deployment… 🚦');
const settings = Object.assign({}, configuration);
// Defines the repository/folder paths and token types.
// Also verifies that the action has all of the required parameters.
settings.folderPath = util_1.generateFolderPath(settings);
util_1.checkParameters(settings);
settings.repositoryPath = util_1.generateRepositoryPath(settings);
settings.tokenType = util_1.generateTokenType(settings);
settings.folderPath = (0, util_1.generateFolderPath)(settings);
(0, util_1.checkParameters)(settings);
settings.repositoryPath = (0, util_1.generateRepositoryPath)(settings);
settings.tokenType = (0, util_1.generateTokenType)(settings);
if (settings.sshKey) {
yield ssh_1.configureSSH(settings);
yield (0, ssh_1.configureSSH)(settings);
}
yield git_1.init(settings);
status = yield git_1.deploy(settings);
yield (0, git_1.init)(settings);
status = yield (0, git_1.deploy)(settings);
}
catch (error) {
status = constants_1.Status.FAILED;
core_1.setFailed(error.message);
(0, core_1.setFailed)((0, util_1.extractErrorMessage)(error));
}
finally {
core_1.info(`${status === constants_1.Status.FAILED
(0, core_1.info)(`${status === constants_1.Status.FAILED
? 'Deployment failed! ❌'
: status === constants_1.Status.SUCCESS
? 'Completed deployment successfully! ✅'
: 'There is nothing to commit. Exiting early… 📭'}`);
core_1.exportVariable('deployment_status', status);
core_1.setOutput('deployment-status', status);
(0, core_1.exportVariable)('deployment_status', status);
(0, core_1.setOutput)('deployment-status', status);
}
});
}

View File

@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
const constants_1 = require("./constants");
const lib_1 = __importDefault(require("./lib"));
// Runs the action within the GitHub actions environment.
lib_1.default(constants_1.action);
(0, lib_1.default)(constants_1.action);

View File

@ -24,30 +24,30 @@ function configureSSH(action) {
// SSH fingerprints provided by GitHub: https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/githubs-ssh-key-fingerprints
const sshGitHubKnownHostRsa = `\n${action.hostname} ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==\n`;
const sshGitHubKnownHostDss = `\n${action.hostname} ssh-dss AAAAB3NzaC1kc3MAAACBANGFW2P9xlGU3zWrymJgI/lKo//ZW2WfVtmbsUZJ5uyKArtlQOT2+WRhcg4979aFxgKdcsqAYW3/LS1T2km3jYW/vr4Uzn+dXWODVk5VlUiZ1HFOHf6s6ITcZvjvdbp6ZbpM+DuJT7Bw+h5Fx8Qt8I16oCZYmAPJRtu46o9C2zk1AAAAFQC4gdFGcSbp5Gr0Wd5Ay/jtcldMewAAAIATTgn4sY4Nem/FQE+XJlyUQptPWMem5fwOcWtSXiTKaaN0lkk2p2snz+EJvAGXGq9dTSWHyLJSM2W6ZdQDqWJ1k+cL8CARAqL+UMwF84CR0m3hj+wtVGD/J4G5kW2DBAf4/bqzP4469lT+dF2FRQ2L9JKXrCWcnhMtJUvua8dvnwAAAIB6C4nQfAA7x8oLta6tT+oCk2WQcydNsyugE8vLrHlogoWEicla6cWPk7oXSspbzUcfkjN3Qa6e74PhRkc7JdSdAlFzU3m7LMkXo1MHgkqNX8glxWNVqBSc0YRdbFdTkL0C6gtpklilhvuHQCdbgB3LBAikcRkDp+FCVkUgPC/7Rw==\n`;
core_1.info(`Configuring SSH client… 🔑`);
yield io_1.mkdirP(sshDirectory);
fs_1.appendFileSync(sshKnownHostsDirectory, sshGitHubKnownHostRsa);
fs_1.appendFileSync(sshKnownHostsDirectory, sshGitHubKnownHostDss);
(0, core_1.info)(`Configuring SSH client… 🔑`);
yield (0, io_1.mkdirP)(sshDirectory);
(0, fs_1.appendFileSync)(sshKnownHostsDirectory, sshGitHubKnownHostRsa);
(0, fs_1.appendFileSync)(sshKnownHostsDirectory, sshGitHubKnownHostDss);
// Initializes SSH agent.
const agentOutput = child_process_1.execFileSync('ssh-agent').toString().split('\n');
const agentOutput = (0, child_process_1.execFileSync)('ssh-agent').toString().split('\n');
agentOutput.map(line => {
const exportableVariables = /^(SSH_AUTH_SOCK|SSH_AGENT_PID)=(.*); export \1/.exec(line);
if (exportableVariables && exportableVariables.length) {
core_1.exportVariable(exportableVariables[1], exportableVariables[2]);
(0, core_1.exportVariable)(exportableVariables[1], exportableVariables[2]);
}
});
// Adds the SSH key to the agent.
action.sshKey.split(/(?=-----BEGIN)/).map((line) => __awaiter(this, void 0, void 0, function* () {
child_process_1.execSync('ssh-add -', { input: `${line.trim()}\n` });
(0, child_process_1.execSync)('ssh-add -', { input: `${line.trim()}\n` });
}));
child_process_1.execSync('ssh-add -l');
(0, child_process_1.execSync)('ssh-add -l');
}
else {
core_1.info(`Skipping SSH client configuration… ⌚`);
(0, core_1.info)(`Skipping SSH client configuration… ⌚`);
}
}
catch (error) {
throw new Error(`The ssh client configuration encountered an error: ${util_1.suppressSensitiveInformation(error.message, action)}`);
throw new Error(`The ssh client configuration encountered an error: ${(0, util_1.suppressSensitiveInformation)((0, util_1.extractErrorMessage)(error), action)}`);
}
});
}

3
lib/util.d.ts vendored
View File

@ -1,9 +1,10 @@
import { ActionInterface } from './constants';
export declare const isNullOrUndefined: (value: unknown) => boolean;
export declare const isNullOrUndefined: (value: unknown, allowEmptyString?: boolean) => boolean;
export declare const generateTokenType: (action: ActionInterface) => string;
export declare const generateRepositoryPath: (action: ActionInterface) => string;
export declare const generateFolderPath: (action: ActionInterface) => string;
export declare const checkParameters: (action: ActionInterface) => void;
export declare const suppressSensitiveInformation: (str: string, action: ActionInterface) => string;
export declare const extractErrorMessage: (error: unknown) => string;
/** Strips the protocol from a provided URL. */
export declare const stripProtocolFromUrl: (url: string) => string;

View File

@ -3,14 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.stripProtocolFromUrl = exports.suppressSensitiveInformation = exports.checkParameters = exports.generateFolderPath = exports.generateRepositoryPath = exports.generateTokenType = exports.isNullOrUndefined = void 0;
exports.stripProtocolFromUrl = exports.extractErrorMessage = exports.suppressSensitiveInformation = exports.checkParameters = exports.generateFolderPath = exports.generateRepositoryPath = exports.generateTokenType = exports.isNullOrUndefined = void 0;
const core_1 = require("@actions/core");
const fs_1 = require("fs");
const path_1 = __importDefault(require("path"));
/* Replaces all instances of a match in a string. */
const replaceAll = (input, find, replace) => input.split(find).join(replace);
/* Utility function that checks to see if a value is undefined or not. */
const isNullOrUndefined = (value) => typeof value === 'undefined' || value === null || value === '';
/* Utility function that checks to see if a value is undefined or not.
If allowEmptyString is passed the parameter is allowed to contain an empty string as a valid parameter. */
const isNullOrUndefined = (value, allowEmptyString = false) => allowEmptyString
? typeof value === 'undefined' || value === null
: typeof value === 'undefined' || value === null || value === '';
exports.isNullOrUndefined = isNullOrUndefined;
/* Generates a token type used for the action. */
const generateTokenType = (action) => action.sshKey ? 'SSH Deploy Key' : action.token ? 'Deploy Token' : '…';
@ -32,7 +35,7 @@ const generateFolderPath = (action) => {
exports.generateFolderPath = generateFolderPath;
/* Checks for the required tokens and formatting. Throws an error if any case is matched. */
const hasRequiredParameters = (action, params) => {
const nonNullParams = params.filter(param => !exports.isNullOrUndefined(action[param]));
const nonNullParams = params.filter(param => !(0, exports.isNullOrUndefined)(action[param]));
return Boolean(nonNullParams.length);
};
/* Verifies the action has the required parameters to run, otherwise throw an error. */
@ -46,7 +49,7 @@ const checkParameters = (action) => {
if (!hasRequiredParameters(action, ['folder'])) {
throw new Error('You must provide the action with a folder to deploy.');
}
if (!fs_1.existsSync(action.folderPath)) {
if (!(0, fs_1.existsSync)(action.folderPath)) {
throw new Error(`The directory you're trying to deploy named ${action.folderPath} doesn't exist. Please double check the path and any prerequisite build scripts and try again. ❗`);
}
};
@ -54,7 +57,7 @@ exports.checkParameters = checkParameters;
/* Suppresses sensitive information from being exposed in error messages. */
const suppressSensitiveInformation = (str, action) => {
let value = str;
if (core_1.isDebug()) {
if ((0, core_1.isDebug)()) {
// Data is unmasked in debug mode.
return value;
}
@ -65,6 +68,12 @@ const suppressSensitiveInformation = (str, action) => {
return value;
};
exports.suppressSensitiveInformation = suppressSensitiveInformation;
const extractErrorMessage = (error) => error instanceof Error
? error.message
: typeof error == 'string'
? error
: JSON.stringify(error);
exports.extractErrorMessage = extractErrorMessage;
/** Strips the protocol from a provided URL. */
const stripProtocolFromUrl = (url) => url.replace(/^(?:https?:\/\/)?(?:www\.)?/i, '').split('/')[0];
exports.stripProtocolFromUrl = stripProtocolFromUrl;

View File

@ -34,11 +34,11 @@ exports.GitCheckout = GitCheckout;
function generateWorktree(action, worktreedir, branchExists) {
return __awaiter(this, void 0, void 0, function* () {
try {
core_1.info('Creating worktree…');
(0, core_1.info)('Creating worktree…');
if (branchExists) {
yield execute_1.execute(`git fetch --no-recurse-submodules --depth=1 origin ${action.branch}`, action.workspace, action.silent);
yield (0, execute_1.execute)(`git fetch --no-recurse-submodules --depth=1 origin ${action.branch}`, action.workspace, action.silent);
}
yield execute_1.execute(`git worktree add --no-checkout --detach ${worktreedir}`, action.workspace, action.silent);
yield (0, execute_1.execute)(`git worktree add --no-checkout --detach ${worktreedir}`, action.workspace, action.silent);
const checkout = new GitCheckout(action.branch);
if (branchExists) {
// There's existing data on the branch to check out
@ -48,19 +48,19 @@ function generateWorktree(action, worktreedir, branchExists) {
// Create a new history if we don't have the branch, or if we want to reset it
checkout.orphan = true;
}
yield execute_1.execute(checkout.toString(), `${action.workspace}/${worktreedir}`, action.silent);
yield (0, execute_1.execute)(checkout.toString(), `${action.workspace}/${worktreedir}`, action.silent);
if (!branchExists) {
core_1.info(`Created the ${action.branch} branch… 🔧`);
(0, core_1.info)(`Created the ${action.branch} branch… 🔧`);
// Our index is in HEAD state, reset
yield execute_1.execute('git reset --hard', `${action.workspace}/${worktreedir}`, action.silent);
yield (0, execute_1.execute)('git reset --hard', `${action.workspace}/${worktreedir}`, action.silent);
if (!action.singleCommit) {
// New history isn't singleCommit, create empty initial commit
yield execute_1.execute(`git commit --no-verify --allow-empty -m "Initial ${action.branch} commit"`, `${action.workspace}/${worktreedir}`, action.silent);
yield (0, execute_1.execute)(`git commit --no-verify --allow-empty -m "Initial ${action.branch} commit"`, `${action.workspace}/${worktreedir}`, action.silent);
}
}
}
catch (error) {
throw new Error(`There was an error creating the worktree: ${util_1.suppressSensitiveInformation(error.message, action)}`);
throw new Error(`There was an error creating the worktree: ${(0, util_1.suppressSensitiveInformation)((0, util_1.extractErrorMessage)(error), action)}`);
}
});
}

53
node_modules/@actions/core/README.md generated vendored
View File

@ -142,6 +142,11 @@ export interface AnnotationProperties {
*/
title?: string
/**
* The name of the file for which the annotation should be created.
*/
file?: string
/**
* The start line for the annotation.
*/
@ -257,3 +262,51 @@ var pid = core.getState("pidToKill");
process.kill(pid);
```
#### OIDC Token
You can use these methods to interact with the GitHub OIDC provider and get a JWT ID token which would help to get access token from third party cloud providers.
**Method Name**: getIDToken()
**Inputs**
audience : optional
**Outputs**
A [JWT](https://jwt.io/) ID Token
In action's `main.ts`:
```js
const core = require('@actions/core');
async function getIDTokenAction(): Promise<void> {
const audience = core.getInput('audience', {required: false})
const id_token1 = await core.getIDToken() // ID Token with default audience
const id_token2 = await core.getIDToken(audience) // ID token with custom audience
// this id_token can be used to get access token from third party cloud providers
}
getIDTokenAction()
```
In action's `actions.yml`:
```yaml
name: 'GetIDToken'
description: 'Get ID token from Github OIDC provider'
inputs:
audience:
description: 'Audience for which the ID token is intended for'
required: false
outputs:
id_token1:
description: 'ID token obtained from OIDC provider'
id_token2:
description: 'ID token obtained from OIDC provider'
runs:
using: 'node12'
main: 'dist/index.js'
```

View File

@ -29,6 +29,10 @@ export interface AnnotationProperties {
* A title for the annotation.
*/
title?: string;
/**
* The path of the file for which the annotation should be created.
*/
file?: string;
/**
* The start line for the annotation.
*/
@ -179,3 +183,4 @@ export declare function saveState(name: string, value: any): void;
* @returns string
*/
export declare function getState(name: string): string;
export declare function getIDToken(aud?: string): Promise<string>;

View File

@ -28,12 +28,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
const command_1 = require("./command");
const file_command_1 = require("./file-command");
const utils_1 = require("./utils");
const os = __importStar(require("os"));
const path = __importStar(require("path"));
const oidc_utils_1 = require("./oidc-utils");
/**
* The code to exit an action
*/
@ -302,4 +303,10 @@ function getState(name) {
return process.env[`STATE_${name}`] || '';
}
exports.getState = getState;
function getIDToken(aud) {
return __awaiter(this, void 0, void 0, function* () {
return yield oidc_utils_1.OidcClient.getIDToken(aud);
});
}
exports.get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,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC;AAED,SAAsB,UAAU,CAAC,GAAY;;QAC3C,OAAO,MAAM,uBAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IACzC,CAAC;CAAA;AAFD,gCAEC"}

7
node_modules/@actions/core/lib/oidc-utils.d.ts generated vendored Normal file
View File

@ -0,0 +1,7 @@
export declare class OidcClient {
private static createHttpClient;
private static getRequestToken;
private static getIDTokenUrl;
private static getCall;
static getIDToken(audience?: string): Promise<string>;
}

77
node_modules/@actions/core/lib/oidc-utils.js generated vendored Normal file
View File

@ -0,0 +1,77 @@
"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.OidcClient = void 0;
const http_client_1 = require("@actions/http-client");
const auth_1 = require("@actions/http-client/auth");
const core_1 = require("./core");
class OidcClient {
static createHttpClient(allowRetry = true, maxRetry = 10) {
const requestOptions = {
allowRetries: allowRetry,
maxRetries: maxRetry
};
return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);
}
static getRequestToken() {
const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];
if (!token) {
throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');
}
return token;
}
static getIDTokenUrl() {
const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];
if (!runtimeUrl) {
throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');
}
return runtimeUrl;
}
static getCall(id_token_url) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const httpclient = OidcClient.createHttpClient();
const res = yield httpclient
.getJson(id_token_url)
.catch(error => {
throw new Error(`Failed to get ID Token. \n
Error Code : ${error.statusCode}\n
Error Message: ${error.result.message}`);
});
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
if (!id_token) {
throw new Error('Response json body do not have ID Token field');
}
return id_token;
});
}
static getIDToken(audience) {
return __awaiter(this, void 0, void 0, function* () {
try {
// New ID Token is requested from action service
let id_token_url = OidcClient.getIDTokenUrl();
if (audience) {
const encodedAudience = encodeURIComponent(audience);
id_token_url = `${id_token_url}&audience=${encodedAudience}`;
}
core_1.debug(`ID token url is ${id_token_url}`);
const id_token = yield OidcClient.getCall(id_token_url);
core_1.setSecret(id_token);
return id_token;
}
catch (error) {
throw new Error(`Error message: ${error.message}`);
}
});
}
}
exports.OidcClient = OidcClient;
//# sourceMappingURL=oidc-utils.js.map

1
node_modules/@actions/core/lib/oidc-utils.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"oidc-utils.js","sourceRoot":"","sources":["../src/oidc-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,sDAA+C;AAC/C,oDAAiE;AACjE,iCAAuC;AAKvC,MAAa,UAAU;IACb,MAAM,CAAC,gBAAgB,CAC7B,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,EAAE;QAEb,MAAM,cAAc,GAAoB;YACtC,YAAY,EAAE,UAAU;YACxB,UAAU,EAAE,QAAQ;SACrB,CAAA;QAED,OAAO,IAAI,wBAAU,CACnB,qBAAqB,EACrB,CAAC,IAAI,8BAAuB,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,EAC3D,cAAc,CACf,CAAA;IACH,CAAC;IAEO,MAAM,CAAC,eAAe;QAC5B,MAAM,KAAK,GAAG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AAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;gBACvD,gBAAS,CAAC,QAAQ,CAAC,CAAA;gBACnB,OAAO,QAAQ,CAAA;aAChB;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;aACnD;QACH,CAAC;KAAA;CACF;AAzED,gCAyEC"}

View File

@ -29,6 +29,7 @@ function toCommandProperties(annotationProperties) {
}
return {
title: annotationProperties.title,
file: annotationProperties.file,
line: annotationProperties.startLine,
endLine: annotationProperties.endLine,
col: annotationProperties.startColumn,

View File

@ -1 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;;AAKvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CACjC,oBAA0C;IAE1C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,MAAM,EAAE;QAC7C,OAAO,EAAE,CAAA;KACV;IAED,OAAO;QACL,KAAK,EAAE,oBAAoB,CAAC,KAAK;QACjC,IAAI,EAAE,oBAAoB,CAAC,SAAS;QACpC,OAAO,EAAE,oBAAoB,CAAC,OAAO;QACrC,GAAG,EAAE,oBAAoB,CAAC,WAAW;QACrC,SAAS,EAAE,oBAAoB,CAAC,SAAS;KAC1C,CAAA;AACH,CAAC;AAdD,kDAcC"}
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;;AAKvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CACjC,oBAA0C;IAE1C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,MAAM,EAAE;QAC7C,OAAO,EAAE,CAAA;KACV;IAED,OAAO;QACL,KAAK,EAAE,oBAAoB,CAAC,KAAK;QACjC,IAAI,EAAE,oBAAoB,CAAC,IAAI;QAC/B,IAAI,EAAE,oBAAoB,CAAC,SAAS;QACpC,OAAO,EAAE,oBAAoB,CAAC,OAAO;QACrC,GAAG,EAAE,oBAAoB,CAAC,WAAW;QACrC,SAAS,EAAE,oBAAoB,CAAC,SAAS;KAC1C,CAAA;AACH,CAAC;AAfD,kDAeC"}

View File

@ -1,6 +1,6 @@
{
"name": "@actions/core",
"version": "1.5.0",
"version": "1.6.0",
"description": "Actions core lib",
"keywords": [
"github",
@ -35,6 +35,9 @@
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
"dependencies": {
"@actions/http-client": "^1.0.11"
},
"devDependencies": {
"@types/node": "^12.0.2"
}

6
node_modules/@types/node/README.md generated vendored
View File

@ -2,15 +2,15 @@
> `npm install --save @types/node`
# Summary
This package contains type definitions for Node.js (http://nodejs.org/).
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: Thu, 26 Aug 2021 01:01:28 GMT
* Last updated: Mon, 08 Nov 2021 21:31:28 GMT
* Dependencies: none
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
# 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), [Hoàng Văn Khải](https://github.com/KSXGitHub), [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), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Jason Kwok](https://github.com/JasonHK), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), and [Linus Unnebäck](https://github.com/LinusU).
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), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [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), and [wafuwafu13](https://github.com/wafuwafu13).

View File

@ -1,7 +1,7 @@
/**
* The `assert` module provides a set of assertion functions for verifying
* invariants.
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/assert.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/assert.js)
*/
declare module 'assert' {
/**

View File

@ -6,7 +6,7 @@
* import async_hooks from 'async_hooks';
* ```
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/async_hooks.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/async_hooks.js)
*/
declare module 'async_hooks' {
/**

View File

@ -4,7 +4,7 @@
*
* The `Buffer` class is a subclass of JavaScript's [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) class and
* extends it with methods that cover additional use cases. Node.js APIs accept
* plain [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)s wherever `Buffer`s are supported as well.
* plain [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) s wherever `Buffer`s are supported as well.
*
* While the `Buffer` class is available within the global scope, it is still
* recommended to explicitly reference it via an import or require statement.
@ -41,7 +41,7 @@
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
* const buf7 = Buffer.from('tést', 'latin1');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/buffer.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/buffer.js)
*/
declare module 'buffer' {
import { BinaryLike } from 'node:crypto';
@ -137,7 +137,7 @@ declare module 'buffer' {
*/
constructor(sources: Array<BinaryLike | Blob>, options?: BlobOptions);
/**
* Returns a promise that fulfills with an [&lt;ArrayBuffer&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of
* Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of
* the `Blob` data.
* @since v15.7.0
*/
@ -176,7 +176,7 @@ declare module 'buffer' {
/**
* Raw data is stored in instances of the Buffer class.
* A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized.
* Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
* Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'base64url'|'binary'(deprecated)|'hex'
*/
interface BufferConstructor {
/**

View File

@ -60,7 +60,7 @@
* For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
* the synchronous methods can have significant impact on performance due to
* stalling the event loop while spawned processes complete.
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/child_process.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/child_process.js)
*/
declare module 'child_process' {
import { ObjectEncodingOptions } from 'node:fs';
@ -70,7 +70,15 @@ declare module 'child_process' {
import { URL } from 'node:url';
type Serializable = string | object | number | boolean | bigint;
type SendHandle = net.Socket | net.Server;
interface ChildProcess extends EventEmitter {
/**
* Instances of the `ChildProcess` represent spawned child processes.
*
* Instances of `ChildProcess` are not intended to be created directly. Rather,
* use the {@link spawn}, {@link exec},{@link execFile}, or {@link fork} methods to create
* instances of `ChildProcess`.
* @since v2.2.0
*/
class ChildProcess extends EventEmitter {
/**
* A `Writable Stream` that represents the child process's `stdin`.
*
@ -236,8 +244,8 @@ declare module 'child_process' {
readonly spawnfile: string;
/**
* The `subprocess.kill()` method sends a signal to the child process. If no
* argument is given, the process will be sent the `'SIGTERM'` signal. See[`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a list of available signals. This function
* returns `true` if[`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) succeeds, and `false` otherwise.
* argument is given, the process will be sent the `'SIGTERM'` signal. See [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a list of available signals. This function
* returns `true` if [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) succeeds, and `false` otherwise.
*
* ```js
* const { spawn } = require('child_process');
@ -781,6 +789,7 @@ declare module 'child_process' {
function spawn(command: string, args: ReadonlyArray<string>, options: SpawnOptions): ChildProcess;
interface ExecOptions extends CommonOptions {
shell?: string | undefined;
signal?: AbortSignal | undefined;
maxBuffer?: number | undefined;
killSignal?: NodeJS.Signals | number | undefined;
}
@ -799,7 +808,7 @@ declare module 'child_process' {
/**
* Spawns a shell then executes the `command` within that shell, buffering any
* generated output. The `command` string passed to the exec function is processed
* directly by the shell and special characters (vary based on[shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters))
* directly by the shell and special characters (vary based on [shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters))
* need to be dealt with accordingly:
*
* ```js
@ -1271,12 +1280,13 @@ declare module 'child_process' {
* @param args List of string arguments.
*/
function spawnSync(command: string): SpawnSyncReturns<Buffer>;
function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>;
function spawnSync(command: string, args: ReadonlyArray<string>): SpawnSyncReturns<Buffer>;
function spawnSync(command: string, args: ReadonlyArray<string>, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
function spawnSync(command: string, args: ReadonlyArray<string>, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>;
interface CommonExecOptions extends CommonOptions {
input?: string | NodeJS.ArrayBufferView | undefined;
stdio?: StdioOptions | undefined;
@ -1310,9 +1320,9 @@ declare module 'child_process' {
* @return The stdout from the command.
*/
function execSync(command: string): Buffer;
function execSync(command: string, options?: ExecSyncOptionsWithStringEncoding): string;
function execSync(command: string, options?: ExecSyncOptionsWithBufferEncoding): Buffer;
function execSync(command: string, options?: ExecSyncOptions): Buffer;
function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string;
function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): Buffer;
function execSync(command: string, options?: ExecSyncOptions): string | Buffer;
interface ExecFileSyncOptions extends CommonExecOptions {
shell?: boolean | string | undefined;
}
@ -1320,7 +1330,7 @@ declare module 'child_process' {
encoding: BufferEncoding;
}
interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
encoding: BufferEncoding; // specify `null`.
encoding?: 'buffer' | null; // specify `null`.
}
/**
* The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not
@ -1343,12 +1353,13 @@ declare module 'child_process' {
* @return The stdout from the command.
*/
function execFileSync(file: string): Buffer;
function execFileSync(file: string, options?: ExecFileSyncOptionsWithStringEncoding): string;
function execFileSync(file: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
function execFileSync(file: string, options?: ExecFileSyncOptions): Buffer;
function execFileSync(file: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithStringEncoding): string;
function execFileSync(file: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
function execFileSync(file: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): Buffer;
function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string;
function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer;
function execFileSync(file: string, options?: ExecFileSyncOptions): string | Buffer;
function execFileSync(file: string, args: ReadonlyArray<string>): Buffer;
function execFileSync(file: string, args: ReadonlyArray<string>, options: ExecFileSyncOptionsWithStringEncoding): string;
function execFileSync(file: string, args: ReadonlyArray<string>, options: ExecFileSyncOptionsWithBufferEncoding): Buffer;
function execFileSync(file: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): string | Buffer;
}
declare module 'node:child_process' {
export * from 'child_process';

View File

@ -49,7 +49,7 @@
* ```
*
* 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/v16.7.0/lib/cluster.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/cluster.js)
*/
declare module 'cluster' {
import * as child from 'node:child_process';

View File

@ -53,7 +53,7 @@
* myConsole.warn(`Danger ${name}! Danger!`);
* // Prints: Danger Will Robinson! Danger!, to err
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/console.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/console.js)
*/
declare module 'console' {
import console = require('node:console');
@ -394,6 +394,11 @@ declare module 'node:console' {
ignoreErrors?: boolean | undefined;
colorMode?: boolean | 'auto' | undefined;
inspectOptions?: InspectOptions | undefined;
/**
* Set group indentation
* @default 2
*/
groupIndentation?: number | undefined;
}
interface ConsoleConstructor {
prototype: Console;

199
node_modules/@types/node/crypto.d.ts generated vendored
View File

@ -13,7 +13,7 @@
* // Prints:
* // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/crypto.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/crypto.js)
*/
declare module 'crypto' {
import * as stream from 'node:stream';
@ -250,7 +250,7 @@ declare module 'crypto' {
*/
function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac;
// https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
type BinaryToTextEncoding = 'base64' | 'hex';
type BinaryToTextEncoding = 'base64' | 'base64url' | 'hex';
type CharacterEncoding = 'utf8' | 'utf-8' | 'utf16le' | 'latin1';
type LegacyCharacterEncoding = 'ascii' | 'binary' | 'ucs2' | 'ucs-2';
type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding;
@ -508,6 +508,18 @@ declare module 'crypto' {
* Public exponent (RSA).
*/
publicExponent?: bigint | undefined;
/**
* Name of the message digest (RSA-PSS).
*/
hashAlgorithm?: string | undefined;
/**
* Name of the message digest used by MGF1 (RSA-PSS).
*/
mgf1HashAlgorithm?: string | undefined;
/**
* Minimal salt length in bytes (RSA-PSS).
*/
saltLength?: number | undefined;
/**
* Size of q in bits (DSA).
*/
@ -535,6 +547,26 @@ declare module 'crypto' {
*/
class KeyObject {
private constructor();
/**
* Example: Converting a `CryptoKey` instance to a `KeyObject`:
*
* ```js
* const { webcrypto, KeyObject } = await import('crypto');
* const { subtle } = webcrypto;
*
* const key = await subtle.generateKey({
* name: 'HMAC',
* hash: 'SHA-256',
* length: 256
* }, true, ['sign', 'verify']);
*
* const keyObject = KeyObject.from(key);
* console.log(keyObject.symmetricKeySize);
* // Prints: 32 (symmetric key size in bytes)
* ```
* @since v15.0.0
*/
static from(key: webcrypto.CryptoKey): KeyObject;
/**
* For asymmetric keys, this property represents the type of the key. Supported key
* types are:
@ -565,8 +597,11 @@ declare module 'crypto' {
* through this property can be used to uniquely identify a key or to compromise
* the security of the key.
*
* RSA-PSS parameters, DH, or any future key type details might be exposed via this
* API using additional attributes.
* For RSA-PSS keys, if the key material contains a `RSASSA-PSS-params` sequence,
* the `hashAlgorithm`, `mgf1HashAlgorithm`, and `saltLength` properties will be
* set.
*
* Other key details might be exposed via this API using additional attributes.
* @since v15.7.0
*/
asymmetricKeyDetails?: AsymmetricKeyDetails | undefined;
@ -641,7 +676,7 @@ declare module 'crypto' {
* non-cryptographically secure hash algorithm allow passwords to be tested very
* rapidly.
*
* In line with OpenSSL's recommendation to use a more modern algorithm instead of[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that
* In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that
* developers derive a key and IV on
* their own using {@link scrypt} and to use {@link createCipheriv} to create the `Cipher` object. Users should not use ciphers with counter mode
* (e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when
@ -669,7 +704,7 @@ declare module 'crypto' {
* recent OpenSSL releases, `openssl list -cipher-algorithms`(`openssl list-cipher-algorithms` for older versions of OpenSSL) will
* display the available cipher algorithms.
*
* The `key` is the raw key used by the `algorithm` and `iv` is an[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
* The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
* strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be
* a `KeyObject` of type `secret`. If the cipher does not need
* an initialization vector, `iv` may be `null`.
@ -886,7 +921,7 @@ declare module 'crypto' {
* non-cryptographically secure hash algorithm allow passwords to be tested very
* rapidly.
*
* In line with OpenSSL's recommendation to use a more modern algorithm instead of[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that
* In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that
* developers derive a key and IV on
* their own using {@link scrypt} and to use {@link createDecipheriv} to create the `Decipher` object.
* @since v0.1.94
@ -910,7 +945,7 @@ declare module 'crypto' {
* recent OpenSSL releases, `openssl list -cipher-algorithms`(`openssl list-cipher-algorithms` for older versions of OpenSSL) will
* display the available cipher algorithms.
*
* The `key` is the raw key used by the `algorithm` and `iv` is an[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
* The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
* strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be
* a `KeyObject` of type `secret`. If the cipher does not need
* an initialization vector, `iv` may be `null`.
@ -1132,6 +1167,26 @@ declare module 'crypto' {
},
callback: (err: Error | null, key: KeyObject) => void
): void;
/**
* Synchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
*
* ```js
* const {
* generateKeySync
* } = await import('crypto');
*
* const key = generateKeySync('hmac', { length: 64 });
* console.log(key.export().toString('hex')); // e89..........41e
* ```
* @since v15.0.0
* @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
*/
function generateKeySync(
type: 'hmac' | 'aes',
options: {
length: number;
}
): KeyObject;
interface JsonWebKeyInput {
key: JsonWebKey;
format: 'jwk';
@ -1505,7 +1560,7 @@ declare module 'crypto' {
}
/**
* Creates a predefined `DiffieHellmanGroup` key exchange object. The
* supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in[RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see `Caveats`) and `'modp14'`, `'modp15'`,`'modp16'`, `'modp17'`,
* supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see `Caveats`) and `'modp14'`, `'modp15'`,`'modp16'`, `'modp17'`,
* `'modp18'` (defined in [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt)). The
* returned object mimics the interface of objects created by {@link createDiffieHellman}, but will not allow changing
* the keys (with `diffieHellman.setPublicKey()`, for example). The
@ -2105,7 +2160,7 @@ declare module 'crypto' {
key: BinaryLike,
curve: string,
inputEncoding?: BinaryToTextEncoding,
outputEncoding?: 'latin1' | 'hex' | 'base64',
outputEncoding?: 'latin1' | 'hex' | 'base64' | 'base64url',
format?: 'uncompressed' | 'compressed' | 'hybrid'
): Buffer | string;
/**
@ -2190,7 +2245,7 @@ declare module 'crypto' {
* This function is based on a constant-time algorithm.
* Returns true if `a` is equal to `b`, without leaking timing information that
* would allow an attacker to guess one of the values. This is suitable for
* comparing HMAC digests or secret values like authentication cookies or[capability urls](https://www.w3.org/TR/capability-urls/).
* comparing HMAC digests or secret values like authentication cookies or [capability urls](https://www.w3.org/TR/capability-urls/).
*
* `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they
* must have the same byte length.
@ -2207,7 +2262,7 @@ declare module 'crypto' {
function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
/** @deprecated since v10.0.0 */
const DEFAULT_ENCODING: BufferEncoding;
type KeyType = 'rsa' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448';
type KeyType = 'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448';
type KeyFormat = 'pem' | 'der';
interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
format: T;
@ -2224,7 +2279,7 @@ declare module 'crypto' {
interface X448KeyPairKeyObjectOptions {}
interface ECKeyPairKeyObjectOptions {
/**
* Name of the curve to use.
* Name of the curve to use
*/
namedCurve: string;
}
@ -2234,10 +2289,34 @@ declare module 'crypto' {
*/
modulusLength: number;
/**
* Public exponent
* @default 0x10001
*/
publicExponent?: number | undefined;
}
interface RSAPSSKeyPairKeyObjectOptions {
/**
* Key size in bits
*/
modulusLength: number;
/**
* Public exponent
* @default 0x10001
*/
publicExponent?: number | undefined;
/**
* Name of the message digest
*/
hashAlgorithm?: string;
/**
* Name of the message digest used by MGF1
*/
mgf1HashAlgorithm?: string;
/**
* Minimal salt length in bytes
*/
saltLength?: string;
}
interface DSAKeyPairKeyObjectOptions {
/**
* Key size in bits
@ -2254,6 +2333,7 @@ declare module 'crypto' {
*/
modulusLength: number;
/**
* Public exponent
* @default 0x10001
*/
publicExponent?: number | undefined;
@ -2265,6 +2345,36 @@ declare module 'crypto' {
type: 'pkcs1' | 'pkcs8';
};
}
interface RSAPSSKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
/**
* Key size in bits
*/
modulusLength: number;
/**
* Public exponent
* @default 0x10001
*/
publicExponent?: number | undefined;
/**
* Name of the message digest
*/
hashAlgorithm?: string;
/**
* Name of the message digest used by MGF1
*/
mgf1HashAlgorithm?: string;
/**
* Minimal salt length in bytes
*/
saltLength?: string;
publicKeyEncoding: {
type: 'spki';
format: PubF;
};
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
type: 'pkcs8';
};
}
interface DSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
/**
* Key size in bits
@ -2336,8 +2446,8 @@ declare module 'crypto' {
privateKey: T2;
}
/**
* Generates a new asymmetric key pair of the given `type`. RSA, DSA, EC, Ed25519,
* Ed448, X25519, X448, and DH are currently supported.
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
* Ed25519, Ed448, X25519, X448, and DH are currently supported.
*
* If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
* behaves as if `keyObject.export()` had been called on its result. Otherwise,
@ -2374,13 +2484,18 @@ declare module 'crypto' {
* When PEM encoding was selected, the respective key will be a string, otherwise
* it will be a buffer containing the data encoded as DER.
* @since v10.12.0
* @param type Must be `'rsa'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
* @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
*/
function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
@ -2412,8 +2527,8 @@ declare module 'crypto' {
function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
function generateKeyPairSync(type: 'x448', options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
/**
* Generates a new asymmetric key pair of the given `type`. RSA, DSA, EC, Ed25519,
* Ed448, X25519, X448, and DH are currently supported.
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
* Ed25519, Ed448, X25519, X448, and DH are currently supported.
*
* If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
* behaves as if `keyObject.export()` had been called on its result. Otherwise,
@ -2448,13 +2563,18 @@ declare module 'crypto' {
* If this method is invoked as its `util.promisify()` ed version, it returns
* a `Promise` for an `Object` with `publicKey` and `privateKey` properties.
* @since v10.12.0
* @param type Must be `'rsa'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
* @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
*/
function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
function generateKeyPair(type: 'rsa', options: RSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
@ -2515,6 +2635,35 @@ declare module 'crypto' {
privateKey: Buffer;
}>;
function __promisify__(type: 'rsa', options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
function __promisify__(
type: 'rsa-pss',
options: RSAPSSKeyPairOptions<'pem', 'pem'>
): Promise<{
publicKey: string;
privateKey: string;
}>;
function __promisify__(
type: 'rsa-pss',
options: RSAPSSKeyPairOptions<'pem', 'der'>
): Promise<{
publicKey: string;
privateKey: Buffer;
}>;
function __promisify__(
type: 'rsa-pss',
options: RSAPSSKeyPairOptions<'der', 'pem'>
): Promise<{
publicKey: Buffer;
privateKey: string;
}>;
function __promisify__(
type: 'rsa-pss',
options: RSAPSSKeyPairOptions<'der', 'der'>
): Promise<{
publicKey: Buffer;
privateKey: Buffer;
}>;
function __promisify__(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
function __promisify__(
type: 'dsa',
options: DSAKeyPairOptions<'pem', 'pem'>
@ -2795,7 +2944,7 @@ declare module 'crypto' {
*
* The supplied `callback` function is called with two arguments: `err` and`derivedKey`. If an errors occurs while deriving the key, `err` will be set;
* otherwise `err` will be `null`. The successfully generated `derivedKey` will
* be passed to the callback as an [&lt;ArrayBuffer&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). An error will be thrown if any
* be passed to the callback as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). An error will be thrown if any
* of the input arguments specify invalid values or types.
*
* ```js
@ -2822,7 +2971,7 @@ declare module 'crypto' {
* Provides a synchronous HKDF key derivation function as defined in RFC 5869\. The
* given `ikm`, `salt` and `info` are used with the `digest` to derive a key of`keylen` bytes.
*
* The successfully generated `derivedKey` will be returned as an [&lt;ArrayBuffer&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer).
* The successfully generated `derivedKey` will be returned as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer).
*
* An error will be thrown if any of the input arguments specify invalid values or
* types, or if the derived key cannot be generated.
@ -3084,8 +3233,8 @@ declare module 'crypto' {
* if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or`DataView`.
*
* By default, the prime is encoded as a big-endian sequence of octets
* in an [&lt;ArrayBuffer&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a
* [&lt;bigint&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)is provided.
* in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a
* [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided.
* @since v15.8.0
* @param size The size (in bits) of the prime to generate.
*/
@ -3115,8 +3264,8 @@ declare module 'crypto' {
* if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or`DataView`.
*
* By default, the prime is encoded as a big-endian sequence of octets
* in an [&lt;ArrayBuffer&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a
* [&lt;bigint&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)is provided.
* in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a
* [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided.
* @since v15.8.0
* @param size The size (in bits) of the prime to generate.
*/

20
node_modules/@types/node/dgram.d.ts generated vendored
View File

@ -23,7 +23,7 @@
* server.bind(41234);
* // Prints: server listening 0.0.0.0:41234
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/dgram.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/dgram.js)
*/
declare module 'dgram' {
import { AddressInfo } from 'node:net';
@ -166,17 +166,17 @@ declare module 'dgram' {
* @since v0.1.99
* @param callback with no parameters. Called when binding is complete.
*/
bind(port?: number, address?: string, callback?: () => void): void;
bind(port?: number, callback?: () => void): void;
bind(callback?: () => void): void;
bind(options: BindOptions, callback?: () => void): void;
bind(port?: number, address?: string, callback?: () => void): this;
bind(port?: number, callback?: () => void): this;
bind(callback?: () => void): this;
bind(options: BindOptions, callback?: () => void): this;
/**
* Close the underlying socket and stop listening for data on it. If a callback is
* provided, it is added as a listener for the `'close'` event.
* @since v0.1.99
* @param callback Called when the socket has been closed.
*/
close(callback?: () => void): void;
close(callback?: () => void): this;
/**
* Associates the `dgram.Socket` to a remote address and port. Every
* message sent by this handle is automatically sent to that destination. Also,
@ -350,7 +350,7 @@ declare module 'dgram' {
*/
setBroadcast(flag: boolean): void;
/**
* _All references to scope in this section are referring to[IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC
* _All references to scope in this section are referring to [IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC
* 4007](https://tools.ietf.org/html/rfc4007). In string form, an IP_
* _with a scope index is written as `'IP%scope'` where scope is an interface name_
* _or interface number._
@ -414,7 +414,7 @@ declare module 'dgram' {
* This method throws `EBADF` if called on an unbound socket.
* @since v0.3.8
*/
setMulticastLoopback(flag: boolean): void;
setMulticastLoopback(flag: boolean): boolean;
/**
* Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for
* "Time to Live", in this context it specifies the number of IP hops that a
@ -427,7 +427,7 @@ declare module 'dgram' {
* This method throws `EBADF` if called on an unbound socket.
* @since v0.3.8
*/
setMulticastTTL(ttl: number): void;
setMulticastTTL(ttl: number): number;
/**
* Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer
* in bytes.
@ -457,7 +457,7 @@ declare module 'dgram' {
* This method throws `EBADF` if called on an unbound socket.
* @since v0.1.101
*/
setTTL(ttl: number): void;
setTTL(ttl: number): number;
/**
* By default, binding a socket will cause it to block the Node.js process from
* exiting as long as the socket is open. The `socket.unref()` method can be used

View File

@ -20,7 +20,7 @@
* should generally include the module name to avoid collisions with data from
* other modules.
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/diagnostics_channel.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/diagnostics_channel.js)
*/
declare module 'diagnostics_channel' {
/**
@ -37,6 +37,7 @@ declare module 'diagnostics_channel' {
* // There are subscribers, prepare and publish message
* }
* ```
* @since v15.1.0, v14.17.0
* @param name The channel name
* @return If there are active subscribers
*/
@ -51,6 +52,7 @@ declare module 'diagnostics_channel' {
*
* const channel = diagnostics_channel.channel('my-channel');
* ```
* @since v15.1.0, v14.17.0
* @param name The channel name
* @return The named channel object
*/
@ -63,6 +65,7 @@ declare module 'diagnostics_channel' {
* lookups at publish time, enabling very fast publish speeds and allowing
* for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly
* with `new Channel(name)` is not supported.
* @since v15.1.0, v14.17.0
*/
class Channel {
readonly name: string;
@ -82,6 +85,7 @@ declare module 'diagnostics_channel' {
* // There are subscribers, prepare and publish message
* }
* ```
* @since v15.1.0, v14.17.0
*/
readonly hasSubscribers: boolean;
private constructor(name: string);
@ -99,6 +103,7 @@ declare module 'diagnostics_channel' {
* // Received data
* });
* ```
* @since v15.1.0, v14.17.0
* @param onMessage The handler to receive channel messages
*/
subscribe(onMessage: ChannelListener): void;
@ -118,6 +123,7 @@ declare module 'diagnostics_channel' {
*
* channel.unsubscribe(onMessage);
* ```
* @since v15.1.0, v14.17.0
* @param onMessage The previous subscribed handler to remove
*/
unsubscribe(onMessage: ChannelListener): void;

4
node_modules/@types/node/dns.d.ts generated vendored
View File

@ -42,7 +42,7 @@
* ```
*
* See the `Implementation considerations section` for more information.
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/dns.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/dns.js)
*/
declare module 'dns' {
import * as dnsPromises from 'node:dns/promises';
@ -502,7 +502,7 @@ declare module 'dns' {
*
* The {@link setServers} method affects only {@link resolve},`dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}).
*
* This method works much like[resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
* This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
* That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
* subsequent servers provided. Fallback DNS servers will only be used if the
* earlier ones time out or result in some other error.

View File

@ -323,7 +323,7 @@ declare module 'dns/promises' {
* The `dnsPromises.setServers()` method must not be called while a DNS query is in
* progress.
*
* This method works much like[resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
* This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
* That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
* subsequent servers provided. Fallback DNS servers will only be used if the
* earlier ones time out or result in some other error.

View File

@ -11,7 +11,7 @@
* will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
* exit immediately with an error code.
* @deprecated Since v1.4.2 - Deprecated
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/domain.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/domain.js)
*/
declare module 'domain' {
import EventEmitter = require('node:events');

View File

@ -32,7 +32,7 @@
* });
* myEmitter.emit('event');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/events.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/events.js)
*/
declare module 'events' {
interface EventEmitterOptions {
@ -78,7 +78,7 @@ declare module 'events' {
* The `Promise` will resolve with an array of all the arguments emitted to the
* given event.
*
* This method is intentionally generic and works with the web platform[EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event
* This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event
* semantics and does not listen to the `'error'` event.
*
* ```js

109
node_modules/@types/node/fs.d.ts generated vendored
View File

@ -16,7 +16,7 @@
*
* All file system operations have synchronous, callback, and promise-based
* forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM).
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/fs.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/fs.js)
*/
declare module 'fs' {
import * as stream from 'node:stream';
@ -188,7 +188,7 @@ declare module 'fs' {
/**
* A class representing a directory stream.
*
* Created by {@link opendir}, {@link opendirSync}, or {@link romises.opendir}.
* Created by {@link opendir}, {@link opendirSync}, or `fsPromises.opendir()`.
*
* ```js
* import { opendir } from 'fs/promises';
@ -208,7 +208,7 @@ declare module 'fs' {
*/
export class Dir implements AsyncIterable<Dirent> {
/**
* The read-only path of this directory as was provided to {@link opendir},{@link opendirSync}, or {@link romises.opendir}.
* The read-only path of this directory as was provided to {@link opendir},{@link opendirSync}, or `fsPromises.opendir()`.
* @since v12.12.0
*/
readonly path: string;
@ -297,7 +297,7 @@ declare module 'fs' {
* @since v0.1.93
*/
export class ReadStream extends stream.Readable {
close(): void;
close(callback?: (err?: NodeJS.ErrnoException | null) => void): void;
/**
* The number of bytes that have been read so far.
* @since v6.4.0
@ -306,7 +306,7 @@ declare module 'fs' {
/**
* The path to the file the stream is reading from as specified in the first
* argument to `fs.createReadStream()`. If `path` is passed as a string, then`readStream.path` will be a string. If `path` is passed as a `Buffer`, then`readStream.path` will be a
* `Buffer`.
* `Buffer`. If `fd` is specified, then`readStream.path` will be `undefined`.
* @since v0.1.93
*/
path: string | Buffer;
@ -385,7 +385,7 @@ declare module 'fs' {
* callback that will be executed once the `writeStream`is closed.
* @since v0.9.4
*/
close(): void;
close(callback?: (err?: NodeJS.ErrnoException | null) => void): void;
/**
* The number of bytes written so far. Does not include data that is still queued
* for writing.
@ -768,6 +768,7 @@ declare module 'fs' {
* @deprecated Since v0.4.7
*/
export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
/** @deprecated */
export namespace lchmod {
/**
* Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
@ -904,42 +905,42 @@ declare module 'fs' {
): Promise<BigIntStats>;
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
}
export interface StatSyncFn<TDescriptor = PathLike> extends Function {
(path: TDescriptor, options?: undefined): Stats;
export interface StatSyncFn extends Function {
(path: PathLike, options?: undefined): Stats;
(
path: TDescriptor,
options?: StatOptions & {
path: PathLike,
options?: StatSyncOptions & {
bigint?: false | undefined;
throwIfNoEntry: false;
}
): Stats | undefined;
(
path: TDescriptor,
options: StatOptions & {
path: PathLike,
options: StatSyncOptions & {
bigint: true;
throwIfNoEntry: false;
}
): BigIntStats | undefined;
(
path: TDescriptor,
options?: StatOptions & {
path: PathLike,
options?: StatSyncOptions & {
bigint?: false | undefined;
}
): Stats;
(
path: TDescriptor,
options: StatOptions & {
path: PathLike,
options: StatSyncOptions & {
bigint: true;
}
): BigIntStats;
(
path: TDescriptor,
options: StatOptions & {
path: PathLike,
options: StatSyncOptions & {
bigint: boolean;
throwIfNoEntry?: false | undefined;
}
): Stats | BigIntStats;
(path: TDescriptor, options?: StatOptions): Stats | BigIntStats | undefined;
(path: PathLike, options?: StatSyncOptions): Stats | BigIntStats | undefined;
}
/**
* Synchronous stat(2) - Get file status.
@ -993,7 +994,20 @@ declare module 'fs' {
* Synchronous fstat(2) - Get file status.
* @param fd A file descriptor.
*/
export const fstatSync: StatSyncFn<number>;
export function fstatSync(
fd: number,
options?: StatOptions & {
bigint?: false | undefined;
}
): Stats;
export function fstatSync(
fd: number,
options: StatOptions & {
bigint: true;
}
): BigIntStats;
export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
/**
* Retrieves the `fs.Stats` for the symbolic link referred to by the path.
* The callback gets two arguments `(err, stats)` where `stats` is a `fs.Stats` object. `lstat()` is identical to `stat()`, except that if `path` is a symbolic
@ -1045,8 +1059,8 @@ declare module 'fs' {
*/
export const lstatSync: StatSyncFn;
/**
* Creates a new link from the `existingPath` to the `newPath`. See the POSIX[`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. No arguments other than a
* possible
* Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. No arguments other than
* a possible
* exception are given to the completion callback.
* @since v0.1.31
*/
@ -1060,7 +1074,7 @@ declare module 'fs' {
function __promisify__(existingPath: PathLike, newPath: PathLike): Promise<void>;
}
/**
* Creates a new link from the `existingPath` to the `newPath`. See the POSIX[`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. Returns `undefined`.
* Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. Returns `undefined`.
* @since v0.1.31
*/
export function linkSync(existingPath: PathLike, newPath: PathLike): void;
@ -1456,7 +1470,7 @@ declare module 'fs' {
* Asynchronously creates a directory.
*
* The callback is given a possible exception and, if `recursive` is `true`, the
* first directory path created, `(err, [path])`.`path` can still be `undefined` when `recursive` is `true`, if no directory was
* first directory path created, `(err[, path])`.`path` can still be `undefined` when `recursive` is `true`, if no directory was
* created.
*
* The optional `options` argument can be an integer specifying `mode` (permission
@ -1949,7 +1963,7 @@ declare module 'fs' {
*
* Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented
* by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains
* a colon, Node.js will open a file system stream, as described by[this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams).
* a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams).
*
* Functions based on `fs.open()` exhibit this behavior as well:`fs.writeFile()`, `fs.readFile()`, etc.
* @since v0.0.2
@ -2202,9 +2216,9 @@ declare module 'fs' {
* If this method is invoked as its `util.promisify()` ed version, it returns
* a promise for an `Object` with `bytesRead` and `buffer` properties.
* @since v0.0.2
* @param [buffer=Buffer.alloc(16384)] The buffer that the data will be written to.
* @param [offset=0] The position in `buffer` to write the data to.
* @param [length=buffer.byteLength] The number of bytes to read.
* @param buffer The buffer that the data will be written to.
* @param offset The position in `buffer` to write the data to.
* @param length The number of bytes to read.
* @param position Specifies where to begin reading from in the file. If `position` is `null` or `-1 `, data will be read from the current file position, and the file position will be updated. If
* `position` is an integer, the file position will be unchanged.
*/
@ -2510,6 +2524,8 @@ declare module 'fs' {
*
* The `encoding` option is ignored if `data` is a buffer.
*
* The `mode` option only affects the newly created file. See {@link open} for more details.
*
* If `data` is a plain object, it must have an own (not inherited) `toString`function property.
*
* ```js
@ -2590,6 +2606,8 @@ declare module 'fs' {
*
* If `data` is a plain object, it must have an own (not inherited) `toString`function property.
*
* The `mode` option only affects the newly created file. See {@link open} for more details.
*
* For detailed information, see the documentation of the asynchronous version of
* this API: {@link writeFile}.
* @since v0.1.29
@ -2600,6 +2618,8 @@ declare module 'fs' {
* Asynchronously append data to a file, creating the file if it does not yet
* exist. `data` can be a string or a `Buffer`.
*
* The `mode` option only affects the newly created file. See {@link open} for more details.
*
* ```js
* import { appendFile } from 'fs';
*
@ -2674,6 +2694,8 @@ declare module 'fs' {
* Synchronously append data to a file, creating the file if it does not yet
* exist. `data` can be a string or a `Buffer`.
*
* The `mode` option only affects the newly created file. See {@link open} for more details.
*
* ```js
* import { appendFileSync } from 'fs';
*
@ -2741,7 +2763,7 @@ declare module 'fs' {
* the numeric values in these objects are specified as `BigInt`s.
*
* To be notified when the file was modified, not just accessed, it is necessary
* to compare `curr.mtime` and `prev.mtime`.
* to compare `curr.mtimeMs` and `prev.mtimeMs`.
*
* When an `fs.watchFile` operation results in an `ENOENT` error, it
* will invoke the listener once, with all the fields zeroed (or, for dates, the
@ -2979,6 +3001,7 @@ declare module 'fs' {
* @deprecated Since v1.0.0 - Use {@link stat} or {@link access} instead.
*/
export function exists(path: PathLike, callback: (exists: boolean) => void): void;
/** @deprecated */
export namespace exists {
/**
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
@ -3339,7 +3362,7 @@ declare module 'fs' {
end?: number | undefined;
}
/**
* Unlike the 16 kb default `highWaterMark` for a readable stream, the stream
* Unlike the 16 kb default `highWaterMark` for a `stream.Readable`, the stream
* returned by this method has a default `highWaterMark` of 64 kb.
*
* `options` can include `start` and `end` values to read a range of bytes from
@ -3359,10 +3382,11 @@ declare module 'fs' {
* closing naturally.
*
* By default, the stream will emit a `'close'` event after it has been
* destroyed, like most `Readable` streams. Set the `emitClose` option to`false` to change this behavior.
* destroyed. Set the `emitClose` option to `false` to change this behavior.
*
* By providing the `fs` option, it is possible to override the corresponding `fs`implementations for `open`, `read`, and `close`. When providing the `fs` option,
* overrides for `open`, `read`, and `close` are required.
* an override for `read` is required. If no `fd` is provided, an override for`open` is also required. If `autoClose` is `true`, an override for `close` is
* also required.
*
* ```js
* import { createReadStream } from 'fs';
@ -3400,7 +3424,6 @@ declare module 'fs' {
*
* If `options` is a string, then it specifies the encoding.
* @since v0.1.31
* @return See `Readable Stream`.
*/
export function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream;
/**
@ -3416,11 +3439,12 @@ declare module 'fs' {
* file descriptor leak.
*
* By default, the stream will emit a `'close'` event after it has been
* destroyed, like most `Writable` streams. Set the `emitClose` option to`false` to change this behavior.
* destroyed. Set the `emitClose` option to `false` to change this behavior.
*
* By providing the `fs` option it is possible to override the corresponding `fs`implementations for `open`, `write`, `writev` and `close`. Overriding `write()`without `writev()` can reduce
* performance as some optimizations (`_writev()`)
* will be disabled. When providing the `fs` option, overrides for `open`,`close`, and at least one of `write` and `writev` are required.
* will be disabled. When providing the `fs` option, overrides for at least one of`write` and `writev` are required. If no `fd` option is supplied, an override
* for `open` is also required. If `autoClose` is `true`, an override for `close`is also required.
*
* Like `fs.ReadStream`, if `fd` is specified, `fs.WriteStream` will ignore the`path` argument and will use the specified file descriptor. This means that no`'open'` event will be
* emitted. `fd` should be blocking; non-blocking `fd`s
@ -3428,12 +3452,11 @@ declare module 'fs' {
*
* If `options` is a string, then it specifies the encoding.
* @since v0.1.31
* @return See `Writable Stream`.
*/
export function createWriteStream(path: PathLike, options?: BufferEncoding | StreamOptions): WriteStream;
/**
* Forces all currently queued I/O operations associated with the file to the
* operating system's synchronized I/O completion state. Refer to the POSIX[`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. No arguments other
* operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. No arguments other
* than a possible
* exception are given to the completion callback.
* @since v0.1.96
@ -3448,7 +3471,7 @@ declare module 'fs' {
}
/**
* Forces all currently queued I/O operations associated with the file to the
* operating system's synchronized I/O completion state. Refer to the POSIX[`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. Returns `undefined`.
* operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. Returns `undefined`.
* @since v0.1.96
*/
export function fdatasyncSync(fd: number): void;
@ -3626,7 +3649,7 @@ declare module 'fs' {
* directory and subsequent read operations.
* @since v12.12.0
*/
export function opendirSync(path: string, options?: OpenDirOptions): Dir;
export function opendirSync(path: PathLike, options?: OpenDirOptions): Dir;
/**
* Asynchronously open a directory. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for
* more details.
@ -3638,10 +3661,10 @@ declare module 'fs' {
* directory and subsequent read operations.
* @since v12.12.0
*/
export function opendir(path: string, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
export function opendir(path: string, options: OpenDirOptions, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
export function opendir(path: PathLike, options: OpenDirOptions, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
export namespace opendir {
function __promisify__(path: string, options?: OpenDirOptions): Promise<Dir>;
function __promisify__(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
}
export interface BigIntStats extends StatsBase<bigint> {
atimeNs: bigint;
@ -3654,6 +3677,8 @@ declare module 'fs' {
}
export interface StatOptions {
bigint?: boolean | undefined;
}
export interface StatSyncOptions extends StatOptions {
throwIfNoEntry?: boolean | undefined;
}
export interface CopyOptions {

View File

@ -31,6 +31,8 @@ declare module 'fs/promises' {
WatchOptions,
WatchEventType,
CopyOptions,
ReadStream,
WriteStream,
} from 'node:fs';
interface FileChangeInfo<T extends string | Buffer> {
eventType: WatchEventType;
@ -59,6 +61,20 @@ declare module 'fs/promises' {
length?: number | null;
position?: number | null;
}
interface CreateReadStreamOptions {
encoding?: BufferEncoding | null | undefined;
autoClose?: boolean | undefined;
emitClose?: boolean | undefined;
start?: number | undefined;
end?: number | undefined;
highWaterMark?: number | undefined;
}
interface CreateWriteStreamOptions {
encoding?: BufferEncoding | null | undefined;
autoClose?: boolean | undefined;
emitClose?: boolean | undefined;
start?: number | undefined;
}
// TODO: Add `EventEmitter` close
interface FileHandle {
/**
@ -90,9 +106,80 @@ declare module 'fs/promises' {
* @return Fulfills with `undefined` upon success.
*/
chmod(mode: Mode): Promise<void>;
/**
* Unlike the 16 kb default `highWaterMark` for a `stream.Readable`, the stream
* returned by this method has a default `highWaterMark` of 64 kb.
*
* `options` can include `start` and `end` values to read a range of bytes from
* the file instead of the entire file. Both `start` and `end` are inclusive and
* start counting at 0, allowed values are in the
* \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `start` is
* omitted or `undefined`, `filehandle.createReadStream()` reads sequentially from
* the current file position. The `encoding` can be any one of those accepted by `Buffer`.
*
* If the `FileHandle` points to a character device that only supports blocking
* reads (such as keyboard or sound card), read operations do not finish until data
* is available. This can prevent the process from exiting and the stream from
* closing naturally.
*
* By default, the stream will emit a `'close'` event after it has been
* destroyed. Set the `emitClose` option to `false` to change this behavior.
*
* ```js
* import { open } from 'fs/promises';
*
* const fd = await open('/dev/input/event0');
* // Create a stream from some character device.
* const stream = fd.createReadStream();
* setTimeout(() => {
* stream.close(); // This may not close the stream.
* // Artificially marking end-of-stream, as if the underlying resource had
* // indicated end-of-file by itself, allows the stream to close.
* // This does not cancel pending read operations, and if there is such an
* // operation, the process may still not be able to exit successfully
* // until it finishes.
* stream.push(null);
* stream.read(0);
* }, 100);
* ```
*
* If `autoClose` is false, then the file descriptor won't be closed, even if
* there's an error. It is the application's responsibility to close it and make
* sure there's no file descriptor leak. If `autoClose` is set to true (default
* behavior), on `'error'` or `'end'` the file descriptor will be closed
* automatically.
*
* An example to read the last 10 bytes of a file which is 100 bytes long:
*
* ```js
* import { open } from 'fs/promises';
*
* const fd = await open('sample.txt');
* fd.createReadStream({ start: 90, end: 99 });
* ```
* @since v16.11.0
*/
createReadStream(options?: CreateReadStreamOptions): ReadStream;
/**
* `options` may also include a `start` option to allow writing data at some
* position past the beginning of the file, allowed values are in the
* \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than replacing
* it may require the `flags` `open` option to be set to `r+` rather than the
* default `r`. The `encoding` can be any one of those accepted by `Buffer`.
*
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,
* then the file descriptor won't be closed, even if there's an error.
* It is the application's responsibility to close it and make sure there's no
* file descriptor leak.
*
* By default, the stream will emit a `'close'` event after it has been
* destroyed. Set the `emitClose` option to `false` to change this behavior.
* @since v16.11.0
*/
createWriteStream(options?: CreateWriteStreamOptions): WriteStream;
/**
* Forces all currently queued I/O operations associated with the file to the
* operating system's synchronized I/O completion state. Refer to the POSIX[`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details.
* operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details.
*
* Unlike `filehandle.sync` this method does not flush modified metadata.
* @since v10.0.0
@ -114,8 +201,8 @@ declare module 'fs/promises' {
* number of bytes read is zero.
* @since v10.0.0
* @param buffer A buffer that will be filled with the file data read.
* @param [offset=0] The location in the buffer at which to start filling.
* @param [length=buffer.byteLength] The number of bytes to read.
* @param offset The location in the buffer at which to start filling.
* @param length The number of bytes to read.
* @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an
* integer, the current file position will remain unchanged.
* @return Fulfills upon success with an object with two properties:
@ -220,7 +307,10 @@ declare module 'fs/promises' {
*/
utimes(atime: string | number | Date, mtime: string | number | Date): Promise<void>;
/**
* Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, or an object with an own `toString` function
* Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface) or
* [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object, or an
* object with an own `toString` function
* property. The promise is resolved with no arguments upon success.
*
* If `options` is a string, then it specifies the `encoding`.
@ -274,7 +364,7 @@ declare module 'fs/promises' {
buffer: string;
}>;
/**
* Write an array of [&lt;ArrayBufferView&gt;](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView)s to the file.
* Write an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s to the file.
*
* The promise is resolved with an object containing a two properties:
*
@ -290,7 +380,7 @@ declare module 'fs/promises' {
*/
writev(buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<WriteVResult>;
/**
* Read from a file and write to an array of [&lt;ArrayBufferView&gt;](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView)s
* Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s
* @since v13.13.0, v12.17.0
* @param position The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position.
* @return Fulfills upon success an object containing two properties:
@ -324,7 +414,7 @@ declare module 'fs/promises' {
*
* If the accessibility check is successful, the promise is resolved with no
* value. If any of the accessibility checks fail, the promise is rejected
* with an [&lt;Error&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object. The following example checks if the file`/etc/passwd` can be read and
* with an [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object. The following example checks if the file`/etc/passwd` can be read and
* written by the current process.
*
* ```js
@ -391,7 +481,7 @@ declare module 'fs/promises' {
*
* Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented
* by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains
* a colon, Node.js will open a file system stream, as described by[this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams).
* a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams).
* @since v10.0.0
* @param [flags='r'] See `support of file system `flags``.
* @param [mode=0o666] Sets the file mode (permission and sticky bits) if the file is created.
@ -539,7 +629,7 @@ declare module 'fs/promises' {
}
): Promise<Dirent[]>;
/**
* Reads the contents of the symbolic link referred to by `path`. See the POSIX[`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is
* Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is
* resolved with the`linkString` upon success.
*
* The optional `options` argument can be a string specifying an encoding, or an
@ -611,7 +701,7 @@ declare module 'fs/promises' {
): Promise<BigIntStats>;
function stat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
/**
* Creates a new link from the `existingPath` to the `newPath`. See the POSIX[`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail.
* Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail.
* @since v10.0.0
* @return Fulfills with `undefined` upon success.
*/
@ -619,7 +709,7 @@ declare module 'fs/promises' {
/**
* If `path` refers to a symbolic link, then the link is removed without affecting
* the file or directory to which that link refers. If the `path` refers to a file
* path that is not a symbolic link, the file is deleted. See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html)documentation for more detail.
* path that is not a symbolic link, the file is deleted. See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more detail.
* @since v10.0.0
* @return Fulfills with `undefined` upon success.
*/
@ -746,6 +836,8 @@ declare module 'fs/promises' {
*
* If `options` is a string, then it specifies the encoding.
*
* The `mode` option only affects the newly created file. See `fs.open()` for more details.
*
* Any specified `FileHandle` has to support writing.
*
* It is unsafe to use `fsPromises.writeFile()` multiple times on the same file
@ -802,6 +894,8 @@ declare module 'fs/promises' {
*
* If `options` is a string, then it specifies the `encoding`.
*
* The `mode` option only affects the newly created file. See `fs.open()` for more details.
*
* The `path` may be specified as a `FileHandle` that has been opened
* for appending (using `fsPromises.open()`).
* @since v10.0.0
@ -894,7 +988,7 @@ declare module 'fs/promises' {
| null
): Promise<string | Buffer>;
/**
* Asynchronously open a directory for iterative scanning. See the POSIX[`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail.
* Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail.
*
* Creates an `fs.Dir`, which contains all further functions for reading from
* and cleaning up the directory.
@ -921,7 +1015,7 @@ declare module 'fs/promises' {
* @since v12.12.0
* @return Fulfills with an {fs.Dir}.
*/
function opendir(path: string, options?: OpenDirOptions): Promise<Dir>;
function opendir(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
/**
* Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
*

View File

@ -185,7 +185,6 @@ declare namespace NodeJS {
code?: string | undefined;
path?: string | undefined;
syscall?: string | undefined;
stack?: string | undefined;
}
interface ReadableStream extends EventEmitter {

21
node_modules/@types/node/http.d.ts generated vendored
View File

@ -37,12 +37,12 @@
* 'Host', 'mysite.com',
* 'accepT', '*' ]
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/http.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/http.js)
*/
declare module 'http' {
import * as stream from 'node:stream';
import { URL } from 'node:url';
import { Socket, Server as NetServer } from 'node:net';
import { Socket, Server as NetServer, LookupFunction } from 'node:net';
// incoming headers will never contain number
interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
accept?: string | undefined;
@ -136,6 +136,7 @@ declare module 'http' {
setHost?: boolean | undefined;
// https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278
createConnection?: ((options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket) | undefined;
lookup?: LookupFunction | undefined;
}
interface ServerOptions {
IncomingMessage?: typeof IncomingMessage | undefined;
@ -183,6 +184,18 @@ declare module 'http' {
* @since v0.7.0
*/
maxHeadersCount: number | null;
/**
* The maximum number of requests socket can handle
* before closing keep alive connection.
*
* A value of `0` will disable the limit.
*
* When the limit is reached it will set the `Connection` header value to `close`,
* but will not actually close the connection, subsequent requests sent
* after the limit is reached will get `503 Service Unavailable` as a response.
* @since v16.10.0
*/
maxRequestsPerSocket: number | null;
/**
* The number of milliseconds of inactivity before a socket is presumed
* to have timed out.
@ -341,11 +354,9 @@ declare module 'http' {
readonly socket: Socket | null;
constructor();
/**
* occurs, Same as binding to the `timeout` event.
*
* Once a socket is associated with the message and is connected,`socket.setTimeout()` will be called with `msecs` as the first parameter.
* @since v0.9.12
* @param callback Optional function to be called when a timeout
* @param callback Optional function to be called when a timeout occurs. Same as binding to the `timeout` event.
*/
setTimeout(msecs: number, callback?: () => void): this;
/**

View File

@ -6,7 +6,7 @@
* const http2 = require('http2');
* ```
* @since v8.4.0
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/http2.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/http2.js)
*/
declare module 'http2' {
import EventEmitter = require('node:events');
@ -1714,7 +1714,7 @@ declare module 'http2' {
writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this;
/**
* Call {@link tream.pushStream} with the given headers, and wrap the
* Call `http2stream.pushStream()` with the given headers, and wrap the
* given `Http2Stream` on a newly created `Http2ServerResponse` as the callback
* parameter if successful. When `Http2ServerRequest` is closed, the callback is
* called with an error `ERR_HTTP2_INVALID_STREAM`.
@ -2014,7 +2014,7 @@ declare module 'http2' {
/**
* Returns a `net.Server` instance that creates and manages `Http2Session`instances.
*
* Since there are no browsers known that support[unencrypted HTTP/2](https://http2.github.io/faq/#does-http2-require-encryption), the use of {@link createSecureServer} is necessary when
* Since there are no browsers known that support [unencrypted HTTP/2](https://http2.github.io/faq/#does-http2-require-encryption), the use of {@link createSecureServer} is necessary when
* communicating
* with browser clients.
*

View File

@ -1,7 +1,7 @@
/**
* HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
* separate module.
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/https.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/https.js)
*/
declare module 'https' {
import { Duplex } from 'node:stream';

View File

@ -1,5 +1,5 @@
// Type definitions for non-npm package Node.js 16.7
// Project: http://nodejs.org/
// Type definitions for non-npm package Node.js 16.11
// Project: https://nodejs.org/
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
// DefinitelyTyped <https://github.com/DefinitelyTyped>
// Alberto Schiabel <https://github.com/jkomyno>
@ -11,7 +11,6 @@
// Deividas Bakanas <https://github.com/DeividasBakanas>
// Eugene Y. Q. Shen <https://github.com/eyqs>
// Hannes Magnusson <https://github.com/Hannes-Magnusson-CK>
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Huw <https://github.com/hoo29>
// Kelvin Jin <https://github.com/kjin>
// Klaus Meinhardt <https://github.com/ajafff>
@ -31,18 +30,17 @@
// Thanik Bhongbhibhat <https://github.com/bhongy>
// Marcin Kopacz <https://github.com/chyzwar>
// Trivikram Kamat <https://github.com/trivikr>
// Minh Son Nguyen <https://github.com/nguymin4>
// Junxiao Shi <https://github.com/yoursunny>
// Ilia Baryshnikov <https://github.com/qwelias>
// ExE Boss <https://github.com/ExE-Boss>
// Surasak Chaisurin <https://github.com/Ryan-Willpower>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Anna Henningsen <https://github.com/addaleax>
// Jason Kwok <https://github.com/JasonHK>
// 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>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
@ -113,6 +111,7 @@
/// <reference path="repl.d.ts" />
/// <reference path="stream.d.ts" />
/// <reference path="stream/promises.d.ts" />
/// <reference path="stream/consumers.d.ts" />
/// <reference path="stream/web.d.ts" />
/// <reference path="string_decoder.d.ts" />
/// <reference path="timers.d.ts" />

View File

@ -15,7 +15,7 @@
* ```js
* const inspector = require('inspector');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/inspector.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/inspector.js)
*/
declare module 'inspector' {
import EventEmitter = require('node:events');
@ -1778,6 +1778,13 @@ declare module 'inspector' {
* @since v8.0.0
*/
connect(): void;
/**
* Connects a session to the main thread inspector back-end.
* An exception will be thrown if this API was not called on a Worker
* thread.
* @since 12.11.0
*/
connectToMainThread(): void;
/**
* Immediately close the session. All pending message callbacks will be called
* with an error. `session.connect()` will need to be called to be able to send
@ -1797,7 +1804,7 @@ declare module 'inspector' {
* // Output: { type: 'number', value: 4, description: '4' }
* ```
*
* The latest version of the V8 inspector protocol is published on the[Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/v8/).
* The latest version of the V8 inspector protocol is published on the [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/v8/).
*
* Node.js inspector supports all the Chrome DevTools Protocol domains declared
* by V8\. Chrome DevTools Protocol domain provides an interface for interacting

6
node_modules/@types/node/net.d.ts generated vendored
View File

@ -10,7 +10,7 @@
* ```js
* const net = require('net');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/net.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/net.js)
*/
declare module 'net' {
import * as stream from 'node:stream';
@ -255,12 +255,12 @@ declare module 'net' {
* connects on `'192.168.1.1'`, the value of `socket.localAddress` would be`'192.168.1.1'`.
* @since v0.9.6
*/
readonly localAddress: string;
readonly localAddress?: string;
/**
* The numeric representation of the local port. For example, `80` or `21`.
* @since v0.9.6
*/
readonly localPort: number;
readonly localPort?: number;
/**
* The string representation of the remote IP address. For example,`'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if
* the socket is destroyed (for example, if the client disconnected).

10
node_modules/@types/node/os.d.ts generated vendored
View File

@ -5,7 +5,7 @@
* ```js
* const os = require('os');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/os.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/os.js)
*/
declare module 'os' {
interface CpuInfo {
@ -143,8 +143,8 @@ declare module 'os' {
/**
* Returns the operating system as a string.
*
* On POSIX systems, the operating system release is determined by calling[`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `GetVersionExW()` is used.
* See[https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
* On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `GetVersionExW()` is used. See
* [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
* @since v0.3.3
*/
function release(): string;
@ -396,8 +396,8 @@ declare module 'os' {
/**
* Returns a string identifying the kernel version.
*
* On POSIX systems, the operating system release is determined by calling[`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not
* available, `GetVersionExW()` will be used. See[https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
* On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not
* available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
* @since v13.11.0, v12.17.0
*/
function version(): string;

View File

@ -1,6 +1,6 @@
{
"name": "@types/node",
"version": "16.7.2",
"version": "16.11.7",
"description": "TypeScript definitions for Node.js",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
"license": "MIT",
@ -60,11 +60,6 @@
"url": "https://github.com/Hannes-Magnusson-CK",
"githubUsername": "Hannes-Magnusson-CK"
},
{
"name": "Hoàng Văn Khải",
"url": "https://github.com/KSXGitHub",
"githubUsername": "KSXGitHub"
},
{
"name": "Huw",
"url": "https://github.com/hoo29",
@ -160,11 +155,6 @@
"url": "https://github.com/trivikr",
"githubUsername": "trivikr"
},
{
"name": "Minh Son Nguyen",
"url": "https://github.com/nguymin4",
"githubUsername": "nguymin4"
},
{
"name": "Junxiao Shi",
"url": "https://github.com/yoursunny",
@ -195,11 +185,6 @@
"url": "https://github.com/addaleax",
"githubUsername": "addaleax"
},
{
"name": "Jason Kwok",
"url": "https://github.com/JasonHK",
"githubUsername": "JasonHK"
},
{
"name": "Victor Perin",
"url": "https://github.com/victorperin",
@ -219,6 +204,11 @@
"name": "Linus Unnebäck",
"url": "https://github.com/LinusU",
"githubUsername": "LinusU"
},
{
"name": "wafuwafu13",
"url": "https://github.com/wafuwafu13",
"githubUsername": "wafuwafu13"
}
],
"main": "",
@ -230,6 +220,6 @@
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "e69ff975ff05f7fa6ee5e27b53994fc27f754f5397951611c387e09a08af0ce1",
"typesPublisherContentHash": "f35526242fcaf9fa8ad50a3aadb0bb8c2e9aba5a332ca0523451167ec6a19f2e",
"typeScriptVersion": "3.7"
}

2
node_modules/@types/node/path.d.ts generated vendored
View File

@ -13,7 +13,7 @@ declare module 'path/win32' {
* ```js
* const path = require('path');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/path.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/path.js)
*/
declare module 'path' {
namespace path {

View File

@ -1,5 +1,5 @@
/**
* This module provides an implementation of a subset of the W3C[Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for
* This module provides an implementation of a subset of the W3C [Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for
* Node.js-specific performance measurements.
*
* Node.js supports the following [Web Performance APIs](https://w3c.github.io/perf-timing-primer/):
@ -26,7 +26,7 @@
* performance.measure('A to B', 'A', 'B');
* });
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/perf_hooks.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/perf_hooks.js)
*/
declare module 'perf_hooks' {
import { AsyncResource } from 'node:async_hooks';
@ -84,7 +84,7 @@ declare module 'perf_hooks' {
* Additional detail specific to the `entryType`.
* @since v16.0.0
*/
readonly details?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type.
readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type.
}
/**
* _This property is an extension by Node.js. It is not available in Web browsers._

View File

@ -639,7 +639,7 @@ declare module 'process' {
*/
getgid(): number;
/**
* The `process.setgid()` method sets the group identity of the process. (See[`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a
* The `process.setgid()` method sets the group identity of the process. (See [`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a
* numeric ID or a group name
* string. If a group name is specified, this method blocks while resolving the
* associated numeric ID.
@ -683,7 +683,7 @@ declare module 'process' {
*/
getuid(): number;
/**
* The `process.setuid(id)` method sets the user identity of the process. (See[`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a
* The `process.setuid(id)` method sets the user identity of the process. (See [`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a
* numeric ID or a username string.
* If a username is specified, the method blocks while resolving the associated
* numeric ID.
@ -1067,7 +1067,7 @@ declare module 'process' {
* ```
*
* The value `'android'` may also be returned if the Node.js is built on the
* Android operating system. However, Android support in Node.js[is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os).
* Android operating system. However, Android support in Node.js [is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os).
* @since v0.1.16
*/
readonly platform: Platform;

View File

@ -24,7 +24,7 @@
* made available to developers as a convenience. Fixes or other modifications to
* the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.
* @deprecated Since v7.0.0 - Deprecated
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/punycode.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/punycode.js)
*/
declare module 'punycode' {
/**
@ -39,7 +39,7 @@ declare module 'punycode' {
*/
function decode(string: string): string;
/**
* The `punycode.encode()` method converts a string of Unicode codepoints to a[Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only characters.
* The `punycode.encode()` method converts a string of Unicode codepoints to a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only characters.
*
* ```js
* punycode.encode('mañana'); // 'maana-pta'
@ -50,7 +50,7 @@ declare module 'punycode' {
function encode(string: string): string;
/**
* The `punycode.toUnicode()` method converts a string representing a domain name
* containing [Punycode](https://tools.ietf.org/html/rfc3492) encoded characters into Unicode. Only the [Punycode](https://tools.ietf.org/html/rfc3492)encoded parts of the domain name are be
* containing [Punycode](https://tools.ietf.org/html/rfc3492) encoded characters into Unicode. Only the [Punycode](https://tools.ietf.org/html/rfc3492) encoded parts of the domain name are be
* converted.
*
* ```js

View File

@ -9,7 +9,7 @@
* The `querystring` API is considered Legacy. While it is still maintained,
* new code should use the `URLSearchParams` API instead.
* @deprecated Legacy
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/querystring.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/querystring.js)
*/
declare module 'querystring' {
interface StringifyOptions {
@ -25,14 +25,14 @@ declare module 'querystring' {
* The `querystring.stringify()` method produces a URL query string from a
* given `obj` by iterating through the object's "own properties".
*
* It serializes the following types of values passed in `obj`:[&lt;string&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
* [&lt;number&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
* [&lt;bigint&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
* [&lt;boolean&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
* [&lt;string\[\]&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
* [&lt;number\[\]&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
* [&lt;bigint\[\]&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
* [&lt;boolean\[\]&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)The numeric values must be finite. Any other input values will be coerced to
* It serializes the following types of values passed in `obj`:[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
* [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
* [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
* [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
* [string\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
* [number\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
* [bigint\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
* [boolean\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) The numeric values must be finite. Any other input values will be coerced to
* empty strings.
*
* ```js

View File

@ -26,7 +26,7 @@
*
* Once this code is invoked, the Node.js application will not terminate until the`readline.Interface` is closed because the interface waits for data to be
* received on the `input` stream.
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/readline.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/readline.js)
*/
declare module 'readline' {
import { Abortable, EventEmitter } from 'node:events';
@ -236,6 +236,7 @@ declare module 'readline' {
* @since v0.1.98
*/
write(data: string | Buffer, key?: Key): void;
write(data: undefined | null | string | Buffer, key: Key): void;
/**
* Returns the real position of the cursor in relation to the input
* prompt + string. Long input (wrapping) strings, as well as multiple

2
node_modules/@types/node/repl.d.ts generated vendored
View File

@ -6,7 +6,7 @@
* ```js
* const repl = require('repl');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/repl.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/repl.js)
*/
declare module 'repl' {
import { Interface, Completer, AsyncCompleter } from 'node:readline';

85
node_modules/@types/node/stream.d.ts generated vendored
View File

@ -14,11 +14,12 @@
*
* The `stream` module is useful for creating new types of stream instances. It is
* usually not necessary to use the `stream` module to consume streams.
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/stream.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/stream.js)
*/
declare module 'stream' {
import { EventEmitter, Abortable } from 'node:events';
import * as streamPromises from 'node:stream/promises';
import * as streamConsumers from 'node:stream/consumers';
class internal extends EventEmitter {
pipe<T extends NodeJS.WritableStream>(
destination: T,
@ -51,12 +52,29 @@ declare module 'stream' {
* A utility method for creating Readable Streams out of iterators.
*/
static from(iterable: Iterable<any> | AsyncIterable<any>, options?: ReadableOptions): Readable;
/**
* Returns whether the stream has been read from or cancelled.
* @since v16.8.0
*/
static isDisturbed(stream: Readable | NodeJS.ReadableStream): boolean;
/**
* Returns whether the stream was destroyed or errored before emitting `'end'`.
* @since v16.8.0
* @experimental
*/
readonly readableAborted: boolean;
/**
* Is `true` if it is safe to call `readable.read()`, which means
* the stream has not been destroyed or emitted `'error'` or `'end'`.
* @since v11.4.0
*/
readable: boolean;
/**
* Returns whether `'data'` has been emitted.
* @since v16.7.0
* @experimental
*/
readonly readableDidRead: boolean;
/**
* Getter for the property `encoding` of a given `Readable` stream. The `encoding`property can be set using the `readable.setEncoding()` method.
* @since v12.7.0
@ -789,7 +807,39 @@ declare module 'stream' {
readonly writableLength: number;
readonly writableObjectMode: boolean;
readonly writableCorked: number;
/**
* If `false` then the stream will automatically end the writable side when the
* readable side ends. Set initially by the `allowHalfOpen` constructor option,
* which defaults to `false`.
*
* This can be changed manually to change the half-open behavior of an existing`Duplex` stream instance, but must be changed before the `'end'` event is
* emitted.
* @since v0.9.4
*/
allowHalfOpen: boolean;
constructor(opts?: DuplexOptions);
/**
* A utility method for creating duplex streams.
*
* - `Stream` converts writable stream into writable `Duplex` and readable stream
* to `Duplex`.
* - `Blob` converts into readable `Duplex`.
* - `string` converts into readable `Duplex`.
* - `ArrayBuffer` converts into readable `Duplex`.
* - `AsyncIterable` converts into a readable `Duplex`. Cannot yield `null`.
* - `AsyncGeneratorFunction` converts into a readable/writable transform
* `Duplex`. Must take a source `AsyncIterable` as first parameter. Cannot yield
* `null`.
* - `AsyncFunction` converts into a writable `Duplex`. Must return
* either `null` or `undefined`
* - `Object ({ writable, readable })` converts `readable` and
* `writable` into `Stream` and then combines them into `Duplex` where the
* `Duplex` will write to the `writable` and read from the `readable`.
* - `Promise` converts into readable `Duplex`. Value `null` is ignored.
*
* @since v16.8.0
*/
static from(src: Stream | Blob | ArrayBuffer | string | Iterable<any> | AsyncIterable<any> | AsyncGeneratorFunction | Promise<any> | Object): Duplex;
_write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
_writev?(
chunks: Array<{
@ -1033,16 +1083,14 @@ declare module 'stream' {
*
* async function run() {
* const ac = new AbortController();
* const options = {
* signal: ac.signal,
* };
* const signal = ac.signal;
*
* setTimeout(() => ac.abort(), 1);
* await pipeline(
* fs.createReadStream('archive.tar'),
* zlib.createGzip(),
* fs.createWriteStream('archive.tar.gz'),
* options,
* { signal },
* );
* }
*
@ -1058,10 +1106,10 @@ declare module 'stream' {
* async function run() {
* await pipeline(
* fs.createReadStream('lowercase.txt'),
* async function* (source) {
* async function* (source, signal) {
* source.setEncoding('utf8'); // Work with strings rather than `Buffer`s.
* for await (const chunk of source) {
* yield chunk.toUpperCase();
* yield await processChunk(chunk, { signal });
* }
* },
* fs.createWriteStream('uppercase.txt')
@ -1072,6 +1120,28 @@ declare module 'stream' {
* run().catch(console.error);
* ```
*
* Remember to handle the `signal` argument passed into the async generator.
* Especially in the case where the async generator is the source for the
* pipeline (i.e. first argument) or the pipeline will never complete.
*
* ```js
* const { pipeline } = require('stream/promises');
* const fs = require('fs');
*
* async function run() {
* await pipeline(
* async function * (signal) {
* await someLongRunningfn({ signal });
* yield 'asd';
* },
* fs.createWriteStream('uppercase.txt')
* );
* console.log('Pipeline succeeded.');
* }
*
* run().catch(console.error);
* ```
*
* `stream.pipeline()` will call `stream.destroy(err)` on all streams except:
*
* * `Readable` streams which have emitted `'end'` or `'close'`.
@ -1169,6 +1239,7 @@ declare module 'stream' {
unref(): void;
}
const promises: typeof streamPromises;
const consumers: typeof streamConsumers;
}
export = internal;
}

24
node_modules/@types/node/stream/consumers.d.ts generated vendored Executable file
View File

@ -0,0 +1,24 @@
// Duplicates of interface in lib.dom.ts.
// Duplicated here rather than referencing lib.dom.ts because doing so causes lib.dom.ts to be loaded for "test-all"
// Which in turn causes tests to pass that shouldn't pass.
//
// This interface is not, and should not be, exported.
interface Blob {
readonly size: number;
readonly type: string;
arrayBuffer(): Promise<ArrayBuffer>;
slice(start?: number, end?: number, contentType?: string): Blob;
stream(): NodeJS.ReadableStream;
text(): Promise<string>;
}
declare module 'stream/consumers' {
import { Readable } from 'node:stream';
function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Buffer>;
function text(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<string>;
function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<ArrayBuffer>;
function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Blob>;
function json(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<unknown>;
}
declare module 'node:stream/consumers' {
export * from 'stream/consumers';
}

View File

@ -36,7 +36,7 @@
* decoder.write(Buffer.from([0x82]));
* console.log(decoder.end(Buffer.from([0xAC])));
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/string_decoder.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/string_decoder.js)
*/
declare module 'string_decoder' {
class StringDecoder {

View File

@ -6,7 +6,7 @@
* The timer functions within Node.js implement a similar API as the timers API
* provided by Web Browsers but use a different internal implementation that is
* built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/timers.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/timers.js)
*/
declare module 'timers' {
import { Abortable } from 'node:events';

17
node_modules/@types/node/tls.d.ts generated vendored
View File

@ -6,7 +6,7 @@
* ```js
* const tls = require('tls');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/tls.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/tls.js)
*/
declare module 'tls' {
import { X509Certificate } from 'node:crypto';
@ -160,9 +160,10 @@ declare module 'tls' {
encrypted: boolean;
/**
* String containing the selected ALPN protocol.
* When ALPN has no selected protocol, tlsSocket.alpnProtocol equals false.
* Before a handshake has completed, this value is always null.
* When a handshake is completed but not ALPN protocol was selected, tlsSocket.alpnProtocol equals false.
*/
alpnProtocol?: string | undefined;
alpnProtocol: string | false | null;
/**
* Returns an object representing the local certificate. The returned object has
* some properties corresponding to the fields of the certificate.
@ -188,7 +189,7 @@ declare module 'tls' {
* }
* ```
*
* See[SSL\_CIPHER\_get\_name](https://www.openssl.org/docs/man1.1.1/man3/SSL_CIPHER_get_name.html)for more information.
* See [SSL\_CIPHER\_get\_name](https://www.openssl.org/docs/man1.1.1/man3/SSL_CIPHER_get_name.html) for more information.
* @since v0.11.4
*/
getCipher(): CipherNameAndProtocol;
@ -273,7 +274,7 @@ declare module 'tls' {
*/
getSession(): Buffer | undefined;
/**
* See[SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html)for more information.
* See [SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html) for more information.
* @since v12.11.0
* @return List of signature algorithms shared between the server and the client in the order of decreasing preference.
*/
@ -809,8 +810,8 @@ declare module 'tls' {
/**
* Verifies the certificate `cert` is issued to `hostname`.
*
* Returns [&lt;Error&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on
* failure. On success, returns [&lt;undefined&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type).
* Returns [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on
* failure. On success, returns [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type).
*
* This function can be overwritten by providing alternative function as part of
* the `options.checkServerIdentity` option passed to `tls.connect()`. The
@ -961,7 +962,7 @@ declare module 'tls' {
*
* A key is _required_ for ciphers that use certificates. Either `key` or`pfx` can be used to provide it.
*
* If the `ca` option is not given, then Node.js will default to using[Mozilla's publicly trusted list of
* If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of
* CAs](https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt).
* @since v0.11.13
*/

View File

@ -56,7 +56,7 @@
* ```
*
* Running Node.js with tracing enabled will produce log files that can be opened
* in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)tab of Chrome.
* in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome.
*
* The logging file is by default called `node_trace.${rotation}.log`, where`${rotation}` is an incrementing log-rotation id. The filepath pattern can
* be specified with `--trace-event-file-pattern` that accepts a template
@ -73,7 +73,7 @@
*
* The features from this module are not available in `Worker` threads.
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/trace_events.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/trace_events.js)
*/
declare module 'trace_events' {
/**

6
node_modules/@types/node/tty.d.ts generated vendored
View File

@ -22,7 +22,7 @@
*
* In most cases, there should be little to no reason for an application to
* manually create instances of the `tty.ReadStream` and `tty.WriteStream`classes.
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/tty.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/tty.js)
*/
declare module 'tty' {
import * as net from 'node:net';
@ -129,9 +129,7 @@ declare module 'tty' {
* * `1` for 2,
* * `4` for 16,
* * `8` for 256,
* * `24` for 16,777,216
*
* colors supported.
* * `24` for 16,777,216 colors supported.
*
* Use this to determine what colors the terminal supports. Due to the nature of
* colors in terminals it is possible to either have false positives or false

31
node_modules/@types/node/url.d.ts generated vendored
View File

@ -5,7 +5,7 @@
* ```js
* import url from 'url';
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/url.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/url.js)
*/
declare module 'url' {
import { Blob } from 'node:buffer';
@ -71,6 +71,30 @@ declare module 'url' {
function parse(urlString: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery;
function parse(urlString: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;
function parse(urlString: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;
/**
* The URL object has both a `toString()` method and `href` property that return string serializations of the URL.
* These are not, however, customizable in any way. The `url.format(URL[, options])` method allows for basic
* customization of the output.
* Returns a customizable serialization of a URL `String` representation of a `WHATWG URL` object.
*
* ```js
* import url from 'url';
* const myURL = new URL('https://a:b@測試?abc#foo');
*
* console.log(myURL.href);
* // Prints https://a:b@xn--g6w251d/?abc#foo
*
* console.log(myURL.toString());
* // Prints https://a:b@xn--g6w251d/?abc#foo
*
* console.log(url.format(myURL, { fragment: false, unicode: true, auth: false }));
* // Prints 'https://測試/?abc'
* ```
* @since v7.6.0
* @param urlObject A `WHATWG URL` object
* @param options
*/
function format(urlObject: URL, options?: URLFormatOptions): string;
/**
* The `url.format()` method returns a formatted URL string derived from`urlObject`.
*
@ -134,7 +158,6 @@ declare module 'url' {
* @deprecated Legacy: Use the WHATWG URL API instead.
* @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`.
*/
function format(urlObject: URL, options?: URLFormatOptions): string;
function format(urlObject: UrlObject | string): string;
/**
* The `url.resolve()` method resolves a target URL relative to a base URL in a
@ -684,7 +707,7 @@ declare module 'url' {
* @since v7.5.0, v6.13.0
*/
class URLSearchParams implements Iterable<[string, string]> {
constructor(init?: URLSearchParams | string | NodeJS.Dict<string | ReadonlyArray<string>> | Iterable<[string, string]> | ReadonlyArray<[string, string]>);
constructor(init?: URLSearchParams | string | Record<string, string | ReadonlyArray<string>> | Iterable<[string, string]> | ReadonlyArray<[string, string]>);
/**
* Append a new name-value pair to the query string.
*/
@ -697,7 +720,7 @@ declare module 'url' {
* Returns an ES6 `Iterator` over each of the name-value pairs in the query.
* Each item of the iterator is a JavaScript `Array`. The first item of the `Array`is the `name`, the second item of the `Array` is the `value`.
*
* Alias for {@link earchParams[@@iterator]}.
* Alias for `urlSearchParams[@@iterator]()`.
*/
entries(): IterableIterator<[string, string]>;
/**

60
node_modules/@types/node/util.d.ts generated vendored
View File

@ -6,7 +6,7 @@
* ```js
* const util = require('util');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/util.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/util.js)
*/
declare module 'util' {
import * as types from 'node:util/types';
@ -113,6 +113,20 @@ declare module 'util' {
* @since v10.0.0
*/
export function formatWithOptions(inspectOptions: InspectOptions, format?: any, ...param: any[]): string;
/**
* Returns the string name for a numeric error code that comes from a Node.js API.
* The mapping between error codes and error names is platform-dependent.
* See `Common System Errors` for the names of common errors.
*
* ```js
* fs.access('file/that/does/not/exist', (err) => {
* const name = util.getSystemErrorName(err.errno);
* console.error(name); // ENOENT
* });
* ```
* @since v9.7.0
*/
export function getSystemErrorName(err: number): string;
/**
* Returns a Map of all system error codes available from the Node.js API.
* The mapping between error codes and error names is platform-dependent.
@ -141,6 +155,13 @@ declare module 'util' {
* @deprecated Since v6.0.0 - Use a third party module instead.
*/
export function log(string: string): void;
/**
* Returns the `string` after replacing any surrogate code points
* (or equivalently, any unpaired surrogate code units) with the
* Unicode "replacement character" U+FFFD.
* @since v16.8.0
*/
export function toUSVString(string: string): string;
/**
* The `util.inspect()` method returns a string representation of `object` that is
* intended for debugging. The output of `util.inspect` may change at any time
@ -245,7 +266,7 @@ declare module 'util' {
* The `showHidden` option allows [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) and
* [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries to be
* inspected. If there are more entries than `maxArrayLength`, there is no
* guarantee which entries are displayed. That means retrieving the same[`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries twice may
* guarantee which entries are displayed. That means retrieving the same [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries twice may
* result in different output. Furthermore, entries
* with no remaining strong references may be garbage collected at any time.
*
@ -307,6 +328,9 @@ declare module 'util' {
* Allows changing inspect settings from the repl.
*/
let replDefaults: InspectOptions;
/**
* That can be used to declare custom inspect functions.
*/
const custom: unique symbol;
}
/**
@ -513,6 +537,7 @@ declare module 'util' {
* @return The logging function
*/
export function debuglog(section: string, callback?: (fn: DebugLoggerFunction) => void): DebugLogger;
export const debug: typeof debuglog;
/**
* Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`.
*
@ -782,6 +807,16 @@ declare module 'util' {
* @since v9.0.0
*/
export function isDeepStrictEqual(val1: unknown, val2: unknown): boolean;
/**
* Returns `str` with any ANSI escape codes removed.
*
* ```js
* console.log(util.stripVTControlCharacters('\u001B[4mvalue\u001B[0m'));
* // Prints "value"
* ```
* @since v16.11.0
*/
export function stripVTControlCharacters(str: string): string;
/**
* Takes an `async` function (or a function that returns a `Promise`) and returns a
* function following the error-first callback style, i.e. taking
@ -954,10 +989,13 @@ declare module 'util' {
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
export function promisify(fn: Function): Function;
export namespace promisify {
/**
* That can be used to declare custom promisified variants of functions.
*/
const custom: unique symbol;
}
/**
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/)`TextDecoder` API.
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API.
*
* ```js
* const decoder = new TextDecoder('shift_jis');
@ -1019,7 +1057,7 @@ declare module 'util' {
}
export { types };
/**
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/)`TextEncoder` API. All
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All
* instances of `TextEncoder` only support UTF-8 encoding.
*
* ```js
@ -1063,8 +1101,8 @@ declare module 'util/types' {
declare module 'util/types' {
import { KeyObject, webcrypto } from 'node:crypto';
/**
* Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)
* or[`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
* Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) or
* [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
*
* See also `util.types.isArrayBuffer()` and `util.types.isSharedArrayBuffer()`.
*
@ -1099,9 +1137,9 @@ declare module 'util/types' {
*/
function isArrayBuffer(object: unknown): object is ArrayBuffer;
/**
* Returns `true` if the value is an instance of one of the [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)views, such as typed array
* objects or [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView). Equivalent
* to[`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
* Returns `true` if the value is an instance of one of the [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) views, such as typed
* array objects or [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView). Equivalent to
* [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
*
* ```js
* util.types.isArrayBufferView(new Int8Array()); // true
@ -1329,7 +1367,7 @@ declare module 'util/types' {
*/
function isMap<T>(object: T | {}): object is T extends ReadonlyMap<any, any> ? (unknown extends T ? never : ReadonlyMap<any, any>) : Map<unknown, unknown>;
/**
* Returns `true` if the value is an iterator returned for a built-in[`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance.
* Returns `true` if the value is an iterator returned for a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance.
*
* ```js
* const map = new Map();
@ -1415,7 +1453,7 @@ declare module 'util/types' {
*/
function isSet<T>(object: T | {}): object is T extends ReadonlySet<any> ? (unknown extends T ? never : ReadonlySet<any>) : Set<unknown>;
/**
* Returns `true` if the value is an iterator returned for a built-in[`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance.
* Returns `true` if the value is an iterator returned for a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance.
*
* ```js
* const set = new Set();

4
node_modules/@types/node/v8.d.ts generated vendored
View File

@ -1,10 +1,10 @@
/**
* The `v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/)built into the Node.js binary. It can be accessed using:
* The `v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using:
*
* ```js
* const v8 = require('v8');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/v8.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/v8.js)
*/
declare module 'v8' {
import { Readable } from 'node:stream';

9
node_modules/@types/node/vm.d.ts generated vendored
View File

@ -32,7 +32,7 @@
*
* console.log(x); // 1; y is not defined.
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/vm.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/vm.js)
*/
declare module 'vm' {
interface Context extends NodeJS.Dict<any> {}
@ -267,13 +267,16 @@ declare module 'vm' {
* @since v10.6.0
*/
createCachedData(): Buffer;
/** @deprecated in favor of `script.createCachedData()` */
cachedDataProduced?: boolean | undefined;
cachedDataRejected?: boolean | undefined;
cachedData?: Buffer | undefined;
}
/**
* If given a `contextObject`, the `vm.createContext()` method will `prepare
* that object` so that it can be used in calls to {@link runInContext} or `script.runInContext()`. Inside such scripts,
* the `contextObject` will be the global object, retaining all of its existing
* properties but also having the built-in objects and functions any standard[global object](https://es5.github.io/#x15.1) has. Outside of scripts run by the vm module, global variables
* properties but also having the built-in objects and functions any standard [global object](https://es5.github.io/#x15.1) has. Outside of scripts run by the vm module, global variables
* will remain unchanged.
*
* ```js
@ -394,7 +397,7 @@ declare module 'vm' {
* ```
*
* Because `vm.runInThisContext()` does not have access to the local scope,`localVar` is unchanged. In contrast,
* [`eval()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval)_does_ have access to the
* [`eval()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) _does_ have access to the
* local scope, so the value `localVar` is changed. In this way`vm.runInThisContext()` is much like an [indirect `eval()` call](https://es5.github.io/#x10.4.2), e.g.`(0,eval)('code')`.
*
* ## Example: Running an HTTP server within a VM

13
node_modules/@types/node/wasi.d.ts generated vendored
View File

@ -1,9 +1,9 @@
/**
* The WASI API provides an implementation of the [WebAssembly System Interface](https://wasi.dev/)specification. WASI gives sandboxed WebAssembly applications access to the
* The WASI API provides an implementation of the [WebAssembly System Interface](https://wasi.dev/) specification. WASI gives sandboxed WebAssembly applications access to the
* underlying operating system via a collection of POSIX-like functions.
*
* ```js
* import fs from 'fs';
* import { readFile } from 'fs/promises';
* import { WASI } from 'wasi';
* import { argv, env } from 'process';
*
@ -14,9 +14,14 @@
* '/sandbox': '/some/real/path/that/wasm/can/access'
* }
* });
*
* // Some WASI binaries require:
* // const importObject = { wasi_unstable: wasi.wasiImport };
* const importObject = { wasi_snapshot_preview1: wasi.wasiImport };
*
* const wasm = await WebAssembly.compile(fs.readFileSync('./demo.wasm'));
* const wasm = await WebAssembly.compile(
* await readFile(new URL('./demo.wasm', import.meta.url))
* );
* const instance = await WebAssembly.instantiate(wasm, importObject);
*
* wasi.start(instance);
@ -63,7 +68,7 @@
* The `--experimental-wasi-unstable-preview1` CLI argument is needed for this
* example to run.
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/wasi.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/wasi.js)
*/
declare module 'wasi' {
interface WASIOptions {

View File

@ -49,7 +49,7 @@
*
* Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
* specifically `argv` and `execArgv` options.
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/worker_threads.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/worker_threads.js)
*/
declare module 'worker_threads' {
import { Blob } from 'node:buffer';
@ -94,7 +94,7 @@ declare module 'worker_threads' {
* asynchronous, two-way communications channel. It can be used to transfer
* structured data, memory regions and other `MessagePort`s between different `Worker` s.
*
* This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort)s.
* This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
* @since v10.5.0
*/
class MessagePort extends EventEmitter {
@ -572,11 +572,11 @@ declare module 'worker_threads' {
* takes its place.
*
* The returned `MessagePort` is an object in the target context and
* inherits from its global `Object` class. Objects passed to the[`port.onmessage()`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage) listener are also created in the
* inherits from its global `Object` class. Objects passed to the [`port.onmessage()`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage) listener are also created in the
* target context
* and inherit from its global `Object` class.
*
* However, the created `MessagePort` no longer inherits from[`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget), and only
* However, the created `MessagePort` no longer inherits from [`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget), and only
* [`port.onmessage()`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage) can be used to receive
* events using it.
* @since v11.13.0

2
node_modules/@types/node/zlib.d.ts generated vendored
View File

@ -88,7 +88,7 @@
* });
* ```
* @since v0.5.8
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/zlib.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/zlib.js)
*/
declare module 'zlib' {
import * as stream from 'node:stream';