full site update

This commit is contained in:
2025-07-24 18:46:24 +02:00
parent bfe2b90d8d
commit 37a6e0ab31
6912 changed files with 540482 additions and 361712 deletions

View File

@@ -1,15 +0,0 @@
# Installation
> `npm install --save @types/babel__core`
# Summary
This package contains type definitions for @babel/core (https://github.com/babel/babel/tree/master/packages/babel-core).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__core.
### Additional Details
* Last updated: Mon, 20 Nov 2023 23:36:23 GMT
* Dependencies: [@babel/parser](https://npmjs.com/package/@babel/parser), [@babel/types](https://npmjs.com/package/@babel/types), [@types/babel__generator](https://npmjs.com/package/@types/babel__generator), [@types/babel__template](https://npmjs.com/package/@types/babel__template), [@types/babel__traverse](https://npmjs.com/package/@types/babel__traverse)
# Credits
These definitions were written by [Troy Gerwien](https://github.com/yortus), [Marvin Hagemeister](https://github.com/marvinhagemeister), [Melvin Groenhoff](https://github.com/mgroenhoff), [Jessica Franco](https://github.com/Jessidhia), and [Ifiok Jr.](https://github.com/ifiokjr).

View File

@@ -1,831 +0,0 @@
import { GeneratorOptions } from "@babel/generator";
import { ParserOptions } from "@babel/parser";
import template from "@babel/template";
import traverse, { Hub, NodePath, Scope, Visitor } from "@babel/traverse";
import * as t from "@babel/types";
export { GeneratorOptions, NodePath, ParserOptions, t as types, template, traverse, Visitor };
export type Node = t.Node;
export type ParseResult = ReturnType<typeof import("@babel/parser").parse>;
export const version: string;
export const DEFAULT_EXTENSIONS: [".js", ".jsx", ".es6", ".es", ".mjs"];
/**
* Source map standard format as to revision 3
* @see {@link https://sourcemaps.info/spec.html}
* @see {@link https://github.com/mozilla/source-map/blob/HEAD/source-map.d.ts}
*/
interface InputSourceMap {
version: number;
sources: string[];
names: string[];
sourceRoot?: string | undefined;
sourcesContent?: string[] | undefined;
mappings: string;
file: string;
}
export interface TransformOptions {
/**
* Specify which assumptions it can make about your code, to better optimize the compilation result. **NOTE**: This replaces the various `loose` options in plugins in favor of
* top-level options that can apply to multiple plugins
*
* @see https://babeljs.io/docs/en/assumptions
*/
assumptions?: { [name: string]: boolean } | null | undefined;
/**
* Include the AST in the returned object
*
* Default: `false`
*/
ast?: boolean | null | undefined;
/**
* Attach a comment after all non-user injected code
*
* Default: `null`
*/
auxiliaryCommentAfter?: string | null | undefined;
/**
* Attach a comment before all non-user injected code
*
* Default: `null`
*/
auxiliaryCommentBefore?: string | null | undefined;
/**
* Specify the "root" folder that defines the location to search for "babel.config.js", and the default folder to allow `.babelrc` files inside of.
*
* Default: `"."`
*/
root?: string | null | undefined;
/**
* This option, combined with the "root" value, defines how Babel chooses its project root.
* The different modes define different ways that Babel can process the "root" value to get
* the final project root.
*
* @see https://babeljs.io/docs/en/next/options#rootmode
*/
rootMode?: "root" | "upward" | "upward-optional" | undefined;
/**
* The config file to load Babel's config from. Defaults to searching for "babel.config.js" inside the "root" folder. `false` will disable searching for config files.
*
* Default: `undefined`
*/
configFile?: string | boolean | null | undefined;
/**
* Specify whether or not to use .babelrc and
* .babelignore files.
*
* Default: `true`
*/
babelrc?: boolean | null | undefined;
/**
* Specify which packages should be search for .babelrc files when they are being compiled. `true` to always search, or a path string or an array of paths to packages to search
* inside of. Defaults to only searching the "root" package.
*
* Default: `(root)`
*/
babelrcRoots?: boolean | MatchPattern | MatchPattern[] | null | undefined;
/**
* Toggles whether or not browserslist config sources are used, which includes searching for any browserslist files or referencing the browserslist key inside package.json.
* This is useful for projects that use a browserslist config for files that won't be compiled with Babel.
*
* If a string is specified, it must represent the path of a browserslist configuration file. Relative paths are resolved relative to the configuration file which specifies
* this option, or to `cwd` when it's passed as part of the programmatic options.
*
* Default: `true`
*/
browserslistConfigFile?: boolean | null | undefined;
/**
* The Browserslist environment to use.
*
* Default: `undefined`
*/
browserslistEnv?: string | null | undefined;
/**
* By default `babel.transformFromAst` will clone the input AST to avoid mutations.
* Specifying `cloneInputAst: false` can improve parsing performance if the input AST is not used elsewhere.
*
* Default: `true`
*/
cloneInputAst?: boolean | null | undefined;
/**
* Defaults to environment variable `BABEL_ENV` if set, or else `NODE_ENV` if set, or else it defaults to `"development"`
*
* Default: env vars
*/
envName?: string | undefined;
/**
* If any of patterns match, the current configuration object is considered inactive and is ignored during config processing.
*/
exclude?: MatchPattern | MatchPattern[] | undefined;
/**
* Enable code generation
*
* Default: `true`
*/
code?: boolean | null | undefined;
/**
* Output comments in generated output
*
* Default: `true`
*/
comments?: boolean | null | undefined;
/**
* Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB
*
* Default: `"auto"`
*/
compact?: boolean | "auto" | null | undefined;
/**
* The working directory that Babel's programmatic options are loaded relative to.
*
* Default: `"."`
*/
cwd?: string | null | undefined;
/**
* Utilities may pass a caller object to identify themselves to Babel and
* pass capability-related flags for use by configs, presets and plugins.
*
* @see https://babeljs.io/docs/en/next/options#caller
*/
caller?: TransformCaller | undefined;
/**
* This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { \/* specific options *\/ } } }`
* which will use those options when the `envName` is `production`
*
* Default: `{}`
*/
env?: { [index: string]: TransformOptions | null | undefined } | null | undefined;
/**
* A path to a `.babelrc` file to extend
*
* Default: `null`
*/
extends?: string | null | undefined;
/**
* Filename for use in errors etc
*
* Default: `"unknown"`
*/
filename?: string | null | undefined;
/**
* Filename relative to `sourceRoot`
*
* Default: `(filename)`
*/
filenameRelative?: string | null | undefined;
/**
* An object containing the options to be passed down to the babel code generator, @babel/generator
*
* Default: `{}`
*/
generatorOpts?: GeneratorOptions | null | undefined;
/**
* Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. If falsy value is returned then the generated module id is used
*
* Default: `null`
*/
getModuleId?: ((moduleName: string) => string | null | undefined) | null | undefined;
/**
* ANSI highlight syntax error code frames
*
* Default: `true`
*/
highlightCode?: boolean | null | undefined;
/**
* Opposite to the `only` option. `ignore` is disregarded if `only` is specified
*
* Default: `null`
*/
ignore?: MatchPattern[] | null | undefined;
/**
* This option is a synonym for "test"
*/
include?: MatchPattern | MatchPattern[] | undefined;
/**
* A source map object that the output source map will be based on
*
* Default: `null`
*/
inputSourceMap?: InputSourceMap | null | undefined;
/**
* Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping `()` from `new` when safe)
*
* Default: `false`
*/
minified?: boolean | null | undefined;
/**
* Specify a custom name for module ids
*
* Default: `null`
*/
moduleId?: string | null | undefined;
/**
* If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules)
*
* Default: `false`
*/
moduleIds?: boolean | null | undefined;
/**
* Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions
*
* Default: `(sourceRoot)`
*/
moduleRoot?: string | null | undefined;
/**
* A glob, regex, or mixed array of both, matching paths to **only** compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile
* a non-matching file it's returned verbatim
*
* Default: `null`
*/
only?: MatchPattern[] | null | undefined;
/**
* Allows users to provide an array of options that will be merged into the current configuration one at a time.
* This feature is best used alongside the "test"/"include"/"exclude" options to provide conditions for which an override should apply
*/
overrides?: TransformOptions[] | undefined;
/**
* An object containing the options to be passed down to the babel parser, @babel/parser
*
* Default: `{}`
*/
parserOpts?: ParserOptions | null | undefined;
/**
* List of plugins to load and use
*
* Default: `[]`
*/
plugins?: PluginItem[] | null | undefined;
/**
* List of presets (a set of plugins) to load and use
*
* Default: `[]`
*/
presets?: PluginItem[] | null | undefined;
/**
* Retain line numbers. This will lead to wacky code but is handy for scenarios where you can't use source maps. (**NOTE**: This will not retain the columns)
*
* Default: `false`
*/
retainLines?: boolean | null | undefined;
/**
* An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE**: This overrides the `comment` option when used
*
* Default: `null`
*/
shouldPrintComment?: ((commentContents: string) => boolean) | null | undefined;
/**
* Set `sources[0]` on returned source map
*
* Default: `(filenameRelative)`
*/
sourceFileName?: string | null | undefined;
/**
* If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"`
* then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!**
*
* Default: `false`
*/
sourceMaps?: boolean | "inline" | "both" | null | undefined;
/**
* The root from which all sources are relative
*
* Default: `(moduleRoot)`
*/
sourceRoot?: string | null | undefined;
/**
* Indicate the mode the code should be parsed in. Can be one of "script", "module", or "unambiguous". `"unambiguous"` will make Babel attempt to guess, based on the presence of ES6
* `import` or `export` statements. Files with ES6 `import`s and `export`s are considered `"module"` and are otherwise `"script"`.
*
* Default: `("module")`
*/
sourceType?: "script" | "module" | "unambiguous" | null | undefined;
/**
* If all patterns fail to match, the current configuration object is considered inactive and is ignored during config processing.
*/
test?: MatchPattern | MatchPattern[] | undefined;
/**
* Describes the environments you support/target for your project.
* This can either be a [browserslist-compatible](https://github.com/ai/browserslist) query (with [caveats](https://babeljs.io/docs/en/babel-preset-env#ineffective-browserslist-queries))
*
* Default: `{}`
*/
targets?:
| string
| string[]
| {
esmodules?: boolean;
node?: Omit<string, "current"> | "current" | true;
safari?: Omit<string, "tp"> | "tp";
browsers?: string | string[];
android?: string;
chrome?: string;
deno?: string;
edge?: string;
electron?: string;
firefox?: string;
ie?: string;
ios?: string;
opera?: string;
rhino?: string;
samsung?: string;
};
/**
* An optional callback that can be used to wrap visitor methods. **NOTE**: This is useful for things like introspection, and not really needed for implementing anything. Called as
* `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`.
*/
wrapPluginVisitorMethod?:
| ((
pluginAlias: string,
visitorType: "enter" | "exit",
callback: (path: NodePath, state: any) => void,
) => (path: NodePath, state: any) => void)
| null
| undefined;
}
export interface TransformCaller {
// the only required property
name: string;
// e.g. set to true by `babel-loader` and false by `babel-jest`
supportsStaticESM?: boolean | undefined;
supportsDynamicImport?: boolean | undefined;
supportsExportNamespaceFrom?: boolean | undefined;
supportsTopLevelAwait?: boolean | undefined;
// augment this with a "declare module '@babel/core' { ... }" if you need more keys
}
export type FileResultCallback = (err: Error | null, result: BabelFileResult | null) => any;
export interface MatchPatternContext {
envName: string;
dirname: string;
caller: TransformCaller | undefined;
}
export type MatchPattern = string | RegExp | ((filename: string | undefined, context: MatchPatternContext) => boolean);
/**
* Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.
*/
export function transform(code: string, callback: FileResultCallback): void;
/**
* Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.
*/
export function transform(code: string, opts: TransformOptions | undefined, callback: FileResultCallback): void;
/**
* Here for backward-compatibility. Ideally use `transformSync` if you want a synchronous API.
*/
export function transform(code: string, opts?: TransformOptions): BabelFileResult | null;
/**
* Transforms the passed in code. Returning an object with the generated code, source map, and AST.
*/
export function transformSync(code: string, opts?: TransformOptions): BabelFileResult | null;
/**
* Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.
*/
export function transformAsync(code: string, opts?: TransformOptions): Promise<BabelFileResult | null>;
/**
* Asynchronously transforms the entire contents of a file.
*/
export function transformFile(filename: string, callback: FileResultCallback): void;
/**
* Asynchronously transforms the entire contents of a file.
*/
export function transformFile(filename: string, opts: TransformOptions | undefined, callback: FileResultCallback): void;
/**
* Synchronous version of `babel.transformFile`. Returns the transformed contents of the `filename`.
*/
export function transformFileSync(filename: string, opts?: TransformOptions): BabelFileResult | null;
/**
* Asynchronously transforms the entire contents of a file.
*/
export function transformFileAsync(filename: string, opts?: TransformOptions): Promise<BabelFileResult | null>;
/**
* Given an AST, transform it.
*/
export function transformFromAst(ast: Node, code: string | undefined, callback: FileResultCallback): void;
/**
* Given an AST, transform it.
*/
export function transformFromAst(
ast: Node,
code: string | undefined,
opts: TransformOptions | undefined,
callback: FileResultCallback,
): void;
/**
* Here for backward-compatibility. Ideally use ".transformSync" if you want a synchronous API.
*/
export function transformFromAstSync(ast: Node, code?: string, opts?: TransformOptions): BabelFileResult | null;
/**
* Given an AST, transform it.
*/
export function transformFromAstAsync(
ast: Node,
code?: string,
opts?: TransformOptions,
): Promise<BabelFileResult | null>;
// A babel plugin is a simple function which must return an object matching
// the following interface. Babel will throw if it finds unknown properties.
// The list of allowed plugin keys is here:
// https://github.com/babel/babel/blob/4e50b2d9d9c376cee7a2cbf56553fe5b982ea53c/packages/babel-core/src/config/option-manager.js#L71
export interface PluginObj<S = PluginPass> {
name?: string | undefined;
manipulateOptions?(opts: any, parserOpts: any): void;
pre?(this: S, file: BabelFile): void;
visitor: Visitor<S>;
post?(this: S, file: BabelFile): void;
inherits?: any;
}
export interface BabelFile {
ast: t.File;
opts: TransformOptions;
hub: Hub;
metadata: object;
path: NodePath<t.Program>;
scope: Scope;
inputMap: object | null;
code: string;
}
export interface PluginPass {
file: BabelFile;
key: string;
opts: object;
cwd: string;
filename: string | undefined;
get(key: unknown): any;
set(key: unknown, value: unknown): void;
[key: string]: unknown;
}
export interface BabelFileResult {
ast?: t.File | null | undefined;
code?: string | null | undefined;
ignored?: boolean | undefined;
map?:
| {
version: number;
sources: string[];
names: string[];
sourceRoot?: string | undefined;
sourcesContent?: string[] | undefined;
mappings: string;
file: string;
}
| null
| undefined;
metadata?: BabelFileMetadata | undefined;
}
export interface BabelFileMetadata {
usedHelpers: string[];
marked: Array<{
type: string;
message: string;
loc: object;
}>;
modules: BabelFileModulesMetadata;
}
export interface BabelFileModulesMetadata {
imports: object[];
exports: {
exported: object[];
specifiers: object[];
};
}
export type FileParseCallback = (err: Error | null, result: ParseResult | null) => any;
/**
* Given some code, parse it using Babel's standard behavior.
* Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
*/
export function parse(code: string, callback: FileParseCallback): void;
/**
* Given some code, parse it using Babel's standard behavior.
* Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
*/
export function parse(code: string, options: TransformOptions | undefined, callback: FileParseCallback): void;
/**
* Given some code, parse it using Babel's standard behavior.
* Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
*/
export function parse(code: string, options?: TransformOptions): ParseResult | null;
/**
* Given some code, parse it using Babel's standard behavior.
* Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
*/
export function parseSync(code: string, options?: TransformOptions): ParseResult | null;
/**
* Given some code, parse it using Babel's standard behavior.
* Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
*/
export function parseAsync(code: string, options?: TransformOptions): Promise<ParseResult | null>;
/**
* Resolve Babel's options fully, resulting in an options object where:
*
* * opts.plugins is a full list of Plugin instances.
* * opts.presets is empty and all presets are flattened into opts.
* * It can be safely passed back to Babel. Fields like babelrc have been set to false so that later calls to Babel
* will not make a second attempt to load config files.
*
* Plugin instances aren't meant to be manipulated directly, but often callers will serialize this opts to JSON to
* use it as a cache key representing the options Babel has received. Caching on this isn't 100% guaranteed to
* invalidate properly, but it is the best we have at the moment.
*/
export function loadOptions(options?: TransformOptions): object | null;
/**
* To allow systems to easily manipulate and validate a user's config, this function resolves the plugins and
* presets and proceeds no further. The expectation is that callers will take the config's .options, manipulate it
* as then see fit and pass it back to Babel again.
*
* * `babelrc: string | void` - The path of the `.babelrc` file, if there was one.
* * `babelignore: string | void` - The path of the `.babelignore` file, if there was one.
* * `options: ValidatedOptions` - The partially resolved options, which can be manipulated and passed back
* to Babel again.
* * `plugins: Array<ConfigItem>` - See below.
* * `presets: Array<ConfigItem>` - See below.
* * It can be safely passed back to Babel. Fields like `babelrc` have been set to false so that later calls to
* Babel will not make a second attempt to load config files.
*
* `ConfigItem` instances expose properties to introspect the values, but each item should be treated as
* immutable. If changes are desired, the item should be removed from the list and replaced with either a normal
* Babel config value, or with a replacement item created by `babel.createConfigItem`. See that function for
* information about `ConfigItem` fields.
*/
export function loadPartialConfig(options?: TransformOptions): Readonly<PartialConfig> | null;
export function loadPartialConfigAsync(options?: TransformOptions): Promise<Readonly<PartialConfig> | null>;
export interface PartialConfig {
options: TransformOptions;
babelrc?: string | undefined;
babelignore?: string | undefined;
config?: string | undefined;
hasFilesystemConfig: () => boolean;
}
export interface ConfigItem {
/**
* The name that the user gave the plugin instance, e.g. `plugins: [ ['env', {}, 'my-env'] ]`
*/
name?: string | undefined;
/**
* The resolved value of the plugin.
*/
value: object | ((...args: any[]) => any);
/**
* The options object passed to the plugin.
*/
options?: object | false | undefined;
/**
* The path that the options are relative to.
*/
dirname: string;
/**
* Information about the plugin's file, if Babel knows it.
* *
*/
file?:
| {
/**
* The file that the user requested, e.g. `"@babel/env"`
*/
request: string;
/**
* The full path of the resolved file, e.g. `"/tmp/node_modules/@babel/preset-env/lib/index.js"`
*/
resolved: string;
}
| null
| undefined;
}
export type PluginOptions = object | undefined | false;
export type PluginTarget = string | object | ((...args: any[]) => any);
export type PluginItem =
| ConfigItem
| PluginObj<any>
| PluginTarget
| [PluginTarget, PluginOptions]
| [PluginTarget, PluginOptions, string | undefined];
export function resolvePlugin(name: string, dirname: string): string | null;
export function resolvePreset(name: string, dirname: string): string | null;
export interface CreateConfigItemOptions {
dirname?: string | undefined;
type?: "preset" | "plugin" | undefined;
}
/**
* Allows build tooling to create and cache config items up front. If this function is called multiple times for a
* given plugin, Babel will call the plugin's function itself multiple times. If you have a clear set of expected
* plugins and presets to inject, pre-constructing the config items would be recommended.
*/
export function createConfigItem(
value: PluginTarget | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined],
options?: CreateConfigItemOptions,
): ConfigItem;
// NOTE: the documentation says the ConfigAPI also exposes @babel/core's exports, but it actually doesn't
/**
* @see https://babeljs.io/docs/en/next/config-files#config-function-api
*/
export interface ConfigAPI {
/**
* The version string for the Babel version that is loading the config file.
*
* @see https://babeljs.io/docs/en/next/config-files#apiversion
*/
version: string;
/**
* @see https://babeljs.io/docs/en/next/config-files#apicache
*/
cache: SimpleCacheConfigurator;
/**
* @see https://babeljs.io/docs/en/next/config-files#apienv
*/
env: EnvFunction;
// undocumented; currently hardcoded to return 'false'
// async(): boolean
/**
* This API is used as a way to access the `caller` data that has been passed to Babel.
* Since many instances of Babel may be running in the same process with different `caller` values,
* this API is designed to automatically configure `api.cache`, the same way `api.env()` does.
*
* The `caller` value is available as the first parameter of the callback function.
* It is best used with something like this to toggle configuration behavior
* based on a specific environment:
*
* @example
* function isBabelRegister(caller?: { name: string }) {
* return !!(caller && caller.name === "@babel/register")
* }
* api.caller(isBabelRegister)
*
* @see https://babeljs.io/docs/en/next/config-files#apicallercb
*/
caller<T extends SimpleCacheKey>(callerCallback: (caller: TransformOptions["caller"]) => T): T;
/**
* While `api.version` can be useful in general, it's sometimes nice to just declare your version.
* This API exposes a simple way to do that with:
*
* @example
* api.assertVersion(7) // major version only
* api.assertVersion("^7.2")
*
* @see https://babeljs.io/docs/en/next/config-files#apiassertversionrange
*/
assertVersion(versionRange: number | string): boolean;
// NOTE: this is an undocumented reexport from "@babel/parser" but it's missing from its types
// tokTypes: typeof tokTypes
}
/**
* JS configs are great because they can compute a config on the fly,
* but the downside there is that it makes caching harder.
* Babel wants to avoid re-executing the config function every time a file is compiled,
* because then it would also need to re-execute any plugin and preset functions
* referenced in that config.
*
* To avoid this, Babel expects users of config functions to tell it how to manage caching
* within a config file.
*
* @see https://babeljs.io/docs/en/next/config-files#apicache
*/
export interface SimpleCacheConfigurator {
// there is an undocumented call signature that is a shorthand for forever()/never()/using().
// (ever: boolean): void
// <T extends SimpleCacheKey>(callback: CacheCallback<T>): T
/**
* Permacache the computed config and never call the function again.
*/
forever(): void;
/**
* Do not cache this config, and re-execute the function every time.
*/
never(): void;
/**
* Any time the using callback returns a value other than the one that was expected,
* the overall config function will be called again and a new entry will be added to the cache.
*
* @example
* api.cache.using(() => process.env.NODE_ENV)
*/
using<T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>): T;
/**
* Any time the using callback returns a value other than the one that was expected,
* the overall config function will be called again and all entries in the cache will
* be replaced with the result.
*
* @example
* api.cache.invalidate(() => process.env.NODE_ENV)
*/
invalidate<T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>): T;
}
// https://github.com/babel/babel/blob/v7.3.3/packages/babel-core/src/config/caching.js#L231
export type SimpleCacheKey = string | boolean | number | null | undefined;
export type SimpleCacheCallback<T extends SimpleCacheKey> = () => T;
/**
* Since `NODE_ENV` is a fairly common way to toggle behavior, Babel also includes an API function
* meant specifically for that. This API is used as a quick way to check the `"envName"` that Babel
* was loaded with, which takes `NODE_ENV` into account if no other overriding environment is set.
*
* @see https://babeljs.io/docs/en/next/config-files#apienv
*/
export interface EnvFunction {
/**
* @returns the current `envName` string
*/
(): string;
/**
* @returns `true` if the `envName` is `===` any of the given strings
*/
(envName: string | readonly string[]): boolean;
// the official documentation is misleading for this one...
// this just passes the callback to `cache.using` but with an additional argument.
// it returns its result instead of necessarily returning a boolean.
<T extends SimpleCacheKey>(envCallback: (envName: NonNullable<TransformOptions["envName"]>) => T): T;
}
export type ConfigFunction = (api: ConfigAPI) => TransformOptions;
export as namespace babel;

View File

@@ -1,51 +0,0 @@
{
"name": "@types/babel__core",
"version": "7.20.5",
"description": "TypeScript definitions for @babel/core",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__core",
"license": "MIT",
"contributors": [
{
"name": "Troy Gerwien",
"githubUsername": "yortus",
"url": "https://github.com/yortus"
},
{
"name": "Marvin Hagemeister",
"githubUsername": "marvinhagemeister",
"url": "https://github.com/marvinhagemeister"
},
{
"name": "Melvin Groenhoff",
"githubUsername": "mgroenhoff",
"url": "https://github.com/mgroenhoff"
},
{
"name": "Jessica Franco",
"githubUsername": "Jessidhia",
"url": "https://github.com/Jessidhia"
},
{
"name": "Ifiok Jr.",
"githubUsername": "ifiokjr",
"url": "https://github.com/ifiokjr"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/babel__core"
},
"scripts": {},
"dependencies": {
"@babel/parser": "^7.20.7",
"@babel/types": "^7.20.7",
"@types/babel__generator": "*",
"@types/babel__template": "*",
"@types/babel__traverse": "*"
},
"typesPublisherContentHash": "3ece429b02ff9f70503a5644f2b303b04d10e6da7940c91a9eff5e52f2c76b91",
"typeScriptVersion": "4.5"
}

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

View File

@@ -1,15 +0,0 @@
# Installation
> `npm install --save @types/babel__generator`
# Summary
This package contains type definitions for @babel/generator (https://github.com/babel/babel/tree/master/packages/babel-generator).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__generator.
### Additional Details
* Last updated: Thu, 03 Apr 2025 16:02:41 GMT
* Dependencies: [@babel/types](https://npmjs.com/package/@babel/types)
# Credits
These definitions were written by [Troy Gerwien](https://github.com/yortus), [Melvin Groenhoff](https://github.com/mgroenhoff), [Cameron Yan](https://github.com/khell), and [Lyanbin](https://github.com/Lyanbin).

View File

@@ -1,210 +0,0 @@
import * as t from "@babel/types";
export interface GeneratorOptions {
/**
* Optional string to add as a block comment at the start of the output file.
*/
auxiliaryCommentBefore?: string | undefined;
/**
* Optional string to add as a block comment at the end of the output file.
*/
auxiliaryCommentAfter?: string | undefined;
/**
* Function that takes a comment (as a string) and returns true if the comment should be included in the output.
* By default, comments are included if `opts.comments` is `true` or if `opts.minifed` is `false` and the comment
* contains `@preserve` or `@license`.
*/
shouldPrintComment?(comment: string): boolean;
/**
* Attempt to use the same line numbers in the output code as in the source code (helps preserve stack traces).
* Defaults to `false`.
*/
retainLines?: boolean | undefined;
/**
* Retain parens around function expressions (could be used to change engine parsing behavior)
* Defaults to `false`.
*/
retainFunctionParens?: boolean | undefined;
/**
* Should comments be included in output? Defaults to `true`.
*/
comments?: boolean | undefined;
/**
* Set to true to avoid adding whitespace for formatting. Defaults to the value of `opts.minified`.
*/
compact?: boolean | "auto" | undefined;
/**
* Should the output be minified. Defaults to `false`.
*/
minified?: boolean | undefined;
/**
* Set to true to reduce whitespace (but not as much as opts.compact). Defaults to `false`.
*/
concise?: boolean | undefined;
/**
* Used in warning messages
*/
filename?: string | undefined;
/**
* Enable generating source maps. Defaults to `false`.
*/
sourceMaps?: boolean | undefined;
/**
* A root for all relative URLs in the source map.
*/
sourceRoot?: string | undefined;
/**
* The filename for the source code (i.e. the code in the `code` argument).
* This will only be used if `code` is a string.
*/
sourceFileName?: string | undefined;
/**
* Set to true to run jsesc with "json": true to print "\u00A9" vs. "©";
*/
jsonCompatibleStrings?: boolean | undefined;
/**
* Set to true to enable support for experimental decorators syntax before module exports.
* Defaults to `false`.
*/
decoratorsBeforeExport?: boolean | undefined;
/**
* The import attributes/assertions syntax to use.
* When not specified, @babel/generator will try to match the style in the input code based on the AST shape.
*/
importAttributesKeyword?: "with" | "assert" | "with-legacy";
/**
* Options for outputting jsesc representation.
*/
jsescOption?: {
/**
* The default value for the quotes option is 'single'. This means that any occurrences of ' in the input
* string are escaped as \', so that the output can be used in a string literal wrapped in single quotes.
*/
quotes?: "single" | "double" | "backtick" | undefined;
/**
* The default value for the numbers option is 'decimal'. This means that any numeric values are represented
* using decimal integer literals. Other valid options are binary, octal, and hexadecimal, which result in
* binary integer literals, octal integer literals, and hexadecimal integer literals, respectively.
*/
numbers?: "binary" | "octal" | "decimal" | "hexadecimal" | undefined;
/**
* The wrap option takes a boolean value (true or false), and defaults to false (disabled). When enabled, the
* output is a valid JavaScript string literal wrapped in quotes. The type of quotes can be specified through
* the quotes setting.
*/
wrap?: boolean | undefined;
/**
* The es6 option takes a boolean value (true or false), and defaults to false (disabled). When enabled, any
* astral Unicode symbols in the input are escaped using ECMAScript 6 Unicode code point escape sequences
* instead of using separate escape sequences for each surrogate half. If backwards compatibility with ES5
* environments is a concern, dont enable this setting. If the json setting is enabled, the value for the es6
* setting is ignored (as if it was false).
*/
es6?: boolean | undefined;
/**
* The escapeEverything option takes a boolean value (true or false), and defaults to false (disabled). When
* enabled, all the symbols in the output are escaped — even printable ASCII symbols.
*/
escapeEverything?: boolean | undefined;
/**
* The minimal option takes a boolean value (true or false), and defaults to false (disabled). When enabled,
* only a limited set of symbols in the output are escaped: \0, \b, \t, \n, \f, \r, \\, \u2028, \u2029.
*/
minimal?: boolean | undefined;
/**
* The isScriptContext option takes a boolean value (true or false), and defaults to false (disabled). When
* enabled, occurrences of </script and </style in the output are escaped as <\/script and <\/style, and <!--
* is escaped as \x3C!-- (or \u003C!-- when the json option is enabled). This setting is useful when jsescs
* output ends up as part of a <script> or <style> element in an HTML document.
*/
isScriptContext?: boolean | undefined;
/**
* The compact option takes a boolean value (true or false), and defaults to true (enabled). When enabled,
* the output for arrays and objects is as compact as possible; its not formatted nicely.
*/
compact?: boolean | undefined;
/**
* The indent option takes a string value, and defaults to '\t'. When the compact setting is enabled (true),
* the value of the indent option is used to format the output for arrays and objects.
*/
indent?: string | undefined;
/**
* The indentLevel option takes a numeric value, and defaults to 0. It represents the current indentation level,
* i.e. the number of times the value of the indent option is repeated.
*/
indentLevel?: number | undefined;
/**
* The json option takes a boolean value (true or false), and defaults to false (disabled). When enabled, the
* output is valid JSON. Hexadecimal character escape sequences and the \v or \0 escape sequences are not used.
* Setting json: true implies quotes: 'double', wrap: true, es6: false, although these values can still be
* overridden if needed — but in such cases, the output wont be valid JSON anymore.
*/
json?: boolean | undefined;
/**
* The lowercaseHex option takes a boolean value (true or false), and defaults to false (disabled). When enabled,
* any alphabetical hexadecimal digits in escape sequences as well as any hexadecimal integer literals (see the
* numbers option) in the output are in lowercase.
*/
lowercaseHex?: boolean | undefined;
} | undefined;
}
export class CodeGenerator {
constructor(ast: t.Node, opts?: GeneratorOptions, code?: string);
generate(): GeneratorResult;
}
/**
* Turns an AST into code, maintaining sourcemaps, user preferences, and valid output.
* @param ast - the abstract syntax tree from which to generate output code.
* @param opts - used for specifying options for code generation.
* @param code - the original source code, used for source maps.
* @returns - an object containing the output code and source map.
*/
export function generate(
ast: t.Node,
opts?: GeneratorOptions,
code?: string | { [filename: string]: string },
): GeneratorResult;
export default generate;
export interface GeneratorResult {
code: string;
map: {
version: number;
sources: string[];
names: string[];
sourceRoot?: string | undefined;
sourcesContent?: string[] | undefined;
mappings: string;
file: string;
} | null;
}

View File

@@ -1,43 +0,0 @@
{
"name": "@types/babel__generator",
"version": "7.27.0",
"description": "TypeScript definitions for @babel/generator",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__generator",
"license": "MIT",
"contributors": [
{
"name": "Troy Gerwien",
"githubUsername": "yortus",
"url": "https://github.com/yortus"
},
{
"name": "Melvin Groenhoff",
"githubUsername": "mgroenhoff",
"url": "https://github.com/mgroenhoff"
},
{
"name": "Cameron Yan",
"githubUsername": "khell",
"url": "https://github.com/khell"
},
{
"name": "Lyanbin",
"githubUsername": "Lyanbin",
"url": "https://github.com/Lyanbin"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/babel__generator"
},
"scripts": {},
"dependencies": {
"@babel/types": "^7.0.0"
},
"peerDependencies": {},
"typesPublisherContentHash": "b5c7deac65dbd6ab9b313d1d71c86afe4383b881dcb4e3b3ac51dab07b8f95fb",
"typeScriptVersion": "5.1"
}

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

View File

@@ -1,15 +0,0 @@
# Installation
> `npm install --save @types/babel__template`
# Summary
This package contains type definitions for @babel/template (https://github.com/babel/babel/tree/master/packages/babel-template).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__template.
### Additional Details
* Last updated: Mon, 06 Nov 2023 22:41:04 GMT
* Dependencies: [@babel/parser](https://npmjs.com/package/@babel/parser), [@babel/types](https://npmjs.com/package/@babel/types)
# Credits
These definitions were written by [Troy Gerwien](https://github.com/yortus), [Marvin Hagemeister](https://github.com/marvinhagemeister), [Melvin Groenhoff](https://github.com/mgroenhoff), and [ExE Boss](https://github.com/ExE-Boss).

View File

@@ -1,92 +0,0 @@
import { ParserOptions } from "@babel/parser";
import { Expression, Program, Statement } from "@babel/types";
export interface TemplateBuilderOptions extends ParserOptions {
/**
* A set of placeholder names to automatically accept.
* Items in this list do not need to match `placeholderPattern`.
*
* This option cannot be used when using `%%foo%%` style placeholders.
*/
placeholderWhitelist?: Set<string> | null | undefined;
/**
* A pattern to search for when looking for `Identifier` and `StringLiteral`
* nodes that should be considered as placeholders.
*
* `false` will disable placeholder searching placeholders, leaving only
* the `placeholderWhitelist` value to find replacements.
*
* This option cannot be used when using `%%foo%%` style placeholders.
*
* @default /^[_$A-Z0-9]+$/
*/
placeholderPattern?: RegExp | false | null | undefined;
/**
* Set this to `true` to preserve comments from the template string
* into the resulting AST, or `false` to automatically discard comments.
*
* @default false
*/
preserveComments?: boolean | null | undefined;
/**
* Set to `true` to use `%%foo%%` style placeholders, `false` to use legacy placeholders
* described by `placeholderPattern` or `placeholderWhitelist`.
*
* When it is not set, it behaves as `true` if there are syntactic placeholders, otherwise as `false`.
*
* @since 7.4.0
*/
syntacticPlaceholders?: boolean | null | undefined;
}
export interface TemplateBuilder<T> {
/**
* Build a new builder, merging the given options with the previous ones.
*/
(opts: TemplateBuilderOptions): TemplateBuilder<T>;
/**
* Building from a string produces an AST builder function by default.
*/
(code: string, opts?: TemplateBuilderOptions): (arg?: PublicReplacements) => T;
/**
* Building from a template literal produces an AST builder function by default.
*/
(tpl: TemplateStringsArray, ...args: unknown[]): (arg?: PublicReplacements) => T;
/**
* Allow users to explicitly create templates that produce ASTs,
* skipping the need for an intermediate function.
*
* Does not allow `%%foo%%` style placeholders.
*/
ast: {
(tpl: string, opts?: TemplateBuilderOptions): T;
(tpl: TemplateStringsArray, ...args: unknown[]): T;
};
}
export type PublicReplacements = { [index: string]: unknown } | unknown[];
export const smart: TemplateBuilder<Statement | Statement[]>;
export const statement: TemplateBuilder<Statement>;
export const statements: TemplateBuilder<Statement[]>;
export const expression: TemplateBuilder<Expression>;
export const program: TemplateBuilder<Program>;
type DefaultTemplateBuilder = typeof smart & {
smart: typeof smart;
statement: typeof statement;
statements: typeof statements;
expression: typeof expression;
program: typeof program;
ast: typeof smart.ast;
};
declare const templateBuilder: DefaultTemplateBuilder;
export default templateBuilder;

View File

@@ -1,43 +0,0 @@
{
"name": "@types/babel__template",
"version": "7.4.4",
"description": "TypeScript definitions for @babel/template",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__template",
"license": "MIT",
"contributors": [
{
"name": "Troy Gerwien",
"githubUsername": "yortus",
"url": "https://github.com/yortus"
},
{
"name": "Marvin Hagemeister",
"githubUsername": "marvinhagemeister",
"url": "https://github.com/marvinhagemeister"
},
{
"name": "Melvin Groenhoff",
"githubUsername": "mgroenhoff",
"url": "https://github.com/mgroenhoff"
},
{
"name": "ExE Boss",
"githubUsername": "ExE-Boss",
"url": "https://github.com/ExE-Boss"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/babel__template"
},
"scripts": {},
"dependencies": {
"@babel/parser": "^7.1.0",
"@babel/types": "^7.0.0"
},
"typesPublisherContentHash": "5730d754b4d1fcd41676b093f9e32b340c749c4d37b126dfa312e394467e86c6",
"typeScriptVersion": "4.5"
}

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

View File

@@ -1,15 +0,0 @@
# Installation
> `npm install --save @types/babel__traverse`
# Summary
This package contains type definitions for @babel/traverse (https://github.com/babel/babel/tree/main/packages/babel-traverse).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__traverse.
### Additional Details
* Last updated: Wed, 26 Mar 2025 08:02:36 GMT
* Dependencies: [@babel/types](https://npmjs.com/package/@babel/types)
# Credits
These definitions were written by [Troy Gerwien](https://github.com/yortus), [Marvin Hagemeister](https://github.com/marvinhagemeister), [Ryan Petrich](https://github.com/rpetrich), [Melvin Groenhoff](https://github.com/mgroenhoff), [Dean L.](https://github.com/dlgrit), [Ifiok Jr.](https://github.com/ifiokjr), [ExE Boss](https://github.com/ExE-Boss), and [Daniel Tschinder](https://github.com/danez).

File diff suppressed because it is too large Load Diff

View File

@@ -1,63 +0,0 @@
{
"name": "@types/babel__traverse",
"version": "7.20.7",
"description": "TypeScript definitions for @babel/traverse",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__traverse",
"license": "MIT",
"contributors": [
{
"name": "Troy Gerwien",
"githubUsername": "yortus",
"url": "https://github.com/yortus"
},
{
"name": "Marvin Hagemeister",
"githubUsername": "marvinhagemeister",
"url": "https://github.com/marvinhagemeister"
},
{
"name": "Ryan Petrich",
"githubUsername": "rpetrich",
"url": "https://github.com/rpetrich"
},
{
"name": "Melvin Groenhoff",
"githubUsername": "mgroenhoff",
"url": "https://github.com/mgroenhoff"
},
{
"name": "Dean L.",
"githubUsername": "dlgrit",
"url": "https://github.com/dlgrit"
},
{
"name": "Ifiok Jr.",
"githubUsername": "ifiokjr",
"url": "https://github.com/ifiokjr"
},
{
"name": "ExE Boss",
"githubUsername": "ExE-Boss",
"url": "https://github.com/ExE-Boss"
},
{
"name": "Daniel Tschinder",
"githubUsername": "danez",
"url": "https://github.com/danez"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/babel__traverse"
},
"scripts": {},
"dependencies": {
"@babel/types": "^7.20.7"
},
"peerDependencies": {},
"typesPublisherContentHash": "e58d29a4d5c39ba4fa0291c8c7d5abad18881f7ed9f938feeb97726ad48a0544",
"typeScriptVersion": "5.0"
}

21
node_modules/@types/cookie/LICENSE generated vendored
View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

15
node_modules/@types/cookie/README.md generated vendored
View File

@@ -1,15 +0,0 @@
# Installation
> `npm install --save @types/cookie`
# Summary
This package contains type definitions for cookie (https://github.com/jshttp/cookie).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie.
### Additional Details
* Last updated: Sun, 26 Nov 2023 22:07:01 GMT
* Dependencies: none
# Credits
These definitions were written by [Pine Mizune](https://github.com/pine), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).

154
node_modules/@types/cookie/index.d.ts generated vendored
View File

@@ -1,154 +0,0 @@
/**
* Basic HTTP cookie parser and serializer for HTTP servers.
*/
/**
* Additional serialization options
*/
export interface CookieSerializeOptions {
/**
* Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.3|Domain Set-Cookie attribute}. By default, no
* domain is set, and most clients will consider the cookie to apply to only
* the current domain.
*/
domain?: string | undefined;
/**
* Specifies a function that will be used to encode a cookie's value. Since
* value of a cookie has a limited character set (and must be a simple
* string), this function can be used to encode a value into a string suited
* for a cookie's value.
*
* The default function is the global `encodeURIComponent`, which will
* encode a JavaScript string into UTF-8 byte sequences and then URL-encode
* any that fall outside of the cookie range.
*/
encode?(value: string): string;
/**
* Specifies the `Date` object to be the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.1|`Expires` `Set-Cookie` attribute}. By default,
* no expiration is set, and most clients will consider this a "non-persistent cookie" and will delete
* it on a condition like exiting a web browser application.
*
* *Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3|cookie storage model specification}
* states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
* possible not all clients by obey this, so if both are set, they should
* point to the same date and time.
*/
expires?: Date | undefined;
/**
* Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.6|`HttpOnly` `Set-Cookie` attribute}.
* When truthy, the `HttpOnly` attribute is set, otherwise it is not. By
* default, the `HttpOnly` attribute is not set.
*
* *Note* be careful when setting this to true, as compliant clients will
* not allow client-side JavaScript to see the cookie in `document.cookie`.
*/
httpOnly?: boolean | undefined;
/**
* Specifies the number (in seconds) to be the value for the `Max-Age`
* `Set-Cookie` attribute. The given number will be converted to an integer
* by rounding down. By default, no maximum age is set.
*
* *Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3|cookie storage model specification}
* states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
* possible not all clients by obey this, so if both are set, they should
* point to the same date and time.
*/
maxAge?: number | undefined;
/**
* Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](rfc-cutler-httpbis-partitioned-cookies)
* attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the
* `Partitioned` attribute is not set.
*
* **note** This is an attribute that has not yet been fully standardized, and may change in the future.
* This also means many clients may ignore this attribute until they understand it.
*
* More information about can be found in [the proposal](https://github.com/privacycg/CHIPS)
*/
partitioned?: boolean | undefined;
/**
* Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.4|`Path` `Set-Cookie` attribute}.
* By default, the path is considered the "default path".
*/
path?: string | undefined;
/**
* Specifies the `string` to be the value for the [`Priority` `Set-Cookie` attribute][rfc-west-cookie-priority-00-4.1].
*
* - `'low'` will set the `Priority` attribute to `Low`.
* - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
* - `'high'` will set the `Priority` attribute to `High`.
*
* More information about the different priority levels can be found in
* [the specification][rfc-west-cookie-priority-00-4.1].
*
* **note** This is an attribute that has not yet been fully standardized, and may change in the future.
* This also means many clients may ignore this attribute until they understand it.
*/
priority?: "low" | "medium" | "high" | undefined;
/**
* Specifies the boolean or string to be the value for the {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|`SameSite` `Set-Cookie` attribute}.
*
* - `true` will set the `SameSite` attribute to `Strict` for strict same
* site enforcement.
* - `false` will not set the `SameSite` attribute.
* - `'lax'` will set the `SameSite` attribute to Lax for lax same site
* enforcement.
* - `'strict'` will set the `SameSite` attribute to Strict for strict same
* site enforcement.
* - `'none'` will set the SameSite attribute to None for an explicit
* cross-site cookie.
*
* More information about the different enforcement levels can be found in {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|the specification}.
*
* *note* This is an attribute that has not yet been fully standardized, and may change in the future. This also means many clients may ignore this attribute until they understand it.
*/
sameSite?: true | false | "lax" | "strict" | "none" | undefined;
/**
* Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.5|`Secure` `Set-Cookie` attribute}. When truthy, the
* `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set.
*
* *Note* be careful when setting this to `true`, as compliant clients will
* not send the cookie back to the server in the future if the browser does
* not have an HTTPS connection.
*/
secure?: boolean | undefined;
}
/**
* Additional parsing options
*/
export interface CookieParseOptions {
/**
* Specifies a function that will be used to decode a cookie's value. Since
* the value of a cookie has a limited character set (and must be a simple
* string), this function can be used to decode a previously-encoded cookie
* value into a JavaScript string or other object.
*
* The default function is the global `decodeURIComponent`, which will decode
* any URL-encoded sequences into their byte representations.
*
* *Note* if an error is thrown from this function, the original, non-decoded
* cookie value will be returned as the cookie's value.
*/
decode?(value: string): string;
}
/**
* Parse an HTTP Cookie header string and returning an object of all cookie
* name-value pairs.
*
* @param str the string representing a `Cookie` header value
* @param [options] object containing parsing options
*/
export function parse(str: string, options?: CookieParseOptions): Record<string, string>;
/**
* Serialize a cookie name-value pair into a `Set-Cookie` header string.
*
* @param name the name for the cookie
* @param value value to set the cookie to
* @param [options] object containing serialization options
* @throws {TypeError} when `maxAge` options is invalid
*/
export function serialize(name: string, value: string, options?: CookieSerializeOptions): string;

View File

@@ -1,30 +0,0 @@
{
"name": "@types/cookie",
"version": "0.6.0",
"description": "TypeScript definitions for cookie",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie",
"license": "MIT",
"contributors": [
{
"name": "Pine Mizune",
"githubUsername": "pine",
"url": "https://github.com/pine"
},
{
"name": "Piotr Błażejewicz",
"githubUsername": "peterblazejewicz",
"url": "https://github.com/peterblazejewicz"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/cookie"
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "0fbdf9c886fb40c8dc7677b8b7d0f9e02ac5235e163d90244a4fb9004736a575",
"typeScriptVersion": "4.5"
}

View File

@@ -8,7 +8,7 @@ This package contains type definitions for estree (https://github.com/estree/est
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree.
### Additional Details
* Last updated: Mon, 24 Mar 2025 07:34:10 GMT
* Last updated: Fri, 06 Jun 2025 00:04:33 GMT
* Dependencies: none
# Credits

View File

@@ -247,7 +247,7 @@ export interface FunctionDeclaration extends MaybeNamedFunctionDeclaration {
export interface VariableDeclaration extends BaseDeclaration {
type: "VariableDeclaration";
declarations: VariableDeclarator[];
kind: "var" | "let" | "const";
kind: "var" | "let" | "const" | "using" | "await using";
}
export interface VariableDeclarator extends BaseNode {

View File

@@ -1,6 +1,6 @@
{
"name": "@types/estree",
"version": "1.0.7",
"version": "1.0.8",
"description": "TypeScript definitions for estree",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree",
"license": "MIT",
@@ -21,7 +21,7 @@
"scripts": {},
"dependencies": {},
"peerDependencies": {},
"typesPublisherContentHash": "1ab11f4e78319f80655b4ca20a073da0dc035be5f3290fb0bfa1e08a055d0c7d",
"typeScriptVersion": "5.0",
"typesPublisherContentHash": "7a167b6e4a4d9f6e9a2cb9fd3fc45c885f89cbdeb44b3e5961bb057a45c082fd",
"typeScriptVersion": "5.1",
"nonNpm": true
}

15
node_modules/@types/fontkit/README.md generated vendored Normal file
View File

@@ -0,0 +1,15 @@
# Installation
> `npm install --save @types/fontkit`
# Summary
This package contains type definitions for fontkit (https://github.com/foliojs/fontkit#readme).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fontkit.
### Additional Details
* Last updated: Sat, 29 Mar 2025 17:33:03 GMT
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
# Credits
These definitions were written by [Stepan Mikhailiuk](https://github.com/stepancar).

406
node_modules/@types/fontkit/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,406 @@
/// <reference types="node" />
/**
* There are several different types of font objects that are returned by fontkit depending on the font format.
* They all inherit from the TTFFont class and have the same public API.
*/
export interface Font {
type: "TTF" | "WOFF" | "WOFF2";
postscriptName: string;
fullName: string;
familyName: string;
subfamilyName: string;
copyright: string;
version: number;
/** the size of the fonts internal coordinate grid */
unitsPerEm: number;
/** the fonts ascender */
ascent: number;
/** the fonts descender */
descent: number;
/** the amount of space that should be included between lines */
lineGap: number;
/** the offset from the normal underline position that should be used */
underlinePosition: number;
/** the weight of the underline that should be used */
underlineThickness: number;
/** if this is an italic font, the angle the cursor should be drawn at to match the font design */
italicAngle: number;
/** the height of capital letters above the baseline */
capHeight: number;
/** the height of lower case letters */
xHeight: number;
/** the fonts bounding box, i.e. the box that encloses all glyphs in the font */
bbox: BBOX;
/** the font metric table consisting of a set of metrics and other data required for OpenType fonts */
"OS/2": Os2Table;
/** the font's horizontal header table consisting of information needed to layout fonts with horizontal characters */
hhea: HHEA;
/** the number of glyphs in the font */
numGlyphs: number;
/** an array of all of the unicode code points supported by the font */
characterSet: number[];
/** an array of all OpenType feature tags (or mapped AAT tags) supported by the font */
availableFeatures: string[];
/** An object describing the available axes in a variable font. Keys are 4 letter axis tags. */
variationAxes: Partial<Record<string, { name: string; min: number; default: number; max: number }>>;
/**
* Returns an array of strings that map to the given glyph id.
*/
stringsForGlyph(gid: number): string[];
/**
* Maps a single unicode code point to a Glyph object.
* Does not perform any advanced substitutions (there is no context to do so).
*/
glyphForCodePoint(codePoint: number): Glyph;
/**
* Returns whether there is glyph in the font for the given unicode code point.
*/
hasGlyphForCodePoint(codePoint: number): boolean;
/**
* Returns an array of Glyph objects for the given string.
* This is only a one-to-one mapping from characters to glyphs.
* For most uses, you should use font.layout (described below), which
* provides a much more advanced mapping supporting AAT and OpenType shaping.
*/
glyphsForString(string: string): Glyph[];
/**
* Returns the advance width for a single glyph id.
*/
widthOfGlyph(glyph_id: number): number;
/**
* Returns a GlyphRun object, which includes an array of Glyphs and GlyphPositions for the given string.
*/
layout(
string: string,
features?: string[] | Record<string, boolean>,
script?: string,
language?: string,
direction?: string,
): GlyphRun;
/**
* Returns a glyph object for the given glyph id. You can pass the array of
* code points this glyph represents for your use later, and it will be
* stored in the glyph object.
*/
getGlyph(glyphId: number, codePoints?: number[]): Glyph;
/**
* an array of all OpenType feature tags
* same to availableFeatures but can input custom script and language params
*/
getAvailableFeatures(script: string | string[], language: string): string[];
/**
* Returns a Subset for this font.
*/
createSubset(): Subset;
/**
* Returns a new font with the given variation settings applied.
* Settings can either be an instance name, or an object containing
* variation tags as specified by the `variationAxes` property.
*/
getVariation(settings: object | string): Font;
// Standardized format plugin API
getFont(name: string): Font;
/**
* Gets a string from the font's `name` table
* `lang` is a BCP-47 language code.
*/
getName(key: string, lang: string): string | null;
setDefaultLanguage(lang: string): void;
}
export interface GlyphRun {
/**
* An array of Glyph objects in the run
*/
glyphs: Glyph[];
/**
* An array of GlyphPosition objects for each glyph in the run
*/
positions: GlyphPosition[];
/**
* The script that was requested for shaping. This was either passed in or detected automatically.
*/
script: string;
/**
* The language requested for shaping, as passed in. If `null`, the default language for the
* script was used.
*/
language: string;
/**
* The direction requested for shaping, as passed in (either ltr or rtl).
* If `null`, the default direction of the script is used.
*/
direction: string;
/**
* The features requested during shaping. This is a combination of user
* specified features and features chosen by the shaper.
*/
features: Record<string, boolean>;
/**
* The total advance width of the run.
*/
advanceWidth: number;
/**
* The total advance height of the run.
*/
advanceHeight: number;
/**
* The bounding box containing all glyphs in the run.
*/
bbox: BBOX;
}
/**
* Represents positioning information for a glyph in a GlyphRun.
*/
export interface GlyphPosition {
/** The amount to move the virtual pen in the X direction after rendering this glyph. */
xAdvance: number;
/** The amount to move the virtual pen in the Y direction after rendering this glyph. */
yAdvance: number;
/** The offset from the pen position in the X direction at which to render this glyph. */
xOffset: number;
/** The offset from the pen position in the Y direction at which to render this glyph. */
yOffset: number;
}
/**
* Glyph objects represent a glyph in the font. They have various properties for accessing metrics and
* the actual vector path the glyph represents, and methods for rendering the glyph to a graphics context.
*
* You do not create glyph objects directly. They are created by various methods on the font object.
* There are several subclasses of the base Glyph class internally that may be returned depending
* on the font format, but they all inherit from this class.
*/
export interface Glyph {
/** the glyph id in the font */
id: number;
/**
* An array of unicode code points that are represented by this glyph.
* There can be multiple code points in the case of ligatures and other glyphs
* that represent multiple visual characters.
*/
codePoints: number[];
/** a vector Path object representing the glyph */
path: Path;
/** the glyphs bounding box, i.e. the rectangle that encloses the glyph outline as tightly as possible. */
bbox: BBOX;
/**
* The glyphs control box.
* This is often the same as the bounding box, but is faster to compute.
* Because of the way bezier curves are defined, some of the control points
* can be outside of the bounding box. Where `bbox` takes this into account,
* `cbox` does not. Thus, cbox is less accurate, but faster to compute.
* See [here](http://www.freetype.org/freetype2/docs/glyphs/glyphs-6.html#section-2)
* for a more detailed description.
*/
cbox: BBOX;
/** the glyphs advance width */
advanceWidth: number;
/** is a mark glyph (non-spacing combining glyph) */
isMark: boolean;
/** is a ligature glyph (multiple character, spacing glyph) */
isLigature: boolean;
/** Renders the glyph to the given graphics context, at the specified font size. */
render(ctx: CanvasRenderingContext2D, size: number): void;
/** The glyph's name. Commonly the character, or 'space' or UTF**** */
name: string;
}
/**
* Path objects are returned by glyphs and represent the actual
* vector outlines for each glyph in the font. Paths can be converted
* to SVG path data strings, or to functions that can be applied to
* render the path to a graphics context.
*/
export interface Path {
commands: PathCommand[];
/**
* Gets the exact bounding box of the path by evaluating curve segments.
* Slower to compute than the control box, but more accurate.
*/
bbox: BBOX;
/**
* Gets the "control box" of a path.
* This is like the bounding box, but it includes all points including
* control points of bezier segments and is much faster to compute than
* the real bounding box.
*/
cbox: BBOX;
/**
* Compiles the path to a JavaScript function that can be applied with
* a graphics context in order to render the path.
*/
toFunction(): (ctx: CanvasRenderingContext2D) => void;
/** Converts the path to an SVG path data string */
toSVG(): string;
/** Transforms the path by the given matrix */
transform(m0: number, m1: number, m2: number, m3: number, m4: number, m5: number): this;
/** Translates the path by the given offset */
translate(x: number, y: number): this;
/** Rotates the path by the given angle (in radians) */
rotate(angle: number): this;
/** Scales the path */
scale(scaleX: number, scaleY?: number): this;
}
export interface PathCommand {
command: "moveTo" | "lineTo" | "quadraticCurveTo" | "bezierCurveTo" | "closePath";
args: number[];
}
export interface BBOX {
minX: number;
minY: number;
maxX: number;
maxY: number;
width: number;
height: number;
}
export interface Os2Table {
breakChar: number;
capHeight: number;
codePageRange: number[];
defaultChar: number;
fsSelection: {
italic: boolean;
negative: boolean;
outlined: boolean;
strikeout: boolean;
underscore: boolean;
useTypoMetrics: boolean;
wws: boolean;
bold: boolean;
regular: boolean;
oblique: boolean;
};
fsType: {
bitmapOnly: boolean;
editable: boolean;
noEmbedding: boolean;
noSubsetting: boolean;
viewOnly: boolean;
};
maxContent: number;
panose: number[];
sFamilyClass: number;
typoAscender: number;
typoDescender: number;
typoLineGap: number;
ulCharRange: number[];
usFirstCharIndex: number;
usLastCharIndex: number;
usWeightClass: number;
usWidthClass: number;
vendorID: string;
version: number;
winAscent: number;
winDescent: number;
xAvgCharWidth: number;
xHeight: number;
yStrikeoutPosition: number;
yStrikeoutSize: number;
ySubscriptXOffset: number;
ySubscriptXSize: number;
ySubscriptYOffset: number;
ySubscriptYSize: number;
ySuperscriptXOffset: number;
ySuperscriptXSize: number;
ySuperscriptYOffset: number;
ySuperscriptYSize: number;
}
export interface HHEA {
version: number;
ascent: number;
descent: number;
lineGap: number;
advanceWidthMax: number;
minLeftSideBearing: number;
minRightSideBearing: number;
xMaxExtent: number;
caretSlopeRise: number;
caretSlopeRun: number;
caretOffset: number;
metricDataFormat: number;
numberOfMetrics: number;
}
export interface FontCollection {
type: "TTC" | "DFont";
getFont(name: string): Font | null;
fonts: Font[];
}
export interface Subset {
includeGlyph(glyph: Glyph): boolean;
encode(): Uint8Array;
}
/**
* Opens a font file asynchronously, returning a promise that resolves with a font object.
* For collection fonts (such as TrueType collection files),
* you can pass a postscriptName to get that font out of the collection instead of a collection object.
*/
export function open(filename: string, postscriptName?: string): Promise<Font | FontCollection>;
/**
* Opens a font file synchronously, and returns a font object.
* For collection fonts (such as TrueType collection files),
* you can pass a postscriptName to get that font out of the collection instead of a collection object.
*/
export function openSync(filename: string, postscriptName?: string): Font | FontCollection;
/**
* Returns a font object for the given buffer.
* For collection fonts (such as TrueType collection files),
* you can pass a postscriptName to get that font out of the collection instead of a collection object.
*/
export function create(buffer: Buffer, postscriptName?: string): Font | FontCollection;

28
node_modules/@types/fontkit/package.json generated vendored Normal file
View File

@@ -0,0 +1,28 @@
{
"name": "@types/fontkit",
"version": "2.0.8",
"description": "TypeScript definitions for fontkit",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fontkit",
"license": "MIT",
"contributors": [
{
"name": "Stepan Mikhailiuk",
"githubUsername": "stepancar",
"url": "https://github.com/stepancar"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/fontkit"
},
"scripts": {},
"dependencies": {
"@types/node": "*"
},
"peerDependencies": {},
"typesPublisherContentHash": "faf41bdfceadd3493fe8bc4ffe11af803e3187ac5668828c846fd9be7017c554",
"typeScriptVersion": "5.0"
}

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

@@ -8,8 +8,8 @@ This package contains type definitions for node (https://nodejs.org/).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v20.
### Additional Details
* Last updated: Tue, 20 May 2025 23:02:19 GMT
* Last updated: Sat, 19 Jul 2025 00:47:11 GMT
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
# Credits
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [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), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky).
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [David Junger](https://github.com/touffy), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Sebastian Silbermann](https://github.com/eps1lon), [Wilco Bakker](https://github.com/WilcoBakker), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky).

View File

@@ -79,7 +79,9 @@ declare module "assert" {
* @return A function that wraps `fn`.
*/
calls(exact?: number): () => void;
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
calls(fn: undefined, exact?: number): () => void;
calls<Func extends (...args: any[]) => any>(fn: Func, exact?: number): Func;
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func | (() => void);
/**
* Example:
*

View File

@@ -1703,6 +1703,8 @@ declare module "buffer" {
* @return A reference to `buf`.
*/
fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
fill(value: string | Uint8Array | number, offset: number, encoding: BufferEncoding): this;
fill(value: string | Uint8Array | number, encoding: BufferEncoding): this;
/**
* If `value` is:
*
@@ -1772,6 +1774,7 @@ declare module "buffer" {
* @return The index of the first occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`.
*/
indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
indexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number;
/**
* Identical to `buf.indexOf()`, except the last occurrence of `value` is found
* rather than the first occurrence.
@@ -1840,6 +1843,7 @@ declare module "buffer" {
* @return The index of the last occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`.
*/
lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
lastIndexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number;
/**
* Equivalent to `buf.indexOf() !== -1`.
*
@@ -1870,6 +1874,7 @@ declare module "buffer" {
* @return `true` if `value` was found in `buf`, `false` otherwise.
*/
includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
includes(value: string | number | Buffer, encoding: BufferEncoding): boolean;
}
var Buffer: BufferConstructor;
/**

View File

@@ -297,7 +297,12 @@ declare module "diagnostics_channel" {
* @param thisArg The receiver to be used for the function call.
* @param args Optional arguments to pass to the function.
*/
runStores(): void;
runStores<ThisArg = any, Args extends any[] = any[], Result = any>(
context: ContextType,
fn: (this: ThisArg, ...args: Args) => Result,
thisArg?: ThisArg,
...args: Args
): Result;
}
interface TracingChannelSubscribers<ContextType extends object> {
start: (message: ContextType) => void;
@@ -441,12 +446,12 @@ declare module "diagnostics_channel" {
* @param args Optional arguments to pass to the function
* @return The return value of the given function
*/
traceSync<ThisArg = any, Args extends any[] = any[]>(
fn: (this: ThisArg, ...args: Args) => any,
traceSync<ThisArg = any, Args extends any[] = any[], Result = any>(
fn: (this: ThisArg, ...args: Args) => Result,
context?: ContextType,
thisArg?: ThisArg,
...args: Args
): void;
): Result;
/**
* Trace a promise-returning function call. This will always produce a `start event` and `end event` around the synchronous portion of the
* function execution, and will produce an `asyncStart event` and `asyncEnd event` when a promise continuation is reached. It may also
@@ -476,12 +481,12 @@ declare module "diagnostics_channel" {
* @param args Optional arguments to pass to the function
* @return Chained from promise returned by the given function
*/
tracePromise<ThisArg = any, Args extends any[] = any[]>(
fn: (this: ThisArg, ...args: Args) => Promise<any>,
tracePromise<ThisArg = any, Args extends any[] = any[], Result = any>(
fn: (this: ThisArg, ...args: Args) => Promise<Result>,
context?: ContextType,
thisArg?: ThisArg,
...args: Args
): void;
): Promise<Result>;
/**
* Trace a callback-receiving function call. This will always produce a `start event` and `end event` around the synchronous portion of the
* function execution, and will produce a `asyncStart event` and `asyncEnd event` around the callback execution. It may also produce an `error event` if the given function throws an error or
@@ -540,13 +545,13 @@ declare module "diagnostics_channel" {
* @param args Optional arguments to pass to the function
* @return The return value of the given function
*/
traceCallback<Fn extends (this: any, ...args: any) => any>(
fn: Fn,
position: number | undefined,
context: ContextType | undefined,
thisArg: any,
...args: Parameters<Fn>
): void;
traceCallback<ThisArg = any, Args extends any[] = any[], Result = any>(
fn: (this: ThisArg, ...args: Args) => Result,
position?: number,
context?: ContextType,
thisArg?: ThisArg,
...args: Args
): Result;
/**
* `true` if any of the individual channels has a subscriber, `false` if not.
*

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

@@ -249,6 +249,9 @@ declare module "dns" {
contactemail?: string | undefined;
contactphone?: string | undefined;
}
export interface AnyCaaRecord extends CaaRecord {
type: "CAA";
}
export interface MxRecord {
priority: number;
exchange: string;
@@ -307,6 +310,7 @@ declare module "dns" {
export type AnyRecord =
| AnyARecord
| AnyAaaaRecord
| AnyCaaRecord
| AnyCnameRecord
| AnyMxRecord
| AnyNaptrRecord
@@ -334,12 +338,7 @@ declare module "dns" {
): void;
export function resolve(
hostname: string,
rrtype: "A",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "AAAA",
rrtype: "A" | "AAAA" | "CNAME" | "NS" | "PTR",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
@@ -349,8 +348,8 @@ declare module "dns" {
): void;
export function resolve(
hostname: string,
rrtype: "CNAME",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
rrtype: "CAA",
callback: (err: NodeJS.ErrnoException | null, address: CaaRecord[]) => void,
): void;
export function resolve(
hostname: string,
@@ -362,16 +361,6 @@ declare module "dns" {
rrtype: "NAPTR",
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "NS",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "PTR",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "SOA",
@@ -392,12 +381,21 @@ declare module "dns" {
rrtype: string,
callback: (
err: NodeJS.ErrnoException | null,
addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[],
addresses:
| string[]
| CaaRecord[]
| MxRecord[]
| NaptrRecord[]
| SoaRecord
| SrvRecord[]
| string[][]
| AnyRecord[],
) => void,
): void;
export namespace resolve {
function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
function __promisify__(hostname: string, rrtype: "CAA"): Promise<CaaRecord[]>;
function __promisify__(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
@@ -406,7 +404,16 @@ declare module "dns" {
function __promisify__(
hostname: string,
rrtype: string,
): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
): Promise<
| string[]
| CaaRecord[]
| MxRecord[]
| NaptrRecord[]
| SoaRecord
| SrvRecord[]
| string[][]
| AnyRecord[]
>;
}
/**
* Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the `hostname`. The `addresses` argument passed to the `callback` function

View File

@@ -126,22 +126,24 @@ declare module "dns/promises" {
* @param [rrtype='A'] Resource record type.
*/
function resolve(hostname: string): Promise<string[]>;
function resolve(hostname: string, rrtype: "A"): Promise<string[]>;
function resolve(hostname: string, rrtype: "AAAA"): Promise<string[]>;
function resolve(hostname: string, rrtype: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
function resolve(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
function resolve(hostname: string, rrtype: "CAA"): Promise<CaaRecord[]>;
function resolve(hostname: string, rrtype: "CNAME"): Promise<string[]>;
function resolve(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
function resolve(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
function resolve(hostname: string, rrtype: "NS"): Promise<string[]>;
function resolve(hostname: string, rrtype: "PTR"): Promise<string[]>;
function resolve(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
function resolve(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>;
function resolve(
hostname: string,
rrtype: string,
): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
function resolve(hostname: string, rrtype: string): Promise<
| string[]
| CaaRecord[]
| MxRecord[]
| NaptrRecord[]
| SoaRecord
| SrvRecord[]
| string[][]
| AnyRecord[]
>;
/**
* Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv4
* addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`).

View File

@@ -1,77 +1,50 @@
export {}; // Don't export anything!
// Make this a module
export {};
//// DOM-like Events
// NB: The Event / EventTarget / EventListener implementations below were copied
// from lib.dom.d.ts, then edited to reflect Node's documentation at
// https://nodejs.org/api/events.html#class-eventtarget.
// Please read that link to understand important implementation differences.
// Conditional type aliases, which are later merged into the global scope.
// Will either be empty if the relevant web library is already present, or the @types/node definition otherwise.
// This conditional type will be the existing global Event in a browser, or
// the copy below in a Node environment.
type __Event = typeof globalThis extends { onmessage: any; Event: any } ? {}
: {
/** This is not used in Node.js and is provided purely for completeness. */
readonly bubbles: boolean;
/** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */
cancelBubble: () => void;
/** True if the event was created with the cancelable option */
readonly cancelable: boolean;
/** This is not used in Node.js and is provided purely for completeness. */
readonly composed: boolean;
/** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */
composedPath(): [EventTarget?];
/** Alias for event.target. */
readonly currentTarget: EventTarget | null;
/** Is true if cancelable is true and event.preventDefault() has been called. */
readonly defaultPrevented: boolean;
/** This is not used in Node.js and is provided purely for completeness. */
readonly eventPhase: 0 | 2;
/** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */
readonly isTrusted: boolean;
/** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */
preventDefault(): void;
/** This is not used in Node.js and is provided purely for completeness. */
returnValue: boolean;
/** Alias for event.target. */
readonly srcElement: EventTarget | null;
/** Stops the invocation of event listeners after the current one completes. */
stopImmediatePropagation(): void;
/** This is not used in Node.js and is provided purely for completeness. */
stopPropagation(): void;
/** The `EventTarget` dispatching the event */
readonly target: EventTarget | null;
/** The millisecond timestamp when the Event object was created. */
readonly timeStamp: number;
/** Returns the type of event, e.g. "click", "hashchange", or "submit". */
readonly type: string;
};
type __Event = typeof globalThis extends { onmessage: any } ? {} : Event;
interface Event {
readonly bubbles: boolean;
cancelBubble: boolean;
readonly cancelable: boolean;
readonly composed: boolean;
composedPath(): [EventTarget?];
readonly currentTarget: EventTarget | null;
readonly defaultPrevented: boolean;
readonly eventPhase: 0 | 2;
initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
readonly isTrusted: boolean;
preventDefault(): void;
readonly returnValue: boolean;
readonly srcElement: EventTarget | null;
stopImmediatePropagation(): void;
stopPropagation(): void;
readonly target: EventTarget | null;
readonly timeStamp: number;
readonly type: string;
}
// See comment above explaining conditional type
type __EventTarget = typeof globalThis extends { onmessage: any; EventTarget: any } ? {}
: {
/**
* Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value.
*
* If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched.
*
* The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification.
* Specifically, the `capture` option is used as part of the key when registering a `listener`.
* Any individual `listener` may be added once with `capture = false`, and once with `capture = true`.
*/
addEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: AddEventListenerOptions | boolean,
): void;
/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
dispatchEvent(event: Event): boolean;
/** Removes the event listener in target's event listener list with the same type, callback, and options. */
removeEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: EventListenerOptions | boolean,
): void;
};
type __CustomEvent<T = any> = typeof globalThis extends { onmessage: any } ? {} : CustomEvent<T>;
interface CustomEvent<T = any> extends Event {
readonly detail: T;
}
type __EventTarget = typeof globalThis extends { onmessage: any } ? {} : EventTarget;
interface EventTarget {
addEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: AddEventListenerOptions | boolean,
): void;
dispatchEvent(event: Event): boolean;
removeEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: EventListenerOptions | boolean,
): void;
}
interface EventInit {
bubbles?: boolean;
@@ -79,17 +52,17 @@ interface EventInit {
composed?: boolean;
}
interface CustomEventInit<T = any> extends EventInit {
detail?: T;
}
interface EventListenerOptions {
/** Not directly used by Node.js. Added for API completeness. Default: `false`. */
capture?: boolean;
}
interface AddEventListenerOptions extends EventListenerOptions {
/** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */
once?: boolean;
/** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */
passive?: boolean;
/** The listener will be removed when the given AbortSignal object's `abort()` method is called. */
signal?: AbortSignal;
}
@@ -101,24 +74,26 @@ interface EventListenerObject {
handleEvent(object: Event): void;
}
import {} from "events"; // Make this an ambient declaration
// Merge conditional interfaces into global scope, and conditionally declare global constructors.
declare global {
/** An event which takes place in the DOM. */
interface Event extends __Event {}
var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
: {
prototype: __Event;
new(type: string, eventInitDict?: EventInit): __Event;
prototype: Event;
new(type: string, eventInitDict?: EventInit): Event;
};
interface CustomEvent<T = any> extends __CustomEvent<T> {}
var CustomEvent: typeof globalThis extends { onmessage: any; CustomEvent: infer T } ? T
: {
prototype: CustomEvent;
new<T>(type: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
};
/**
* EventTarget is a DOM interface implemented by objects that can
* receive events and may have listeners for them.
*/
interface EventTarget extends __EventTarget {}
var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
: {
prototype: __EventTarget;
new(): __EventTarget;
prototype: EventTarget;
new(): EventTarget;
};
}

View File

@@ -12,6 +12,7 @@ type _RequestInit = typeof globalThis extends { onmessage: any } ? {}
: import("undici-types").RequestInit;
type _ResponseInit = typeof globalThis extends { onmessage: any } ? {}
: import("undici-types").ResponseInit;
type _EventSource = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").EventSource;
// #endregion Fetch and friends
// #region DOMException
@@ -251,11 +252,6 @@ declare global {
// Global DOM types
function structuredClone<T>(
value: T,
transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> },
): T;
interface DOMException extends _DOMException {}
var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
: NodeDOMExceptionConstructor;
@@ -332,5 +328,8 @@ declare global {
} ? T
: typeof import("undici-types").MessageEvent;
interface EventSource extends _EventSource {}
var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T
: typeof import("undici-types").EventSource;
// #endregion fetch
}

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

@@ -909,7 +909,7 @@ declare module "http" {
* the request body should be sent.
* @since v10.0.0
*/
writeProcessing(): void;
writeProcessing(callback?: () => void): void;
}
interface InformationEvent {
statusCode: number;
@@ -1568,6 +1568,68 @@ declare module "http" {
* @since v0.11.4
*/
destroy(): void;
/**
* Produces a socket/stream to be used for HTTP requests.
*
* By default, this function is the same as `net.createConnection()`. However,
* custom agents may override this method in case greater flexibility is desired.
*
* A socket/stream can be supplied in one of two ways: by returning the
* socket/stream from this function, or by passing the socket/stream to `callback`.
*
* This method is guaranteed to return an instance of the `net.Socket` class,
* a subclass of `stream.Duplex`, unless the user specifies a socket
* type other than `net.Socket`.
*
* `callback` has a signature of `(err, stream)`.
* @since v0.11.4
* @param options Options containing connection details. Check `createConnection` for the format of the options
* @param callback Callback function that receives the created socket
*/
createConnection(
options: ClientRequestArgs,
callback?: (err: Error | null, stream: stream.Duplex) => void,
): stream.Duplex;
/**
* Called when `socket` is detached from a request and could be persisted by the`Agent`. Default behavior is to:
*
* ```js
* socket.setKeepAlive(true, this.keepAliveMsecs);
* socket.unref();
* return true;
* ```
*
* This method can be overridden by a particular `Agent` subclass. If this
* method returns a falsy value, the socket will be destroyed instead of persisting
* it for use with the next request.
*
* The `socket` argument can be an instance of `net.Socket`, a subclass of `stream.Duplex`.
* @since v8.1.0
*/
keepSocketAlive(socket: stream.Duplex): void;
/**
* Called when `socket` is attached to `request` after being persisted because of
* the keep-alive options. Default behavior is to:
*
* ```js
* socket.ref();
* ```
*
* This method can be overridden by a particular `Agent` subclass.
*
* The `socket` argument can be an instance of `net.Socket`, a subclass of `stream.Duplex`.
* @since v8.1.0
*/
reuseSocket(socket: stream.Duplex, request: ClientRequest): void;
/**
* Get a unique name for a set of request options, to determine whether a
* connection can be reused. For an HTTP agent, this returns`host:port:localAddress` or `host:port:localAddress:family`. For an HTTPS agent,
* the name includes the CA, cert, ciphers, and other HTTPS/TLS-specific options
* that determine socket reusability.
* @since v0.11.4
* @param options A set of options providing information for name generation
*/
getName(options?: ClientRequestArgs): string;
}
const METHODS: string[];
const STATUS_CODES: {

70
node_modules/@types/node/http2.d.ts generated vendored
View File

@@ -1223,14 +1223,66 @@ declare module "http2" {
}
// Http2Server
export interface SessionOptions {
/**
* Sets the maximum dynamic table size for deflating header fields.
* @default 4Kib
*/
maxDeflateDynamicTableSize?: number | undefined;
/**
* Sets the maximum number of settings entries per `SETTINGS` frame.
* The minimum value allowed is `1`.
* @default 32
*/
maxSettings?: number | undefined;
/**
* Sets the maximum memory that the `Http2Session` is permitted to use.
* The value is expressed in terms of number of megabytes, e.g. `1` equal 1 megabyte.
* The minimum value allowed is `1`.
* This is a credit based limit, existing `Http2Stream`s may cause this limit to be exceeded,
* but new `Http2Stream` instances will be rejected while this limit is exceeded.
* The current number of `Http2Stream` sessions, the current memory use of the header compression tables,
* current data queued to be sent, and unacknowledged `PING` and `SETTINGS` frames are all counted towards the current limit.
* @default 10
*/
maxSessionMemory?: number | undefined;
/**
* Sets the maximum number of header entries.
* This is similar to `server.maxHeadersCount` or `request.maxHeadersCount` in the `node:http` module.
* The minimum value is `1`.
* @default 128
*/
maxHeaderListPairs?: number | undefined;
/**
* Sets the maximum number of outstanding, unacknowledged pings.
* @default 10
*/
maxOutstandingPings?: number | undefined;
/**
* Sets the maximum allowed size for a serialized, compressed block of headers.
* Attempts to send headers that exceed this limit will result in
* a `'frameError'` event being emitted and the stream being closed and destroyed.
*/
maxSendHeaderBlockLength?: number | undefined;
/**
* Strategy used for determining the amount of padding to use for `HEADERS` and `DATA` frames.
* @default http2.constants.PADDING_STRATEGY_NONE
*/
paddingStrategy?: number | undefined;
/**
* Sets the maximum number of concurrent streams for the remote peer as if a `SETTINGS` frame had been received.
* Will be overridden if the remote peer sets its own value for `maxConcurrentStreams`.
* @default 100
*/
peerMaxConcurrentStreams?: number | undefined;
/**
* The initial settings to send to the remote peer upon connection.
*/
settings?: Settings | undefined;
/**
* The array of integer values determines the settings types,
* which are included in the `CustomSettings`-property of the received remoteSettings.
* Please see the `CustomSettings`-property of the `Http2Settings` object for more information, on the allowed setting types.
*/
remoteCustomSettings?: number[] | undefined;
/**
* Specifies a timeout in milliseconds that
@@ -1239,11 +1291,27 @@ declare module "http2" {
* @default 100000
*/
unknownProtocolTimeout?: number | undefined;
selectPadding?(frameLen: number, maxFrameLen: number): number;
}
export interface ClientSessionOptions extends SessionOptions {
/**
* Sets the maximum number of reserved push streams the client will accept at any given time.
* Once the current number of currently reserved push streams exceeds reaches this limit,
* new push streams sent by the server will be automatically rejected.
* The minimum allowed value is 0. The maximum allowed value is 2<sup>32</sup>-1.
* A negative value sets this option to the maximum allowed value.
* @default 200
*/
maxReservedRemoteStreams?: number | undefined;
/**
* An optional callback that receives the `URL` instance passed to `connect` and the `options` object,
* and returns any `Duplex` stream that is to be used as the connection for this session.
*/
createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined;
/**
* The protocol to connect with, if not set in the `authority`.
* Value may be either `'http:'` or `'https:'`.
* @default 'https:'
*/
protocol?: "http:" | "https:" | undefined;
}
export interface ServerSessionOptions<

View File

@@ -1703,6 +1703,110 @@ declare module 'inspector' {
message: string;
}
}
namespace Network {
/**
* Resource type as it was perceived by the rendering engine.
*/
type ResourceType = string;
/**
* Unique request identifier.
*/
type RequestId = string;
/**
* UTC time in seconds, counted from January 1, 1970.
*/
type TimeSinceEpoch = number;
/**
* Monotonically increasing time in seconds since an arbitrary point in the past.
*/
type MonotonicTime = number;
/**
* HTTP request data.
*/
interface Request {
url: string;
method: string;
headers: Headers;
}
/**
* HTTP response data.
*/
interface Response {
url: string;
status: number;
statusText: string;
headers: Headers;
}
/**
* Request / response headers as keys / values of JSON object.
*/
interface Headers {
}
interface RequestWillBeSentEventDataType {
/**
* Request identifier.
*/
requestId: RequestId;
/**
* Request data.
*/
request: Request;
/**
* Timestamp.
*/
timestamp: MonotonicTime;
/**
* Timestamp.
*/
wallTime: TimeSinceEpoch;
}
interface ResponseReceivedEventDataType {
/**
* Request identifier.
*/
requestId: RequestId;
/**
* Timestamp.
*/
timestamp: MonotonicTime;
/**
* Resource type.
*/
type: ResourceType;
/**
* Response data.
*/
response: Response;
}
interface LoadingFailedEventDataType {
/**
* Request identifier.
*/
requestId: RequestId;
/**
* Timestamp.
*/
timestamp: MonotonicTime;
/**
* Resource type.
*/
type: ResourceType;
/**
* Error message.
*/
errorText: string;
}
interface LoadingFinishedEventDataType {
/**
* Request identifier.
*/
requestId: RequestId;
/**
* Timestamp.
*/
timestamp: MonotonicTime;
}
}
namespace NodeRuntime {
interface NotifyWhenWaitingForDisconnectParameterType {
enabled: boolean;
@@ -2076,6 +2180,14 @@ declare module 'inspector' {
*/
post(method: 'NodeWorker.detach', params?: NodeWorker.DetachParameterType, callback?: (err: Error | null) => void): void;
post(method: 'NodeWorker.detach', callback?: (err: Error | null) => void): void;
/**
* Disables network tracking, prevents network events from being sent to the client.
*/
post(method: 'Network.disable', callback?: (err: Error | null) => void): void;
/**
* Enables network tracking, network events will now be delivered to the client.
*/
post(method: 'Network.enable', callback?: (err: Error | null) => void): void;
/**
* Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`.
*/
@@ -2185,6 +2297,16 @@ declare module 'inspector' {
* (session ID is provided in attachedToWorker notification).
*/
addListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
/**
* Fired when page is about to send HTTP request.
*/
addListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
/**
* Fired when HTTP response is available.
*/
addListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
addListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
addListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -2224,6 +2346,10 @@ declare module 'inspector' {
emit(event: 'NodeWorker.attachedToWorker', message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>): boolean;
emit(event: 'NodeWorker.detachedFromWorker', message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>): boolean;
emit(event: 'NodeWorker.receivedMessageFromWorker', message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>): boolean;
emit(event: 'Network.requestWillBeSent', message: InspectorNotification<Network.RequestWillBeSentEventDataType>): boolean;
emit(event: 'Network.responseReceived', message: InspectorNotification<Network.ResponseReceivedEventDataType>): boolean;
emit(event: 'Network.loadingFailed', message: InspectorNotification<Network.LoadingFailedEventDataType>): boolean;
emit(event: 'Network.loadingFinished', message: InspectorNotification<Network.LoadingFinishedEventDataType>): boolean;
emit(event: 'NodeRuntime.waitingForDisconnect'): boolean;
emit(event: 'NodeRuntime.waitingForDebugger'): boolean;
on(event: string, listener: (...args: any[]) => void): this;
@@ -2321,6 +2447,16 @@ declare module 'inspector' {
* (session ID is provided in attachedToWorker notification).
*/
on(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
/**
* Fired when page is about to send HTTP request.
*/
on(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
/**
* Fired when HTTP response is available.
*/
on(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
on(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
on(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -2428,6 +2564,16 @@ declare module 'inspector' {
* (session ID is provided in attachedToWorker notification).
*/
once(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
/**
* Fired when page is about to send HTTP request.
*/
once(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
/**
* Fired when HTTP response is available.
*/
once(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
once(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
once(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -2535,6 +2681,16 @@ declare module 'inspector' {
* (session ID is provided in attachedToWorker notification).
*/
prependListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
/**
* Fired when page is about to send HTTP request.
*/
prependListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
/**
* Fired when HTTP response is available.
*/
prependListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
prependListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
prependListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -2642,6 +2798,16 @@ declare module 'inspector' {
* (session ID is provided in attachedToWorker notification).
*/
prependOnceListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
/**
* Fired when page is about to send HTTP request.
*/
prependOnceListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
/**
* Fired when HTTP response is available.
*/
prependOnceListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
prependOnceListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
prependOnceListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -2699,7 +2865,7 @@ declare module 'inspector' {
/**
* Blocks until a client (existing or connected later) has sent `Runtime.runIfWaitingForDebugger` command.
*
*
* An exception will be thrown if there is no active inspector.
* @since v12.7.0
*/
@@ -2737,6 +2903,46 @@ declare module 'inspector' {
* @since v11.0.0
*/
const console: InspectorConsole;
// DevTools protocol event broadcast methods
namespace Network {
/**
* This feature is only available with the `--experimental-network-inspection` flag enabled.
*
* Broadcasts the `Network.requestWillBeSent` event to connected frontends. This event indicates that
* the application is about to send an HTTP request.
* @since v22.6.0
* @experimental
*/
function requestWillBeSent(params: RequestWillBeSentEventDataType): void;
/**
* This feature is only available with the `--experimental-network-inspection` flag enabled.
*
* Broadcasts the `Network.responseReceived` event to connected frontends. This event indicates that
* HTTP response is available.
* @since v22.6.0
* @experimental
*/
function responseReceived(params: ResponseReceivedEventDataType): void;
/**
* This feature is only available with the `--experimental-network-inspection` flag enabled.
*
* Broadcasts the `Network.loadingFinished` event to connected frontends. This event indicates that
* HTTP request has finished loading.
* @since v22.6.0
* @experimental
*/
function loadingFinished(params: LoadingFinishedEventDataType): void;
/**
* This feature is only available with the `--experimental-network-inspection` flag enabled.
*
* Broadcasts the `Network.loadingFailed` event to connected frontends. This event indicates that
* HTTP request has failed to load.
* @since v22.7.0
* @experimental
*/
function loadingFailed(params: LoadingFailedEventDataType): void;
}
}
/**
@@ -2770,6 +2976,7 @@ declare module 'inspector/promises' {
HeapProfiler,
NodeTracing,
NodeWorker,
Network,
NodeRuntime,
} from 'inspector';
@@ -2816,7 +3023,7 @@ declare module 'inspector/promises' {
* } catch (error) {
* console.error(error);
* }
* // Output: { result: { type: 'number', value: 4, description: '4' } }
* // Output: { result: { type: 'number', value: 4, description: '4' } }
* ```
*
* The latest version of the V8 inspector protocol is published on the
@@ -3087,6 +3294,14 @@ declare module 'inspector/promises' {
* Detached from the worker with given sessionId.
*/
post(method: 'NodeWorker.detach', params?: NodeWorker.DetachParameterType): Promise<void>;
/**
* Disables network tracking, prevents network events from being sent to the client.
*/
post(method: 'Network.disable'): Promise<void>;
/**
* Enables network tracking, network events will now be delivered to the client.
*/
post(method: 'Network.enable'): Promise<void>;
/**
* Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`.
*/
@@ -3195,6 +3410,16 @@ declare module 'inspector/promises' {
* (session ID is provided in attachedToWorker notification).
*/
addListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
/**
* Fired when page is about to send HTTP request.
*/
addListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
/**
* Fired when HTTP response is available.
*/
addListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
addListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
addListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -3234,6 +3459,10 @@ declare module 'inspector/promises' {
emit(event: 'NodeWorker.attachedToWorker', message: InspectorNotification<NodeWorker.AttachedToWorkerEventDataType>): boolean;
emit(event: 'NodeWorker.detachedFromWorker', message: InspectorNotification<NodeWorker.DetachedFromWorkerEventDataType>): boolean;
emit(event: 'NodeWorker.receivedMessageFromWorker', message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>): boolean;
emit(event: 'Network.requestWillBeSent', message: InspectorNotification<Network.RequestWillBeSentEventDataType>): boolean;
emit(event: 'Network.responseReceived', message: InspectorNotification<Network.ResponseReceivedEventDataType>): boolean;
emit(event: 'Network.loadingFailed', message: InspectorNotification<Network.LoadingFailedEventDataType>): boolean;
emit(event: 'Network.loadingFinished', message: InspectorNotification<Network.LoadingFinishedEventDataType>): boolean;
emit(event: 'NodeRuntime.waitingForDisconnect'): boolean;
emit(event: 'NodeRuntime.waitingForDebugger'): boolean;
on(event: string, listener: (...args: any[]) => void): this;
@@ -3331,6 +3560,16 @@ declare module 'inspector/promises' {
* (session ID is provided in attachedToWorker notification).
*/
on(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
/**
* Fired when page is about to send HTTP request.
*/
on(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
/**
* Fired when HTTP response is available.
*/
on(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
on(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
on(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -3438,6 +3677,16 @@ declare module 'inspector/promises' {
* (session ID is provided in attachedToWorker notification).
*/
once(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
/**
* Fired when page is about to send HTTP request.
*/
once(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
/**
* Fired when HTTP response is available.
*/
once(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
once(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
once(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -3545,6 +3794,16 @@ declare module 'inspector/promises' {
* (session ID is provided in attachedToWorker notification).
*/
prependListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
/**
* Fired when page is about to send HTTP request.
*/
prependListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
/**
* Fired when HTTP response is available.
*/
prependListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
prependListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
prependListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -3652,6 +3911,16 @@ declare module 'inspector/promises' {
* (session ID is provided in attachedToWorker notification).
*/
prependOnceListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification<NodeWorker.ReceivedMessageFromWorkerEventDataType>) => void): this;
/**
* Fired when page is about to send HTTP request.
*/
prependOnceListener(event: 'Network.requestWillBeSent', listener: (message: InspectorNotification<Network.RequestWillBeSentEventDataType>) => void): this;
/**
* Fired when HTTP response is available.
*/
prependOnceListener(event: 'Network.responseReceived', listener: (message: InspectorNotification<Network.ResponseReceivedEventDataType>) => void): this;
prependOnceListener(event: 'Network.loadingFailed', listener: (message: InspectorNotification<Network.LoadingFailedEventDataType>) => void): this;
prependOnceListener(event: 'Network.loadingFinished', listener: (message: InspectorNotification<Network.LoadingFinishedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -3682,6 +3951,7 @@ declare module 'inspector/promises' {
HeapProfiler,
NodeTracing,
NodeWorker,
Network,
NodeRuntime,
};
}

View File

@@ -200,7 +200,7 @@ declare module "module" {
importAttributes: ImportAttributes;
}
interface LoadFnOutput {
format: ModuleFormat;
format: string | null | undefined;
/**
* A signal that this hook intends to terminate the chain of `resolve` hooks.
* @default false

View File

@@ -1,6 +1,6 @@
{
"name": "@types/node",
"version": "20.17.50",
"version": "20.19.9",
"description": "TypeScript definitions for node",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
"license": "MIT",
@@ -15,11 +15,6 @@
"githubUsername": "jkomyno",
"url": "https://github.com/jkomyno"
},
{
"name": "Alvis HT Tang",
"githubUsername": "alvis",
"url": "https://github.com/alvis"
},
{
"name": "Andrew Makarov",
"githubUsername": "r3nya",
@@ -30,56 +25,11 @@
"githubUsername": "btoueg",
"url": "https://github.com/btoueg"
},
{
"name": "Chigozirim C.",
"githubUsername": "smac89",
"url": "https://github.com/smac89"
},
{
"name": "David Junger",
"githubUsername": "touffy",
"url": "https://github.com/touffy"
},
{
"name": "Deividas Bakanas",
"githubUsername": "DeividasBakanas",
"url": "https://github.com/DeividasBakanas"
},
{
"name": "Eugene Y. Q. Shen",
"githubUsername": "eyqs",
"url": "https://github.com/eyqs"
},
{
"name": "Hannes Magnusson",
"githubUsername": "Hannes-Magnusson-CK",
"url": "https://github.com/Hannes-Magnusson-CK"
},
{
"name": "Huw",
"githubUsername": "hoo29",
"url": "https://github.com/hoo29"
},
{
"name": "Kelvin Jin",
"githubUsername": "kjin",
"url": "https://github.com/kjin"
},
{
"name": "Klaus Meinhardt",
"githubUsername": "ajafff",
"url": "https://github.com/ajafff"
},
{
"name": "Lishude",
"githubUsername": "islishude",
"url": "https://github.com/islishude"
},
{
"name": "Mariusz Wiktorczyk",
"githubUsername": "mwiktorczyk",
"url": "https://github.com/mwiktorczyk"
},
{
"name": "Mohsen Azimi",
"githubUsername": "mohsen1",
@@ -90,46 +40,16 @@
"githubUsername": "galkin",
"url": "https://github.com/galkin"
},
{
"name": "Parambir Singh",
"githubUsername": "parambirs",
"url": "https://github.com/parambirs"
},
{
"name": "Sebastian Silbermann",
"githubUsername": "eps1lon",
"url": "https://github.com/eps1lon"
},
{
"name": "Thomas den Hollander",
"githubUsername": "ThomasdenH",
"url": "https://github.com/ThomasdenH"
},
{
"name": "Wilco Bakker",
"githubUsername": "WilcoBakker",
"url": "https://github.com/WilcoBakker"
},
{
"name": "wwwy3y3",
"githubUsername": "wwwy3y3",
"url": "https://github.com/wwwy3y3"
},
{
"name": "Samuel Ainsworth",
"githubUsername": "samuela",
"url": "https://github.com/samuela"
},
{
"name": "Kyle Uehlein",
"githubUsername": "kuehlein",
"url": "https://github.com/kuehlein"
},
{
"name": "Thanik Bhongbhibhat",
"githubUsername": "bhongy",
"url": "https://github.com/bhongy"
},
{
"name": "Marcin Kopacz",
"githubUsername": "chyzwar",
@@ -212,9 +132,9 @@
},
"scripts": {},
"dependencies": {
"undici-types": "~6.19.2"
"undici-types": "~6.21.0"
},
"peerDependencies": {},
"typesPublisherContentHash": "54d753d629b4c086700669f5792ec798007247c341fb4c90bda11c64170b214d",
"typesPublisherContentHash": "3750c2bc17c26965bb2e8e18153c13e2b78690ea2e5d00315a7b0f1a3375a950",
"typeScriptVersion": "5.1"
}

View File

@@ -116,6 +116,20 @@ declare module "perf_hooks" {
class PerformanceMeasure extends PerformanceEntry {
readonly entryType: "measure";
}
interface UVMetrics {
/**
* Number of event loop iterations.
*/
readonly loopCount: number;
/**
* Number of events that have been processed by the event handler.
*/
readonly events: number;
/**
* Number of events that were waiting to be processed when the event provider was called.
*/
readonly eventsWaiting: number;
}
/**
* _This property is an extension by Node.js. It is not available in Web browsers._
*
@@ -165,6 +179,16 @@ declare module "perf_hooks" {
* @since v8.5.0
*/
readonly nodeStart: number;
/**
* This is a wrapper to the `uv_metrics_info` function.
* It returns the current set of event loop metrics.
*
* It is recommended to use this property inside a function whose execution was
* scheduled using `setImmediate` to avoid collecting metrics before finishing all
* operations scheduled during the current loop iteration.
* @since v20.18.0
*/
readonly uvMetricsInfo: UVMetrics;
/**
* The high resolution millisecond timestamp at which the V8 platform was
* initialized.
@@ -563,6 +587,11 @@ declare module "perf_hooks" {
buffered?: boolean | undefined;
},
): void;
/**
* @since v16.0.0
* @returns Current list of entries stored in the performance observer, emptying it out.
*/
takeRecords(): PerformanceEntry[];
}
/**
* Provides detailed network timing data regarding the loading of an application's resources.
@@ -830,12 +859,12 @@ declare module "perf_hooks" {
* The minimum recordable value. Must be an integer value greater than 0.
* @default 1
*/
min?: number | bigint | undefined;
lowest?: number | bigint | undefined;
/**
* The maximum recordable value. Must be an integer value greater than min.
* @default Number.MAX_SAFE_INTEGER
*/
max?: number | bigint | undefined;
highest?: number | bigint | undefined;
/**
* The number of accuracy digits. Must be a number between 1 and 5.
* @default 3

View File

@@ -168,6 +168,59 @@ declare module "process" {
libUrl?: string | undefined;
lts?: string | undefined;
}
interface ProcessFeatures {
/**
* A boolean value that is `true` if the current Node.js build is caching builtin modules.
* @since v12.0.0
*/
readonly cached_builtins: boolean;
/**
* A boolean value that is `true` if the current Node.js build is a debug build.
* @since v0.5.5
*/
readonly debug: boolean;
/**
* A boolean value that is `true` if the current Node.js build includes the inspector.
* @since v11.10.0
*/
readonly inspector: boolean;
/**
* A boolean value that is `true` if the current Node.js build includes support for IPv6.
* @since v0.5.3
*/
readonly ipv6: boolean;
/**
* A boolean value that is `true` if the current Node.js build supports
* [loading ECMAScript modules using `require()`](https://nodejs.org/docs/latest-v20.x/api/modules.html#loading-ecmascript-modules-using-require).
* @since v20.19.0
*/
readonly require_module: boolean;
/**
* A boolean value that is `true` if the current Node.js build includes support for TLS.
* @since v0.5.3
*/
readonly tls: boolean;
/**
* A boolean value that is `true` if the current Node.js build includes support for ALPN in TLS.
* @since v4.8.0
*/
readonly tls_alpn: boolean;
/**
* A boolean value that is `true` if the current Node.js build includes support for OCSP in TLS.
* @since v0.11.13
*/
readonly tls_ocsp: boolean;
/**
* A boolean value that is `true` if the current Node.js build includes support for SNI in TLS.
* @since v0.5.3
*/
readonly tls_sni: boolean;
/**
* A boolean value that is `true` if the current Node.js build includes support for libuv.
* @since v0.5.3
*/
readonly uv: boolean;
}
interface ProcessVersions extends Dict<string> {
http_parser: string;
node: string;
@@ -1612,16 +1665,7 @@ declare module "process" {
* @since v3.0.0
*/
readonly release: ProcessRelease;
features: {
inspector: boolean;
debug: boolean;
uv: boolean;
ipv6: boolean;
tls_alpn: boolean;
tls_sni: boolean;
tls_ocsp: boolean;
tls: boolean;
};
readonly features: ProcessFeatures;
/**
* `process.umask()` returns the Node.js process's file mode creation mask. Child
* processes inherit the mask from the parent process.

View File

@@ -737,6 +737,12 @@ declare module "stream" {
* @since v11.4.0
*/
readonly writable: boolean;
/**
* Returns whether the stream was destroyed or errored before emitting `'finish'`.
* @since v18.0.0, v16.17.0
* @experimental
*/
readonly writableAborted: boolean;
/**
* Is `true` after `writable.end()` has been called. This property
* does not indicate whether the data has been flushed, for this use `writable.writableFinished` instead.

3086
node_modules/@types/node/test.d.ts generated vendored

File diff suppressed because it is too large Load Diff

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

@@ -817,6 +817,12 @@ declare module "tls" {
* This option cannot be used with the `ALPNProtocols` option, and setting both options will throw an error.
*/
ALPNCallback?: ((arg: { servername: string; protocols: string[] }) => string | undefined) | undefined;
/**
* Treat intermediate (non-self-signed)
* certificates in the trust CA certificate list as trusted.
* @since v22.9.0, v20.18.0
*/
allowPartialTrustChain?: boolean | undefined;
/**
* Optionally override the trusted CA certificates. Default is to trust
* the well-known CAs curated by Mozilla. Mozilla's CAs are completely

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

@@ -437,6 +437,15 @@ declare module "url" {
* @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first.
*/
static canParse(input: string, base?: string): boolean;
/**
* Parses a string as a URL. If `base` is provided, it will be used as the base URL for the purpose of resolving non-absolute `input` URLs.
* Returns `null` if `input` is not a valid.
* @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is
* `converted to a string` first.
* @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first.
* @since v20.18.0
*/
static parse(input: string, base?: string): URL | null;
constructor(input: string | { toString: () => string }, base?: string | URL);
/**
* Gets and sets the fragment portion of the URL.

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

@@ -1186,7 +1186,7 @@ declare module "util" {
* @param content The raw contents of a `.env` file.
* @since v20.12.0
*/
export function parseEnv(content: string): object;
export function parseEnv(content: string): NodeJS.Dict<string>;
// https://nodejs.org/docs/latest/api/util.html#foreground-colors
type ForegroundColors =
| "black"
@@ -1865,6 +1865,18 @@ declare module "util/types" {
* @since v10.0.0
*/
function isBigInt64Array(value: unknown): value is BigInt64Array;
/**
* Returns `true` if the value is a BigInt object, e.g. created
* by `Object(BigInt(123))`.
*
* ```js
* util.types.isBigIntObject(Object(BigInt(123))); // Returns true
* util.types.isBigIntObject(BigInt(123)); // Returns false
* util.types.isBigIntObject(123); // Returns false
* ```
* @since v10.4.0
*/
function isBigIntObject(object: unknown): object is BigInt;
/**
* Returns `true` if the value is a `BigUint64Array` instance.
*

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

@@ -56,6 +56,11 @@ declare module "vm" {
*/
columnOffset?: number | undefined;
}
type DynamicModuleLoader<T> = (
specifier: string,
referrer: T,
importAttributes: ImportAttributes,
) => Module | Promise<Module>;
interface ScriptOptions extends BaseOptions {
/**
* Provides an optional data with V8's code cache data for the supplied source.
@@ -69,7 +74,7 @@ declare module "vm" {
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v20.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
*/
importModuleDynamically?:
| ((specifier: string, script: Script, importAttributes: ImportAttributes) => Module | Promise<Module>)
| DynamicModuleLoader<Script>
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
| undefined;
}
@@ -114,14 +119,30 @@ declare module "vm" {
* Provides an optional data with V8's code cache data for the supplied source.
*/
cachedData?: ScriptOptions["cachedData"] | undefined;
importModuleDynamically?: ScriptOptions["importModuleDynamically"];
/**
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
*/
importModuleDynamically?:
| DynamicModuleLoader<Script>
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
| undefined;
}
interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions {
/**
* Provides an optional data with V8's code cache data for the supplied source.
*/
cachedData?: ScriptOptions["cachedData"] | undefined;
importModuleDynamically?: ScriptOptions["importModuleDynamically"];
/**
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
*/
importModuleDynamically?:
| DynamicModuleLoader<Script>
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
| undefined;
}
interface CompileFunctionOptions extends BaseOptions {
/**
@@ -141,6 +162,15 @@ declare module "vm" {
* An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling
*/
contextExtensions?: Object[] | undefined;
/**
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
*/
importModuleDynamically?:
| DynamicModuleLoader<ReturnType<typeof compileFunction>>
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
| undefined;
}
interface CreateContextOptions {
/**
@@ -175,6 +205,15 @@ declare module "vm" {
* If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
*/
microtaskMode?: "afterEvaluate" | undefined;
/**
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
*/
importModuleDynamically?:
| DynamicModuleLoader<Context>
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
| undefined;
}
type MeasureMemoryMode = "summary" | "detailed";
interface MeasureMemoryOptions {
@@ -236,16 +275,23 @@ declare module "vm" {
*/
runInContext(contextifiedObject: Context, options?: RunningScriptOptions): any;
/**
* First contextifies the given `contextObject`, runs the compiled code contained
* by the `vm.Script` object within the created context, and returns the result.
* Running code does not have access to local scope.
* This method is a shortcut to `script.runInContext(vm.createContext(options), options)`.
* It does several things at once:
*
* 1. Creates a new context.
* 2. If `contextObject` is an object, contextifies it with the new context.
* If `contextObject` is undefined, creates a new object and contextifies it.
* If `contextObject` is `vm.constants.DONT_CONTEXTIFY`, don't contextify anything.
* 3. Runs the compiled code contained by the `vm.Script` object within the created context. The code
* does not have access to the scope in which this method is called.
* 4. Returns the result.
*
* The following example compiles code that sets a global variable, then executes
* the code multiple times in different contexts. The globals are set on and
* contained within each individual `context`.
*
* ```js
* import vm from 'node:vm';
* const vm = require('node:vm');
*
* const script = new vm.Script('globalVar = "set"');
*
@@ -256,12 +302,22 @@ declare module "vm" {
*
* console.log(contexts);
* // Prints: [{ globalVar: 'set' }, { globalVar: 'set' }, { globalVar: 'set' }]
*
* // This would throw if the context is created from a contextified object.
* // vm.constants.DONT_CONTEXTIFY allows creating contexts with ordinary
* // global objects that can be frozen.
* const freezeScript = new vm.Script('Object.freeze(globalThis); globalThis;');
* const frozenContext = freezeScript.runInNewContext(vm.constants.DONT_CONTEXTIFY);
* ```
* @since v0.3.1
* @param contextObject An object that will be `contextified`. If `undefined`, a new object will be created.
* @param contextObject Either `vm.constants.DONT_CONTEXTIFY` or an object that will be contextified.
* If `undefined`, an empty contextified object will be created for backwards compatibility.
* @return the result of the very last statement executed in the script.
*/
runInNewContext(contextObject?: Context, options?: RunningScriptInNewContextOptions): any;
runInNewContext(
contextObject?: Context | typeof constants.DONT_CONTEXTIFY,
options?: RunningScriptInNewContextOptions,
): any;
/**
* Runs the compiled code contained by the `vm.Script` within the context of the
* current `global` object. Running code does not have access to local scope, but _does_ have access to the current `global` object.
@@ -353,17 +409,17 @@ declare module "vm" {
sourceMapURL?: string | undefined;
}
/**
* If given a `contextObject`, the `vm.createContext()` method will
* If the given `contextObject` is an object, the `vm.createContext()` method will
* [prepare that object](https://nodejs.org/docs/latest-v20.x/api/vm.html#what-does-it-mean-to-contextify-an-object)
* and return a reference to it so that it can be used in `{@link runInContext}` or
* [`script.runInContext()`](https://nodejs.org/docs/latest-v20.x/api/vm.html#scriptrunincontextcontextifiedobject-options). 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
* and return a reference to it so that it can be used in calls to {@link runInContext} or
* [`script.runInContext()`](https://nodejs.org/docs/latest-v20.x/api/vm.html#scriptrunincontextcontextifiedobject-options).
* Inside such scripts, the global object will be wrapped by the `contextObject`, 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 will remain unchanged.
*
* ```js
* import vm from 'node:vm';
* const vm = require('node:vm');
*
* global.globalVar = 3;
*
@@ -380,7 +436,12 @@ declare module "vm" {
* ```
*
* If `contextObject` is omitted (or passed explicitly as `undefined`), a new,
* empty `contextified` object will be returned.
* empty contextified object will be returned.
*
* When the global object in the newly created context is contextified, it has some quirks
* compared to ordinary global objects. For example, it cannot be frozen. To create a context
* without the contextifying quirks, pass `vm.constants.DONT_CONTEXTIFY` as the `contextObject`
* argument. See the documentation of `vm.constants.DONT_CONTEXTIFY` for details.
*
* The `vm.createContext()` method is primarily useful for creating a single
* context that can be used to run multiple scripts. For instance, if emulating a
@@ -391,11 +452,17 @@ declare module "vm" {
* The provided `name` and `origin` of the context are made visible through the
* Inspector API.
* @since v0.3.1
* @param contextObject Either `vm.constants.DONT_CONTEXTIFY` or an object that will be contextified.
* If `undefined`, an empty contextified object will be created for backwards compatibility.
* @return contextified object.
*/
function createContext(sandbox?: Context, options?: CreateContextOptions): Context;
function createContext(
contextObject?: Context | typeof constants.DONT_CONTEXTIFY,
options?: CreateContextOptions,
): Context;
/**
* Returns `true` if the given `object` object has been `contextified` using {@link createContext}.
* Returns `true` if the given `object` object has been contextified using {@link createContext},
* or if it's the global object of a context created using `vm.constants.DONT_CONTEXTIFY`.
* @since v0.11.7
*/
function isContext(sandbox: Context): boolean;
@@ -428,18 +495,26 @@ declare module "vm" {
*/
function runInContext(code: string, contextifiedObject: Context, options?: RunningCodeOptions | string): any;
/**
* The `vm.runInNewContext()` first contextifies the given `contextObject` (or
* creates a new `contextObject` if passed as `undefined`), compiles the `code`,
* runs it within the created context, then returns the result. Running code
* does not have access to the local scope.
*
* This method is a shortcut to
* `(new vm.Script(code, options)).runInContext(vm.createContext(options), options)`.
* If `options` is a string, then it specifies the filename.
*
* It does several things at once:
*
* 1. Creates a new context.
* 2. If `contextObject` is an object, contextifies it with the new context.
* If `contextObject` is undefined, creates a new object and contextifies it.
* If `contextObject` is `vm.constants.DONT_CONTEXTIFY`, don't contextify anything.
* 3. Compiles the code as a`vm.Script`
* 4. Runs the compield code within the created context. The code does not have access to the scope in
* which this method is called.
* 5. Returns the result.
*
* The following example compiles and executes code that increments a global
* variable and sets a new one. These globals are contained in the `contextObject`.
*
* ```js
* import vm from 'node:vm';
* const vm = require('node:vm');
*
* const contextObject = {
* animal: 'cat',
@@ -449,15 +524,21 @@ declare module "vm" {
* vm.runInNewContext('count += 1; name = "kitty"', contextObject);
* console.log(contextObject);
* // Prints: { animal: 'cat', count: 3, name: 'kitty' }
*
* // This would throw if the context is created from a contextified object.
* // vm.constants.DONT_CONTEXTIFY allows creating contexts with ordinary global objects that
* // can be frozen.
* const frozenContext = vm.runInNewContext('Object.freeze(globalThis); globalThis;', vm.constants.DONT_CONTEXTIFY);
* ```
* @since v0.3.1
* @param code The JavaScript code to compile and run.
* @param contextObject An object that will be `contextified`. If `undefined`, a new object will be created.
* @param contextObject Either `vm.constants.DONT_CONTEXTIFY` or an object that will be contextified.
* If `undefined`, an empty contextified object will be created for backwards compatibility.
* @return the result of the very last statement executed in the script.
*/
function runInNewContext(
code: string,
contextObject?: Context,
contextObject?: Context | typeof constants.DONT_CONTEXTIFY,
options?: RunningCodeInNewContextOptions | string,
): any;
/**
@@ -824,13 +905,12 @@ declare module "vm" {
* Called during evaluation of this module to initialize the `import.meta`.
*/
initializeImportMeta?: ((meta: ImportMeta, module: SourceTextModule) => void) | undefined;
importModuleDynamically?:
| ((
specifier: string,
referrer: SourceTextModule,
importAttributes: ImportAttributes,
) => Module | Promise<Module>)
| undefined;
/**
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
*/
importModuleDynamically?: DynamicModuleLoader<SourceTextModule> | undefined;
}
/**
* This feature is only available with the `--experimental-vm-modules` command
@@ -930,6 +1010,19 @@ declare module "vm" {
* @since v20.12.0
*/
const USE_MAIN_CONTEXT_DEFAULT_LOADER: number;
/**
* This constant, when used as the `contextObject` argument in vm APIs, instructs Node.js to create
* a context without wrapping its global object with another object in a Node.js-specific manner.
* As a result, the `globalThis` value inside the new context would behave more closely to an ordinary
* one.
*
* When `vm.constants.DONT_CONTEXTIFY` is used as the `contextObject` argument to {@link createContext},
* the returned object is a proxy-like object to the global object in the newly created context with
* fewer Node.js-specific quirks. It is reference equal to the `globalThis` value in the new context,
* can be modified from outside the context, and can be used to access built-ins in the new context directly.
* @since v20.18.0
*/
const DONT_CONTEXTIFY: number;
}
}
declare module "node:vm" {

View File

@@ -52,14 +52,13 @@
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/worker_threads.js)
*/
declare module "worker_threads" {
import { Blob } from "node:buffer";
import { Context } from "node:vm";
import { EventEmitter } from "node:events";
import { EventLoopUtilityFunction } from "node:perf_hooks";
import { FileHandle } from "node:fs/promises";
import { Readable, Writable } from "node:stream";
import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
import { URL } from "node:url";
import { X509Certificate } from "node:crypto";
const isMainThread: boolean;
const parentPort: null | MessagePort;
const resourceLimits: ResourceLimits;
@@ -88,7 +87,16 @@ declare module "worker_threads" {
interface WorkerPerformance {
eventLoopUtilization: EventLoopUtilityFunction;
}
type TransferListItem = ArrayBuffer | MessagePort | FileHandle | X509Certificate | Blob;
type Transferable =
| ArrayBuffer
| MessagePort
| AbortSignal
| FileHandle
| ReadableStream
| WritableStream
| TransformStream;
/** @deprecated Use `import { Transferable } from "node:worker_threads"` instead. */
type TransferListItem = Transferable;
/**
* Instances of the `worker.MessagePort` class represent one end of an
* asynchronous, two-way communications channel. It can be used to transfer
@@ -173,7 +181,7 @@ declare module "worker_threads" {
* behind this API, see the `serialization API of the node:v8 module`.
* @since v10.5.0
*/
postMessage(value: any, transferList?: readonly TransferListItem[]): void;
postMessage(value: any, transferList?: readonly Transferable[]): void;
/**
* Opposite of `unref()`. Calling `ref()` on a previously `unref()`ed port does _not_ let the program exit if it's the only active handle left (the default
* behavior). If the port is `ref()`ed, calling `ref()` again has no effect.
@@ -260,7 +268,7 @@ declare module "worker_threads" {
/**
* Additional data to send in the first worker message.
*/
transferList?: TransferListItem[] | undefined;
transferList?: Transferable[] | undefined;
/**
* @default true
*/
@@ -408,7 +416,25 @@ declare module "worker_threads" {
* See `port.postMessage()` for more details.
* @since v10.5.0
*/
postMessage(value: any, transferList?: readonly TransferListItem[]): void;
postMessage(value: any, transferList?: readonly Transferable[]): void;
/**
* Sends a value to another worker, identified by its thread ID.
* @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
* If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
* @param value The value to send.
* @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
* or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
* @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
* If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
* @since v20.19.0
*/
postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
postMessageToThread(
threadId: number,
value: any,
transferList: readonly Transferable[],
timeout?: number,
): Promise<void>;
/**
* Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker does _not_ let the program exit if it's the only active handle left (the default
* behavior). If the worker is `ref()`ed, calling `ref()` again has
@@ -649,7 +675,7 @@ declare module "worker_threads" {
* @param value Any arbitrary, cloneable JavaScript value that will be cloned and passed automatically to all new `Worker` instances. If `value` is passed as `undefined`, any previously set value
* for the `key` will be deleted.
*/
function setEnvironmentData(key: Serializable, value: Serializable): void;
function setEnvironmentData(key: Serializable, value?: Serializable): void;
import {
BroadcastChannel as _BroadcastChannel,
@@ -657,6 +683,10 @@ declare module "worker_threads" {
MessagePort as _MessagePort,
} from "worker_threads";
global {
function structuredClone<T>(
value: T,
options?: { transfer?: Transferable[] },
): T;
/**
* `BroadcastChannel` class is a global reference for `import { BroadcastChannel } from 'node:worker_threads'`
* https://nodejs.org/api/globals.html#broadcastchannel