Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint-scope/LICENSE +21 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint-scope/README.md +90 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint-scope/index.d.ts +71 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint-scope/package.json +28 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/helpers.d.ts +3 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/index.d.ts +1510 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/package.json +70 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/best-practices.d.ts +1048 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/deprecated.d.ts +267 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/ecmascript-6.d.ts +534 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/index.d.ts +23 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/node-commonjs.d.ts +133 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/possible-errors.d.ts +571 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/strict-mode.d.ts +11 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/stylistic-issues.d.ts +1905 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/variables.d.ts +194 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/use-at-your-own-risk.d.ts +19 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/estree/LICENSE +21 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/estree/README.md +15 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/estree/flow.d.ts +167 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/estree/index.d.ts +694 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/estree/package.json +27 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/json-schema/LICENSE +21 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/json-schema/README.md +15 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/json-schema/index.d.ts +749 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/json-schema/package.json +40 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/json5/README.md +18 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/json5/index.d.ts +44 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/json5/package.json +16 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/json5/types-metadata.json +25 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/minimist/LICENSE +21 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/minimist/README.md +15 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/minimist/index.d.ts +87 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/minimist/package.json +40 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node-fetch/LICENSE +21 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node-fetch/README.md +15 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node-fetch/externals.d.ts +32 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node-fetch/index.d.ts +239 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node-fetch/package.json +84 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/LICENSE +21 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/README.md +15 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/assert.d.ts +1056 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/assert/strict.d.ts +8 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/async_hooks.d.ts +623 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/buffer.buffer.d.ts +463 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/buffer.d.ts +1930 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/child_process.d.ts +1549 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/cluster.d.ts +579 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/console.d.ts +452 -0
novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint-scope/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint-scope/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/eslint-scope`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for eslint-scope (https://github.com/eslint/eslint-scope).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/eslint-scope.
|
| 9 |
+
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/eslint-scope/index.d.ts)
|
| 10 |
+
````ts
|
| 11 |
+
import * as eslint from "eslint";
|
| 12 |
+
import * as estree from "estree";
|
| 13 |
+
|
| 14 |
+
export const version: string;
|
| 15 |
+
|
| 16 |
+
export class ScopeManager implements eslint.Scope.ScopeManager {
|
| 17 |
+
scopes: Scope[];
|
| 18 |
+
globalScope: Scope;
|
| 19 |
+
acquire(node: {}, inner?: boolean): Scope | null;
|
| 20 |
+
getDeclaredVariables(node: {}): Variable[];
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
export class Scope implements eslint.Scope.Scope {
|
| 24 |
+
type:
|
| 25 |
+
| "block"
|
| 26 |
+
| "catch"
|
| 27 |
+
| "class"
|
| 28 |
+
| "for"
|
| 29 |
+
| "function"
|
| 30 |
+
| "function-expression-name"
|
| 31 |
+
| "global"
|
| 32 |
+
| "module"
|
| 33 |
+
| "switch"
|
| 34 |
+
| "with"
|
| 35 |
+
| "TDZ";
|
| 36 |
+
isStrict: boolean;
|
| 37 |
+
upper: Scope | null;
|
| 38 |
+
childScopes: Scope[];
|
| 39 |
+
variableScope: Scope;
|
| 40 |
+
block: estree.Node;
|
| 41 |
+
variables: Variable[];
|
| 42 |
+
set: Map<string, Variable>;
|
| 43 |
+
references: Reference[];
|
| 44 |
+
through: Reference[];
|
| 45 |
+
functionExpressionScope: boolean;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
export class Variable implements eslint.Scope.Variable {
|
| 49 |
+
name: string;
|
| 50 |
+
scope: Scope;
|
| 51 |
+
identifiers: estree.Identifier[];
|
| 52 |
+
references: Reference[];
|
| 53 |
+
defs: eslint.Scope.Definition[];
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
export class Reference implements eslint.Scope.Reference {
|
| 57 |
+
identifier: estree.Identifier;
|
| 58 |
+
from: Scope;
|
| 59 |
+
resolved: Variable | null;
|
| 60 |
+
writeExpr: estree.Node | null;
|
| 61 |
+
init: boolean;
|
| 62 |
+
|
| 63 |
+
isWrite(): boolean;
|
| 64 |
+
isRead(): boolean;
|
| 65 |
+
isWriteOnly(): boolean;
|
| 66 |
+
isReadOnly(): boolean;
|
| 67 |
+
isReadWrite(): boolean;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
export interface AnalysisOptions {
|
| 71 |
+
optimistic?: boolean;
|
| 72 |
+
directive?: boolean;
|
| 73 |
+
ignoreEval?: boolean;
|
| 74 |
+
nodejsScope?: boolean;
|
| 75 |
+
impliedStrict?: boolean;
|
| 76 |
+
fallback?: string | ((node: {}) => string[]);
|
| 77 |
+
sourceType?: "script" | "module";
|
| 78 |
+
ecmaVersion?: number;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
export function analyze(ast: {}, options?: AnalysisOptions): ScopeManager;
|
| 82 |
+
|
| 83 |
+
````
|
| 84 |
+
|
| 85 |
+
### Additional Details
|
| 86 |
+
* Last updated: Mon, 06 Nov 2023 22:41:05 GMT
|
| 87 |
+
* Dependencies: [@types/eslint](https://npmjs.com/package/@types/eslint), [@types/estree](https://npmjs.com/package/@types/estree)
|
| 88 |
+
|
| 89 |
+
# Credits
|
| 90 |
+
These definitions were written by [Toru Nagashima](https://github.com/mysticatea).
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint-scope/index.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as eslint from "eslint";
|
| 2 |
+
import * as estree from "estree";
|
| 3 |
+
|
| 4 |
+
export const version: string;
|
| 5 |
+
|
| 6 |
+
export class ScopeManager implements eslint.Scope.ScopeManager {
|
| 7 |
+
scopes: Scope[];
|
| 8 |
+
globalScope: Scope;
|
| 9 |
+
acquire(node: {}, inner?: boolean): Scope | null;
|
| 10 |
+
getDeclaredVariables(node: {}): Variable[];
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
export class Scope implements eslint.Scope.Scope {
|
| 14 |
+
type:
|
| 15 |
+
| "block"
|
| 16 |
+
| "catch"
|
| 17 |
+
| "class"
|
| 18 |
+
| "for"
|
| 19 |
+
| "function"
|
| 20 |
+
| "function-expression-name"
|
| 21 |
+
| "global"
|
| 22 |
+
| "module"
|
| 23 |
+
| "switch"
|
| 24 |
+
| "with"
|
| 25 |
+
| "TDZ";
|
| 26 |
+
isStrict: boolean;
|
| 27 |
+
upper: Scope | null;
|
| 28 |
+
childScopes: Scope[];
|
| 29 |
+
variableScope: Scope;
|
| 30 |
+
block: estree.Node;
|
| 31 |
+
variables: Variable[];
|
| 32 |
+
set: Map<string, Variable>;
|
| 33 |
+
references: Reference[];
|
| 34 |
+
through: Reference[];
|
| 35 |
+
functionExpressionScope: boolean;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
export class Variable implements eslint.Scope.Variable {
|
| 39 |
+
name: string;
|
| 40 |
+
scope: Scope;
|
| 41 |
+
identifiers: estree.Identifier[];
|
| 42 |
+
references: Reference[];
|
| 43 |
+
defs: eslint.Scope.Definition[];
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
export class Reference implements eslint.Scope.Reference {
|
| 47 |
+
identifier: estree.Identifier;
|
| 48 |
+
from: Scope;
|
| 49 |
+
resolved: Variable | null;
|
| 50 |
+
writeExpr: estree.Node | null;
|
| 51 |
+
init: boolean;
|
| 52 |
+
|
| 53 |
+
isWrite(): boolean;
|
| 54 |
+
isRead(): boolean;
|
| 55 |
+
isWriteOnly(): boolean;
|
| 56 |
+
isReadOnly(): boolean;
|
| 57 |
+
isReadWrite(): boolean;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
export interface AnalysisOptions {
|
| 61 |
+
optimistic?: boolean;
|
| 62 |
+
directive?: boolean;
|
| 63 |
+
ignoreEval?: boolean;
|
| 64 |
+
nodejsScope?: boolean;
|
| 65 |
+
impliedStrict?: boolean;
|
| 66 |
+
fallback?: string | ((node: {}) => string[]);
|
| 67 |
+
sourceType?: "script" | "module";
|
| 68 |
+
ecmaVersion?: number;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
export function analyze(ast: {}, options?: AnalysisOptions): ScopeManager;
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint-scope/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/eslint-scope",
|
| 3 |
+
"version": "3.7.7",
|
| 4 |
+
"description": "TypeScript definitions for eslint-scope",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/eslint-scope",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "Toru Nagashima",
|
| 10 |
+
"githubUsername": "mysticatea",
|
| 11 |
+
"url": "https://github.com/mysticatea"
|
| 12 |
+
}
|
| 13 |
+
],
|
| 14 |
+
"main": "",
|
| 15 |
+
"types": "index.d.ts",
|
| 16 |
+
"repository": {
|
| 17 |
+
"type": "git",
|
| 18 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 19 |
+
"directory": "types/eslint-scope"
|
| 20 |
+
},
|
| 21 |
+
"scripts": {},
|
| 22 |
+
"dependencies": {
|
| 23 |
+
"@types/eslint": "*",
|
| 24 |
+
"@types/estree": "*"
|
| 25 |
+
},
|
| 26 |
+
"typesPublisherContentHash": "49eee35b78c19e2c83bc96ce190c7a88329006f876dd7f1fb378c1e8034fc8f2",
|
| 27 |
+
"typeScriptVersion": "4.5"
|
| 28 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/helpers.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
type Prepend<Tuple extends any[], Addend> = ((_: Addend, ..._1: Tuple) => any) extends (..._: infer Result) => any
|
| 2 |
+
? Result
|
| 3 |
+
: never;
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/index.d.ts
ADDED
|
@@ -0,0 +1,1510 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/// <reference path="helpers.d.ts" />
|
| 2 |
+
|
| 3 |
+
import * as ESTree from "estree";
|
| 4 |
+
import { JSONSchema4 } from "json-schema";
|
| 5 |
+
|
| 6 |
+
export namespace AST {
|
| 7 |
+
type TokenType =
|
| 8 |
+
| "Boolean"
|
| 9 |
+
| "Null"
|
| 10 |
+
| "Identifier"
|
| 11 |
+
| "Keyword"
|
| 12 |
+
| "Punctuator"
|
| 13 |
+
| "JSXIdentifier"
|
| 14 |
+
| "JSXText"
|
| 15 |
+
| "Numeric"
|
| 16 |
+
| "String"
|
| 17 |
+
| "RegularExpression";
|
| 18 |
+
|
| 19 |
+
interface Token {
|
| 20 |
+
type: TokenType;
|
| 21 |
+
value: string;
|
| 22 |
+
range: Range;
|
| 23 |
+
loc: SourceLocation;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
interface SourceLocation {
|
| 27 |
+
start: ESTree.Position;
|
| 28 |
+
end: ESTree.Position;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
type Range = [number, number];
|
| 32 |
+
|
| 33 |
+
interface Program extends ESTree.Program {
|
| 34 |
+
comments: ESTree.Comment[];
|
| 35 |
+
tokens: Token[];
|
| 36 |
+
loc: SourceLocation;
|
| 37 |
+
range: Range;
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
export namespace Scope {
|
| 42 |
+
interface ScopeManager {
|
| 43 |
+
scopes: Scope[];
|
| 44 |
+
globalScope: Scope | null;
|
| 45 |
+
|
| 46 |
+
acquire(node: ESTree.Node, inner?: boolean): Scope | null;
|
| 47 |
+
|
| 48 |
+
getDeclaredVariables(node: ESTree.Node): Variable[];
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
interface Scope {
|
| 52 |
+
type:
|
| 53 |
+
| "block"
|
| 54 |
+
| "catch"
|
| 55 |
+
| "class"
|
| 56 |
+
| "for"
|
| 57 |
+
| "function"
|
| 58 |
+
| "function-expression-name"
|
| 59 |
+
| "global"
|
| 60 |
+
| "module"
|
| 61 |
+
| "switch"
|
| 62 |
+
| "with"
|
| 63 |
+
| "TDZ";
|
| 64 |
+
isStrict: boolean;
|
| 65 |
+
upper: Scope | null;
|
| 66 |
+
childScopes: Scope[];
|
| 67 |
+
variableScope: Scope;
|
| 68 |
+
block: ESTree.Node;
|
| 69 |
+
variables: Variable[];
|
| 70 |
+
set: Map<string, Variable>;
|
| 71 |
+
references: Reference[];
|
| 72 |
+
through: Reference[];
|
| 73 |
+
functionExpressionScope: boolean;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
interface Variable {
|
| 77 |
+
name: string;
|
| 78 |
+
scope: Scope;
|
| 79 |
+
identifiers: ESTree.Identifier[];
|
| 80 |
+
references: Reference[];
|
| 81 |
+
defs: Definition[];
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
interface Reference {
|
| 85 |
+
identifier: ESTree.Identifier;
|
| 86 |
+
from: Scope;
|
| 87 |
+
resolved: Variable | null;
|
| 88 |
+
writeExpr: ESTree.Node | null;
|
| 89 |
+
init: boolean;
|
| 90 |
+
|
| 91 |
+
isWrite(): boolean;
|
| 92 |
+
|
| 93 |
+
isRead(): boolean;
|
| 94 |
+
|
| 95 |
+
isWriteOnly(): boolean;
|
| 96 |
+
|
| 97 |
+
isReadOnly(): boolean;
|
| 98 |
+
|
| 99 |
+
isReadWrite(): boolean;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
type DefinitionType =
|
| 103 |
+
| { type: "CatchClause"; node: ESTree.CatchClause; parent: null }
|
| 104 |
+
| { type: "ClassName"; node: ESTree.ClassDeclaration | ESTree.ClassExpression; parent: null }
|
| 105 |
+
| { type: "FunctionName"; node: ESTree.FunctionDeclaration | ESTree.FunctionExpression; parent: null }
|
| 106 |
+
| { type: "ImplicitGlobalVariable"; node: ESTree.Program; parent: null }
|
| 107 |
+
| {
|
| 108 |
+
type: "ImportBinding";
|
| 109 |
+
node: ESTree.ImportSpecifier | ESTree.ImportDefaultSpecifier | ESTree.ImportNamespaceSpecifier;
|
| 110 |
+
parent: ESTree.ImportDeclaration;
|
| 111 |
+
}
|
| 112 |
+
| {
|
| 113 |
+
type: "Parameter";
|
| 114 |
+
node: ESTree.FunctionDeclaration | ESTree.FunctionExpression | ESTree.ArrowFunctionExpression;
|
| 115 |
+
parent: null;
|
| 116 |
+
}
|
| 117 |
+
| { type: "TDZ"; node: any; parent: null }
|
| 118 |
+
| { type: "Variable"; node: ESTree.VariableDeclarator; parent: ESTree.VariableDeclaration };
|
| 119 |
+
|
| 120 |
+
type Definition = DefinitionType & { name: ESTree.Identifier };
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
// #region SourceCode
|
| 124 |
+
|
| 125 |
+
export class SourceCode {
|
| 126 |
+
text: string;
|
| 127 |
+
ast: AST.Program;
|
| 128 |
+
lines: string[];
|
| 129 |
+
hasBOM: boolean;
|
| 130 |
+
parserServices: SourceCode.ParserServices;
|
| 131 |
+
scopeManager: Scope.ScopeManager;
|
| 132 |
+
visitorKeys: SourceCode.VisitorKeys;
|
| 133 |
+
|
| 134 |
+
constructor(text: string, ast: AST.Program);
|
| 135 |
+
constructor(config: SourceCode.Config);
|
| 136 |
+
|
| 137 |
+
static splitLines(text: string): string[];
|
| 138 |
+
|
| 139 |
+
getText(node?: ESTree.Node, beforeCount?: number, afterCount?: number): string;
|
| 140 |
+
|
| 141 |
+
getLines(): string[];
|
| 142 |
+
|
| 143 |
+
getAllComments(): ESTree.Comment[];
|
| 144 |
+
|
| 145 |
+
getAncestors(node: ESTree.Node): ESTree.Node[];
|
| 146 |
+
|
| 147 |
+
getComments(node: ESTree.Node): { leading: ESTree.Comment[]; trailing: ESTree.Comment[] };
|
| 148 |
+
|
| 149 |
+
getDeclaredVariables(node: ESTree.Node): Scope.Variable[];
|
| 150 |
+
|
| 151 |
+
getJSDocComment(node: ESTree.Node): ESTree.Comment | null;
|
| 152 |
+
|
| 153 |
+
getNodeByRangeIndex(index: number): ESTree.Node | null;
|
| 154 |
+
|
| 155 |
+
isSpaceBetweenTokens(first: AST.Token, second: AST.Token): boolean;
|
| 156 |
+
|
| 157 |
+
getLocFromIndex(index: number): ESTree.Position;
|
| 158 |
+
|
| 159 |
+
getIndexFromLoc(location: ESTree.Position): number;
|
| 160 |
+
|
| 161 |
+
// Inherited methods from TokenStore
|
| 162 |
+
// ---------------------------------
|
| 163 |
+
|
| 164 |
+
getTokenByRangeStart(offset: number, options?: { includeComments: false }): AST.Token | null;
|
| 165 |
+
getTokenByRangeStart(offset: number, options: { includeComments: boolean }): AST.Token | ESTree.Comment | null;
|
| 166 |
+
|
| 167 |
+
getFirstToken: SourceCode.UnaryNodeCursorWithSkipOptions;
|
| 168 |
+
|
| 169 |
+
getFirstTokens: SourceCode.UnaryNodeCursorWithCountOptions;
|
| 170 |
+
|
| 171 |
+
getLastToken: SourceCode.UnaryNodeCursorWithSkipOptions;
|
| 172 |
+
|
| 173 |
+
getLastTokens: SourceCode.UnaryNodeCursorWithCountOptions;
|
| 174 |
+
|
| 175 |
+
getTokenBefore: SourceCode.UnaryCursorWithSkipOptions;
|
| 176 |
+
|
| 177 |
+
getTokensBefore: SourceCode.UnaryCursorWithCountOptions;
|
| 178 |
+
|
| 179 |
+
getTokenAfter: SourceCode.UnaryCursorWithSkipOptions;
|
| 180 |
+
|
| 181 |
+
getTokensAfter: SourceCode.UnaryCursorWithCountOptions;
|
| 182 |
+
|
| 183 |
+
getFirstTokenBetween: SourceCode.BinaryCursorWithSkipOptions;
|
| 184 |
+
|
| 185 |
+
getFirstTokensBetween: SourceCode.BinaryCursorWithCountOptions;
|
| 186 |
+
|
| 187 |
+
getLastTokenBetween: SourceCode.BinaryCursorWithSkipOptions;
|
| 188 |
+
|
| 189 |
+
getLastTokensBetween: SourceCode.BinaryCursorWithCountOptions;
|
| 190 |
+
|
| 191 |
+
getTokensBetween: SourceCode.BinaryCursorWithCountOptions;
|
| 192 |
+
|
| 193 |
+
getTokens:
|
| 194 |
+
& ((node: ESTree.Node, beforeCount?: number, afterCount?: number) => AST.Token[])
|
| 195 |
+
& SourceCode.UnaryNodeCursorWithCountOptions;
|
| 196 |
+
|
| 197 |
+
commentsExistBetween(
|
| 198 |
+
left: ESTree.Node | AST.Token | ESTree.Comment,
|
| 199 |
+
right: ESTree.Node | AST.Token | ESTree.Comment,
|
| 200 |
+
): boolean;
|
| 201 |
+
|
| 202 |
+
getCommentsBefore(nodeOrToken: ESTree.Node | AST.Token): ESTree.Comment[];
|
| 203 |
+
|
| 204 |
+
getCommentsAfter(nodeOrToken: ESTree.Node | AST.Token): ESTree.Comment[];
|
| 205 |
+
|
| 206 |
+
getCommentsInside(node: ESTree.Node): ESTree.Comment[];
|
| 207 |
+
|
| 208 |
+
getScope(node: ESTree.Node): Scope.Scope;
|
| 209 |
+
|
| 210 |
+
isSpaceBetween(
|
| 211 |
+
first: ESTree.Node | AST.Token,
|
| 212 |
+
second: ESTree.Node | AST.Token,
|
| 213 |
+
): boolean;
|
| 214 |
+
|
| 215 |
+
markVariableAsUsed(name: string, refNode?: ESTree.Node): boolean;
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
export namespace SourceCode {
|
| 219 |
+
interface Config {
|
| 220 |
+
text: string;
|
| 221 |
+
ast: AST.Program;
|
| 222 |
+
parserServices?: ParserServices | undefined;
|
| 223 |
+
scopeManager?: Scope.ScopeManager | undefined;
|
| 224 |
+
visitorKeys?: VisitorKeys | undefined;
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
type ParserServices = any;
|
| 228 |
+
|
| 229 |
+
interface VisitorKeys {
|
| 230 |
+
[nodeType: string]: string[];
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
interface UnaryNodeCursorWithSkipOptions {
|
| 234 |
+
<T extends AST.Token>(
|
| 235 |
+
node: ESTree.Node,
|
| 236 |
+
options:
|
| 237 |
+
| ((token: AST.Token) => token is T)
|
| 238 |
+
| {
|
| 239 |
+
filter: (token: AST.Token) => token is T;
|
| 240 |
+
includeComments?: false | undefined;
|
| 241 |
+
skip?: number | undefined;
|
| 242 |
+
},
|
| 243 |
+
): T | null;
|
| 244 |
+
<T extends AST.Token | ESTree.Comment>(
|
| 245 |
+
node: ESTree.Node,
|
| 246 |
+
options: {
|
| 247 |
+
filter: (tokenOrComment: AST.Token | ESTree.Comment) => tokenOrComment is T;
|
| 248 |
+
includeComments: boolean;
|
| 249 |
+
skip?: number | undefined;
|
| 250 |
+
},
|
| 251 |
+
): T | null;
|
| 252 |
+
(
|
| 253 |
+
node: ESTree.Node,
|
| 254 |
+
options?:
|
| 255 |
+
| {
|
| 256 |
+
filter?: ((token: AST.Token) => boolean) | undefined;
|
| 257 |
+
includeComments?: false | undefined;
|
| 258 |
+
skip?: number | undefined;
|
| 259 |
+
}
|
| 260 |
+
| ((token: AST.Token) => boolean)
|
| 261 |
+
| number,
|
| 262 |
+
): AST.Token | null;
|
| 263 |
+
(
|
| 264 |
+
node: ESTree.Node,
|
| 265 |
+
options: {
|
| 266 |
+
filter?: ((token: AST.Token | ESTree.Comment) => boolean) | undefined;
|
| 267 |
+
includeComments: boolean;
|
| 268 |
+
skip?: number | undefined;
|
| 269 |
+
},
|
| 270 |
+
): AST.Token | ESTree.Comment | null;
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
interface UnaryNodeCursorWithCountOptions {
|
| 274 |
+
<T extends AST.Token>(
|
| 275 |
+
node: ESTree.Node,
|
| 276 |
+
options:
|
| 277 |
+
| ((token: AST.Token) => token is T)
|
| 278 |
+
| {
|
| 279 |
+
filter: (token: AST.Token) => token is T;
|
| 280 |
+
includeComments?: false | undefined;
|
| 281 |
+
count?: number | undefined;
|
| 282 |
+
},
|
| 283 |
+
): T[];
|
| 284 |
+
<T extends AST.Token | ESTree.Comment>(
|
| 285 |
+
node: ESTree.Node,
|
| 286 |
+
options: {
|
| 287 |
+
filter: (tokenOrComment: AST.Token | ESTree.Comment) => tokenOrComment is T;
|
| 288 |
+
includeComments: boolean;
|
| 289 |
+
count?: number | undefined;
|
| 290 |
+
},
|
| 291 |
+
): T[];
|
| 292 |
+
(
|
| 293 |
+
node: ESTree.Node,
|
| 294 |
+
options?:
|
| 295 |
+
| {
|
| 296 |
+
filter?: ((token: AST.Token) => boolean) | undefined;
|
| 297 |
+
includeComments?: false | undefined;
|
| 298 |
+
count?: number | undefined;
|
| 299 |
+
}
|
| 300 |
+
| ((token: AST.Token) => boolean)
|
| 301 |
+
| number,
|
| 302 |
+
): AST.Token[];
|
| 303 |
+
(
|
| 304 |
+
node: ESTree.Node,
|
| 305 |
+
options: {
|
| 306 |
+
filter?: ((token: AST.Token | ESTree.Comment) => boolean) | undefined;
|
| 307 |
+
includeComments: boolean;
|
| 308 |
+
count?: number | undefined;
|
| 309 |
+
},
|
| 310 |
+
): Array<AST.Token | ESTree.Comment>;
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
interface UnaryCursorWithSkipOptions {
|
| 314 |
+
<T extends AST.Token>(
|
| 315 |
+
node: ESTree.Node | AST.Token | ESTree.Comment,
|
| 316 |
+
options:
|
| 317 |
+
| ((token: AST.Token) => token is T)
|
| 318 |
+
| {
|
| 319 |
+
filter: (token: AST.Token) => token is T;
|
| 320 |
+
includeComments?: false | undefined;
|
| 321 |
+
skip?: number | undefined;
|
| 322 |
+
},
|
| 323 |
+
): T | null;
|
| 324 |
+
<T extends AST.Token | ESTree.Comment>(
|
| 325 |
+
node: ESTree.Node | AST.Token | ESTree.Comment,
|
| 326 |
+
options: {
|
| 327 |
+
filter: (tokenOrComment: AST.Token | ESTree.Comment) => tokenOrComment is T;
|
| 328 |
+
includeComments: boolean;
|
| 329 |
+
skip?: number | undefined;
|
| 330 |
+
},
|
| 331 |
+
): T | null;
|
| 332 |
+
(
|
| 333 |
+
node: ESTree.Node | AST.Token | ESTree.Comment,
|
| 334 |
+
options?:
|
| 335 |
+
| {
|
| 336 |
+
filter?: ((token: AST.Token) => boolean) | undefined;
|
| 337 |
+
includeComments?: false | undefined;
|
| 338 |
+
skip?: number | undefined;
|
| 339 |
+
}
|
| 340 |
+
| ((token: AST.Token) => boolean)
|
| 341 |
+
| number,
|
| 342 |
+
): AST.Token | null;
|
| 343 |
+
(
|
| 344 |
+
node: ESTree.Node | AST.Token | ESTree.Comment,
|
| 345 |
+
options: {
|
| 346 |
+
filter?: ((token: AST.Token | ESTree.Comment) => boolean) | undefined;
|
| 347 |
+
includeComments: boolean;
|
| 348 |
+
skip?: number | undefined;
|
| 349 |
+
},
|
| 350 |
+
): AST.Token | ESTree.Comment | null;
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
interface UnaryCursorWithCountOptions {
|
| 354 |
+
<T extends AST.Token>(
|
| 355 |
+
node: ESTree.Node | AST.Token | ESTree.Comment,
|
| 356 |
+
options:
|
| 357 |
+
| ((token: AST.Token) => token is T)
|
| 358 |
+
| {
|
| 359 |
+
filter: (token: AST.Token) => token is T;
|
| 360 |
+
includeComments?: false | undefined;
|
| 361 |
+
count?: number | undefined;
|
| 362 |
+
},
|
| 363 |
+
): T[];
|
| 364 |
+
<T extends AST.Token | ESTree.Comment>(
|
| 365 |
+
node: ESTree.Node | AST.Token | ESTree.Comment,
|
| 366 |
+
options: {
|
| 367 |
+
filter: (tokenOrComment: AST.Token | ESTree.Comment) => tokenOrComment is T;
|
| 368 |
+
includeComments: boolean;
|
| 369 |
+
count?: number | undefined;
|
| 370 |
+
},
|
| 371 |
+
): T[];
|
| 372 |
+
(
|
| 373 |
+
node: ESTree.Node | AST.Token | ESTree.Comment,
|
| 374 |
+
options?:
|
| 375 |
+
| {
|
| 376 |
+
filter?: ((token: AST.Token) => boolean) | undefined;
|
| 377 |
+
includeComments?: false | undefined;
|
| 378 |
+
count?: number | undefined;
|
| 379 |
+
}
|
| 380 |
+
| ((token: AST.Token) => boolean)
|
| 381 |
+
| number,
|
| 382 |
+
): AST.Token[];
|
| 383 |
+
(
|
| 384 |
+
node: ESTree.Node | AST.Token | ESTree.Comment,
|
| 385 |
+
options: {
|
| 386 |
+
filter?: ((token: AST.Token | ESTree.Comment) => boolean) | undefined;
|
| 387 |
+
includeComments: boolean;
|
| 388 |
+
count?: number | undefined;
|
| 389 |
+
},
|
| 390 |
+
): Array<AST.Token | ESTree.Comment>;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
interface BinaryCursorWithSkipOptions {
|
| 394 |
+
<T extends AST.Token>(
|
| 395 |
+
left: ESTree.Node | AST.Token | ESTree.Comment,
|
| 396 |
+
right: ESTree.Node | AST.Token | ESTree.Comment,
|
| 397 |
+
options:
|
| 398 |
+
| ((token: AST.Token) => token is T)
|
| 399 |
+
| {
|
| 400 |
+
filter: (token: AST.Token) => token is T;
|
| 401 |
+
includeComments?: false | undefined;
|
| 402 |
+
skip?: number | undefined;
|
| 403 |
+
},
|
| 404 |
+
): T | null;
|
| 405 |
+
<T extends AST.Token | ESTree.Comment>(
|
| 406 |
+
left: ESTree.Node | AST.Token | ESTree.Comment,
|
| 407 |
+
right: ESTree.Node | AST.Token | ESTree.Comment,
|
| 408 |
+
options: {
|
| 409 |
+
filter: (tokenOrComment: AST.Token | ESTree.Comment) => tokenOrComment is T;
|
| 410 |
+
includeComments: boolean;
|
| 411 |
+
skip?: number | undefined;
|
| 412 |
+
},
|
| 413 |
+
): T | null;
|
| 414 |
+
(
|
| 415 |
+
left: ESTree.Node | AST.Token | ESTree.Comment,
|
| 416 |
+
right: ESTree.Node | AST.Token | ESTree.Comment,
|
| 417 |
+
options?:
|
| 418 |
+
| {
|
| 419 |
+
filter?: ((token: AST.Token) => boolean) | undefined;
|
| 420 |
+
includeComments?: false | undefined;
|
| 421 |
+
skip?: number | undefined;
|
| 422 |
+
}
|
| 423 |
+
| ((token: AST.Token) => boolean)
|
| 424 |
+
| number,
|
| 425 |
+
): AST.Token | null;
|
| 426 |
+
(
|
| 427 |
+
left: ESTree.Node | AST.Token | ESTree.Comment,
|
| 428 |
+
right: ESTree.Node | AST.Token | ESTree.Comment,
|
| 429 |
+
options: {
|
| 430 |
+
filter?: ((token: AST.Token | ESTree.Comment) => boolean) | undefined;
|
| 431 |
+
includeComments: boolean;
|
| 432 |
+
skip?: number | undefined;
|
| 433 |
+
},
|
| 434 |
+
): AST.Token | ESTree.Comment | null;
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
interface BinaryCursorWithCountOptions {
|
| 438 |
+
<T extends AST.Token>(
|
| 439 |
+
left: ESTree.Node | AST.Token | ESTree.Comment,
|
| 440 |
+
right: ESTree.Node | AST.Token | ESTree.Comment,
|
| 441 |
+
options:
|
| 442 |
+
| ((token: AST.Token) => token is T)
|
| 443 |
+
| {
|
| 444 |
+
filter: (token: AST.Token) => token is T;
|
| 445 |
+
includeComments?: false | undefined;
|
| 446 |
+
count?: number | undefined;
|
| 447 |
+
},
|
| 448 |
+
): T[];
|
| 449 |
+
<T extends AST.Token | ESTree.Comment>(
|
| 450 |
+
left: ESTree.Node | AST.Token | ESTree.Comment,
|
| 451 |
+
right: ESTree.Node | AST.Token | ESTree.Comment,
|
| 452 |
+
options: {
|
| 453 |
+
filter: (tokenOrComment: AST.Token | ESTree.Comment) => tokenOrComment is T;
|
| 454 |
+
includeComments: boolean;
|
| 455 |
+
count?: number | undefined;
|
| 456 |
+
},
|
| 457 |
+
): T[];
|
| 458 |
+
(
|
| 459 |
+
left: ESTree.Node | AST.Token | ESTree.Comment,
|
| 460 |
+
right: ESTree.Node | AST.Token | ESTree.Comment,
|
| 461 |
+
options?:
|
| 462 |
+
| {
|
| 463 |
+
filter?: ((token: AST.Token) => boolean) | undefined;
|
| 464 |
+
includeComments?: false | undefined;
|
| 465 |
+
count?: number | undefined;
|
| 466 |
+
}
|
| 467 |
+
| ((token: AST.Token) => boolean)
|
| 468 |
+
| number,
|
| 469 |
+
): AST.Token[];
|
| 470 |
+
(
|
| 471 |
+
left: ESTree.Node | AST.Token | ESTree.Comment,
|
| 472 |
+
right: ESTree.Node | AST.Token | ESTree.Comment,
|
| 473 |
+
options: {
|
| 474 |
+
filter?: ((token: AST.Token | ESTree.Comment) => boolean) | undefined;
|
| 475 |
+
includeComments: boolean;
|
| 476 |
+
count?: number | undefined;
|
| 477 |
+
},
|
| 478 |
+
): Array<AST.Token | ESTree.Comment>;
|
| 479 |
+
}
|
| 480 |
+
}
|
| 481 |
+
|
| 482 |
+
// #endregion
|
| 483 |
+
|
| 484 |
+
export namespace Rule {
|
| 485 |
+
/**
|
| 486 |
+
* TODO: Old style rules are planned to be removed in v9, remove this type then (https://github.com/eslint/rfcs/blob/main/designs/2021-schema-object-rules/README.md)
|
| 487 |
+
* @deprecated Use `RuleModule` instead.
|
| 488 |
+
*/
|
| 489 |
+
type OldStyleRule = RuleModule["create"];
|
| 490 |
+
|
| 491 |
+
interface RuleModule {
|
| 492 |
+
create(context: RuleContext): RuleListener;
|
| 493 |
+
meta?: RuleMetaData | undefined;
|
| 494 |
+
schema?: RuleMetaData["schema"];
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
type NodeTypes = ESTree.Node["type"];
|
| 498 |
+
interface NodeListener {
|
| 499 |
+
ArrayExpression?: ((node: ESTree.ArrayExpression & NodeParentExtension) => void) | undefined;
|
| 500 |
+
"ArrayExpression:exit"?: ((node: ESTree.ArrayExpression & NodeParentExtension) => void) | undefined;
|
| 501 |
+
ArrayPattern?: ((node: ESTree.ArrayPattern & NodeParentExtension) => void) | undefined;
|
| 502 |
+
"ArrayPattern:exit"?: ((node: ESTree.ArrayPattern & NodeParentExtension) => void) | undefined;
|
| 503 |
+
ArrowFunctionExpression?: ((node: ESTree.ArrowFunctionExpression & NodeParentExtension) => void) | undefined;
|
| 504 |
+
"ArrowFunctionExpression:exit"?:
|
| 505 |
+
| ((node: ESTree.ArrowFunctionExpression & NodeParentExtension) => void)
|
| 506 |
+
| undefined;
|
| 507 |
+
AssignmentExpression?: ((node: ESTree.AssignmentExpression & NodeParentExtension) => void) | undefined;
|
| 508 |
+
"AssignmentExpression:exit"?: ((node: ESTree.AssignmentExpression & NodeParentExtension) => void) | undefined;
|
| 509 |
+
AssignmentPattern?: ((node: ESTree.AssignmentPattern & NodeParentExtension) => void) | undefined;
|
| 510 |
+
"AssignmentPattern:exit"?: ((node: ESTree.AssignmentPattern & NodeParentExtension) => void) | undefined;
|
| 511 |
+
AwaitExpression?: ((node: ESTree.AwaitExpression & NodeParentExtension) => void) | undefined;
|
| 512 |
+
"AwaitExpression:exit"?: ((node: ESTree.AwaitExpression & NodeParentExtension) => void) | undefined;
|
| 513 |
+
BinaryExpression?: ((node: ESTree.BinaryExpression & NodeParentExtension) => void) | undefined;
|
| 514 |
+
"BinaryExpression:exit"?: ((node: ESTree.BinaryExpression & NodeParentExtension) => void) | undefined;
|
| 515 |
+
BlockStatement?: ((node: ESTree.BlockStatement & NodeParentExtension) => void) | undefined;
|
| 516 |
+
"BlockStatement:exit"?: ((node: ESTree.BlockStatement & NodeParentExtension) => void) | undefined;
|
| 517 |
+
BreakStatement?: ((node: ESTree.BreakStatement & NodeParentExtension) => void) | undefined;
|
| 518 |
+
"BreakStatement:exit"?: ((node: ESTree.BreakStatement & NodeParentExtension) => void) | undefined;
|
| 519 |
+
CallExpression?: ((node: ESTree.CallExpression & NodeParentExtension) => void) | undefined;
|
| 520 |
+
"CallExpression:exit"?: ((node: ESTree.CallExpression & NodeParentExtension) => void) | undefined;
|
| 521 |
+
CatchClause?: ((node: ESTree.CatchClause & NodeParentExtension) => void) | undefined;
|
| 522 |
+
"CatchClause:exit"?: ((node: ESTree.CatchClause & NodeParentExtension) => void) | undefined;
|
| 523 |
+
ChainExpression?: ((node: ESTree.ChainExpression & NodeParentExtension) => void) | undefined;
|
| 524 |
+
"ChainExpression:exit"?: ((node: ESTree.ChainExpression & NodeParentExtension) => void) | undefined;
|
| 525 |
+
ClassBody?: ((node: ESTree.ClassBody & NodeParentExtension) => void) | undefined;
|
| 526 |
+
"ClassBody:exit"?: ((node: ESTree.ClassBody & NodeParentExtension) => void) | undefined;
|
| 527 |
+
ClassDeclaration?: ((node: ESTree.ClassDeclaration & NodeParentExtension) => void) | undefined;
|
| 528 |
+
"ClassDeclaration:exit"?: ((node: ESTree.ClassDeclaration & NodeParentExtension) => void) | undefined;
|
| 529 |
+
ClassExpression?: ((node: ESTree.ClassExpression & NodeParentExtension) => void) | undefined;
|
| 530 |
+
"ClassExpression:exit"?: ((node: ESTree.ClassExpression & NodeParentExtension) => void) | undefined;
|
| 531 |
+
ConditionalExpression?: ((node: ESTree.ConditionalExpression & NodeParentExtension) => void) | undefined;
|
| 532 |
+
"ConditionalExpression:exit"?: ((node: ESTree.ConditionalExpression & NodeParentExtension) => void) | undefined;
|
| 533 |
+
ContinueStatement?: ((node: ESTree.ContinueStatement & NodeParentExtension) => void) | undefined;
|
| 534 |
+
"ContinueStatement:exit"?: ((node: ESTree.ContinueStatement & NodeParentExtension) => void) | undefined;
|
| 535 |
+
DebuggerStatement?: ((node: ESTree.DebuggerStatement & NodeParentExtension) => void) | undefined;
|
| 536 |
+
"DebuggerStatement:exit"?: ((node: ESTree.DebuggerStatement & NodeParentExtension) => void) | undefined;
|
| 537 |
+
DoWhileStatement?: ((node: ESTree.DoWhileStatement & NodeParentExtension) => void) | undefined;
|
| 538 |
+
"DoWhileStatement:exit"?: ((node: ESTree.DoWhileStatement & NodeParentExtension) => void) | undefined;
|
| 539 |
+
EmptyStatement?: ((node: ESTree.EmptyStatement & NodeParentExtension) => void) | undefined;
|
| 540 |
+
"EmptyStatement:exit"?: ((node: ESTree.EmptyStatement & NodeParentExtension) => void) | undefined;
|
| 541 |
+
ExportAllDeclaration?: ((node: ESTree.ExportAllDeclaration & NodeParentExtension) => void) | undefined;
|
| 542 |
+
"ExportAllDeclaration:exit"?: ((node: ESTree.ExportAllDeclaration & NodeParentExtension) => void) | undefined;
|
| 543 |
+
ExportDefaultDeclaration?: ((node: ESTree.ExportDefaultDeclaration & NodeParentExtension) => void) | undefined;
|
| 544 |
+
"ExportDefaultDeclaration:exit"?:
|
| 545 |
+
| ((node: ESTree.ExportDefaultDeclaration & NodeParentExtension) => void)
|
| 546 |
+
| undefined;
|
| 547 |
+
ExportNamedDeclaration?: ((node: ESTree.ExportNamedDeclaration & NodeParentExtension) => void) | undefined;
|
| 548 |
+
"ExportNamedDeclaration:exit"?:
|
| 549 |
+
| ((node: ESTree.ExportNamedDeclaration & NodeParentExtension) => void)
|
| 550 |
+
| undefined;
|
| 551 |
+
ExportSpecifier?: ((node: ESTree.ExportSpecifier & NodeParentExtension) => void) | undefined;
|
| 552 |
+
"ExportSpecifier:exit"?: ((node: ESTree.ExportSpecifier & NodeParentExtension) => void) | undefined;
|
| 553 |
+
ExpressionStatement?: ((node: ESTree.ExpressionStatement & NodeParentExtension) => void) | undefined;
|
| 554 |
+
"ExpressionStatement:exit"?: ((node: ESTree.ExpressionStatement & NodeParentExtension) => void) | undefined;
|
| 555 |
+
ForInStatement?: ((node: ESTree.ForInStatement & NodeParentExtension) => void) | undefined;
|
| 556 |
+
"ForInStatement:exit"?: ((node: ESTree.ForInStatement & NodeParentExtension) => void) | undefined;
|
| 557 |
+
ForOfStatement?: ((node: ESTree.ForOfStatement & NodeParentExtension) => void) | undefined;
|
| 558 |
+
"ForOfStatement:exit"?: ((node: ESTree.ForOfStatement & NodeParentExtension) => void) | undefined;
|
| 559 |
+
ForStatement?: ((node: ESTree.ForStatement & NodeParentExtension) => void) | undefined;
|
| 560 |
+
"ForStatement:exit"?: ((node: ESTree.ForStatement & NodeParentExtension) => void) | undefined;
|
| 561 |
+
FunctionDeclaration?: ((node: ESTree.FunctionDeclaration & NodeParentExtension) => void) | undefined;
|
| 562 |
+
"FunctionDeclaration:exit"?: ((node: ESTree.FunctionDeclaration & NodeParentExtension) => void) | undefined;
|
| 563 |
+
FunctionExpression?: ((node: ESTree.FunctionExpression & NodeParentExtension) => void) | undefined;
|
| 564 |
+
"FunctionExpression:exit"?: ((node: ESTree.FunctionExpression & NodeParentExtension) => void) | undefined;
|
| 565 |
+
Identifier?: ((node: ESTree.Identifier & NodeParentExtension) => void) | undefined;
|
| 566 |
+
"Identifier:exit"?: ((node: ESTree.Identifier & NodeParentExtension) => void) | undefined;
|
| 567 |
+
IfStatement?: ((node: ESTree.IfStatement & NodeParentExtension) => void) | undefined;
|
| 568 |
+
"IfStatement:exit"?: ((node: ESTree.IfStatement & NodeParentExtension) => void) | undefined;
|
| 569 |
+
ImportDeclaration?: ((node: ESTree.ImportDeclaration & NodeParentExtension) => void) | undefined;
|
| 570 |
+
"ImportDeclaration:exit"?: ((node: ESTree.ImportDeclaration & NodeParentExtension) => void) | undefined;
|
| 571 |
+
ImportDefaultSpecifier?: ((node: ESTree.ImportDefaultSpecifier & NodeParentExtension) => void) | undefined;
|
| 572 |
+
"ImportDefaultSpecifier:exit"?:
|
| 573 |
+
| ((node: ESTree.ImportDefaultSpecifier & NodeParentExtension) => void)
|
| 574 |
+
| undefined;
|
| 575 |
+
ImportExpression?: ((node: ESTree.ImportExpression & NodeParentExtension) => void) | undefined;
|
| 576 |
+
"ImportExpression:exit"?: ((node: ESTree.ImportExpression & NodeParentExtension) => void) | undefined;
|
| 577 |
+
ImportNamespaceSpecifier?: ((node: ESTree.ImportNamespaceSpecifier & NodeParentExtension) => void) | undefined;
|
| 578 |
+
"ImportNamespaceSpecifier:exit"?:
|
| 579 |
+
| ((node: ESTree.ImportNamespaceSpecifier & NodeParentExtension) => void)
|
| 580 |
+
| undefined;
|
| 581 |
+
ImportSpecifier?: ((node: ESTree.ImportSpecifier & NodeParentExtension) => void) | undefined;
|
| 582 |
+
"ImportSpecifier:exit"?: ((node: ESTree.ImportSpecifier & NodeParentExtension) => void) | undefined;
|
| 583 |
+
LabeledStatement?: ((node: ESTree.LabeledStatement & NodeParentExtension) => void) | undefined;
|
| 584 |
+
"LabeledStatement:exit"?: ((node: ESTree.LabeledStatement & NodeParentExtension) => void) | undefined;
|
| 585 |
+
Literal?: ((node: ESTree.Literal & NodeParentExtension) => void) | undefined;
|
| 586 |
+
"Literal:exit"?: ((node: ESTree.Literal & NodeParentExtension) => void) | undefined;
|
| 587 |
+
LogicalExpression?: ((node: ESTree.LogicalExpression & NodeParentExtension) => void) | undefined;
|
| 588 |
+
"LogicalExpression:exit"?: ((node: ESTree.LogicalExpression & NodeParentExtension) => void) | undefined;
|
| 589 |
+
MemberExpression?: ((node: ESTree.MemberExpression & NodeParentExtension) => void) | undefined;
|
| 590 |
+
"MemberExpression:exit"?: ((node: ESTree.MemberExpression & NodeParentExtension) => void) | undefined;
|
| 591 |
+
MetaProperty?: ((node: ESTree.MetaProperty & NodeParentExtension) => void) | undefined;
|
| 592 |
+
"MetaProperty:exit"?: ((node: ESTree.MetaProperty & NodeParentExtension) => void) | undefined;
|
| 593 |
+
MethodDefinition?: ((node: ESTree.MethodDefinition & NodeParentExtension) => void) | undefined;
|
| 594 |
+
"MethodDefinition:exit"?: ((node: ESTree.MethodDefinition & NodeParentExtension) => void) | undefined;
|
| 595 |
+
NewExpression?: ((node: ESTree.NewExpression & NodeParentExtension) => void) | undefined;
|
| 596 |
+
"NewExpression:exit"?: ((node: ESTree.NewExpression & NodeParentExtension) => void) | undefined;
|
| 597 |
+
ObjectExpression?: ((node: ESTree.ObjectExpression & NodeParentExtension) => void) | undefined;
|
| 598 |
+
"ObjectExpression:exit"?: ((node: ESTree.ObjectExpression & NodeParentExtension) => void) | undefined;
|
| 599 |
+
ObjectPattern?: ((node: ESTree.ObjectPattern & NodeParentExtension) => void) | undefined;
|
| 600 |
+
"ObjectPattern:exit"?: ((node: ESTree.ObjectPattern & NodeParentExtension) => void) | undefined;
|
| 601 |
+
PrivateIdentifier?: ((node: ESTree.PrivateIdentifier & NodeParentExtension) => void) | undefined;
|
| 602 |
+
"PrivateIdentifier:exit"?: ((node: ESTree.PrivateIdentifier & NodeParentExtension) => void) | undefined;
|
| 603 |
+
Program?: ((node: ESTree.Program) => void) | undefined;
|
| 604 |
+
"Program:exit"?: ((node: ESTree.Program) => void) | undefined;
|
| 605 |
+
Property?: ((node: ESTree.Property & NodeParentExtension) => void) | undefined;
|
| 606 |
+
"Property:exit"?: ((node: ESTree.Property & NodeParentExtension) => void) | undefined;
|
| 607 |
+
PropertyDefinition?: ((node: ESTree.PropertyDefinition & NodeParentExtension) => void) | undefined;
|
| 608 |
+
"PropertyDefinition:exit"?: ((node: ESTree.PropertyDefinition & NodeParentExtension) => void) | undefined;
|
| 609 |
+
RestElement?: ((node: ESTree.RestElement & NodeParentExtension) => void) | undefined;
|
| 610 |
+
"RestElement:exit"?: ((node: ESTree.RestElement & NodeParentExtension) => void) | undefined;
|
| 611 |
+
ReturnStatement?: ((node: ESTree.ReturnStatement & NodeParentExtension) => void) | undefined;
|
| 612 |
+
"ReturnStatement:exit"?: ((node: ESTree.ReturnStatement & NodeParentExtension) => void) | undefined;
|
| 613 |
+
SequenceExpression?: ((node: ESTree.SequenceExpression & NodeParentExtension) => void) | undefined;
|
| 614 |
+
"SequenceExpression:exit"?: ((node: ESTree.SequenceExpression & NodeParentExtension) => void) | undefined;
|
| 615 |
+
SpreadElement?: ((node: ESTree.SpreadElement & NodeParentExtension) => void) | undefined;
|
| 616 |
+
"SpreadElement:exit"?: ((node: ESTree.SpreadElement & NodeParentExtension) => void) | undefined;
|
| 617 |
+
StaticBlock?: ((node: ESTree.StaticBlock & NodeParentExtension) => void) | undefined;
|
| 618 |
+
"StaticBlock:exit"?: ((node: ESTree.StaticBlock & NodeParentExtension) => void) | undefined;
|
| 619 |
+
Super?: ((node: ESTree.Super & NodeParentExtension) => void) | undefined;
|
| 620 |
+
"Super:exit"?: ((node: ESTree.Super & NodeParentExtension) => void) | undefined;
|
| 621 |
+
SwitchCase?: ((node: ESTree.SwitchCase & NodeParentExtension) => void) | undefined;
|
| 622 |
+
"SwitchCase:exit"?: ((node: ESTree.SwitchCase & NodeParentExtension) => void) | undefined;
|
| 623 |
+
SwitchStatement?: ((node: ESTree.SwitchStatement & NodeParentExtension) => void) | undefined;
|
| 624 |
+
"SwitchStatement:exit"?: ((node: ESTree.SwitchStatement & NodeParentExtension) => void) | undefined;
|
| 625 |
+
TaggedTemplateExpression?: ((node: ESTree.TaggedTemplateExpression & NodeParentExtension) => void) | undefined;
|
| 626 |
+
"TaggedTemplateExpression:exit"?:
|
| 627 |
+
| ((node: ESTree.TaggedTemplateExpression & NodeParentExtension) => void)
|
| 628 |
+
| undefined;
|
| 629 |
+
TemplateElement?: ((node: ESTree.TemplateElement & NodeParentExtension) => void) | undefined;
|
| 630 |
+
"TemplateElement:exit"?: ((node: ESTree.TemplateElement & NodeParentExtension) => void) | undefined;
|
| 631 |
+
TemplateLiteral?: ((node: ESTree.TemplateLiteral & NodeParentExtension) => void) | undefined;
|
| 632 |
+
"TemplateLiteral:exit"?: ((node: ESTree.TemplateLiteral & NodeParentExtension) => void) | undefined;
|
| 633 |
+
ThisExpression?: ((node: ESTree.ThisExpression & NodeParentExtension) => void) | undefined;
|
| 634 |
+
"ThisExpression:exit"?: ((node: ESTree.ThisExpression & NodeParentExtension) => void) | undefined;
|
| 635 |
+
ThrowStatement?: ((node: ESTree.ThrowStatement & NodeParentExtension) => void) | undefined;
|
| 636 |
+
"ThrowStatement:exit"?: ((node: ESTree.ThrowStatement & NodeParentExtension) => void) | undefined;
|
| 637 |
+
TryStatement?: ((node: ESTree.TryStatement & NodeParentExtension) => void) | undefined;
|
| 638 |
+
"TryStatement:exit"?: ((node: ESTree.TryStatement & NodeParentExtension) => void) | undefined;
|
| 639 |
+
UnaryExpression?: ((node: ESTree.UnaryExpression & NodeParentExtension) => void) | undefined;
|
| 640 |
+
"UnaryExpression:exit"?: ((node: ESTree.UnaryExpression & NodeParentExtension) => void) | undefined;
|
| 641 |
+
UpdateExpression?: ((node: ESTree.UpdateExpression & NodeParentExtension) => void) | undefined;
|
| 642 |
+
"UpdateExpression:exit"?: ((node: ESTree.UpdateExpression & NodeParentExtension) => void) | undefined;
|
| 643 |
+
VariableDeclaration?: ((node: ESTree.VariableDeclaration & NodeParentExtension) => void) | undefined;
|
| 644 |
+
"VariableDeclaration:exit"?: ((node: ESTree.VariableDeclaration & NodeParentExtension) => void) | undefined;
|
| 645 |
+
VariableDeclarator?: ((node: ESTree.VariableDeclarator & NodeParentExtension) => void) | undefined;
|
| 646 |
+
"VariableDeclarator:exit"?: ((node: ESTree.VariableDeclarator & NodeParentExtension) => void) | undefined;
|
| 647 |
+
WhileStatement?: ((node: ESTree.WhileStatement & NodeParentExtension) => void) | undefined;
|
| 648 |
+
"WhileStatement:exit"?: ((node: ESTree.WhileStatement & NodeParentExtension) => void) | undefined;
|
| 649 |
+
WithStatement?: ((node: ESTree.WithStatement & NodeParentExtension) => void) | undefined;
|
| 650 |
+
"WithStatement:exit"?: ((node: ESTree.WithStatement & NodeParentExtension) => void) | undefined;
|
| 651 |
+
YieldExpression?: ((node: ESTree.YieldExpression & NodeParentExtension) => void) | undefined;
|
| 652 |
+
"YieldExpression:exit"?: ((node: ESTree.YieldExpression & NodeParentExtension) => void) | undefined;
|
| 653 |
+
}
|
| 654 |
+
|
| 655 |
+
interface NodeParentExtension {
|
| 656 |
+
parent: Node;
|
| 657 |
+
}
|
| 658 |
+
type Node = ESTree.Node & NodeParentExtension;
|
| 659 |
+
|
| 660 |
+
interface RuleListener extends NodeListener {
|
| 661 |
+
onCodePathStart?(codePath: CodePath, node: Node): void;
|
| 662 |
+
|
| 663 |
+
onCodePathEnd?(codePath: CodePath, node: Node): void;
|
| 664 |
+
|
| 665 |
+
onCodePathSegmentStart?(segment: CodePathSegment, node: Node): void;
|
| 666 |
+
|
| 667 |
+
onCodePathSegmentEnd?(segment: CodePathSegment, node: Node): void;
|
| 668 |
+
|
| 669 |
+
onCodePathSegmentLoop?(fromSegment: CodePathSegment, toSegment: CodePathSegment, node: Node): void;
|
| 670 |
+
|
| 671 |
+
[key: string]:
|
| 672 |
+
| ((codePath: CodePath, node: Node) => void)
|
| 673 |
+
| ((segment: CodePathSegment, node: Node) => void)
|
| 674 |
+
| ((fromSegment: CodePathSegment, toSegment: CodePathSegment, node: Node) => void)
|
| 675 |
+
| ((node: Node) => void)
|
| 676 |
+
| NodeListener[keyof NodeListener]
|
| 677 |
+
| undefined;
|
| 678 |
+
}
|
| 679 |
+
|
| 680 |
+
interface CodePath {
|
| 681 |
+
id: string;
|
| 682 |
+
initialSegment: CodePathSegment;
|
| 683 |
+
finalSegments: CodePathSegment[];
|
| 684 |
+
returnedSegments: CodePathSegment[];
|
| 685 |
+
thrownSegments: CodePathSegment[];
|
| 686 |
+
currentSegments: CodePathSegment[];
|
| 687 |
+
upper: CodePath | null;
|
| 688 |
+
childCodePaths: CodePath[];
|
| 689 |
+
}
|
| 690 |
+
|
| 691 |
+
interface CodePathSegment {
|
| 692 |
+
id: string;
|
| 693 |
+
nextSegments: CodePathSegment[];
|
| 694 |
+
prevSegments: CodePathSegment[];
|
| 695 |
+
reachable: boolean;
|
| 696 |
+
}
|
| 697 |
+
|
| 698 |
+
interface RuleMetaData {
|
| 699 |
+
/** Properties often used for documentation generation and tooling. */
|
| 700 |
+
docs?: {
|
| 701 |
+
/** Provides a short description of the rule. Commonly used when generating lists of rules. */
|
| 702 |
+
description?: string | undefined;
|
| 703 |
+
/** Historically used by some plugins that divide rules into categories in their documentation. */
|
| 704 |
+
category?: string | undefined;
|
| 705 |
+
/** Historically used by some plugins to indicate a rule belongs in their `recommended` configuration. */
|
| 706 |
+
recommended?: boolean | undefined;
|
| 707 |
+
/** Specifies the URL at which the full documentation can be accessed. Code editors often use this to provide a helpful link on highlighted rule violations. */
|
| 708 |
+
url?: string | undefined;
|
| 709 |
+
/**
|
| 710 |
+
* TODO: remove this field in next major release of @types/eslint.
|
| 711 |
+
* @deprecated use `meta.hasSuggestions` instead
|
| 712 |
+
*/
|
| 713 |
+
suggestion?: boolean | undefined;
|
| 714 |
+
} | undefined;
|
| 715 |
+
/** Violation and suggestion messages. */
|
| 716 |
+
messages?: { [messageId: string]: string } | undefined;
|
| 717 |
+
/**
|
| 718 |
+
* Specifies if the `--fix` option on the command line automatically fixes problems reported by the rule.
|
| 719 |
+
* Mandatory for fixable rules.
|
| 720 |
+
*/
|
| 721 |
+
fixable?: "code" | "whitespace" | undefined;
|
| 722 |
+
/**
|
| 723 |
+
* Specifies the [options](https://eslint.org/docs/latest/developer-guide/working-with-rules#options-schemas)
|
| 724 |
+
* so ESLint can prevent invalid [rule configurations](https://eslint.org/docs/latest/user-guide/configuring/rules#configuring-rules).
|
| 725 |
+
* Mandatory for rules with options.
|
| 726 |
+
*/
|
| 727 |
+
schema?: JSONSchema4 | JSONSchema4[] | undefined;
|
| 728 |
+
|
| 729 |
+
/** Indicates whether the rule has been deprecated. Omit if not deprecated. */
|
| 730 |
+
deprecated?: boolean | undefined;
|
| 731 |
+
/** The name of the rule(s) this rule was replaced by, if it was deprecated. */
|
| 732 |
+
replacedBy?: readonly string[];
|
| 733 |
+
|
| 734 |
+
/**
|
| 735 |
+
* Indicates the type of rule:
|
| 736 |
+
* - `"problem"` means the rule is identifying code that either will cause an error or may cause a confusing behavior. Developers should consider this a high priority to resolve.
|
| 737 |
+
* - `"suggestion"` means the rule is identifying something that could be done in a better way but no errors will occur if the code isn’t changed.
|
| 738 |
+
* - `"layout"` means the rule cares primarily about whitespace, semicolons, commas, and parentheses,
|
| 739 |
+
* all the parts of the program that determine how the code looks rather than how it executes.
|
| 740 |
+
* These rules work on parts of the code that aren’t specified in the AST.
|
| 741 |
+
*/
|
| 742 |
+
type?: "problem" | "suggestion" | "layout" | undefined;
|
| 743 |
+
/**
|
| 744 |
+
* Specifies whether the rule can return suggestions (defaults to `false` if omitted).
|
| 745 |
+
* Mandatory for rules that provide suggestions.
|
| 746 |
+
*/
|
| 747 |
+
hasSuggestions?: boolean | undefined;
|
| 748 |
+
}
|
| 749 |
+
|
| 750 |
+
interface RuleContext {
|
| 751 |
+
id: string;
|
| 752 |
+
options: any[];
|
| 753 |
+
settings: { [name: string]: any };
|
| 754 |
+
parserPath: string | undefined;
|
| 755 |
+
languageOptions: Linter.FlatConfig["languageOptions"];
|
| 756 |
+
parserOptions: Linter.ParserOptions;
|
| 757 |
+
parserServices: SourceCode.ParserServices;
|
| 758 |
+
cwd: string;
|
| 759 |
+
filename: string;
|
| 760 |
+
physicalFilename: string;
|
| 761 |
+
sourceCode: SourceCode;
|
| 762 |
+
|
| 763 |
+
getAncestors(): ESTree.Node[];
|
| 764 |
+
|
| 765 |
+
getDeclaredVariables(node: ESTree.Node): Scope.Variable[];
|
| 766 |
+
|
| 767 |
+
/** @deprecated Use property `filename` directly instead */
|
| 768 |
+
getFilename(): string;
|
| 769 |
+
|
| 770 |
+
/** @deprecated Use property `physicalFilename` directly instead */
|
| 771 |
+
getPhysicalFilename(): string;
|
| 772 |
+
|
| 773 |
+
/** @deprecated Use property `cwd` directly instead */
|
| 774 |
+
getCwd(): string;
|
| 775 |
+
|
| 776 |
+
getScope(): Scope.Scope;
|
| 777 |
+
|
| 778 |
+
/** @deprecated Use property `sourceCode` directly instead */
|
| 779 |
+
getSourceCode(): SourceCode;
|
| 780 |
+
|
| 781 |
+
markVariableAsUsed(name: string): boolean;
|
| 782 |
+
|
| 783 |
+
report(descriptor: ReportDescriptor): void;
|
| 784 |
+
}
|
| 785 |
+
|
| 786 |
+
type ReportFixer = (fixer: RuleFixer) => null | Fix | IterableIterator<Fix> | Fix[];
|
| 787 |
+
|
| 788 |
+
interface ReportDescriptorOptionsBase {
|
| 789 |
+
data?: { [key: string]: string };
|
| 790 |
+
|
| 791 |
+
fix?: null | ReportFixer;
|
| 792 |
+
}
|
| 793 |
+
|
| 794 |
+
interface SuggestionReportOptions {
|
| 795 |
+
data?: { [key: string]: string };
|
| 796 |
+
|
| 797 |
+
fix: ReportFixer;
|
| 798 |
+
}
|
| 799 |
+
|
| 800 |
+
type SuggestionDescriptorMessage = { desc: string } | { messageId: string };
|
| 801 |
+
type SuggestionReportDescriptor = SuggestionDescriptorMessage & SuggestionReportOptions;
|
| 802 |
+
|
| 803 |
+
interface ReportDescriptorOptions extends ReportDescriptorOptionsBase {
|
| 804 |
+
suggest?: SuggestionReportDescriptor[] | null | undefined;
|
| 805 |
+
}
|
| 806 |
+
|
| 807 |
+
type ReportDescriptor = ReportDescriptorMessage & ReportDescriptorLocation & ReportDescriptorOptions;
|
| 808 |
+
type ReportDescriptorMessage = { message: string } | { messageId: string };
|
| 809 |
+
type ReportDescriptorLocation =
|
| 810 |
+
| { node: ESTree.Node }
|
| 811 |
+
| { loc: AST.SourceLocation | { line: number; column: number } };
|
| 812 |
+
|
| 813 |
+
interface RuleFixer {
|
| 814 |
+
insertTextAfter(nodeOrToken: ESTree.Node | AST.Token, text: string): Fix;
|
| 815 |
+
|
| 816 |
+
insertTextAfterRange(range: AST.Range, text: string): Fix;
|
| 817 |
+
|
| 818 |
+
insertTextBefore(nodeOrToken: ESTree.Node | AST.Token, text: string): Fix;
|
| 819 |
+
|
| 820 |
+
insertTextBeforeRange(range: AST.Range, text: string): Fix;
|
| 821 |
+
|
| 822 |
+
remove(nodeOrToken: ESTree.Node | AST.Token): Fix;
|
| 823 |
+
|
| 824 |
+
removeRange(range: AST.Range): Fix;
|
| 825 |
+
|
| 826 |
+
replaceText(nodeOrToken: ESTree.Node | AST.Token, text: string): Fix;
|
| 827 |
+
|
| 828 |
+
replaceTextRange(range: AST.Range, text: string): Fix;
|
| 829 |
+
}
|
| 830 |
+
|
| 831 |
+
interface Fix {
|
| 832 |
+
range: AST.Range;
|
| 833 |
+
text: string;
|
| 834 |
+
}
|
| 835 |
+
}
|
| 836 |
+
|
| 837 |
+
// #region Linter
|
| 838 |
+
|
| 839 |
+
export class Linter {
|
| 840 |
+
static version: string;
|
| 841 |
+
|
| 842 |
+
version: string;
|
| 843 |
+
|
| 844 |
+
constructor(options?: { cwd?: string | undefined; configType?: "flat" | "eslintrc" });
|
| 845 |
+
|
| 846 |
+
verify(
|
| 847 |
+
code: SourceCode | string,
|
| 848 |
+
config: Linter.Config | Linter.FlatConfig[],
|
| 849 |
+
filename?: string,
|
| 850 |
+
): Linter.LintMessage[];
|
| 851 |
+
verify(
|
| 852 |
+
code: SourceCode | string,
|
| 853 |
+
config: Linter.Config | Linter.FlatConfig[],
|
| 854 |
+
options: Linter.LintOptions,
|
| 855 |
+
): Linter.LintMessage[];
|
| 856 |
+
|
| 857 |
+
verifyAndFix(code: string, config: Linter.Config | Linter.FlatConfig[], filename?: string): Linter.FixReport;
|
| 858 |
+
verifyAndFix(
|
| 859 |
+
code: string,
|
| 860 |
+
config: Linter.Config | Linter.FlatConfig[],
|
| 861 |
+
options: Linter.FixOptions,
|
| 862 |
+
): Linter.FixReport;
|
| 863 |
+
|
| 864 |
+
getSourceCode(): SourceCode;
|
| 865 |
+
|
| 866 |
+
defineRule(name: string, rule: Rule.RuleModule): void;
|
| 867 |
+
|
| 868 |
+
defineRules(rules: { [name: string]: Rule.RuleModule }): void;
|
| 869 |
+
|
| 870 |
+
getRules(): Map<string, Rule.RuleModule>;
|
| 871 |
+
|
| 872 |
+
defineParser(name: string, parser: Linter.ParserModule): void;
|
| 873 |
+
}
|
| 874 |
+
|
| 875 |
+
export namespace Linter {
|
| 876 |
+
/**
|
| 877 |
+
* The numeric severity level for a rule.
|
| 878 |
+
*
|
| 879 |
+
* - `0` means off.
|
| 880 |
+
* - `1` means warn.
|
| 881 |
+
* - `2` means error.
|
| 882 |
+
*
|
| 883 |
+
* @see [Rule Severities](https://eslint.org/docs/latest/use/configure/rules#rule-severities)
|
| 884 |
+
*/
|
| 885 |
+
type Severity = 0 | 1 | 2;
|
| 886 |
+
|
| 887 |
+
/**
|
| 888 |
+
* The human readable severity level for a rule.
|
| 889 |
+
*
|
| 890 |
+
* @see [Rule Severities](https://eslint.org/docs/latest/use/configure/rules#rule-severities)
|
| 891 |
+
*/
|
| 892 |
+
type StringSeverity = "off" | "warn" | "error";
|
| 893 |
+
|
| 894 |
+
/**
|
| 895 |
+
* The numeric or human readable severity level for a rule.
|
| 896 |
+
*
|
| 897 |
+
* @see [Rule Severities](https://eslint.org/docs/latest/use/configure/rules#rule-severities)
|
| 898 |
+
*/
|
| 899 |
+
type RuleLevel = Severity | StringSeverity;
|
| 900 |
+
|
| 901 |
+
/**
|
| 902 |
+
* An array containing the rule severity level, followed by the rule options.
|
| 903 |
+
*
|
| 904 |
+
* @see [Rules](https://eslint.org/docs/user-guide/configuring/rules)
|
| 905 |
+
*/
|
| 906 |
+
type RuleLevelAndOptions<Options extends any[] = any[]> = Prepend<Partial<Options>, RuleLevel>;
|
| 907 |
+
|
| 908 |
+
/**
|
| 909 |
+
* The severity level for the rule or an array containing the rule severity level, followed by the rule options.
|
| 910 |
+
*
|
| 911 |
+
* @see [Rules](https://eslint.org/docs/user-guide/configuring/rules)
|
| 912 |
+
*/
|
| 913 |
+
type RuleEntry<Options extends any[] = any[]> = RuleLevel | RuleLevelAndOptions<Options>;
|
| 914 |
+
|
| 915 |
+
/**
|
| 916 |
+
* The rules config object is a key/value map of rule names and their severity and options.
|
| 917 |
+
*/
|
| 918 |
+
interface RulesRecord {
|
| 919 |
+
[rule: string]: RuleEntry;
|
| 920 |
+
}
|
| 921 |
+
|
| 922 |
+
/**
|
| 923 |
+
* A configuration object that may have a `rules` block.
|
| 924 |
+
*/
|
| 925 |
+
interface HasRules<Rules extends RulesRecord = RulesRecord> {
|
| 926 |
+
rules?: Partial<Rules> | undefined;
|
| 927 |
+
}
|
| 928 |
+
|
| 929 |
+
/**
|
| 930 |
+
* ESLint configuration.
|
| 931 |
+
*
|
| 932 |
+
* @see [ESLint Configuration](https://eslint.org/docs/latest/user-guide/configuring/)
|
| 933 |
+
*/
|
| 934 |
+
interface BaseConfig<Rules extends RulesRecord = RulesRecord, OverrideRules extends RulesRecord = Rules>
|
| 935 |
+
extends HasRules<Rules>
|
| 936 |
+
{
|
| 937 |
+
$schema?: string | undefined;
|
| 938 |
+
|
| 939 |
+
/**
|
| 940 |
+
* An environment provides predefined global variables.
|
| 941 |
+
*
|
| 942 |
+
* @see [Environments](https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-environments)
|
| 943 |
+
*/
|
| 944 |
+
env?: { [name: string]: boolean } | undefined;
|
| 945 |
+
|
| 946 |
+
/**
|
| 947 |
+
* Extending configuration files.
|
| 948 |
+
*
|
| 949 |
+
* @see [Extends](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#extending-configuration-files)
|
| 950 |
+
*/
|
| 951 |
+
extends?: string | string[] | undefined;
|
| 952 |
+
|
| 953 |
+
/**
|
| 954 |
+
* Specifying globals.
|
| 955 |
+
*
|
| 956 |
+
* @see [Globals](https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-globals)
|
| 957 |
+
*/
|
| 958 |
+
globals?: { [name: string]: boolean | "off" | "readonly" | "readable" | "writable" | "writeable" } | undefined;
|
| 959 |
+
|
| 960 |
+
/**
|
| 961 |
+
* Disable processing of inline comments.
|
| 962 |
+
*
|
| 963 |
+
* @see [Disabling Inline Comments](https://eslint.org/docs/latest/user-guide/configuring/rules#disabling-inline-comments)
|
| 964 |
+
*/
|
| 965 |
+
noInlineConfig?: boolean | undefined;
|
| 966 |
+
|
| 967 |
+
/**
|
| 968 |
+
* Overrides can be used to use a differing configuration for matching sub-directories and files.
|
| 969 |
+
*
|
| 970 |
+
* @see [How do overrides work](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#how-do-overrides-work)
|
| 971 |
+
*/
|
| 972 |
+
overrides?: Array<ConfigOverride<OverrideRules>> | undefined;
|
| 973 |
+
|
| 974 |
+
/**
|
| 975 |
+
* Parser.
|
| 976 |
+
*
|
| 977 |
+
* @see [Working with Custom Parsers](https://eslint.org/docs/latest/developer-guide/working-with-custom-parsers)
|
| 978 |
+
* @see [Specifying Parser](https://eslint.org/docs/latest/user-guide/configuring/plugins#configure-a-parser)
|
| 979 |
+
*/
|
| 980 |
+
parser?: string | undefined;
|
| 981 |
+
|
| 982 |
+
/**
|
| 983 |
+
* Parser options.
|
| 984 |
+
*
|
| 985 |
+
* @see [Working with Custom Parsers](https://eslint.org/docs/latest/developer-guide/working-with-custom-parsers)
|
| 986 |
+
* @see [Specifying Parser Options](https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options)
|
| 987 |
+
*/
|
| 988 |
+
parserOptions?: ParserOptions | undefined;
|
| 989 |
+
|
| 990 |
+
/**
|
| 991 |
+
* Which third-party plugins define additional rules, environments, configs, etc. for ESLint to use.
|
| 992 |
+
*
|
| 993 |
+
* @see [Configuring Plugins](https://eslint.org/docs/latest/user-guide/configuring/plugins#configure-plugins)
|
| 994 |
+
*/
|
| 995 |
+
plugins?: string[] | undefined;
|
| 996 |
+
|
| 997 |
+
/**
|
| 998 |
+
* Specifying processor.
|
| 999 |
+
*
|
| 1000 |
+
* @see [processor](https://eslint.org/docs/latest/user-guide/configuring/plugins#specify-a-processor)
|
| 1001 |
+
*/
|
| 1002 |
+
processor?: string | undefined;
|
| 1003 |
+
|
| 1004 |
+
/**
|
| 1005 |
+
* Report unused `ESLint-disable` comments as warning.
|
| 1006 |
+
*
|
| 1007 |
+
* @see [Report unused `ESLint-disable` comments](https://eslint.org/docs/latest/user-guide/configuring/rules#report-unused-eslint-disable-comments)
|
| 1008 |
+
*/
|
| 1009 |
+
reportUnusedDisableDirectives?: boolean | undefined;
|
| 1010 |
+
|
| 1011 |
+
/**
|
| 1012 |
+
* Settings.
|
| 1013 |
+
*
|
| 1014 |
+
* @see [Settings](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#adding-shared-settings)
|
| 1015 |
+
*/
|
| 1016 |
+
settings?: { [name: string]: any } | undefined;
|
| 1017 |
+
}
|
| 1018 |
+
|
| 1019 |
+
/**
|
| 1020 |
+
* The overwrites that apply more differing configuration to specific files or directories.
|
| 1021 |
+
*/
|
| 1022 |
+
interface ConfigOverride<Rules extends RulesRecord = RulesRecord> extends BaseConfig<Rules> {
|
| 1023 |
+
/**
|
| 1024 |
+
* The glob patterns for excluded files.
|
| 1025 |
+
*/
|
| 1026 |
+
excludedFiles?: string | string[] | undefined;
|
| 1027 |
+
|
| 1028 |
+
/**
|
| 1029 |
+
* The glob patterns for target files.
|
| 1030 |
+
*/
|
| 1031 |
+
files: string | string[];
|
| 1032 |
+
}
|
| 1033 |
+
|
| 1034 |
+
/**
|
| 1035 |
+
* ESLint configuration.
|
| 1036 |
+
*
|
| 1037 |
+
* @see [ESLint Configuration](https://eslint.org/docs/latest/user-guide/configuring/)
|
| 1038 |
+
*/
|
| 1039 |
+
// https://github.com/eslint/eslint/blob/v6.8.0/conf/config-schema.js
|
| 1040 |
+
interface Config<Rules extends RulesRecord = RulesRecord, OverrideRules extends RulesRecord = Rules>
|
| 1041 |
+
extends BaseConfig<Rules, OverrideRules>
|
| 1042 |
+
{
|
| 1043 |
+
/**
|
| 1044 |
+
* Tell ESLint to ignore specific files and directories.
|
| 1045 |
+
*
|
| 1046 |
+
* @see [Ignore Patterns](https://eslint.org/docs/latest/user-guide/configuring/ignoring-code)
|
| 1047 |
+
*/
|
| 1048 |
+
ignorePatterns?: string | string[] | undefined;
|
| 1049 |
+
|
| 1050 |
+
/**
|
| 1051 |
+
* @see [Using Configuration Files](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#using-configuration-files)
|
| 1052 |
+
*/
|
| 1053 |
+
root?: boolean | undefined;
|
| 1054 |
+
}
|
| 1055 |
+
|
| 1056 |
+
/**
|
| 1057 |
+
* An alias for `Config` for interoperability with `@types/eslint@9`.
|
| 1058 |
+
*/
|
| 1059 |
+
type LegacyConfig = Config;
|
| 1060 |
+
|
| 1061 |
+
/**
|
| 1062 |
+
* Parser options.
|
| 1063 |
+
*
|
| 1064 |
+
* @see [Specifying Parser Options](https://eslint.org/docs/user-guide/configuring/language-options#specifying-parser-options)
|
| 1065 |
+
*/
|
| 1066 |
+
interface ParserOptions {
|
| 1067 |
+
/**
|
| 1068 |
+
* Accepts any valid ECMAScript version number or `'latest'`:
|
| 1069 |
+
*
|
| 1070 |
+
* - A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, es14, ..., or
|
| 1071 |
+
* - A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, ..., or
|
| 1072 |
+
* - `'latest'`
|
| 1073 |
+
*
|
| 1074 |
+
* When it's a version or a year, the value must be a number - so do not include the `es` prefix.
|
| 1075 |
+
*
|
| 1076 |
+
* Specifies the version of ECMAScript syntax you want to use. This is used by the parser to determine how to perform scope analysis, and it affects the default
|
| 1077 |
+
*
|
| 1078 |
+
* @default 2018
|
| 1079 |
+
*
|
| 1080 |
+
* @see https://typescript-eslint.io/architecture/parser/#ecmaversion
|
| 1081 |
+
*/
|
| 1082 |
+
ecmaVersion?:
|
| 1083 |
+
| 3
|
| 1084 |
+
| 5
|
| 1085 |
+
| 6
|
| 1086 |
+
| 7
|
| 1087 |
+
| 8
|
| 1088 |
+
| 9
|
| 1089 |
+
| 10
|
| 1090 |
+
| 11
|
| 1091 |
+
| 12
|
| 1092 |
+
| 13
|
| 1093 |
+
| 14
|
| 1094 |
+
| 15
|
| 1095 |
+
| 2015
|
| 1096 |
+
| 2016
|
| 1097 |
+
| 2017
|
| 1098 |
+
| 2018
|
| 1099 |
+
| 2019
|
| 1100 |
+
| 2020
|
| 1101 |
+
| 2021
|
| 1102 |
+
| 2022
|
| 1103 |
+
| 2023
|
| 1104 |
+
| 2024
|
| 1105 |
+
| "latest"
|
| 1106 |
+
| undefined;
|
| 1107 |
+
|
| 1108 |
+
/**
|
| 1109 |
+
* Set to "script" (default) or "module" if your code is in ECMAScript modules.
|
| 1110 |
+
*
|
| 1111 |
+
* @default 'script'
|
| 1112 |
+
*
|
| 1113 |
+
* @see https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options
|
| 1114 |
+
*/
|
| 1115 |
+
sourceType?: "script" | "module" | undefined;
|
| 1116 |
+
|
| 1117 |
+
/**
|
| 1118 |
+
* An object indicating which additional language features you'd like to use.
|
| 1119 |
+
*
|
| 1120 |
+
* @see https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options
|
| 1121 |
+
* @see https://typescript-eslint.io/architecture/parser#ecmafeatures
|
| 1122 |
+
*/
|
| 1123 |
+
ecmaFeatures?: {
|
| 1124 |
+
globalReturn?: boolean | undefined;
|
| 1125 |
+
impliedStrict?: boolean | undefined;
|
| 1126 |
+
jsx?: boolean | undefined;
|
| 1127 |
+
experimentalObjectRestSpread?: boolean | undefined;
|
| 1128 |
+
[key: string]: any;
|
| 1129 |
+
} | undefined;
|
| 1130 |
+
[key: string]: any;
|
| 1131 |
+
}
|
| 1132 |
+
|
| 1133 |
+
interface LintOptions {
|
| 1134 |
+
filename?: string | undefined;
|
| 1135 |
+
preprocess?: ((code: string) => string[]) | undefined;
|
| 1136 |
+
postprocess?: ((problemLists: LintMessage[][]) => LintMessage[]) | undefined;
|
| 1137 |
+
filterCodeBlock?: boolean | undefined;
|
| 1138 |
+
disableFixes?: boolean | undefined;
|
| 1139 |
+
allowInlineConfig?: boolean | undefined;
|
| 1140 |
+
reportUnusedDisableDirectives?: boolean | undefined;
|
| 1141 |
+
}
|
| 1142 |
+
|
| 1143 |
+
interface LintSuggestion {
|
| 1144 |
+
desc: string;
|
| 1145 |
+
fix: Rule.Fix;
|
| 1146 |
+
messageId?: string | undefined;
|
| 1147 |
+
}
|
| 1148 |
+
|
| 1149 |
+
interface LintMessage {
|
| 1150 |
+
column: number;
|
| 1151 |
+
line: number;
|
| 1152 |
+
endColumn?: number | undefined;
|
| 1153 |
+
endLine?: number | undefined;
|
| 1154 |
+
ruleId: string | null;
|
| 1155 |
+
message: string;
|
| 1156 |
+
messageId?: string | undefined;
|
| 1157 |
+
nodeType?: string | undefined;
|
| 1158 |
+
fatal?: true | undefined;
|
| 1159 |
+
severity: Severity;
|
| 1160 |
+
fix?: Rule.Fix | undefined;
|
| 1161 |
+
/** @deprecated Use `linter.getSourceCode()` */
|
| 1162 |
+
source?: string | null | undefined;
|
| 1163 |
+
suggestions?: LintSuggestion[] | undefined;
|
| 1164 |
+
}
|
| 1165 |
+
|
| 1166 |
+
interface LintSuppression {
|
| 1167 |
+
kind: string;
|
| 1168 |
+
justification: string;
|
| 1169 |
+
}
|
| 1170 |
+
|
| 1171 |
+
interface SuppressedLintMessage extends LintMessage {
|
| 1172 |
+
suppressions: LintSuppression[];
|
| 1173 |
+
}
|
| 1174 |
+
|
| 1175 |
+
interface FixOptions extends LintOptions {
|
| 1176 |
+
fix?: boolean | undefined;
|
| 1177 |
+
}
|
| 1178 |
+
|
| 1179 |
+
interface FixReport {
|
| 1180 |
+
fixed: boolean;
|
| 1181 |
+
output: string;
|
| 1182 |
+
messages: LintMessage[];
|
| 1183 |
+
}
|
| 1184 |
+
|
| 1185 |
+
// Temporarily loosen type for just flat config files (see #68232)
|
| 1186 |
+
type FlatConfigParserModule =
|
| 1187 |
+
& Omit<ParserModule, "parseForESLint">
|
| 1188 |
+
& ({
|
| 1189 |
+
parse(text: string, options?: any): unknown;
|
| 1190 |
+
} | {
|
| 1191 |
+
parseForESLint(text: string, options?: any): Omit<ESLintParseResult, "ast" | "scopeManager"> & {
|
| 1192 |
+
ast: unknown;
|
| 1193 |
+
scopeManager?: unknown;
|
| 1194 |
+
};
|
| 1195 |
+
});
|
| 1196 |
+
|
| 1197 |
+
type ParserModule =
|
| 1198 |
+
& ESLint.ObjectMetaProperties
|
| 1199 |
+
& (
|
| 1200 |
+
| { parse(text: string, options?: any): AST.Program }
|
| 1201 |
+
| { parseForESLint(text: string, options?: any): ESLintParseResult }
|
| 1202 |
+
);
|
| 1203 |
+
|
| 1204 |
+
interface ESLintParseResult {
|
| 1205 |
+
ast: AST.Program;
|
| 1206 |
+
parserServices?: SourceCode.ParserServices | undefined;
|
| 1207 |
+
scopeManager?: Scope.ScopeManager | undefined;
|
| 1208 |
+
visitorKeys?: SourceCode.VisitorKeys | undefined;
|
| 1209 |
+
}
|
| 1210 |
+
|
| 1211 |
+
interface ProcessorFile {
|
| 1212 |
+
text: string;
|
| 1213 |
+
filename: string;
|
| 1214 |
+
}
|
| 1215 |
+
|
| 1216 |
+
// https://eslint.org/docs/developer-guide/working-with-plugins#processors-in-plugins
|
| 1217 |
+
interface Processor<T extends string | ProcessorFile = string | ProcessorFile> extends ESLint.ObjectMetaProperties {
|
| 1218 |
+
supportsAutofix?: boolean | undefined;
|
| 1219 |
+
preprocess?(text: string, filename: string): T[];
|
| 1220 |
+
postprocess?(messages: LintMessage[][], filename: string): LintMessage[];
|
| 1221 |
+
}
|
| 1222 |
+
|
| 1223 |
+
interface FlatConfig<Rules extends RulesRecord = RulesRecord> {
|
| 1224 |
+
/**
|
| 1225 |
+
* An string to identify the configuration object. Used in error messages and
|
| 1226 |
+
* inspection tools.
|
| 1227 |
+
*/
|
| 1228 |
+
name?: string;
|
| 1229 |
+
|
| 1230 |
+
/**
|
| 1231 |
+
* An array of glob patterns indicating the files that the configuration
|
| 1232 |
+
* object should apply to. If not specified, the configuration object applies
|
| 1233 |
+
* to all files
|
| 1234 |
+
*/
|
| 1235 |
+
files?: Array<string | string[]>;
|
| 1236 |
+
|
| 1237 |
+
/**
|
| 1238 |
+
* An array of glob patterns indicating the files that the configuration
|
| 1239 |
+
* object should not apply to. If not specified, the configuration object
|
| 1240 |
+
* applies to all files matched by files
|
| 1241 |
+
*/
|
| 1242 |
+
ignores?: string[];
|
| 1243 |
+
|
| 1244 |
+
/**
|
| 1245 |
+
* An object containing settings related to how JavaScript is configured for
|
| 1246 |
+
* linting.
|
| 1247 |
+
*/
|
| 1248 |
+
languageOptions?: {
|
| 1249 |
+
/**
|
| 1250 |
+
* The version of ECMAScript to support. May be any year (i.e., 2022) or
|
| 1251 |
+
* version (i.e., 5). Set to "latest" for the most recent supported version.
|
| 1252 |
+
* @default "latest"
|
| 1253 |
+
*/
|
| 1254 |
+
ecmaVersion?: ParserOptions["ecmaVersion"];
|
| 1255 |
+
|
| 1256 |
+
/**
|
| 1257 |
+
* The type of JavaScript source code. Possible values are "script" for
|
| 1258 |
+
* traditional script files, "module" for ECMAScript modules (ESM), and
|
| 1259 |
+
* "commonjs" for CommonJS files. (default: "module" for .js and .mjs
|
| 1260 |
+
* files; "commonjs" for .cjs files)
|
| 1261 |
+
*/
|
| 1262 |
+
sourceType?: "script" | "module" | "commonjs";
|
| 1263 |
+
|
| 1264 |
+
/**
|
| 1265 |
+
* An object specifying additional objects that should be added to the
|
| 1266 |
+
* global scope during linting.
|
| 1267 |
+
*/
|
| 1268 |
+
globals?: ESLint.Environment["globals"];
|
| 1269 |
+
|
| 1270 |
+
/**
|
| 1271 |
+
* An object containing a parse() or parseForESLint() method.
|
| 1272 |
+
* If not configured, the default ESLint parser (Espree) will be used.
|
| 1273 |
+
*/
|
| 1274 |
+
parser?: FlatConfigParserModule;
|
| 1275 |
+
|
| 1276 |
+
/**
|
| 1277 |
+
* An object specifying additional options that are passed directly to the
|
| 1278 |
+
* parser() method on the parser. The available options are parser-dependent
|
| 1279 |
+
*/
|
| 1280 |
+
parserOptions?: ESLint.Environment["parserOptions"];
|
| 1281 |
+
};
|
| 1282 |
+
|
| 1283 |
+
/**
|
| 1284 |
+
* An object containing settings related to the linting process
|
| 1285 |
+
*/
|
| 1286 |
+
linterOptions?: {
|
| 1287 |
+
/**
|
| 1288 |
+
* A boolean value indicating if inline configuration is allowed.
|
| 1289 |
+
*/
|
| 1290 |
+
noInlineConfig?: boolean;
|
| 1291 |
+
|
| 1292 |
+
/**
|
| 1293 |
+
* A severity value indicating if and how unused disable directives should be
|
| 1294 |
+
* tracked and reported.
|
| 1295 |
+
*/
|
| 1296 |
+
reportUnusedDisableDirectives?: Severity | StringSeverity | boolean;
|
| 1297 |
+
};
|
| 1298 |
+
|
| 1299 |
+
/**
|
| 1300 |
+
* Either an object containing preprocess() and postprocess() methods or a
|
| 1301 |
+
* string indicating the name of a processor inside of a plugin
|
| 1302 |
+
* (i.e., "pluginName/processorName").
|
| 1303 |
+
*/
|
| 1304 |
+
processor?: string | Processor;
|
| 1305 |
+
|
| 1306 |
+
/**
|
| 1307 |
+
* An object containing a name-value mapping of plugin names to plugin objects.
|
| 1308 |
+
* When files is specified, these plugins are only available to the matching files.
|
| 1309 |
+
*/
|
| 1310 |
+
plugins?: Record<string, ESLint.Plugin>;
|
| 1311 |
+
|
| 1312 |
+
/**
|
| 1313 |
+
* An object containing the configured rules. When files or ignores are specified,
|
| 1314 |
+
* these rule configurations are only available to the matching files.
|
| 1315 |
+
*/
|
| 1316 |
+
rules?: Partial<Rules>;
|
| 1317 |
+
|
| 1318 |
+
/**
|
| 1319 |
+
* An object containing name-value pairs of information that should be
|
| 1320 |
+
* available to all rules.
|
| 1321 |
+
*/
|
| 1322 |
+
settings?: Record<string, unknown>;
|
| 1323 |
+
}
|
| 1324 |
+
}
|
| 1325 |
+
|
| 1326 |
+
// #endregion
|
| 1327 |
+
|
| 1328 |
+
// #region ESLint
|
| 1329 |
+
|
| 1330 |
+
export class ESLint {
|
| 1331 |
+
static version: string;
|
| 1332 |
+
|
| 1333 |
+
static outputFixes(results: ESLint.LintResult[]): Promise<void>;
|
| 1334 |
+
|
| 1335 |
+
static getErrorResults(results: ESLint.LintResult[]): ESLint.LintResult[];
|
| 1336 |
+
|
| 1337 |
+
constructor(options?: ESLint.Options);
|
| 1338 |
+
|
| 1339 |
+
lintFiles(patterns: string | string[]): Promise<ESLint.LintResult[]>;
|
| 1340 |
+
|
| 1341 |
+
lintText(
|
| 1342 |
+
code: string,
|
| 1343 |
+
options?: { filePath?: string | undefined; warnIgnored?: boolean | undefined },
|
| 1344 |
+
): Promise<ESLint.LintResult[]>;
|
| 1345 |
+
|
| 1346 |
+
getRulesMetaForResults(results: ESLint.LintResult[]): ESLint.LintResultData["rulesMeta"];
|
| 1347 |
+
|
| 1348 |
+
calculateConfigForFile(filePath: string): Promise<any>;
|
| 1349 |
+
|
| 1350 |
+
isPathIgnored(filePath: string): Promise<boolean>;
|
| 1351 |
+
|
| 1352 |
+
loadFormatter(nameOrPath?: string): Promise<ESLint.Formatter>;
|
| 1353 |
+
}
|
| 1354 |
+
|
| 1355 |
+
export namespace ESLint {
|
| 1356 |
+
type ConfigData<Rules extends Linter.RulesRecord = Linter.RulesRecord> = Omit<Linter.Config<Rules>, "$schema">;
|
| 1357 |
+
|
| 1358 |
+
interface Globals {
|
| 1359 |
+
[name: string]: boolean | "writable" | "readonly" | "off";
|
| 1360 |
+
}
|
| 1361 |
+
|
| 1362 |
+
interface Environment {
|
| 1363 |
+
globals?: Globals | undefined;
|
| 1364 |
+
parserOptions?: Linter.ParserOptions | undefined;
|
| 1365 |
+
}
|
| 1366 |
+
|
| 1367 |
+
interface ObjectMetaProperties {
|
| 1368 |
+
/** @deprecated Use `meta.name` instead. */
|
| 1369 |
+
name?: string | undefined;
|
| 1370 |
+
|
| 1371 |
+
/** @deprecated Use `meta.version` instead. */
|
| 1372 |
+
version?: string | undefined;
|
| 1373 |
+
|
| 1374 |
+
meta?: {
|
| 1375 |
+
name?: string | undefined;
|
| 1376 |
+
version?: string | undefined;
|
| 1377 |
+
};
|
| 1378 |
+
}
|
| 1379 |
+
|
| 1380 |
+
interface Plugin extends ObjectMetaProperties {
|
| 1381 |
+
configs?: Record<string, ConfigData | Linter.FlatConfig | Linter.FlatConfig[]> | undefined;
|
| 1382 |
+
environments?: Record<string, Environment> | undefined;
|
| 1383 |
+
processors?: Record<string, Linter.Processor> | undefined;
|
| 1384 |
+
rules?: Record<string, Rule.OldStyleRule | Rule.RuleModule> | undefined;
|
| 1385 |
+
}
|
| 1386 |
+
|
| 1387 |
+
interface Options {
|
| 1388 |
+
// File enumeration
|
| 1389 |
+
cwd?: string | undefined;
|
| 1390 |
+
errorOnUnmatchedPattern?: boolean | undefined;
|
| 1391 |
+
extensions?: string[] | undefined;
|
| 1392 |
+
globInputPaths?: boolean | undefined;
|
| 1393 |
+
ignore?: boolean | undefined;
|
| 1394 |
+
ignorePath?: string | undefined;
|
| 1395 |
+
|
| 1396 |
+
// Linting
|
| 1397 |
+
allowInlineConfig?: boolean | undefined;
|
| 1398 |
+
baseConfig?: Linter.Config | undefined;
|
| 1399 |
+
overrideConfig?: Linter.Config | undefined;
|
| 1400 |
+
overrideConfigFile?: string | undefined;
|
| 1401 |
+
plugins?: Record<string, Plugin> | undefined;
|
| 1402 |
+
reportUnusedDisableDirectives?: Linter.StringSeverity | undefined;
|
| 1403 |
+
resolvePluginsRelativeTo?: string | undefined;
|
| 1404 |
+
rulePaths?: string[] | undefined;
|
| 1405 |
+
useEslintrc?: boolean | undefined;
|
| 1406 |
+
|
| 1407 |
+
// Autofix
|
| 1408 |
+
fix?: boolean | ((message: Linter.LintMessage) => boolean) | undefined;
|
| 1409 |
+
fixTypes?: Array<Rule.RuleMetaData["type"]> | undefined;
|
| 1410 |
+
|
| 1411 |
+
// Cache-related
|
| 1412 |
+
cache?: boolean | undefined;
|
| 1413 |
+
cacheLocation?: string | undefined;
|
| 1414 |
+
cacheStrategy?: "content" | "metadata" | undefined;
|
| 1415 |
+
}
|
| 1416 |
+
|
| 1417 |
+
interface LintResult {
|
| 1418 |
+
filePath: string;
|
| 1419 |
+
messages: Linter.LintMessage[];
|
| 1420 |
+
suppressedMessages: Linter.SuppressedLintMessage[];
|
| 1421 |
+
errorCount: number;
|
| 1422 |
+
fatalErrorCount: number;
|
| 1423 |
+
warningCount: number;
|
| 1424 |
+
fixableErrorCount: number;
|
| 1425 |
+
fixableWarningCount: number;
|
| 1426 |
+
output?: string | undefined;
|
| 1427 |
+
source?: string | undefined;
|
| 1428 |
+
usedDeprecatedRules: DeprecatedRuleUse[];
|
| 1429 |
+
}
|
| 1430 |
+
|
| 1431 |
+
interface LintResultData {
|
| 1432 |
+
cwd: string;
|
| 1433 |
+
rulesMeta: {
|
| 1434 |
+
[ruleId: string]: Rule.RuleMetaData;
|
| 1435 |
+
};
|
| 1436 |
+
}
|
| 1437 |
+
|
| 1438 |
+
interface DeprecatedRuleUse {
|
| 1439 |
+
ruleId: string;
|
| 1440 |
+
replacedBy: string[];
|
| 1441 |
+
}
|
| 1442 |
+
|
| 1443 |
+
interface Formatter {
|
| 1444 |
+
format(results: LintResult[], data?: LintResultData): string | Promise<string>;
|
| 1445 |
+
}
|
| 1446 |
+
|
| 1447 |
+
// Docs reference the type by this name
|
| 1448 |
+
type EditInfo = Rule.Fix;
|
| 1449 |
+
}
|
| 1450 |
+
|
| 1451 |
+
// #endregion
|
| 1452 |
+
|
| 1453 |
+
// #region RuleTester
|
| 1454 |
+
|
| 1455 |
+
export class RuleTester {
|
| 1456 |
+
constructor(config?: any);
|
| 1457 |
+
|
| 1458 |
+
run(
|
| 1459 |
+
name: string,
|
| 1460 |
+
rule: Rule.RuleModule,
|
| 1461 |
+
tests: {
|
| 1462 |
+
valid?: Array<string | RuleTester.ValidTestCase> | undefined;
|
| 1463 |
+
invalid?: RuleTester.InvalidTestCase[] | undefined;
|
| 1464 |
+
},
|
| 1465 |
+
): void;
|
| 1466 |
+
|
| 1467 |
+
static only(
|
| 1468 |
+
item: string | RuleTester.ValidTestCase | RuleTester.InvalidTestCase,
|
| 1469 |
+
): RuleTester.ValidTestCase | RuleTester.InvalidTestCase;
|
| 1470 |
+
}
|
| 1471 |
+
|
| 1472 |
+
export namespace RuleTester {
|
| 1473 |
+
interface ValidTestCase {
|
| 1474 |
+
name?: string;
|
| 1475 |
+
code: string;
|
| 1476 |
+
options?: any;
|
| 1477 |
+
filename?: string | undefined;
|
| 1478 |
+
only?: boolean;
|
| 1479 |
+
parserOptions?: Linter.ParserOptions | undefined;
|
| 1480 |
+
settings?: { [name: string]: any } | undefined;
|
| 1481 |
+
parser?: string | undefined;
|
| 1482 |
+
globals?: { [name: string]: boolean } | undefined;
|
| 1483 |
+
}
|
| 1484 |
+
|
| 1485 |
+
interface SuggestionOutput {
|
| 1486 |
+
messageId?: string | undefined;
|
| 1487 |
+
desc?: string | undefined;
|
| 1488 |
+
data?: Record<string, unknown> | undefined;
|
| 1489 |
+
output: string;
|
| 1490 |
+
}
|
| 1491 |
+
|
| 1492 |
+
interface InvalidTestCase extends ValidTestCase {
|
| 1493 |
+
errors: number | Array<TestCaseError | string>;
|
| 1494 |
+
output?: string | null | undefined;
|
| 1495 |
+
}
|
| 1496 |
+
|
| 1497 |
+
interface TestCaseError {
|
| 1498 |
+
message?: string | RegExp | undefined;
|
| 1499 |
+
messageId?: string | undefined;
|
| 1500 |
+
type?: string | undefined;
|
| 1501 |
+
data?: any;
|
| 1502 |
+
line?: number | undefined;
|
| 1503 |
+
column?: number | undefined;
|
| 1504 |
+
endLine?: number | undefined;
|
| 1505 |
+
endColumn?: number | undefined;
|
| 1506 |
+
suggestions?: SuggestionOutput[] | undefined;
|
| 1507 |
+
}
|
| 1508 |
+
}
|
| 1509 |
+
|
| 1510 |
+
// #endregion
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/eslint",
|
| 3 |
+
"version": "8.56.12",
|
| 4 |
+
"description": "TypeScript definitions for eslint",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/eslint",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "Pierre-Marie Dartus",
|
| 10 |
+
"githubUsername": "pmdartus",
|
| 11 |
+
"url": "https://github.com/pmdartus"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Jed Fox",
|
| 15 |
+
"githubUsername": "j-f1",
|
| 16 |
+
"url": "https://github.com/j-f1"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "Saad Quadri",
|
| 20 |
+
"githubUsername": "saadq",
|
| 21 |
+
"url": "https://github.com/saadq"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"name": "Jason Kwok",
|
| 25 |
+
"githubUsername": "JasonHK",
|
| 26 |
+
"url": "https://github.com/JasonHK"
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"name": "Brad Zacher",
|
| 30 |
+
"githubUsername": "bradzacher",
|
| 31 |
+
"url": "https://github.com/bradzacher"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"name": "JounQin",
|
| 35 |
+
"githubUsername": "JounQin",
|
| 36 |
+
"url": "https://github.com/JounQin"
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"name": "Bryan Mishkin",
|
| 40 |
+
"githubUsername": "bmish",
|
| 41 |
+
"url": "https://github.com/bmish"
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"main": "",
|
| 45 |
+
"types": "index.d.ts",
|
| 46 |
+
"exports": {
|
| 47 |
+
".": {
|
| 48 |
+
"types": "./index.d.ts"
|
| 49 |
+
},
|
| 50 |
+
"./use-at-your-own-risk": {
|
| 51 |
+
"types": "./use-at-your-own-risk.d.ts"
|
| 52 |
+
},
|
| 53 |
+
"./rules": {
|
| 54 |
+
"types": "./rules/index.d.ts"
|
| 55 |
+
},
|
| 56 |
+
"./package.json": "./package.json"
|
| 57 |
+
},
|
| 58 |
+
"repository": {
|
| 59 |
+
"type": "git",
|
| 60 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 61 |
+
"directory": "types/eslint"
|
| 62 |
+
},
|
| 63 |
+
"scripts": {},
|
| 64 |
+
"dependencies": {
|
| 65 |
+
"@types/estree": "*",
|
| 66 |
+
"@types/json-schema": "*"
|
| 67 |
+
},
|
| 68 |
+
"typesPublisherContentHash": "804eabaa45a9d9fa17f60c85a8d5139ef8826929e60e1de0ada0c3dbf17f6e2b",
|
| 69 |
+
"typeScriptVersion": "4.8"
|
| 70 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/best-practices.d.ts
ADDED
|
@@ -0,0 +1,1048 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Linter } from "../index";
|
| 2 |
+
|
| 3 |
+
export interface BestPractices extends Linter.RulesRecord {
|
| 4 |
+
/**
|
| 5 |
+
* Rule to enforce getter and setter pairs in objects.
|
| 6 |
+
*
|
| 7 |
+
* @since 0.22.0
|
| 8 |
+
* @see https://eslint.org/docs/rules/accessor-pairs
|
| 9 |
+
*/
|
| 10 |
+
"accessor-pairs": Linter.RuleEntry<
|
| 11 |
+
[
|
| 12 |
+
Partial<{
|
| 13 |
+
/**
|
| 14 |
+
* @default true
|
| 15 |
+
*/
|
| 16 |
+
setWithoutGet: boolean;
|
| 17 |
+
/**
|
| 18 |
+
* @default false
|
| 19 |
+
*/
|
| 20 |
+
getWithoutSet: boolean;
|
| 21 |
+
/**
|
| 22 |
+
* @default true
|
| 23 |
+
*/
|
| 24 |
+
enforceForClassMembers: boolean;
|
| 25 |
+
}>,
|
| 26 |
+
]
|
| 27 |
+
>;
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Rule to enforce `return` statements in callbacks of array methods.
|
| 31 |
+
*
|
| 32 |
+
* @since 2.0.0-alpha-1
|
| 33 |
+
* @see https://eslint.org/docs/rules/array-callback-return
|
| 34 |
+
*/
|
| 35 |
+
"array-callback-return": Linter.RuleEntry<
|
| 36 |
+
[
|
| 37 |
+
Partial<{
|
| 38 |
+
/**
|
| 39 |
+
* @default false
|
| 40 |
+
*/
|
| 41 |
+
allowImplicit: boolean;
|
| 42 |
+
/**
|
| 43 |
+
* @default false
|
| 44 |
+
*/
|
| 45 |
+
checkForEach: boolean;
|
| 46 |
+
/**
|
| 47 |
+
* @default false
|
| 48 |
+
*/
|
| 49 |
+
allowVoid: boolean;
|
| 50 |
+
}>,
|
| 51 |
+
]
|
| 52 |
+
>;
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* Rule to enforce the use of variables within the scope they are defined.
|
| 56 |
+
*
|
| 57 |
+
* @since 0.1.0
|
| 58 |
+
* @see https://eslint.org/docs/rules/block-scoped-var
|
| 59 |
+
*/
|
| 60 |
+
"block-scoped-var": Linter.RuleEntry<[]>;
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Rule to enforce that class methods utilize `this`.
|
| 64 |
+
*
|
| 65 |
+
* @since 3.4.0
|
| 66 |
+
* @see https://eslint.org/docs/rules/class-methods-use-this
|
| 67 |
+
*/
|
| 68 |
+
"class-methods-use-this": Linter.RuleEntry<
|
| 69 |
+
[
|
| 70 |
+
Partial<{
|
| 71 |
+
exceptMethods: string[];
|
| 72 |
+
}>,
|
| 73 |
+
]
|
| 74 |
+
>;
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* Rule to enforce a maximum cyclomatic complexity allowed in a program.
|
| 78 |
+
*
|
| 79 |
+
* @since 0.0.9
|
| 80 |
+
* @see https://eslint.org/docs/rules/complexity
|
| 81 |
+
*/
|
| 82 |
+
complexity: Linter.RuleEntry<
|
| 83 |
+
[
|
| 84 |
+
| Partial<{
|
| 85 |
+
/**
|
| 86 |
+
* @default 20
|
| 87 |
+
*/
|
| 88 |
+
max: number;
|
| 89 |
+
/**
|
| 90 |
+
* @deprecated
|
| 91 |
+
* @default 20
|
| 92 |
+
*/
|
| 93 |
+
maximum: number;
|
| 94 |
+
}>
|
| 95 |
+
| number,
|
| 96 |
+
]
|
| 97 |
+
>;
|
| 98 |
+
|
| 99 |
+
/**
|
| 100 |
+
* Rule to require `return` statements to either always or never specify values.
|
| 101 |
+
*
|
| 102 |
+
* @since 0.4.0
|
| 103 |
+
* @see https://eslint.org/docs/rules/consistent-return
|
| 104 |
+
*/
|
| 105 |
+
"consistent-return": Linter.RuleEntry<
|
| 106 |
+
[
|
| 107 |
+
Partial<{
|
| 108 |
+
/**
|
| 109 |
+
* @default false
|
| 110 |
+
*/
|
| 111 |
+
treatUndefinedAsUnspecified: boolean;
|
| 112 |
+
}>,
|
| 113 |
+
]
|
| 114 |
+
>;
|
| 115 |
+
|
| 116 |
+
/**
|
| 117 |
+
* Rule to enforce consistent brace style for all control statements.
|
| 118 |
+
*
|
| 119 |
+
* @since 0.0.2
|
| 120 |
+
* @see https://eslint.org/docs/rules/curly
|
| 121 |
+
*/
|
| 122 |
+
curly: Linter.RuleEntry<["all" | "multi" | "multi-line" | "multi-or-nest" | "consistent"]>;
|
| 123 |
+
|
| 124 |
+
/**
|
| 125 |
+
* Rule to require `default` cases in `switch` statements.
|
| 126 |
+
*
|
| 127 |
+
* @since 0.6.0
|
| 128 |
+
* @see https://eslint.org/docs/rules/default-case
|
| 129 |
+
*/
|
| 130 |
+
"default-case": Linter.RuleEntry<
|
| 131 |
+
[
|
| 132 |
+
Partial<{
|
| 133 |
+
/**
|
| 134 |
+
* @default '^no default$'
|
| 135 |
+
*/
|
| 136 |
+
commentPattern: string;
|
| 137 |
+
}>,
|
| 138 |
+
]
|
| 139 |
+
>;
|
| 140 |
+
|
| 141 |
+
/**
|
| 142 |
+
* Rule to enforce default clauses in switch statements to be last
|
| 143 |
+
*
|
| 144 |
+
* @since 7.0.0
|
| 145 |
+
* @see https://eslint.org/docs/latest/rules/default-case-last
|
| 146 |
+
*/
|
| 147 |
+
"default-case-last": Linter.RuleEntry<[]>;
|
| 148 |
+
|
| 149 |
+
/**
|
| 150 |
+
* Enforce default parameters to be last
|
| 151 |
+
*
|
| 152 |
+
* @since 6.4.0
|
| 153 |
+
* @see https://eslint.org/docs/latest/rules/default-param-last
|
| 154 |
+
*/
|
| 155 |
+
"default-param-last": Linter.RuleEntry<[]>;
|
| 156 |
+
|
| 157 |
+
/**
|
| 158 |
+
* Rule to enforce consistent newlines before and after dots.
|
| 159 |
+
*
|
| 160 |
+
* @since 0.21.0
|
| 161 |
+
* @see https://eslint.org/docs/rules/dot-location
|
| 162 |
+
*/
|
| 163 |
+
"dot-location": Linter.RuleEntry<["object" | "property"]>;
|
| 164 |
+
|
| 165 |
+
/**
|
| 166 |
+
* Rule to enforce dot notation whenever possible.
|
| 167 |
+
*
|
| 168 |
+
* @since 0.0.7
|
| 169 |
+
* @see https://eslint.org/docs/rules/dot-notation
|
| 170 |
+
*/
|
| 171 |
+
"dot-notation": Linter.RuleEntry<
|
| 172 |
+
[
|
| 173 |
+
Partial<{
|
| 174 |
+
/**
|
| 175 |
+
* @default true
|
| 176 |
+
*/
|
| 177 |
+
allowKeywords: boolean;
|
| 178 |
+
allowPattern: string;
|
| 179 |
+
}>,
|
| 180 |
+
]
|
| 181 |
+
>;
|
| 182 |
+
|
| 183 |
+
/**
|
| 184 |
+
* Rule to require the use of `===` and `!==`.
|
| 185 |
+
*
|
| 186 |
+
* @since 0.0.2
|
| 187 |
+
* @see https://eslint.org/docs/rules/eqeqeq
|
| 188 |
+
*/
|
| 189 |
+
eqeqeq:
|
| 190 |
+
| Linter.RuleEntry<
|
| 191 |
+
[
|
| 192 |
+
"always",
|
| 193 |
+
Partial<{
|
| 194 |
+
/**
|
| 195 |
+
* @default 'always'
|
| 196 |
+
*/
|
| 197 |
+
null: "always" | "never" | "ignore";
|
| 198 |
+
}>,
|
| 199 |
+
]
|
| 200 |
+
>
|
| 201 |
+
| Linter.RuleEntry<["smart" | "allow-null"]>;
|
| 202 |
+
|
| 203 |
+
/**
|
| 204 |
+
* Require grouped accessor pairs in object literals and classes.
|
| 205 |
+
*
|
| 206 |
+
* @since 6.7.0
|
| 207 |
+
* @see https://eslint.org/docs/latest/rules/grouped-accessor-pairs
|
| 208 |
+
*/
|
| 209 |
+
"grouped-accessor-pairs": Linter.RuleEntry<["anyOrder" | "getBeforeSet" | "setBeforeGet"]>;
|
| 210 |
+
|
| 211 |
+
/**
|
| 212 |
+
* Rule to require `for-in` loops to include an `if` statement.
|
| 213 |
+
*
|
| 214 |
+
* @since 0.0.6
|
| 215 |
+
* @see https://eslint.org/docs/rules/guard-for-in
|
| 216 |
+
*/
|
| 217 |
+
"guard-for-in": Linter.RuleEntry<[]>;
|
| 218 |
+
|
| 219 |
+
/**
|
| 220 |
+
* Rule to enforce a maximum number of classes per file.
|
| 221 |
+
*
|
| 222 |
+
* @since 5.0.0-alpha.3
|
| 223 |
+
* @see https://eslint.org/docs/rules/max-classes-per-file
|
| 224 |
+
*/
|
| 225 |
+
"max-classes-per-file": Linter.RuleEntry<[number]>;
|
| 226 |
+
|
| 227 |
+
/**
|
| 228 |
+
* Rule to disallow the use of `alert`, `confirm`, and `prompt`.
|
| 229 |
+
*
|
| 230 |
+
* @since 0.0.5
|
| 231 |
+
* @see https://eslint.org/docs/rules/no-alert
|
| 232 |
+
*/
|
| 233 |
+
"no-alert": Linter.RuleEntry<[]>;
|
| 234 |
+
|
| 235 |
+
/**
|
| 236 |
+
* Rule to disallow the use of `arguments.caller` or `arguments.callee`.
|
| 237 |
+
*
|
| 238 |
+
* @since 0.0.6
|
| 239 |
+
* @see https://eslint.org/docs/rules/no-caller
|
| 240 |
+
*/
|
| 241 |
+
"no-caller": Linter.RuleEntry<[]>;
|
| 242 |
+
|
| 243 |
+
/**
|
| 244 |
+
* Rule to disallow lexical declarations in case clauses.
|
| 245 |
+
*
|
| 246 |
+
* @remarks
|
| 247 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 248 |
+
*
|
| 249 |
+
* @since 1.9.0
|
| 250 |
+
* @see https://eslint.org/docs/rules/no-case-declarations
|
| 251 |
+
*/
|
| 252 |
+
"no-case-declarations": Linter.RuleEntry<[]>;
|
| 253 |
+
|
| 254 |
+
/**
|
| 255 |
+
* Rule to disallow division operators explicitly at the beginning of regular expressions.
|
| 256 |
+
*
|
| 257 |
+
* @since 0.1.0
|
| 258 |
+
* @see https://eslint.org/docs/rules/no-div-regex
|
| 259 |
+
*/
|
| 260 |
+
"no-div-regex": Linter.RuleEntry<[]>;
|
| 261 |
+
|
| 262 |
+
/**
|
| 263 |
+
* Rule to disallow `else` blocks after `return` statements in `if` statements.
|
| 264 |
+
*
|
| 265 |
+
* @since 0.0.9
|
| 266 |
+
* @see https://eslint.org/docs/rules/no-else-return
|
| 267 |
+
*/
|
| 268 |
+
"no-else-return": Linter.RuleEntry<
|
| 269 |
+
[
|
| 270 |
+
Partial<{
|
| 271 |
+
/**
|
| 272 |
+
* @default true
|
| 273 |
+
*/
|
| 274 |
+
allowElseIf: boolean;
|
| 275 |
+
}>,
|
| 276 |
+
]
|
| 277 |
+
>;
|
| 278 |
+
|
| 279 |
+
/**
|
| 280 |
+
* Rule to disallow empty functions.
|
| 281 |
+
*
|
| 282 |
+
* @since 2.0.0
|
| 283 |
+
* @see https://eslint.org/docs/rules/no-empty-function
|
| 284 |
+
*/
|
| 285 |
+
"no-empty-function": Linter.RuleEntry<
|
| 286 |
+
[
|
| 287 |
+
Partial<{
|
| 288 |
+
/**
|
| 289 |
+
* @default []
|
| 290 |
+
*/
|
| 291 |
+
allow: Array<
|
| 292 |
+
| "functions"
|
| 293 |
+
| "arrowFunctions"
|
| 294 |
+
| "generatorFunctions"
|
| 295 |
+
| "methods"
|
| 296 |
+
| "generatorMethods"
|
| 297 |
+
| "getters"
|
| 298 |
+
| "setters"
|
| 299 |
+
| "constructors"
|
| 300 |
+
>;
|
| 301 |
+
}>,
|
| 302 |
+
]
|
| 303 |
+
>;
|
| 304 |
+
|
| 305 |
+
/**
|
| 306 |
+
* Rule to disallow empty destructuring patterns.
|
| 307 |
+
*
|
| 308 |
+
* @remarks
|
| 309 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 310 |
+
*
|
| 311 |
+
* @since 1.7.0
|
| 312 |
+
* @see https://eslint.org/docs/rules/no-empty-pattern
|
| 313 |
+
*/
|
| 314 |
+
"no-empty-pattern": Linter.RuleEntry<[]>;
|
| 315 |
+
|
| 316 |
+
/**
|
| 317 |
+
* Rule to disallow `null` comparisons without type-checking operators.
|
| 318 |
+
*
|
| 319 |
+
* @since 0.0.9
|
| 320 |
+
* @see https://eslint.org/docs/rules/no-eq-null
|
| 321 |
+
*/
|
| 322 |
+
"no-eq-null": Linter.RuleEntry<[]>;
|
| 323 |
+
|
| 324 |
+
/**
|
| 325 |
+
* Rule to disallow the use of `eval()`.
|
| 326 |
+
*
|
| 327 |
+
* @since 0.0.2
|
| 328 |
+
* @see https://eslint.org/docs/rules/no-eval
|
| 329 |
+
*/
|
| 330 |
+
"no-eval": Linter.RuleEntry<
|
| 331 |
+
[
|
| 332 |
+
Partial<{
|
| 333 |
+
/**
|
| 334 |
+
* @default false
|
| 335 |
+
*/
|
| 336 |
+
allowIndirect: boolean;
|
| 337 |
+
}>,
|
| 338 |
+
]
|
| 339 |
+
>;
|
| 340 |
+
|
| 341 |
+
/**
|
| 342 |
+
* Rule to disallow extending native types.
|
| 343 |
+
*
|
| 344 |
+
* @since 0.1.4
|
| 345 |
+
* @see https://eslint.org/docs/rules/no-extend-native
|
| 346 |
+
*/
|
| 347 |
+
"no-extend-native": Linter.RuleEntry<
|
| 348 |
+
[
|
| 349 |
+
Partial<{
|
| 350 |
+
exceptions: string[];
|
| 351 |
+
}>,
|
| 352 |
+
]
|
| 353 |
+
>;
|
| 354 |
+
|
| 355 |
+
/**
|
| 356 |
+
* Rule to disallow unnecessary calls to `.bind()`.
|
| 357 |
+
*
|
| 358 |
+
* @since 0.8.0
|
| 359 |
+
* @see https://eslint.org/docs/rules/no-extra-bind
|
| 360 |
+
*/
|
| 361 |
+
"no-extra-bind": Linter.RuleEntry<[]>;
|
| 362 |
+
|
| 363 |
+
/**
|
| 364 |
+
* Rule to disallow unnecessary labels.
|
| 365 |
+
*
|
| 366 |
+
* @since 2.0.0-rc.0
|
| 367 |
+
* @see https://eslint.org/docs/rules/no-extra-label
|
| 368 |
+
*/
|
| 369 |
+
"no-extra-label": Linter.RuleEntry<[]>;
|
| 370 |
+
|
| 371 |
+
/**
|
| 372 |
+
* Rule to disallow fallthrough of `case` statements.
|
| 373 |
+
*
|
| 374 |
+
* @remarks
|
| 375 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 376 |
+
*
|
| 377 |
+
* @since 0.0.7
|
| 378 |
+
* @see https://eslint.org/docs/rules/no-fallthrough
|
| 379 |
+
*/
|
| 380 |
+
"no-fallthrough": Linter.RuleEntry<
|
| 381 |
+
[
|
| 382 |
+
Partial<{
|
| 383 |
+
/**
|
| 384 |
+
* @default 'falls?\s?through'
|
| 385 |
+
*/
|
| 386 |
+
commentPattern: string;
|
| 387 |
+
/**
|
| 388 |
+
* @default false
|
| 389 |
+
*/
|
| 390 |
+
allowEmptyCase: boolean;
|
| 391 |
+
}>,
|
| 392 |
+
]
|
| 393 |
+
>;
|
| 394 |
+
|
| 395 |
+
/**
|
| 396 |
+
* Rule to disallow leading or trailing decimal points in numeric literals.
|
| 397 |
+
*
|
| 398 |
+
* @since 0.0.6
|
| 399 |
+
* @see https://eslint.org/docs/rules/no-floating-decimal
|
| 400 |
+
*/
|
| 401 |
+
"no-floating-decimal": Linter.RuleEntry<[]>;
|
| 402 |
+
|
| 403 |
+
/**
|
| 404 |
+
* Rule to disallow assignments to native objects or read-only global variables.
|
| 405 |
+
*
|
| 406 |
+
* @remarks
|
| 407 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 408 |
+
*
|
| 409 |
+
* @since 3.3.0
|
| 410 |
+
* @see https://eslint.org/docs/rules/no-global-assign
|
| 411 |
+
*/
|
| 412 |
+
"no-global-assign": Linter.RuleEntry<
|
| 413 |
+
[
|
| 414 |
+
Partial<{
|
| 415 |
+
exceptions: string[];
|
| 416 |
+
}>,
|
| 417 |
+
]
|
| 418 |
+
>;
|
| 419 |
+
|
| 420 |
+
/**
|
| 421 |
+
* Rule to disallow shorthand type conversions.
|
| 422 |
+
*
|
| 423 |
+
* @since 1.0.0-rc-2
|
| 424 |
+
* @see https://eslint.org/docs/rules/no-implicit-coercion
|
| 425 |
+
*/
|
| 426 |
+
"no-implicit-coercion": Linter.RuleEntry<
|
| 427 |
+
[
|
| 428 |
+
Partial<{
|
| 429 |
+
/**
|
| 430 |
+
* @default true
|
| 431 |
+
*/
|
| 432 |
+
boolean: boolean;
|
| 433 |
+
/**
|
| 434 |
+
* @default true
|
| 435 |
+
*/
|
| 436 |
+
number: boolean;
|
| 437 |
+
/**
|
| 438 |
+
* @default true
|
| 439 |
+
*/
|
| 440 |
+
string: boolean;
|
| 441 |
+
/**
|
| 442 |
+
* @default false
|
| 443 |
+
*/
|
| 444 |
+
disallowTemplateShorthand: boolean;
|
| 445 |
+
/**
|
| 446 |
+
* @default []
|
| 447 |
+
*/
|
| 448 |
+
allow: Array<"~" | "!!" | "+" | "*">;
|
| 449 |
+
}>,
|
| 450 |
+
]
|
| 451 |
+
>;
|
| 452 |
+
|
| 453 |
+
/**
|
| 454 |
+
* Rule to disallow variable and `function` declarations in the global scope.
|
| 455 |
+
*
|
| 456 |
+
* @since 2.0.0-alpha-1
|
| 457 |
+
* @see https://eslint.org/docs/rules/no-implicit-globals
|
| 458 |
+
*/
|
| 459 |
+
"no-implicit-globals": Linter.RuleEntry<[]>;
|
| 460 |
+
|
| 461 |
+
/**
|
| 462 |
+
* Rule to disallow the use of `eval()`-like methods.
|
| 463 |
+
*
|
| 464 |
+
* @since 0.0.7
|
| 465 |
+
* @see https://eslint.org/docs/rules/no-implied-eval
|
| 466 |
+
*/
|
| 467 |
+
"no-implied-eval": Linter.RuleEntry<[]>;
|
| 468 |
+
|
| 469 |
+
/**
|
| 470 |
+
* Disallow assigning to imported bindings.
|
| 471 |
+
*
|
| 472 |
+
* @remarks
|
| 473 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 474 |
+
*
|
| 475 |
+
* @since 6.4.0
|
| 476 |
+
* @see https://eslint.org/docs/latest/rules/no-import-assign
|
| 477 |
+
*/
|
| 478 |
+
"no-import-assign": Linter.RuleEntry<[]>;
|
| 479 |
+
|
| 480 |
+
/**
|
| 481 |
+
* Rule to disallow `this` keywords outside of classes or class-like objects.
|
| 482 |
+
*
|
| 483 |
+
* @since 1.0.0-rc-2
|
| 484 |
+
* @see https://eslint.org/docs/rules/no-invalid-this
|
| 485 |
+
*/
|
| 486 |
+
"no-invalid-this": Linter.RuleEntry<
|
| 487 |
+
[
|
| 488 |
+
Partial<{
|
| 489 |
+
/**
|
| 490 |
+
* @default true
|
| 491 |
+
*/
|
| 492 |
+
capIsConstructor: boolean;
|
| 493 |
+
}>,
|
| 494 |
+
]
|
| 495 |
+
>;
|
| 496 |
+
|
| 497 |
+
/**
|
| 498 |
+
* Rule to disallow the use of the `__iterator__` property.
|
| 499 |
+
*
|
| 500 |
+
* @since 0.0.9
|
| 501 |
+
* @see https://eslint.org/docs/rules/no-iterator
|
| 502 |
+
*/
|
| 503 |
+
"no-iterator": Linter.RuleEntry<[]>;
|
| 504 |
+
|
| 505 |
+
/**
|
| 506 |
+
* Rule to disallow labeled statements.
|
| 507 |
+
*
|
| 508 |
+
* @since 0.4.0
|
| 509 |
+
* @see https://eslint.org/docs/rules/no-labels
|
| 510 |
+
*/
|
| 511 |
+
"no-labels": Linter.RuleEntry<
|
| 512 |
+
[
|
| 513 |
+
Partial<{
|
| 514 |
+
/**
|
| 515 |
+
* @default false
|
| 516 |
+
*/
|
| 517 |
+
allowLoop: boolean;
|
| 518 |
+
/**
|
| 519 |
+
* @default false
|
| 520 |
+
*/
|
| 521 |
+
allowSwitch: boolean;
|
| 522 |
+
}>,
|
| 523 |
+
]
|
| 524 |
+
>;
|
| 525 |
+
|
| 526 |
+
/**
|
| 527 |
+
* Rule to disallow unnecessary nested blocks.
|
| 528 |
+
*
|
| 529 |
+
* @since 0.4.0
|
| 530 |
+
* @see https://eslint.org/docs/rules/no-lone-blocks
|
| 531 |
+
*/
|
| 532 |
+
"no-lone-blocks": Linter.RuleEntry<[]>;
|
| 533 |
+
|
| 534 |
+
/**
|
| 535 |
+
* Rule to disallow function declarations that contain unsafe references inside loop statements.
|
| 536 |
+
*
|
| 537 |
+
* @since 0.0.9
|
| 538 |
+
* @see https://eslint.org/docs/rules/no-loop-func
|
| 539 |
+
*/
|
| 540 |
+
"no-loop-func": Linter.RuleEntry<[]>;
|
| 541 |
+
|
| 542 |
+
/**
|
| 543 |
+
* Rule to disallow magic numbers.
|
| 544 |
+
*
|
| 545 |
+
* @since 1.7.0
|
| 546 |
+
* @see https://eslint.org/docs/rules/no-magic-numbers
|
| 547 |
+
*/
|
| 548 |
+
"no-magic-numbers": Linter.RuleEntry<
|
| 549 |
+
[
|
| 550 |
+
Partial<{
|
| 551 |
+
/**
|
| 552 |
+
* @default []
|
| 553 |
+
*/
|
| 554 |
+
ignore: number[];
|
| 555 |
+
/**
|
| 556 |
+
* @default false
|
| 557 |
+
*/
|
| 558 |
+
ignoreArrayIndexes: boolean;
|
| 559 |
+
/**
|
| 560 |
+
* @default false
|
| 561 |
+
*/
|
| 562 |
+
enforceConst: boolean;
|
| 563 |
+
/**
|
| 564 |
+
* @default false
|
| 565 |
+
*/
|
| 566 |
+
detectObjects: boolean;
|
| 567 |
+
}>,
|
| 568 |
+
]
|
| 569 |
+
>;
|
| 570 |
+
|
| 571 |
+
/**
|
| 572 |
+
* Rule to disallow multiple spaces.
|
| 573 |
+
*
|
| 574 |
+
* @since 0.9.0
|
| 575 |
+
* @see https://eslint.org/docs/rules/no-multi-spaces
|
| 576 |
+
*/
|
| 577 |
+
"no-multi-spaces": Linter.RuleEntry<
|
| 578 |
+
[
|
| 579 |
+
Partial<{
|
| 580 |
+
/**
|
| 581 |
+
* @default false
|
| 582 |
+
*/
|
| 583 |
+
ignoreEOLComments: boolean;
|
| 584 |
+
/**
|
| 585 |
+
* @default { Property: true }
|
| 586 |
+
*/
|
| 587 |
+
exceptions: Record<string, boolean>;
|
| 588 |
+
}>,
|
| 589 |
+
]
|
| 590 |
+
>;
|
| 591 |
+
|
| 592 |
+
/**
|
| 593 |
+
* Rule to disallow multiline strings.
|
| 594 |
+
*
|
| 595 |
+
* @since 0.0.9
|
| 596 |
+
* @see https://eslint.org/docs/rules/no-multi-str
|
| 597 |
+
*/
|
| 598 |
+
"no-multi-str": Linter.RuleEntry<[]>;
|
| 599 |
+
|
| 600 |
+
/**
|
| 601 |
+
* Rule to disallow `new` operators outside of assignments or comparisons.
|
| 602 |
+
*
|
| 603 |
+
* @since 0.0.7
|
| 604 |
+
* @see https://eslint.org/docs/rules/no-new
|
| 605 |
+
*/
|
| 606 |
+
"no-new": Linter.RuleEntry<[]>;
|
| 607 |
+
|
| 608 |
+
/**
|
| 609 |
+
* Rule to disallow `new` operators with the `Function` object.
|
| 610 |
+
*
|
| 611 |
+
* @since 0.0.7
|
| 612 |
+
* @see https://eslint.org/docs/rules/no-new-func
|
| 613 |
+
*/
|
| 614 |
+
"no-new-func": Linter.RuleEntry<[]>;
|
| 615 |
+
|
| 616 |
+
/**
|
| 617 |
+
* Rule to disallow `new` operators with the `String`, `Number`, and `Boolean` objects.
|
| 618 |
+
*
|
| 619 |
+
* @since 0.0.6
|
| 620 |
+
* @see https://eslint.org/docs/rules/no-new-wrappers
|
| 621 |
+
*/
|
| 622 |
+
"no-new-wrappers": Linter.RuleEntry<[]>;
|
| 623 |
+
|
| 624 |
+
/**
|
| 625 |
+
* Disallow `\\8` and `\\9` escape sequences in string literals.
|
| 626 |
+
*
|
| 627 |
+
* @since 7.14.0
|
| 628 |
+
* @see https://eslint.org/docs/rules/no-nonoctal-decimal-escape
|
| 629 |
+
*/
|
| 630 |
+
"no-nonoctal-decimal-escape": Linter.RuleEntry<[]>;
|
| 631 |
+
|
| 632 |
+
/**
|
| 633 |
+
* Rule to disallow octal literals.
|
| 634 |
+
*
|
| 635 |
+
* @remarks
|
| 636 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 637 |
+
*
|
| 638 |
+
* @since 0.0.6
|
| 639 |
+
* @see https://eslint.org/docs/rules/no-octal
|
| 640 |
+
*/
|
| 641 |
+
"no-octal": Linter.RuleEntry<[]>;
|
| 642 |
+
|
| 643 |
+
/**
|
| 644 |
+
* Rule to disallow octal escape sequences in string literals.
|
| 645 |
+
*
|
| 646 |
+
* @since 0.0.9
|
| 647 |
+
* @see https://eslint.org/docs/rules/no-octal-escape
|
| 648 |
+
*/
|
| 649 |
+
"no-octal-escape": Linter.RuleEntry<[]>;
|
| 650 |
+
|
| 651 |
+
/**
|
| 652 |
+
* Rule to disallow reassigning `function` parameters.
|
| 653 |
+
*
|
| 654 |
+
* @since 0.18.0
|
| 655 |
+
* @see https://eslint.org/docs/rules/no-param-reassign
|
| 656 |
+
*/
|
| 657 |
+
"no-param-reassign": Linter.RuleEntry<
|
| 658 |
+
[
|
| 659 |
+
Partial<{
|
| 660 |
+
/**
|
| 661 |
+
* @default false
|
| 662 |
+
*/
|
| 663 |
+
props: boolean;
|
| 664 |
+
/**
|
| 665 |
+
* @default []
|
| 666 |
+
*/
|
| 667 |
+
ignorePropertyModificationsFor: string[];
|
| 668 |
+
}>,
|
| 669 |
+
]
|
| 670 |
+
>;
|
| 671 |
+
|
| 672 |
+
/**
|
| 673 |
+
* Rule to disallow the use of the `__proto__` property.
|
| 674 |
+
*
|
| 675 |
+
* @since 0.0.9
|
| 676 |
+
* @see https://eslint.org/docs/rules/no-proto
|
| 677 |
+
*/
|
| 678 |
+
"no-proto": Linter.RuleEntry<[]>;
|
| 679 |
+
|
| 680 |
+
/**
|
| 681 |
+
* Rule to disallow variable redeclaration.
|
| 682 |
+
*
|
| 683 |
+
* @remarks
|
| 684 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 685 |
+
*
|
| 686 |
+
* @since 0.0.9
|
| 687 |
+
* @see https://eslint.org/docs/rules/no-redeclare
|
| 688 |
+
*/
|
| 689 |
+
"no-redeclare": Linter.RuleEntry<
|
| 690 |
+
[
|
| 691 |
+
Partial<{
|
| 692 |
+
/**
|
| 693 |
+
* @default true
|
| 694 |
+
*/
|
| 695 |
+
builtinGlobals: boolean;
|
| 696 |
+
}>,
|
| 697 |
+
]
|
| 698 |
+
>;
|
| 699 |
+
|
| 700 |
+
/**
|
| 701 |
+
* Rule to disallow certain properties on certain objects.
|
| 702 |
+
*
|
| 703 |
+
* @since 3.5.0
|
| 704 |
+
* @see https://eslint.org/docs/rules/no-restricted-properties
|
| 705 |
+
*/
|
| 706 |
+
"no-restricted-properties": Linter.RuleEntry<
|
| 707 |
+
[
|
| 708 |
+
...Array<
|
| 709 |
+
| {
|
| 710 |
+
object: string;
|
| 711 |
+
property?: string | undefined;
|
| 712 |
+
message?: string | undefined;
|
| 713 |
+
}
|
| 714 |
+
| {
|
| 715 |
+
property: string;
|
| 716 |
+
message?: string | undefined;
|
| 717 |
+
}
|
| 718 |
+
>,
|
| 719 |
+
]
|
| 720 |
+
>;
|
| 721 |
+
|
| 722 |
+
/**
|
| 723 |
+
* Rule to disallow assignment operators in `return` statements.
|
| 724 |
+
*
|
| 725 |
+
* @since 0.0.9
|
| 726 |
+
* @see https://eslint.org/docs/rules/no-return-assign
|
| 727 |
+
*/
|
| 728 |
+
"no-return-assign": Linter.RuleEntry<["except-parens" | "always"]>;
|
| 729 |
+
|
| 730 |
+
/**
|
| 731 |
+
* Rule to disallow unnecessary `return await`.
|
| 732 |
+
*
|
| 733 |
+
* @since 3.10.0
|
| 734 |
+
* @see https://eslint.org/docs/rules/no-return-await
|
| 735 |
+
*/
|
| 736 |
+
"no-return-await": Linter.RuleEntry<[]>;
|
| 737 |
+
|
| 738 |
+
/**
|
| 739 |
+
* Rule to disallow `javascript:` urls.
|
| 740 |
+
*
|
| 741 |
+
* @since 0.0.9
|
| 742 |
+
* @see https://eslint.org/docs/rules/no-script-url
|
| 743 |
+
*/
|
| 744 |
+
"no-script-url": Linter.RuleEntry<[]>;
|
| 745 |
+
|
| 746 |
+
/**
|
| 747 |
+
* Rule to disallow assignments where both sides are exactly the same.
|
| 748 |
+
*
|
| 749 |
+
* @remarks
|
| 750 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 751 |
+
*
|
| 752 |
+
* @since 2.0.0-rc.0
|
| 753 |
+
* @see https://eslint.org/docs/rules/no-self-assign
|
| 754 |
+
*/
|
| 755 |
+
"no-self-assign": Linter.RuleEntry<[]>;
|
| 756 |
+
|
| 757 |
+
/**
|
| 758 |
+
* Rule to disallow comparisons where both sides are exactly the same.
|
| 759 |
+
*
|
| 760 |
+
* @since 0.0.9
|
| 761 |
+
* @see https://eslint.org/docs/rules/no-self-compare
|
| 762 |
+
*/
|
| 763 |
+
"no-self-compare": Linter.RuleEntry<[]>;
|
| 764 |
+
|
| 765 |
+
/**
|
| 766 |
+
* Rule to disallow comma operators.
|
| 767 |
+
*
|
| 768 |
+
* @since 0.5.1
|
| 769 |
+
* @see https://eslint.org/docs/rules/no-sequences
|
| 770 |
+
*/
|
| 771 |
+
"no-sequences": Linter.RuleEntry<[]>;
|
| 772 |
+
|
| 773 |
+
/**
|
| 774 |
+
* Rule to disallow throwing literals as exceptions.
|
| 775 |
+
*
|
| 776 |
+
* @since 0.15.0
|
| 777 |
+
* @see https://eslint.org/docs/rules/no-throw-literal
|
| 778 |
+
*/
|
| 779 |
+
"no-throw-literal": Linter.RuleEntry<[]>;
|
| 780 |
+
|
| 781 |
+
/**
|
| 782 |
+
* Rule to disallow unmodified loop conditions.
|
| 783 |
+
*
|
| 784 |
+
* @since 2.0.0-alpha-2
|
| 785 |
+
* @see https://eslint.org/docs/rules/no-unmodified-loop-condition
|
| 786 |
+
*/
|
| 787 |
+
"no-unmodified-loop-condition": Linter.RuleEntry<[]>;
|
| 788 |
+
|
| 789 |
+
/**
|
| 790 |
+
* Rule to disallow unused expressions.
|
| 791 |
+
*
|
| 792 |
+
* @since 0.1.0
|
| 793 |
+
* @see https://eslint.org/docs/rules/no-unused-expressions
|
| 794 |
+
*/
|
| 795 |
+
"no-unused-expressions": Linter.RuleEntry<
|
| 796 |
+
[
|
| 797 |
+
Partial<{
|
| 798 |
+
/**
|
| 799 |
+
* @default false
|
| 800 |
+
*/
|
| 801 |
+
allowShortCircuit: boolean;
|
| 802 |
+
/**
|
| 803 |
+
* @default false
|
| 804 |
+
*/
|
| 805 |
+
allowTernary: boolean;
|
| 806 |
+
/**
|
| 807 |
+
* @default false
|
| 808 |
+
*/
|
| 809 |
+
allowTaggedTemplates: boolean;
|
| 810 |
+
}>,
|
| 811 |
+
]
|
| 812 |
+
>;
|
| 813 |
+
|
| 814 |
+
/**
|
| 815 |
+
* Rule to disallow unused labels.
|
| 816 |
+
*
|
| 817 |
+
* @remarks
|
| 818 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 819 |
+
*
|
| 820 |
+
* @since 2.0.0-rc.0
|
| 821 |
+
* @see https://eslint.org/docs/rules/no-unused-labels
|
| 822 |
+
*/
|
| 823 |
+
"no-unused-labels": Linter.RuleEntry<[]>;
|
| 824 |
+
|
| 825 |
+
/**
|
| 826 |
+
* Disallow useless backreferences in regular expressions
|
| 827 |
+
*
|
| 828 |
+
* @remarks
|
| 829 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 830 |
+
*
|
| 831 |
+
* @since 7.0.0-alpha.0
|
| 832 |
+
* @see https://eslint.org/docs/latest/rules/no-useless-backreference
|
| 833 |
+
*/
|
| 834 |
+
"no-useless-backreference": Linter.RuleEntry<[]>;
|
| 835 |
+
|
| 836 |
+
/**
|
| 837 |
+
* Rule to disallow unnecessary calls to `.call()` and `.apply()`.
|
| 838 |
+
*
|
| 839 |
+
* @since 1.0.0-rc-1
|
| 840 |
+
* @see https://eslint.org/docs/rules/no-useless-call
|
| 841 |
+
*/
|
| 842 |
+
"no-useless-call": Linter.RuleEntry<[]>;
|
| 843 |
+
|
| 844 |
+
/**
|
| 845 |
+
* Rule to disallow unnecessary `catch` clauses.
|
| 846 |
+
*
|
| 847 |
+
* @remarks
|
| 848 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 849 |
+
*
|
| 850 |
+
* @since 5.11.0
|
| 851 |
+
* @see https://eslint.org/docs/rules/no-useless-catch
|
| 852 |
+
*/
|
| 853 |
+
"no-useless-catch": Linter.RuleEntry<[]>;
|
| 854 |
+
|
| 855 |
+
/**
|
| 856 |
+
* Rule to disallow unnecessary concatenation of literals or template literals.
|
| 857 |
+
*
|
| 858 |
+
* @since 1.3.0
|
| 859 |
+
* @see https://eslint.org/docs/rules/no-useless-concat
|
| 860 |
+
*/
|
| 861 |
+
"no-useless-concat": Linter.RuleEntry<[]>;
|
| 862 |
+
|
| 863 |
+
/**
|
| 864 |
+
* Rule to disallow unnecessary escape characters.
|
| 865 |
+
*
|
| 866 |
+
* @remarks
|
| 867 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 868 |
+
*
|
| 869 |
+
* @since 2.5.0
|
| 870 |
+
* @see https://eslint.org/docs/rules/no-useless-escape
|
| 871 |
+
*/
|
| 872 |
+
"no-useless-escape": Linter.RuleEntry<[]>;
|
| 873 |
+
|
| 874 |
+
/**
|
| 875 |
+
* Rule to disallow redundant return statements.
|
| 876 |
+
*
|
| 877 |
+
* @since 3.9.0
|
| 878 |
+
* @see https://eslint.org/docs/rules/no-useless-return
|
| 879 |
+
*/
|
| 880 |
+
"no-useless-return": Linter.RuleEntry<[]>;
|
| 881 |
+
|
| 882 |
+
/**
|
| 883 |
+
* Rule to disallow `void` operators.
|
| 884 |
+
*
|
| 885 |
+
* @since 0.8.0
|
| 886 |
+
* @see https://eslint.org/docs/rules/no-void
|
| 887 |
+
*/
|
| 888 |
+
"no-void": Linter.RuleEntry<
|
| 889 |
+
[
|
| 890 |
+
Partial<{
|
| 891 |
+
/**
|
| 892 |
+
* @default false
|
| 893 |
+
*/
|
| 894 |
+
allowAsStatement: boolean;
|
| 895 |
+
}>,
|
| 896 |
+
]
|
| 897 |
+
>;
|
| 898 |
+
|
| 899 |
+
/**
|
| 900 |
+
* Rule to disallow specified warning terms in comments.
|
| 901 |
+
*
|
| 902 |
+
* @since 0.4.4
|
| 903 |
+
* @see https://eslint.org/docs/rules/no-warning-comments
|
| 904 |
+
*/
|
| 905 |
+
"no-warning-comments": Linter.RuleEntry<
|
| 906 |
+
[
|
| 907 |
+
{
|
| 908 |
+
/**
|
| 909 |
+
* @default ["todo", "fixme", "xxx"]
|
| 910 |
+
*/
|
| 911 |
+
terms: string[];
|
| 912 |
+
/**
|
| 913 |
+
* @default 'start'
|
| 914 |
+
*/
|
| 915 |
+
location: "start" | "anywhere";
|
| 916 |
+
},
|
| 917 |
+
]
|
| 918 |
+
>;
|
| 919 |
+
|
| 920 |
+
/**
|
| 921 |
+
* Rule to disallow `with` statements.
|
| 922 |
+
*
|
| 923 |
+
* @remarks
|
| 924 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 925 |
+
*
|
| 926 |
+
* @since 0.0.2
|
| 927 |
+
* @see https://eslint.org/docs/rules/no-with
|
| 928 |
+
*/
|
| 929 |
+
"no-with": Linter.RuleEntry<[]>;
|
| 930 |
+
|
| 931 |
+
/**
|
| 932 |
+
* Rule to enforce using named capture group in regular expression.
|
| 933 |
+
*
|
| 934 |
+
* @since 5.15.0
|
| 935 |
+
* @see https://eslint.org/docs/rules/prefer-named-capture-group
|
| 936 |
+
*/
|
| 937 |
+
"prefer-named-capture-group": Linter.RuleEntry<[]>;
|
| 938 |
+
|
| 939 |
+
/**
|
| 940 |
+
* Disallow use of `Object.prototype.hasOwnProperty.call()` and prefer use of `Object.hasOwn()`.
|
| 941 |
+
*
|
| 942 |
+
* @since 3.5.0
|
| 943 |
+
* @see https://eslint.org/docs/rules/prefer-object-has-own
|
| 944 |
+
*/
|
| 945 |
+
"prefer-object-has-own": Linter.RuleEntry<[]>;
|
| 946 |
+
|
| 947 |
+
/**
|
| 948 |
+
* Rule to require using Error objects as Promise rejection reasons.
|
| 949 |
+
*
|
| 950 |
+
* @since 3.14.0
|
| 951 |
+
* @see https://eslint.org/docs/rules/prefer-promise-reject-errors
|
| 952 |
+
*/
|
| 953 |
+
"prefer-promise-reject-errors": Linter.RuleEntry<
|
| 954 |
+
[
|
| 955 |
+
Partial<{
|
| 956 |
+
/**
|
| 957 |
+
* @default false
|
| 958 |
+
*/
|
| 959 |
+
allowEmptyReject: boolean;
|
| 960 |
+
}>,
|
| 961 |
+
]
|
| 962 |
+
>;
|
| 963 |
+
|
| 964 |
+
/**
|
| 965 |
+
* Disallow use of the `RegExp` constructor in favor of regular expression literals.
|
| 966 |
+
*
|
| 967 |
+
* @since 6.4.0
|
| 968 |
+
* @see https://eslint.org/docs/latest/rules/prefer-regex-literals
|
| 969 |
+
*/
|
| 970 |
+
"prefer-regex-literals": Linter.RuleEntry<
|
| 971 |
+
[
|
| 972 |
+
Partial<{
|
| 973 |
+
/**
|
| 974 |
+
* @default false
|
| 975 |
+
*/
|
| 976 |
+
disallowRedundantWrapping: boolean;
|
| 977 |
+
}>,
|
| 978 |
+
]
|
| 979 |
+
>;
|
| 980 |
+
|
| 981 |
+
/**
|
| 982 |
+
* Rule to enforce the consistent use of the radix argument when using `parseInt()`.
|
| 983 |
+
*
|
| 984 |
+
* @since 0.0.7
|
| 985 |
+
* @see https://eslint.org/docs/rules/radix
|
| 986 |
+
*/
|
| 987 |
+
radix: Linter.RuleEntry<["always" | "as-needed"]>;
|
| 988 |
+
|
| 989 |
+
/**
|
| 990 |
+
* Rule to disallow async functions which have no `await` expression.
|
| 991 |
+
*
|
| 992 |
+
* @since 3.11.0
|
| 993 |
+
* @see https://eslint.org/docs/rules/require-await
|
| 994 |
+
*/
|
| 995 |
+
"require-await": Linter.RuleEntry<[]>;
|
| 996 |
+
|
| 997 |
+
/**
|
| 998 |
+
* Rule to enforce the use of `u` flag on RegExp.
|
| 999 |
+
*
|
| 1000 |
+
* @since 5.3.0
|
| 1001 |
+
* @see https://eslint.org/docs/rules/require-unicode-regexp
|
| 1002 |
+
*/
|
| 1003 |
+
"require-unicode-regexp": Linter.RuleEntry<[]>;
|
| 1004 |
+
|
| 1005 |
+
/**
|
| 1006 |
+
* Rule to require `var` declarations be placed at the top of their containing scope.
|
| 1007 |
+
*
|
| 1008 |
+
* @since 0.8.0
|
| 1009 |
+
* @see https://eslint.org/docs/rules/vars-on-top
|
| 1010 |
+
*/
|
| 1011 |
+
"vars-on-top": Linter.RuleEntry<[]>;
|
| 1012 |
+
|
| 1013 |
+
/**
|
| 1014 |
+
* Rule to require parentheses around immediate `function` invocations.
|
| 1015 |
+
*
|
| 1016 |
+
* @since 0.0.9
|
| 1017 |
+
* @see https://eslint.org/docs/rules/wrap-iife
|
| 1018 |
+
*/
|
| 1019 |
+
"wrap-iife": Linter.RuleEntry<
|
| 1020 |
+
[
|
| 1021 |
+
"outside" | "inside" | "any",
|
| 1022 |
+
Partial<{
|
| 1023 |
+
/**
|
| 1024 |
+
* @default false
|
| 1025 |
+
*/
|
| 1026 |
+
functionPrototypeMethods: boolean;
|
| 1027 |
+
}>,
|
| 1028 |
+
]
|
| 1029 |
+
>;
|
| 1030 |
+
|
| 1031 |
+
/**
|
| 1032 |
+
* Rule to require or disallow “Yoda” conditions.
|
| 1033 |
+
*
|
| 1034 |
+
* @since 0.7.1
|
| 1035 |
+
* @see https://eslint.org/docs/rules/yoda
|
| 1036 |
+
*/
|
| 1037 |
+
yoda:
|
| 1038 |
+
| Linter.RuleEntry<
|
| 1039 |
+
[
|
| 1040 |
+
"never",
|
| 1041 |
+
Partial<{
|
| 1042 |
+
exceptRange: boolean;
|
| 1043 |
+
onlyEquality: boolean;
|
| 1044 |
+
}>,
|
| 1045 |
+
]
|
| 1046 |
+
>
|
| 1047 |
+
| Linter.RuleEntry<["always"]>;
|
| 1048 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/deprecated.d.ts
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Linter } from "../index";
|
| 2 |
+
|
| 3 |
+
export interface Deprecated extends Linter.RulesRecord {
|
| 4 |
+
/**
|
| 5 |
+
* Rule to enforce consistent indentation.
|
| 6 |
+
*
|
| 7 |
+
* @since 4.0.0-alpha.0
|
| 8 |
+
* @deprecated since 4.0.0, use [`indent`](https://eslint.org/docs/rules/indent) instead.
|
| 9 |
+
* @see https://eslint.org/docs/rules/indent-legacy
|
| 10 |
+
*/
|
| 11 |
+
"indent-legacy": Linter.RuleEntry<
|
| 12 |
+
[
|
| 13 |
+
number | "tab",
|
| 14 |
+
Partial<{
|
| 15 |
+
/**
|
| 16 |
+
* @default 0
|
| 17 |
+
*/
|
| 18 |
+
SwitchCase: number;
|
| 19 |
+
/**
|
| 20 |
+
* @default 1
|
| 21 |
+
*/
|
| 22 |
+
VariableDeclarator:
|
| 23 |
+
| Partial<{
|
| 24 |
+
/**
|
| 25 |
+
* @default 1
|
| 26 |
+
*/
|
| 27 |
+
var: number | "first";
|
| 28 |
+
/**
|
| 29 |
+
* @default 1
|
| 30 |
+
*/
|
| 31 |
+
let: number | "first";
|
| 32 |
+
/**
|
| 33 |
+
* @default 1
|
| 34 |
+
*/
|
| 35 |
+
const: number | "first";
|
| 36 |
+
}>
|
| 37 |
+
| number
|
| 38 |
+
| "first";
|
| 39 |
+
/**
|
| 40 |
+
* @default 1
|
| 41 |
+
*/
|
| 42 |
+
outerIIFEBody: number;
|
| 43 |
+
/**
|
| 44 |
+
* @default 1
|
| 45 |
+
*/
|
| 46 |
+
MemberExpression: number | "off";
|
| 47 |
+
/**
|
| 48 |
+
* @default { parameters: 1, body: 1 }
|
| 49 |
+
*/
|
| 50 |
+
FunctionDeclaration: Partial<{
|
| 51 |
+
/**
|
| 52 |
+
* @default 1
|
| 53 |
+
*/
|
| 54 |
+
parameters: number | "first" | "off";
|
| 55 |
+
/**
|
| 56 |
+
* @default 1
|
| 57 |
+
*/
|
| 58 |
+
body: number;
|
| 59 |
+
}>;
|
| 60 |
+
/**
|
| 61 |
+
* @default { parameters: 1, body: 1 }
|
| 62 |
+
*/
|
| 63 |
+
FunctionExpression: Partial<{
|
| 64 |
+
/**
|
| 65 |
+
* @default 1
|
| 66 |
+
*/
|
| 67 |
+
parameters: number | "first" | "off";
|
| 68 |
+
/**
|
| 69 |
+
* @default 1
|
| 70 |
+
*/
|
| 71 |
+
body: number;
|
| 72 |
+
}>;
|
| 73 |
+
/**
|
| 74 |
+
* @default { arguments: 1 }
|
| 75 |
+
*/
|
| 76 |
+
CallExpression: Partial<{
|
| 77 |
+
/**
|
| 78 |
+
* @default 1
|
| 79 |
+
*/
|
| 80 |
+
arguments: number | "first" | "off";
|
| 81 |
+
}>;
|
| 82 |
+
/**
|
| 83 |
+
* @default 1
|
| 84 |
+
*/
|
| 85 |
+
ArrayExpression: number | "first" | "off";
|
| 86 |
+
/**
|
| 87 |
+
* @default 1
|
| 88 |
+
*/
|
| 89 |
+
ObjectExpression: number | "first" | "off";
|
| 90 |
+
/**
|
| 91 |
+
* @default 1
|
| 92 |
+
*/
|
| 93 |
+
ImportDeclaration: number | "first" | "off";
|
| 94 |
+
/**
|
| 95 |
+
* @default false
|
| 96 |
+
*/
|
| 97 |
+
flatTernaryExpressions: boolean;
|
| 98 |
+
ignoredNodes: string[];
|
| 99 |
+
/**
|
| 100 |
+
* @default false
|
| 101 |
+
*/
|
| 102 |
+
ignoreComments: boolean;
|
| 103 |
+
}>,
|
| 104 |
+
]
|
| 105 |
+
>;
|
| 106 |
+
|
| 107 |
+
/**
|
| 108 |
+
* Rule to require or disallow newlines around directives.
|
| 109 |
+
*
|
| 110 |
+
* @since 3.5.0
|
| 111 |
+
* @deprecated since 4.0.0, use [`padding-line-between-statements`](https://eslint.org/docs/rules/padding-line-between-statements) instead.
|
| 112 |
+
* @see https://eslint.org/docs/rules/lines-around-directive
|
| 113 |
+
*/
|
| 114 |
+
"lines-around-directive": Linter.RuleEntry<["always" | "never"]>;
|
| 115 |
+
|
| 116 |
+
/**
|
| 117 |
+
* Rule to require or disallow an empty line after variable declarations.
|
| 118 |
+
*
|
| 119 |
+
* @since 0.18.0
|
| 120 |
+
* @deprecated since 4.0.0, use [`padding-line-between-statements`](https://eslint.org/docs/rules/padding-line-between-statements) instead.
|
| 121 |
+
* @see https://eslint.org/docs/rules/newline-after-var
|
| 122 |
+
*/
|
| 123 |
+
"newline-after-var": Linter.RuleEntry<["always" | "never"]>;
|
| 124 |
+
|
| 125 |
+
/**
|
| 126 |
+
* Rule to require an empty line before `return` statements.
|
| 127 |
+
*
|
| 128 |
+
* @since 2.3.0
|
| 129 |
+
* @deprecated since 4.0.0, use [`padding-line-between-statements`](https://eslint.org/docs/rules/padding-line-between-statements) instead.
|
| 130 |
+
* @see https://eslint.org/docs/rules/newline-before-return
|
| 131 |
+
*/
|
| 132 |
+
"newline-before-return": Linter.RuleEntry<[]>;
|
| 133 |
+
|
| 134 |
+
/**
|
| 135 |
+
* Rule to disallow shadowing of variables inside of `catch`.
|
| 136 |
+
*
|
| 137 |
+
* @since 0.0.9
|
| 138 |
+
* @deprecated since 5.1.0, use [`no-shadow`](https://eslint.org/docs/rules/no-shadow) instead.
|
| 139 |
+
* @see https://eslint.org/docs/rules/no-catch-shadow
|
| 140 |
+
*/
|
| 141 |
+
"no-catch-shadow": Linter.RuleEntry<[]>;
|
| 142 |
+
|
| 143 |
+
/**
|
| 144 |
+
* Rule to disallow reassignment of native objects.
|
| 145 |
+
*
|
| 146 |
+
* @since 0.0.9
|
| 147 |
+
* @deprecated since 3.3.0, use [`no-global-assign`](https://eslint.org/docs/rules/no-global-assign) instead.
|
| 148 |
+
* @see https://eslint.org/docs/rules/no-native-reassign
|
| 149 |
+
*/
|
| 150 |
+
"no-native-reassign": Linter.RuleEntry<
|
| 151 |
+
[
|
| 152 |
+
Partial<{
|
| 153 |
+
exceptions: string[];
|
| 154 |
+
}>,
|
| 155 |
+
]
|
| 156 |
+
>;
|
| 157 |
+
|
| 158 |
+
/**
|
| 159 |
+
* Rule to disallow negating the left operand in `in` expressions.
|
| 160 |
+
*
|
| 161 |
+
* @since 0.1.2
|
| 162 |
+
* @deprecated since 3.3.0, use [`no-unsafe-negation`](https://eslint.org/docs/rules/no-unsafe-negation) instead.
|
| 163 |
+
* @see https://eslint.org/docs/rules/no-negated-in-lhs
|
| 164 |
+
*/
|
| 165 |
+
"no-negated-in-lhs": Linter.RuleEntry<[]>;
|
| 166 |
+
|
| 167 |
+
/**
|
| 168 |
+
* Rule to disallow spacing between function identifiers and their applications.
|
| 169 |
+
*
|
| 170 |
+
* @since 0.1.2
|
| 171 |
+
* @deprecated since 3.3.0, use [`func-call-spacing`](https://eslint.org/docs/rules/func-call-spacing) instead.
|
| 172 |
+
* @see https://eslint.org/docs/rules/no-spaced-func
|
| 173 |
+
*/
|
| 174 |
+
"no-spaced-func": Linter.RuleEntry<[]>;
|
| 175 |
+
|
| 176 |
+
/**
|
| 177 |
+
* Rule to suggest using `Reflect` methods where applicable.
|
| 178 |
+
*
|
| 179 |
+
* @since 1.0.0-rc-2
|
| 180 |
+
* @deprecated since 3.9.0
|
| 181 |
+
* @see https://eslint.org/docs/rules/prefer-reflect
|
| 182 |
+
*/
|
| 183 |
+
"prefer-reflect": Linter.RuleEntry<
|
| 184 |
+
[
|
| 185 |
+
Partial<{
|
| 186 |
+
exceptions: string[];
|
| 187 |
+
}>,
|
| 188 |
+
]
|
| 189 |
+
>;
|
| 190 |
+
|
| 191 |
+
/**
|
| 192 |
+
* Rule to require JSDoc comments.
|
| 193 |
+
*
|
| 194 |
+
* @since 1.4.0
|
| 195 |
+
* @deprecated since 5.10.0
|
| 196 |
+
* @see https://eslint.org/docs/rules/require-jsdoc
|
| 197 |
+
*/
|
| 198 |
+
"require-jsdoc": Linter.RuleEntry<
|
| 199 |
+
[
|
| 200 |
+
Partial<{
|
| 201 |
+
require: Partial<{
|
| 202 |
+
/**
|
| 203 |
+
* @default true
|
| 204 |
+
*/
|
| 205 |
+
FunctionDeclaration: boolean;
|
| 206 |
+
/**
|
| 207 |
+
* @default false
|
| 208 |
+
*/
|
| 209 |
+
MethodDefinition: boolean;
|
| 210 |
+
/**
|
| 211 |
+
* @default false
|
| 212 |
+
*/
|
| 213 |
+
ClassDeclaration: boolean;
|
| 214 |
+
/**
|
| 215 |
+
* @default false
|
| 216 |
+
*/
|
| 217 |
+
ArrowFunctionExpression: boolean;
|
| 218 |
+
/**
|
| 219 |
+
* @default false
|
| 220 |
+
*/
|
| 221 |
+
FunctionExpression: boolean;
|
| 222 |
+
}>;
|
| 223 |
+
}>,
|
| 224 |
+
]
|
| 225 |
+
>;
|
| 226 |
+
|
| 227 |
+
/**
|
| 228 |
+
* Rule to enforce valid JSDoc comments.
|
| 229 |
+
*
|
| 230 |
+
* @since 0.4.0
|
| 231 |
+
* @deprecated since 5.10.0
|
| 232 |
+
* @see https://eslint.org/docs/rules/valid-jsdoc
|
| 233 |
+
*/
|
| 234 |
+
"valid-jsdoc": Linter.RuleEntry<
|
| 235 |
+
[
|
| 236 |
+
Partial<{
|
| 237 |
+
prefer: Record<string, string>;
|
| 238 |
+
preferType: Record<string, string>;
|
| 239 |
+
/**
|
| 240 |
+
* @default true
|
| 241 |
+
*/
|
| 242 |
+
requireReturn: boolean;
|
| 243 |
+
/**
|
| 244 |
+
* @default true
|
| 245 |
+
*/
|
| 246 |
+
requireReturnType: boolean;
|
| 247 |
+
/**
|
| 248 |
+
* @remarks
|
| 249 |
+
* Also accept for regular expression pattern
|
| 250 |
+
*/
|
| 251 |
+
matchDescription: string;
|
| 252 |
+
/**
|
| 253 |
+
* @default true
|
| 254 |
+
*/
|
| 255 |
+
requireParamDescription: boolean;
|
| 256 |
+
/**
|
| 257 |
+
* @default true
|
| 258 |
+
*/
|
| 259 |
+
requireReturnDescription: boolean;
|
| 260 |
+
/**
|
| 261 |
+
* @default true
|
| 262 |
+
*/
|
| 263 |
+
requireParamType: boolean;
|
| 264 |
+
}>,
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Linter } from "../index";
|
| 2 |
+
|
| 3 |
+
export interface ECMAScript6 extends Linter.RulesRecord {
|
| 4 |
+
/**
|
| 5 |
+
* Rule to require braces around arrow function bodies.
|
| 6 |
+
*
|
| 7 |
+
* @since 1.8.0
|
| 8 |
+
* @see https://eslint.org/docs/rules/arrow-body-style
|
| 9 |
+
*/
|
| 10 |
+
"arrow-body-style":
|
| 11 |
+
| Linter.RuleEntry<
|
| 12 |
+
[
|
| 13 |
+
"as-needed",
|
| 14 |
+
Partial<{
|
| 15 |
+
/**
|
| 16 |
+
* @default false
|
| 17 |
+
*/
|
| 18 |
+
requireReturnForObjectLiteral: boolean;
|
| 19 |
+
}>,
|
| 20 |
+
]
|
| 21 |
+
>
|
| 22 |
+
| Linter.RuleEntry<["always" | "never"]>;
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Rule to require parentheses around arrow function arguments.
|
| 26 |
+
*
|
| 27 |
+
* @since 1.0.0-rc-1
|
| 28 |
+
* @see https://eslint.org/docs/rules/arrow-parens
|
| 29 |
+
*/
|
| 30 |
+
"arrow-parens":
|
| 31 |
+
| Linter.RuleEntry<["always"]>
|
| 32 |
+
| Linter.RuleEntry<
|
| 33 |
+
[
|
| 34 |
+
"as-needed",
|
| 35 |
+
Partial<{
|
| 36 |
+
/**
|
| 37 |
+
* @default false
|
| 38 |
+
*/
|
| 39 |
+
requireForBlockBody: boolean;
|
| 40 |
+
}>,
|
| 41 |
+
]
|
| 42 |
+
>;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Rule to enforce consistent spacing before and after the arrow in arrow functions.
|
| 46 |
+
*
|
| 47 |
+
* @since 1.0.0-rc-1
|
| 48 |
+
* @see https://eslint.org/docs/rules/arrow-spacing
|
| 49 |
+
*/
|
| 50 |
+
"arrow-spacing": Linter.RuleEntry<[]>;
|
| 51 |
+
|
| 52 |
+
/**
|
| 53 |
+
* Rule to require `super()` calls in constructors.
|
| 54 |
+
*
|
| 55 |
+
* @remarks
|
| 56 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 57 |
+
*
|
| 58 |
+
* @since 0.24.0
|
| 59 |
+
* @see https://eslint.org/docs/rules/constructor-super
|
| 60 |
+
*/
|
| 61 |
+
"constructor-super": Linter.RuleEntry<[]>;
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* Rule to enforce consistent spacing around `*` operators in generator functions.
|
| 65 |
+
*
|
| 66 |
+
* @since 0.17.0
|
| 67 |
+
* @see https://eslint.org/docs/rules/generator-star-spacing
|
| 68 |
+
*/
|
| 69 |
+
"generator-star-spacing": Linter.RuleEntry<
|
| 70 |
+
[
|
| 71 |
+
| Partial<{
|
| 72 |
+
before: boolean;
|
| 73 |
+
after: boolean;
|
| 74 |
+
named:
|
| 75 |
+
| Partial<{
|
| 76 |
+
before: boolean;
|
| 77 |
+
after: boolean;
|
| 78 |
+
}>
|
| 79 |
+
| "before"
|
| 80 |
+
| "after"
|
| 81 |
+
| "both"
|
| 82 |
+
| "neither";
|
| 83 |
+
anonymous:
|
| 84 |
+
| Partial<{
|
| 85 |
+
before: boolean;
|
| 86 |
+
after: boolean;
|
| 87 |
+
}>
|
| 88 |
+
| "before"
|
| 89 |
+
| "after"
|
| 90 |
+
| "both"
|
| 91 |
+
| "neither";
|
| 92 |
+
method:
|
| 93 |
+
| Partial<{
|
| 94 |
+
before: boolean;
|
| 95 |
+
after: boolean;
|
| 96 |
+
}>
|
| 97 |
+
| "before"
|
| 98 |
+
| "after"
|
| 99 |
+
| "both"
|
| 100 |
+
| "neither";
|
| 101 |
+
}>
|
| 102 |
+
| "before"
|
| 103 |
+
| "after"
|
| 104 |
+
| "both"
|
| 105 |
+
| "neither",
|
| 106 |
+
]
|
| 107 |
+
>;
|
| 108 |
+
|
| 109 |
+
/**
|
| 110 |
+
* Require or disallow logical assignment operator shorthand.
|
| 111 |
+
*
|
| 112 |
+
* @since 8.24.0
|
| 113 |
+
* @see https://eslint.org/docs/rules/logical-assignment-operators
|
| 114 |
+
*/
|
| 115 |
+
"logical-assignment-operators":
|
| 116 |
+
| Linter.RuleEntry<
|
| 117 |
+
[
|
| 118 |
+
"always",
|
| 119 |
+
Partial<{
|
| 120 |
+
/**
|
| 121 |
+
* @default false
|
| 122 |
+
*/
|
| 123 |
+
enforceForIfStatements: boolean;
|
| 124 |
+
}>,
|
| 125 |
+
]
|
| 126 |
+
>
|
| 127 |
+
| Linter.RuleEntry<["never"]>;
|
| 128 |
+
|
| 129 |
+
/**
|
| 130 |
+
* Rule to disallow reassigning class members.
|
| 131 |
+
*
|
| 132 |
+
* @remarks
|
| 133 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 134 |
+
*
|
| 135 |
+
* @since 1.0.0-rc-1
|
| 136 |
+
* @see https://eslint.org/docs/rules/no-class-assign
|
| 137 |
+
*/
|
| 138 |
+
"no-class-assign": Linter.RuleEntry<[]>;
|
| 139 |
+
|
| 140 |
+
/**
|
| 141 |
+
* Rule to disallow arrow functions where they could be confused with comparisons.
|
| 142 |
+
*
|
| 143 |
+
* @since 2.0.0-alpha-2
|
| 144 |
+
* @see https://eslint.org/docs/rules/no-confusing-arrow
|
| 145 |
+
*/
|
| 146 |
+
"no-confusing-arrow": Linter.RuleEntry<
|
| 147 |
+
[
|
| 148 |
+
Partial<{
|
| 149 |
+
/**
|
| 150 |
+
* @default true
|
| 151 |
+
*/
|
| 152 |
+
allowParens: boolean;
|
| 153 |
+
}>,
|
| 154 |
+
]
|
| 155 |
+
>;
|
| 156 |
+
|
| 157 |
+
/**
|
| 158 |
+
* Rule to disallow reassigning `const` variables.
|
| 159 |
+
*
|
| 160 |
+
* @remarks
|
| 161 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 162 |
+
*
|
| 163 |
+
* @since 1.0.0-rc-1
|
| 164 |
+
* @see https://eslint.org/docs/rules/no-const-assign
|
| 165 |
+
*/
|
| 166 |
+
"no-const-assign": Linter.RuleEntry<[]>;
|
| 167 |
+
|
| 168 |
+
/**
|
| 169 |
+
* Rule to disallow duplicate class members.
|
| 170 |
+
*
|
| 171 |
+
* @remarks
|
| 172 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 173 |
+
*
|
| 174 |
+
* @since 1.2.0
|
| 175 |
+
* @see https://eslint.org/docs/rules/no-dupe-class-members
|
| 176 |
+
*/
|
| 177 |
+
"no-dupe-class-members": Linter.RuleEntry<[]>;
|
| 178 |
+
|
| 179 |
+
/**
|
| 180 |
+
* Rule to disallow duplicate module imports.
|
| 181 |
+
*
|
| 182 |
+
* @since 2.5.0
|
| 183 |
+
* @see https://eslint.org/docs/rules/no-duplicate-imports
|
| 184 |
+
*/
|
| 185 |
+
"no-duplicate-imports": Linter.RuleEntry<
|
| 186 |
+
[
|
| 187 |
+
Partial<{
|
| 188 |
+
/**
|
| 189 |
+
* @default false
|
| 190 |
+
*/
|
| 191 |
+
includeExports: boolean;
|
| 192 |
+
}>,
|
| 193 |
+
]
|
| 194 |
+
>;
|
| 195 |
+
|
| 196 |
+
/**
|
| 197 |
+
* Rule to disallow `new` operators with the `Symbol` object.
|
| 198 |
+
*
|
| 199 |
+
* @remarks
|
| 200 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 201 |
+
*
|
| 202 |
+
* @since 2.0.0-beta.1
|
| 203 |
+
* @see https://eslint.org/docs/rules/no-new-symbol
|
| 204 |
+
*/
|
| 205 |
+
"no-new-symbol": Linter.RuleEntry<[]>;
|
| 206 |
+
|
| 207 |
+
/**
|
| 208 |
+
* Rule to disallow specified modules when loaded by `import`.
|
| 209 |
+
*
|
| 210 |
+
* @since 2.0.0-alpha-1
|
| 211 |
+
* @see https://eslint.org/docs/rules/no-restricted-imports
|
| 212 |
+
*/
|
| 213 |
+
"no-restricted-imports": Linter.RuleEntry<
|
| 214 |
+
[
|
| 215 |
+
...Array<
|
| 216 |
+
| string
|
| 217 |
+
| {
|
| 218 |
+
name: string;
|
| 219 |
+
importNames?: string[] | undefined;
|
| 220 |
+
message?: string | undefined;
|
| 221 |
+
}
|
| 222 |
+
| Partial<{
|
| 223 |
+
paths: Array<
|
| 224 |
+
| string
|
| 225 |
+
| {
|
| 226 |
+
name: string;
|
| 227 |
+
importNames?: string[] | undefined;
|
| 228 |
+
message?: string | undefined;
|
| 229 |
+
}
|
| 230 |
+
>;
|
| 231 |
+
patterns: string[];
|
| 232 |
+
}>
|
| 233 |
+
>,
|
| 234 |
+
]
|
| 235 |
+
>;
|
| 236 |
+
|
| 237 |
+
/**
|
| 238 |
+
* Rule to disallow `this`/`super` before calling `super()` in constructors.
|
| 239 |
+
*
|
| 240 |
+
* @remarks
|
| 241 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 242 |
+
*
|
| 243 |
+
* @since 0.24.0
|
| 244 |
+
* @see https://eslint.org/docs/rules/no-this-before-super
|
| 245 |
+
*/
|
| 246 |
+
"no-this-before-super": Linter.RuleEntry<[]>;
|
| 247 |
+
|
| 248 |
+
/**
|
| 249 |
+
* Rule to disallow unnecessary computed property keys in object literals.
|
| 250 |
+
*
|
| 251 |
+
* @since 2.9.0
|
| 252 |
+
* @see https://eslint.org/docs/rules/no-useless-computed-key
|
| 253 |
+
*/
|
| 254 |
+
"no-useless-computed-key": Linter.RuleEntry<[]>;
|
| 255 |
+
|
| 256 |
+
/**
|
| 257 |
+
* Rule to disallow unnecessary constructors.
|
| 258 |
+
*
|
| 259 |
+
* @since 2.0.0-beta.1
|
| 260 |
+
* @see https://eslint.org/docs/rules/no-useless-constructor
|
| 261 |
+
*/
|
| 262 |
+
"no-useless-constructor": Linter.RuleEntry<[]>;
|
| 263 |
+
|
| 264 |
+
/**
|
| 265 |
+
* Rule to disallow renaming import, export, and destructured assignments to the same name.
|
| 266 |
+
*
|
| 267 |
+
* @since 2.11.0
|
| 268 |
+
* @see https://eslint.org/docs/rules/no-useless-rename
|
| 269 |
+
*/
|
| 270 |
+
"no-useless-rename": Linter.RuleEntry<
|
| 271 |
+
[
|
| 272 |
+
Partial<{
|
| 273 |
+
/**
|
| 274 |
+
* @default false
|
| 275 |
+
*/
|
| 276 |
+
ignoreImport: boolean;
|
| 277 |
+
/**
|
| 278 |
+
* @default false
|
| 279 |
+
*/
|
| 280 |
+
ignoreExport: boolean;
|
| 281 |
+
/**
|
| 282 |
+
* @default false
|
| 283 |
+
*/
|
| 284 |
+
ignoreDestructuring: boolean;
|
| 285 |
+
}>,
|
| 286 |
+
]
|
| 287 |
+
>;
|
| 288 |
+
|
| 289 |
+
/**
|
| 290 |
+
* Rule to require `let` or `const` instead of `var`.
|
| 291 |
+
*
|
| 292 |
+
* @since 0.12.0
|
| 293 |
+
* @see https://eslint.org/docs/rules/no-var
|
| 294 |
+
*/
|
| 295 |
+
"no-var": Linter.RuleEntry<[]>;
|
| 296 |
+
|
| 297 |
+
/**
|
| 298 |
+
* Rule to require or disallow method and property shorthand syntax for object literals.
|
| 299 |
+
*
|
| 300 |
+
* @since 0.20.0
|
| 301 |
+
* @see https://eslint.org/docs/rules/object-shorthand
|
| 302 |
+
*/
|
| 303 |
+
"object-shorthand":
|
| 304 |
+
| Linter.RuleEntry<
|
| 305 |
+
[
|
| 306 |
+
"always" | "methods",
|
| 307 |
+
Partial<{
|
| 308 |
+
/**
|
| 309 |
+
* @default false
|
| 310 |
+
*/
|
| 311 |
+
avoidQuotes: boolean;
|
| 312 |
+
/**
|
| 313 |
+
* @default false
|
| 314 |
+
*/
|
| 315 |
+
ignoreConstructors: boolean;
|
| 316 |
+
/**
|
| 317 |
+
* @default false
|
| 318 |
+
*/
|
| 319 |
+
avoidExplicitReturnArrows: boolean;
|
| 320 |
+
}>,
|
| 321 |
+
]
|
| 322 |
+
>
|
| 323 |
+
| Linter.RuleEntry<
|
| 324 |
+
[
|
| 325 |
+
"properties",
|
| 326 |
+
Partial<{
|
| 327 |
+
/**
|
| 328 |
+
* @default false
|
| 329 |
+
*/
|
| 330 |
+
avoidQuotes: boolean;
|
| 331 |
+
}>,
|
| 332 |
+
]
|
| 333 |
+
>
|
| 334 |
+
| Linter.RuleEntry<["never" | "consistent" | "consistent-as-needed"]>;
|
| 335 |
+
|
| 336 |
+
/**
|
| 337 |
+
* Rule to require using arrow functions for callbacks.
|
| 338 |
+
*
|
| 339 |
+
* @since 1.2.0
|
| 340 |
+
* @see https://eslint.org/docs/rules/prefer-arrow-callback
|
| 341 |
+
*/
|
| 342 |
+
"prefer-arrow-callback": Linter.RuleEntry<
|
| 343 |
+
[
|
| 344 |
+
Partial<{
|
| 345 |
+
/**
|
| 346 |
+
* @default false
|
| 347 |
+
*/
|
| 348 |
+
allowNamedFunctions: boolean;
|
| 349 |
+
/**
|
| 350 |
+
* @default true
|
| 351 |
+
*/
|
| 352 |
+
allowUnboundThis: boolean;
|
| 353 |
+
}>,
|
| 354 |
+
]
|
| 355 |
+
>;
|
| 356 |
+
|
| 357 |
+
/**
|
| 358 |
+
* Rule to require `const` declarations for variables that are never reassigned after declared.
|
| 359 |
+
*
|
| 360 |
+
* @since 0.23.0
|
| 361 |
+
* @see https://eslint.org/docs/rules/prefer-const
|
| 362 |
+
*/
|
| 363 |
+
"prefer-const": Linter.RuleEntry<
|
| 364 |
+
[
|
| 365 |
+
Partial<{
|
| 366 |
+
/**
|
| 367 |
+
* @default 'any'
|
| 368 |
+
*/
|
| 369 |
+
destructuring: "any" | "all";
|
| 370 |
+
/**
|
| 371 |
+
* @default false
|
| 372 |
+
*/
|
| 373 |
+
ignoreReadBeforeAssign: boolean;
|
| 374 |
+
}>,
|
| 375 |
+
]
|
| 376 |
+
>;
|
| 377 |
+
|
| 378 |
+
/**
|
| 379 |
+
* Rule to require destructuring from arrays and/or objects.
|
| 380 |
+
*
|
| 381 |
+
* @since 3.13.0
|
| 382 |
+
* @see https://eslint.org/docs/rules/prefer-destructuring
|
| 383 |
+
*/
|
| 384 |
+
"prefer-destructuring": Linter.RuleEntry<
|
| 385 |
+
[
|
| 386 |
+
Partial<
|
| 387 |
+
| {
|
| 388 |
+
VariableDeclarator: Partial<{
|
| 389 |
+
array: boolean;
|
| 390 |
+
object: boolean;
|
| 391 |
+
}>;
|
| 392 |
+
AssignmentExpression: Partial<{
|
| 393 |
+
array: boolean;
|
| 394 |
+
object: boolean;
|
| 395 |
+
}>;
|
| 396 |
+
}
|
| 397 |
+
| {
|
| 398 |
+
array: boolean;
|
| 399 |
+
object: boolean;
|
| 400 |
+
}
|
| 401 |
+
>,
|
| 402 |
+
Partial<{
|
| 403 |
+
enforceForRenamedProperties: boolean;
|
| 404 |
+
}>,
|
| 405 |
+
]
|
| 406 |
+
>;
|
| 407 |
+
|
| 408 |
+
/**
|
| 409 |
+
* Disallow the use of `Math.pow` in favor of the `**` operator.
|
| 410 |
+
*
|
| 411 |
+
* @since 6.7.0
|
| 412 |
+
* @see https://eslint.org/docs/latest/rules/prefer-exponentiation-operator
|
| 413 |
+
*/
|
| 414 |
+
"prefer-exponentiation-operator": Linter.RuleEntry<[]>;
|
| 415 |
+
|
| 416 |
+
/**
|
| 417 |
+
* Rule to disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals.
|
| 418 |
+
*
|
| 419 |
+
* @since 3.5.0
|
| 420 |
+
* @see https://eslint.org/docs/rules/prefer-numeric-literals
|
| 421 |
+
*/
|
| 422 |
+
"prefer-numeric-literals": Linter.RuleEntry<[]>;
|
| 423 |
+
|
| 424 |
+
/**
|
| 425 |
+
* Rule to require rest parameters instead of `arguments`.
|
| 426 |
+
*
|
| 427 |
+
* @since 2.0.0-alpha-1
|
| 428 |
+
* @see https://eslint.org/docs/rules/prefer-rest-params
|
| 429 |
+
*/
|
| 430 |
+
"prefer-rest-params": Linter.RuleEntry<[]>;
|
| 431 |
+
|
| 432 |
+
/**
|
| 433 |
+
* Rule to require spread operators instead of `.apply()`.
|
| 434 |
+
*
|
| 435 |
+
* @since 1.0.0-rc-1
|
| 436 |
+
* @see https://eslint.org/docs/rules/prefer-spread
|
| 437 |
+
*/
|
| 438 |
+
"prefer-spread": Linter.RuleEntry<[]>;
|
| 439 |
+
|
| 440 |
+
/**
|
| 441 |
+
* Rule to require template literals instead of string concatenation.
|
| 442 |
+
*
|
| 443 |
+
* @since 1.2.0
|
| 444 |
+
* @see https://eslint.org/docs/rules/prefer-template
|
| 445 |
+
*/
|
| 446 |
+
"prefer-template": Linter.RuleEntry<[]>;
|
| 447 |
+
|
| 448 |
+
/**
|
| 449 |
+
* Rule to require generator functions to contain `yield`.
|
| 450 |
+
*
|
| 451 |
+
* @remarks
|
| 452 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 453 |
+
*
|
| 454 |
+
* @since 1.0.0-rc-1
|
| 455 |
+
* @see https://eslint.org/docs/rules/require-yield
|
| 456 |
+
*/
|
| 457 |
+
"require-yield": Linter.RuleEntry<[]>;
|
| 458 |
+
|
| 459 |
+
/**
|
| 460 |
+
* Rule to enforce spacing between rest and spread operators and their expressions.
|
| 461 |
+
*
|
| 462 |
+
* @since 2.12.0
|
| 463 |
+
* @see https://eslint.org/docs/rules/rest-spread-spacing
|
| 464 |
+
*/
|
| 465 |
+
"rest-spread-spacing": Linter.RuleEntry<["never" | "always"]>;
|
| 466 |
+
|
| 467 |
+
/**
|
| 468 |
+
* Rule to enforce sorted import declarations within modules.
|
| 469 |
+
*
|
| 470 |
+
* @since 2.0.0-beta.1
|
| 471 |
+
* @see https://eslint.org/docs/rules/sort-imports
|
| 472 |
+
*/
|
| 473 |
+
"sort-imports": Linter.RuleEntry<
|
| 474 |
+
[
|
| 475 |
+
Partial<{
|
| 476 |
+
/**
|
| 477 |
+
* @default false
|
| 478 |
+
*/
|
| 479 |
+
ignoreCase: boolean;
|
| 480 |
+
/**
|
| 481 |
+
* @default false
|
| 482 |
+
*/
|
| 483 |
+
ignoreDeclarationSort: boolean;
|
| 484 |
+
/**
|
| 485 |
+
* @default false
|
| 486 |
+
*/
|
| 487 |
+
ignoreMemberSort: boolean;
|
| 488 |
+
/**
|
| 489 |
+
* @default ['none', 'all', 'multiple', 'single']
|
| 490 |
+
*/
|
| 491 |
+
memberSyntaxSortOrder: Array<"none" | "all" | "multiple" | "single">;
|
| 492 |
+
/**
|
| 493 |
+
* @default false
|
| 494 |
+
*/
|
| 495 |
+
allowSeparatedGroups: boolean;
|
| 496 |
+
}>,
|
| 497 |
+
]
|
| 498 |
+
>;
|
| 499 |
+
|
| 500 |
+
/**
|
| 501 |
+
* Rule to require symbol descriptions.
|
| 502 |
+
*
|
| 503 |
+
* @since 3.4.0
|
| 504 |
+
* @see https://eslint.org/docs/rules/symbol-description
|
| 505 |
+
*/
|
| 506 |
+
"symbol-description": Linter.RuleEntry<[]>;
|
| 507 |
+
|
| 508 |
+
/**
|
| 509 |
+
* Rule to require or disallow spacing around embedded expressions of template strings.
|
| 510 |
+
*
|
| 511 |
+
* @since 2.0.0-rc.0
|
| 512 |
+
* @see https://eslint.org/docs/rules/template-curly-spacing
|
| 513 |
+
*/
|
| 514 |
+
"template-curly-spacing": Linter.RuleEntry<["never" | "always"]>;
|
| 515 |
+
|
| 516 |
+
/**
|
| 517 |
+
* Rule to require or disallow spacing around the `*` in `yield*` expressions.
|
| 518 |
+
*
|
| 519 |
+
* @since 2.0.0-alpha-1
|
| 520 |
+
* @see https://eslint.org/docs/rules/yield-star-spacing
|
| 521 |
+
*/
|
| 522 |
+
"yield-star-spacing": Linter.RuleEntry<
|
| 523 |
+
[
|
| 524 |
+
| Partial<{
|
| 525 |
+
before: boolean;
|
| 526 |
+
after: boolean;
|
| 527 |
+
}>
|
| 528 |
+
| "before"
|
| 529 |
+
| "after"
|
| 530 |
+
| "both"
|
| 531 |
+
| "neither",
|
| 532 |
+
]
|
| 533 |
+
>;
|
| 534 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Linter } from "../index";
|
| 2 |
+
|
| 3 |
+
import { BestPractices } from "./best-practices";
|
| 4 |
+
import { Deprecated } from "./deprecated";
|
| 5 |
+
import { ECMAScript6 } from "./ecmascript-6";
|
| 6 |
+
import { NodeJSAndCommonJS } from "./node-commonjs";
|
| 7 |
+
import { PossibleErrors } from "./possible-errors";
|
| 8 |
+
import { StrictMode } from "./strict-mode";
|
| 9 |
+
import { StylisticIssues } from "./stylistic-issues";
|
| 10 |
+
import { Variables } from "./variables";
|
| 11 |
+
|
| 12 |
+
export interface ESLintRules
|
| 13 |
+
extends
|
| 14 |
+
Linter.RulesRecord,
|
| 15 |
+
PossibleErrors,
|
| 16 |
+
BestPractices,
|
| 17 |
+
StrictMode,
|
| 18 |
+
Variables,
|
| 19 |
+
NodeJSAndCommonJS,
|
| 20 |
+
StylisticIssues,
|
| 21 |
+
ECMAScript6,
|
| 22 |
+
Deprecated
|
| 23 |
+
{}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/node-commonjs.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Linter } from "../index";
|
| 2 |
+
|
| 3 |
+
export interface NodeJSAndCommonJS extends Linter.RulesRecord {
|
| 4 |
+
/**
|
| 5 |
+
* Rule to require `return` statements after callbacks.
|
| 6 |
+
*
|
| 7 |
+
* @since 1.0.0-rc-1
|
| 8 |
+
* @see https://eslint.org/docs/rules/callback-return
|
| 9 |
+
*/
|
| 10 |
+
"callback-return": Linter.RuleEntry<[string[]]>;
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* Rule to require `require()` calls to be placed at top-level module scope.
|
| 14 |
+
*
|
| 15 |
+
* @since 1.4.0
|
| 16 |
+
* @see https://eslint.org/docs/rules/global-require
|
| 17 |
+
*/
|
| 18 |
+
"global-require": Linter.RuleEntry<[]>;
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Rule to require error handling in callbacks.
|
| 22 |
+
*
|
| 23 |
+
* @since 0.4.5
|
| 24 |
+
* @see https://eslint.org/docs/rules/handle-callback-err
|
| 25 |
+
*/
|
| 26 |
+
"handle-callback-err": Linter.RuleEntry<[string]>;
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* Rule to disallow use of the `Buffer()` constructor.
|
| 30 |
+
*
|
| 31 |
+
* @since 4.0.0-alpha.0
|
| 32 |
+
* @see https://eslint.org/docs/rules/no-buffer-constructor
|
| 33 |
+
*/
|
| 34 |
+
"no-buffer-constructor": Linter.RuleEntry<[]>;
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Rule to disallow `require` calls to be mixed with regular variable declarations.
|
| 38 |
+
*
|
| 39 |
+
* @since 0.0.9
|
| 40 |
+
* @see https://eslint.org/docs/rules/no-mixed-requires
|
| 41 |
+
*/
|
| 42 |
+
"no-mixed-requires": Linter.RuleEntry<
|
| 43 |
+
[
|
| 44 |
+
Partial<{
|
| 45 |
+
/**
|
| 46 |
+
* @default false
|
| 47 |
+
*/
|
| 48 |
+
grouping: boolean;
|
| 49 |
+
/**
|
| 50 |
+
* @default false
|
| 51 |
+
*/
|
| 52 |
+
allowCall: boolean;
|
| 53 |
+
}>,
|
| 54 |
+
]
|
| 55 |
+
>;
|
| 56 |
+
|
| 57 |
+
/**
|
| 58 |
+
* Rule to disallow `new` operators with calls to `require`.
|
| 59 |
+
*
|
| 60 |
+
* @since 0.6.0
|
| 61 |
+
* @see https://eslint.org/docs/rules/no-new-require
|
| 62 |
+
*/
|
| 63 |
+
"no-new-require": Linter.RuleEntry<[]>;
|
| 64 |
+
|
| 65 |
+
/**
|
| 66 |
+
* Rule to disallow string concatenation when using `__dirname` and `__filename`.
|
| 67 |
+
*
|
| 68 |
+
* @since 0.4.0
|
| 69 |
+
* @see https://eslint.org/docs/rules/no-path-concat
|
| 70 |
+
*/
|
| 71 |
+
"no-path-concat": Linter.RuleEntry<[]>;
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* Rule to disallow the use of `process.env`.
|
| 75 |
+
*
|
| 76 |
+
* @since 0.9.0
|
| 77 |
+
* @see https://eslint.org/docs/rules/no-process-env
|
| 78 |
+
*/
|
| 79 |
+
"no-process-env": Linter.RuleEntry<[]>;
|
| 80 |
+
|
| 81 |
+
/**
|
| 82 |
+
* Rule to disallow the use of `process.exit()`.
|
| 83 |
+
*
|
| 84 |
+
* @since 0.4.0
|
| 85 |
+
* @see https://eslint.org/docs/rules/no-process-exit
|
| 86 |
+
*/
|
| 87 |
+
"no-process-exit": Linter.RuleEntry<[]>;
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* Rule to disallow specified modules when loaded by `require`.
|
| 91 |
+
*
|
| 92 |
+
* @since 0.6.0
|
| 93 |
+
* @see https://eslint.org/docs/rules/no-restricted-modules
|
| 94 |
+
*/
|
| 95 |
+
"no-restricted-modules": Linter.RuleEntry<
|
| 96 |
+
[
|
| 97 |
+
...Array<
|
| 98 |
+
| string
|
| 99 |
+
| {
|
| 100 |
+
name: string;
|
| 101 |
+
message?: string | undefined;
|
| 102 |
+
}
|
| 103 |
+
| Partial<{
|
| 104 |
+
paths: Array<
|
| 105 |
+
| string
|
| 106 |
+
| {
|
| 107 |
+
name: string;
|
| 108 |
+
message?: string | undefined;
|
| 109 |
+
}
|
| 110 |
+
>;
|
| 111 |
+
patterns: string[];
|
| 112 |
+
}>
|
| 113 |
+
>,
|
| 114 |
+
]
|
| 115 |
+
>;
|
| 116 |
+
|
| 117 |
+
/**
|
| 118 |
+
* Rule to disallow synchronous methods.
|
| 119 |
+
*
|
| 120 |
+
* @since 0.0.9
|
| 121 |
+
* @see https://eslint.org/docs/rules/no-sync
|
| 122 |
+
*/
|
| 123 |
+
"no-sync": Linter.RuleEntry<
|
| 124 |
+
[
|
| 125 |
+
{
|
| 126 |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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Linter } from "../index";
|
| 2 |
+
|
| 3 |
+
export interface PossibleErrors extends Linter.RulesRecord {
|
| 4 |
+
/**
|
| 5 |
+
* Rule to enforce `for` loop update clause moving the counter in the right direction.
|
| 6 |
+
*
|
| 7 |
+
* @remarks
|
| 8 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 9 |
+
*
|
| 10 |
+
* @since 4.0.0-beta.0
|
| 11 |
+
* @see https://eslint.org/docs/rules/for-direction
|
| 12 |
+
*/
|
| 13 |
+
"for-direction": Linter.RuleEntry<[]>;
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* Rule to enforce `return` statements in getters.
|
| 17 |
+
*
|
| 18 |
+
* @remarks
|
| 19 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 20 |
+
*
|
| 21 |
+
* @since 4.2.0
|
| 22 |
+
* @see https://eslint.org/docs/rules/getter-return
|
| 23 |
+
*/
|
| 24 |
+
"getter-return": Linter.RuleEntry<
|
| 25 |
+
[
|
| 26 |
+
Partial<{
|
| 27 |
+
/**
|
| 28 |
+
* @default false
|
| 29 |
+
*/
|
| 30 |
+
allowImplicit: boolean;
|
| 31 |
+
}>,
|
| 32 |
+
]
|
| 33 |
+
>;
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* Rule to disallow using an async function as a `Promise` executor.
|
| 37 |
+
*
|
| 38 |
+
* @remarks
|
| 39 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 40 |
+
*
|
| 41 |
+
* @since 5.3.0
|
| 42 |
+
* @see https://eslint.org/docs/rules/no-async-promise-executor
|
| 43 |
+
*/
|
| 44 |
+
"no-async-promise-executor": Linter.RuleEntry<[]>;
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Rule to disallow `await` inside of loops.
|
| 48 |
+
*
|
| 49 |
+
* @since 3.12.0
|
| 50 |
+
* @see https://eslint.org/docs/rules/no-await-in-loop
|
| 51 |
+
*/
|
| 52 |
+
"no-await-in-loop": Linter.RuleEntry<[]>;
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* Rule to disallow comparing against `-0`.
|
| 56 |
+
*
|
| 57 |
+
* @remarks
|
| 58 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 59 |
+
*
|
| 60 |
+
* @since 3.17.0
|
| 61 |
+
* @see https://eslint.org/docs/rules/no-compare-neg-zero
|
| 62 |
+
*/
|
| 63 |
+
"no-compare-neg-zero": Linter.RuleEntry<[]>;
|
| 64 |
+
|
| 65 |
+
/**
|
| 66 |
+
* Rule to disallow assignment operators in conditional statements.
|
| 67 |
+
*
|
| 68 |
+
* @remarks
|
| 69 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 70 |
+
*
|
| 71 |
+
* @since 0.0.9
|
| 72 |
+
* @see https://eslint.org/docs/rules/no-cond-assign
|
| 73 |
+
*/
|
| 74 |
+
"no-cond-assign": Linter.RuleEntry<["except-parens" | "always"]>;
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* Rule to disallow the use of `console`.
|
| 78 |
+
*
|
| 79 |
+
* @since 0.0.2
|
| 80 |
+
* @see https://eslint.org/docs/rules/no-console
|
| 81 |
+
*/
|
| 82 |
+
"no-console": Linter.RuleEntry<
|
| 83 |
+
[
|
| 84 |
+
Partial<{
|
| 85 |
+
allow: Array<keyof Console>;
|
| 86 |
+
}>,
|
| 87 |
+
]
|
| 88 |
+
>;
|
| 89 |
+
|
| 90 |
+
/**
|
| 91 |
+
* Rule to disallow constant expressions in conditions.
|
| 92 |
+
*
|
| 93 |
+
* @remarks
|
| 94 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 95 |
+
*
|
| 96 |
+
* @since 0.4.1
|
| 97 |
+
* @see https://eslint.org/docs/rules/no-constant-condition
|
| 98 |
+
*/
|
| 99 |
+
"no-constant-condition": Linter.RuleEntry<
|
| 100 |
+
[
|
| 101 |
+
{
|
| 102 |
+
/**
|
| 103 |
+
* @default true
|
| 104 |
+
*/
|
| 105 |
+
checkLoops: boolean;
|
| 106 |
+
},
|
| 107 |
+
]
|
| 108 |
+
>;
|
| 109 |
+
|
| 110 |
+
/**
|
| 111 |
+
* Rule to disallow control characters in regular expressions.
|
| 112 |
+
*
|
| 113 |
+
* @remarks
|
| 114 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 115 |
+
*
|
| 116 |
+
* @since 0.1.0
|
| 117 |
+
* @see https://eslint.org/docs/rules/no-control-regex
|
| 118 |
+
*/
|
| 119 |
+
"no-control-regex": Linter.RuleEntry<[]>;
|
| 120 |
+
|
| 121 |
+
/**
|
| 122 |
+
* Rule to disallow the use of `debugger`.
|
| 123 |
+
*
|
| 124 |
+
* @remarks
|
| 125 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 126 |
+
*
|
| 127 |
+
* @since 0.0.2
|
| 128 |
+
* @see https://eslint.org/docs/rules/no-debugger
|
| 129 |
+
*/
|
| 130 |
+
"no-debugger": Linter.RuleEntry<[]>;
|
| 131 |
+
|
| 132 |
+
/**
|
| 133 |
+
* Rule to disallow duplicate arguments in `function` definitions.
|
| 134 |
+
*
|
| 135 |
+
* @remarks
|
| 136 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 137 |
+
*
|
| 138 |
+
* @since 0.16.0
|
| 139 |
+
* @see https://eslint.org/docs/rules/no-dupe-args
|
| 140 |
+
*/
|
| 141 |
+
"no-dupe-args": Linter.RuleEntry<[]>;
|
| 142 |
+
|
| 143 |
+
/**
|
| 144 |
+
* Disallow duplicate conditions in if-else-if chains.
|
| 145 |
+
*
|
| 146 |
+
* @remarks
|
| 147 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 148 |
+
*
|
| 149 |
+
* @since 6.7.0
|
| 150 |
+
* @see https://eslint.org/docs/rules/no-dupe-else-if
|
| 151 |
+
*/
|
| 152 |
+
"no-dupe-else-if": Linter.RuleEntry<[]>;
|
| 153 |
+
|
| 154 |
+
/**
|
| 155 |
+
* Rule to disallow duplicate keys in object literals.
|
| 156 |
+
*
|
| 157 |
+
* @remarks
|
| 158 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 159 |
+
*
|
| 160 |
+
* @since 0.0.9
|
| 161 |
+
* @see https://eslint.org/docs/rules/no-dupe-keys
|
| 162 |
+
*/
|
| 163 |
+
"no-dupe-keys": Linter.RuleEntry<[]>;
|
| 164 |
+
|
| 165 |
+
/**
|
| 166 |
+
* Rule to disallow a duplicate case label.
|
| 167 |
+
*
|
| 168 |
+
* @remarks
|
| 169 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 170 |
+
*
|
| 171 |
+
* @since 0.17.0
|
| 172 |
+
* @see https://eslint.org/docs/rules/no-duplicate-case
|
| 173 |
+
*/
|
| 174 |
+
"no-duplicate-case": Linter.RuleEntry<[]>;
|
| 175 |
+
|
| 176 |
+
/**
|
| 177 |
+
* Rule to disallow empty block statements.
|
| 178 |
+
*
|
| 179 |
+
* @remarks
|
| 180 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 181 |
+
*
|
| 182 |
+
* @since 0.0.2
|
| 183 |
+
* @see https://eslint.org/docs/rules/no-empty
|
| 184 |
+
*/
|
| 185 |
+
"no-empty": Linter.RuleEntry<
|
| 186 |
+
[
|
| 187 |
+
Partial<{
|
| 188 |
+
/**
|
| 189 |
+
* @default false
|
| 190 |
+
*/
|
| 191 |
+
allowEmptyCatch: boolean;
|
| 192 |
+
}>,
|
| 193 |
+
]
|
| 194 |
+
>;
|
| 195 |
+
|
| 196 |
+
/**
|
| 197 |
+
* Rule to disallow empty character classes in regular expressions.
|
| 198 |
+
*
|
| 199 |
+
* @remarks
|
| 200 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 201 |
+
*
|
| 202 |
+
* @since 0.22.0
|
| 203 |
+
* @see https://eslint.org/docs/rules/no-empty-character-class
|
| 204 |
+
*/
|
| 205 |
+
"no-empty-character-class": Linter.RuleEntry<[]>;
|
| 206 |
+
|
| 207 |
+
/**
|
| 208 |
+
* Rule to disallow reassigning exceptions in `catch` clauses.
|
| 209 |
+
*
|
| 210 |
+
* @remarks
|
| 211 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 212 |
+
*
|
| 213 |
+
* @since 0.0.9
|
| 214 |
+
* @see https://eslint.org/docs/rules/no-ex-assign
|
| 215 |
+
*/
|
| 216 |
+
"no-ex-assign": Linter.RuleEntry<[]>;
|
| 217 |
+
|
| 218 |
+
/**
|
| 219 |
+
* Rule to disallow unnecessary boolean casts.
|
| 220 |
+
*
|
| 221 |
+
* @remarks
|
| 222 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 223 |
+
*
|
| 224 |
+
* @since 0.4.0
|
| 225 |
+
* @see https://eslint.org/docs/rules/no-extra-boolean-cast
|
| 226 |
+
*/
|
| 227 |
+
"no-extra-boolean-cast": Linter.RuleEntry<[]>;
|
| 228 |
+
|
| 229 |
+
/**
|
| 230 |
+
* Rule to disallow unnecessary parentheses.
|
| 231 |
+
*
|
| 232 |
+
* @since 0.1.4
|
| 233 |
+
* @see https://eslint.org/docs/rules/no-extra-parens
|
| 234 |
+
*/
|
| 235 |
+
"no-extra-parens":
|
| 236 |
+
| Linter.RuleEntry<
|
| 237 |
+
[
|
| 238 |
+
"all",
|
| 239 |
+
Partial<{
|
| 240 |
+
/**
|
| 241 |
+
* @default true,
|
| 242 |
+
*/
|
| 243 |
+
conditionalAssign: boolean;
|
| 244 |
+
/**
|
| 245 |
+
* @default true
|
| 246 |
+
*/
|
| 247 |
+
returnAssign: boolean;
|
| 248 |
+
/**
|
| 249 |
+
* @default true
|
| 250 |
+
*/
|
| 251 |
+
nestedBinaryExpressions: boolean;
|
| 252 |
+
/**
|
| 253 |
+
* @default 'none'
|
| 254 |
+
*/
|
| 255 |
+
ignoreJSX: "none" | "all" | "multi-line" | "single-line";
|
| 256 |
+
/**
|
| 257 |
+
* @default true
|
| 258 |
+
*/
|
| 259 |
+
enforceForArrowConditionals: boolean;
|
| 260 |
+
}>,
|
| 261 |
+
]
|
| 262 |
+
>
|
| 263 |
+
| Linter.RuleEntry<["functions"]>;
|
| 264 |
+
|
| 265 |
+
/**
|
| 266 |
+
* Rule to disallow unnecessary semicolons.
|
| 267 |
+
*
|
| 268 |
+
* @remarks
|
| 269 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 270 |
+
*
|
| 271 |
+
* @since 0.0.9
|
| 272 |
+
* @see https://eslint.org/docs/rules/no-extra-semi
|
| 273 |
+
*/
|
| 274 |
+
"no-extra-semi": Linter.RuleEntry<[]>;
|
| 275 |
+
|
| 276 |
+
/**
|
| 277 |
+
* Rule to disallow reassigning `function` declarations.
|
| 278 |
+
*
|
| 279 |
+
* @remarks
|
| 280 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 281 |
+
*
|
| 282 |
+
* @since 0.0.9
|
| 283 |
+
* @see https://eslint.org/docs/rules/no-func-assign
|
| 284 |
+
*/
|
| 285 |
+
"no-func-assign": Linter.RuleEntry<[]>;
|
| 286 |
+
|
| 287 |
+
/**
|
| 288 |
+
* Rule to disallow variable or `function` declarations in nested blocks.
|
| 289 |
+
*
|
| 290 |
+
* @remarks
|
| 291 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 292 |
+
*
|
| 293 |
+
* @since 0.6.0
|
| 294 |
+
* @see https://eslint.org/docs/rules/no-inner-declarations
|
| 295 |
+
*/
|
| 296 |
+
"no-inner-declarations": Linter.RuleEntry<["functions" | "both"]>;
|
| 297 |
+
|
| 298 |
+
/**
|
| 299 |
+
* Rule to disallow invalid regular expression strings in `RegExp` constructors.
|
| 300 |
+
*
|
| 301 |
+
* @remarks
|
| 302 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 303 |
+
*
|
| 304 |
+
* @since 0.1.4
|
| 305 |
+
* @see https://eslint.org/docs/rules/no-invalid-regexp
|
| 306 |
+
*/
|
| 307 |
+
"no-invalid-regexp": Linter.RuleEntry<
|
| 308 |
+
[
|
| 309 |
+
Partial<{
|
| 310 |
+
allowConstructorFlags: string[];
|
| 311 |
+
}>,
|
| 312 |
+
]
|
| 313 |
+
>;
|
| 314 |
+
|
| 315 |
+
/**
|
| 316 |
+
* Rule to disallow irregular whitespace.
|
| 317 |
+
*
|
| 318 |
+
* @remarks
|
| 319 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 320 |
+
*
|
| 321 |
+
* @since 0.9.0
|
| 322 |
+
* @see https://eslint.org/docs/rules/no-irregular-whitespace
|
| 323 |
+
*/
|
| 324 |
+
"no-irregular-whitespace": Linter.RuleEntry<
|
| 325 |
+
[
|
| 326 |
+
Partial<{
|
| 327 |
+
/**
|
| 328 |
+
* @default true
|
| 329 |
+
*/
|
| 330 |
+
skipStrings: boolean;
|
| 331 |
+
/**
|
| 332 |
+
* @default false
|
| 333 |
+
*/
|
| 334 |
+
skipComments: boolean;
|
| 335 |
+
/**
|
| 336 |
+
* @default false
|
| 337 |
+
*/
|
| 338 |
+
skipRegExps: boolean;
|
| 339 |
+
/**
|
| 340 |
+
* @default false
|
| 341 |
+
*/
|
| 342 |
+
skipTemplates: boolean;
|
| 343 |
+
}>,
|
| 344 |
+
]
|
| 345 |
+
>;
|
| 346 |
+
|
| 347 |
+
/**
|
| 348 |
+
* Disallow literal numbers that lose precision.
|
| 349 |
+
*
|
| 350 |
+
* @remarks
|
| 351 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 352 |
+
*
|
| 353 |
+
* @since 7.1.0
|
| 354 |
+
* @see https://eslint.org/docs/latest/rules/no-loss-of-precision
|
| 355 |
+
*/
|
| 356 |
+
"no-loss-of-precision": Linter.RuleEntry<[]>;
|
| 357 |
+
|
| 358 |
+
/**
|
| 359 |
+
* Rule to disallow characters which are made with multiple code points in character class syntax.
|
| 360 |
+
*
|
| 361 |
+
* @remarks
|
| 362 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 363 |
+
*
|
| 364 |
+
* @since 5.3.0
|
| 365 |
+
* @see https://eslint.org/docs/rules/no-misleading-character-class
|
| 366 |
+
*/
|
| 367 |
+
"no-misleading-character-class": Linter.RuleEntry<[]>;
|
| 368 |
+
|
| 369 |
+
/**
|
| 370 |
+
* Rule to disallow calling global object properties as functions.
|
| 371 |
+
*
|
| 372 |
+
* @remarks
|
| 373 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 374 |
+
*
|
| 375 |
+
* @since 0.0.9
|
| 376 |
+
* @see https://eslint.org/docs/rules/no-obj-calls
|
| 377 |
+
*/
|
| 378 |
+
"no-obj-calls": Linter.RuleEntry<[]>;
|
| 379 |
+
|
| 380 |
+
/**
|
| 381 |
+
* Rule to disallow returning values from Promise executor functions.
|
| 382 |
+
*
|
| 383 |
+
* @since 7.3.0
|
| 384 |
+
* @see https://eslint.org/docs/rules/no-promise-executor-return
|
| 385 |
+
*/
|
| 386 |
+
"no-promise-executor-return": Linter.RuleEntry<[
|
| 387 |
+
{
|
| 388 |
+
/**
|
| 389 |
+
* @default false
|
| 390 |
+
*/
|
| 391 |
+
allowVoid?: boolean;
|
| 392 |
+
},
|
| 393 |
+
]>;
|
| 394 |
+
|
| 395 |
+
/**
|
| 396 |
+
* Rule to disallow use of `Object.prototypes` builtins directly.
|
| 397 |
+
*
|
| 398 |
+
* @remarks
|
| 399 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 400 |
+
*
|
| 401 |
+
* @since 2.11.0
|
| 402 |
+
* @see https://eslint.org/docs/rules/no-prototype-builtins
|
| 403 |
+
*/
|
| 404 |
+
"no-prototype-builtins": Linter.RuleEntry<[]>;
|
| 405 |
+
|
| 406 |
+
/**
|
| 407 |
+
* Rule to disallow multiple spaces in regular expressions.
|
| 408 |
+
*
|
| 409 |
+
* @remarks
|
| 410 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 411 |
+
*
|
| 412 |
+
* @since 0.4.0
|
| 413 |
+
* @see https://eslint.org/docs/rules/no-regex-spaces
|
| 414 |
+
*/
|
| 415 |
+
"no-regex-spaces": Linter.RuleEntry<[]>;
|
| 416 |
+
|
| 417 |
+
/**
|
| 418 |
+
* Rule to disallow sparse arrays.
|
| 419 |
+
*
|
| 420 |
+
* @remarks
|
| 421 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 422 |
+
*
|
| 423 |
+
* @since 0.4.0
|
| 424 |
+
* @see https://eslint.org/docs/rules/no-sparse-arrays
|
| 425 |
+
*/
|
| 426 |
+
"no-sparse-arrays": Linter.RuleEntry<[]>;
|
| 427 |
+
|
| 428 |
+
/**
|
| 429 |
+
* Rule to disallow template literal placeholder syntax in regular strings.
|
| 430 |
+
*
|
| 431 |
+
* @since 3.3.0
|
| 432 |
+
* @see https://eslint.org/docs/rules/no-template-curly-in-string
|
| 433 |
+
*/
|
| 434 |
+
"no-template-curly-in-string": Linter.RuleEntry<[]>;
|
| 435 |
+
|
| 436 |
+
/**
|
| 437 |
+
* Rule to disallow confusing multiline expressions.
|
| 438 |
+
*
|
| 439 |
+
* @remarks
|
| 440 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 441 |
+
*
|
| 442 |
+
* @since 0.24.0
|
| 443 |
+
* @see https://eslint.org/docs/rules/no-unexpected-multiline
|
| 444 |
+
*/
|
| 445 |
+
"no-unexpected-multiline": Linter.RuleEntry<[]>;
|
| 446 |
+
|
| 447 |
+
/**
|
| 448 |
+
* Rule to disallow unreachable code after `return`, `throw`, `continue`, and `break` statements.
|
| 449 |
+
*
|
| 450 |
+
* @remarks
|
| 451 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 452 |
+
*
|
| 453 |
+
* @since 0.0.6
|
| 454 |
+
* @see https://eslint.org/docs/rules/no-unreachable
|
| 455 |
+
*/
|
| 456 |
+
"no-unreachable": Linter.RuleEntry<[]>;
|
| 457 |
+
|
| 458 |
+
/**
|
| 459 |
+
* Disallow loops with a body that allows only one iteration.
|
| 460 |
+
*
|
| 461 |
+
* @since 7.3.0
|
| 462 |
+
* @see https://eslint.org/docs/latest/rules/no-unreachable-loop
|
| 463 |
+
*/
|
| 464 |
+
"no-unreachable-loop": Linter.RuleEntry<
|
| 465 |
+
[
|
| 466 |
+
Partial<{
|
| 467 |
+
/**
|
| 468 |
+
* @default []
|
| 469 |
+
*/
|
| 470 |
+
ignore: "WhileStatement" | "DoWhileStatement" | "ForStatement" | "ForInStatement" | "ForOfStatement";
|
| 471 |
+
}>,
|
| 472 |
+
]
|
| 473 |
+
>;
|
| 474 |
+
|
| 475 |
+
/**
|
| 476 |
+
* Rule to disallow control flow statements in `finally` blocks.
|
| 477 |
+
*
|
| 478 |
+
* @remarks
|
| 479 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 480 |
+
*
|
| 481 |
+
* @since 2.9.0
|
| 482 |
+
* @see https://eslint.org/docs/rules/no-unsafe-finally
|
| 483 |
+
*/
|
| 484 |
+
"no-unsafe-finally": Linter.RuleEntry<[]>;
|
| 485 |
+
|
| 486 |
+
/**
|
| 487 |
+
* Rule to disallow negating the left operand of relational operators.
|
| 488 |
+
*
|
| 489 |
+
* @remarks
|
| 490 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 491 |
+
*
|
| 492 |
+
* @since 3.3.0
|
| 493 |
+
* @see https://eslint.org/docs/rules/no-unsafe-negation
|
| 494 |
+
*/
|
| 495 |
+
"no-unsafe-negation": Linter.RuleEntry<[]>;
|
| 496 |
+
|
| 497 |
+
/**
|
| 498 |
+
* Disallow use of optional chaining in contexts where the `undefined` value is not allowed.
|
| 499 |
+
*
|
| 500 |
+
* @remarks
|
| 501 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 502 |
+
*
|
| 503 |
+
* @since 7.15.0
|
| 504 |
+
* @see https://eslint.org/docs/rules/no-unsafe-optional-chaining
|
| 505 |
+
*/
|
| 506 |
+
"no-unsafe-optional-chaining": Linter.RuleEntry<
|
| 507 |
+
[
|
| 508 |
+
Partial<{
|
| 509 |
+
/**
|
| 510 |
+
* @default false
|
| 511 |
+
*/
|
| 512 |
+
disallowArithmeticOperators: boolean;
|
| 513 |
+
}>,
|
| 514 |
+
]
|
| 515 |
+
>;
|
| 516 |
+
|
| 517 |
+
/**
|
| 518 |
+
* Rule to disallow assignments that can lead to race conditions due to usage of `await` or `yield`.
|
| 519 |
+
*
|
| 520 |
+
* @remarks
|
| 521 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 522 |
+
*
|
| 523 |
+
* @since 5.3.0
|
| 524 |
+
* @see https://eslint.org/docs/rules/require-atomic-updates
|
| 525 |
+
*/
|
| 526 |
+
"require-atomic-updates": Linter.RuleEntry<[]>;
|
| 527 |
+
|
| 528 |
+
/**
|
| 529 |
+
* Rule to require calls to `isNaN()` when checking for `NaN`.
|
| 530 |
+
*
|
| 531 |
+
* @remarks
|
| 532 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 533 |
+
*
|
| 534 |
+
* @since 0.0.6
|
| 535 |
+
* @see https://eslint.org/docs/rules/use-isnan
|
| 536 |
+
*/
|
| 537 |
+
"use-isnan": Linter.RuleEntry<
|
| 538 |
+
[
|
| 539 |
+
Partial<{
|
| 540 |
+
/**
|
| 541 |
+
* @default true
|
| 542 |
+
*/
|
| 543 |
+
enforceForSwitchCase: boolean;
|
| 544 |
+
/**
|
| 545 |
+
* @default true
|
| 546 |
+
*/
|
| 547 |
+
enforceForIndexOf: boolean;
|
| 548 |
+
}>,
|
| 549 |
+
]
|
| 550 |
+
>;
|
| 551 |
+
|
| 552 |
+
/**
|
| 553 |
+
* Rule to enforce comparing `typeof` expressions against valid strings.
|
| 554 |
+
*
|
| 555 |
+
* @remarks
|
| 556 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 557 |
+
*
|
| 558 |
+
* @since 0.5.0
|
| 559 |
+
* @see https://eslint.org/docs/rules/valid-typeof
|
| 560 |
+
*/
|
| 561 |
+
"valid-typeof": Linter.RuleEntry<
|
| 562 |
+
[
|
| 563 |
+
Partial<{
|
| 564 |
+
/**
|
| 565 |
+
* @default false
|
| 566 |
+
*/
|
| 567 |
+
requireStringLiterals: boolean;
|
| 568 |
+
}>,
|
| 569 |
+
]
|
| 570 |
+
>;
|
| 571 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/strict-mode.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Linter } from "../index";
|
| 2 |
+
|
| 3 |
+
export interface StrictMode extends Linter.RulesRecord {
|
| 4 |
+
/**
|
| 5 |
+
* Rule to require or disallow strict mode directives.
|
| 6 |
+
*
|
| 7 |
+
* @since 0.1.0
|
| 8 |
+
* @see https://eslint.org/docs/rules/strict
|
| 9 |
+
*/
|
| 10 |
+
strict: Linter.RuleEntry<["safe" | "global" | "function" | "never"]>;
|
| 11 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/stylistic-issues.d.ts
ADDED
|
@@ -0,0 +1,1905 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Linter } from "../index";
|
| 2 |
+
|
| 3 |
+
export interface StylisticIssues extends Linter.RulesRecord {
|
| 4 |
+
/**
|
| 5 |
+
* Rule to enforce linebreaks after opening and before closing array brackets.
|
| 6 |
+
*
|
| 7 |
+
* @since 4.0.0-alpha.1
|
| 8 |
+
* @see https://eslint.org/docs/rules/array-bracket-newline
|
| 9 |
+
*/
|
| 10 |
+
"array-bracket-newline": Linter.RuleEntry<
|
| 11 |
+
[
|
| 12 |
+
| "always"
|
| 13 |
+
| "never"
|
| 14 |
+
| "consistent"
|
| 15 |
+
| Partial<{
|
| 16 |
+
/**
|
| 17 |
+
* @default true
|
| 18 |
+
*/
|
| 19 |
+
multiline: boolean;
|
| 20 |
+
/**
|
| 21 |
+
* @default null
|
| 22 |
+
*/
|
| 23 |
+
minItems: number | null;
|
| 24 |
+
}>,
|
| 25 |
+
]
|
| 26 |
+
>;
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* Rule to enforce consistent spacing inside array brackets.
|
| 30 |
+
*
|
| 31 |
+
* @since 0.24.0
|
| 32 |
+
* @see https://eslint.org/docs/rules/array-bracket-spacing
|
| 33 |
+
*/
|
| 34 |
+
"array-bracket-spacing":
|
| 35 |
+
| Linter.RuleEntry<
|
| 36 |
+
[
|
| 37 |
+
"never",
|
| 38 |
+
Partial<{
|
| 39 |
+
/**
|
| 40 |
+
* @default false
|
| 41 |
+
*/
|
| 42 |
+
singleValue: boolean;
|
| 43 |
+
/**
|
| 44 |
+
* @default false
|
| 45 |
+
*/
|
| 46 |
+
objectsInArrays: boolean;
|
| 47 |
+
/**
|
| 48 |
+
* @default false
|
| 49 |
+
*/
|
| 50 |
+
arraysInArrays: boolean;
|
| 51 |
+
}>,
|
| 52 |
+
]
|
| 53 |
+
>
|
| 54 |
+
| Linter.RuleEntry<
|
| 55 |
+
[
|
| 56 |
+
"always",
|
| 57 |
+
Partial<{
|
| 58 |
+
/**
|
| 59 |
+
* @default true
|
| 60 |
+
*/
|
| 61 |
+
singleValue: boolean;
|
| 62 |
+
/**
|
| 63 |
+
* @default true
|
| 64 |
+
*/
|
| 65 |
+
objectsInArrays: boolean;
|
| 66 |
+
/**
|
| 67 |
+
* @default true
|
| 68 |
+
*/
|
| 69 |
+
arraysInArrays: boolean;
|
| 70 |
+
}>,
|
| 71 |
+
]
|
| 72 |
+
>;
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* Rule to enforce line breaks after each array element.
|
| 76 |
+
*
|
| 77 |
+
* @since 4.0.0-rc.0
|
| 78 |
+
* @see https://eslint.org/docs/rules/array-element-newline
|
| 79 |
+
*/
|
| 80 |
+
"array-element-newline": Linter.RuleEntry<
|
| 81 |
+
[
|
| 82 |
+
| "always"
|
| 83 |
+
| "never"
|
| 84 |
+
| "consistent"
|
| 85 |
+
| Partial<{
|
| 86 |
+
/**
|
| 87 |
+
* @default true
|
| 88 |
+
*/
|
| 89 |
+
multiline: boolean;
|
| 90 |
+
/**
|
| 91 |
+
* @default null
|
| 92 |
+
*/
|
| 93 |
+
minItems: number | null;
|
| 94 |
+
}>,
|
| 95 |
+
]
|
| 96 |
+
>;
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* Rule to disallow or enforce spaces inside of blocks after opening block and before closing block.
|
| 100 |
+
*
|
| 101 |
+
* @since 1.2.0
|
| 102 |
+
* @see https://eslint.org/docs/rules/block-spacing
|
| 103 |
+
*/
|
| 104 |
+
"block-spacing": Linter.RuleEntry<["always" | "never"]>;
|
| 105 |
+
|
| 106 |
+
/**
|
| 107 |
+
* Rule to enforce consistent brace style for blocks.
|
| 108 |
+
*
|
| 109 |
+
* @since 0.0.7
|
| 110 |
+
* @see https://eslint.org/docs/rules/brace-style
|
| 111 |
+
*/
|
| 112 |
+
"brace-style": Linter.RuleEntry<
|
| 113 |
+
[
|
| 114 |
+
"1tbs" | "stroustrup" | "allman",
|
| 115 |
+
Partial<{
|
| 116 |
+
/**
|
| 117 |
+
* @default false
|
| 118 |
+
*/
|
| 119 |
+
allowSingleLine: boolean;
|
| 120 |
+
}>,
|
| 121 |
+
]
|
| 122 |
+
>;
|
| 123 |
+
|
| 124 |
+
/**
|
| 125 |
+
* Rule to enforce camelcase naming convention.
|
| 126 |
+
*
|
| 127 |
+
* @since 0.0.2
|
| 128 |
+
* @see https://eslint.org/docs/rules/camelcase
|
| 129 |
+
*/
|
| 130 |
+
camelcase: Linter.RuleEntry<
|
| 131 |
+
[
|
| 132 |
+
Partial<{
|
| 133 |
+
/**
|
| 134 |
+
* @default 'always'
|
| 135 |
+
*/
|
| 136 |
+
properties: "always" | "never";
|
| 137 |
+
/**
|
| 138 |
+
* @default false
|
| 139 |
+
*/
|
| 140 |
+
ignoreDestructuring: boolean;
|
| 141 |
+
/**
|
| 142 |
+
* @remarks
|
| 143 |
+
* Also accept for regular expression patterns
|
| 144 |
+
*/
|
| 145 |
+
allow: string[];
|
| 146 |
+
}>,
|
| 147 |
+
]
|
| 148 |
+
>;
|
| 149 |
+
|
| 150 |
+
/**
|
| 151 |
+
* Rule to enforce or disallow capitalization of the first letter of a comment.
|
| 152 |
+
*
|
| 153 |
+
* @since 3.11.0
|
| 154 |
+
* @see https://eslint.org/docs/rules/capitalized-comments
|
| 155 |
+
*/
|
| 156 |
+
"capitalized-comments": Linter.RuleEntry<
|
| 157 |
+
[
|
| 158 |
+
"always" | "never",
|
| 159 |
+
Partial<{
|
| 160 |
+
ignorePattern: string;
|
| 161 |
+
/**
|
| 162 |
+
* @default false
|
| 163 |
+
*/
|
| 164 |
+
ignoreInlineComments: boolean;
|
| 165 |
+
/**
|
| 166 |
+
* @default false
|
| 167 |
+
*/
|
| 168 |
+
ignoreConsecutiveComments: boolean;
|
| 169 |
+
}>,
|
| 170 |
+
]
|
| 171 |
+
>;
|
| 172 |
+
|
| 173 |
+
/**
|
| 174 |
+
* Rule to require or disallow trailing commas.
|
| 175 |
+
*
|
| 176 |
+
* @since 0.16.0
|
| 177 |
+
* @see https://eslint.org/docs/rules/comma-dangle
|
| 178 |
+
*/
|
| 179 |
+
"comma-dangle": Linter.RuleEntry<
|
| 180 |
+
[
|
| 181 |
+
| "never"
|
| 182 |
+
| "always"
|
| 183 |
+
| "always-multiline"
|
| 184 |
+
| "only-multiline"
|
| 185 |
+
| Partial<{
|
| 186 |
+
/**
|
| 187 |
+
* @default 'never'
|
| 188 |
+
*/
|
| 189 |
+
arrays: "never" | "always" | "always-multiline" | "only-multiline";
|
| 190 |
+
/**
|
| 191 |
+
* @default 'never'
|
| 192 |
+
*/
|
| 193 |
+
objects: "never" | "always" | "always-multiline" | "only-multiline";
|
| 194 |
+
/**
|
| 195 |
+
* @default 'never'
|
| 196 |
+
*/
|
| 197 |
+
imports: "never" | "always" | "always-multiline" | "only-multiline";
|
| 198 |
+
/**
|
| 199 |
+
* @default 'never'
|
| 200 |
+
*/
|
| 201 |
+
exports: "never" | "always" | "always-multiline" | "only-multiline";
|
| 202 |
+
/**
|
| 203 |
+
* @default 'never'
|
| 204 |
+
*/
|
| 205 |
+
functions: "never" | "always" | "always-multiline" | "only-multiline";
|
| 206 |
+
}>,
|
| 207 |
+
]
|
| 208 |
+
>;
|
| 209 |
+
|
| 210 |
+
/**
|
| 211 |
+
* Rule to enforce consistent spacing before and after commas.
|
| 212 |
+
*
|
| 213 |
+
* @since 0.9.0
|
| 214 |
+
* @see https://eslint.org/docs/rules/comma-spacing
|
| 215 |
+
*/
|
| 216 |
+
"comma-spacing": Linter.RuleEntry<
|
| 217 |
+
[
|
| 218 |
+
Partial<{
|
| 219 |
+
/**
|
| 220 |
+
* @default false
|
| 221 |
+
*/
|
| 222 |
+
before: boolean;
|
| 223 |
+
/**
|
| 224 |
+
* @default true
|
| 225 |
+
*/
|
| 226 |
+
after: boolean;
|
| 227 |
+
}>,
|
| 228 |
+
]
|
| 229 |
+
>;
|
| 230 |
+
|
| 231 |
+
/**
|
| 232 |
+
* Rule to enforce consistent comma style.
|
| 233 |
+
*
|
| 234 |
+
* @since 0.9.0
|
| 235 |
+
* @see https://eslint.org/docs/rules/comma-style
|
| 236 |
+
*/
|
| 237 |
+
"comma-style": Linter.RuleEntry<
|
| 238 |
+
[
|
| 239 |
+
"last" | "first",
|
| 240 |
+
Partial<{
|
| 241 |
+
exceptions: Record<string, boolean>;
|
| 242 |
+
}>,
|
| 243 |
+
]
|
| 244 |
+
>;
|
| 245 |
+
|
| 246 |
+
/**
|
| 247 |
+
* Rule to enforce consistent spacing inside computed property brackets.
|
| 248 |
+
*
|
| 249 |
+
* @since 0.23.0
|
| 250 |
+
* @see https://eslint.org/docs/rules/computed-property-spacing
|
| 251 |
+
*/
|
| 252 |
+
"computed-property-spacing": Linter.RuleEntry<["never" | "always"]>;
|
| 253 |
+
|
| 254 |
+
/**
|
| 255 |
+
* Rule to enforce consistent naming when capturing the current execution context.
|
| 256 |
+
*
|
| 257 |
+
* @since 0.0.9
|
| 258 |
+
* @see https://eslint.org/docs/rules/consistent-this
|
| 259 |
+
*/
|
| 260 |
+
"consistent-this": Linter.RuleEntry<[...string[]]>;
|
| 261 |
+
|
| 262 |
+
/**
|
| 263 |
+
* Rule to require or disallow newline at the end of files.
|
| 264 |
+
*
|
| 265 |
+
* @since 0.7.1
|
| 266 |
+
* @see https://eslint.org/docs/rules/eol-last
|
| 267 |
+
*/
|
| 268 |
+
"eol-last": Linter.RuleEntry<
|
| 269 |
+
[
|
| 270 |
+
"always" | "never", // | 'unix' | 'windows'
|
| 271 |
+
]
|
| 272 |
+
>;
|
| 273 |
+
|
| 274 |
+
/**
|
| 275 |
+
* Rule to require or disallow spacing between function identifiers and their invocations.
|
| 276 |
+
*
|
| 277 |
+
* @since 3.3.0
|
| 278 |
+
* @see https://eslint.org/docs/rules/func-call-spacing
|
| 279 |
+
*/
|
| 280 |
+
"func-call-spacing": Linter.RuleEntry<["never" | "always"]>;
|
| 281 |
+
|
| 282 |
+
/**
|
| 283 |
+
* Rule to require function names to match the name of the variable or property to which they are assigned.
|
| 284 |
+
*
|
| 285 |
+
* @since 3.8.0
|
| 286 |
+
* @see https://eslint.org/docs/rules/func-name-matching
|
| 287 |
+
*/
|
| 288 |
+
"func-name-matching":
|
| 289 |
+
| Linter.RuleEntry<
|
| 290 |
+
[
|
| 291 |
+
"always" | "never",
|
| 292 |
+
Partial<{
|
| 293 |
+
/**
|
| 294 |
+
* @default false
|
| 295 |
+
*/
|
| 296 |
+
considerPropertyDescriptor: boolean;
|
| 297 |
+
/**
|
| 298 |
+
* @default false
|
| 299 |
+
*/
|
| 300 |
+
includeCommonJSModuleExports: boolean;
|
| 301 |
+
}>,
|
| 302 |
+
]
|
| 303 |
+
>
|
| 304 |
+
| Linter.RuleEntry<
|
| 305 |
+
[
|
| 306 |
+
Partial<{
|
| 307 |
+
/**
|
| 308 |
+
* @default false
|
| 309 |
+
*/
|
| 310 |
+
considerPropertyDescriptor: boolean;
|
| 311 |
+
/**
|
| 312 |
+
* @default false
|
| 313 |
+
*/
|
| 314 |
+
includeCommonJSModuleExports: boolean;
|
| 315 |
+
}>,
|
| 316 |
+
]
|
| 317 |
+
>;
|
| 318 |
+
|
| 319 |
+
/**
|
| 320 |
+
* Rule to require or disallow named `function` expressions.
|
| 321 |
+
*
|
| 322 |
+
* @since 0.4.0
|
| 323 |
+
* @see https://eslint.org/docs/rules/func-names
|
| 324 |
+
*/
|
| 325 |
+
"func-names": Linter.RuleEntry<
|
| 326 |
+
[
|
| 327 |
+
"always" | "as-needed" | "never",
|
| 328 |
+
Partial<{
|
| 329 |
+
generators: "always" | "as-needed" | "never";
|
| 330 |
+
}>,
|
| 331 |
+
]
|
| 332 |
+
>;
|
| 333 |
+
|
| 334 |
+
/**
|
| 335 |
+
* Rule to enforce the consistent use of either `function` declarations or expressions.
|
| 336 |
+
*
|
| 337 |
+
* @since 0.2.0
|
| 338 |
+
* @see https://eslint.org/docs/rules/func-style
|
| 339 |
+
*/
|
| 340 |
+
"func-style": Linter.RuleEntry<
|
| 341 |
+
[
|
| 342 |
+
"expression" | "declaration",
|
| 343 |
+
Partial<{
|
| 344 |
+
/**
|
| 345 |
+
* @default false
|
| 346 |
+
*/
|
| 347 |
+
allowArrowFunctions: boolean;
|
| 348 |
+
}>,
|
| 349 |
+
]
|
| 350 |
+
>;
|
| 351 |
+
|
| 352 |
+
/**
|
| 353 |
+
* Rule to enforce consistent line breaks inside function parentheses.
|
| 354 |
+
*
|
| 355 |
+
* @since 4.6.0
|
| 356 |
+
* @see https://eslint.org/docs/rules/function-paren-newline
|
| 357 |
+
*/
|
| 358 |
+
"function-paren-newline": Linter.RuleEntry<
|
| 359 |
+
[
|
| 360 |
+
| "always"
|
| 361 |
+
| "never"
|
| 362 |
+
| "multiline"
|
| 363 |
+
| "multiline-arguments"
|
| 364 |
+
| "consistent"
|
| 365 |
+
| Partial<{
|
| 366 |
+
minItems: number;
|
| 367 |
+
}>,
|
| 368 |
+
]
|
| 369 |
+
>;
|
| 370 |
+
|
| 371 |
+
/**
|
| 372 |
+
* Rule to disallow specified identifiers.
|
| 373 |
+
*
|
| 374 |
+
* @since 2.0.0-beta.2
|
| 375 |
+
* @see https://eslint.org/docs/rules/id-blacklist
|
| 376 |
+
*/
|
| 377 |
+
"id-blacklist": Linter.RuleEntry<[...string[]]>;
|
| 378 |
+
|
| 379 |
+
/**
|
| 380 |
+
* Rule to enforce minimum and maximum identifier lengths.
|
| 381 |
+
*
|
| 382 |
+
* @since 1.0.0
|
| 383 |
+
* @see https://eslint.org/docs/rules/id-length
|
| 384 |
+
*/
|
| 385 |
+
"id-length": Linter.RuleEntry<
|
| 386 |
+
[
|
| 387 |
+
Partial<{
|
| 388 |
+
/**
|
| 389 |
+
* @default 2
|
| 390 |
+
*/
|
| 391 |
+
min: number;
|
| 392 |
+
/**
|
| 393 |
+
* @default Infinity
|
| 394 |
+
*/
|
| 395 |
+
max: number;
|
| 396 |
+
/**
|
| 397 |
+
* @default 'always'
|
| 398 |
+
*/
|
| 399 |
+
properties: "always" | "never";
|
| 400 |
+
exceptions: string[];
|
| 401 |
+
}>,
|
| 402 |
+
]
|
| 403 |
+
>;
|
| 404 |
+
|
| 405 |
+
/**
|
| 406 |
+
* Rule to require identifiers to match a specified regular expression.
|
| 407 |
+
*
|
| 408 |
+
* @since 1.0.0
|
| 409 |
+
* @see https://eslint.org/docs/rules/id-match
|
| 410 |
+
*/
|
| 411 |
+
"id-match": Linter.RuleEntry<
|
| 412 |
+
[
|
| 413 |
+
string,
|
| 414 |
+
Partial<{
|
| 415 |
+
/**
|
| 416 |
+
* @default false
|
| 417 |
+
*/
|
| 418 |
+
properties: boolean;
|
| 419 |
+
/**
|
| 420 |
+
* @default false
|
| 421 |
+
*/
|
| 422 |
+
onlyDeclarations: boolean;
|
| 423 |
+
/**
|
| 424 |
+
* @default false
|
| 425 |
+
*/
|
| 426 |
+
ignoreDestructuring: boolean;
|
| 427 |
+
}>,
|
| 428 |
+
]
|
| 429 |
+
>;
|
| 430 |
+
|
| 431 |
+
/**
|
| 432 |
+
* Rule to enforce the location of arrow function bodies.
|
| 433 |
+
*
|
| 434 |
+
* @since 4.12.0
|
| 435 |
+
* @see https://eslint.org/docs/rules/implicit-arrow-linebreak
|
| 436 |
+
*/
|
| 437 |
+
"implicit-arrow-linebreak": Linter.RuleEntry<["beside" | "below"]>;
|
| 438 |
+
|
| 439 |
+
/**
|
| 440 |
+
* Rule to enforce consistent indentation.
|
| 441 |
+
*
|
| 442 |
+
* @since 0.14.0
|
| 443 |
+
* @see https://eslint.org/docs/rules/indent
|
| 444 |
+
*/
|
| 445 |
+
indent: Linter.RuleEntry<
|
| 446 |
+
[
|
| 447 |
+
number | "tab",
|
| 448 |
+
Partial<{
|
| 449 |
+
/**
|
| 450 |
+
* @default 0
|
| 451 |
+
*/
|
| 452 |
+
SwitchCase: number;
|
| 453 |
+
/**
|
| 454 |
+
* @default 1
|
| 455 |
+
*/
|
| 456 |
+
VariableDeclarator:
|
| 457 |
+
| Partial<{
|
| 458 |
+
/**
|
| 459 |
+
* @default 1
|
| 460 |
+
*/
|
| 461 |
+
var: number | "first";
|
| 462 |
+
/**
|
| 463 |
+
* @default 1
|
| 464 |
+
*/
|
| 465 |
+
let: number | "first";
|
| 466 |
+
/**
|
| 467 |
+
* @default 1
|
| 468 |
+
*/
|
| 469 |
+
const: number | "first";
|
| 470 |
+
}>
|
| 471 |
+
| number
|
| 472 |
+
| "first";
|
| 473 |
+
/**
|
| 474 |
+
* @default 1
|
| 475 |
+
*/
|
| 476 |
+
outerIIFEBody: number;
|
| 477 |
+
/**
|
| 478 |
+
* @default 1
|
| 479 |
+
*/
|
| 480 |
+
MemberExpression: number | "off";
|
| 481 |
+
/**
|
| 482 |
+
* @default { parameters: 1, body: 1 }
|
| 483 |
+
*/
|
| 484 |
+
FunctionDeclaration: Partial<{
|
| 485 |
+
/**
|
| 486 |
+
* @default 1
|
| 487 |
+
*/
|
| 488 |
+
parameters: number | "first" | "off";
|
| 489 |
+
/**
|
| 490 |
+
* @default 1
|
| 491 |
+
*/
|
| 492 |
+
body: number;
|
| 493 |
+
}>;
|
| 494 |
+
/**
|
| 495 |
+
* @default { parameters: 1, body: 1 }
|
| 496 |
+
*/
|
| 497 |
+
FunctionExpression: Partial<{
|
| 498 |
+
/**
|
| 499 |
+
* @default 1
|
| 500 |
+
*/
|
| 501 |
+
parameters: number | "first" | "off";
|
| 502 |
+
/**
|
| 503 |
+
* @default 1
|
| 504 |
+
*/
|
| 505 |
+
body: number;
|
| 506 |
+
}>;
|
| 507 |
+
/**
|
| 508 |
+
* @default { arguments: 1 }
|
| 509 |
+
*/
|
| 510 |
+
CallExpression: Partial<{
|
| 511 |
+
/**
|
| 512 |
+
* @default 1
|
| 513 |
+
*/
|
| 514 |
+
arguments: number | "first" | "off";
|
| 515 |
+
}>;
|
| 516 |
+
/**
|
| 517 |
+
* @default 1
|
| 518 |
+
*/
|
| 519 |
+
ArrayExpression: number | "first" | "off";
|
| 520 |
+
/**
|
| 521 |
+
* @default 1
|
| 522 |
+
*/
|
| 523 |
+
ObjectExpression: number | "first" | "off";
|
| 524 |
+
/**
|
| 525 |
+
* @default 1
|
| 526 |
+
*/
|
| 527 |
+
ImportDeclaration: number | "first" | "off";
|
| 528 |
+
/**
|
| 529 |
+
* @default false
|
| 530 |
+
*/
|
| 531 |
+
flatTernaryExpressions: boolean;
|
| 532 |
+
ignoredNodes: string[];
|
| 533 |
+
/**
|
| 534 |
+
* @default false
|
| 535 |
+
*/
|
| 536 |
+
ignoreComments: boolean;
|
| 537 |
+
}>,
|
| 538 |
+
]
|
| 539 |
+
>;
|
| 540 |
+
|
| 541 |
+
/**
|
| 542 |
+
* Rule to enforce the consistent use of either double or single quotes in JSX attributes.
|
| 543 |
+
*
|
| 544 |
+
* @since 1.4.0
|
| 545 |
+
* @see https://eslint.org/docs/rules/jsx-quotes
|
| 546 |
+
*/
|
| 547 |
+
"jsx-quotes": Linter.RuleEntry<["prefer-double" | "prefer-single"]>;
|
| 548 |
+
|
| 549 |
+
/**
|
| 550 |
+
* Rule to enforce consistent spacing between keys and values in object literal properties.
|
| 551 |
+
*
|
| 552 |
+
* @since 0.9.0
|
| 553 |
+
* @see https://eslint.org/docs/rules/key-spacing
|
| 554 |
+
*/
|
| 555 |
+
"key-spacing": Linter.RuleEntry<
|
| 556 |
+
[
|
| 557 |
+
| Partial<
|
| 558 |
+
| {
|
| 559 |
+
/**
|
| 560 |
+
* @default false
|
| 561 |
+
*/
|
| 562 |
+
beforeColon: boolean;
|
| 563 |
+
/**
|
| 564 |
+
* @default true
|
| 565 |
+
*/
|
| 566 |
+
afterColon: boolean;
|
| 567 |
+
/**
|
| 568 |
+
* @default 'strict'
|
| 569 |
+
*/
|
| 570 |
+
mode: "strict" | "minimum";
|
| 571 |
+
align:
|
| 572 |
+
| Partial<{
|
| 573 |
+
/**
|
| 574 |
+
* @default false
|
| 575 |
+
*/
|
| 576 |
+
beforeColon: boolean;
|
| 577 |
+
/**
|
| 578 |
+
* @default true
|
| 579 |
+
*/
|
| 580 |
+
afterColon: boolean;
|
| 581 |
+
/**
|
| 582 |
+
* @default 'colon'
|
| 583 |
+
*/
|
| 584 |
+
on: "value" | "colon";
|
| 585 |
+
/**
|
| 586 |
+
* @default 'strict'
|
| 587 |
+
*/
|
| 588 |
+
mode: "strict" | "minimum";
|
| 589 |
+
}>
|
| 590 |
+
| "value"
|
| 591 |
+
| "colon";
|
| 592 |
+
}
|
| 593 |
+
| {
|
| 594 |
+
singleLine?:
|
| 595 |
+
| Partial<{
|
| 596 |
+
/**
|
| 597 |
+
* @default false
|
| 598 |
+
*/
|
| 599 |
+
beforeColon: boolean;
|
| 600 |
+
/**
|
| 601 |
+
* @default true
|
| 602 |
+
*/
|
| 603 |
+
afterColon: boolean;
|
| 604 |
+
/**
|
| 605 |
+
* @default 'strict'
|
| 606 |
+
*/
|
| 607 |
+
mode: "strict" | "minimum";
|
| 608 |
+
}>
|
| 609 |
+
| undefined;
|
| 610 |
+
multiLine?:
|
| 611 |
+
| Partial<{
|
| 612 |
+
/**
|
| 613 |
+
* @default false
|
| 614 |
+
*/
|
| 615 |
+
beforeColon: boolean;
|
| 616 |
+
/**
|
| 617 |
+
* @default true
|
| 618 |
+
*/
|
| 619 |
+
afterColon: boolean;
|
| 620 |
+
/**
|
| 621 |
+
* @default 'strict'
|
| 622 |
+
*/
|
| 623 |
+
mode: "strict" | "minimum";
|
| 624 |
+
align:
|
| 625 |
+
| Partial<{
|
| 626 |
+
/**
|
| 627 |
+
* @default false
|
| 628 |
+
*/
|
| 629 |
+
beforeColon: boolean;
|
| 630 |
+
/**
|
| 631 |
+
* @default true
|
| 632 |
+
*/
|
| 633 |
+
afterColon: boolean;
|
| 634 |
+
/**
|
| 635 |
+
* @default 'colon'
|
| 636 |
+
*/
|
| 637 |
+
on: "value" | "colon";
|
| 638 |
+
/**
|
| 639 |
+
* @default 'strict'
|
| 640 |
+
*/
|
| 641 |
+
mode: "strict" | "minimum";
|
| 642 |
+
}>
|
| 643 |
+
| "value"
|
| 644 |
+
| "colon";
|
| 645 |
+
}>
|
| 646 |
+
| undefined;
|
| 647 |
+
}
|
| 648 |
+
>
|
| 649 |
+
| {
|
| 650 |
+
align: Partial<{
|
| 651 |
+
/**
|
| 652 |
+
* @default false
|
| 653 |
+
*/
|
| 654 |
+
beforeColon: boolean;
|
| 655 |
+
/**
|
| 656 |
+
* @default true
|
| 657 |
+
*/
|
| 658 |
+
afterColon: boolean;
|
| 659 |
+
/**
|
| 660 |
+
* @default 'colon'
|
| 661 |
+
*/
|
| 662 |
+
on: "value" | "colon";
|
| 663 |
+
/**
|
| 664 |
+
* @default 'strict'
|
| 665 |
+
*/
|
| 666 |
+
mode: "strict" | "minimum";
|
| 667 |
+
}>;
|
| 668 |
+
singleLine?:
|
| 669 |
+
| Partial<{
|
| 670 |
+
/**
|
| 671 |
+
* @default false
|
| 672 |
+
*/
|
| 673 |
+
beforeColon: boolean;
|
| 674 |
+
/**
|
| 675 |
+
* @default true
|
| 676 |
+
*/
|
| 677 |
+
afterColon: boolean;
|
| 678 |
+
/**
|
| 679 |
+
* @default 'strict'
|
| 680 |
+
*/
|
| 681 |
+
mode: "strict" | "minimum";
|
| 682 |
+
}>
|
| 683 |
+
| undefined;
|
| 684 |
+
multiLine?:
|
| 685 |
+
| Partial<{
|
| 686 |
+
/**
|
| 687 |
+
* @default false
|
| 688 |
+
*/
|
| 689 |
+
beforeColon: boolean;
|
| 690 |
+
/**
|
| 691 |
+
* @default true
|
| 692 |
+
*/
|
| 693 |
+
afterColon: boolean;
|
| 694 |
+
/**
|
| 695 |
+
* @default 'strict'
|
| 696 |
+
*/
|
| 697 |
+
mode: "strict" | "minimum";
|
| 698 |
+
}>
|
| 699 |
+
| undefined;
|
| 700 |
+
},
|
| 701 |
+
]
|
| 702 |
+
>;
|
| 703 |
+
|
| 704 |
+
/**
|
| 705 |
+
* Rule to enforce consistent spacing before and after keywords.
|
| 706 |
+
*
|
| 707 |
+
* @since 2.0.0-beta.1
|
| 708 |
+
* @see https://eslint.org/docs/rules/keyword-spacing
|
| 709 |
+
*/
|
| 710 |
+
"keyword-spacing": Linter.RuleEntry<
|
| 711 |
+
[
|
| 712 |
+
Partial<{
|
| 713 |
+
/**
|
| 714 |
+
* @default true
|
| 715 |
+
*/
|
| 716 |
+
before: boolean;
|
| 717 |
+
/**
|
| 718 |
+
* @default true
|
| 719 |
+
*/
|
| 720 |
+
after: boolean;
|
| 721 |
+
overrides: Record<
|
| 722 |
+
string,
|
| 723 |
+
Partial<{
|
| 724 |
+
before: boolean;
|
| 725 |
+
after: boolean;
|
| 726 |
+
}>
|
| 727 |
+
>;
|
| 728 |
+
}>,
|
| 729 |
+
]
|
| 730 |
+
>;
|
| 731 |
+
|
| 732 |
+
/**
|
| 733 |
+
* Rule to enforce position of line comments.
|
| 734 |
+
*
|
| 735 |
+
* @since 3.5.0
|
| 736 |
+
* @see https://eslint.org/docs/rules/line-comment-position
|
| 737 |
+
*/
|
| 738 |
+
"line-comment-position": Linter.RuleEntry<
|
| 739 |
+
[
|
| 740 |
+
Partial<{
|
| 741 |
+
/**
|
| 742 |
+
* @default 'above'
|
| 743 |
+
*/
|
| 744 |
+
position: "above" | "beside";
|
| 745 |
+
ignorePattern: string;
|
| 746 |
+
/**
|
| 747 |
+
* @default true
|
| 748 |
+
*/
|
| 749 |
+
applyDefaultIgnorePatterns: boolean;
|
| 750 |
+
}>,
|
| 751 |
+
]
|
| 752 |
+
>;
|
| 753 |
+
|
| 754 |
+
/**
|
| 755 |
+
* Rule to enforce consistent linebreak style.
|
| 756 |
+
*
|
| 757 |
+
* @since 0.21.0
|
| 758 |
+
* @see https://eslint.org/docs/rules/linebreak-style
|
| 759 |
+
*/
|
| 760 |
+
"linebreak-style": Linter.RuleEntry<["unix" | "windows"]>;
|
| 761 |
+
|
| 762 |
+
/**
|
| 763 |
+
* Rule to require empty lines around comments.
|
| 764 |
+
*
|
| 765 |
+
* @since 0.22.0
|
| 766 |
+
* @see https://eslint.org/docs/rules/lines-around-comment
|
| 767 |
+
*/
|
| 768 |
+
"lines-around-comment": Linter.RuleEntry<
|
| 769 |
+
[
|
| 770 |
+
Partial<{
|
| 771 |
+
/**
|
| 772 |
+
* @default true
|
| 773 |
+
*/
|
| 774 |
+
beforeBlockComment: boolean;
|
| 775 |
+
/**
|
| 776 |
+
* @default false
|
| 777 |
+
*/
|
| 778 |
+
afterBlockComment: boolean;
|
| 779 |
+
/**
|
| 780 |
+
* @default false
|
| 781 |
+
*/
|
| 782 |
+
beforeLineComment: boolean;
|
| 783 |
+
/**
|
| 784 |
+
* @default false
|
| 785 |
+
*/
|
| 786 |
+
afterLineComment: boolean;
|
| 787 |
+
/**
|
| 788 |
+
* @default false
|
| 789 |
+
*/
|
| 790 |
+
allowBlockStart: boolean;
|
| 791 |
+
/**
|
| 792 |
+
* @default false
|
| 793 |
+
*/
|
| 794 |
+
allowBlockEnd: boolean;
|
| 795 |
+
/**
|
| 796 |
+
* @default false
|
| 797 |
+
*/
|
| 798 |
+
allowObjectStart: boolean;
|
| 799 |
+
/**
|
| 800 |
+
* @default false
|
| 801 |
+
*/
|
| 802 |
+
allowObjectEnd: boolean;
|
| 803 |
+
/**
|
| 804 |
+
* @default false
|
| 805 |
+
*/
|
| 806 |
+
allowArrayStart: boolean;
|
| 807 |
+
/**
|
| 808 |
+
* @default false
|
| 809 |
+
*/
|
| 810 |
+
allowArrayEnd: boolean;
|
| 811 |
+
/**
|
| 812 |
+
* @default false
|
| 813 |
+
*/
|
| 814 |
+
allowClassStart: boolean;
|
| 815 |
+
/**
|
| 816 |
+
* @default false
|
| 817 |
+
*/
|
| 818 |
+
allowClassEnd: boolean;
|
| 819 |
+
ignorePattern: string;
|
| 820 |
+
/**
|
| 821 |
+
* @default true
|
| 822 |
+
*/
|
| 823 |
+
applyDefaultIgnorePatterns: boolean;
|
| 824 |
+
}>,
|
| 825 |
+
]
|
| 826 |
+
>;
|
| 827 |
+
|
| 828 |
+
/**
|
| 829 |
+
* Rule to require or disallow an empty line between class members.
|
| 830 |
+
*
|
| 831 |
+
* @since 4.9.0
|
| 832 |
+
* @see https://eslint.org/docs/rules/lines-between-class-members
|
| 833 |
+
*/
|
| 834 |
+
"lines-between-class-members": Linter.RuleEntry<
|
| 835 |
+
[
|
| 836 |
+
"always" | "never",
|
| 837 |
+
Partial<{
|
| 838 |
+
/**
|
| 839 |
+
* @default false
|
| 840 |
+
*/
|
| 841 |
+
exceptAfterSingleLine: boolean;
|
| 842 |
+
}>,
|
| 843 |
+
]
|
| 844 |
+
>;
|
| 845 |
+
|
| 846 |
+
/**
|
| 847 |
+
* Rule to enforce a maximum depth that blocks can be nested.
|
| 848 |
+
*
|
| 849 |
+
* @since 0.0.9
|
| 850 |
+
* @see https://eslint.org/docs/rules/max-depth
|
| 851 |
+
*/
|
| 852 |
+
"max-depth": Linter.RuleEntry<
|
| 853 |
+
[
|
| 854 |
+
Partial<{
|
| 855 |
+
/**
|
| 856 |
+
* @default 4
|
| 857 |
+
*/
|
| 858 |
+
max: number;
|
| 859 |
+
}>,
|
| 860 |
+
]
|
| 861 |
+
>;
|
| 862 |
+
|
| 863 |
+
/**
|
| 864 |
+
* Rule to enforce a maximum line length.
|
| 865 |
+
*
|
| 866 |
+
* @since 0.0.9
|
| 867 |
+
* @see https://eslint.org/docs/rules/max-len
|
| 868 |
+
*/
|
| 869 |
+
"max-len": Linter.RuleEntry<
|
| 870 |
+
[
|
| 871 |
+
Partial<{
|
| 872 |
+
/**
|
| 873 |
+
* @default 80
|
| 874 |
+
*/
|
| 875 |
+
code: number;
|
| 876 |
+
/**
|
| 877 |
+
* @default 4
|
| 878 |
+
*/
|
| 879 |
+
tabWidth: number;
|
| 880 |
+
comments: number;
|
| 881 |
+
ignorePattern: string;
|
| 882 |
+
/**
|
| 883 |
+
* @default false
|
| 884 |
+
*/
|
| 885 |
+
ignoreComments: boolean;
|
| 886 |
+
/**
|
| 887 |
+
* @default false
|
| 888 |
+
*/
|
| 889 |
+
ignoreTrailingComments: boolean;
|
| 890 |
+
/**
|
| 891 |
+
* @default false
|
| 892 |
+
*/
|
| 893 |
+
ignoreUrls: boolean;
|
| 894 |
+
/**
|
| 895 |
+
* @default false
|
| 896 |
+
*/
|
| 897 |
+
ignoreStrings: boolean;
|
| 898 |
+
/**
|
| 899 |
+
* @default false
|
| 900 |
+
*/
|
| 901 |
+
ignoreTemplateLiterals: boolean;
|
| 902 |
+
/**
|
| 903 |
+
* @default false
|
| 904 |
+
*/
|
| 905 |
+
ignoreRegExpLiterals: boolean;
|
| 906 |
+
}>,
|
| 907 |
+
]
|
| 908 |
+
>;
|
| 909 |
+
|
| 910 |
+
/**
|
| 911 |
+
* Rule to enforce a maximum number of lines per file.
|
| 912 |
+
*
|
| 913 |
+
* @since 2.12.0
|
| 914 |
+
* @see https://eslint.org/docs/rules/max-lines
|
| 915 |
+
*/
|
| 916 |
+
"max-lines": Linter.RuleEntry<
|
| 917 |
+
[
|
| 918 |
+
| Partial<{
|
| 919 |
+
/**
|
| 920 |
+
* @default 300
|
| 921 |
+
*/
|
| 922 |
+
max: number;
|
| 923 |
+
/**
|
| 924 |
+
* @default false
|
| 925 |
+
*/
|
| 926 |
+
skipBlankLines: boolean;
|
| 927 |
+
/**
|
| 928 |
+
* @default false
|
| 929 |
+
*/
|
| 930 |
+
skipComments: boolean;
|
| 931 |
+
}>
|
| 932 |
+
| number,
|
| 933 |
+
]
|
| 934 |
+
>;
|
| 935 |
+
|
| 936 |
+
/**
|
| 937 |
+
* Rule to enforce a maximum number of line of code in a function.
|
| 938 |
+
*
|
| 939 |
+
* @since 5.0.0
|
| 940 |
+
* @see https://eslint.org/docs/rules/max-lines-per-function
|
| 941 |
+
*/
|
| 942 |
+
"max-lines-per-function": Linter.RuleEntry<
|
| 943 |
+
[
|
| 944 |
+
Partial<{
|
| 945 |
+
/**
|
| 946 |
+
* @default 50
|
| 947 |
+
*/
|
| 948 |
+
max: number;
|
| 949 |
+
/**
|
| 950 |
+
* @default false
|
| 951 |
+
*/
|
| 952 |
+
skipBlankLines: boolean;
|
| 953 |
+
/**
|
| 954 |
+
* @default false
|
| 955 |
+
*/
|
| 956 |
+
skipComments: boolean;
|
| 957 |
+
/**
|
| 958 |
+
* @default false
|
| 959 |
+
*/
|
| 960 |
+
IIFEs: boolean;
|
| 961 |
+
}>,
|
| 962 |
+
]
|
| 963 |
+
>;
|
| 964 |
+
|
| 965 |
+
/**
|
| 966 |
+
* Rule to enforce a maximum depth that callbacks can be nested.
|
| 967 |
+
*
|
| 968 |
+
* @since 0.2.0
|
| 969 |
+
* @see https://eslint.org/docs/rules/max-nested-callbacks
|
| 970 |
+
*/
|
| 971 |
+
"max-nested-callbacks": Linter.RuleEntry<
|
| 972 |
+
[
|
| 973 |
+
| Partial<{
|
| 974 |
+
/**
|
| 975 |
+
* @default 10
|
| 976 |
+
*/
|
| 977 |
+
max: number;
|
| 978 |
+
}>
|
| 979 |
+
| number,
|
| 980 |
+
]
|
| 981 |
+
>;
|
| 982 |
+
|
| 983 |
+
/**
|
| 984 |
+
* Rule to enforce a maximum number of parameters in function definitions.
|
| 985 |
+
*
|
| 986 |
+
* @since 0.0.9
|
| 987 |
+
* @see https://eslint.org/docs/rules/max-params
|
| 988 |
+
*/
|
| 989 |
+
"max-params": Linter.RuleEntry<
|
| 990 |
+
[
|
| 991 |
+
| Partial<{
|
| 992 |
+
/**
|
| 993 |
+
* @default 3
|
| 994 |
+
*/
|
| 995 |
+
max: number;
|
| 996 |
+
}>
|
| 997 |
+
| number,
|
| 998 |
+
]
|
| 999 |
+
>;
|
| 1000 |
+
|
| 1001 |
+
/**
|
| 1002 |
+
* Rule to enforce a maximum number of statements allowed in function blocks.
|
| 1003 |
+
*
|
| 1004 |
+
* @since 0.0.9
|
| 1005 |
+
* @see https://eslint.org/docs/rules/max-statements
|
| 1006 |
+
*/
|
| 1007 |
+
"max-statements": Linter.RuleEntry<
|
| 1008 |
+
[
|
| 1009 |
+
| Partial<{
|
| 1010 |
+
/**
|
| 1011 |
+
* @default 10
|
| 1012 |
+
*/
|
| 1013 |
+
max: number;
|
| 1014 |
+
/**
|
| 1015 |
+
* @default false
|
| 1016 |
+
*/
|
| 1017 |
+
ignoreTopLevelFunctions: boolean;
|
| 1018 |
+
}>
|
| 1019 |
+
| number,
|
| 1020 |
+
]
|
| 1021 |
+
>;
|
| 1022 |
+
|
| 1023 |
+
/**
|
| 1024 |
+
* Rule to enforce a maximum number of statements allowed per line.
|
| 1025 |
+
*
|
| 1026 |
+
* @since 2.5.0
|
| 1027 |
+
* @see https://eslint.org/docs/rules/max-statements-per-line
|
| 1028 |
+
*/
|
| 1029 |
+
"max-statements-per-line": Linter.RuleEntry<
|
| 1030 |
+
[
|
| 1031 |
+
| Partial<{
|
| 1032 |
+
/**
|
| 1033 |
+
* @default 1
|
| 1034 |
+
*/
|
| 1035 |
+
max: number;
|
| 1036 |
+
}>
|
| 1037 |
+
| number,
|
| 1038 |
+
]
|
| 1039 |
+
>;
|
| 1040 |
+
|
| 1041 |
+
/**
|
| 1042 |
+
* Rule to enforce a particular style for multiline comments.
|
| 1043 |
+
*
|
| 1044 |
+
* @since 4.10.0
|
| 1045 |
+
* @see https://eslint.org/docs/rules/multiline-comment-style
|
| 1046 |
+
*/
|
| 1047 |
+
"multiline-comment-style": Linter.RuleEntry<["starred-block" | "bare-block" | "separate-lines"]>;
|
| 1048 |
+
|
| 1049 |
+
/**
|
| 1050 |
+
* Rule to enforce newlines between operands of ternary expressions.
|
| 1051 |
+
*
|
| 1052 |
+
* @since 3.1.0
|
| 1053 |
+
* @see https://eslint.org/docs/rules/multiline-ternary
|
| 1054 |
+
*/
|
| 1055 |
+
"multiline-ternary": Linter.RuleEntry<["always" | "always-multiline" | "never"]>;
|
| 1056 |
+
|
| 1057 |
+
/**
|
| 1058 |
+
* Rule to require constructor names to begin with a capital letter.
|
| 1059 |
+
*
|
| 1060 |
+
* @since 0.0.3-0
|
| 1061 |
+
* @see https://eslint.org/docs/rules/new-cap
|
| 1062 |
+
*/
|
| 1063 |
+
"new-cap": Linter.RuleEntry<
|
| 1064 |
+
[
|
| 1065 |
+
Partial<{
|
| 1066 |
+
/**
|
| 1067 |
+
* @default true
|
| 1068 |
+
*/
|
| 1069 |
+
newIsCap: boolean;
|
| 1070 |
+
/**
|
| 1071 |
+
* @default true
|
| 1072 |
+
*/
|
| 1073 |
+
capIsNew: boolean;
|
| 1074 |
+
newIsCapExceptions: string[];
|
| 1075 |
+
newIsCapExceptionPattern: string;
|
| 1076 |
+
capIsNewExceptions: string[];
|
| 1077 |
+
capIsNewExceptionPattern: string;
|
| 1078 |
+
/**
|
| 1079 |
+
* @default true
|
| 1080 |
+
*/
|
| 1081 |
+
properties: boolean;
|
| 1082 |
+
}>,
|
| 1083 |
+
]
|
| 1084 |
+
>;
|
| 1085 |
+
|
| 1086 |
+
/**
|
| 1087 |
+
* Rule to enforce or disallow parentheses when invoking a constructor with no arguments.
|
| 1088 |
+
*
|
| 1089 |
+
* @since 0.0.6
|
| 1090 |
+
* @see https://eslint.org/docs/rules/new-parens
|
| 1091 |
+
*/
|
| 1092 |
+
"new-parens": Linter.RuleEntry<["always" | "never"]>;
|
| 1093 |
+
|
| 1094 |
+
/**
|
| 1095 |
+
* Rule to require a newline after each call in a method chain.
|
| 1096 |
+
*
|
| 1097 |
+
* @since 2.0.0-rc.0
|
| 1098 |
+
* @see https://eslint.org/docs/rules/newline-per-chained-call
|
| 1099 |
+
*/
|
| 1100 |
+
"newline-per-chained-call": Linter.RuleEntry<
|
| 1101 |
+
[
|
| 1102 |
+
{
|
| 1103 |
+
/**
|
| 1104 |
+
* @default 2
|
| 1105 |
+
*/
|
| 1106 |
+
ignoreChainWithDepth: number;
|
| 1107 |
+
},
|
| 1108 |
+
]
|
| 1109 |
+
>;
|
| 1110 |
+
|
| 1111 |
+
/**
|
| 1112 |
+
* Rule to disallow `Array` constructors.
|
| 1113 |
+
*
|
| 1114 |
+
* @since 0.4.0
|
| 1115 |
+
* @see https://eslint.org/docs/rules/no-array-constructor
|
| 1116 |
+
*/
|
| 1117 |
+
"no-array-constructor": Linter.RuleEntry<[]>;
|
| 1118 |
+
|
| 1119 |
+
/**
|
| 1120 |
+
* Rule to disallow bitwise operators.
|
| 1121 |
+
*
|
| 1122 |
+
* @since 0.0.2
|
| 1123 |
+
* @see https://eslint.org/docs/rules/no-bitwise
|
| 1124 |
+
*/
|
| 1125 |
+
"no-bitwise": Linter.RuleEntry<
|
| 1126 |
+
[
|
| 1127 |
+
Partial<{
|
| 1128 |
+
allow: string[];
|
| 1129 |
+
/**
|
| 1130 |
+
* @default false
|
| 1131 |
+
*/
|
| 1132 |
+
int32Hint: boolean;
|
| 1133 |
+
}>,
|
| 1134 |
+
]
|
| 1135 |
+
>;
|
| 1136 |
+
|
| 1137 |
+
/**
|
| 1138 |
+
* Rule to disallow `continue` statements.
|
| 1139 |
+
*
|
| 1140 |
+
* @since 0.19.0
|
| 1141 |
+
* @see https://eslint.org/docs/rules/no-continue
|
| 1142 |
+
*/
|
| 1143 |
+
"no-continue": Linter.RuleEntry<[]>;
|
| 1144 |
+
|
| 1145 |
+
/**
|
| 1146 |
+
* Rule to disallow inline comments after code.
|
| 1147 |
+
*
|
| 1148 |
+
* @since 0.10.0
|
| 1149 |
+
* @see https://eslint.org/docs/rules/no-inline-comments
|
| 1150 |
+
*/
|
| 1151 |
+
"no-inline-comments": Linter.RuleEntry<[]>;
|
| 1152 |
+
|
| 1153 |
+
/**
|
| 1154 |
+
* Rule to disallow `if` statements as the only statement in `else` blocks.
|
| 1155 |
+
*
|
| 1156 |
+
* @since 0.6.0
|
| 1157 |
+
* @see https://eslint.org/docs/rules/no-lonely-if
|
| 1158 |
+
*/
|
| 1159 |
+
"no-lonely-if": Linter.RuleEntry<[]>;
|
| 1160 |
+
|
| 1161 |
+
/**
|
| 1162 |
+
* Rule to disallow mixed binary operators.
|
| 1163 |
+
*
|
| 1164 |
+
* @since 2.12.0
|
| 1165 |
+
* @see https://eslint.org/docs/rules/no-mixed-operators
|
| 1166 |
+
*/
|
| 1167 |
+
"no-mixed-operators": Linter.RuleEntry<
|
| 1168 |
+
[
|
| 1169 |
+
Partial<{
|
| 1170 |
+
/**
|
| 1171 |
+
* @default
|
| 1172 |
+
* [
|
| 1173 |
+
* ["+", "-", "*", "/", "%", "**"],
|
| 1174 |
+
* ["&", "|", "^", "~", "<<", ">>", ">>>"],
|
| 1175 |
+
* ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
| 1176 |
+
* ["&&", "||"],
|
| 1177 |
+
* ["in", "instanceof"]
|
| 1178 |
+
* ]
|
| 1179 |
+
*/
|
| 1180 |
+
groups: string[][];
|
| 1181 |
+
/**
|
| 1182 |
+
* @default true
|
| 1183 |
+
*/
|
| 1184 |
+
allowSamePrecedence: boolean;
|
| 1185 |
+
}>,
|
| 1186 |
+
]
|
| 1187 |
+
>;
|
| 1188 |
+
|
| 1189 |
+
/**
|
| 1190 |
+
* Rule to disallow mixed spaces and tabs for indentation.
|
| 1191 |
+
*
|
| 1192 |
+
* @remarks
|
| 1193 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 1194 |
+
*
|
| 1195 |
+
* @since 0.7.1
|
| 1196 |
+
* @see https://eslint.org/docs/rules/no-mixed-spaces-and-tabs
|
| 1197 |
+
*/
|
| 1198 |
+
"no-mixed-spaces-and-tabs": Linter.RuleEntry<["smart-tabs"]>;
|
| 1199 |
+
|
| 1200 |
+
/**
|
| 1201 |
+
* Rule to disallow use of chained assignment expressions.
|
| 1202 |
+
*
|
| 1203 |
+
* @since 3.14.0
|
| 1204 |
+
* @see https://eslint.org/docs/rules/no-multi-assign
|
| 1205 |
+
*/
|
| 1206 |
+
"no-multi-assign": Linter.RuleEntry<[]>;
|
| 1207 |
+
|
| 1208 |
+
/**
|
| 1209 |
+
* Rule to disallow multiple empty lines.
|
| 1210 |
+
*
|
| 1211 |
+
* @since 0.9.0
|
| 1212 |
+
* @see https://eslint.org/docs/rules/no-multiple-empty-lines
|
| 1213 |
+
*/
|
| 1214 |
+
"no-multiple-empty-lines": Linter.RuleEntry<
|
| 1215 |
+
[
|
| 1216 |
+
| Partial<{
|
| 1217 |
+
/**
|
| 1218 |
+
* @default 2
|
| 1219 |
+
*/
|
| 1220 |
+
max: number;
|
| 1221 |
+
maxEOF: number;
|
| 1222 |
+
maxBOF: number;
|
| 1223 |
+
}>
|
| 1224 |
+
| number,
|
| 1225 |
+
]
|
| 1226 |
+
>;
|
| 1227 |
+
|
| 1228 |
+
/**
|
| 1229 |
+
* Rule to disallow negated conditions.
|
| 1230 |
+
*
|
| 1231 |
+
* @since 1.6.0
|
| 1232 |
+
* @see https://eslint.org/docs/rules/no-negated-condition
|
| 1233 |
+
*/
|
| 1234 |
+
"no-negated-condition": Linter.RuleEntry<[]>;
|
| 1235 |
+
|
| 1236 |
+
/**
|
| 1237 |
+
* Rule to disallow nested ternary expressions.
|
| 1238 |
+
*
|
| 1239 |
+
* @since 0.2.0
|
| 1240 |
+
* @see https://eslint.org/docs/rules/no-nested-ternary
|
| 1241 |
+
*/
|
| 1242 |
+
"no-nested-ternary": Linter.RuleEntry<[]>;
|
| 1243 |
+
|
| 1244 |
+
/**
|
| 1245 |
+
* Rule to disallow `Object` constructors.
|
| 1246 |
+
*
|
| 1247 |
+
* @since 0.0.9
|
| 1248 |
+
* @see https://eslint.org/docs/rules/no-new-object
|
| 1249 |
+
*/
|
| 1250 |
+
"no-new-object": Linter.RuleEntry<[]>;
|
| 1251 |
+
|
| 1252 |
+
/**
|
| 1253 |
+
* Rule to disallow the unary operators `++` and `--`.
|
| 1254 |
+
*
|
| 1255 |
+
* @since 0.0.9
|
| 1256 |
+
* @see https://eslint.org/docs/rules/no-plusplus
|
| 1257 |
+
*/
|
| 1258 |
+
"no-plusplus": Linter.RuleEntry<
|
| 1259 |
+
[
|
| 1260 |
+
Partial<{
|
| 1261 |
+
/**
|
| 1262 |
+
* @default false
|
| 1263 |
+
*/
|
| 1264 |
+
allowForLoopAfterthoughts: boolean;
|
| 1265 |
+
}>,
|
| 1266 |
+
]
|
| 1267 |
+
>;
|
| 1268 |
+
|
| 1269 |
+
/**
|
| 1270 |
+
* Rule to disallow specified syntax.
|
| 1271 |
+
*
|
| 1272 |
+
* @since 1.4.0
|
| 1273 |
+
* @see https://eslint.org/docs/rules/no-restricted-syntax
|
| 1274 |
+
*/
|
| 1275 |
+
"no-restricted-syntax": Linter.RuleEntry<
|
| 1276 |
+
[
|
| 1277 |
+
...Array<
|
| 1278 |
+
| string
|
| 1279 |
+
| {
|
| 1280 |
+
selector: string;
|
| 1281 |
+
message?: string | undefined;
|
| 1282 |
+
}
|
| 1283 |
+
>,
|
| 1284 |
+
]
|
| 1285 |
+
>;
|
| 1286 |
+
|
| 1287 |
+
/**
|
| 1288 |
+
* Rule to disallow all tabs.
|
| 1289 |
+
*
|
| 1290 |
+
* @since 3.2.0
|
| 1291 |
+
* @see https://eslint.org/docs/rules/no-tabs
|
| 1292 |
+
*/
|
| 1293 |
+
"no-tabs": Linter.RuleEntry<
|
| 1294 |
+
[
|
| 1295 |
+
Partial<{
|
| 1296 |
+
/**
|
| 1297 |
+
* @default false
|
| 1298 |
+
*/
|
| 1299 |
+
allowIndentationTabs: boolean;
|
| 1300 |
+
}>,
|
| 1301 |
+
]
|
| 1302 |
+
>;
|
| 1303 |
+
|
| 1304 |
+
/**
|
| 1305 |
+
* Rule to disallow ternary operators.
|
| 1306 |
+
*
|
| 1307 |
+
* @since 0.0.9
|
| 1308 |
+
* @see https://eslint.org/docs/rules/no-ternary
|
| 1309 |
+
*/
|
| 1310 |
+
"no-ternary": Linter.RuleEntry<[]>;
|
| 1311 |
+
|
| 1312 |
+
/**
|
| 1313 |
+
* Rule to disallow trailing whitespace at the end of lines.
|
| 1314 |
+
*
|
| 1315 |
+
* @since 0.7.1
|
| 1316 |
+
* @see https://eslint.org/docs/rules/no-trailing-spaces
|
| 1317 |
+
*/
|
| 1318 |
+
"no-trailing-spaces": Linter.RuleEntry<
|
| 1319 |
+
[
|
| 1320 |
+
Partial<{
|
| 1321 |
+
/**
|
| 1322 |
+
* @default false
|
| 1323 |
+
*/
|
| 1324 |
+
skipBlankLines: boolean;
|
| 1325 |
+
/**
|
| 1326 |
+
* @default false
|
| 1327 |
+
*/
|
| 1328 |
+
ignoreComments: boolean;
|
| 1329 |
+
}>,
|
| 1330 |
+
]
|
| 1331 |
+
>;
|
| 1332 |
+
|
| 1333 |
+
/**
|
| 1334 |
+
* Rule to disallow dangling underscores in identifiers.
|
| 1335 |
+
*
|
| 1336 |
+
* @since 0.0.9
|
| 1337 |
+
* @see https://eslint.org/docs/rules/no-underscore-dangle
|
| 1338 |
+
*/
|
| 1339 |
+
"no-underscore-dangle": Linter.RuleEntry<
|
| 1340 |
+
[
|
| 1341 |
+
Partial<{
|
| 1342 |
+
allow: string[];
|
| 1343 |
+
/**
|
| 1344 |
+
* @default false
|
| 1345 |
+
*/
|
| 1346 |
+
allowAfterThis: boolean;
|
| 1347 |
+
/**
|
| 1348 |
+
* @default false
|
| 1349 |
+
*/
|
| 1350 |
+
allowAfterSuper: boolean;
|
| 1351 |
+
/**
|
| 1352 |
+
* @default false
|
| 1353 |
+
*/
|
| 1354 |
+
enforceInMethodNames: boolean;
|
| 1355 |
+
}>,
|
| 1356 |
+
]
|
| 1357 |
+
>;
|
| 1358 |
+
|
| 1359 |
+
/**
|
| 1360 |
+
* Rule to disallow ternary operators when simpler alternatives exist.
|
| 1361 |
+
*
|
| 1362 |
+
* @since 0.21.0
|
| 1363 |
+
* @see https://eslint.org/docs/rules/no-unneeded-ternary
|
| 1364 |
+
*/
|
| 1365 |
+
"no-unneeded-ternary": Linter.RuleEntry<
|
| 1366 |
+
[
|
| 1367 |
+
Partial<{
|
| 1368 |
+
/**
|
| 1369 |
+
* @default true
|
| 1370 |
+
*/
|
| 1371 |
+
defaultAssignment: boolean;
|
| 1372 |
+
}>,
|
| 1373 |
+
]
|
| 1374 |
+
>;
|
| 1375 |
+
|
| 1376 |
+
/**
|
| 1377 |
+
* Rule to disallow whitespace before properties.
|
| 1378 |
+
*
|
| 1379 |
+
* @since 2.0.0-beta.1
|
| 1380 |
+
* @see https://eslint.org/docs/rules/no-whitespace-before-property
|
| 1381 |
+
*/
|
| 1382 |
+
"no-whitespace-before-property": Linter.RuleEntry<[]>;
|
| 1383 |
+
|
| 1384 |
+
/**
|
| 1385 |
+
* Rule to enforce the location of single-line statements.
|
| 1386 |
+
*
|
| 1387 |
+
* @since 3.17.0
|
| 1388 |
+
* @see https://eslint.org/docs/rules/nonblock-statement-body-position
|
| 1389 |
+
*/
|
| 1390 |
+
"nonblock-statement-body-position": Linter.RuleEntry<
|
| 1391 |
+
[
|
| 1392 |
+
"beside" | "below" | "any",
|
| 1393 |
+
Partial<{
|
| 1394 |
+
overrides: Record<string, "beside" | "below" | "any">;
|
| 1395 |
+
}>,
|
| 1396 |
+
]
|
| 1397 |
+
>;
|
| 1398 |
+
|
| 1399 |
+
/**
|
| 1400 |
+
* Rule to enforce consistent line breaks inside braces.
|
| 1401 |
+
*
|
| 1402 |
+
* @since 2.12.0
|
| 1403 |
+
* @see https://eslint.org/docs/rules/object-curly-newline
|
| 1404 |
+
*/
|
| 1405 |
+
"object-curly-newline": Linter.RuleEntry<
|
| 1406 |
+
[
|
| 1407 |
+
| "always"
|
| 1408 |
+
| "never"
|
| 1409 |
+
| Partial<{
|
| 1410 |
+
/**
|
| 1411 |
+
* @default false
|
| 1412 |
+
*/
|
| 1413 |
+
multiline: boolean;
|
| 1414 |
+
minProperties: number;
|
| 1415 |
+
/**
|
| 1416 |
+
* @default true
|
| 1417 |
+
*/
|
| 1418 |
+
consistent: boolean;
|
| 1419 |
+
}>
|
| 1420 |
+
| Partial<
|
| 1421 |
+
Record<
|
| 1422 |
+
"ObjectExpression" | "ObjectPattern" | "ImportDeclaration" | "ExportDeclaration",
|
| 1423 |
+
| "always"
|
| 1424 |
+
| "never"
|
| 1425 |
+
| Partial<{
|
| 1426 |
+
/**
|
| 1427 |
+
* @default false
|
| 1428 |
+
*/
|
| 1429 |
+
multiline: boolean;
|
| 1430 |
+
minProperties: number;
|
| 1431 |
+
/**
|
| 1432 |
+
* @default true
|
| 1433 |
+
*/
|
| 1434 |
+
consistent: boolean;
|
| 1435 |
+
}>
|
| 1436 |
+
>
|
| 1437 |
+
>,
|
| 1438 |
+
]
|
| 1439 |
+
>;
|
| 1440 |
+
|
| 1441 |
+
/**
|
| 1442 |
+
* Rule to enforce consistent spacing inside braces.
|
| 1443 |
+
*
|
| 1444 |
+
* @since 0.22.0
|
| 1445 |
+
* @see https://eslint.org/docs/rules/object-curly-spacing
|
| 1446 |
+
*/
|
| 1447 |
+
"object-curly-spacing":
|
| 1448 |
+
| Linter.RuleEntry<
|
| 1449 |
+
[
|
| 1450 |
+
"never",
|
| 1451 |
+
{
|
| 1452 |
+
/**
|
| 1453 |
+
* @default false
|
| 1454 |
+
*/
|
| 1455 |
+
arraysInObjects: boolean;
|
| 1456 |
+
/**
|
| 1457 |
+
* @default false
|
| 1458 |
+
*/
|
| 1459 |
+
objectsInObjects: boolean;
|
| 1460 |
+
},
|
| 1461 |
+
]
|
| 1462 |
+
>
|
| 1463 |
+
| Linter.RuleEntry<
|
| 1464 |
+
[
|
| 1465 |
+
"always",
|
| 1466 |
+
{
|
| 1467 |
+
/**
|
| 1468 |
+
* @default true
|
| 1469 |
+
*/
|
| 1470 |
+
arraysInObjects: boolean;
|
| 1471 |
+
/**
|
| 1472 |
+
* @default true
|
| 1473 |
+
*/
|
| 1474 |
+
objectsInObjects: boolean;
|
| 1475 |
+
},
|
| 1476 |
+
]
|
| 1477 |
+
>;
|
| 1478 |
+
|
| 1479 |
+
/**
|
| 1480 |
+
* Rule to enforce placing object properties on separate lines.
|
| 1481 |
+
*
|
| 1482 |
+
* @since 2.10.0
|
| 1483 |
+
* @see https://eslint.org/docs/rules/object-property-newline
|
| 1484 |
+
*/
|
| 1485 |
+
"object-property-newline": Linter.RuleEntry<
|
| 1486 |
+
[
|
| 1487 |
+
Partial<{
|
| 1488 |
+
/**
|
| 1489 |
+
* @default false
|
| 1490 |
+
*/
|
| 1491 |
+
allowAllPropertiesOnSameLine: boolean;
|
| 1492 |
+
}>,
|
| 1493 |
+
]
|
| 1494 |
+
>;
|
| 1495 |
+
|
| 1496 |
+
/**
|
| 1497 |
+
* Rule to enforce variables to be declared either together or separately in functions.
|
| 1498 |
+
*
|
| 1499 |
+
* @since 0.0.9
|
| 1500 |
+
* @see https://eslint.org/docs/rules/one-var
|
| 1501 |
+
*/
|
| 1502 |
+
"one-var": Linter.RuleEntry<
|
| 1503 |
+
[
|
| 1504 |
+
| "always"
|
| 1505 |
+
| "never"
|
| 1506 |
+
| "consecutive"
|
| 1507 |
+
| Partial<
|
| 1508 |
+
{
|
| 1509 |
+
/**
|
| 1510 |
+
* @default false
|
| 1511 |
+
*/
|
| 1512 |
+
separateRequires: boolean;
|
| 1513 |
+
} & Record<"var" | "let" | "const", "always" | "never" | "consecutive">
|
| 1514 |
+
>
|
| 1515 |
+
| Partial<Record<"initialized" | "uninitialized", "always" | "never" | "consecutive">>,
|
| 1516 |
+
]
|
| 1517 |
+
>;
|
| 1518 |
+
|
| 1519 |
+
/**
|
| 1520 |
+
* Rule to require or disallow newlines around variable declarations.
|
| 1521 |
+
*
|
| 1522 |
+
* @since 2.0.0-beta.3
|
| 1523 |
+
* @see https://eslint.org/docs/rules/one-var-declaration-per-line
|
| 1524 |
+
*/
|
| 1525 |
+
"one-var-declaration-per-line": Linter.RuleEntry<["initializations" | "always"]>;
|
| 1526 |
+
|
| 1527 |
+
/**
|
| 1528 |
+
* Rule to require or disallow assignment operator shorthand where possible.
|
| 1529 |
+
*
|
| 1530 |
+
* @since 0.10.0
|
| 1531 |
+
* @see https://eslint.org/docs/rules/operator-assignment
|
| 1532 |
+
*/
|
| 1533 |
+
"operator-assignment": Linter.RuleEntry<["always" | "never"]>;
|
| 1534 |
+
|
| 1535 |
+
/**
|
| 1536 |
+
* Rule to enforce consistent linebreak style for operators.
|
| 1537 |
+
*
|
| 1538 |
+
* @since 0.19.0
|
| 1539 |
+
* @see https://eslint.org/docs/rules/operator-linebreak
|
| 1540 |
+
*/
|
| 1541 |
+
"operator-linebreak": Linter.RuleEntry<
|
| 1542 |
+
[
|
| 1543 |
+
"after" | "before" | "none",
|
| 1544 |
+
Partial<{
|
| 1545 |
+
overrides: Record<string, "after" | "before" | "none">;
|
| 1546 |
+
}>,
|
| 1547 |
+
]
|
| 1548 |
+
>;
|
| 1549 |
+
|
| 1550 |
+
/**
|
| 1551 |
+
* Rule to require or disallow padding within blocks.
|
| 1552 |
+
*
|
| 1553 |
+
* @since 0.9.0
|
| 1554 |
+
* @see https://eslint.org/docs/rules/padded-blocks
|
| 1555 |
+
*/
|
| 1556 |
+
"padded-blocks": Linter.RuleEntry<
|
| 1557 |
+
[
|
| 1558 |
+
"always" | "never" | Partial<Record<"blocks" | "classes" | "switches", "always" | "never">>,
|
| 1559 |
+
{
|
| 1560 |
+
/**
|
| 1561 |
+
* @default false
|
| 1562 |
+
*/
|
| 1563 |
+
allowSingleLineBlocks: boolean;
|
| 1564 |
+
},
|
| 1565 |
+
]
|
| 1566 |
+
>;
|
| 1567 |
+
|
| 1568 |
+
/**
|
| 1569 |
+
* Rule to require or disallow padding lines between statements.
|
| 1570 |
+
*
|
| 1571 |
+
* @since 4.0.0-beta.0
|
| 1572 |
+
* @see https://eslint.org/docs/rules/padding-line-between-statements
|
| 1573 |
+
*/
|
| 1574 |
+
"padding-line-between-statements": Linter.RuleEntry<
|
| 1575 |
+
[
|
| 1576 |
+
...Array<
|
| 1577 |
+
{
|
| 1578 |
+
blankLine: "any" | "never" | "always";
|
| 1579 |
+
} & Record<"prev" | "next", string | string[]>
|
| 1580 |
+
>,
|
| 1581 |
+
]
|
| 1582 |
+
>;
|
| 1583 |
+
|
| 1584 |
+
/**
|
| 1585 |
+
* Rule to disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead.
|
| 1586 |
+
*
|
| 1587 |
+
* @since 5.0.0-alpha.3
|
| 1588 |
+
* @see https://eslint.org/docs/rules/prefer-object-spread
|
| 1589 |
+
*/
|
| 1590 |
+
"prefer-object-spread": Linter.RuleEntry<[]>;
|
| 1591 |
+
|
| 1592 |
+
/**
|
| 1593 |
+
* Rule to require quotes around object literal property names.
|
| 1594 |
+
*
|
| 1595 |
+
* @since 0.0.6
|
| 1596 |
+
* @see https://eslint.org/docs/rules/quote-props
|
| 1597 |
+
*/
|
| 1598 |
+
"quote-props":
|
| 1599 |
+
| Linter.RuleEntry<["always" | "consistent"]>
|
| 1600 |
+
| Linter.RuleEntry<
|
| 1601 |
+
[
|
| 1602 |
+
"as-needed",
|
| 1603 |
+
Partial<{
|
| 1604 |
+
/**
|
| 1605 |
+
* @default false
|
| 1606 |
+
*/
|
| 1607 |
+
keywords: boolean;
|
| 1608 |
+
/**
|
| 1609 |
+
* @default true
|
| 1610 |
+
*/
|
| 1611 |
+
unnecessary: boolean;
|
| 1612 |
+
/**
|
| 1613 |
+
* @default false
|
| 1614 |
+
*/
|
| 1615 |
+
numbers: boolean;
|
| 1616 |
+
}>,
|
| 1617 |
+
]
|
| 1618 |
+
>
|
| 1619 |
+
| Linter.RuleEntry<
|
| 1620 |
+
[
|
| 1621 |
+
"consistent-as-needed",
|
| 1622 |
+
Partial<{
|
| 1623 |
+
/**
|
| 1624 |
+
* @default false
|
| 1625 |
+
*/
|
| 1626 |
+
keywords: boolean;
|
| 1627 |
+
}>,
|
| 1628 |
+
]
|
| 1629 |
+
>;
|
| 1630 |
+
|
| 1631 |
+
/**
|
| 1632 |
+
* Rule to enforce the consistent use of either backticks, double, or single quotes.
|
| 1633 |
+
*
|
| 1634 |
+
* @since 0.0.7
|
| 1635 |
+
* @see https://eslint.org/docs/rules/quotes
|
| 1636 |
+
*/
|
| 1637 |
+
quotes: Linter.RuleEntry<
|
| 1638 |
+
[
|
| 1639 |
+
"double" | "single" | "backtick",
|
| 1640 |
+
Partial<{
|
| 1641 |
+
/**
|
| 1642 |
+
* @default false
|
| 1643 |
+
*/
|
| 1644 |
+
avoidEscape: boolean;
|
| 1645 |
+
/**
|
| 1646 |
+
* @default false
|
| 1647 |
+
*/
|
| 1648 |
+
allowTemplateLiterals: boolean;
|
| 1649 |
+
}>,
|
| 1650 |
+
]
|
| 1651 |
+
>;
|
| 1652 |
+
|
| 1653 |
+
/**
|
| 1654 |
+
* Rule to require or disallow semicolons instead of ASI.
|
| 1655 |
+
*
|
| 1656 |
+
* @since 0.0.6
|
| 1657 |
+
* @see https://eslint.org/docs/rules/semi
|
| 1658 |
+
*/
|
| 1659 |
+
semi:
|
| 1660 |
+
| Linter.RuleEntry<
|
| 1661 |
+
[
|
| 1662 |
+
"always",
|
| 1663 |
+
Partial<{
|
| 1664 |
+
/**
|
| 1665 |
+
* @default false
|
| 1666 |
+
*/
|
| 1667 |
+
omitLastInOneLineBlock: boolean;
|
| 1668 |
+
}>,
|
| 1669 |
+
]
|
| 1670 |
+
>
|
| 1671 |
+
| Linter.RuleEntry<
|
| 1672 |
+
[
|
| 1673 |
+
"never",
|
| 1674 |
+
Partial<{
|
| 1675 |
+
/**
|
| 1676 |
+
* @default 'any'
|
| 1677 |
+
*/
|
| 1678 |
+
beforeStatementContinuationChars: "any" | "always" | "never";
|
| 1679 |
+
}>,
|
| 1680 |
+
]
|
| 1681 |
+
>;
|
| 1682 |
+
|
| 1683 |
+
/**
|
| 1684 |
+
* Rule to enforce consistent spacing before and after semicolons.
|
| 1685 |
+
*
|
| 1686 |
+
* @since 0.16.0
|
| 1687 |
+
* @see https://eslint.org/docs/rules/semi-spacing
|
| 1688 |
+
*/
|
| 1689 |
+
"semi-spacing": Linter.RuleEntry<
|
| 1690 |
+
[
|
| 1691 |
+
Partial<{
|
| 1692 |
+
/**
|
| 1693 |
+
* @default false
|
| 1694 |
+
*/
|
| 1695 |
+
before: boolean;
|
| 1696 |
+
/**
|
| 1697 |
+
* @default true
|
| 1698 |
+
*/
|
| 1699 |
+
after: boolean;
|
| 1700 |
+
}>,
|
| 1701 |
+
]
|
| 1702 |
+
>;
|
| 1703 |
+
|
| 1704 |
+
/**
|
| 1705 |
+
* Rule to enforce location of semicolons.
|
| 1706 |
+
*
|
| 1707 |
+
* @since 4.0.0-beta.0
|
| 1708 |
+
* @see https://eslint.org/docs/rules/semi-style
|
| 1709 |
+
*/
|
| 1710 |
+
"semi-style": Linter.RuleEntry<["last" | "first"]>;
|
| 1711 |
+
|
| 1712 |
+
/**
|
| 1713 |
+
* Rule to require object keys to be sorted.
|
| 1714 |
+
*
|
| 1715 |
+
* @since 3.3.0
|
| 1716 |
+
* @see https://eslint.org/docs/rules/sort-keys
|
| 1717 |
+
*/
|
| 1718 |
+
"sort-keys": Linter.RuleEntry<
|
| 1719 |
+
[
|
| 1720 |
+
"asc" | "desc",
|
| 1721 |
+
Partial<{
|
| 1722 |
+
/**
|
| 1723 |
+
* @default true
|
| 1724 |
+
*/
|
| 1725 |
+
caseSensitive: boolean;
|
| 1726 |
+
/**
|
| 1727 |
+
* @default 2
|
| 1728 |
+
*/
|
| 1729 |
+
minKeys: number;
|
| 1730 |
+
/**
|
| 1731 |
+
* @default false
|
| 1732 |
+
*/
|
| 1733 |
+
natural: boolean;
|
| 1734 |
+
/**
|
| 1735 |
+
* @default false
|
| 1736 |
+
*/
|
| 1737 |
+
allowLineSeparatedGroups: boolean;
|
| 1738 |
+
}>,
|
| 1739 |
+
]
|
| 1740 |
+
>;
|
| 1741 |
+
|
| 1742 |
+
/**
|
| 1743 |
+
* Rule to require variables within the same declaration block to be sorted.
|
| 1744 |
+
*
|
| 1745 |
+
* @since 0.2.0
|
| 1746 |
+
* @see https://eslint.org/docs/rules/sort-vars
|
| 1747 |
+
*/
|
| 1748 |
+
"sort-vars": Linter.RuleEntry<
|
| 1749 |
+
[
|
| 1750 |
+
Partial<{
|
| 1751 |
+
/**
|
| 1752 |
+
* @default false
|
| 1753 |
+
*/
|
| 1754 |
+
ignoreCase: boolean;
|
| 1755 |
+
}>,
|
| 1756 |
+
]
|
| 1757 |
+
>;
|
| 1758 |
+
|
| 1759 |
+
/**
|
| 1760 |
+
* Rule to enforce consistent spacing before blocks.
|
| 1761 |
+
*
|
| 1762 |
+
* @since 0.9.0
|
| 1763 |
+
* @see https://eslint.org/docs/rules/space-before-blocks
|
| 1764 |
+
*/
|
| 1765 |
+
"space-before-blocks": Linter.RuleEntry<
|
| 1766 |
+
["always" | "never" | Partial<Record<"functions" | "keywords" | "classes", "always" | "never" | "off">>]
|
| 1767 |
+
>;
|
| 1768 |
+
|
| 1769 |
+
/**
|
| 1770 |
+
* Rule to enforce consistent spacing before `function` definition opening parenthesis.
|
| 1771 |
+
*
|
| 1772 |
+
* @since 0.18.0
|
| 1773 |
+
* @see https://eslint.org/docs/rules/space-before-function-paren
|
| 1774 |
+
*/
|
| 1775 |
+
"space-before-function-paren": Linter.RuleEntry<
|
| 1776 |
+
["always" | "never" | Partial<Record<"anonymous" | "named" | "asyncArrow", "always" | "never" | "ignore">>]
|
| 1777 |
+
>;
|
| 1778 |
+
|
| 1779 |
+
/**
|
| 1780 |
+
* Rule to enforce consistent spacing inside parentheses.
|
| 1781 |
+
*
|
| 1782 |
+
* @since 0.8.0
|
| 1783 |
+
* @see https://eslint.org/docs/rules/space-in-parens
|
| 1784 |
+
*/
|
| 1785 |
+
"space-in-parens": Linter.RuleEntry<
|
| 1786 |
+
[
|
| 1787 |
+
"never" | "always",
|
| 1788 |
+
Partial<{
|
| 1789 |
+
exceptions: string[];
|
| 1790 |
+
}>,
|
| 1791 |
+
]
|
| 1792 |
+
>;
|
| 1793 |
+
|
| 1794 |
+
/**
|
| 1795 |
+
* Rule to require spacing around infix operators.
|
| 1796 |
+
*
|
| 1797 |
+
* @since 0.2.0
|
| 1798 |
+
* @see https://eslint.org/docs/rules/space-infix-ops
|
| 1799 |
+
*/
|
| 1800 |
+
"space-infix-ops": Linter.RuleEntry<
|
| 1801 |
+
[
|
| 1802 |
+
Partial<{
|
| 1803 |
+
/**
|
| 1804 |
+
* @default false
|
| 1805 |
+
*/
|
| 1806 |
+
int32Hint: boolean;
|
| 1807 |
+
}>,
|
| 1808 |
+
]
|
| 1809 |
+
>;
|
| 1810 |
+
|
| 1811 |
+
/**
|
| 1812 |
+
* Rule to enforce consistent spacing before or after unary operators.
|
| 1813 |
+
*
|
| 1814 |
+
* @since 0.10.0
|
| 1815 |
+
* @see https://eslint.org/docs/rules/space-unary-ops
|
| 1816 |
+
*/
|
| 1817 |
+
"space-unary-ops": Linter.RuleEntry<
|
| 1818 |
+
[
|
| 1819 |
+
Partial<{
|
| 1820 |
+
/**
|
| 1821 |
+
* @default true
|
| 1822 |
+
*/
|
| 1823 |
+
words: boolean;
|
| 1824 |
+
/**
|
| 1825 |
+
* @default false
|
| 1826 |
+
*/
|
| 1827 |
+
nonwords: boolean;
|
| 1828 |
+
overrides: Record<string, boolean>;
|
| 1829 |
+
}>,
|
| 1830 |
+
]
|
| 1831 |
+
>;
|
| 1832 |
+
|
| 1833 |
+
/**
|
| 1834 |
+
* Rule to enforce consistent spacing after the `//` or `/*` in a comment.
|
| 1835 |
+
*
|
| 1836 |
+
* @since 0.23.0
|
| 1837 |
+
* @see https://eslint.org/docs/rules/spaced-comment
|
| 1838 |
+
*/
|
| 1839 |
+
"spaced-comment": Linter.RuleEntry<
|
| 1840 |
+
[
|
| 1841 |
+
"always" | "never",
|
| 1842 |
+
{
|
| 1843 |
+
exceptions: string[];
|
| 1844 |
+
markers: string[];
|
| 1845 |
+
line: {
|
| 1846 |
+
exceptions: string[];
|
| 1847 |
+
markers: string[];
|
| 1848 |
+
};
|
| 1849 |
+
block: {
|
| 1850 |
+
exceptions: string[];
|
| 1851 |
+
markers: string[];
|
| 1852 |
+
/**
|
| 1853 |
+
* @default false
|
| 1854 |
+
*/
|
| 1855 |
+
balanced: boolean;
|
| 1856 |
+
};
|
| 1857 |
+
},
|
| 1858 |
+
]
|
| 1859 |
+
>;
|
| 1860 |
+
|
| 1861 |
+
/**
|
| 1862 |
+
* Rule to enforce spacing around colons of switch statements.
|
| 1863 |
+
*
|
| 1864 |
+
* @since 4.0.0-beta.0
|
| 1865 |
+
* @see https://eslint.org/docs/rules/switch-colon-spacing
|
| 1866 |
+
*/
|
| 1867 |
+
"switch-colon-spacing": Linter.RuleEntry<
|
| 1868 |
+
[
|
| 1869 |
+
Partial<{
|
| 1870 |
+
/**
|
| 1871 |
+
* @default false
|
| 1872 |
+
*/
|
| 1873 |
+
before: boolean;
|
| 1874 |
+
/**
|
| 1875 |
+
* @default true
|
| 1876 |
+
*/
|
| 1877 |
+
after: boolean;
|
| 1878 |
+
}>,
|
| 1879 |
+
]
|
| 1880 |
+
>;
|
| 1881 |
+
|
| 1882 |
+
/**
|
| 1883 |
+
* Rule to require or disallow spacing between template tags and their literals.
|
| 1884 |
+
*
|
| 1885 |
+
* @since 3.15.0
|
| 1886 |
+
* @see https://eslint.org/docs/rules/template-tag-spacing
|
| 1887 |
+
*/
|
| 1888 |
+
"template-tag-spacing": Linter.RuleEntry<["never" | "always"]>;
|
| 1889 |
+
|
| 1890 |
+
/**
|
| 1891 |
+
* Rule to require or disallow Unicode byte order mark (BOM).
|
| 1892 |
+
*
|
| 1893 |
+
* @since 2.11.0
|
| 1894 |
+
* @see https://eslint.org/docs/rules/unicode-bom
|
| 1895 |
+
*/
|
| 1896 |
+
"unicode-bom": Linter.RuleEntry<["never" | "always"]>;
|
| 1897 |
+
|
| 1898 |
+
/**
|
| 1899 |
+
* Rule to require parenthesis around regex literals.
|
| 1900 |
+
*
|
| 1901 |
+
* @since 0.1.0
|
| 1902 |
+
* @see https://eslint.org/docs/rules/wrap-regex
|
| 1903 |
+
*/
|
| 1904 |
+
"wrap-regex": Linter.RuleEntry<[]>;
|
| 1905 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/rules/variables.d.ts
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Linter } from "../index";
|
| 2 |
+
|
| 3 |
+
export interface Variables extends Linter.RulesRecord {
|
| 4 |
+
/**
|
| 5 |
+
* Rule to require or disallow initialization in variable declarations.
|
| 6 |
+
*
|
| 7 |
+
* @since 1.0.0-rc-1
|
| 8 |
+
* @see https://eslint.org/docs/rules/init-declarations
|
| 9 |
+
*/
|
| 10 |
+
"init-declarations":
|
| 11 |
+
| Linter.RuleEntry<["always"]>
|
| 12 |
+
| Linter.RuleEntry<
|
| 13 |
+
[
|
| 14 |
+
"never",
|
| 15 |
+
Partial<{
|
| 16 |
+
ignoreForLoopInit: boolean;
|
| 17 |
+
}>,
|
| 18 |
+
]
|
| 19 |
+
>;
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Rule to disallow deleting variables.
|
| 23 |
+
*
|
| 24 |
+
* @remarks
|
| 25 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 26 |
+
*
|
| 27 |
+
* @since 0.0.9
|
| 28 |
+
* @see https://eslint.org/docs/rules/no-delete-var
|
| 29 |
+
*/
|
| 30 |
+
"no-delete-var": Linter.RuleEntry<[]>;
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* Rule to disallow labels that share a name with a variable.
|
| 34 |
+
*
|
| 35 |
+
* @since 0.0.9
|
| 36 |
+
* @see https://eslint.org/docs/rules/no-label-var
|
| 37 |
+
*/
|
| 38 |
+
"no-label-var": Linter.RuleEntry<[]>;
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* Rule to disallow specified global variables.
|
| 42 |
+
*
|
| 43 |
+
* @since 2.3.0
|
| 44 |
+
* @see https://eslint.org/docs/rules/no-restricted-globals
|
| 45 |
+
*/
|
| 46 |
+
"no-restricted-globals": Linter.RuleEntry<
|
| 47 |
+
[
|
| 48 |
+
...Array<
|
| 49 |
+
| string
|
| 50 |
+
| {
|
| 51 |
+
name: string;
|
| 52 |
+
message?: string | undefined;
|
| 53 |
+
}
|
| 54 |
+
>,
|
| 55 |
+
]
|
| 56 |
+
>;
|
| 57 |
+
|
| 58 |
+
/**
|
| 59 |
+
* Rule to disallow variable declarations from shadowing variables declared in the outer scope.
|
| 60 |
+
*
|
| 61 |
+
* @since 0.0.9
|
| 62 |
+
* @see https://eslint.org/docs/rules/no-shadow
|
| 63 |
+
*/
|
| 64 |
+
"no-shadow": Linter.RuleEntry<
|
| 65 |
+
[
|
| 66 |
+
Partial<{
|
| 67 |
+
/**
|
| 68 |
+
* @default false
|
| 69 |
+
*/
|
| 70 |
+
builtinGlobals: boolean;
|
| 71 |
+
/**
|
| 72 |
+
* @default 'functions'
|
| 73 |
+
*/
|
| 74 |
+
hoist: "functions" | "all" | "never";
|
| 75 |
+
allow: string[];
|
| 76 |
+
}>,
|
| 77 |
+
]
|
| 78 |
+
>;
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* Rule to disallow identifiers from shadowing restricted names.
|
| 82 |
+
*
|
| 83 |
+
* @remarks
|
| 84 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 85 |
+
*
|
| 86 |
+
* @since 0.1.4
|
| 87 |
+
* @see https://eslint.org/docs/rules/no-shadow-restricted-names
|
| 88 |
+
*/
|
| 89 |
+
"no-shadow-restricted-names": Linter.RuleEntry<[]>;
|
| 90 |
+
|
| 91 |
+
/**
|
| 92 |
+
* Rule to disallow the use of undeclared variables unless mentioned in `global` comments.
|
| 93 |
+
*
|
| 94 |
+
* @remarks
|
| 95 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 96 |
+
*
|
| 97 |
+
* @since 0.0.9
|
| 98 |
+
* @see https://eslint.org/docs/rules/no-undef
|
| 99 |
+
*/
|
| 100 |
+
"no-undef": Linter.RuleEntry<
|
| 101 |
+
[
|
| 102 |
+
Partial<{
|
| 103 |
+
/**
|
| 104 |
+
* @default false
|
| 105 |
+
*/
|
| 106 |
+
typeof: boolean;
|
| 107 |
+
}>,
|
| 108 |
+
]
|
| 109 |
+
>;
|
| 110 |
+
|
| 111 |
+
/**
|
| 112 |
+
* Rule to disallow initializing variables to `undefined`.
|
| 113 |
+
*
|
| 114 |
+
* @since 0.0.6
|
| 115 |
+
* @see https://eslint.org/docs/rules/no-undef-init
|
| 116 |
+
*/
|
| 117 |
+
"no-undef-init": Linter.RuleEntry<[]>;
|
| 118 |
+
|
| 119 |
+
/**
|
| 120 |
+
* Rule to disallow the use of `undefined` as an identifier.
|
| 121 |
+
*
|
| 122 |
+
* @since 0.7.1
|
| 123 |
+
* @see https://eslint.org/docs/rules/no-undefined
|
| 124 |
+
*/
|
| 125 |
+
"no-undefined": Linter.RuleEntry<[]>;
|
| 126 |
+
|
| 127 |
+
/**
|
| 128 |
+
* Rule to disallow unused variables.
|
| 129 |
+
*
|
| 130 |
+
* @remarks
|
| 131 |
+
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
| 132 |
+
*
|
| 133 |
+
* @since 0.0.9
|
| 134 |
+
* @see https://eslint.org/docs/rules/no-unused-vars
|
| 135 |
+
*/
|
| 136 |
+
"no-unused-vars": Linter.RuleEntry<
|
| 137 |
+
[
|
| 138 |
+
| "all"
|
| 139 |
+
| "local"
|
| 140 |
+
| Partial<{
|
| 141 |
+
/**
|
| 142 |
+
* @default 'all'
|
| 143 |
+
*/
|
| 144 |
+
vars: "all" | "local";
|
| 145 |
+
varsIgnorePattern: string;
|
| 146 |
+
/**
|
| 147 |
+
* @default 'after-used'
|
| 148 |
+
*/
|
| 149 |
+
args: "after-used" | "all" | "none";
|
| 150 |
+
/**
|
| 151 |
+
* @default false
|
| 152 |
+
*/
|
| 153 |
+
ignoreRestSiblings: boolean;
|
| 154 |
+
argsIgnorePattern: string;
|
| 155 |
+
/**
|
| 156 |
+
* @default 'none'
|
| 157 |
+
*/
|
| 158 |
+
caughtErrors: "none" | "all";
|
| 159 |
+
caughtErrorsIgnorePattern: string;
|
| 160 |
+
destructuredArrayIgnorePattern: string;
|
| 161 |
+
}>,
|
| 162 |
+
]
|
| 163 |
+
>;
|
| 164 |
+
|
| 165 |
+
/**
|
| 166 |
+
* Rule to disallow the use of variables before they are defined.
|
| 167 |
+
*
|
| 168 |
+
* @since 0.0.9
|
| 169 |
+
* @see https://eslint.org/docs/rules/no-use-before-define
|
| 170 |
+
*/
|
| 171 |
+
"no-use-before-define": Linter.RuleEntry<
|
| 172 |
+
[
|
| 173 |
+
| Partial<{
|
| 174 |
+
/**
|
| 175 |
+
* @default true
|
| 176 |
+
*/
|
| 177 |
+
functions: boolean;
|
| 178 |
+
/**
|
| 179 |
+
* @default true
|
| 180 |
+
*/
|
| 181 |
+
classes: boolean;
|
| 182 |
+
/**
|
| 183 |
+
* @default true
|
| 184 |
+
*/
|
| 185 |
+
variables: boolean;
|
| 186 |
+
/**
|
| 187 |
+
* @default false
|
| 188 |
+
*/
|
| 189 |
+
allowNamedExports: boolean;
|
| 190 |
+
}>
|
| 191 |
+
| "nofunc",
|
| 192 |
+
]
|
| 193 |
+
>;
|
| 194 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/eslint/use-at-your-own-risk.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/** @deprecated */
|
| 2 |
+
export const builtinRules: Map<string, import("./index.js").Rule.RuleModule>;
|
| 3 |
+
/** @deprecated */
|
| 4 |
+
export class FileEnumerator {
|
| 5 |
+
constructor(
|
| 6 |
+
params?: {
|
| 7 |
+
cwd?: string;
|
| 8 |
+
configArrayFactory?: any;
|
| 9 |
+
extensions?: any;
|
| 10 |
+
globInputPaths?: boolean;
|
| 11 |
+
errorOnUnmatchedPattern?: boolean;
|
| 12 |
+
ignore?: boolean;
|
| 13 |
+
},
|
| 14 |
+
);
|
| 15 |
+
isTargetPath(filePath: string, providedConfig?: any): boolean;
|
| 16 |
+
iterateFiles(
|
| 17 |
+
patternOrPatterns: string | string[],
|
| 18 |
+
): IterableIterator<{ config: any; filePath: string; ignored: boolean }>;
|
| 19 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/estree/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/estree/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/estree`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for estree (https://github.com/estree/estree).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Fri, 06 Jun 2025 00:04:33 GMT
|
| 12 |
+
* Dependencies: none
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [RReverser](https://github.com/RReverser).
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/estree/flow.d.ts
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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face FlowBaseTypeAnnotation extends FlowTypeAnnotation {}
|
| 5 |
+
|
| 6 |
+
interface FlowLiteralTypeAnnotation extends FlowTypeAnnotation, Literal {}
|
| 7 |
+
|
| 8 |
+
interface FlowDeclaration extends Declaration {}
|
| 9 |
+
|
| 10 |
+
interface AnyTypeAnnotation extends FlowBaseTypeAnnotation {}
|
| 11 |
+
|
| 12 |
+
interface ArrayTypeAnnotation extends FlowTypeAnnotation {
|
| 13 |
+
elementType: FlowTypeAnnotation;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
interface BooleanLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
|
| 17 |
+
|
| 18 |
+
interface BooleanTypeAnnotation extends FlowBaseTypeAnnotation {}
|
| 19 |
+
|
| 20 |
+
interface ClassImplements extends Node {
|
| 21 |
+
id: Identifier;
|
| 22 |
+
typeParameters?: TypeParameterInstantiation | null;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
interface ClassProperty {
|
| 26 |
+
key: Expression;
|
| 27 |
+
value?: Expression | null;
|
| 28 |
+
typeAnnotation?: TypeAnnotation | null;
|
| 29 |
+
computed: boolean;
|
| 30 |
+
static: boolean;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
interface DeclareClass extends FlowDeclaration {
|
| 34 |
+
id: Identifier;
|
| 35 |
+
typeParameters?: TypeParameterDeclaration | null;
|
| 36 |
+
body: ObjectTypeAnnotation;
|
| 37 |
+
extends: InterfaceExtends[];
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
interface DeclareFunction extends FlowDeclaration {
|
| 41 |
+
id: Identifier;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
interface DeclareModule extends FlowDeclaration {
|
| 45 |
+
id: Literal | Identifier;
|
| 46 |
+
body: BlockStatement;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
interface DeclareVariable extends FlowDeclaration {
|
| 50 |
+
id: Identifier;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
interface FunctionTypeAnnotation extends FlowTypeAnnotation {
|
| 54 |
+
params: FunctionTypeParam[];
|
| 55 |
+
returnType: FlowTypeAnnotation;
|
| 56 |
+
rest?: FunctionTypeParam | null;
|
| 57 |
+
typeParameters?: TypeParameterDeclaration | null;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
interface FunctionTypeParam {
|
| 61 |
+
name: Identifier;
|
| 62 |
+
typeAnnotation: FlowTypeAnnotation;
|
| 63 |
+
optional: boolean;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
interface GenericTypeAnnotation extends FlowTypeAnnotation {
|
| 67 |
+
id: Identifier | QualifiedTypeIdentifier;
|
| 68 |
+
typeParameters?: TypeParameterInstantiation | null;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
interface InterfaceExtends extends Node {
|
| 72 |
+
id: Identifier | QualifiedTypeIdentifier;
|
| 73 |
+
typeParameters?: TypeParameterInstantiation | null;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
interface InterfaceDeclaration extends FlowDeclaration {
|
| 77 |
+
id: Identifier;
|
| 78 |
+
typeParameters?: TypeParameterDeclaration | null;
|
| 79 |
+
extends: InterfaceExtends[];
|
| 80 |
+
body: ObjectTypeAnnotation;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
interface IntersectionTypeAnnotation extends FlowTypeAnnotation {
|
| 84 |
+
types: FlowTypeAnnotation[];
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
interface MixedTypeAnnotation extends FlowBaseTypeAnnotation {}
|
| 88 |
+
|
| 89 |
+
interface NullableTypeAnnotation extends FlowTypeAnnotation {
|
| 90 |
+
typeAnnotation: TypeAnnotation;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
interface NumberLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
|
| 94 |
+
|
| 95 |
+
interface NumberTypeAnnotation extends FlowBaseTypeAnnotation {}
|
| 96 |
+
|
| 97 |
+
interface StringLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
|
| 98 |
+
|
| 99 |
+
interface StringTypeAnnotation extends FlowBaseTypeAnnotation {}
|
| 100 |
+
|
| 101 |
+
interface TupleTypeAnnotation extends FlowTypeAnnotation {
|
| 102 |
+
types: FlowTypeAnnotation[];
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
interface TypeofTypeAnnotation extends FlowTypeAnnotation {
|
| 106 |
+
argument: FlowTypeAnnotation;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
interface TypeAlias extends FlowDeclaration {
|
| 110 |
+
id: Identifier;
|
| 111 |
+
typeParameters?: TypeParameterDeclaration | null;
|
| 112 |
+
right: FlowTypeAnnotation;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
interface TypeAnnotation extends Node {
|
| 116 |
+
typeAnnotation: FlowTypeAnnotation;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
interface TypeCastExpression extends Expression {
|
| 120 |
+
expression: Expression;
|
| 121 |
+
typeAnnotation: TypeAnnotation;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
interface TypeParameterDeclaration extends Node {
|
| 125 |
+
params: Identifier[];
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
interface TypeParameterInstantiation extends Node {
|
| 129 |
+
params: FlowTypeAnnotation[];
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
interface ObjectTypeAnnotation extends FlowTypeAnnotation {
|
| 133 |
+
properties: ObjectTypeProperty[];
|
| 134 |
+
indexers: ObjectTypeIndexer[];
|
| 135 |
+
callProperties: ObjectTypeCallProperty[];
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
interface ObjectTypeCallProperty extends Node {
|
| 139 |
+
value: FunctionTypeAnnotation;
|
| 140 |
+
static: boolean;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
interface ObjectTypeIndexer extends Node {
|
| 144 |
+
id: Identifier;
|
| 145 |
+
key: FlowTypeAnnotation;
|
| 146 |
+
value: FlowTypeAnnotation;
|
| 147 |
+
static: boolean;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
interface ObjectTypeProperty extends Node {
|
| 151 |
+
key: Expression;
|
| 152 |
+
value: FlowTypeAnnotation;
|
| 153 |
+
optional: boolean;
|
| 154 |
+
static: boolean;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
interface QualifiedTypeIdentifier extends Node {
|
| 158 |
+
qualification: Identifier | QualifiedTypeIdentifier;
|
| 159 |
+
id: Identifier;
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
interface UnionTypeAnnotation extends FlowTypeAnnotation {
|
| 163 |
+
types: FlowTypeAnnotation[];
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
interface VoidTypeAnnotation extends FlowBaseTypeAnnotation {}
|
| 167 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/estree/index.d.ts
ADDED
|
@@ -0,0 +1,694 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// This definition file follows a somewhat unusual format. ESTree allows
|
| 2 |
+
// runtime type checks based on the `type` parameter. In order to explain this
|
| 3 |
+
// to typescript we want to use discriminated union types:
|
| 4 |
+
// https://github.com/Microsoft/TypeScript/pull/9163
|
| 5 |
+
//
|
| 6 |
+
// For ESTree this is a bit tricky because the high level interfaces like
|
| 7 |
+
// Node or Function are pulling double duty. We want to pass common fields down
|
| 8 |
+
// to the interfaces that extend them (like Identifier or
|
| 9 |
+
// ArrowFunctionExpression), but you can't extend a type union or enforce
|
| 10 |
+
// common fields on them. So we've split the high level interfaces into two
|
| 11 |
+
// types, a base type which passes down inherited fields, and a type union of
|
| 12 |
+
// all types which extend the base type. Only the type union is exported, and
|
| 13 |
+
// the union is how other types refer to the collection of inheriting types.
|
| 14 |
+
//
|
| 15 |
+
// This makes the definitions file here somewhat more difficult to maintain,
|
| 16 |
+
// but it has the notable advantage of making ESTree much easier to use as
|
| 17 |
+
// an end user.
|
| 18 |
+
|
| 19 |
+
export interface BaseNodeWithoutComments {
|
| 20 |
+
// Every leaf interface that extends BaseNode must specify a type property.
|
| 21 |
+
// The type property should be a string literal. For example, Identifier
|
| 22 |
+
// has: `type: "Identifier"`
|
| 23 |
+
type: string;
|
| 24 |
+
loc?: SourceLocation | null | undefined;
|
| 25 |
+
range?: [number, number] | undefined;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
export interface BaseNode extends BaseNodeWithoutComments {
|
| 29 |
+
leadingComments?: Comment[] | undefined;
|
| 30 |
+
trailingComments?: Comment[] | undefined;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
export interface NodeMap {
|
| 34 |
+
AssignmentProperty: AssignmentProperty;
|
| 35 |
+
CatchClause: CatchClause;
|
| 36 |
+
Class: Class;
|
| 37 |
+
ClassBody: ClassBody;
|
| 38 |
+
Expression: Expression;
|
| 39 |
+
Function: Function;
|
| 40 |
+
Identifier: Identifier;
|
| 41 |
+
Literal: Literal;
|
| 42 |
+
MethodDefinition: MethodDefinition;
|
| 43 |
+
ModuleDeclaration: ModuleDeclaration;
|
| 44 |
+
ModuleSpecifier: ModuleSpecifier;
|
| 45 |
+
Pattern: Pattern;
|
| 46 |
+
PrivateIdentifier: PrivateIdentifier;
|
| 47 |
+
Program: Program;
|
| 48 |
+
Property: Property;
|
| 49 |
+
PropertyDefinition: PropertyDefinition;
|
| 50 |
+
SpreadElement: SpreadElement;
|
| 51 |
+
Statement: Statement;
|
| 52 |
+
Super: Super;
|
| 53 |
+
SwitchCase: SwitchCase;
|
| 54 |
+
TemplateElement: TemplateElement;
|
| 55 |
+
VariableDeclarator: VariableDeclarator;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
export type Node = NodeMap[keyof NodeMap];
|
| 59 |
+
|
| 60 |
+
export interface Comment extends BaseNodeWithoutComments {
|
| 61 |
+
type: "Line" | "Block";
|
| 62 |
+
value: string;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
export interface SourceLocation {
|
| 66 |
+
source?: string | null | undefined;
|
| 67 |
+
start: Position;
|
| 68 |
+
end: Position;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
export interface Position {
|
| 72 |
+
/** >= 1 */
|
| 73 |
+
line: number;
|
| 74 |
+
/** >= 0 */
|
| 75 |
+
column: number;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
export interface Program extends BaseNode {
|
| 79 |
+
type: "Program";
|
| 80 |
+
sourceType: "script" | "module";
|
| 81 |
+
body: Array<Directive | Statement | ModuleDeclaration>;
|
| 82 |
+
comments?: Comment[] | undefined;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
export interface Directive extends BaseNode {
|
| 86 |
+
type: "ExpressionStatement";
|
| 87 |
+
expression: Literal;
|
| 88 |
+
directive: string;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
export interface BaseFunction extends BaseNode {
|
| 92 |
+
params: Pattern[];
|
| 93 |
+
generator?: boolean | undefined;
|
| 94 |
+
async?: boolean | undefined;
|
| 95 |
+
// The body is either BlockStatement or Expression because arrow functions
|
| 96 |
+
// can have a body that's either. FunctionDeclarations and
|
| 97 |
+
// FunctionExpressions have only BlockStatement bodies.
|
| 98 |
+
body: BlockStatement | Expression;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
export type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
|
| 102 |
+
|
| 103 |
+
export type Statement =
|
| 104 |
+
| ExpressionStatement
|
| 105 |
+
| BlockStatement
|
| 106 |
+
| StaticBlock
|
| 107 |
+
| EmptyStatement
|
| 108 |
+
| DebuggerStatement
|
| 109 |
+
| WithStatement
|
| 110 |
+
| ReturnStatement
|
| 111 |
+
| LabeledStatement
|
| 112 |
+
| BreakStatement
|
| 113 |
+
| ContinueStatement
|
| 114 |
+
| IfStatement
|
| 115 |
+
| SwitchStatement
|
| 116 |
+
| ThrowStatement
|
| 117 |
+
| TryStatement
|
| 118 |
+
| WhileStatement
|
| 119 |
+
| DoWhileStatement
|
| 120 |
+
| ForStatement
|
| 121 |
+
| ForInStatement
|
| 122 |
+
| ForOfStatement
|
| 123 |
+
| Declaration;
|
| 124 |
+
|
| 125 |
+
export interface BaseStatement extends BaseNode {}
|
| 126 |
+
|
| 127 |
+
export interface EmptyStatement extends BaseStatement {
|
| 128 |
+
type: "EmptyStatement";
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
export interface BlockStatement extends BaseStatement {
|
| 132 |
+
type: "BlockStatement";
|
| 133 |
+
body: Statement[];
|
| 134 |
+
innerComments?: Comment[] | undefined;
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
export interface StaticBlock extends Omit<BlockStatement, "type"> {
|
| 138 |
+
type: "StaticBlock";
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
export interface ExpressionStatement extends BaseStatement {
|
| 142 |
+
type: "ExpressionStatement";
|
| 143 |
+
expression: Expression;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
export interface IfStatement extends BaseStatement {
|
| 147 |
+
type: "IfStatement";
|
| 148 |
+
test: Expression;
|
| 149 |
+
consequent: Statement;
|
| 150 |
+
alternate?: Statement | null | undefined;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
export interface LabeledStatement extends BaseStatement {
|
| 154 |
+
type: "LabeledStatement";
|
| 155 |
+
label: Identifier;
|
| 156 |
+
body: Statement;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
export interface BreakStatement extends BaseStatement {
|
| 160 |
+
type: "BreakStatement";
|
| 161 |
+
label?: Identifier | null | undefined;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
export interface ContinueStatement extends BaseStatement {
|
| 165 |
+
type: "ContinueStatement";
|
| 166 |
+
label?: Identifier | null | undefined;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
export interface WithStatement extends BaseStatement {
|
| 170 |
+
type: "WithStatement";
|
| 171 |
+
object: Expression;
|
| 172 |
+
body: Statement;
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
export interface SwitchStatement extends BaseStatement {
|
| 176 |
+
type: "SwitchStatement";
|
| 177 |
+
discriminant: Expression;
|
| 178 |
+
cases: SwitchCase[];
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
export interface ReturnStatement extends BaseStatement {
|
| 182 |
+
type: "ReturnStatement";
|
| 183 |
+
argument?: Expression | null | undefined;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
export interface ThrowStatement extends BaseStatement {
|
| 187 |
+
type: "ThrowStatement";
|
| 188 |
+
argument: Expression;
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
export interface TryStatement extends BaseStatement {
|
| 192 |
+
type: "TryStatement";
|
| 193 |
+
block: BlockStatement;
|
| 194 |
+
handler?: CatchClause | null | undefined;
|
| 195 |
+
finalizer?: BlockStatement | null | undefined;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
export interface WhileStatement extends BaseStatement {
|
| 199 |
+
type: "WhileStatement";
|
| 200 |
+
test: Expression;
|
| 201 |
+
body: Statement;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
export interface DoWhileStatement extends BaseStatement {
|
| 205 |
+
type: "DoWhileStatement";
|
| 206 |
+
body: Statement;
|
| 207 |
+
test: Expression;
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
export interface ForStatement extends BaseStatement {
|
| 211 |
+
type: "ForStatement";
|
| 212 |
+
init?: VariableDeclaration | Expression | null | undefined;
|
| 213 |
+
test?: Expression | null | undefined;
|
| 214 |
+
update?: Expression | null | undefined;
|
| 215 |
+
body: Statement;
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
export interface BaseForXStatement extends BaseStatement {
|
| 219 |
+
left: VariableDeclaration | Pattern;
|
| 220 |
+
right: Expression;
|
| 221 |
+
body: Statement;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
export interface ForInStatement extends BaseForXStatement {
|
| 225 |
+
type: "ForInStatement";
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
export interface DebuggerStatement extends BaseStatement {
|
| 229 |
+
type: "DebuggerStatement";
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
|
| 233 |
+
|
| 234 |
+
export interface BaseDeclaration extends BaseStatement {}
|
| 235 |
+
|
| 236 |
+
export interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration {
|
| 237 |
+
type: "FunctionDeclaration";
|
| 238 |
+
/** It is null when a function declaration is a part of the `export default function` statement */
|
| 239 |
+
id: Identifier | null;
|
| 240 |
+
body: BlockStatement;
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
export interface FunctionDeclaration extends MaybeNamedFunctionDeclaration {
|
| 244 |
+
id: Identifier;
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
export interface VariableDeclaration extends BaseDeclaration {
|
| 248 |
+
type: "VariableDeclaration";
|
| 249 |
+
declarations: VariableDeclarator[];
|
| 250 |
+
kind: "var" | "let" | "const" | "using" | "await using";
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
export interface VariableDeclarator extends BaseNode {
|
| 254 |
+
type: "VariableDeclarator";
|
| 255 |
+
id: Pattern;
|
| 256 |
+
init?: Expression | null | undefined;
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
export interface ExpressionMap {
|
| 260 |
+
ArrayExpression: ArrayExpression;
|
| 261 |
+
ArrowFunctionExpression: ArrowFunctionExpression;
|
| 262 |
+
AssignmentExpression: AssignmentExpression;
|
| 263 |
+
AwaitExpression: AwaitExpression;
|
| 264 |
+
BinaryExpression: BinaryExpression;
|
| 265 |
+
CallExpression: CallExpression;
|
| 266 |
+
ChainExpression: ChainExpression;
|
| 267 |
+
ClassExpression: ClassExpression;
|
| 268 |
+
ConditionalExpression: ConditionalExpression;
|
| 269 |
+
FunctionExpression: FunctionExpression;
|
| 270 |
+
Identifier: Identifier;
|
| 271 |
+
ImportExpression: ImportExpression;
|
| 272 |
+
Literal: Literal;
|
| 273 |
+
LogicalExpression: LogicalExpression;
|
| 274 |
+
MemberExpression: MemberExpression;
|
| 275 |
+
MetaProperty: MetaProperty;
|
| 276 |
+
NewExpression: NewExpression;
|
| 277 |
+
ObjectExpression: ObjectExpression;
|
| 278 |
+
SequenceExpression: SequenceExpression;
|
| 279 |
+
TaggedTemplateExpression: TaggedTemplateExpression;
|
| 280 |
+
TemplateLiteral: TemplateLiteral;
|
| 281 |
+
ThisExpression: ThisExpression;
|
| 282 |
+
UnaryExpression: UnaryExpression;
|
| 283 |
+
UpdateExpression: UpdateExpression;
|
| 284 |
+
YieldExpression: YieldExpression;
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
export type Expression = ExpressionMap[keyof ExpressionMap];
|
| 288 |
+
|
| 289 |
+
export interface BaseExpression extends BaseNode {}
|
| 290 |
+
|
| 291 |
+
export type ChainElement = SimpleCallExpression | MemberExpression;
|
| 292 |
+
|
| 293 |
+
export interface ChainExpression extends BaseExpression {
|
| 294 |
+
type: "ChainExpression";
|
| 295 |
+
expression: ChainElement;
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
export interface ThisExpression extends BaseExpression {
|
| 299 |
+
type: "ThisExpression";
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
export interface ArrayExpression extends BaseExpression {
|
| 303 |
+
type: "ArrayExpression";
|
| 304 |
+
elements: Array<Expression | SpreadElement | null>;
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
export interface ObjectExpression extends BaseExpression {
|
| 308 |
+
type: "ObjectExpression";
|
| 309 |
+
properties: Array<Property | SpreadElement>;
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
export interface PrivateIdentifier extends BaseNode {
|
| 313 |
+
type: "PrivateIdentifier";
|
| 314 |
+
name: string;
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
export interface Property extends BaseNode {
|
| 318 |
+
type: "Property";
|
| 319 |
+
key: Expression | PrivateIdentifier;
|
| 320 |
+
value: Expression | Pattern; // Could be an AssignmentProperty
|
| 321 |
+
kind: "init" | "get" | "set";
|
| 322 |
+
method: boolean;
|
| 323 |
+
shorthand: boolean;
|
| 324 |
+
computed: boolean;
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
export interface PropertyDefinition extends BaseNode {
|
| 328 |
+
type: "PropertyDefinition";
|
| 329 |
+
key: Expression | PrivateIdentifier;
|
| 330 |
+
value?: Expression | null | undefined;
|
| 331 |
+
computed: boolean;
|
| 332 |
+
static: boolean;
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
export interface FunctionExpression extends BaseFunction, BaseExpression {
|
| 336 |
+
id?: Identifier | null | undefined;
|
| 337 |
+
type: "FunctionExpression";
|
| 338 |
+
body: BlockStatement;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
export interface SequenceExpression extends BaseExpression {
|
| 342 |
+
type: "SequenceExpression";
|
| 343 |
+
expressions: Expression[];
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
export interface UnaryExpression extends BaseExpression {
|
| 347 |
+
type: "UnaryExpression";
|
| 348 |
+
operator: UnaryOperator;
|
| 349 |
+
prefix: true;
|
| 350 |
+
argument: Expression;
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
export interface BinaryExpression extends BaseExpression {
|
| 354 |
+
type: "BinaryExpression";
|
| 355 |
+
operator: BinaryOperator;
|
| 356 |
+
left: Expression | PrivateIdentifier;
|
| 357 |
+
right: Expression;
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
export interface AssignmentExpression extends BaseExpression {
|
| 361 |
+
type: "AssignmentExpression";
|
| 362 |
+
operator: AssignmentOperator;
|
| 363 |
+
left: Pattern | MemberExpression;
|
| 364 |
+
right: Expression;
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
export interface UpdateExpression extends BaseExpression {
|
| 368 |
+
type: "UpdateExpression";
|
| 369 |
+
operator: UpdateOperator;
|
| 370 |
+
argument: Expression;
|
| 371 |
+
prefix: boolean;
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
export interface LogicalExpression extends BaseExpression {
|
| 375 |
+
type: "LogicalExpression";
|
| 376 |
+
operator: LogicalOperator;
|
| 377 |
+
left: Expression;
|
| 378 |
+
right: Expression;
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
export interface ConditionalExpression extends BaseExpression {
|
| 382 |
+
type: "ConditionalExpression";
|
| 383 |
+
test: Expression;
|
| 384 |
+
alternate: Expression;
|
| 385 |
+
consequent: Expression;
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
export interface BaseCallExpression extends BaseExpression {
|
| 389 |
+
callee: Expression | Super;
|
| 390 |
+
arguments: Array<Expression | SpreadElement>;
|
| 391 |
+
}
|
| 392 |
+
export type CallExpression = SimpleCallExpression | NewExpression;
|
| 393 |
+
|
| 394 |
+
export interface SimpleCallExpression extends BaseCallExpression {
|
| 395 |
+
type: "CallExpression";
|
| 396 |
+
optional: boolean;
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
export interface NewExpression extends BaseCallExpression {
|
| 400 |
+
type: "NewExpression";
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
export interface MemberExpression extends BaseExpression, BasePattern {
|
| 404 |
+
type: "MemberExpression";
|
| 405 |
+
object: Expression | Super;
|
| 406 |
+
property: Expression | PrivateIdentifier;
|
| 407 |
+
computed: boolean;
|
| 408 |
+
optional: boolean;
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
|
| 412 |
+
|
| 413 |
+
export interface BasePattern extends BaseNode {}
|
| 414 |
+
|
| 415 |
+
export interface SwitchCase extends BaseNode {
|
| 416 |
+
type: "SwitchCase";
|
| 417 |
+
test?: Expression | null | undefined;
|
| 418 |
+
consequent: Statement[];
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
export interface CatchClause extends BaseNode {
|
| 422 |
+
type: "CatchClause";
|
| 423 |
+
param: Pattern | null;
|
| 424 |
+
body: BlockStatement;
|
| 425 |
+
}
|
| 426 |
+
|
| 427 |
+
export interface Identifier extends BaseNode, BaseExpression, BasePattern {
|
| 428 |
+
type: "Identifier";
|
| 429 |
+
name: string;
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
export type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral;
|
| 433 |
+
|
| 434 |
+
export interface SimpleLiteral extends BaseNode, BaseExpression {
|
| 435 |
+
type: "Literal";
|
| 436 |
+
value: string | boolean | number | null;
|
| 437 |
+
raw?: string | undefined;
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
export interface RegExpLiteral extends BaseNode, BaseExpression {
|
| 441 |
+
type: "Literal";
|
| 442 |
+
value?: RegExp | null | undefined;
|
| 443 |
+
regex: {
|
| 444 |
+
pattern: string;
|
| 445 |
+
flags: string;
|
| 446 |
+
};
|
| 447 |
+
raw?: string | undefined;
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
export interface BigIntLiteral extends BaseNode, BaseExpression {
|
| 451 |
+
type: "Literal";
|
| 452 |
+
value?: bigint | null | undefined;
|
| 453 |
+
bigint: string;
|
| 454 |
+
raw?: string | undefined;
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
| 458 |
+
|
| 459 |
+
export type BinaryOperator =
|
| 460 |
+
| "=="
|
| 461 |
+
| "!="
|
| 462 |
+
| "==="
|
| 463 |
+
| "!=="
|
| 464 |
+
| "<"
|
| 465 |
+
| "<="
|
| 466 |
+
| ">"
|
| 467 |
+
| ">="
|
| 468 |
+
| "<<"
|
| 469 |
+
| ">>"
|
| 470 |
+
| ">>>"
|
| 471 |
+
| "+"
|
| 472 |
+
| "-"
|
| 473 |
+
| "*"
|
| 474 |
+
| "/"
|
| 475 |
+
| "%"
|
| 476 |
+
| "**"
|
| 477 |
+
| "|"
|
| 478 |
+
| "^"
|
| 479 |
+
| "&"
|
| 480 |
+
| "in"
|
| 481 |
+
| "instanceof";
|
| 482 |
+
|
| 483 |
+
export type LogicalOperator = "||" | "&&" | "??";
|
| 484 |
+
|
| 485 |
+
export type AssignmentOperator =
|
| 486 |
+
| "="
|
| 487 |
+
| "+="
|
| 488 |
+
| "-="
|
| 489 |
+
| "*="
|
| 490 |
+
| "/="
|
| 491 |
+
| "%="
|
| 492 |
+
| "**="
|
| 493 |
+
| "<<="
|
| 494 |
+
| ">>="
|
| 495 |
+
| ">>>="
|
| 496 |
+
| "|="
|
| 497 |
+
| "^="
|
| 498 |
+
| "&="
|
| 499 |
+
| "||="
|
| 500 |
+
| "&&="
|
| 501 |
+
| "??=";
|
| 502 |
+
|
| 503 |
+
export type UpdateOperator = "++" | "--";
|
| 504 |
+
|
| 505 |
+
export interface ForOfStatement extends BaseForXStatement {
|
| 506 |
+
type: "ForOfStatement";
|
| 507 |
+
await: boolean;
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
export interface Super extends BaseNode {
|
| 511 |
+
type: "Super";
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
+
export interface SpreadElement extends BaseNode {
|
| 515 |
+
type: "SpreadElement";
|
| 516 |
+
argument: Expression;
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
export interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
|
| 520 |
+
type: "ArrowFunctionExpression";
|
| 521 |
+
expression: boolean;
|
| 522 |
+
body: BlockStatement | Expression;
|
| 523 |
+
}
|
| 524 |
+
|
| 525 |
+
export interface YieldExpression extends BaseExpression {
|
| 526 |
+
type: "YieldExpression";
|
| 527 |
+
argument?: Expression | null | undefined;
|
| 528 |
+
delegate: boolean;
|
| 529 |
+
}
|
| 530 |
+
|
| 531 |
+
export interface TemplateLiteral extends BaseExpression {
|
| 532 |
+
type: "TemplateLiteral";
|
| 533 |
+
quasis: TemplateElement[];
|
| 534 |
+
expressions: Expression[];
|
| 535 |
+
}
|
| 536 |
+
|
| 537 |
+
export interface TaggedTemplateExpression extends BaseExpression {
|
| 538 |
+
type: "TaggedTemplateExpression";
|
| 539 |
+
tag: Expression;
|
| 540 |
+
quasi: TemplateLiteral;
|
| 541 |
+
}
|
| 542 |
+
|
| 543 |
+
export interface TemplateElement extends BaseNode {
|
| 544 |
+
type: "TemplateElement";
|
| 545 |
+
tail: boolean;
|
| 546 |
+
value: {
|
| 547 |
+
/** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */
|
| 548 |
+
cooked?: string | null | undefined;
|
| 549 |
+
raw: string;
|
| 550 |
+
};
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
export interface AssignmentProperty extends Property {
|
| 554 |
+
value: Pattern;
|
| 555 |
+
kind: "init";
|
| 556 |
+
method: boolean; // false
|
| 557 |
+
}
|
| 558 |
+
|
| 559 |
+
export interface ObjectPattern extends BasePattern {
|
| 560 |
+
type: "ObjectPattern";
|
| 561 |
+
properties: Array<AssignmentProperty | RestElement>;
|
| 562 |
+
}
|
| 563 |
+
|
| 564 |
+
export interface ArrayPattern extends BasePattern {
|
| 565 |
+
type: "ArrayPattern";
|
| 566 |
+
elements: Array<Pattern | null>;
|
| 567 |
+
}
|
| 568 |
+
|
| 569 |
+
export interface RestElement extends BasePattern {
|
| 570 |
+
type: "RestElement";
|
| 571 |
+
argument: Pattern;
|
| 572 |
+
}
|
| 573 |
+
|
| 574 |
+
export interface AssignmentPattern extends BasePattern {
|
| 575 |
+
type: "AssignmentPattern";
|
| 576 |
+
left: Pattern;
|
| 577 |
+
right: Expression;
|
| 578 |
+
}
|
| 579 |
+
|
| 580 |
+
export type Class = ClassDeclaration | ClassExpression;
|
| 581 |
+
export interface BaseClass extends BaseNode {
|
| 582 |
+
superClass?: Expression | null | undefined;
|
| 583 |
+
body: ClassBody;
|
| 584 |
+
}
|
| 585 |
+
|
| 586 |
+
export interface ClassBody extends BaseNode {
|
| 587 |
+
type: "ClassBody";
|
| 588 |
+
body: Array<MethodDefinition | PropertyDefinition | StaticBlock>;
|
| 589 |
+
}
|
| 590 |
+
|
| 591 |
+
export interface MethodDefinition extends BaseNode {
|
| 592 |
+
type: "MethodDefinition";
|
| 593 |
+
key: Expression | PrivateIdentifier;
|
| 594 |
+
value: FunctionExpression;
|
| 595 |
+
kind: "constructor" | "method" | "get" | "set";
|
| 596 |
+
computed: boolean;
|
| 597 |
+
static: boolean;
|
| 598 |
+
}
|
| 599 |
+
|
| 600 |
+
export interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration {
|
| 601 |
+
type: "ClassDeclaration";
|
| 602 |
+
/** It is null when a class declaration is a part of the `export default class` statement */
|
| 603 |
+
id: Identifier | null;
|
| 604 |
+
}
|
| 605 |
+
|
| 606 |
+
export interface ClassDeclaration extends MaybeNamedClassDeclaration {
|
| 607 |
+
id: Identifier;
|
| 608 |
+
}
|
| 609 |
+
|
| 610 |
+
export interface ClassExpression extends BaseClass, BaseExpression {
|
| 611 |
+
type: "ClassExpression";
|
| 612 |
+
id?: Identifier | null | undefined;
|
| 613 |
+
}
|
| 614 |
+
|
| 615 |
+
export interface MetaProperty extends BaseExpression {
|
| 616 |
+
type: "MetaProperty";
|
| 617 |
+
meta: Identifier;
|
| 618 |
+
property: Identifier;
|
| 619 |
+
}
|
| 620 |
+
|
| 621 |
+
export type ModuleDeclaration =
|
| 622 |
+
| ImportDeclaration
|
| 623 |
+
| ExportNamedDeclaration
|
| 624 |
+
| ExportDefaultDeclaration
|
| 625 |
+
| ExportAllDeclaration;
|
| 626 |
+
export interface BaseModuleDeclaration extends BaseNode {}
|
| 627 |
+
|
| 628 |
+
export type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier;
|
| 629 |
+
export interface BaseModuleSpecifier extends BaseNode {
|
| 630 |
+
local: Identifier;
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
export interface ImportDeclaration extends BaseModuleDeclaration {
|
| 634 |
+
type: "ImportDeclaration";
|
| 635 |
+
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
|
| 636 |
+
attributes: ImportAttribute[];
|
| 637 |
+
source: Literal;
|
| 638 |
+
}
|
| 639 |
+
|
| 640 |
+
export interface ImportSpecifier extends BaseModuleSpecifier {
|
| 641 |
+
type: "ImportSpecifier";
|
| 642 |
+
imported: Identifier | Literal;
|
| 643 |
+
}
|
| 644 |
+
|
| 645 |
+
export interface ImportAttribute extends BaseNode {
|
| 646 |
+
type: "ImportAttribute";
|
| 647 |
+
key: Identifier | Literal;
|
| 648 |
+
value: Literal;
|
| 649 |
+
}
|
| 650 |
+
|
| 651 |
+
export interface ImportExpression extends BaseExpression {
|
| 652 |
+
type: "ImportExpression";
|
| 653 |
+
source: Expression;
|
| 654 |
+
options?: Expression | null | undefined;
|
| 655 |
+
}
|
| 656 |
+
|
| 657 |
+
export interface ImportDefaultSpecifier extends BaseModuleSpecifier {
|
| 658 |
+
type: "ImportDefaultSpecifier";
|
| 659 |
+
}
|
| 660 |
+
|
| 661 |
+
export interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
|
| 662 |
+
type: "ImportNamespaceSpecifier";
|
| 663 |
+
}
|
| 664 |
+
|
| 665 |
+
export interface ExportNamedDeclaration extends BaseModuleDeclaration {
|
| 666 |
+
type: "ExportNamedDeclaration";
|
| 667 |
+
declaration?: Declaration | null | undefined;
|
| 668 |
+
specifiers: ExportSpecifier[];
|
| 669 |
+
attributes: ImportAttribute[];
|
| 670 |
+
source?: Literal | null | undefined;
|
| 671 |
+
}
|
| 672 |
+
|
| 673 |
+
export interface ExportSpecifier extends Omit<BaseModuleSpecifier, "local"> {
|
| 674 |
+
type: "ExportSpecifier";
|
| 675 |
+
local: Identifier | Literal;
|
| 676 |
+
exported: Identifier | Literal;
|
| 677 |
+
}
|
| 678 |
+
|
| 679 |
+
export interface ExportDefaultDeclaration extends BaseModuleDeclaration {
|
| 680 |
+
type: "ExportDefaultDeclaration";
|
| 681 |
+
declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression;
|
| 682 |
+
}
|
| 683 |
+
|
| 684 |
+
export interface ExportAllDeclaration extends BaseModuleDeclaration {
|
| 685 |
+
type: "ExportAllDeclaration";
|
| 686 |
+
exported: Identifier | Literal | null;
|
| 687 |
+
attributes: ImportAttribute[];
|
| 688 |
+
source: Literal;
|
| 689 |
+
}
|
| 690 |
+
|
| 691 |
+
export interface AwaitExpression extends BaseExpression {
|
| 692 |
+
type: "AwaitExpression";
|
| 693 |
+
argument: Expression;
|
| 694 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/estree/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/estree",
|
| 3 |
+
"version": "1.0.8",
|
| 4 |
+
"description": "TypeScript definitions for estree",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "RReverser",
|
| 10 |
+
"githubUsername": "RReverser",
|
| 11 |
+
"url": "https://github.com/RReverser"
|
| 12 |
+
}
|
| 13 |
+
],
|
| 14 |
+
"main": "",
|
| 15 |
+
"types": "index.d.ts",
|
| 16 |
+
"repository": {
|
| 17 |
+
"type": "git",
|
| 18 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 19 |
+
"directory": "types/estree"
|
| 20 |
+
},
|
| 21 |
+
"scripts": {},
|
| 22 |
+
"dependencies": {},
|
| 23 |
+
"peerDependencies": {},
|
| 24 |
+
"typesPublisherContentHash": "7a167b6e4a4d9f6e9a2cb9fd3fc45c885f89cbdeb44b3e5961bb057a45c082fd",
|
| 25 |
+
"typeScriptVersion": "5.1",
|
| 26 |
+
"nonNpm": true
|
| 27 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/json-schema/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/json-schema/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/json-schema`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for json-schema (https://github.com/kriszyp/json-schema).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/json-schema.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Tue, 07 Nov 2023 03:09:37 GMT
|
| 12 |
+
* Dependencies: none
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [Boris Cherny](https://github.com/bcherny), [Lucian Buzzo](https://github.com/lucianbuzzo), [Roland Groza](https://github.com/rolandjitsu), and [Jason Kwok](https://github.com/JasonHK).
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/json-schema/index.d.ts
ADDED
|
@@ -0,0 +1,749 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// ==================================================================================================
|
| 2 |
+
// JSON Schema Draft 04
|
| 3 |
+
// ==================================================================================================
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
|
| 7 |
+
*/
|
| 8 |
+
export type JSONSchema4TypeName =
|
| 9 |
+
| "string" //
|
| 10 |
+
| "number"
|
| 11 |
+
| "integer"
|
| 12 |
+
| "boolean"
|
| 13 |
+
| "object"
|
| 14 |
+
| "array"
|
| 15 |
+
| "null"
|
| 16 |
+
| "any";
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
|
| 20 |
+
*/
|
| 21 |
+
export type JSONSchema4Type =
|
| 22 |
+
| string //
|
| 23 |
+
| number
|
| 24 |
+
| boolean
|
| 25 |
+
| JSONSchema4Object
|
| 26 |
+
| JSONSchema4Array
|
| 27 |
+
| null;
|
| 28 |
+
|
| 29 |
+
// Workaround for infinite type recursion
|
| 30 |
+
export interface JSONSchema4Object {
|
| 31 |
+
[key: string]: JSONSchema4Type;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
// Workaround for infinite type recursion
|
| 35 |
+
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
| 36 |
+
export interface JSONSchema4Array extends Array<JSONSchema4Type> {}
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Meta schema
|
| 40 |
+
*
|
| 41 |
+
* Recommended values:
|
| 42 |
+
* - 'http://json-schema.org/schema#'
|
| 43 |
+
* - 'http://json-schema.org/hyper-schema#'
|
| 44 |
+
* - 'http://json-schema.org/draft-04/schema#'
|
| 45 |
+
* - 'http://json-schema.org/draft-04/hyper-schema#'
|
| 46 |
+
* - 'http://json-schema.org/draft-03/schema#'
|
| 47 |
+
* - 'http://json-schema.org/draft-03/hyper-schema#'
|
| 48 |
+
*
|
| 49 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
| 50 |
+
*/
|
| 51 |
+
export type JSONSchema4Version = string;
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* JSON Schema V4
|
| 55 |
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04
|
| 56 |
+
*/
|
| 57 |
+
export interface JSONSchema4 {
|
| 58 |
+
id?: string | undefined;
|
| 59 |
+
$ref?: string | undefined;
|
| 60 |
+
$schema?: JSONSchema4Version | undefined;
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* This attribute is a string that provides a short description of the
|
| 64 |
+
* instance property.
|
| 65 |
+
*
|
| 66 |
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21
|
| 67 |
+
*/
|
| 68 |
+
title?: string | undefined;
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* This attribute is a string that provides a full description of the of
|
| 72 |
+
* purpose the instance property.
|
| 73 |
+
*
|
| 74 |
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22
|
| 75 |
+
*/
|
| 76 |
+
description?: string | undefined;
|
| 77 |
+
|
| 78 |
+
default?: JSONSchema4Type | undefined;
|
| 79 |
+
multipleOf?: number | undefined;
|
| 80 |
+
maximum?: number | undefined;
|
| 81 |
+
exclusiveMaximum?: boolean | undefined;
|
| 82 |
+
minimum?: number | undefined;
|
| 83 |
+
exclusiveMinimum?: boolean | undefined;
|
| 84 |
+
maxLength?: number | undefined;
|
| 85 |
+
minLength?: number | undefined;
|
| 86 |
+
pattern?: string | undefined;
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* May only be defined when "items" is defined, and is a tuple of JSONSchemas.
|
| 90 |
+
*
|
| 91 |
+
* This provides a definition for additional items in an array instance
|
| 92 |
+
* when tuple definitions of the items is provided. This can be false
|
| 93 |
+
* to indicate additional items in the array are not allowed, or it can
|
| 94 |
+
* be a schema that defines the schema of the additional items.
|
| 95 |
+
*
|
| 96 |
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6
|
| 97 |
+
*/
|
| 98 |
+
additionalItems?: boolean | JSONSchema4 | undefined;
|
| 99 |
+
|
| 100 |
+
/**
|
| 101 |
+
* This attribute defines the allowed items in an instance array, and
|
| 102 |
+
* MUST be a schema or an array of schemas. The default value is an
|
| 103 |
+
* empty schema which allows any value for items in the instance array.
|
| 104 |
+
*
|
| 105 |
+
* When this attribute value is a schema and the instance value is an
|
| 106 |
+
* array, then all the items in the array MUST be valid according to the
|
| 107 |
+
* schema.
|
| 108 |
+
*
|
| 109 |
+
* When this attribute value is an array of schemas and the instance
|
| 110 |
+
* value is an array, each position in the instance array MUST conform
|
| 111 |
+
* to the schema in the corresponding position for this array. This
|
| 112 |
+
* called tuple typing. When tuple typing is used, additional items are
|
| 113 |
+
* allowed, disallowed, or constrained by the "additionalItems"
|
| 114 |
+
* (Section 5.6) attribute using the same rules as
|
| 115 |
+
* "additionalProperties" (Section 5.4) for objects.
|
| 116 |
+
*
|
| 117 |
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5
|
| 118 |
+
*/
|
| 119 |
+
items?: JSONSchema4 | JSONSchema4[] | undefined;
|
| 120 |
+
|
| 121 |
+
maxItems?: number | undefined;
|
| 122 |
+
minItems?: number | undefined;
|
| 123 |
+
uniqueItems?: boolean | undefined;
|
| 124 |
+
maxProperties?: number | undefined;
|
| 125 |
+
minProperties?: number | undefined;
|
| 126 |
+
|
| 127 |
+
/**
|
| 128 |
+
* This attribute indicates if the instance must have a value, and not
|
| 129 |
+
* be undefined. This is false by default, making the instance
|
| 130 |
+
* optional.
|
| 131 |
+
*
|
| 132 |
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7
|
| 133 |
+
*/
|
| 134 |
+
required?: boolean | string[] | undefined;
|
| 135 |
+
|
| 136 |
+
/**
|
| 137 |
+
* This attribute defines a schema for all properties that are not
|
| 138 |
+
* explicitly defined in an object type definition. If specified, the
|
| 139 |
+
* value MUST be a schema or a boolean. If false is provided, no
|
| 140 |
+
* additional properties are allowed beyond the properties defined in
|
| 141 |
+
* the schema. The default value is an empty schema which allows any
|
| 142 |
+
* value for additional properties.
|
| 143 |
+
*
|
| 144 |
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4
|
| 145 |
+
*/
|
| 146 |
+
additionalProperties?: boolean | JSONSchema4 | undefined;
|
| 147 |
+
|
| 148 |
+
definitions?: {
|
| 149 |
+
[k: string]: JSONSchema4;
|
| 150 |
+
} | undefined;
|
| 151 |
+
|
| 152 |
+
/**
|
| 153 |
+
* This attribute is an object with property definitions that define the
|
| 154 |
+
* valid values of instance object property values. When the instance
|
| 155 |
+
* value is an object, the property values of the instance object MUST
|
| 156 |
+
* conform to the property definitions in this object. In this object,
|
| 157 |
+
* each property definition's value MUST be a schema, and the property's
|
| 158 |
+
* name MUST be the name of the instance property that it defines. The
|
| 159 |
+
* instance property value MUST be valid according to the schema from
|
| 160 |
+
* the property definition. Properties are considered unordered, the
|
| 161 |
+
* order of the instance properties MAY be in any order.
|
| 162 |
+
*
|
| 163 |
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2
|
| 164 |
+
*/
|
| 165 |
+
properties?: {
|
| 166 |
+
[k: string]: JSONSchema4;
|
| 167 |
+
} | undefined;
|
| 168 |
+
|
| 169 |
+
/**
|
| 170 |
+
* This attribute is an object that defines the schema for a set of
|
| 171 |
+
* property names of an object instance. The name of each property of
|
| 172 |
+
* this attribute's object is a regular expression pattern in the ECMA
|
| 173 |
+
* 262/Perl 5 format, while the value is a schema. If the pattern
|
| 174 |
+
* matches the name of a property on the instance object, the value of
|
| 175 |
+
* the instance's property MUST be valid against the pattern name's
|
| 176 |
+
* schema value.
|
| 177 |
+
*
|
| 178 |
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3
|
| 179 |
+
*/
|
| 180 |
+
patternProperties?: {
|
| 181 |
+
[k: string]: JSONSchema4;
|
| 182 |
+
} | undefined;
|
| 183 |
+
dependencies?: {
|
| 184 |
+
[k: string]: JSONSchema4 | string[];
|
| 185 |
+
} | undefined;
|
| 186 |
+
|
| 187 |
+
/**
|
| 188 |
+
* This provides an enumeration of all possible values that are valid
|
| 189 |
+
* for the instance property. This MUST be an array, and each item in
|
| 190 |
+
* the array represents a possible value for the instance value. If
|
| 191 |
+
* this attribute is defined, the instance value MUST be one of the
|
| 192 |
+
* values in the array in order for the schema to be valid.
|
| 193 |
+
*
|
| 194 |
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
|
| 195 |
+
*/
|
| 196 |
+
enum?: JSONSchema4Type[] | undefined;
|
| 197 |
+
|
| 198 |
+
/**
|
| 199 |
+
* A single type, or a union of simple types
|
| 200 |
+
*/
|
| 201 |
+
type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined;
|
| 202 |
+
|
| 203 |
+
allOf?: JSONSchema4[] | undefined;
|
| 204 |
+
anyOf?: JSONSchema4[] | undefined;
|
| 205 |
+
oneOf?: JSONSchema4[] | undefined;
|
| 206 |
+
not?: JSONSchema4 | undefined;
|
| 207 |
+
|
| 208 |
+
/**
|
| 209 |
+
* The value of this property MUST be another schema which will provide
|
| 210 |
+
* a base schema which the current schema will inherit from. The
|
| 211 |
+
* inheritance rules are such that any instance that is valid according
|
| 212 |
+
* to the current schema MUST be valid according to the referenced
|
| 213 |
+
* schema. This MAY also be an array, in which case, the instance MUST
|
| 214 |
+
* be valid for all the schemas in the array. A schema that extends
|
| 215 |
+
* another schema MAY define additional attributes, constrain existing
|
| 216 |
+
* attributes, or add other constraints.
|
| 217 |
+
*
|
| 218 |
+
* Conceptually, the behavior of extends can be seen as validating an
|
| 219 |
+
* instance against all constraints in the extending schema as well as
|
| 220 |
+
* the extended schema(s).
|
| 221 |
+
*
|
| 222 |
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26
|
| 223 |
+
*/
|
| 224 |
+
extends?: string | string[] | undefined;
|
| 225 |
+
|
| 226 |
+
/**
|
| 227 |
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6
|
| 228 |
+
*/
|
| 229 |
+
[k: string]: any;
|
| 230 |
+
|
| 231 |
+
format?: string | undefined;
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
// ==================================================================================================
|
| 235 |
+
// JSON Schema Draft 06
|
| 236 |
+
// ==================================================================================================
|
| 237 |
+
|
| 238 |
+
export type JSONSchema6TypeName =
|
| 239 |
+
| "string" //
|
| 240 |
+
| "number"
|
| 241 |
+
| "integer"
|
| 242 |
+
| "boolean"
|
| 243 |
+
| "object"
|
| 244 |
+
| "array"
|
| 245 |
+
| "null"
|
| 246 |
+
| "any";
|
| 247 |
+
|
| 248 |
+
export type JSONSchema6Type =
|
| 249 |
+
| string //
|
| 250 |
+
| number
|
| 251 |
+
| boolean
|
| 252 |
+
| JSONSchema6Object
|
| 253 |
+
| JSONSchema6Array
|
| 254 |
+
| null;
|
| 255 |
+
|
| 256 |
+
// Workaround for infinite type recursion
|
| 257 |
+
export interface JSONSchema6Object {
|
| 258 |
+
[key: string]: JSONSchema6Type;
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
// Workaround for infinite type recursion
|
| 262 |
+
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
| 263 |
+
export interface JSONSchema6Array extends Array<JSONSchema6Type> {}
|
| 264 |
+
|
| 265 |
+
/**
|
| 266 |
+
* Meta schema
|
| 267 |
+
*
|
| 268 |
+
* Recommended values:
|
| 269 |
+
* - 'http://json-schema.org/schema#'
|
| 270 |
+
* - 'http://json-schema.org/hyper-schema#'
|
| 271 |
+
* - 'http://json-schema.org/draft-06/schema#'
|
| 272 |
+
* - 'http://json-schema.org/draft-06/hyper-schema#'
|
| 273 |
+
*
|
| 274 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
| 275 |
+
*/
|
| 276 |
+
export type JSONSchema6Version = string;
|
| 277 |
+
|
| 278 |
+
/**
|
| 279 |
+
* JSON Schema V6
|
| 280 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01
|
| 281 |
+
*/
|
| 282 |
+
export type JSONSchema6Definition = JSONSchema6 | boolean;
|
| 283 |
+
export interface JSONSchema6 {
|
| 284 |
+
$id?: string | undefined;
|
| 285 |
+
$ref?: string | undefined;
|
| 286 |
+
$schema?: JSONSchema6Version | undefined;
|
| 287 |
+
|
| 288 |
+
/**
|
| 289 |
+
* Must be strictly greater than 0.
|
| 290 |
+
* A numeric instance is valid only if division by this keyword's value results in an integer.
|
| 291 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.1
|
| 292 |
+
*/
|
| 293 |
+
multipleOf?: number | undefined;
|
| 294 |
+
|
| 295 |
+
/**
|
| 296 |
+
* Representing an inclusive upper limit for a numeric instance.
|
| 297 |
+
* This keyword validates only if the instance is less than or exactly equal to "maximum".
|
| 298 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.2
|
| 299 |
+
*/
|
| 300 |
+
maximum?: number | undefined;
|
| 301 |
+
|
| 302 |
+
/**
|
| 303 |
+
* Representing an exclusive upper limit for a numeric instance.
|
| 304 |
+
* This keyword validates only if the instance is strictly less than (not equal to) to "exclusiveMaximum".
|
| 305 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.3
|
| 306 |
+
*/
|
| 307 |
+
exclusiveMaximum?: number | undefined;
|
| 308 |
+
|
| 309 |
+
/**
|
| 310 |
+
* Representing an inclusive lower limit for a numeric instance.
|
| 311 |
+
* This keyword validates only if the instance is greater than or exactly equal to "minimum".
|
| 312 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.4
|
| 313 |
+
*/
|
| 314 |
+
minimum?: number | undefined;
|
| 315 |
+
|
| 316 |
+
/**
|
| 317 |
+
* Representing an exclusive lower limit for a numeric instance.
|
| 318 |
+
* This keyword validates only if the instance is strictly greater than (not equal to) to "exclusiveMinimum".
|
| 319 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.5
|
| 320 |
+
*/
|
| 321 |
+
exclusiveMinimum?: number | undefined;
|
| 322 |
+
|
| 323 |
+
/**
|
| 324 |
+
* Must be a non-negative integer.
|
| 325 |
+
* A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword.
|
| 326 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.6
|
| 327 |
+
*/
|
| 328 |
+
maxLength?: number | undefined;
|
| 329 |
+
|
| 330 |
+
/**
|
| 331 |
+
* Must be a non-negative integer.
|
| 332 |
+
* A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.
|
| 333 |
+
* Omitting this keyword has the same behavior as a value of 0.
|
| 334 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.7
|
| 335 |
+
*/
|
| 336 |
+
minLength?: number | undefined;
|
| 337 |
+
|
| 338 |
+
/**
|
| 339 |
+
* Should be a valid regular expression, according to the ECMA 262 regular expression dialect.
|
| 340 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.8
|
| 341 |
+
*/
|
| 342 |
+
pattern?: string | undefined;
|
| 343 |
+
|
| 344 |
+
/**
|
| 345 |
+
* This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.
|
| 346 |
+
* Omitting this keyword has the same behavior as an empty schema.
|
| 347 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9
|
| 348 |
+
*/
|
| 349 |
+
items?: JSONSchema6Definition | JSONSchema6Definition[] | undefined;
|
| 350 |
+
|
| 351 |
+
/**
|
| 352 |
+
* This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.
|
| 353 |
+
* If "items" is an array of schemas, validation succeeds if every instance element
|
| 354 |
+
* at a position greater than the size of "items" validates against "additionalItems".
|
| 355 |
+
* Otherwise, "additionalItems" MUST be ignored, as the "items" schema
|
| 356 |
+
* (possibly the default value of an empty schema) is applied to all elements.
|
| 357 |
+
* Omitting this keyword has the same behavior as an empty schema.
|
| 358 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10
|
| 359 |
+
*/
|
| 360 |
+
additionalItems?: JSONSchema6Definition | undefined;
|
| 361 |
+
|
| 362 |
+
/**
|
| 363 |
+
* Must be a non-negative integer.
|
| 364 |
+
* An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword.
|
| 365 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.11
|
| 366 |
+
*/
|
| 367 |
+
maxItems?: number | undefined;
|
| 368 |
+
|
| 369 |
+
/**
|
| 370 |
+
* Must be a non-negative integer.
|
| 371 |
+
* An array instance is valid against "maxItems" if its size is greater than, or equal to, the value of this keyword.
|
| 372 |
+
* Omitting this keyword has the same behavior as a value of 0.
|
| 373 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.12
|
| 374 |
+
*/
|
| 375 |
+
minItems?: number | undefined;
|
| 376 |
+
|
| 377 |
+
/**
|
| 378 |
+
* If this keyword has boolean value false, the instance validates successfully.
|
| 379 |
+
* If it has boolean value true, the instance validates successfully if all of its elements are unique.
|
| 380 |
+
* Omitting this keyword has the same behavior as a value of false.
|
| 381 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.13
|
| 382 |
+
*/
|
| 383 |
+
uniqueItems?: boolean | undefined;
|
| 384 |
+
|
| 385 |
+
/**
|
| 386 |
+
* An array instance is valid against "contains" if at least one of its elements is valid against the given schema.
|
| 387 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14
|
| 388 |
+
*/
|
| 389 |
+
contains?: JSONSchema6Definition | undefined;
|
| 390 |
+
|
| 391 |
+
/**
|
| 392 |
+
* Must be a non-negative integer.
|
| 393 |
+
* An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword.
|
| 394 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.15
|
| 395 |
+
*/
|
| 396 |
+
maxProperties?: number | undefined;
|
| 397 |
+
|
| 398 |
+
/**
|
| 399 |
+
* Must be a non-negative integer.
|
| 400 |
+
* An object instance is valid against "maxProperties" if its number of properties is greater than,
|
| 401 |
+
* or equal to, the value of this keyword.
|
| 402 |
+
* Omitting this keyword has the same behavior as a value of 0.
|
| 403 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.16
|
| 404 |
+
*/
|
| 405 |
+
minProperties?: number | undefined;
|
| 406 |
+
|
| 407 |
+
/**
|
| 408 |
+
* Elements of this array must be unique.
|
| 409 |
+
* An object instance is valid against this keyword if every item in the array is the name of a property in the instance.
|
| 410 |
+
* Omitting this keyword has the same behavior as an empty array.
|
| 411 |
+
*
|
| 412 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.17
|
| 413 |
+
*/
|
| 414 |
+
required?: string[] | undefined;
|
| 415 |
+
|
| 416 |
+
/**
|
| 417 |
+
* This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself.
|
| 418 |
+
* Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value,
|
| 419 |
+
* the child instance for that name successfully validates against the corresponding schema.
|
| 420 |
+
* Omitting this keyword has the same behavior as an empty object.
|
| 421 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.18
|
| 422 |
+
*/
|
| 423 |
+
properties?: {
|
| 424 |
+
[k: string]: JSONSchema6Definition;
|
| 425 |
+
} | undefined;
|
| 426 |
+
|
| 427 |
+
/**
|
| 428 |
+
* This attribute is an object that defines the schema for a set of property names of an object instance.
|
| 429 |
+
* The name of each property of this attribute's object is a regular expression pattern in the ECMA 262, while the value is a schema.
|
| 430 |
+
* If the pattern matches the name of a property on the instance object, the value of the instance's property
|
| 431 |
+
* MUST be valid against the pattern name's schema value.
|
| 432 |
+
* Omitting this keyword has the same behavior as an empty object.
|
| 433 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.19
|
| 434 |
+
*/
|
| 435 |
+
patternProperties?: {
|
| 436 |
+
[k: string]: JSONSchema6Definition;
|
| 437 |
+
} | undefined;
|
| 438 |
+
|
| 439 |
+
/**
|
| 440 |
+
* This attribute defines a schema for all properties that are not explicitly defined in an object type definition.
|
| 441 |
+
* If specified, the value MUST be a schema or a boolean.
|
| 442 |
+
* If false is provided, no additional properties are allowed beyond the properties defined in the schema.
|
| 443 |
+
* The default value is an empty schema which allows any value for additional properties.
|
| 444 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20
|
| 445 |
+
*/
|
| 446 |
+
additionalProperties?: JSONSchema6Definition | undefined;
|
| 447 |
+
|
| 448 |
+
/**
|
| 449 |
+
* This keyword specifies rules that are evaluated if the instance is an object and contains a certain property.
|
| 450 |
+
* Each property specifies a dependency.
|
| 451 |
+
* If the dependency value is an array, each element in the array must be unique.
|
| 452 |
+
* Omitting this keyword has the same behavior as an empty object.
|
| 453 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.21
|
| 454 |
+
*/
|
| 455 |
+
dependencies?: {
|
| 456 |
+
[k: string]: JSONSchema6Definition | string[];
|
| 457 |
+
} | undefined;
|
| 458 |
+
|
| 459 |
+
/**
|
| 460 |
+
* Takes a schema which validates the names of all properties rather than their values.
|
| 461 |
+
* Note the property name that the schema is testing will always be a string.
|
| 462 |
+
* Omitting this keyword has the same behavior as an empty schema.
|
| 463 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22
|
| 464 |
+
*/
|
| 465 |
+
propertyNames?: JSONSchema6Definition | undefined;
|
| 466 |
+
|
| 467 |
+
/**
|
| 468 |
+
* This provides an enumeration of all possible values that are valid
|
| 469 |
+
* for the instance property. This MUST be an array, and each item in
|
| 470 |
+
* the array represents a possible value for the instance value. If
|
| 471 |
+
* this attribute is defined, the instance value MUST be one of the
|
| 472 |
+
* values in the array in order for the schema to be valid.
|
| 473 |
+
*
|
| 474 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23
|
| 475 |
+
*/
|
| 476 |
+
enum?: JSONSchema6Type[] | undefined;
|
| 477 |
+
|
| 478 |
+
/**
|
| 479 |
+
* More readable form of a one-element "enum"
|
| 480 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.24
|
| 481 |
+
*/
|
| 482 |
+
const?: JSONSchema6Type | undefined;
|
| 483 |
+
|
| 484 |
+
/**
|
| 485 |
+
* A single type, or a union of simple types
|
| 486 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25
|
| 487 |
+
*/
|
| 488 |
+
type?: JSONSchema6TypeName | JSONSchema6TypeName[] | undefined;
|
| 489 |
+
|
| 490 |
+
/**
|
| 491 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
|
| 492 |
+
*/
|
| 493 |
+
allOf?: JSONSchema6Definition[] | undefined;
|
| 494 |
+
|
| 495 |
+
/**
|
| 496 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
|
| 497 |
+
*/
|
| 498 |
+
anyOf?: JSONSchema6Definition[] | undefined;
|
| 499 |
+
|
| 500 |
+
/**
|
| 501 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
|
| 502 |
+
*/
|
| 503 |
+
oneOf?: JSONSchema6Definition[] | undefined;
|
| 504 |
+
|
| 505 |
+
/**
|
| 506 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29
|
| 507 |
+
*/
|
| 508 |
+
not?: JSONSchema6Definition | undefined;
|
| 509 |
+
|
| 510 |
+
/**
|
| 511 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1
|
| 512 |
+
*/
|
| 513 |
+
definitions?: {
|
| 514 |
+
[k: string]: JSONSchema6Definition;
|
| 515 |
+
} | undefined;
|
| 516 |
+
|
| 517 |
+
/**
|
| 518 |
+
* This attribute is a string that provides a short description of the instance property.
|
| 519 |
+
*
|
| 520 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2
|
| 521 |
+
*/
|
| 522 |
+
title?: string | undefined;
|
| 523 |
+
|
| 524 |
+
/**
|
| 525 |
+
* This attribute is a string that provides a full description of the of purpose the instance property.
|
| 526 |
+
*
|
| 527 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2
|
| 528 |
+
*/
|
| 529 |
+
description?: string | undefined;
|
| 530 |
+
|
| 531 |
+
/**
|
| 532 |
+
* This keyword can be used to supply a default JSON value associated with a particular schema.
|
| 533 |
+
* It is RECOMMENDED that a default value be valid against the associated schema.
|
| 534 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.3
|
| 535 |
+
*/
|
| 536 |
+
default?: JSONSchema6Type | undefined;
|
| 537 |
+
|
| 538 |
+
/**
|
| 539 |
+
* Array of examples with no validation effect the value of "default" is usable as an example without repeating it under this keyword
|
| 540 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4
|
| 541 |
+
*/
|
| 542 |
+
examples?: JSONSchema6Type[] | undefined;
|
| 543 |
+
|
| 544 |
+
/**
|
| 545 |
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-8
|
| 546 |
+
*/
|
| 547 |
+
format?: string | undefined;
|
| 548 |
+
}
|
| 549 |
+
|
| 550 |
+
// ==================================================================================================
|
| 551 |
+
// JSON Schema Draft 07
|
| 552 |
+
// ==================================================================================================
|
| 553 |
+
// https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
| 554 |
+
// --------------------------------------------------------------------------------------------------
|
| 555 |
+
|
| 556 |
+
/**
|
| 557 |
+
* Primitive type
|
| 558 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
| 559 |
+
*/
|
| 560 |
+
export type JSONSchema7TypeName =
|
| 561 |
+
| "string" //
|
| 562 |
+
| "number"
|
| 563 |
+
| "integer"
|
| 564 |
+
| "boolean"
|
| 565 |
+
| "object"
|
| 566 |
+
| "array"
|
| 567 |
+
| "null";
|
| 568 |
+
|
| 569 |
+
/**
|
| 570 |
+
* Primitive type
|
| 571 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
| 572 |
+
*/
|
| 573 |
+
export type JSONSchema7Type =
|
| 574 |
+
| string //
|
| 575 |
+
| number
|
| 576 |
+
| boolean
|
| 577 |
+
| JSONSchema7Object
|
| 578 |
+
| JSONSchema7Array
|
| 579 |
+
| null;
|
| 580 |
+
|
| 581 |
+
// Workaround for infinite type recursion
|
| 582 |
+
export interface JSONSchema7Object {
|
| 583 |
+
[key: string]: JSONSchema7Type;
|
| 584 |
+
}
|
| 585 |
+
|
| 586 |
+
// Workaround for infinite type recursion
|
| 587 |
+
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
| 588 |
+
export interface JSONSchema7Array extends Array<JSONSchema7Type> {}
|
| 589 |
+
|
| 590 |
+
/**
|
| 591 |
+
* Meta schema
|
| 592 |
+
*
|
| 593 |
+
* Recommended values:
|
| 594 |
+
* - 'http://json-schema.org/schema#'
|
| 595 |
+
* - 'http://json-schema.org/hyper-schema#'
|
| 596 |
+
* - 'http://json-schema.org/draft-07/schema#'
|
| 597 |
+
* - 'http://json-schema.org/draft-07/hyper-schema#'
|
| 598 |
+
*
|
| 599 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
| 600 |
+
*/
|
| 601 |
+
export type JSONSchema7Version = string;
|
| 602 |
+
|
| 603 |
+
/**
|
| 604 |
+
* JSON Schema v7
|
| 605 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
| 606 |
+
*/
|
| 607 |
+
export type JSONSchema7Definition = JSONSchema7 | boolean;
|
| 608 |
+
export interface JSONSchema7 {
|
| 609 |
+
$id?: string | undefined;
|
| 610 |
+
$ref?: string | undefined;
|
| 611 |
+
$schema?: JSONSchema7Version | undefined;
|
| 612 |
+
$comment?: string | undefined;
|
| 613 |
+
|
| 614 |
+
/**
|
| 615 |
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
| 616 |
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
| 617 |
+
*/
|
| 618 |
+
$defs?: {
|
| 619 |
+
[key: string]: JSONSchema7Definition;
|
| 620 |
+
} | undefined;
|
| 621 |
+
|
| 622 |
+
/**
|
| 623 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
|
| 624 |
+
*/
|
| 625 |
+
type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
|
| 626 |
+
enum?: JSONSchema7Type[] | undefined;
|
| 627 |
+
const?: JSONSchema7Type | undefined;
|
| 628 |
+
|
| 629 |
+
/**
|
| 630 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
|
| 631 |
+
*/
|
| 632 |
+
multipleOf?: number | undefined;
|
| 633 |
+
maximum?: number | undefined;
|
| 634 |
+
exclusiveMaximum?: number | undefined;
|
| 635 |
+
minimum?: number | undefined;
|
| 636 |
+
exclusiveMinimum?: number | undefined;
|
| 637 |
+
|
| 638 |
+
/**
|
| 639 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
|
| 640 |
+
*/
|
| 641 |
+
maxLength?: number | undefined;
|
| 642 |
+
minLength?: number | undefined;
|
| 643 |
+
pattern?: string | undefined;
|
| 644 |
+
|
| 645 |
+
/**
|
| 646 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
|
| 647 |
+
*/
|
| 648 |
+
items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
|
| 649 |
+
additionalItems?: JSONSchema7Definition | undefined;
|
| 650 |
+
maxItems?: number | undefined;
|
| 651 |
+
minItems?: number | undefined;
|
| 652 |
+
uniqueItems?: boolean | undefined;
|
| 653 |
+
contains?: JSONSchema7Definition | undefined;
|
| 654 |
+
|
| 655 |
+
/**
|
| 656 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
|
| 657 |
+
*/
|
| 658 |
+
maxProperties?: number | undefined;
|
| 659 |
+
minProperties?: number | undefined;
|
| 660 |
+
required?: string[] | undefined;
|
| 661 |
+
properties?: {
|
| 662 |
+
[key: string]: JSONSchema7Definition;
|
| 663 |
+
} | undefined;
|
| 664 |
+
patternProperties?: {
|
| 665 |
+
[key: string]: JSONSchema7Definition;
|
| 666 |
+
} | undefined;
|
| 667 |
+
additionalProperties?: JSONSchema7Definition | undefined;
|
| 668 |
+
dependencies?: {
|
| 669 |
+
[key: string]: JSONSchema7Definition | string[];
|
| 670 |
+
} | undefined;
|
| 671 |
+
propertyNames?: JSONSchema7Definition | undefined;
|
| 672 |
+
|
| 673 |
+
/**
|
| 674 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
|
| 675 |
+
*/
|
| 676 |
+
if?: JSONSchema7Definition | undefined;
|
| 677 |
+
then?: JSONSchema7Definition | undefined;
|
| 678 |
+
else?: JSONSchema7Definition | undefined;
|
| 679 |
+
|
| 680 |
+
/**
|
| 681 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
|
| 682 |
+
*/
|
| 683 |
+
allOf?: JSONSchema7Definition[] | undefined;
|
| 684 |
+
anyOf?: JSONSchema7Definition[] | undefined;
|
| 685 |
+
oneOf?: JSONSchema7Definition[] | undefined;
|
| 686 |
+
not?: JSONSchema7Definition | undefined;
|
| 687 |
+
|
| 688 |
+
/**
|
| 689 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
|
| 690 |
+
*/
|
| 691 |
+
format?: string | undefined;
|
| 692 |
+
|
| 693 |
+
/**
|
| 694 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
|
| 695 |
+
*/
|
| 696 |
+
contentMediaType?: string | undefined;
|
| 697 |
+
contentEncoding?: string | undefined;
|
| 698 |
+
|
| 699 |
+
/**
|
| 700 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
|
| 701 |
+
*/
|
| 702 |
+
definitions?: {
|
| 703 |
+
[key: string]: JSONSchema7Definition;
|
| 704 |
+
} | undefined;
|
| 705 |
+
|
| 706 |
+
/**
|
| 707 |
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
|
| 708 |
+
*/
|
| 709 |
+
title?: string | undefined;
|
| 710 |
+
description?: string | undefined;
|
| 711 |
+
default?: JSONSchema7Type | undefined;
|
| 712 |
+
readOnly?: boolean | undefined;
|
| 713 |
+
writeOnly?: boolean | undefined;
|
| 714 |
+
examples?: JSONSchema7Type | undefined;
|
| 715 |
+
}
|
| 716 |
+
|
| 717 |
+
export interface ValidationResult {
|
| 718 |
+
valid: boolean;
|
| 719 |
+
errors: ValidationError[];
|
| 720 |
+
}
|
| 721 |
+
|
| 722 |
+
export interface ValidationError {
|
| 723 |
+
property: string;
|
| 724 |
+
message: string;
|
| 725 |
+
}
|
| 726 |
+
|
| 727 |
+
/**
|
| 728 |
+
* To use the validator call JSONSchema.validate with an instance object and an optional schema object.
|
| 729 |
+
* If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating),
|
| 730 |
+
* that schema will be used to validate and the schema parameter is not necessary (if both exist,
|
| 731 |
+
* both validations will occur).
|
| 732 |
+
*/
|
| 733 |
+
export function validate(instance: {}, schema: JSONSchema4 | JSONSchema6 | JSONSchema7): ValidationResult;
|
| 734 |
+
|
| 735 |
+
/**
|
| 736 |
+
* The checkPropertyChange method will check to see if an value can legally be in property with the given schema
|
| 737 |
+
* This is slightly different than the validate method in that it will fail if the schema is readonly and it will
|
| 738 |
+
* not check for self-validation, it is assumed that the passed in value is already internally valid.
|
| 739 |
+
*/
|
| 740 |
+
export function checkPropertyChange(
|
| 741 |
+
value: any,
|
| 742 |
+
schema: JSONSchema4 | JSONSchema6 | JSONSchema7,
|
| 743 |
+
property: string,
|
| 744 |
+
): ValidationResult;
|
| 745 |
+
|
| 746 |
+
/**
|
| 747 |
+
* This checks to ensure that the result is valid and will throw an appropriate error message if it is not.
|
| 748 |
+
*/
|
| 749 |
+
export function mustBeValid(result: ValidationResult): void;
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/json-schema/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/json-schema",
|
| 3 |
+
"version": "7.0.15",
|
| 4 |
+
"description": "TypeScript definitions for json-schema",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/json-schema",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "Boris Cherny",
|
| 10 |
+
"githubUsername": "bcherny",
|
| 11 |
+
"url": "https://github.com/bcherny"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Lucian Buzzo",
|
| 15 |
+
"githubUsername": "lucianbuzzo",
|
| 16 |
+
"url": "https://github.com/lucianbuzzo"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "Roland Groza",
|
| 20 |
+
"githubUsername": "rolandjitsu",
|
| 21 |
+
"url": "https://github.com/rolandjitsu"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"name": "Jason Kwok",
|
| 25 |
+
"githubUsername": "JasonHK",
|
| 26 |
+
"url": "https://github.com/JasonHK"
|
| 27 |
+
}
|
| 28 |
+
],
|
| 29 |
+
"main": "",
|
| 30 |
+
"types": "index.d.ts",
|
| 31 |
+
"repository": {
|
| 32 |
+
"type": "git",
|
| 33 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 34 |
+
"directory": "types/json-schema"
|
| 35 |
+
},
|
| 36 |
+
"scripts": {},
|
| 37 |
+
"dependencies": {},
|
| 38 |
+
"typesPublisherContentHash": "79984fd70cd25c3f7d72b84368778c763c89728ea0073832d745d4691b705257",
|
| 39 |
+
"typeScriptVersion": "4.5"
|
| 40 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/json5/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/json5`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for JSON5 (http://json5.org/).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/json5
|
| 9 |
+
|
| 10 |
+
Additional Details
|
| 11 |
+
* Last updated: Mon, 19 Sep 2016 17:28:59 GMT
|
| 12 |
+
* File structure: ProperModule
|
| 13 |
+
* Library Dependencies: none
|
| 14 |
+
* Module Dependencies: none
|
| 15 |
+
* Global values: json5
|
| 16 |
+
|
| 17 |
+
# Credits
|
| 18 |
+
These definitions were written by Jason Swearingen <https://jasonswearingen.github.io>.
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/json5/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Type definitions for JSON5
|
| 2 |
+
// Project: http://json5.org/
|
| 3 |
+
// Definitions by: Jason Swearingen <https://jasonswearingen.github.io>
|
| 4 |
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
//commonjs loader
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* The following is the exact list of additions to JSON's syntax introduced by JSON5. All of these are optional, and all of these come from ES5.
|
| 11 |
+
|
| 12 |
+
Objects
|
| 13 |
+
|
| 14 |
+
Object keys can be unquoted if they're valid identifiers. Yes, even reserved keywords (like default) are valid unquoted keys in ES5 [§11.1.5, §7.6]. (More info)
|
| 15 |
+
|
| 16 |
+
(TODO: Unicode characters and escape sequences aren’t yet supported in this implementation.)
|
| 17 |
+
|
| 18 |
+
Objects can have trailing commas.
|
| 19 |
+
|
| 20 |
+
Arrays
|
| 21 |
+
|
| 22 |
+
Arrays can have trailing commas.
|
| 23 |
+
Strings
|
| 24 |
+
|
| 25 |
+
Strings can be single-quoted.
|
| 26 |
+
|
| 27 |
+
Strings can be split across multiple lines; just prefix each newline with a backslash. [ES5 §7.8.4]
|
| 28 |
+
|
| 29 |
+
Numbers
|
| 30 |
+
|
| 31 |
+
Numbers can be hexadecimal (base 16).
|
| 32 |
+
|
| 33 |
+
Numbers can begin or end with a (leading or trailing) decimal point.
|
| 34 |
+
|
| 35 |
+
Numbers can include Infinity, -Infinity, NaN, and -NaN.
|
| 36 |
+
|
| 37 |
+
Numbers can begin with an explicit plus sign.
|
| 38 |
+
|
| 39 |
+
Comments
|
| 40 |
+
|
| 41 |
+
Both inline (single-line) and block (multi-line) comments are allowed.
|
| 42 |
+
*/
|
| 43 |
+
declare var json5: JSON;
|
| 44 |
+
export = json5;
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/json5/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/json5",
|
| 3 |
+
"version": "0.0.29",
|
| 4 |
+
"description": "TypeScript definitions for JSON5",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"author": "Jason Swearingen <https://jasonswearingen.github.io>",
|
| 7 |
+
"main": "",
|
| 8 |
+
"repository": {
|
| 9 |
+
"type": "git",
|
| 10 |
+
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git"
|
| 11 |
+
},
|
| 12 |
+
"scripts": {},
|
| 13 |
+
"dependencies": {},
|
| 14 |
+
"typings": "index.d.ts",
|
| 15 |
+
"typesPublisherContentHash": "1ed77f2bfd59d290798abf89db281c36565f4a78d97d4e9caab25319d54c6331"
|
| 16 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/json5/types-metadata.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"authors": "Jason Swearingen <https://jasonswearingen.github.io>",
|
| 3 |
+
"definitionFilename": "index.d.ts",
|
| 4 |
+
"libraryDependencies": [],
|
| 5 |
+
"moduleDependencies": [],
|
| 6 |
+
"libraryMajorVersion": "0",
|
| 7 |
+
"libraryMinorVersion": "0",
|
| 8 |
+
"libraryName": "JSON5",
|
| 9 |
+
"typingsPackageName": "json5",
|
| 10 |
+
"projectName": "http://json5.org/",
|
| 11 |
+
"sourceRepoURL": "https://www.github.com/DefinitelyTyped/DefinitelyTyped",
|
| 12 |
+
"sourceBranch": "types-2.0",
|
| 13 |
+
"kind": "ProperModule",
|
| 14 |
+
"globals": [
|
| 15 |
+
"json5"
|
| 16 |
+
],
|
| 17 |
+
"declaredModules": [
|
| 18 |
+
"json5"
|
| 19 |
+
],
|
| 20 |
+
"files": [
|
| 21 |
+
"index.d.ts"
|
| 22 |
+
],
|
| 23 |
+
"hasPackageJson": false,
|
| 24 |
+
"contentHash": "1ed77f2bfd59d290798abf89db281c36565f4a78d97d4e9caab25319d54c6331"
|
| 25 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/minimist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/minimist/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/minimist`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for minimist (https://github.com/substack/minimist).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/minimist.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Tue, 07 Nov 2023 09:09:39 GMT
|
| 12 |
+
* Dependencies: none
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [Bart van der Schoor](https://github.com/Bartvds), [Necroskillz](https://github.com/Necroskillz), [kamranayub](https://github.com/kamranayub), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/minimist/index.d.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Return an argument object populated with the array arguments from args
|
| 3 |
+
*
|
| 4 |
+
* @param [args] An optional argument array (typically `process.argv.slice(2)`)
|
| 5 |
+
* @param [opts] An optional options object to customize the parsing
|
| 6 |
+
*/
|
| 7 |
+
declare function minimist(args?: string[], opts?: minimist.Opts): minimist.ParsedArgs;
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Return an argument object populated with the array arguments from args. Strongly-typed
|
| 11 |
+
* to be the intersect of type T with minimist.ParsedArgs.
|
| 12 |
+
*
|
| 13 |
+
* `T` The type that will be intersected with minimist.ParsedArgs to represent the argument object
|
| 14 |
+
*
|
| 15 |
+
* @param [args] An optional argument array (typically `process.argv.slice(2)`)
|
| 16 |
+
* @param [opts] An optional options object to customize the parsing
|
| 17 |
+
*/
|
| 18 |
+
declare function minimist<T>(args?: string[], opts?: minimist.Opts): T & minimist.ParsedArgs;
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Return an argument object populated with the array arguments from args. Strongly-typed
|
| 22 |
+
* to be the the type T which should extend minimist.ParsedArgs
|
| 23 |
+
*
|
| 24 |
+
* `T` The type that extends minimist.ParsedArgs and represents the argument object
|
| 25 |
+
*
|
| 26 |
+
* @param [args] An optional argument array (typically `process.argv.slice(2)`)
|
| 27 |
+
* @param [opts] An optional options object to customize the parsing
|
| 28 |
+
*/
|
| 29 |
+
declare function minimist<T extends minimist.ParsedArgs>(args?: string[], opts?: minimist.Opts): T;
|
| 30 |
+
|
| 31 |
+
declare namespace minimist {
|
| 32 |
+
interface Opts {
|
| 33 |
+
/**
|
| 34 |
+
* A string or array of strings argument names to always treat as strings
|
| 35 |
+
*/
|
| 36 |
+
string?: string | string[] | undefined;
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* A boolean, string or array of strings to always treat as booleans. If true will treat
|
| 40 |
+
* all double hyphenated arguments without equals signs as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`)
|
| 41 |
+
*/
|
| 42 |
+
boolean?: boolean | string | string[] | undefined;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* An object mapping string names to strings or arrays of string argument names to use as aliases
|
| 46 |
+
*/
|
| 47 |
+
alias?: { [key: string]: string | string[] } | undefined;
|
| 48 |
+
|
| 49 |
+
/**
|
| 50 |
+
* An object mapping string argument names to default values
|
| 51 |
+
*/
|
| 52 |
+
default?: { [key: string]: any } | undefined;
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* When true, populate argv._ with everything after the first non-option
|
| 56 |
+
*/
|
| 57 |
+
stopEarly?: boolean | undefined;
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* A function which is invoked with a command line parameter not defined in the opts
|
| 61 |
+
* configuration object. If the function returns false, the unknown option is not added to argv
|
| 62 |
+
*/
|
| 63 |
+
unknown?: ((arg: string) => boolean) | undefined;
|
| 64 |
+
|
| 65 |
+
/**
|
| 66 |
+
* When true, populate argv._ with everything before the -- and argv['--'] with everything after the --.
|
| 67 |
+
* Note that with -- set, parsing for arguments still stops after the `--`.
|
| 68 |
+
*/
|
| 69 |
+
"--"?: boolean | undefined;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
interface ParsedArgs {
|
| 73 |
+
[arg: string]: any;
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* If opts['--'] is true, populated with everything after the --
|
| 77 |
+
*/
|
| 78 |
+
"--"?: string[] | undefined;
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* Contains all the arguments that didn't have an option associated with them
|
| 82 |
+
*/
|
| 83 |
+
_: string[];
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
export = minimist;
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/minimist/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/minimist",
|
| 3 |
+
"version": "1.2.5",
|
| 4 |
+
"description": "TypeScript definitions for minimist",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/minimist",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "Bart van der Schoor",
|
| 10 |
+
"githubUsername": "Bartvds",
|
| 11 |
+
"url": "https://github.com/Bartvds"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Necroskillz",
|
| 15 |
+
"githubUsername": "Necroskillz",
|
| 16 |
+
"url": "https://github.com/Necroskillz"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "kamranayub",
|
| 20 |
+
"githubUsername": "kamranayub",
|
| 21 |
+
"url": "https://github.com/kamranayub"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"name": "Piotr Błażejewicz",
|
| 25 |
+
"githubUsername": "peterblazejewicz",
|
| 26 |
+
"url": "https://github.com/peterblazejewicz"
|
| 27 |
+
}
|
| 28 |
+
],
|
| 29 |
+
"main": "",
|
| 30 |
+
"types": "index.d.ts",
|
| 31 |
+
"repository": {
|
| 32 |
+
"type": "git",
|
| 33 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 34 |
+
"directory": "types/minimist"
|
| 35 |
+
},
|
| 36 |
+
"scripts": {},
|
| 37 |
+
"dependencies": {},
|
| 38 |
+
"typesPublisherContentHash": "e7dad9991b8f1cc7aae482ae6c4009a6a44645234b6f94524e2a76425cda2822",
|
| 39 |
+
"typeScriptVersion": "4.5"
|
| 40 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/node-fetch/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/node-fetch/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/node-fetch`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for node-fetch (https://github.com/bitinn/node-fetch).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Mon, 11 Nov 2024 18:36:31 GMT
|
| 12 |
+
* Dependencies: [@types/node](https://npmjs.com/package/@types/node), [form-data](https://npmjs.com/package/form-data)
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [Torsten Werner](https://github.com/torstenwerner), [Niklas Lindgren](https://github.com/nikcorg), [Vinay Bedre](https://github.com/vinaybedre), [Antonio Román](https://github.com/kyranet), [Andrew Leedham](https://github.com/AndrewLeedham), [Jason Li](https://github.com/JasonLi914), [Steve Faulkner](https://github.com/southpolesteve), [ExE Boss](https://github.com/ExE-Boss), [Alex Savin](https://github.com/alexandrusavin), [Alexis Tyler](https://github.com/OmgImAlexis), [Jakub Kisielewski](https://github.com/kbkk), and [David Glasser](https://github.com/glasser).
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/node-fetch/externals.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// `AbortSignal` is defined here to prevent a dependency on a particular
|
| 2 |
+
// implementation like the `abort-controller` package, and to avoid requiring
|
| 3 |
+
// the `dom` library in `tsconfig.json`.
|
| 4 |
+
|
| 5 |
+
export interface AbortSignal {
|
| 6 |
+
aborted: boolean;
|
| 7 |
+
reason: any;
|
| 8 |
+
|
| 9 |
+
addEventListener: (
|
| 10 |
+
type: "abort",
|
| 11 |
+
listener: (this: AbortSignal, event: any) => any,
|
| 12 |
+
options?: boolean | {
|
| 13 |
+
capture?: boolean | undefined;
|
| 14 |
+
once?: boolean | undefined;
|
| 15 |
+
passive?: boolean | undefined;
|
| 16 |
+
},
|
| 17 |
+
) => void;
|
| 18 |
+
|
| 19 |
+
removeEventListener: (
|
| 20 |
+
type: "abort",
|
| 21 |
+
listener: (this: AbortSignal, event: any) => any,
|
| 22 |
+
options?: boolean | {
|
| 23 |
+
capture?: boolean | undefined;
|
| 24 |
+
},
|
| 25 |
+
) => void;
|
| 26 |
+
|
| 27 |
+
dispatchEvent: (event: any) => boolean;
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/// <reference types="node" />
|
| 2 |
+
|
| 3 |
+
import FormData = require("form-data");
|
| 4 |
+
import { RequestOptions } from "http";
|
| 5 |
+
import { URL, URLSearchParams } from "url";
|
| 6 |
+
import { AbortSignal } from "./externals";
|
| 7 |
+
|
| 8 |
+
declare class Request extends Body {
|
| 9 |
+
constructor(input: RequestInfo, init?: RequestInit);
|
| 10 |
+
clone(): Request;
|
| 11 |
+
context: RequestContext;
|
| 12 |
+
headers: Headers;
|
| 13 |
+
method: string;
|
| 14 |
+
redirect: RequestRedirect;
|
| 15 |
+
referrer: string;
|
| 16 |
+
url: string;
|
| 17 |
+
|
| 18 |
+
// node-fetch extensions to the whatwg/fetch spec
|
| 19 |
+
agent?: RequestOptions["agent"] | ((parsedUrl: URL) => RequestOptions["agent"]);
|
| 20 |
+
compress: boolean;
|
| 21 |
+
counter: number;
|
| 22 |
+
follow: number;
|
| 23 |
+
hostname: string;
|
| 24 |
+
port?: number | undefined;
|
| 25 |
+
protocol: string;
|
| 26 |
+
size: number;
|
| 27 |
+
timeout: number;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
interface RequestInit {
|
| 31 |
+
// whatwg/fetch standard options
|
| 32 |
+
body?: BodyInit | undefined;
|
| 33 |
+
headers?: HeadersInit | undefined;
|
| 34 |
+
method?: string | undefined;
|
| 35 |
+
redirect?: RequestRedirect | undefined;
|
| 36 |
+
signal?: AbortSignal | null | undefined;
|
| 37 |
+
|
| 38 |
+
// node-fetch extensions
|
| 39 |
+
agent?: RequestOptions["agent"] | ((parsedUrl: URL) => RequestOptions["agent"]); // =null http.Agent instance, allows custom proxy, certificate etc.
|
| 40 |
+
compress?: boolean | undefined; // =true support gzip/deflate content encoding. false to disable
|
| 41 |
+
follow?: number | undefined; // =20 maximum redirect count. 0 to not follow redirect
|
| 42 |
+
size?: number | undefined; // =0 maximum response body size in bytes. 0 to disable
|
| 43 |
+
timeout?: number | undefined; // =0 req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies)
|
| 44 |
+
|
| 45 |
+
// node-fetch does not support mode, cache or credentials options
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
type RequestContext =
|
| 49 |
+
| "audio"
|
| 50 |
+
| "beacon"
|
| 51 |
+
| "cspreport"
|
| 52 |
+
| "download"
|
| 53 |
+
| "embed"
|
| 54 |
+
| "eventsource"
|
| 55 |
+
| "favicon"
|
| 56 |
+
| "fetch"
|
| 57 |
+
| "font"
|
| 58 |
+
| "form"
|
| 59 |
+
| "frame"
|
| 60 |
+
| "hyperlink"
|
| 61 |
+
| "iframe"
|
| 62 |
+
| "image"
|
| 63 |
+
| "imageset"
|
| 64 |
+
| "import"
|
| 65 |
+
| "internal"
|
| 66 |
+
| "location"
|
| 67 |
+
| "manifest"
|
| 68 |
+
| "object"
|
| 69 |
+
| "ping"
|
| 70 |
+
| "plugin"
|
| 71 |
+
| "prefetch"
|
| 72 |
+
| "script"
|
| 73 |
+
| "serviceworker"
|
| 74 |
+
| "sharedworker"
|
| 75 |
+
| "style"
|
| 76 |
+
| "subresource"
|
| 77 |
+
| "track"
|
| 78 |
+
| "video"
|
| 79 |
+
| "worker"
|
| 80 |
+
| "xmlhttprequest"
|
| 81 |
+
| "xslt";
|
| 82 |
+
type RequestMode = "cors" | "no-cors" | "same-origin";
|
| 83 |
+
type RequestRedirect = "error" | "follow" | "manual";
|
| 84 |
+
type RequestCredentials = "omit" | "include" | "same-origin";
|
| 85 |
+
|
| 86 |
+
type RequestCache =
|
| 87 |
+
| "default"
|
| 88 |
+
| "force-cache"
|
| 89 |
+
| "no-cache"
|
| 90 |
+
| "no-store"
|
| 91 |
+
| "only-if-cached"
|
| 92 |
+
| "reload";
|
| 93 |
+
|
| 94 |
+
declare class Headers implements Iterable<[string, string]> {
|
| 95 |
+
constructor(init?: HeadersInit);
|
| 96 |
+
forEach(callback: (value: string, name: string) => void): void;
|
| 97 |
+
append(name: string, value: string): void;
|
| 98 |
+
delete(name: string): void;
|
| 99 |
+
get(name: string): string | null;
|
| 100 |
+
has(name: string): boolean;
|
| 101 |
+
raw(): { [k: string]: string[] };
|
| 102 |
+
set(name: string, value: string): void;
|
| 103 |
+
|
| 104 |
+
// Iterable methods
|
| 105 |
+
entries(): IterableIterator<[string, string]>;
|
| 106 |
+
keys(): IterableIterator<string>;
|
| 107 |
+
values(): IterableIterator<string>;
|
| 108 |
+
[Symbol.iterator](): Iterator<[string, string]>;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
type BlobPart = ArrayBuffer | ArrayBufferView | Blob | string;
|
| 112 |
+
|
| 113 |
+
interface BlobOptions {
|
| 114 |
+
type?: string | undefined;
|
| 115 |
+
endings?: "transparent" | "native" | undefined;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
declare class Blob {
|
| 119 |
+
constructor(blobParts?: BlobPart[], options?: BlobOptions);
|
| 120 |
+
readonly type: string;
|
| 121 |
+
readonly size: number;
|
| 122 |
+
slice(start?: number, end?: number): Blob;
|
| 123 |
+
text(): Promise<string>;
|
| 124 |
+
arrayBuffer(): Promise<ArrayBuffer>;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
declare class Body {
|
| 128 |
+
constructor(body?: any, opts?: { size?: number | undefined; timeout?: number | undefined });
|
| 129 |
+
arrayBuffer(): Promise<ArrayBuffer>;
|
| 130 |
+
blob(): Promise<Blob>;
|
| 131 |
+
body: NodeJS.ReadableStream;
|
| 132 |
+
bodyUsed: boolean;
|
| 133 |
+
buffer(): Promise<Buffer>;
|
| 134 |
+
json(): Promise<any>;
|
| 135 |
+
size: number;
|
| 136 |
+
text(): Promise<string>;
|
| 137 |
+
textConverted(): Promise<string>;
|
| 138 |
+
timeout: number;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
interface SystemError extends Error {
|
| 142 |
+
code?: string | undefined;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
declare class AbortError extends Error {
|
| 146 |
+
readonly name: "AbortError";
|
| 147 |
+
constructor(message: string);
|
| 148 |
+
readonly type: "aborted";
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
declare class FetchError extends Error {
|
| 152 |
+
name: "FetchError";
|
| 153 |
+
constructor(message: string, type: string, systemError?: SystemError);
|
| 154 |
+
type: string;
|
| 155 |
+
code?: string | undefined;
|
| 156 |
+
errno?: string | undefined;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
declare class Response extends Body {
|
| 160 |
+
constructor(body?: BodyInit, init?: ResponseInit);
|
| 161 |
+
static error(): Response;
|
| 162 |
+
static redirect(url: string, status: number): Response;
|
| 163 |
+
clone(): Response;
|
| 164 |
+
headers: Headers;
|
| 165 |
+
ok: boolean;
|
| 166 |
+
redirected: boolean;
|
| 167 |
+
status: number;
|
| 168 |
+
statusText: string;
|
| 169 |
+
type: ResponseType;
|
| 170 |
+
url: string;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
type ResponseType =
|
| 174 |
+
| "basic"
|
| 175 |
+
| "cors"
|
| 176 |
+
| "default"
|
| 177 |
+
| "error"
|
| 178 |
+
| "opaque"
|
| 179 |
+
| "opaqueredirect";
|
| 180 |
+
|
| 181 |
+
interface ResponseInit {
|
| 182 |
+
headers?: HeadersInit | undefined;
|
| 183 |
+
size?: number | undefined;
|
| 184 |
+
status?: number | undefined;
|
| 185 |
+
statusText?: string | undefined;
|
| 186 |
+
timeout?: number | undefined;
|
| 187 |
+
url?: string | undefined;
|
| 188 |
+
counter?: number | undefined;
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
interface URLLike {
|
| 192 |
+
href: string;
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
type HeadersInit = Headers | string[][] | { [key: string]: string | string[] };
|
| 196 |
+
type BodyInit =
|
| 197 |
+
| ArrayBuffer
|
| 198 |
+
| ArrayBufferView
|
| 199 |
+
| NodeJS.ReadableStream
|
| 200 |
+
| string
|
| 201 |
+
| URLSearchParams
|
| 202 |
+
| FormData;
|
| 203 |
+
type RequestInfo = string | URLLike | Request;
|
| 204 |
+
|
| 205 |
+
declare function fetch(
|
| 206 |
+
url: RequestInfo,
|
| 207 |
+
init?: RequestInit,
|
| 208 |
+
): Promise<Response>;
|
| 209 |
+
|
| 210 |
+
declare namespace fetch {
|
| 211 |
+
export {
|
| 212 |
+
AbortError,
|
| 213 |
+
Blob,
|
| 214 |
+
Body,
|
| 215 |
+
BodyInit,
|
| 216 |
+
FetchError,
|
| 217 |
+
Headers,
|
| 218 |
+
HeadersInit,
|
| 219 |
+
// HeaderInit is exported to support backwards compatibility. See PR #34382
|
| 220 |
+
HeadersInit as HeaderInit,
|
| 221 |
+
Request,
|
| 222 |
+
RequestCache,
|
| 223 |
+
RequestContext,
|
| 224 |
+
RequestCredentials,
|
| 225 |
+
RequestInfo,
|
| 226 |
+
RequestInit,
|
| 227 |
+
RequestMode,
|
| 228 |
+
RequestRedirect,
|
| 229 |
+
Response,
|
| 230 |
+
ResponseInit,
|
| 231 |
+
ResponseType,
|
| 232 |
+
};
|
| 233 |
+
export function isRedirect(code: number): boolean;
|
| 234 |
+
|
| 235 |
+
import _default = fetch;
|
| 236 |
+
export { _default as default };
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
export = fetch;
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/node-fetch/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/node-fetch",
|
| 3 |
+
"version": "2.6.12",
|
| 4 |
+
"description": "TypeScript definitions for node-fetch",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "Torsten Werner",
|
| 10 |
+
"githubUsername": "torstenwerner",
|
| 11 |
+
"url": "https://github.com/torstenwerner"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Niklas Lindgren",
|
| 15 |
+
"githubUsername": "nikcorg",
|
| 16 |
+
"url": "https://github.com/nikcorg"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "Vinay Bedre",
|
| 20 |
+
"githubUsername": "vinaybedre",
|
| 21 |
+
"url": "https://github.com/vinaybedre"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"name": "Antonio Román",
|
| 25 |
+
"githubUsername": "kyranet",
|
| 26 |
+
"url": "https://github.com/kyranet"
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"name": "Andrew Leedham",
|
| 30 |
+
"githubUsername": "AndrewLeedham",
|
| 31 |
+
"url": "https://github.com/AndrewLeedham"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"name": "Jason Li",
|
| 35 |
+
"githubUsername": "JasonLi914",
|
| 36 |
+
"url": "https://github.com/JasonLi914"
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"name": "Steve Faulkner",
|
| 40 |
+
"githubUsername": "southpolesteve",
|
| 41 |
+
"url": "https://github.com/southpolesteve"
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"name": "ExE Boss",
|
| 45 |
+
"githubUsername": "ExE-Boss",
|
| 46 |
+
"url": "https://github.com/ExE-Boss"
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"name": "Alex Savin",
|
| 50 |
+
"githubUsername": "alexandrusavin",
|
| 51 |
+
"url": "https://github.com/alexandrusavin"
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"name": "Alexis Tyler",
|
| 55 |
+
"githubUsername": "OmgImAlexis",
|
| 56 |
+
"url": "https://github.com/OmgImAlexis"
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"name": "Jakub Kisielewski",
|
| 60 |
+
"githubUsername": "kbkk",
|
| 61 |
+
"url": "https://github.com/kbkk"
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"name": "David Glasser",
|
| 65 |
+
"githubUsername": "glasser",
|
| 66 |
+
"url": "https://github.com/glasser"
|
| 67 |
+
}
|
| 68 |
+
],
|
| 69 |
+
"main": "",
|
| 70 |
+
"types": "index.d.ts",
|
| 71 |
+
"repository": {
|
| 72 |
+
"type": "git",
|
| 73 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 74 |
+
"directory": "types/node-fetch"
|
| 75 |
+
},
|
| 76 |
+
"scripts": {},
|
| 77 |
+
"dependencies": {
|
| 78 |
+
"@types/node": "*",
|
| 79 |
+
"form-data": "^4.0.0"
|
| 80 |
+
},
|
| 81 |
+
"peerDependencies": {},
|
| 82 |
+
"typesPublisherContentHash": "ebdd1146f8abd6b712fd73289dda67142f5307fc11c3c5f321f8da964a43054e",
|
| 83 |
+
"typeScriptVersion": "4.9"
|
| 84 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/node`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for node (https://nodejs.org/).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Tue, 22 Jul 2025 11:34:36 GMT
|
| 12 |
+
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
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), [Dmitry Semigradsky](https://github.com/Semigradsky), [René](https://github.com/Renegade334), and [Yagiz Nizipli](https://github.com/anonrig).
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/assert.d.ts
ADDED
|
@@ -0,0 +1,1056 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* The `node:assert` module provides a set of assertion functions for verifying
|
| 3 |
+
* invariants.
|
| 4 |
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/assert.js)
|
| 5 |
+
*/
|
| 6 |
+
declare module "assert" {
|
| 7 |
+
/**
|
| 8 |
+
* An alias of {@link ok}.
|
| 9 |
+
* @since v0.5.9
|
| 10 |
+
* @param value The input that is checked for being truthy.
|
| 11 |
+
*/
|
| 12 |
+
function assert(value: unknown, message?: string | Error): asserts value;
|
| 13 |
+
namespace assert {
|
| 14 |
+
/**
|
| 15 |
+
* Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
|
| 16 |
+
*/
|
| 17 |
+
class AssertionError extends Error {
|
| 18 |
+
/**
|
| 19 |
+
* Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
|
| 20 |
+
*/
|
| 21 |
+
actual: unknown;
|
| 22 |
+
/**
|
| 23 |
+
* Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
|
| 24 |
+
*/
|
| 25 |
+
expected: unknown;
|
| 26 |
+
/**
|
| 27 |
+
* Set to the passed in operator value.
|
| 28 |
+
*/
|
| 29 |
+
operator: string;
|
| 30 |
+
/**
|
| 31 |
+
* Indicates if the message was auto-generated (`true`) or not.
|
| 32 |
+
*/
|
| 33 |
+
generatedMessage: boolean;
|
| 34 |
+
/**
|
| 35 |
+
* Value is always `ERR_ASSERTION` to show that the error is an assertion error.
|
| 36 |
+
*/
|
| 37 |
+
code: "ERR_ASSERTION";
|
| 38 |
+
constructor(options?: {
|
| 39 |
+
/** If provided, the error message is set to this value. */
|
| 40 |
+
message?: string | undefined;
|
| 41 |
+
/** The `actual` property on the error instance. */
|
| 42 |
+
actual?: unknown | undefined;
|
| 43 |
+
/** The `expected` property on the error instance. */
|
| 44 |
+
expected?: unknown | undefined;
|
| 45 |
+
/** The `operator` property on the error instance. */
|
| 46 |
+
operator?: string | undefined;
|
| 47 |
+
/** If provided, the generated stack trace omits frames before this function. */
|
| 48 |
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
| 49 |
+
stackStartFn?: Function | undefined;
|
| 50 |
+
});
|
| 51 |
+
}
|
| 52 |
+
/**
|
| 53 |
+
* This feature is deprecated and will be removed in a future version.
|
| 54 |
+
* Please consider using alternatives such as the `mock` helper function.
|
| 55 |
+
* @since v14.2.0, v12.19.0
|
| 56 |
+
* @deprecated Deprecated
|
| 57 |
+
*/
|
| 58 |
+
class CallTracker {
|
| 59 |
+
/**
|
| 60 |
+
* The wrapper function is expected to be called exactly `exact` times. If the
|
| 61 |
+
* function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an
|
| 62 |
+
* error.
|
| 63 |
+
*
|
| 64 |
+
* ```js
|
| 65 |
+
* import assert from 'node:assert';
|
| 66 |
+
*
|
| 67 |
+
* // Creates call tracker.
|
| 68 |
+
* const tracker = new assert.CallTracker();
|
| 69 |
+
*
|
| 70 |
+
* function func() {}
|
| 71 |
+
*
|
| 72 |
+
* // Returns a function that wraps func() that must be called exact times
|
| 73 |
+
* // before tracker.verify().
|
| 74 |
+
* const callsfunc = tracker.calls(func);
|
| 75 |
+
* ```
|
| 76 |
+
* @since v14.2.0, v12.19.0
|
| 77 |
+
* @param [fn='A no-op function']
|
| 78 |
+
* @param [exact=1]
|
| 79 |
+
* @return A function that wraps `fn`.
|
| 80 |
+
*/
|
| 81 |
+
calls(exact?: number): () => void;
|
| 82 |
+
calls(fn: undefined, exact?: number): () => void;
|
| 83 |
+
calls<Func extends (...args: any[]) => any>(fn: Func, exact?: number): Func;
|
| 84 |
+
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func | (() => void);
|
| 85 |
+
/**
|
| 86 |
+
* Example:
|
| 87 |
+
*
|
| 88 |
+
* ```js
|
| 89 |
+
* import assert from 'node:assert';
|
| 90 |
+
*
|
| 91 |
+
* const tracker = new assert.CallTracker();
|
| 92 |
+
*
|
| 93 |
+
* function func() {}
|
| 94 |
+
* const callsfunc = tracker.calls(func);
|
| 95 |
+
* callsfunc(1, 2, 3);
|
| 96 |
+
*
|
| 97 |
+
* assert.deepStrictEqual(tracker.getCalls(callsfunc),
|
| 98 |
+
* [{ thisArg: undefined, arguments: [1, 2, 3] }]);
|
| 99 |
+
* ```
|
| 100 |
+
* @since v18.8.0, v16.18.0
|
| 101 |
+
* @return An array with all the calls to a tracked function.
|
| 102 |
+
*/
|
| 103 |
+
getCalls(fn: Function): CallTrackerCall[];
|
| 104 |
+
/**
|
| 105 |
+
* The arrays contains information about the expected and actual number of calls of
|
| 106 |
+
* the functions that have not been called the expected number of times.
|
| 107 |
+
*
|
| 108 |
+
* ```js
|
| 109 |
+
* import assert from 'node:assert';
|
| 110 |
+
*
|
| 111 |
+
* // Creates call tracker.
|
| 112 |
+
* const tracker = new assert.CallTracker();
|
| 113 |
+
*
|
| 114 |
+
* function func() {}
|
| 115 |
+
*
|
| 116 |
+
* // Returns a function that wraps func() that must be called exact times
|
| 117 |
+
* // before tracker.verify().
|
| 118 |
+
* const callsfunc = tracker.calls(func, 2);
|
| 119 |
+
*
|
| 120 |
+
* // Returns an array containing information on callsfunc()
|
| 121 |
+
* console.log(tracker.report());
|
| 122 |
+
* // [
|
| 123 |
+
* // {
|
| 124 |
+
* // message: 'Expected the func function to be executed 2 time(s) but was
|
| 125 |
+
* // executed 0 time(s).',
|
| 126 |
+
* // actual: 0,
|
| 127 |
+
* // expected: 2,
|
| 128 |
+
* // operator: 'func',
|
| 129 |
+
* // stack: stack trace
|
| 130 |
+
* // }
|
| 131 |
+
* // ]
|
| 132 |
+
* ```
|
| 133 |
+
* @since v14.2.0, v12.19.0
|
| 134 |
+
* @return An array of objects containing information about the wrapper functions returned by {@link tracker.calls()}.
|
| 135 |
+
*/
|
| 136 |
+
report(): CallTrackerReportInformation[];
|
| 137 |
+
/**
|
| 138 |
+
* Reset calls of the call tracker. If a tracked function is passed as an argument, the calls will be reset for it.
|
| 139 |
+
* If no arguments are passed, all tracked functions will be reset.
|
| 140 |
+
*
|
| 141 |
+
* ```js
|
| 142 |
+
* import assert from 'node:assert';
|
| 143 |
+
*
|
| 144 |
+
* const tracker = new assert.CallTracker();
|
| 145 |
+
*
|
| 146 |
+
* function func() {}
|
| 147 |
+
* const callsfunc = tracker.calls(func);
|
| 148 |
+
*
|
| 149 |
+
* callsfunc();
|
| 150 |
+
* // Tracker was called once
|
| 151 |
+
* assert.strictEqual(tracker.getCalls(callsfunc).length, 1);
|
| 152 |
+
*
|
| 153 |
+
* tracker.reset(callsfunc);
|
| 154 |
+
* assert.strictEqual(tracker.getCalls(callsfunc).length, 0);
|
| 155 |
+
* ```
|
| 156 |
+
* @since v18.8.0, v16.18.0
|
| 157 |
+
* @param fn a tracked function to reset.
|
| 158 |
+
*/
|
| 159 |
+
reset(fn?: Function): void;
|
| 160 |
+
/**
|
| 161 |
+
* Iterates through the list of functions passed to {@link tracker.calls()} and will throw an error for functions that
|
| 162 |
+
* have not been called the expected number of times.
|
| 163 |
+
*
|
| 164 |
+
* ```js
|
| 165 |
+
* import assert from 'node:assert';
|
| 166 |
+
*
|
| 167 |
+
* // Creates call tracker.
|
| 168 |
+
* const tracker = new assert.CallTracker();
|
| 169 |
+
*
|
| 170 |
+
* function func() {}
|
| 171 |
+
*
|
| 172 |
+
* // Returns a function that wraps func() that must be called exact times
|
| 173 |
+
* // before tracker.verify().
|
| 174 |
+
* const callsfunc = tracker.calls(func, 2);
|
| 175 |
+
*
|
| 176 |
+
* callsfunc();
|
| 177 |
+
*
|
| 178 |
+
* // Will throw an error since callsfunc() was only called once.
|
| 179 |
+
* tracker.verify();
|
| 180 |
+
* ```
|
| 181 |
+
* @since v14.2.0, v12.19.0
|
| 182 |
+
*/
|
| 183 |
+
verify(): void;
|
| 184 |
+
}
|
| 185 |
+
interface CallTrackerCall {
|
| 186 |
+
thisArg: object;
|
| 187 |
+
arguments: unknown[];
|
| 188 |
+
}
|
| 189 |
+
interface CallTrackerReportInformation {
|
| 190 |
+
message: string;
|
| 191 |
+
/** The actual number of times the function was called. */
|
| 192 |
+
actual: number;
|
| 193 |
+
/** The number of times the function was expected to be called. */
|
| 194 |
+
expected: number;
|
| 195 |
+
/** The name of the function that is wrapped. */
|
| 196 |
+
operator: string;
|
| 197 |
+
/** A stack trace of the function. */
|
| 198 |
+
stack: object;
|
| 199 |
+
}
|
| 200 |
+
type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error;
|
| 201 |
+
/**
|
| 202 |
+
* Throws an `AssertionError` with the provided error message or a default
|
| 203 |
+
* error message. If the `message` parameter is an instance of an `Error` then
|
| 204 |
+
* it will be thrown instead of the `AssertionError`.
|
| 205 |
+
*
|
| 206 |
+
* ```js
|
| 207 |
+
* import assert from 'node:assert/strict';
|
| 208 |
+
*
|
| 209 |
+
* assert.fail();
|
| 210 |
+
* // AssertionError [ERR_ASSERTION]: Failed
|
| 211 |
+
*
|
| 212 |
+
* assert.fail('boom');
|
| 213 |
+
* // AssertionError [ERR_ASSERTION]: boom
|
| 214 |
+
*
|
| 215 |
+
* assert.fail(new TypeError('need array'));
|
| 216 |
+
* // TypeError: need array
|
| 217 |
+
* ```
|
| 218 |
+
*
|
| 219 |
+
* Using `assert.fail()` with more than two arguments is possible but deprecated.
|
| 220 |
+
* See below for further details.
|
| 221 |
+
* @since v0.1.21
|
| 222 |
+
* @param [message='Failed']
|
| 223 |
+
*/
|
| 224 |
+
function fail(message?: string | Error): never;
|
| 225 |
+
/** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
|
| 226 |
+
function fail(
|
| 227 |
+
actual: unknown,
|
| 228 |
+
expected: unknown,
|
| 229 |
+
message?: string | Error,
|
| 230 |
+
operator?: string,
|
| 231 |
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
| 232 |
+
stackStartFn?: Function,
|
| 233 |
+
): never;
|
| 234 |
+
/**
|
| 235 |
+
* Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
|
| 236 |
+
*
|
| 237 |
+
* If `value` is not truthy, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is `undefined`, a default
|
| 238 |
+
* error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
| 239 |
+
* If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``.
|
| 240 |
+
*
|
| 241 |
+
* Be aware that in the `repl` the error message will be different to the one
|
| 242 |
+
* thrown in a file! See below for further details.
|
| 243 |
+
*
|
| 244 |
+
* ```js
|
| 245 |
+
* import assert from 'node:assert/strict';
|
| 246 |
+
*
|
| 247 |
+
* assert.ok(true);
|
| 248 |
+
* // OK
|
| 249 |
+
* assert.ok(1);
|
| 250 |
+
* // OK
|
| 251 |
+
*
|
| 252 |
+
* assert.ok();
|
| 253 |
+
* // AssertionError: No value argument passed to `assert.ok()`
|
| 254 |
+
*
|
| 255 |
+
* assert.ok(false, 'it\'s false');
|
| 256 |
+
* // AssertionError: it's false
|
| 257 |
+
*
|
| 258 |
+
* // In the repl:
|
| 259 |
+
* assert.ok(typeof 123 === 'string');
|
| 260 |
+
* // AssertionError: false == true
|
| 261 |
+
*
|
| 262 |
+
* // In a file (e.g. test.js):
|
| 263 |
+
* assert.ok(typeof 123 === 'string');
|
| 264 |
+
* // AssertionError: The expression evaluated to a falsy value:
|
| 265 |
+
* //
|
| 266 |
+
* // assert.ok(typeof 123 === 'string')
|
| 267 |
+
*
|
| 268 |
+
* assert.ok(false);
|
| 269 |
+
* // AssertionError: The expression evaluated to a falsy value:
|
| 270 |
+
* //
|
| 271 |
+
* // assert.ok(false)
|
| 272 |
+
*
|
| 273 |
+
* assert.ok(0);
|
| 274 |
+
* // AssertionError: The expression evaluated to a falsy value:
|
| 275 |
+
* //
|
| 276 |
+
* // assert.ok(0)
|
| 277 |
+
* ```
|
| 278 |
+
*
|
| 279 |
+
* ```js
|
| 280 |
+
* import assert from 'node:assert/strict';
|
| 281 |
+
*
|
| 282 |
+
* // Using `assert()` works the same:
|
| 283 |
+
* assert(0);
|
| 284 |
+
* // AssertionError: The expression evaluated to a falsy value:
|
| 285 |
+
* //
|
| 286 |
+
* // assert(0)
|
| 287 |
+
* ```
|
| 288 |
+
* @since v0.1.21
|
| 289 |
+
*/
|
| 290 |
+
function ok(value: unknown, message?: string | Error): asserts value;
|
| 291 |
+
/**
|
| 292 |
+
* **Strict assertion mode**
|
| 293 |
+
*
|
| 294 |
+
* An alias of {@link strictEqual}.
|
| 295 |
+
*
|
| 296 |
+
* **Legacy assertion mode**
|
| 297 |
+
*
|
| 298 |
+
* > Stability: 3 - Legacy: Use {@link strictEqual} instead.
|
| 299 |
+
*
|
| 300 |
+
* Tests shallow, coercive equality between the `actual` and `expected` parameters
|
| 301 |
+
* using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled
|
| 302 |
+
* and treated as being identical if both sides are `NaN`.
|
| 303 |
+
*
|
| 304 |
+
* ```js
|
| 305 |
+
* import assert from 'node:assert';
|
| 306 |
+
*
|
| 307 |
+
* assert.equal(1, 1);
|
| 308 |
+
* // OK, 1 == 1
|
| 309 |
+
* assert.equal(1, '1');
|
| 310 |
+
* // OK, 1 == '1'
|
| 311 |
+
* assert.equal(NaN, NaN);
|
| 312 |
+
* // OK
|
| 313 |
+
*
|
| 314 |
+
* assert.equal(1, 2);
|
| 315 |
+
* // AssertionError: 1 == 2
|
| 316 |
+
* assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
|
| 317 |
+
* // AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
|
| 318 |
+
* ```
|
| 319 |
+
*
|
| 320 |
+
* If the values are not equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
|
| 321 |
+
* error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
| 322 |
+
* @since v0.1.21
|
| 323 |
+
*/
|
| 324 |
+
function equal(actual: unknown, expected: unknown, message?: string | Error): void;
|
| 325 |
+
/**
|
| 326 |
+
* **Strict assertion mode**
|
| 327 |
+
*
|
| 328 |
+
* An alias of {@link notStrictEqual}.
|
| 329 |
+
*
|
| 330 |
+
* **Legacy assertion mode**
|
| 331 |
+
*
|
| 332 |
+
* > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
|
| 333 |
+
*
|
| 334 |
+
* Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is
|
| 335 |
+
* specially handled and treated as being identical if both sides are `NaN`.
|
| 336 |
+
*
|
| 337 |
+
* ```js
|
| 338 |
+
* import assert from 'node:assert';
|
| 339 |
+
*
|
| 340 |
+
* assert.notEqual(1, 2);
|
| 341 |
+
* // OK
|
| 342 |
+
*
|
| 343 |
+
* assert.notEqual(1, 1);
|
| 344 |
+
* // AssertionError: 1 != 1
|
| 345 |
+
*
|
| 346 |
+
* assert.notEqual(1, '1');
|
| 347 |
+
* // AssertionError: 1 != '1'
|
| 348 |
+
* ```
|
| 349 |
+
*
|
| 350 |
+
* If the values are equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error
|
| 351 |
+
* message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
| 352 |
+
* @since v0.1.21
|
| 353 |
+
*/
|
| 354 |
+
function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
| 355 |
+
/**
|
| 356 |
+
* **Strict assertion mode**
|
| 357 |
+
*
|
| 358 |
+
* An alias of {@link deepStrictEqual}.
|
| 359 |
+
*
|
| 360 |
+
* **Legacy assertion mode**
|
| 361 |
+
*
|
| 362 |
+
* > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead.
|
| 363 |
+
*
|
| 364 |
+
* Tests for deep equality between the `actual` and `expected` parameters. Consider
|
| 365 |
+
* using {@link deepStrictEqual} instead. {@link deepEqual} can have
|
| 366 |
+
* surprising results.
|
| 367 |
+
*
|
| 368 |
+
* _Deep equality_ means that the enumerable "own" properties of child objects
|
| 369 |
+
* are also recursively evaluated by the following rules.
|
| 370 |
+
* @since v0.1.21
|
| 371 |
+
*/
|
| 372 |
+
function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
| 373 |
+
/**
|
| 374 |
+
* **Strict assertion mode**
|
| 375 |
+
*
|
| 376 |
+
* An alias of {@link notDeepStrictEqual}.
|
| 377 |
+
*
|
| 378 |
+
* **Legacy assertion mode**
|
| 379 |
+
*
|
| 380 |
+
* > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead.
|
| 381 |
+
*
|
| 382 |
+
* Tests for any deep inequality. Opposite of {@link deepEqual}.
|
| 383 |
+
*
|
| 384 |
+
* ```js
|
| 385 |
+
* import assert from 'node:assert';
|
| 386 |
+
*
|
| 387 |
+
* const obj1 = {
|
| 388 |
+
* a: {
|
| 389 |
+
* b: 1,
|
| 390 |
+
* },
|
| 391 |
+
* };
|
| 392 |
+
* const obj2 = {
|
| 393 |
+
* a: {
|
| 394 |
+
* b: 2,
|
| 395 |
+
* },
|
| 396 |
+
* };
|
| 397 |
+
* const obj3 = {
|
| 398 |
+
* a: {
|
| 399 |
+
* b: 1,
|
| 400 |
+
* },
|
| 401 |
+
* };
|
| 402 |
+
* const obj4 = { __proto__: obj1 };
|
| 403 |
+
*
|
| 404 |
+
* assert.notDeepEqual(obj1, obj1);
|
| 405 |
+
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
|
| 406 |
+
*
|
| 407 |
+
* assert.notDeepEqual(obj1, obj2);
|
| 408 |
+
* // OK
|
| 409 |
+
*
|
| 410 |
+
* assert.notDeepEqual(obj1, obj3);
|
| 411 |
+
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
|
| 412 |
+
*
|
| 413 |
+
* assert.notDeepEqual(obj1, obj4);
|
| 414 |
+
* // OK
|
| 415 |
+
* ```
|
| 416 |
+
*
|
| 417 |
+
* If the values are deeply equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
|
| 418 |
+
* error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
|
| 419 |
+
* instead of the `AssertionError`.
|
| 420 |
+
* @since v0.1.21
|
| 421 |
+
*/
|
| 422 |
+
function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
| 423 |
+
/**
|
| 424 |
+
* Tests strict equality between the `actual` and `expected` parameters as
|
| 425 |
+
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
|
| 426 |
+
*
|
| 427 |
+
* ```js
|
| 428 |
+
* import assert from 'node:assert/strict';
|
| 429 |
+
*
|
| 430 |
+
* assert.strictEqual(1, 2);
|
| 431 |
+
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
|
| 432 |
+
* //
|
| 433 |
+
* // 1 !== 2
|
| 434 |
+
*
|
| 435 |
+
* assert.strictEqual(1, 1);
|
| 436 |
+
* // OK
|
| 437 |
+
*
|
| 438 |
+
* assert.strictEqual('Hello foobar', 'Hello World!');
|
| 439 |
+
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
|
| 440 |
+
* // + actual - expected
|
| 441 |
+
* //
|
| 442 |
+
* // + 'Hello foobar'
|
| 443 |
+
* // - 'Hello World!'
|
| 444 |
+
* // ^
|
| 445 |
+
*
|
| 446 |
+
* const apples = 1;
|
| 447 |
+
* const oranges = 2;
|
| 448 |
+
* assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`);
|
| 449 |
+
* // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2
|
| 450 |
+
*
|
| 451 |
+
* assert.strictEqual(1, '1', new TypeError('Inputs are not identical'));
|
| 452 |
+
* // TypeError: Inputs are not identical
|
| 453 |
+
* ```
|
| 454 |
+
*
|
| 455 |
+
* If the values are not strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
|
| 456 |
+
* default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
|
| 457 |
+
* instead of the `AssertionError`.
|
| 458 |
+
* @since v0.1.21
|
| 459 |
+
*/
|
| 460 |
+
function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
| 461 |
+
/**
|
| 462 |
+
* Tests strict inequality between the `actual` and `expected` parameters as
|
| 463 |
+
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
|
| 464 |
+
*
|
| 465 |
+
* ```js
|
| 466 |
+
* import assert from 'node:assert/strict';
|
| 467 |
+
*
|
| 468 |
+
* assert.notStrictEqual(1, 2);
|
| 469 |
+
* // OK
|
| 470 |
+
*
|
| 471 |
+
* assert.notStrictEqual(1, 1);
|
| 472 |
+
* // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to:
|
| 473 |
+
* //
|
| 474 |
+
* // 1
|
| 475 |
+
*
|
| 476 |
+
* assert.notStrictEqual(1, '1');
|
| 477 |
+
* // OK
|
| 478 |
+
* ```
|
| 479 |
+
*
|
| 480 |
+
* If the values are strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
|
| 481 |
+
* default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
|
| 482 |
+
* instead of the `AssertionError`.
|
| 483 |
+
* @since v0.1.21
|
| 484 |
+
*/
|
| 485 |
+
function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
| 486 |
+
/**
|
| 487 |
+
* Tests for deep equality between the `actual` and `expected` parameters.
|
| 488 |
+
* "Deep" equality means that the enumerable "own" properties of child objects
|
| 489 |
+
* are recursively evaluated also by the following rules.
|
| 490 |
+
* @since v1.2.0
|
| 491 |
+
*/
|
| 492 |
+
function deepStrictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
| 493 |
+
/**
|
| 494 |
+
* Tests for deep strict inequality. Opposite of {@link deepStrictEqual}.
|
| 495 |
+
*
|
| 496 |
+
* ```js
|
| 497 |
+
* import assert from 'node:assert/strict';
|
| 498 |
+
*
|
| 499 |
+
* assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
|
| 500 |
+
* // OK
|
| 501 |
+
* ```
|
| 502 |
+
*
|
| 503 |
+
* If the values are deeply and strictly equal, an `AssertionError` is thrown
|
| 504 |
+
* with a `message` property set equal to the value of the `message` parameter. If
|
| 505 |
+
* the `message` parameter is undefined, a default error message is assigned. If
|
| 506 |
+
* the `message` parameter is an instance of an `Error` then it will be thrown
|
| 507 |
+
* instead of the `AssertionError`.
|
| 508 |
+
* @since v1.2.0
|
| 509 |
+
*/
|
| 510 |
+
function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
| 511 |
+
/**
|
| 512 |
+
* Expects the function `fn` to throw an error.
|
| 513 |
+
*
|
| 514 |
+
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
| 515 |
+
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
|
| 516 |
+
* a validation object where each property will be tested for strict deep equality,
|
| 517 |
+
* or an instance of error where each property will be tested for strict deep
|
| 518 |
+
* equality including the non-enumerable `message` and `name` properties. When
|
| 519 |
+
* using an object, it is also possible to use a regular expression, when
|
| 520 |
+
* validating against a string property. See below for examples.
|
| 521 |
+
*
|
| 522 |
+
* If specified, `message` will be appended to the message provided by the `AssertionError` if the `fn` call fails to throw or in case the error validation
|
| 523 |
+
* fails.
|
| 524 |
+
*
|
| 525 |
+
* Custom validation object/error instance:
|
| 526 |
+
*
|
| 527 |
+
* ```js
|
| 528 |
+
* import assert from 'node:assert/strict';
|
| 529 |
+
*
|
| 530 |
+
* const err = new TypeError('Wrong value');
|
| 531 |
+
* err.code = 404;
|
| 532 |
+
* err.foo = 'bar';
|
| 533 |
+
* err.info = {
|
| 534 |
+
* nested: true,
|
| 535 |
+
* baz: 'text',
|
| 536 |
+
* };
|
| 537 |
+
* err.reg = /abc/i;
|
| 538 |
+
*
|
| 539 |
+
* assert.throws(
|
| 540 |
+
* () => {
|
| 541 |
+
* throw err;
|
| 542 |
+
* },
|
| 543 |
+
* {
|
| 544 |
+
* name: 'TypeError',
|
| 545 |
+
* message: 'Wrong value',
|
| 546 |
+
* info: {
|
| 547 |
+
* nested: true,
|
| 548 |
+
* baz: 'text',
|
| 549 |
+
* },
|
| 550 |
+
* // Only properties on the validation object will be tested for.
|
| 551 |
+
* // Using nested objects requires all properties to be present. Otherwise
|
| 552 |
+
* // the validation is going to fail.
|
| 553 |
+
* },
|
| 554 |
+
* );
|
| 555 |
+
*
|
| 556 |
+
* // Using regular expressions to validate error properties:
|
| 557 |
+
* assert.throws(
|
| 558 |
+
* () => {
|
| 559 |
+
* throw err;
|
| 560 |
+
* },
|
| 561 |
+
* {
|
| 562 |
+
* // The `name` and `message` properties are strings and using regular
|
| 563 |
+
* // expressions on those will match against the string. If they fail, an
|
| 564 |
+
* // error is thrown.
|
| 565 |
+
* name: /^TypeError$/,
|
| 566 |
+
* message: /Wrong/,
|
| 567 |
+
* foo: 'bar',
|
| 568 |
+
* info: {
|
| 569 |
+
* nested: true,
|
| 570 |
+
* // It is not possible to use regular expressions for nested properties!
|
| 571 |
+
* baz: 'text',
|
| 572 |
+
* },
|
| 573 |
+
* // The `reg` property contains a regular expression and only if the
|
| 574 |
+
* // validation object contains an identical regular expression, it is going
|
| 575 |
+
* // to pass.
|
| 576 |
+
* reg: /abc/i,
|
| 577 |
+
* },
|
| 578 |
+
* );
|
| 579 |
+
*
|
| 580 |
+
* // Fails due to the different `message` and `name` properties:
|
| 581 |
+
* assert.throws(
|
| 582 |
+
* () => {
|
| 583 |
+
* const otherErr = new Error('Not found');
|
| 584 |
+
* // Copy all enumerable properties from `err` to `otherErr`.
|
| 585 |
+
* for (const [key, value] of Object.entries(err)) {
|
| 586 |
+
* otherErr[key] = value;
|
| 587 |
+
* }
|
| 588 |
+
* throw otherErr;
|
| 589 |
+
* },
|
| 590 |
+
* // The error's `message` and `name` properties will also be checked when using
|
| 591 |
+
* // an error as validation object.
|
| 592 |
+
* err,
|
| 593 |
+
* );
|
| 594 |
+
* ```
|
| 595 |
+
*
|
| 596 |
+
* Validate instanceof using constructor:
|
| 597 |
+
*
|
| 598 |
+
* ```js
|
| 599 |
+
* import assert from 'node:assert/strict';
|
| 600 |
+
*
|
| 601 |
+
* assert.throws(
|
| 602 |
+
* () => {
|
| 603 |
+
* throw new Error('Wrong value');
|
| 604 |
+
* },
|
| 605 |
+
* Error,
|
| 606 |
+
* );
|
| 607 |
+
* ```
|
| 608 |
+
*
|
| 609 |
+
* Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions):
|
| 610 |
+
*
|
| 611 |
+
* Using a regular expression runs `.toString` on the error object, and will
|
| 612 |
+
* therefore also include the error name.
|
| 613 |
+
*
|
| 614 |
+
* ```js
|
| 615 |
+
* import assert from 'node:assert/strict';
|
| 616 |
+
*
|
| 617 |
+
* assert.throws(
|
| 618 |
+
* () => {
|
| 619 |
+
* throw new Error('Wrong value');
|
| 620 |
+
* },
|
| 621 |
+
* /^Error: Wrong value$/,
|
| 622 |
+
* );
|
| 623 |
+
* ```
|
| 624 |
+
*
|
| 625 |
+
* Custom error validation:
|
| 626 |
+
*
|
| 627 |
+
* The function must return `true` to indicate all internal validations passed.
|
| 628 |
+
* It will otherwise fail with an `AssertionError`.
|
| 629 |
+
*
|
| 630 |
+
* ```js
|
| 631 |
+
* import assert from 'node:assert/strict';
|
| 632 |
+
*
|
| 633 |
+
* assert.throws(
|
| 634 |
+
* () => {
|
| 635 |
+
* throw new Error('Wrong value');
|
| 636 |
+
* },
|
| 637 |
+
* (err) => {
|
| 638 |
+
* assert(err instanceof Error);
|
| 639 |
+
* assert(/value/.test(err));
|
| 640 |
+
* // Avoid returning anything from validation functions besides `true`.
|
| 641 |
+
* // Otherwise, it's not clear what part of the validation failed. Instead,
|
| 642 |
+
* // throw an error about the specific validation that failed (as done in this
|
| 643 |
+
* // example) and add as much helpful debugging information to that error as
|
| 644 |
+
* // possible.
|
| 645 |
+
* return true;
|
| 646 |
+
* },
|
| 647 |
+
* 'unexpected error',
|
| 648 |
+
* );
|
| 649 |
+
* ```
|
| 650 |
+
*
|
| 651 |
+
* `error` cannot be a string. If a string is provided as the second
|
| 652 |
+
* argument, then `error` is assumed to be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Using the same
|
| 653 |
+
* message as the thrown error message is going to result in an `ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
|
| 654 |
+
* a string as the second argument gets considered:
|
| 655 |
+
*
|
| 656 |
+
* ```js
|
| 657 |
+
* import assert from 'node:assert/strict';
|
| 658 |
+
*
|
| 659 |
+
* function throwingFirst() {
|
| 660 |
+
* throw new Error('First');
|
| 661 |
+
* }
|
| 662 |
+
*
|
| 663 |
+
* function throwingSecond() {
|
| 664 |
+
* throw new Error('Second');
|
| 665 |
+
* }
|
| 666 |
+
*
|
| 667 |
+
* function notThrowing() {}
|
| 668 |
+
*
|
| 669 |
+
* // The second argument is a string and the input function threw an Error.
|
| 670 |
+
* // The first case will not throw as it does not match for the error message
|
| 671 |
+
* // thrown by the input function!
|
| 672 |
+
* assert.throws(throwingFirst, 'Second');
|
| 673 |
+
* // In the next example the message has no benefit over the message from the
|
| 674 |
+
* // error and since it is not clear if the user intended to actually match
|
| 675 |
+
* // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error.
|
| 676 |
+
* assert.throws(throwingSecond, 'Second');
|
| 677 |
+
* // TypeError [ERR_AMBIGUOUS_ARGUMENT]
|
| 678 |
+
*
|
| 679 |
+
* // The string is only used (as message) in case the function does not throw:
|
| 680 |
+
* assert.throws(notThrowing, 'Second');
|
| 681 |
+
* // AssertionError [ERR_ASSERTION]: Missing expected exception: Second
|
| 682 |
+
*
|
| 683 |
+
* // If it was intended to match for the error message do this instead:
|
| 684 |
+
* // It does not throw because the error messages match.
|
| 685 |
+
* assert.throws(throwingSecond, /Second$/);
|
| 686 |
+
*
|
| 687 |
+
* // If the error message does not match, an AssertionError is thrown.
|
| 688 |
+
* assert.throws(throwingFirst, /Second$/);
|
| 689 |
+
* // AssertionError [ERR_ASSERTION]
|
| 690 |
+
* ```
|
| 691 |
+
*
|
| 692 |
+
* Due to the confusing error-prone notation, avoid a string as the second
|
| 693 |
+
* argument.
|
| 694 |
+
* @since v0.1.21
|
| 695 |
+
*/
|
| 696 |
+
function throws(block: () => unknown, message?: string | Error): void;
|
| 697 |
+
function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
|
| 698 |
+
/**
|
| 699 |
+
* Asserts that the function `fn` does not throw an error.
|
| 700 |
+
*
|
| 701 |
+
* Using `assert.doesNotThrow()` is actually not useful because there
|
| 702 |
+
* is no benefit in catching an error and then rethrowing it. Instead, consider
|
| 703 |
+
* adding a comment next to the specific code path that should not throw and keep
|
| 704 |
+
* error messages as expressive as possible.
|
| 705 |
+
*
|
| 706 |
+
* When `assert.doesNotThrow()` is called, it will immediately call the `fn` function.
|
| 707 |
+
*
|
| 708 |
+
* If an error is thrown and it is the same type as that specified by the `error` parameter, then an `AssertionError` is thrown. If the error is of a
|
| 709 |
+
* different type, or if the `error` parameter is undefined, the error is
|
| 710 |
+
* propagated back to the caller.
|
| 711 |
+
*
|
| 712 |
+
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
| 713 |
+
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
|
| 714 |
+
* function. See {@link throws} for more details.
|
| 715 |
+
*
|
| 716 |
+
* The following, for instance, will throw the `TypeError` because there is no
|
| 717 |
+
* matching error type in the assertion:
|
| 718 |
+
*
|
| 719 |
+
* ```js
|
| 720 |
+
* import assert from 'node:assert/strict';
|
| 721 |
+
*
|
| 722 |
+
* assert.doesNotThrow(
|
| 723 |
+
* () => {
|
| 724 |
+
* throw new TypeError('Wrong value');
|
| 725 |
+
* },
|
| 726 |
+
* SyntaxError,
|
| 727 |
+
* );
|
| 728 |
+
* ```
|
| 729 |
+
*
|
| 730 |
+
* However, the following will result in an `AssertionError` with the message
|
| 731 |
+
* 'Got unwanted exception...':
|
| 732 |
+
*
|
| 733 |
+
* ```js
|
| 734 |
+
* import assert from 'node:assert/strict';
|
| 735 |
+
*
|
| 736 |
+
* assert.doesNotThrow(
|
| 737 |
+
* () => {
|
| 738 |
+
* throw new TypeError('Wrong value');
|
| 739 |
+
* },
|
| 740 |
+
* TypeError,
|
| 741 |
+
* );
|
| 742 |
+
* ```
|
| 743 |
+
*
|
| 744 |
+
* If an `AssertionError` is thrown and a value is provided for the `message` parameter, the value of `message` will be appended to the `AssertionError` message:
|
| 745 |
+
*
|
| 746 |
+
* ```js
|
| 747 |
+
* import assert from 'node:assert/strict';
|
| 748 |
+
*
|
| 749 |
+
* assert.doesNotThrow(
|
| 750 |
+
* () => {
|
| 751 |
+
* throw new TypeError('Wrong value');
|
| 752 |
+
* },
|
| 753 |
+
* /Wrong value/,
|
| 754 |
+
* 'Whoops',
|
| 755 |
+
* );
|
| 756 |
+
* // Throws: AssertionError: Got unwanted exception: Whoops
|
| 757 |
+
* ```
|
| 758 |
+
* @since v0.1.21
|
| 759 |
+
*/
|
| 760 |
+
function doesNotThrow(block: () => unknown, message?: string | Error): void;
|
| 761 |
+
function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
|
| 762 |
+
/**
|
| 763 |
+
* Throws `value` if `value` is not `undefined` or `null`. This is useful when
|
| 764 |
+
* testing the `error` argument in callbacks. The stack trace contains all frames
|
| 765 |
+
* from the error passed to `ifError()` including the potential new frames for `ifError()` itself.
|
| 766 |
+
*
|
| 767 |
+
* ```js
|
| 768 |
+
* import assert from 'node:assert/strict';
|
| 769 |
+
*
|
| 770 |
+
* assert.ifError(null);
|
| 771 |
+
* // OK
|
| 772 |
+
* assert.ifError(0);
|
| 773 |
+
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0
|
| 774 |
+
* assert.ifError('error');
|
| 775 |
+
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error'
|
| 776 |
+
* assert.ifError(new Error());
|
| 777 |
+
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error
|
| 778 |
+
*
|
| 779 |
+
* // Create some random error frames.
|
| 780 |
+
* let err;
|
| 781 |
+
* (function errorFrame() {
|
| 782 |
+
* err = new Error('test error');
|
| 783 |
+
* })();
|
| 784 |
+
*
|
| 785 |
+
* (function ifErrorFrame() {
|
| 786 |
+
* assert.ifError(err);
|
| 787 |
+
* })();
|
| 788 |
+
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error
|
| 789 |
+
* // at ifErrorFrame
|
| 790 |
+
* // at errorFrame
|
| 791 |
+
* ```
|
| 792 |
+
* @since v0.1.97
|
| 793 |
+
*/
|
| 794 |
+
function ifError(value: unknown): asserts value is null | undefined;
|
| 795 |
+
/**
|
| 796 |
+
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
|
| 797 |
+
* calls the function and awaits the returned promise to complete. It will then
|
| 798 |
+
* check that the promise is rejected.
|
| 799 |
+
*
|
| 800 |
+
* If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the
|
| 801 |
+
* function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v24.x/api/errors.html#err_invalid_return_value)
|
| 802 |
+
* error. In both cases the error handler is skipped.
|
| 803 |
+
*
|
| 804 |
+
* Besides the async nature to await the completion behaves identically to {@link throws}.
|
| 805 |
+
*
|
| 806 |
+
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
| 807 |
+
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
|
| 808 |
+
* an object where each property will be tested for, or an instance of error where
|
| 809 |
+
* each property will be tested for including the non-enumerable `message` and `name` properties.
|
| 810 |
+
*
|
| 811 |
+
* If specified, `message` will be the message provided by the `{@link AssertionError}` if the `asyncFn` fails to reject.
|
| 812 |
+
*
|
| 813 |
+
* ```js
|
| 814 |
+
* import assert from 'node:assert/strict';
|
| 815 |
+
*
|
| 816 |
+
* await assert.rejects(
|
| 817 |
+
* async () => {
|
| 818 |
+
* throw new TypeError('Wrong value');
|
| 819 |
+
* },
|
| 820 |
+
* {
|
| 821 |
+
* name: 'TypeError',
|
| 822 |
+
* message: 'Wrong value',
|
| 823 |
+
* },
|
| 824 |
+
* );
|
| 825 |
+
* ```
|
| 826 |
+
*
|
| 827 |
+
* ```js
|
| 828 |
+
* import assert from 'node:assert/strict';
|
| 829 |
+
*
|
| 830 |
+
* await assert.rejects(
|
| 831 |
+
* async () => {
|
| 832 |
+
* throw new TypeError('Wrong value');
|
| 833 |
+
* },
|
| 834 |
+
* (err) => {
|
| 835 |
+
* assert.strictEqual(err.name, 'TypeError');
|
| 836 |
+
* assert.strictEqual(err.message, 'Wrong value');
|
| 837 |
+
* return true;
|
| 838 |
+
* },
|
| 839 |
+
* );
|
| 840 |
+
* ```
|
| 841 |
+
*
|
| 842 |
+
* ```js
|
| 843 |
+
* import assert from 'node:assert/strict';
|
| 844 |
+
*
|
| 845 |
+
* assert.rejects(
|
| 846 |
+
* Promise.reject(new Error('Wrong value')),
|
| 847 |
+
* Error,
|
| 848 |
+
* ).then(() => {
|
| 849 |
+
* // ...
|
| 850 |
+
* });
|
| 851 |
+
* ```
|
| 852 |
+
*
|
| 853 |
+
* `error` cannot be a string. If a string is provided as the second argument, then `error` is assumed to
|
| 854 |
+
* be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Please read the
|
| 855 |
+
* example in {@link throws} carefully if using a string as the second argument gets considered.
|
| 856 |
+
* @since v10.0.0
|
| 857 |
+
*/
|
| 858 |
+
function rejects(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
|
| 859 |
+
function rejects(
|
| 860 |
+
block: (() => Promise<unknown>) | Promise<unknown>,
|
| 861 |
+
error: AssertPredicate,
|
| 862 |
+
message?: string | Error,
|
| 863 |
+
): Promise<void>;
|
| 864 |
+
/**
|
| 865 |
+
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
|
| 866 |
+
* calls the function and awaits the returned promise to complete. It will then
|
| 867 |
+
* check that the promise is not rejected.
|
| 868 |
+
*
|
| 869 |
+
* If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If
|
| 870 |
+
* the function does not return a promise, `assert.doesNotReject()` will return a
|
| 871 |
+
* rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v24.x/api/errors.html#err_invalid_return_value) error. In both cases
|
| 872 |
+
* the error handler is skipped.
|
| 873 |
+
*
|
| 874 |
+
* Using `assert.doesNotReject()` is actually not useful because there is little
|
| 875 |
+
* benefit in catching a rejection and then rejecting it again. Instead, consider
|
| 876 |
+
* adding a comment next to the specific code path that should not reject and keep
|
| 877 |
+
* error messages as expressive as possible.
|
| 878 |
+
*
|
| 879 |
+
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
| 880 |
+
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
|
| 881 |
+
* function. See {@link throws} for more details.
|
| 882 |
+
*
|
| 883 |
+
* Besides the async nature to await the completion behaves identically to {@link doesNotThrow}.
|
| 884 |
+
*
|
| 885 |
+
* ```js
|
| 886 |
+
* import assert from 'node:assert/strict';
|
| 887 |
+
*
|
| 888 |
+
* await assert.doesNotReject(
|
| 889 |
+
* async () => {
|
| 890 |
+
* throw new TypeError('Wrong value');
|
| 891 |
+
* },
|
| 892 |
+
* SyntaxError,
|
| 893 |
+
* );
|
| 894 |
+
* ```
|
| 895 |
+
*
|
| 896 |
+
* ```js
|
| 897 |
+
* import assert from 'node:assert/strict';
|
| 898 |
+
*
|
| 899 |
+
* assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
|
| 900 |
+
* .then(() => {
|
| 901 |
+
* // ...
|
| 902 |
+
* });
|
| 903 |
+
* ```
|
| 904 |
+
* @since v10.0.0
|
| 905 |
+
*/
|
| 906 |
+
function doesNotReject(
|
| 907 |
+
block: (() => Promise<unknown>) | Promise<unknown>,
|
| 908 |
+
message?: string | Error,
|
| 909 |
+
): Promise<void>;
|
| 910 |
+
function doesNotReject(
|
| 911 |
+
block: (() => Promise<unknown>) | Promise<unknown>,
|
| 912 |
+
error: AssertPredicate,
|
| 913 |
+
message?: string | Error,
|
| 914 |
+
): Promise<void>;
|
| 915 |
+
/**
|
| 916 |
+
* Expects the `string` input to match the regular expression.
|
| 917 |
+
*
|
| 918 |
+
* ```js
|
| 919 |
+
* import assert from 'node:assert/strict';
|
| 920 |
+
*
|
| 921 |
+
* assert.match('I will fail', /pass/);
|
| 922 |
+
* // AssertionError [ERR_ASSERTION]: The input did not match the regular ...
|
| 923 |
+
*
|
| 924 |
+
* assert.match(123, /pass/);
|
| 925 |
+
* // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
|
| 926 |
+
*
|
| 927 |
+
* assert.match('I will pass', /pass/);
|
| 928 |
+
* // OK
|
| 929 |
+
* ```
|
| 930 |
+
*
|
| 931 |
+
* If the values do not match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
| 932 |
+
* to the value of the `message` parameter. If the `message` parameter is
|
| 933 |
+
* undefined, a default error message is assigned. If the `message` parameter is an
|
| 934 |
+
* instance of an [Error](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
| 935 |
+
* @since v13.6.0, v12.16.0
|
| 936 |
+
*/
|
| 937 |
+
function match(value: string, regExp: RegExp, message?: string | Error): void;
|
| 938 |
+
/**
|
| 939 |
+
* Expects the `string` input not to match the regular expression.
|
| 940 |
+
*
|
| 941 |
+
* ```js
|
| 942 |
+
* import assert from 'node:assert/strict';
|
| 943 |
+
*
|
| 944 |
+
* assert.doesNotMatch('I will fail', /fail/);
|
| 945 |
+
* // AssertionError [ERR_ASSERTION]: The input was expected to not match the ...
|
| 946 |
+
*
|
| 947 |
+
* assert.doesNotMatch(123, /pass/);
|
| 948 |
+
* // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
|
| 949 |
+
*
|
| 950 |
+
* assert.doesNotMatch('I will pass', /different/);
|
| 951 |
+
* // OK
|
| 952 |
+
* ```
|
| 953 |
+
*
|
| 954 |
+
* If the values do match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
| 955 |
+
* to the value of the `message` parameter. If the `message` parameter is
|
| 956 |
+
* undefined, a default error message is assigned. If the `message` parameter is an
|
| 957 |
+
* instance of an [Error](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
| 958 |
+
* @since v13.6.0, v12.16.0
|
| 959 |
+
*/
|
| 960 |
+
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
|
| 961 |
+
/**
|
| 962 |
+
* Tests for partial deep equality between the `actual` and `expected` parameters.
|
| 963 |
+
* "Deep" equality means that the enumerable "own" properties of child objects
|
| 964 |
+
* are recursively evaluated also by the following rules. "Partial" equality means
|
| 965 |
+
* that only properties that exist on the `expected` parameter are going to be
|
| 966 |
+
* compared.
|
| 967 |
+
*
|
| 968 |
+
* This method always passes the same test cases as `assert.deepStrictEqual()`,
|
| 969 |
+
* behaving as a super set of it.
|
| 970 |
+
* @since v22.13.0
|
| 971 |
+
*/
|
| 972 |
+
function partialDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
| 973 |
+
/**
|
| 974 |
+
* In strict assertion mode, non-strict methods behave like their corresponding strict methods. For example,
|
| 975 |
+
* {@link deepEqual} will behave like {@link deepStrictEqual}.
|
| 976 |
+
*
|
| 977 |
+
* In strict assertion mode, error messages for objects display a diff. In legacy assertion mode, error
|
| 978 |
+
* messages for objects display the objects, often truncated.
|
| 979 |
+
*
|
| 980 |
+
* To use strict assertion mode:
|
| 981 |
+
*
|
| 982 |
+
* ```js
|
| 983 |
+
* import { strict as assert } from 'node:assert';
|
| 984 |
+
* import assert from 'node:assert/strict';
|
| 985 |
+
* ```
|
| 986 |
+
*
|
| 987 |
+
* Example error diff:
|
| 988 |
+
*
|
| 989 |
+
* ```js
|
| 990 |
+
* import { strict as assert } from 'node:assert';
|
| 991 |
+
*
|
| 992 |
+
* assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
|
| 993 |
+
* // AssertionError: Expected inputs to be strictly deep-equal:
|
| 994 |
+
* // + actual - expected ... Lines skipped
|
| 995 |
+
* //
|
| 996 |
+
* // [
|
| 997 |
+
* // [
|
| 998 |
+
* // ...
|
| 999 |
+
* // 2,
|
| 1000 |
+
* // + 3
|
| 1001 |
+
* // - '3'
|
| 1002 |
+
* // ],
|
| 1003 |
+
* // ...
|
| 1004 |
+
* // 5
|
| 1005 |
+
* // ]
|
| 1006 |
+
* ```
|
| 1007 |
+
*
|
| 1008 |
+
* To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` environment variables. This will also
|
| 1009 |
+
* deactivate the colors in the REPL. For more on color support in terminal environments, read the tty
|
| 1010 |
+
* `getColorDepth()` documentation.
|
| 1011 |
+
*
|
| 1012 |
+
* @since v15.0.0, v13.9.0, v12.16.2, v9.9.0
|
| 1013 |
+
*/
|
| 1014 |
+
namespace strict {
|
| 1015 |
+
type AssertionError = assert.AssertionError;
|
| 1016 |
+
type AssertPredicate = assert.AssertPredicate;
|
| 1017 |
+
type CallTrackerCall = assert.CallTrackerCall;
|
| 1018 |
+
type CallTrackerReportInformation = assert.CallTrackerReportInformation;
|
| 1019 |
+
}
|
| 1020 |
+
const strict:
|
| 1021 |
+
& Omit<
|
| 1022 |
+
typeof assert,
|
| 1023 |
+
| "equal"
|
| 1024 |
+
| "notEqual"
|
| 1025 |
+
| "deepEqual"
|
| 1026 |
+
| "notDeepEqual"
|
| 1027 |
+
| "ok"
|
| 1028 |
+
| "strictEqual"
|
| 1029 |
+
| "deepStrictEqual"
|
| 1030 |
+
| "ifError"
|
| 1031 |
+
| "strict"
|
| 1032 |
+
| "AssertionError"
|
| 1033 |
+
>
|
| 1034 |
+
& {
|
| 1035 |
+
(value: unknown, message?: string | Error): asserts value;
|
| 1036 |
+
equal: typeof strictEqual;
|
| 1037 |
+
notEqual: typeof notStrictEqual;
|
| 1038 |
+
deepEqual: typeof deepStrictEqual;
|
| 1039 |
+
notDeepEqual: typeof notDeepStrictEqual;
|
| 1040 |
+
// Mapped types and assertion functions are incompatible?
|
| 1041 |
+
// TS2775: Assertions require every name in the call target
|
| 1042 |
+
// to be declared with an explicit type annotation.
|
| 1043 |
+
ok: typeof ok;
|
| 1044 |
+
strictEqual: typeof strictEqual;
|
| 1045 |
+
deepStrictEqual: typeof deepStrictEqual;
|
| 1046 |
+
ifError: typeof ifError;
|
| 1047 |
+
strict: typeof strict;
|
| 1048 |
+
AssertionError: typeof AssertionError;
|
| 1049 |
+
};
|
| 1050 |
+
}
|
| 1051 |
+
export = assert;
|
| 1052 |
+
}
|
| 1053 |
+
declare module "node:assert" {
|
| 1054 |
+
import assert = require("assert");
|
| 1055 |
+
export = assert;
|
| 1056 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/assert/strict.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
declare module "assert/strict" {
|
| 2 |
+
import { strict } from "node:assert";
|
| 3 |
+
export = strict;
|
| 4 |
+
}
|
| 5 |
+
declare module "node:assert/strict" {
|
| 6 |
+
import { strict } from "node:assert";
|
| 7 |
+
export = strict;
|
| 8 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/async_hooks.d.ts
ADDED
|
@@ -0,0 +1,623 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* We strongly discourage the use of the `async_hooks` API.
|
| 3 |
+
* Other APIs that can cover most of its use cases include:
|
| 4 |
+
*
|
| 5 |
+
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v24.x/api/async_context.html#class-asynclocalstorage) tracks async context
|
| 6 |
+
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v24.x/api/process.html#processgetactiveresourcesinfo) tracks active resources
|
| 7 |
+
*
|
| 8 |
+
* The `node:async_hooks` module provides an API to track asynchronous resources.
|
| 9 |
+
* It can be accessed using:
|
| 10 |
+
*
|
| 11 |
+
* ```js
|
| 12 |
+
* import async_hooks from 'node:async_hooks';
|
| 13 |
+
* ```
|
| 14 |
+
* @experimental
|
| 15 |
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/async_hooks.js)
|
| 16 |
+
*/
|
| 17 |
+
declare module "async_hooks" {
|
| 18 |
+
/**
|
| 19 |
+
* ```js
|
| 20 |
+
* import { executionAsyncId } from 'node:async_hooks';
|
| 21 |
+
* import fs from 'node:fs';
|
| 22 |
+
*
|
| 23 |
+
* console.log(executionAsyncId()); // 1 - bootstrap
|
| 24 |
+
* const path = '.';
|
| 25 |
+
* fs.open(path, 'r', (err, fd) => {
|
| 26 |
+
* console.log(executionAsyncId()); // 6 - open()
|
| 27 |
+
* });
|
| 28 |
+
* ```
|
| 29 |
+
*
|
| 30 |
+
* The ID returned from `executionAsyncId()` is related to execution timing, not
|
| 31 |
+
* causality (which is covered by `triggerAsyncId()`):
|
| 32 |
+
*
|
| 33 |
+
* ```js
|
| 34 |
+
* const server = net.createServer((conn) => {
|
| 35 |
+
* // Returns the ID of the server, not of the new connection, because the
|
| 36 |
+
* // callback runs in the execution scope of the server's MakeCallback().
|
| 37 |
+
* async_hooks.executionAsyncId();
|
| 38 |
+
*
|
| 39 |
+
* }).listen(port, () => {
|
| 40 |
+
* // Returns the ID of a TickObject (process.nextTick()) because all
|
| 41 |
+
* // callbacks passed to .listen() are wrapped in a nextTick().
|
| 42 |
+
* async_hooks.executionAsyncId();
|
| 43 |
+
* });
|
| 44 |
+
* ```
|
| 45 |
+
*
|
| 46 |
+
* Promise contexts may not get precise `executionAsyncIds` by default.
|
| 47 |
+
* See the section on [promise execution tracking](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#promise-execution-tracking).
|
| 48 |
+
* @since v8.1.0
|
| 49 |
+
* @return The `asyncId` of the current execution context. Useful to track when something calls.
|
| 50 |
+
*/
|
| 51 |
+
function executionAsyncId(): number;
|
| 52 |
+
/**
|
| 53 |
+
* Resource objects returned by `executionAsyncResource()` are most often internal
|
| 54 |
+
* Node.js handle objects with undocumented APIs. Using any functions or properties
|
| 55 |
+
* on the object is likely to crash your application and should be avoided.
|
| 56 |
+
*
|
| 57 |
+
* Using `executionAsyncResource()` in the top-level execution context will
|
| 58 |
+
* return an empty object as there is no handle or request object to use,
|
| 59 |
+
* but having an object representing the top-level can be helpful.
|
| 60 |
+
*
|
| 61 |
+
* ```js
|
| 62 |
+
* import { open } from 'node:fs';
|
| 63 |
+
* import { executionAsyncId, executionAsyncResource } from 'node:async_hooks';
|
| 64 |
+
*
|
| 65 |
+
* console.log(executionAsyncId(), executionAsyncResource()); // 1 {}
|
| 66 |
+
* open(new URL(import.meta.url), 'r', (err, fd) => {
|
| 67 |
+
* console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap
|
| 68 |
+
* });
|
| 69 |
+
* ```
|
| 70 |
+
*
|
| 71 |
+
* This can be used to implement continuation local storage without the
|
| 72 |
+
* use of a tracking `Map` to store the metadata:
|
| 73 |
+
*
|
| 74 |
+
* ```js
|
| 75 |
+
* import { createServer } from 'node:http';
|
| 76 |
+
* import {
|
| 77 |
+
* executionAsyncId,
|
| 78 |
+
* executionAsyncResource,
|
| 79 |
+
* createHook,
|
| 80 |
+
* } from 'node:async_hooks';
|
| 81 |
+
* const sym = Symbol('state'); // Private symbol to avoid pollution
|
| 82 |
+
*
|
| 83 |
+
* createHook({
|
| 84 |
+
* init(asyncId, type, triggerAsyncId, resource) {
|
| 85 |
+
* const cr = executionAsyncResource();
|
| 86 |
+
* if (cr) {
|
| 87 |
+
* resource[sym] = cr[sym];
|
| 88 |
+
* }
|
| 89 |
+
* },
|
| 90 |
+
* }).enable();
|
| 91 |
+
*
|
| 92 |
+
* const server = createServer((req, res) => {
|
| 93 |
+
* executionAsyncResource()[sym] = { state: req.url };
|
| 94 |
+
* setTimeout(function() {
|
| 95 |
+
* res.end(JSON.stringify(executionAsyncResource()[sym]));
|
| 96 |
+
* }, 100);
|
| 97 |
+
* }).listen(3000);
|
| 98 |
+
* ```
|
| 99 |
+
* @since v13.9.0, v12.17.0
|
| 100 |
+
* @return The resource representing the current execution. Useful to store data within the resource.
|
| 101 |
+
*/
|
| 102 |
+
function executionAsyncResource(): object;
|
| 103 |
+
/**
|
| 104 |
+
* ```js
|
| 105 |
+
* const server = net.createServer((conn) => {
|
| 106 |
+
* // The resource that caused (or triggered) this callback to be called
|
| 107 |
+
* // was that of the new connection. Thus the return value of triggerAsyncId()
|
| 108 |
+
* // is the asyncId of "conn".
|
| 109 |
+
* async_hooks.triggerAsyncId();
|
| 110 |
+
*
|
| 111 |
+
* }).listen(port, () => {
|
| 112 |
+
* // Even though all callbacks passed to .listen() are wrapped in a nextTick()
|
| 113 |
+
* // the callback itself exists because the call to the server's .listen()
|
| 114 |
+
* // was made. So the return value would be the ID of the server.
|
| 115 |
+
* async_hooks.triggerAsyncId();
|
| 116 |
+
* });
|
| 117 |
+
* ```
|
| 118 |
+
*
|
| 119 |
+
* Promise contexts may not get valid `triggerAsyncId`s by default. See
|
| 120 |
+
* the section on [promise execution tracking](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#promise-execution-tracking).
|
| 121 |
+
* @return The ID of the resource responsible for calling the callback that is currently being executed.
|
| 122 |
+
*/
|
| 123 |
+
function triggerAsyncId(): number;
|
| 124 |
+
interface HookCallbacks {
|
| 125 |
+
/**
|
| 126 |
+
* Called when a class is constructed that has the possibility to emit an asynchronous event.
|
| 127 |
+
* @param asyncId A unique ID for the async resource
|
| 128 |
+
* @param type The type of the async resource
|
| 129 |
+
* @param triggerAsyncId The unique ID of the async resource in whose execution context this async resource was created
|
| 130 |
+
* @param resource Reference to the resource representing the async operation, needs to be released during destroy
|
| 131 |
+
*/
|
| 132 |
+
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
|
| 133 |
+
/**
|
| 134 |
+
* When an asynchronous operation is initiated or completes a callback is called to notify the user.
|
| 135 |
+
* The before callback is called just before said callback is executed.
|
| 136 |
+
* @param asyncId the unique identifier assigned to the resource about to execute the callback.
|
| 137 |
+
*/
|
| 138 |
+
before?(asyncId: number): void;
|
| 139 |
+
/**
|
| 140 |
+
* Called immediately after the callback specified in `before` is completed.
|
| 141 |
+
*
|
| 142 |
+
* If an uncaught exception occurs during execution of the callback, then `after` will run after the `'uncaughtException'` event is emitted or a `domain`'s handler runs.
|
| 143 |
+
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
|
| 144 |
+
*/
|
| 145 |
+
after?(asyncId: number): void;
|
| 146 |
+
/**
|
| 147 |
+
* Called when a promise has resolve() called. This may not be in the same execution id
|
| 148 |
+
* as the promise itself.
|
| 149 |
+
* @param asyncId the unique id for the promise that was resolve()d.
|
| 150 |
+
*/
|
| 151 |
+
promiseResolve?(asyncId: number): void;
|
| 152 |
+
/**
|
| 153 |
+
* Called after the resource corresponding to asyncId is destroyed
|
| 154 |
+
* @param asyncId a unique ID for the async resource
|
| 155 |
+
*/
|
| 156 |
+
destroy?(asyncId: number): void;
|
| 157 |
+
}
|
| 158 |
+
interface AsyncHook {
|
| 159 |
+
/**
|
| 160 |
+
* Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
|
| 161 |
+
*/
|
| 162 |
+
enable(): this;
|
| 163 |
+
/**
|
| 164 |
+
* Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
|
| 165 |
+
*/
|
| 166 |
+
disable(): this;
|
| 167 |
+
}
|
| 168 |
+
/**
|
| 169 |
+
* Registers functions to be called for different lifetime events of each async
|
| 170 |
+
* operation.
|
| 171 |
+
*
|
| 172 |
+
* The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the
|
| 173 |
+
* respective asynchronous event during a resource's lifetime.
|
| 174 |
+
*
|
| 175 |
+
* All callbacks are optional. For example, if only resource cleanup needs to
|
| 176 |
+
* be tracked, then only the `destroy` callback needs to be passed. The
|
| 177 |
+
* specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
|
| 178 |
+
*
|
| 179 |
+
* ```js
|
| 180 |
+
* import { createHook } from 'node:async_hooks';
|
| 181 |
+
*
|
| 182 |
+
* const asyncHook = createHook({
|
| 183 |
+
* init(asyncId, type, triggerAsyncId, resource) { },
|
| 184 |
+
* destroy(asyncId) { },
|
| 185 |
+
* });
|
| 186 |
+
* ```
|
| 187 |
+
*
|
| 188 |
+
* The callbacks will be inherited via the prototype chain:
|
| 189 |
+
*
|
| 190 |
+
* ```js
|
| 191 |
+
* class MyAsyncCallbacks {
|
| 192 |
+
* init(asyncId, type, triggerAsyncId, resource) { }
|
| 193 |
+
* destroy(asyncId) {}
|
| 194 |
+
* }
|
| 195 |
+
*
|
| 196 |
+
* class MyAddedCallbacks extends MyAsyncCallbacks {
|
| 197 |
+
* before(asyncId) { }
|
| 198 |
+
* after(asyncId) { }
|
| 199 |
+
* }
|
| 200 |
+
*
|
| 201 |
+
* const asyncHook = async_hooks.createHook(new MyAddedCallbacks());
|
| 202 |
+
* ```
|
| 203 |
+
*
|
| 204 |
+
* Because promises are asynchronous resources whose lifecycle is tracked
|
| 205 |
+
* via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises.
|
| 206 |
+
* @since v8.1.0
|
| 207 |
+
* @param callbacks The `Hook Callbacks` to register
|
| 208 |
+
* @return Instance used for disabling and enabling hooks
|
| 209 |
+
*/
|
| 210 |
+
function createHook(callbacks: HookCallbacks): AsyncHook;
|
| 211 |
+
interface AsyncResourceOptions {
|
| 212 |
+
/**
|
| 213 |
+
* The ID of the execution context that created this async event.
|
| 214 |
+
* @default executionAsyncId()
|
| 215 |
+
*/
|
| 216 |
+
triggerAsyncId?: number | undefined;
|
| 217 |
+
/**
|
| 218 |
+
* Disables automatic `emitDestroy` when the object is garbage collected.
|
| 219 |
+
* This usually does not need to be set (even if `emitDestroy` is called
|
| 220 |
+
* manually), unless the resource's `asyncId` is retrieved and the
|
| 221 |
+
* sensitive API's `emitDestroy` is called with it.
|
| 222 |
+
* @default false
|
| 223 |
+
*/
|
| 224 |
+
requireManualDestroy?: boolean | undefined;
|
| 225 |
+
}
|
| 226 |
+
/**
|
| 227 |
+
* The class `AsyncResource` is designed to be extended by the embedder's async
|
| 228 |
+
* resources. Using this, users can easily trigger the lifetime events of their
|
| 229 |
+
* own resources.
|
| 230 |
+
*
|
| 231 |
+
* The `init` hook will trigger when an `AsyncResource` is instantiated.
|
| 232 |
+
*
|
| 233 |
+
* The following is an overview of the `AsyncResource` API.
|
| 234 |
+
*
|
| 235 |
+
* ```js
|
| 236 |
+
* import { AsyncResource, executionAsyncId } from 'node:async_hooks';
|
| 237 |
+
*
|
| 238 |
+
* // AsyncResource() is meant to be extended. Instantiating a
|
| 239 |
+
* // new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
| 240 |
+
* // async_hook.executionAsyncId() is used.
|
| 241 |
+
* const asyncResource = new AsyncResource(
|
| 242 |
+
* type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false },
|
| 243 |
+
* );
|
| 244 |
+
*
|
| 245 |
+
* // Run a function in the execution context of the resource. This will
|
| 246 |
+
* // * establish the context of the resource
|
| 247 |
+
* // * trigger the AsyncHooks before callbacks
|
| 248 |
+
* // * call the provided function `fn` with the supplied arguments
|
| 249 |
+
* // * trigger the AsyncHooks after callbacks
|
| 250 |
+
* // * restore the original execution context
|
| 251 |
+
* asyncResource.runInAsyncScope(fn, thisArg, ...args);
|
| 252 |
+
*
|
| 253 |
+
* // Call AsyncHooks destroy callbacks.
|
| 254 |
+
* asyncResource.emitDestroy();
|
| 255 |
+
*
|
| 256 |
+
* // Return the unique ID assigned to the AsyncResource instance.
|
| 257 |
+
* asyncResource.asyncId();
|
| 258 |
+
*
|
| 259 |
+
* // Return the trigger ID for the AsyncResource instance.
|
| 260 |
+
* asyncResource.triggerAsyncId();
|
| 261 |
+
* ```
|
| 262 |
+
*/
|
| 263 |
+
class AsyncResource {
|
| 264 |
+
/**
|
| 265 |
+
* AsyncResource() is meant to be extended. Instantiating a
|
| 266 |
+
* new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
| 267 |
+
* async_hook.executionAsyncId() is used.
|
| 268 |
+
* @param type The type of async event.
|
| 269 |
+
* @param triggerAsyncId The ID of the execution context that created
|
| 270 |
+
* this async event (default: `executionAsyncId()`), or an
|
| 271 |
+
* AsyncResourceOptions object (since v9.3.0)
|
| 272 |
+
*/
|
| 273 |
+
constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions);
|
| 274 |
+
/**
|
| 275 |
+
* Binds the given function to the current execution context.
|
| 276 |
+
* @since v14.8.0, v12.19.0
|
| 277 |
+
* @param fn The function to bind to the current execution context.
|
| 278 |
+
* @param type An optional name to associate with the underlying `AsyncResource`.
|
| 279 |
+
*/
|
| 280 |
+
static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(
|
| 281 |
+
fn: Func,
|
| 282 |
+
type?: string,
|
| 283 |
+
thisArg?: ThisArg,
|
| 284 |
+
): Func;
|
| 285 |
+
/**
|
| 286 |
+
* Binds the given function to execute to this `AsyncResource`'s scope.
|
| 287 |
+
* @since v14.8.0, v12.19.0
|
| 288 |
+
* @param fn The function to bind to the current `AsyncResource`.
|
| 289 |
+
*/
|
| 290 |
+
bind<Func extends (...args: any[]) => any>(fn: Func): Func;
|
| 291 |
+
/**
|
| 292 |
+
* Call the provided function with the provided arguments in the execution context
|
| 293 |
+
* of the async resource. This will establish the context, trigger the AsyncHooks
|
| 294 |
+
* before callbacks, call the function, trigger the AsyncHooks after callbacks, and
|
| 295 |
+
* then restore the original execution context.
|
| 296 |
+
* @since v9.6.0
|
| 297 |
+
* @param fn The function to call in the execution context of this async resource.
|
| 298 |
+
* @param thisArg The receiver to be used for the function call.
|
| 299 |
+
* @param args Optional arguments to pass to the function.
|
| 300 |
+
*/
|
| 301 |
+
runInAsyncScope<This, Result>(
|
| 302 |
+
fn: (this: This, ...args: any[]) => Result,
|
| 303 |
+
thisArg?: This,
|
| 304 |
+
...args: any[]
|
| 305 |
+
): Result;
|
| 306 |
+
/**
|
| 307 |
+
* Call all `destroy` hooks. This should only ever be called once. An error will
|
| 308 |
+
* be thrown if it is called more than once. This **must** be manually called. If
|
| 309 |
+
* the resource is left to be collected by the GC then the `destroy` hooks will
|
| 310 |
+
* never be called.
|
| 311 |
+
* @return A reference to `asyncResource`.
|
| 312 |
+
*/
|
| 313 |
+
emitDestroy(): this;
|
| 314 |
+
/**
|
| 315 |
+
* @return The unique `asyncId` assigned to the resource.
|
| 316 |
+
*/
|
| 317 |
+
asyncId(): number;
|
| 318 |
+
/**
|
| 319 |
+
* @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor.
|
| 320 |
+
*/
|
| 321 |
+
triggerAsyncId(): number;
|
| 322 |
+
}
|
| 323 |
+
interface AsyncLocalStorageOptions {
|
| 324 |
+
/**
|
| 325 |
+
* The default value to be used when no store is provided.
|
| 326 |
+
*/
|
| 327 |
+
defaultValue?: any;
|
| 328 |
+
/**
|
| 329 |
+
* A name for the `AsyncLocalStorage` value.
|
| 330 |
+
*/
|
| 331 |
+
name?: string | undefined;
|
| 332 |
+
}
|
| 333 |
+
/**
|
| 334 |
+
* This class creates stores that stay coherent through asynchronous operations.
|
| 335 |
+
*
|
| 336 |
+
* While you can create your own implementation on top of the `node:async_hooks` module, `AsyncLocalStorage` should be preferred as it is a performant and memory
|
| 337 |
+
* safe implementation that involves significant optimizations that are non-obvious
|
| 338 |
+
* to implement.
|
| 339 |
+
*
|
| 340 |
+
* The following example uses `AsyncLocalStorage` to build a simple logger
|
| 341 |
+
* that assigns IDs to incoming HTTP requests and includes them in messages
|
| 342 |
+
* logged within each request.
|
| 343 |
+
*
|
| 344 |
+
* ```js
|
| 345 |
+
* import http from 'node:http';
|
| 346 |
+
* import { AsyncLocalStorage } from 'node:async_hooks';
|
| 347 |
+
*
|
| 348 |
+
* const asyncLocalStorage = new AsyncLocalStorage();
|
| 349 |
+
*
|
| 350 |
+
* function logWithId(msg) {
|
| 351 |
+
* const id = asyncLocalStorage.getStore();
|
| 352 |
+
* console.log(`${id !== undefined ? id : '-'}:`, msg);
|
| 353 |
+
* }
|
| 354 |
+
*
|
| 355 |
+
* let idSeq = 0;
|
| 356 |
+
* http.createServer((req, res) => {
|
| 357 |
+
* asyncLocalStorage.run(idSeq++, () => {
|
| 358 |
+
* logWithId('start');
|
| 359 |
+
* // Imagine any chain of async operations here
|
| 360 |
+
* setImmediate(() => {
|
| 361 |
+
* logWithId('finish');
|
| 362 |
+
* res.end();
|
| 363 |
+
* });
|
| 364 |
+
* });
|
| 365 |
+
* }).listen(8080);
|
| 366 |
+
*
|
| 367 |
+
* http.get('http://localhost:8080');
|
| 368 |
+
* http.get('http://localhost:8080');
|
| 369 |
+
* // Prints:
|
| 370 |
+
* // 0: start
|
| 371 |
+
* // 0: finish
|
| 372 |
+
* // 1: start
|
| 373 |
+
* // 1: finish
|
| 374 |
+
* ```
|
| 375 |
+
*
|
| 376 |
+
* Each instance of `AsyncLocalStorage` maintains an independent storage context.
|
| 377 |
+
* Multiple instances can safely exist simultaneously without risk of interfering
|
| 378 |
+
* with each other's data.
|
| 379 |
+
* @since v13.10.0, v12.17.0
|
| 380 |
+
*/
|
| 381 |
+
class AsyncLocalStorage<T> {
|
| 382 |
+
/**
|
| 383 |
+
* Creates a new instance of `AsyncLocalStorage`. Store is only provided within a
|
| 384 |
+
* `run()` call or after an `enterWith()` call.
|
| 385 |
+
*/
|
| 386 |
+
constructor(options?: AsyncLocalStorageOptions);
|
| 387 |
+
/**
|
| 388 |
+
* Binds the given function to the current execution context.
|
| 389 |
+
* @since v19.8.0
|
| 390 |
+
* @param fn The function to bind to the current execution context.
|
| 391 |
+
* @return A new function that calls `fn` within the captured execution context.
|
| 392 |
+
*/
|
| 393 |
+
static bind<Func extends (...args: any[]) => any>(fn: Func): Func;
|
| 394 |
+
/**
|
| 395 |
+
* Captures the current execution context and returns a function that accepts a
|
| 396 |
+
* function as an argument. Whenever the returned function is called, it
|
| 397 |
+
* calls the function passed to it within the captured context.
|
| 398 |
+
*
|
| 399 |
+
* ```js
|
| 400 |
+
* const asyncLocalStorage = new AsyncLocalStorage();
|
| 401 |
+
* const runInAsyncScope = asyncLocalStorage.run(123, () => AsyncLocalStorage.snapshot());
|
| 402 |
+
* const result = asyncLocalStorage.run(321, () => runInAsyncScope(() => asyncLocalStorage.getStore()));
|
| 403 |
+
* console.log(result); // returns 123
|
| 404 |
+
* ```
|
| 405 |
+
*
|
| 406 |
+
* AsyncLocalStorage.snapshot() can replace the use of AsyncResource for simple
|
| 407 |
+
* async context tracking purposes, for example:
|
| 408 |
+
*
|
| 409 |
+
* ```js
|
| 410 |
+
* class Foo {
|
| 411 |
+
* #runInAsyncScope = AsyncLocalStorage.snapshot();
|
| 412 |
+
*
|
| 413 |
+
* get() { return this.#runInAsyncScope(() => asyncLocalStorage.getStore()); }
|
| 414 |
+
* }
|
| 415 |
+
*
|
| 416 |
+
* const foo = asyncLocalStorage.run(123, () => new Foo());
|
| 417 |
+
* console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123
|
| 418 |
+
* ```
|
| 419 |
+
* @since v19.8.0
|
| 420 |
+
* @return A new function with the signature `(fn: (...args) : R, ...args) : R`.
|
| 421 |
+
*/
|
| 422 |
+
static snapshot(): <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;
|
| 423 |
+
/**
|
| 424 |
+
* Disables the instance of `AsyncLocalStorage`. All subsequent calls
|
| 425 |
+
* to `asyncLocalStorage.getStore()` will return `undefined` until `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
|
| 426 |
+
*
|
| 427 |
+
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
|
| 428 |
+
* instance will be exited.
|
| 429 |
+
*
|
| 430 |
+
* Calling `asyncLocalStorage.disable()` is required before the `asyncLocalStorage` can be garbage collected. This does not apply to stores
|
| 431 |
+
* provided by the `asyncLocalStorage`, as those objects are garbage collected
|
| 432 |
+
* along with the corresponding async resources.
|
| 433 |
+
*
|
| 434 |
+
* Use this method when the `asyncLocalStorage` is not in use anymore
|
| 435 |
+
* in the current process.
|
| 436 |
+
* @since v13.10.0, v12.17.0
|
| 437 |
+
* @experimental
|
| 438 |
+
*/
|
| 439 |
+
disable(): void;
|
| 440 |
+
/**
|
| 441 |
+
* Returns the current store.
|
| 442 |
+
* If called outside of an asynchronous context initialized by
|
| 443 |
+
* calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it
|
| 444 |
+
* returns `undefined`.
|
| 445 |
+
* @since v13.10.0, v12.17.0
|
| 446 |
+
*/
|
| 447 |
+
getStore(): T | undefined;
|
| 448 |
+
/**
|
| 449 |
+
* The name of the `AsyncLocalStorage` instance if provided.
|
| 450 |
+
* @since v24.0.0
|
| 451 |
+
*/
|
| 452 |
+
readonly name: string;
|
| 453 |
+
/**
|
| 454 |
+
* Runs a function synchronously within a context and returns its
|
| 455 |
+
* return value. The store is not accessible outside of the callback function.
|
| 456 |
+
* The store is accessible to any asynchronous operations created within the
|
| 457 |
+
* callback.
|
| 458 |
+
*
|
| 459 |
+
* The optional `args` are passed to the callback function.
|
| 460 |
+
*
|
| 461 |
+
* If the callback function throws an error, the error is thrown by `run()` too.
|
| 462 |
+
* The stacktrace is not impacted by this call and the context is exited.
|
| 463 |
+
*
|
| 464 |
+
* Example:
|
| 465 |
+
*
|
| 466 |
+
* ```js
|
| 467 |
+
* const store = { id: 2 };
|
| 468 |
+
* try {
|
| 469 |
+
* asyncLocalStorage.run(store, () => {
|
| 470 |
+
* asyncLocalStorage.getStore(); // Returns the store object
|
| 471 |
+
* setTimeout(() => {
|
| 472 |
+
* asyncLocalStorage.getStore(); // Returns the store object
|
| 473 |
+
* }, 200);
|
| 474 |
+
* throw new Error();
|
| 475 |
+
* });
|
| 476 |
+
* } catch (e) {
|
| 477 |
+
* asyncLocalStorage.getStore(); // Returns undefined
|
| 478 |
+
* // The error will be caught here
|
| 479 |
+
* }
|
| 480 |
+
* ```
|
| 481 |
+
* @since v13.10.0, v12.17.0
|
| 482 |
+
*/
|
| 483 |
+
run<R>(store: T, callback: () => R): R;
|
| 484 |
+
run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
|
| 485 |
+
/**
|
| 486 |
+
* Runs a function synchronously outside of a context and returns its
|
| 487 |
+
* return value. The store is not accessible within the callback function or
|
| 488 |
+
* the asynchronous operations created within the callback. Any `getStore()` call done within the callback function will always return `undefined`.
|
| 489 |
+
*
|
| 490 |
+
* The optional `args` are passed to the callback function.
|
| 491 |
+
*
|
| 492 |
+
* If the callback function throws an error, the error is thrown by `exit()` too.
|
| 493 |
+
* The stacktrace is not impacted by this call and the context is re-entered.
|
| 494 |
+
*
|
| 495 |
+
* Example:
|
| 496 |
+
*
|
| 497 |
+
* ```js
|
| 498 |
+
* // Within a call to run
|
| 499 |
+
* try {
|
| 500 |
+
* asyncLocalStorage.getStore(); // Returns the store object or value
|
| 501 |
+
* asyncLocalStorage.exit(() => {
|
| 502 |
+
* asyncLocalStorage.getStore(); // Returns undefined
|
| 503 |
+
* throw new Error();
|
| 504 |
+
* });
|
| 505 |
+
* } catch (e) {
|
| 506 |
+
* asyncLocalStorage.getStore(); // Returns the same object or value
|
| 507 |
+
* // The error will be caught here
|
| 508 |
+
* }
|
| 509 |
+
* ```
|
| 510 |
+
* @since v13.10.0, v12.17.0
|
| 511 |
+
* @experimental
|
| 512 |
+
*/
|
| 513 |
+
exit<R, TArgs extends any[]>(callback: (...args: TArgs) => R, ...args: TArgs): R;
|
| 514 |
+
/**
|
| 515 |
+
* Transitions into the context for the remainder of the current
|
| 516 |
+
* synchronous execution and then persists the store through any following
|
| 517 |
+
* asynchronous calls.
|
| 518 |
+
*
|
| 519 |
+
* Example:
|
| 520 |
+
*
|
| 521 |
+
* ```js
|
| 522 |
+
* const store = { id: 1 };
|
| 523 |
+
* // Replaces previous store with the given store object
|
| 524 |
+
* asyncLocalStorage.enterWith(store);
|
| 525 |
+
* asyncLocalStorage.getStore(); // Returns the store object
|
| 526 |
+
* someAsyncOperation(() => {
|
| 527 |
+
* asyncLocalStorage.getStore(); // Returns the same object
|
| 528 |
+
* });
|
| 529 |
+
* ```
|
| 530 |
+
*
|
| 531 |
+
* This transition will continue for the _entire_ synchronous execution.
|
| 532 |
+
* This means that if, for example, the context is entered within an event
|
| 533 |
+
* handler subsequent event handlers will also run within that context unless
|
| 534 |
+
* specifically bound to another context with an `AsyncResource`. That is why `run()` should be preferred over `enterWith()` unless there are strong reasons
|
| 535 |
+
* to use the latter method.
|
| 536 |
+
*
|
| 537 |
+
* ```js
|
| 538 |
+
* const store = { id: 1 };
|
| 539 |
+
*
|
| 540 |
+
* emitter.on('my-event', () => {
|
| 541 |
+
* asyncLocalStorage.enterWith(store);
|
| 542 |
+
* });
|
| 543 |
+
* emitter.on('my-event', () => {
|
| 544 |
+
* asyncLocalStorage.getStore(); // Returns the same object
|
| 545 |
+
* });
|
| 546 |
+
*
|
| 547 |
+
* asyncLocalStorage.getStore(); // Returns undefined
|
| 548 |
+
* emitter.emit('my-event');
|
| 549 |
+
* asyncLocalStorage.getStore(); // Returns the same object
|
| 550 |
+
* ```
|
| 551 |
+
* @since v13.11.0, v12.17.0
|
| 552 |
+
* @experimental
|
| 553 |
+
*/
|
| 554 |
+
enterWith(store: T): void;
|
| 555 |
+
}
|
| 556 |
+
/**
|
| 557 |
+
* @since v17.2.0, v16.14.0
|
| 558 |
+
* @return A map of provider types to the corresponding numeric id.
|
| 559 |
+
* This map contains all the event types that might be emitted by the `async_hooks.init()` event.
|
| 560 |
+
*/
|
| 561 |
+
namespace asyncWrapProviders {
|
| 562 |
+
const NONE: number;
|
| 563 |
+
const DIRHANDLE: number;
|
| 564 |
+
const DNSCHANNEL: number;
|
| 565 |
+
const ELDHISTOGRAM: number;
|
| 566 |
+
const FILEHANDLE: number;
|
| 567 |
+
const FILEHANDLECLOSEREQ: number;
|
| 568 |
+
const FIXEDSIZEBLOBCOPY: number;
|
| 569 |
+
const FSEVENTWRAP: number;
|
| 570 |
+
const FSREQCALLBACK: number;
|
| 571 |
+
const FSREQPROMISE: number;
|
| 572 |
+
const GETADDRINFOREQWRAP: number;
|
| 573 |
+
const GETNAMEINFOREQWRAP: number;
|
| 574 |
+
const HEAPSNAPSHOT: number;
|
| 575 |
+
const HTTP2SESSION: number;
|
| 576 |
+
const HTTP2STREAM: number;
|
| 577 |
+
const HTTP2PING: number;
|
| 578 |
+
const HTTP2SETTINGS: number;
|
| 579 |
+
const HTTPINCOMINGMESSAGE: number;
|
| 580 |
+
const HTTPCLIENTREQUEST: number;
|
| 581 |
+
const JSSTREAM: number;
|
| 582 |
+
const JSUDPWRAP: number;
|
| 583 |
+
const MESSAGEPORT: number;
|
| 584 |
+
const PIPECONNECTWRAP: number;
|
| 585 |
+
const PIPESERVERWRAP: number;
|
| 586 |
+
const PIPEWRAP: number;
|
| 587 |
+
const PROCESSWRAP: number;
|
| 588 |
+
const PROMISE: number;
|
| 589 |
+
const QUERYWRAP: number;
|
| 590 |
+
const SHUTDOWNWRAP: number;
|
| 591 |
+
const SIGNALWRAP: number;
|
| 592 |
+
const STATWATCHER: number;
|
| 593 |
+
const STREAMPIPE: number;
|
| 594 |
+
const TCPCONNECTWRAP: number;
|
| 595 |
+
const TCPSERVERWRAP: number;
|
| 596 |
+
const TCPWRAP: number;
|
| 597 |
+
const TTYWRAP: number;
|
| 598 |
+
const UDPSENDWRAP: number;
|
| 599 |
+
const UDPWRAP: number;
|
| 600 |
+
const SIGINTWATCHDOG: number;
|
| 601 |
+
const WORKER: number;
|
| 602 |
+
const WORKERHEAPSNAPSHOT: number;
|
| 603 |
+
const WRITEWRAP: number;
|
| 604 |
+
const ZLIB: number;
|
| 605 |
+
const CHECKPRIMEREQUEST: number;
|
| 606 |
+
const PBKDF2REQUEST: number;
|
| 607 |
+
const KEYPAIRGENREQUEST: number;
|
| 608 |
+
const KEYGENREQUEST: number;
|
| 609 |
+
const KEYEXPORTREQUEST: number;
|
| 610 |
+
const CIPHERREQUEST: number;
|
| 611 |
+
const DERIVEBITSREQUEST: number;
|
| 612 |
+
const HASHREQUEST: number;
|
| 613 |
+
const RANDOMBYTESREQUEST: number;
|
| 614 |
+
const RANDOMPRIMEREQUEST: number;
|
| 615 |
+
const SCRYPTREQUEST: number;
|
| 616 |
+
const SIGNREQUEST: number;
|
| 617 |
+
const TLSWRAP: number;
|
| 618 |
+
const VERIFYREQUEST: number;
|
| 619 |
+
}
|
| 620 |
+
}
|
| 621 |
+
declare module "node:async_hooks" {
|
| 622 |
+
export * from "async_h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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
declare module "buffer" {
|
| 2 |
+
type ImplicitArrayBuffer<T extends WithImplicitCoercion<ArrayBufferLike>> = T extends
|
| 3 |
+
{ valueOf(): infer V extends ArrayBufferLike } ? V : T;
|
| 4 |
+
global {
|
| 5 |
+
interface BufferConstructor {
|
| 6 |
+
// see buffer.d.ts for implementation shared with all TypeScript versions
|
| 7 |
+
|
| 8 |
+
/**
|
| 9 |
+
* Allocates a new buffer containing the given {str}.
|
| 10 |
+
*
|
| 11 |
+
* @param str String to store in buffer.
|
| 12 |
+
* @param encoding encoding to use, optional. Default is 'utf8'
|
| 13 |
+
* @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
|
| 14 |
+
*/
|
| 15 |
+
new(str: string, encoding?: BufferEncoding): Buffer<ArrayBuffer>;
|
| 16 |
+
/**
|
| 17 |
+
* Allocates a new buffer of {size} octets.
|
| 18 |
+
*
|
| 19 |
+
* @param size count of octets to allocate.
|
| 20 |
+
* @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
|
| 21 |
+
*/
|
| 22 |
+
new(size: number): Buffer<ArrayBuffer>;
|
| 23 |
+
/**
|
| 24 |
+
* Allocates a new buffer containing the given {array} of octets.
|
| 25 |
+
*
|
| 26 |
+
* @param array The octets to store.
|
| 27 |
+
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
| 28 |
+
*/
|
| 29 |
+
new(array: ArrayLike<number>): Buffer<ArrayBuffer>;
|
| 30 |
+
/**
|
| 31 |
+
* Produces a Buffer backed by the same allocated memory as
|
| 32 |
+
* the given {ArrayBuffer}/{SharedArrayBuffer}.
|
| 33 |
+
*
|
| 34 |
+
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
| 35 |
+
* @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
|
| 36 |
+
*/
|
| 37 |
+
new<TArrayBuffer extends ArrayBufferLike = ArrayBuffer>(arrayBuffer: TArrayBuffer): Buffer<TArrayBuffer>;
|
| 38 |
+
/**
|
| 39 |
+
* Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`.
|
| 40 |
+
* Array entries outside that range will be truncated to fit into it.
|
| 41 |
+
*
|
| 42 |
+
* ```js
|
| 43 |
+
* import { Buffer } from 'node:buffer';
|
| 44 |
+
*
|
| 45 |
+
* // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.
|
| 46 |
+
* const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
|
| 47 |
+
* ```
|
| 48 |
+
*
|
| 49 |
+
* If `array` is an `Array`-like object (that is, one with a `length` property of
|
| 50 |
+
* type `number`), it is treated as if it is an array, unless it is a `Buffer` or
|
| 51 |
+
* a `Uint8Array`. This means all other `TypedArray` variants get treated as an
|
| 52 |
+
* `Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use
|
| 53 |
+
* `Buffer.copyBytesFrom()`.
|
| 54 |
+
*
|
| 55 |
+
* A `TypeError` will be thrown if `array` is not an `Array` or another type
|
| 56 |
+
* appropriate for `Buffer.from()` variants.
|
| 57 |
+
*
|
| 58 |
+
* `Buffer.from(array)` and `Buffer.from(string)` may also use the internal
|
| 59 |
+
* `Buffer` pool like `Buffer.allocUnsafe()` does.
|
| 60 |
+
* @since v5.10.0
|
| 61 |
+
*/
|
| 62 |
+
from(array: WithImplicitCoercion<ArrayLike<number>>): Buffer<ArrayBuffer>;
|
| 63 |
+
/**
|
| 64 |
+
* This creates a view of the `ArrayBuffer` without copying the underlying
|
| 65 |
+
* memory. For example, when passed a reference to the `.buffer` property of a
|
| 66 |
+
* `TypedArray` instance, the newly created `Buffer` will share the same
|
| 67 |
+
* allocated memory as the `TypedArray`'s underlying `ArrayBuffer`.
|
| 68 |
+
*
|
| 69 |
+
* ```js
|
| 70 |
+
* import { Buffer } from 'node:buffer';
|
| 71 |
+
*
|
| 72 |
+
* const arr = new Uint16Array(2);
|
| 73 |
+
*
|
| 74 |
+
* arr[0] = 5000;
|
| 75 |
+
* arr[1] = 4000;
|
| 76 |
+
*
|
| 77 |
+
* // Shares memory with `arr`.
|
| 78 |
+
* const buf = Buffer.from(arr.buffer);
|
| 79 |
+
*
|
| 80 |
+
* console.log(buf);
|
| 81 |
+
* // Prints: <Buffer 88 13 a0 0f>
|
| 82 |
+
*
|
| 83 |
+
* // Changing the original Uint16Array changes the Buffer also.
|
| 84 |
+
* arr[1] = 6000;
|
| 85 |
+
*
|
| 86 |
+
* console.log(buf);
|
| 87 |
+
* // Prints: <Buffer 88 13 70 17>
|
| 88 |
+
* ```
|
| 89 |
+
*
|
| 90 |
+
* The optional `byteOffset` and `length` arguments specify a memory range within
|
| 91 |
+
* the `arrayBuffer` that will be shared by the `Buffer`.
|
| 92 |
+
*
|
| 93 |
+
* ```js
|
| 94 |
+
* import { Buffer } from 'node:buffer';
|
| 95 |
+
*
|
| 96 |
+
* const ab = new ArrayBuffer(10);
|
| 97 |
+
* const buf = Buffer.from(ab, 0, 2);
|
| 98 |
+
*
|
| 99 |
+
* console.log(buf.length);
|
| 100 |
+
* // Prints: 2
|
| 101 |
+
* ```
|
| 102 |
+
*
|
| 103 |
+
* A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer` or a
|
| 104 |
+
* `SharedArrayBuffer` or another type appropriate for `Buffer.from()`
|
| 105 |
+
* variants.
|
| 106 |
+
*
|
| 107 |
+
* It is important to remember that a backing `ArrayBuffer` can cover a range
|
| 108 |
+
* of memory that extends beyond the bounds of a `TypedArray` view. A new
|
| 109 |
+
* `Buffer` created using the `buffer` property of a `TypedArray` may extend
|
| 110 |
+
* beyond the range of the `TypedArray`:
|
| 111 |
+
*
|
| 112 |
+
* ```js
|
| 113 |
+
* import { Buffer } from 'node:buffer';
|
| 114 |
+
*
|
| 115 |
+
* const arrA = Uint8Array.from([0x63, 0x64, 0x65, 0x66]); // 4 elements
|
| 116 |
+
* const arrB = new Uint8Array(arrA.buffer, 1, 2); // 2 elements
|
| 117 |
+
* console.log(arrA.buffer === arrB.buffer); // true
|
| 118 |
+
*
|
| 119 |
+
* const buf = Buffer.from(arrB.buffer);
|
| 120 |
+
* console.log(buf);
|
| 121 |
+
* // Prints: <Buffer 63 64 65 66>
|
| 122 |
+
* ```
|
| 123 |
+
* @since v5.10.0
|
| 124 |
+
* @param arrayBuffer An `ArrayBuffer`, `SharedArrayBuffer`, for example the
|
| 125 |
+
* `.buffer` property of a `TypedArray`.
|
| 126 |
+
* @param byteOffset Index of first byte to expose. **Default:** `0`.
|
| 127 |
+
* @param length Number of bytes to expose. **Default:**
|
| 128 |
+
* `arrayBuffer.byteLength - byteOffset`.
|
| 129 |
+
*/
|
| 130 |
+
from<TArrayBuffer extends WithImplicitCoercion<ArrayBufferLike>>(
|
| 131 |
+
arrayBuffer: TArrayBuffer,
|
| 132 |
+
byteOffset?: number,
|
| 133 |
+
length?: number,
|
| 134 |
+
): Buffer<ImplicitArrayBuffer<TArrayBuffer>>;
|
| 135 |
+
/**
|
| 136 |
+
* Creates a new `Buffer` containing `string`. The `encoding` parameter identifies
|
| 137 |
+
* the character encoding to be used when converting `string` into bytes.
|
| 138 |
+
*
|
| 139 |
+
* ```js
|
| 140 |
+
* import { Buffer } from 'node:buffer';
|
| 141 |
+
*
|
| 142 |
+
* const buf1 = Buffer.from('this is a tést');
|
| 143 |
+
* const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');
|
| 144 |
+
*
|
| 145 |
+
* console.log(buf1.toString());
|
| 146 |
+
* // Prints: this is a tést
|
| 147 |
+
* console.log(buf2.toString());
|
| 148 |
+
* // Prints: this is a tést
|
| 149 |
+
* console.log(buf1.toString('latin1'));
|
| 150 |
+
* // Prints: this is a tést
|
| 151 |
+
* ```
|
| 152 |
+
*
|
| 153 |
+
* A `TypeError` will be thrown if `string` is not a string or another type
|
| 154 |
+
* appropriate for `Buffer.from()` variants.
|
| 155 |
+
*
|
| 156 |
+
* `Buffer.from(string)` may also use the internal `Buffer` pool like
|
| 157 |
+
* `Buffer.allocUnsafe()` does.
|
| 158 |
+
* @since v5.10.0
|
| 159 |
+
* @param string A string to encode.
|
| 160 |
+
* @param encoding The encoding of `string`. **Default:** `'utf8'`.
|
| 161 |
+
*/
|
| 162 |
+
from(string: WithImplicitCoercion<string>, encoding?: BufferEncoding): Buffer<ArrayBuffer>;
|
| 163 |
+
from(arrayOrString: WithImplicitCoercion<ArrayLike<number> | string>): Buffer<ArrayBuffer>;
|
| 164 |
+
/**
|
| 165 |
+
* Creates a new Buffer using the passed {data}
|
| 166 |
+
* @param values to create a new Buffer
|
| 167 |
+
*/
|
| 168 |
+
of(...items: number[]): Buffer<ArrayBuffer>;
|
| 169 |
+
/**
|
| 170 |
+
* Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together.
|
| 171 |
+
*
|
| 172 |
+
* If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned.
|
| 173 |
+
*
|
| 174 |
+
* If `totalLength` is not provided, it is calculated from the `Buffer` instances
|
| 175 |
+
* in `list` by adding their lengths.
|
| 176 |
+
*
|
| 177 |
+
* If `totalLength` is provided, it is coerced to an unsigned integer. If the
|
| 178 |
+
* combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
|
| 179 |
+
* truncated to `totalLength`. If the combined length of the `Buffer`s in `list` is
|
| 180 |
+
* less than `totalLength`, the remaining space is filled with zeros.
|
| 181 |
+
*
|
| 182 |
+
* ```js
|
| 183 |
+
* import { Buffer } from 'node:buffer';
|
| 184 |
+
*
|
| 185 |
+
* // Create a single `Buffer` from a list of three `Buffer` instances.
|
| 186 |
+
*
|
| 187 |
+
* const buf1 = Buffer.alloc(10);
|
| 188 |
+
* const buf2 = Buffer.alloc(14);
|
| 189 |
+
* const buf3 = Buffer.alloc(18);
|
| 190 |
+
* const totalLength = buf1.length + buf2.length + buf3.length;
|
| 191 |
+
*
|
| 192 |
+
* console.log(totalLength);
|
| 193 |
+
* // Prints: 42
|
| 194 |
+
*
|
| 195 |
+
* const bufA = Buffer.concat([buf1, buf2, buf3], totalLength);
|
| 196 |
+
*
|
| 197 |
+
* console.log(bufA);
|
| 198 |
+
* // Prints: <Buffer 00 00 00 00 ...>
|
| 199 |
+
* console.log(bufA.length);
|
| 200 |
+
* // Prints: 42
|
| 201 |
+
* ```
|
| 202 |
+
*
|
| 203 |
+
* `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
|
| 204 |
+
* @since v0.7.11
|
| 205 |
+
* @param list List of `Buffer` or {@link Uint8Array} instances to concatenate.
|
| 206 |
+
* @param totalLength Total length of the `Buffer` instances in `list` when concatenated.
|
| 207 |
+
*/
|
| 208 |
+
concat(list: readonly Uint8Array[], totalLength?: number): Buffer<ArrayBuffer>;
|
| 209 |
+
/**
|
| 210 |
+
* Copies the underlying memory of `view` into a new `Buffer`.
|
| 211 |
+
*
|
| 212 |
+
* ```js
|
| 213 |
+
* const u16 = new Uint16Array([0, 0xffff]);
|
| 214 |
+
* const buf = Buffer.copyBytesFrom(u16, 1, 1);
|
| 215 |
+
* u16[1] = 0;
|
| 216 |
+
* console.log(buf.length); // 2
|
| 217 |
+
* console.log(buf[0]); // 255
|
| 218 |
+
* console.log(buf[1]); // 255
|
| 219 |
+
* ```
|
| 220 |
+
* @since v19.8.0
|
| 221 |
+
* @param view The {TypedArray} to copy.
|
| 222 |
+
* @param [offset=0] The starting offset within `view`.
|
| 223 |
+
* @param [length=view.length - offset] The number of elements from `view` to copy.
|
| 224 |
+
*/
|
| 225 |
+
copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer<ArrayBuffer>;
|
| 226 |
+
/**
|
| 227 |
+
* Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled.
|
| 228 |
+
*
|
| 229 |
+
* ```js
|
| 230 |
+
* import { Buffer } from 'node:buffer';
|
| 231 |
+
*
|
| 232 |
+
* const buf = Buffer.alloc(5);
|
| 233 |
+
*
|
| 234 |
+
* console.log(buf);
|
| 235 |
+
* // Prints: <Buffer 00 00 00 00 00>
|
| 236 |
+
* ```
|
| 237 |
+
*
|
| 238 |
+
* If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
|
| 239 |
+
*
|
| 240 |
+
* If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`.
|
| 241 |
+
*
|
| 242 |
+
* ```js
|
| 243 |
+
* import { Buffer } from 'node:buffer';
|
| 244 |
+
*
|
| 245 |
+
* const buf = Buffer.alloc(5, 'a');
|
| 246 |
+
*
|
| 247 |
+
* console.log(buf);
|
| 248 |
+
* // Prints: <Buffer 61 61 61 61 61>
|
| 249 |
+
* ```
|
| 250 |
+
*
|
| 251 |
+
* If both `fill` and `encoding` are specified, the allocated `Buffer` will be
|
| 252 |
+
* initialized by calling `buf.fill(fill, encoding)`.
|
| 253 |
+
*
|
| 254 |
+
* ```js
|
| 255 |
+
* import { Buffer } from 'node:buffer';
|
| 256 |
+
*
|
| 257 |
+
* const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
|
| 258 |
+
*
|
| 259 |
+
* console.log(buf);
|
| 260 |
+
* // Prints: <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
|
| 261 |
+
* ```
|
| 262 |
+
*
|
| 263 |
+
* Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance
|
| 264 |
+
* contents will never contain sensitive data from previous allocations, including
|
| 265 |
+
* data that might not have been allocated for `Buffer`s.
|
| 266 |
+
*
|
| 267 |
+
* A `TypeError` will be thrown if `size` is not a number.
|
| 268 |
+
* @since v5.10.0
|
| 269 |
+
* @param size The desired length of the new `Buffer`.
|
| 270 |
+
* @param [fill=0] A value to pre-fill the new `Buffer` with.
|
| 271 |
+
* @param [encoding='utf8'] If `fill` is a string, this is its encoding.
|
| 272 |
+
*/
|
| 273 |
+
alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer<ArrayBuffer>;
|
| 274 |
+
/**
|
| 275 |
+
* Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
|
| 276 |
+
*
|
| 277 |
+
* The underlying memory for `Buffer` instances created in this way is _not_
|
| 278 |
+
* _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes.
|
| 279 |
+
*
|
| 280 |
+
* ```js
|
| 281 |
+
* import { Buffer } from 'node:buffer';
|
| 282 |
+
*
|
| 283 |
+
* const buf = Buffer.allocUnsafe(10);
|
| 284 |
+
*
|
| 285 |
+
* console.log(buf);
|
| 286 |
+
* // Prints (contents may vary): <Buffer a0 8b 28 3f 01 00 00 00 50 32>
|
| 287 |
+
*
|
| 288 |
+
* buf.fill(0);
|
| 289 |
+
*
|
| 290 |
+
* console.log(buf);
|
| 291 |
+
* // Prints: <Buffer 00 00 00 00 00 00 00 00 00 00>
|
| 292 |
+
* ```
|
| 293 |
+
*
|
| 294 |
+
* A `TypeError` will be thrown if `size` is not a number.
|
| 295 |
+
*
|
| 296 |
+
* The `Buffer` module pre-allocates an internal `Buffer` instance of
|
| 297 |
+
* size `Buffer.poolSize` that is used as a pool for the fast allocation of new `Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`,
|
| 298 |
+
* and `Buffer.concat()` only when `size` is less than `Buffer.poolSize >>> 1` (floor of `Buffer.poolSize` divided by two).
|
| 299 |
+
*
|
| 300 |
+
* Use of this pre-allocated internal memory pool is a key difference between
|
| 301 |
+
* calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
|
| 302 |
+
* Specifically, `Buffer.alloc(size, fill)` will _never_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`_will_ use the internal`Buffer` pool if `size` is less
|
| 303 |
+
* than or equal to half `Buffer.poolSize`. The
|
| 304 |
+
* difference is subtle but can be important when an application requires the
|
| 305 |
+
* additional performance that `Buffer.allocUnsafe()` provides.
|
| 306 |
+
* @since v5.10.0
|
| 307 |
+
* @param size The desired length of the new `Buffer`.
|
| 308 |
+
*/
|
| 309 |
+
allocUnsafe(size: number): Buffer<ArrayBuffer>;
|
| 310 |
+
/**
|
| 311 |
+
* Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. A zero-length `Buffer` is created if
|
| 312 |
+
* `size` is 0.
|
| 313 |
+
*
|
| 314 |
+
* The underlying memory for `Buffer` instances created in this way is _not_
|
| 315 |
+
* _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize
|
| 316 |
+
* such `Buffer` instances with zeroes.
|
| 317 |
+
*
|
| 318 |
+
* When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
|
| 319 |
+
* allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This
|
| 320 |
+
* allows applications to avoid the garbage collection overhead of creating many
|
| 321 |
+
* individually allocated `Buffer` instances. This approach improves both
|
| 322 |
+
* performance and memory usage by eliminating the need to track and clean up as
|
| 323 |
+
* many individual `ArrayBuffer` objects.
|
| 324 |
+
*
|
| 325 |
+
* However, in the case where a developer may need to retain a small chunk of
|
| 326 |
+
* memory from a pool for an indeterminate amount of time, it may be appropriate
|
| 327 |
+
* to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and
|
| 328 |
+
* then copying out the relevant bits.
|
| 329 |
+
*
|
| 330 |
+
* ```js
|
| 331 |
+
* import { Buffer } from 'node:buffer';
|
| 332 |
+
*
|
| 333 |
+
* // Need to keep around a few small chunks of memory.
|
| 334 |
+
* const store = [];
|
| 335 |
+
*
|
| 336 |
+
* socket.on('readable', () => {
|
| 337 |
+
* let data;
|
| 338 |
+
* while (null !== (data = readable.read())) {
|
| 339 |
+
* // Allocate for retained data.
|
| 340 |
+
* const sb = Buffer.allocUnsafeSlow(10);
|
| 341 |
+
*
|
| 342 |
+
* // Copy the data into the new allocation.
|
| 343 |
+
* data.copy(sb, 0, 0, 10);
|
| 344 |
+
*
|
| 345 |
+
* store.push(sb);
|
| 346 |
+
* }
|
| 347 |
+
* });
|
| 348 |
+
* ```
|
| 349 |
+
*
|
| 350 |
+
* A `TypeError` will be thrown if `size` is not a number.
|
| 351 |
+
* @since v5.12.0
|
| 352 |
+
* @param size The desired length of the new `Buffer`.
|
| 353 |
+
*/
|
| 354 |
+
allocUnsafeSlow(size: number): Buffer<ArrayBuffer>;
|
| 355 |
+
}
|
| 356 |
+
interface Buffer<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> extends Uint8Array<TArrayBuffer> {
|
| 357 |
+
// see buffer.d.ts for implementation shared with all TypeScript versions
|
| 358 |
+
|
| 359 |
+
/**
|
| 360 |
+
* Returns a new `Buffer` that references the same memory as the original, but
|
| 361 |
+
* offset and cropped by the `start` and `end` indices.
|
| 362 |
+
*
|
| 363 |
+
* This method is not compatible with the `Uint8Array.prototype.slice()`,
|
| 364 |
+
* which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`.
|
| 365 |
+
*
|
| 366 |
+
* ```js
|
| 367 |
+
* import { Buffer } from 'node:buffer';
|
| 368 |
+
*
|
| 369 |
+
* const buf = Buffer.from('buffer');
|
| 370 |
+
*
|
| 371 |
+
* const copiedBuf = Uint8Array.prototype.slice.call(buf);
|
| 372 |
+
* copiedBuf[0]++;
|
| 373 |
+
* console.log(copiedBuf.toString());
|
| 374 |
+
* // Prints: cuffer
|
| 375 |
+
*
|
| 376 |
+
* console.log(buf.toString());
|
| 377 |
+
* // Prints: buffer
|
| 378 |
+
*
|
| 379 |
+
* // With buf.slice(), the original buffer is modified.
|
| 380 |
+
* const notReallyCopiedBuf = buf.slice();
|
| 381 |
+
* notReallyCopiedBuf[0]++;
|
| 382 |
+
* console.log(notReallyCopiedBuf.toString());
|
| 383 |
+
* // Prints: cuffer
|
| 384 |
+
* console.log(buf.toString());
|
| 385 |
+
* // Also prints: cuffer (!)
|
| 386 |
+
* ```
|
| 387 |
+
* @since v0.3.0
|
| 388 |
+
* @deprecated Use `subarray` instead.
|
| 389 |
+
* @param [start=0] Where the new `Buffer` will start.
|
| 390 |
+
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
| 391 |
+
*/
|
| 392 |
+
slice(start?: number, end?: number): Buffer<ArrayBuffer>;
|
| 393 |
+
/**
|
| 394 |
+
* Returns a new `Buffer` that references the same memory as the original, but
|
| 395 |
+
* offset and cropped by the `start` and `end` indices.
|
| 396 |
+
*
|
| 397 |
+
* Specifying `end` greater than `buf.length` will return the same result as
|
| 398 |
+
* that of `end` equal to `buf.length`.
|
| 399 |
+
*
|
| 400 |
+
* This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray).
|
| 401 |
+
*
|
| 402 |
+
* Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap.
|
| 403 |
+
*
|
| 404 |
+
* ```js
|
| 405 |
+
* import { Buffer } from 'node:buffer';
|
| 406 |
+
*
|
| 407 |
+
* // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte
|
| 408 |
+
* // from the original `Buffer`.
|
| 409 |
+
*
|
| 410 |
+
* const buf1 = Buffer.allocUnsafe(26);
|
| 411 |
+
*
|
| 412 |
+
* for (let i = 0; i < 26; i++) {
|
| 413 |
+
* // 97 is the decimal ASCII value for 'a'.
|
| 414 |
+
* buf1[i] = i + 97;
|
| 415 |
+
* }
|
| 416 |
+
*
|
| 417 |
+
* const buf2 = buf1.subarray(0, 3);
|
| 418 |
+
*
|
| 419 |
+
* console.log(buf2.toString('ascii', 0, buf2.length));
|
| 420 |
+
* // Prints: abc
|
| 421 |
+
*
|
| 422 |
+
* buf1[0] = 33;
|
| 423 |
+
*
|
| 424 |
+
* console.log(buf2.toString('ascii', 0, buf2.length));
|
| 425 |
+
* // Prints: !bc
|
| 426 |
+
* ```
|
| 427 |
+
*
|
| 428 |
+
* Specifying negative indexes causes the slice to be generated relative to the
|
| 429 |
+
* end of `buf` rather than the beginning.
|
| 430 |
+
*
|
| 431 |
+
* ```js
|
| 432 |
+
* import { Buffer } from 'node:buffer';
|
| 433 |
+
*
|
| 434 |
+
* const buf = Buffer.from('buffer');
|
| 435 |
+
*
|
| 436 |
+
* console.log(buf.subarray(-6, -1).toString());
|
| 437 |
+
* // Prints: buffe
|
| 438 |
+
* // (Equivalent to buf.subarray(0, 5).)
|
| 439 |
+
*
|
| 440 |
+
* console.log(buf.subarray(-6, -2).toString());
|
| 441 |
+
* // Prints: buff
|
| 442 |
+
* // (Equivalent to buf.subarray(0, 4).)
|
| 443 |
+
*
|
| 444 |
+
* console.log(buf.subarray(-5, -2).toString());
|
| 445 |
+
* // Prints: uff
|
| 446 |
+
* // (Equivalent to buf.subarray(1, 4).)
|
| 447 |
+
* ```
|
| 448 |
+
* @since v3.0.0
|
| 449 |
+
* @param [start=0] Where the new `Buffer` will start.
|
| 450 |
+
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
| 451 |
+
*/
|
| 452 |
+
subarray(start?: number, end?: number): Buffer<TArrayBuffer>;
|
| 453 |
+
}
|
| 454 |
+
type NonSharedBuffer = Buffer<ArrayBuffer>;
|
| 455 |
+
type AllowSharedBuffer = Buffer<ArrayBufferLike>;
|
| 456 |
+
}
|
| 457 |
+
/** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
|
| 458 |
+
var SlowBuffer: {
|
| 459 |
+
/** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
|
| 460 |
+
new(size: number): Buffer<ArrayBuffer>;
|
| 461 |
+
prototype: Buffer;
|
| 462 |
+
};
|
| 463 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/buffer.d.ts
ADDED
|
@@ -0,0 +1,1930 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// If lib.dom.d.ts or lib.webworker.d.ts is loaded, then use the global types.
|
| 2 |
+
// Otherwise, use the types from node.
|
| 3 |
+
type _Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : import("buffer").Blob;
|
| 4 |
+
type _File = typeof globalThis extends { onmessage: any; File: any } ? {} : import("buffer").File;
|
| 5 |
+
|
| 6 |
+
/**
|
| 7 |
+
* `Buffer` objects are used to represent a fixed-length sequence of bytes. Many
|
| 8 |
+
* Node.js APIs support `Buffer`s.
|
| 9 |
+
*
|
| 10 |
+
* The `Buffer` class is a subclass of JavaScript's [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) class and
|
| 11 |
+
* extends it with methods that cover additional use cases. Node.js APIs accept
|
| 12 |
+
* plain [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) s wherever `Buffer`s are supported as well.
|
| 13 |
+
*
|
| 14 |
+
* While the `Buffer` class is available within the global scope, it is still
|
| 15 |
+
* recommended to explicitly reference it via an import or require statement.
|
| 16 |
+
*
|
| 17 |
+
* ```js
|
| 18 |
+
* import { Buffer } from 'node:buffer';
|
| 19 |
+
*
|
| 20 |
+
* // Creates a zero-filled Buffer of length 10.
|
| 21 |
+
* const buf1 = Buffer.alloc(10);
|
| 22 |
+
*
|
| 23 |
+
* // Creates a Buffer of length 10,
|
| 24 |
+
* // filled with bytes which all have the value `1`.
|
| 25 |
+
* const buf2 = Buffer.alloc(10, 1);
|
| 26 |
+
*
|
| 27 |
+
* // Creates an uninitialized buffer of length 10.
|
| 28 |
+
* // This is faster than calling Buffer.alloc() but the returned
|
| 29 |
+
* // Buffer instance might contain old data that needs to be
|
| 30 |
+
* // overwritten using fill(), write(), or other functions that fill the Buffer's
|
| 31 |
+
* // contents.
|
| 32 |
+
* const buf3 = Buffer.allocUnsafe(10);
|
| 33 |
+
*
|
| 34 |
+
* // Creates a Buffer containing the bytes [1, 2, 3].
|
| 35 |
+
* const buf4 = Buffer.from([1, 2, 3]);
|
| 36 |
+
*
|
| 37 |
+
* // Creates a Buffer containing the bytes [1, 1, 1, 1] – the entries
|
| 38 |
+
* // are all truncated using `(value & 255)` to fit into the range 0–255.
|
| 39 |
+
* const buf5 = Buffer.from([257, 257.5, -255, '1']);
|
| 40 |
+
*
|
| 41 |
+
* // Creates a Buffer containing the UTF-8-encoded bytes for the string 'tést':
|
| 42 |
+
* // [0x74, 0xc3, 0xa9, 0x73, 0x74] (in hexadecimal notation)
|
| 43 |
+
* // [116, 195, 169, 115, 116] (in decimal notation)
|
| 44 |
+
* const buf6 = Buffer.from('tést');
|
| 45 |
+
*
|
| 46 |
+
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
|
| 47 |
+
* const buf7 = Buffer.from('tést', 'latin1');
|
| 48 |
+
* ```
|
| 49 |
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/buffer.js)
|
| 50 |
+
*/
|
| 51 |
+
declare module "buffer" {
|
| 52 |
+
import { BinaryLike } from "node:crypto";
|
| 53 |
+
import { ReadableStream as WebReadableStream } from "node:stream/web";
|
| 54 |
+
/**
|
| 55 |
+
* This function returns `true` if `input` contains only valid UTF-8-encoded data,
|
| 56 |
+
* including the case in which `input` is empty.
|
| 57 |
+
*
|
| 58 |
+
* Throws if the `input` is a detached array buffer.
|
| 59 |
+
* @since v19.4.0, v18.14.0
|
| 60 |
+
* @param input The input to validate.
|
| 61 |
+
*/
|
| 62 |
+
export function isUtf8(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
|
| 63 |
+
/**
|
| 64 |
+
* This function returns `true` if `input` contains only valid ASCII-encoded data,
|
| 65 |
+
* including the case in which `input` is empty.
|
| 66 |
+
*
|
| 67 |
+
* Throws if the `input` is a detached array buffer.
|
| 68 |
+
* @since v19.6.0, v18.15.0
|
| 69 |
+
* @param input The input to validate.
|
| 70 |
+
*/
|
| 71 |
+
export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
|
| 72 |
+
export let INSPECT_MAX_BYTES: number;
|
| 73 |
+
export const kMaxLength: number;
|
| 74 |
+
export const kStringMaxLength: number;
|
| 75 |
+
export const constants: {
|
| 76 |
+
MAX_LENGTH: number;
|
| 77 |
+
MAX_STRING_LENGTH: number;
|
| 78 |
+
};
|
| 79 |
+
export type TranscodeEncoding =
|
| 80 |
+
| "ascii"
|
| 81 |
+
| "utf8"
|
| 82 |
+
| "utf-8"
|
| 83 |
+
| "utf16le"
|
| 84 |
+
| "utf-16le"
|
| 85 |
+
| "ucs2"
|
| 86 |
+
| "ucs-2"
|
| 87 |
+
| "latin1"
|
| 88 |
+
| "binary";
|
| 89 |
+
/**
|
| 90 |
+
* Re-encodes the given `Buffer` or `Uint8Array` instance from one character
|
| 91 |
+
* encoding to another. Returns a new `Buffer` instance.
|
| 92 |
+
*
|
| 93 |
+
* Throws if the `fromEnc` or `toEnc` specify invalid character encodings or if
|
| 94 |
+
* conversion from `fromEnc` to `toEnc` is not permitted.
|
| 95 |
+
*
|
| 96 |
+
* Encodings supported by `buffer.transcode()` are: `'ascii'`, `'utf8'`, `'utf16le'`, `'ucs2'`, `'latin1'`, and `'binary'`.
|
| 97 |
+
*
|
| 98 |
+
* The transcoding process will use substitution characters if a given byte
|
| 99 |
+
* sequence cannot be adequately represented in the target encoding. For instance:
|
| 100 |
+
*
|
| 101 |
+
* ```js
|
| 102 |
+
* import { Buffer, transcode } from 'node:buffer';
|
| 103 |
+
*
|
| 104 |
+
* const newBuf = transcode(Buffer.from('€'), 'utf8', 'ascii');
|
| 105 |
+
* console.log(newBuf.toString('ascii'));
|
| 106 |
+
* // Prints: '?'
|
| 107 |
+
* ```
|
| 108 |
+
*
|
| 109 |
+
* Because the Euro (`€`) sign is not representable in US-ASCII, it is replaced
|
| 110 |
+
* with `?` in the transcoded `Buffer`.
|
| 111 |
+
* @since v7.1.0
|
| 112 |
+
* @param source A `Buffer` or `Uint8Array` instance.
|
| 113 |
+
* @param fromEnc The current encoding.
|
| 114 |
+
* @param toEnc To target encoding.
|
| 115 |
+
*/
|
| 116 |
+
export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer;
|
| 117 |
+
/**
|
| 118 |
+
* Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using
|
| 119 |
+
* a prior call to `URL.createObjectURL()`.
|
| 120 |
+
* @since v16.7.0
|
| 121 |
+
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
| 122 |
+
*/
|
| 123 |
+
export function resolveObjectURL(id: string): Blob | undefined;
|
| 124 |
+
export { type AllowSharedBuffer, Buffer, type NonSharedBuffer };
|
| 125 |
+
/**
|
| 126 |
+
* @experimental
|
| 127 |
+
*/
|
| 128 |
+
export interface BlobOptions {
|
| 129 |
+
/**
|
| 130 |
+
* One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts
|
| 131 |
+
* will be converted to the platform native line-ending as specified by `import { EOL } from 'node:os'`.
|
| 132 |
+
*/
|
| 133 |
+
endings?: "transparent" | "native";
|
| 134 |
+
/**
|
| 135 |
+
* The Blob content-type. The intent is for `type` to convey
|
| 136 |
+
* the MIME media type of the data, however no validation of the type format
|
| 137 |
+
* is performed.
|
| 138 |
+
*/
|
| 139 |
+
type?: string | undefined;
|
| 140 |
+
}
|
| 141 |
+
/**
|
| 142 |
+
* A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across
|
| 143 |
+
* multiple worker threads.
|
| 144 |
+
* @since v15.7.0, v14.18.0
|
| 145 |
+
*/
|
| 146 |
+
export class Blob {
|
| 147 |
+
/**
|
| 148 |
+
* The total size of the `Blob` in bytes.
|
| 149 |
+
* @since v15.7.0, v14.18.0
|
| 150 |
+
*/
|
| 151 |
+
readonly size: number;
|
| 152 |
+
/**
|
| 153 |
+
* The content-type of the `Blob`.
|
| 154 |
+
* @since v15.7.0, v14.18.0
|
| 155 |
+
*/
|
| 156 |
+
readonly type: string;
|
| 157 |
+
/**
|
| 158 |
+
* Creates a new `Blob` object containing a concatenation of the given sources.
|
| 159 |
+
*
|
| 160 |
+
* {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into
|
| 161 |
+
* the 'Blob' and can therefore be safely modified after the 'Blob' is created.
|
| 162 |
+
*
|
| 163 |
+
* String sources are also copied into the `Blob`.
|
| 164 |
+
*/
|
| 165 |
+
constructor(sources: Array<ArrayBuffer | BinaryLike | Blob>, options?: BlobOptions);
|
| 166 |
+
/**
|
| 167 |
+
* Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of
|
| 168 |
+
* the `Blob` data.
|
| 169 |
+
* @since v15.7.0, v14.18.0
|
| 170 |
+
*/
|
| 171 |
+
arrayBuffer(): Promise<ArrayBuffer>;
|
| 172 |
+
/**
|
| 173 |
+
* The `blob.bytes()` method returns the byte of the `Blob` object as a `Promise<Uint8Array>`.
|
| 174 |
+
*
|
| 175 |
+
* ```js
|
| 176 |
+
* const blob = new Blob(['hello']);
|
| 177 |
+
* blob.bytes().then((bytes) => {
|
| 178 |
+
* console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]
|
| 179 |
+
* });
|
| 180 |
+
* ```
|
| 181 |
+
*/
|
| 182 |
+
bytes(): Promise<Uint8Array>;
|
| 183 |
+
/**
|
| 184 |
+
* Creates and returns a new `Blob` containing a subset of this `Blob` objects
|
| 185 |
+
* data. The original `Blob` is not altered.
|
| 186 |
+
* @since v15.7.0, v14.18.0
|
| 187 |
+
* @param start The starting index.
|
| 188 |
+
* @param end The ending index.
|
| 189 |
+
* @param type The content-type for the new `Blob`
|
| 190 |
+
*/
|
| 191 |
+
slice(start?: number, end?: number, type?: string): Blob;
|
| 192 |
+
/**
|
| 193 |
+
* Returns a promise that fulfills with the contents of the `Blob` decoded as a
|
| 194 |
+
* UTF-8 string.
|
| 195 |
+
* @since v15.7.0, v14.18.0
|
| 196 |
+
*/
|
| 197 |
+
text(): Promise<string>;
|
| 198 |
+
/**
|
| 199 |
+
* Returns a new `ReadableStream` that allows the content of the `Blob` to be read.
|
| 200 |
+
* @since v16.7.0
|
| 201 |
+
*/
|
| 202 |
+
stream(): WebReadableStream;
|
| 203 |
+
}
|
| 204 |
+
export interface FileOptions {
|
| 205 |
+
/**
|
| 206 |
+
* One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be
|
| 207 |
+
* converted to the platform native line-ending as specified by `import { EOL } from 'node:os'`.
|
| 208 |
+
*/
|
| 209 |
+
endings?: "native" | "transparent";
|
| 210 |
+
/** The File content-type. */
|
| 211 |
+
type?: string;
|
| 212 |
+
/** The last modified date of the file. `Default`: Date.now(). */
|
| 213 |
+
lastModified?: number;
|
| 214 |
+
}
|
| 215 |
+
/**
|
| 216 |
+
* A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files.
|
| 217 |
+
* @since v19.2.0, v18.13.0
|
| 218 |
+
*/
|
| 219 |
+
export class File extends Blob {
|
| 220 |
+
constructor(sources: Array<BinaryLike | Blob>, fileName: string, options?: FileOptions);
|
| 221 |
+
/**
|
| 222 |
+
* The name of the `File`.
|
| 223 |
+
* @since v19.2.0, v18.13.0
|
| 224 |
+
*/
|
| 225 |
+
readonly name: string;
|
| 226 |
+
/**
|
| 227 |
+
* The last modified date of the `File`.
|
| 228 |
+
* @since v19.2.0, v18.13.0
|
| 229 |
+
*/
|
| 230 |
+
readonly lastModified: number;
|
| 231 |
+
}
|
| 232 |
+
export import atob = globalThis.atob;
|
| 233 |
+
export import btoa = globalThis.btoa;
|
| 234 |
+
export type WithImplicitCoercion<T> =
|
| 235 |
+
| T
|
| 236 |
+
| { valueOf(): T }
|
| 237 |
+
| (T extends string ? { [Symbol.toPrimitive](hint: "string"): T } : never);
|
| 238 |
+
global {
|
| 239 |
+
namespace NodeJS {
|
| 240 |
+
export { BufferEncoding };
|
| 241 |
+
}
|
| 242 |
+
// Buffer class
|
| 243 |
+
type BufferEncoding =
|
| 244 |
+
| "ascii"
|
| 245 |
+
| "utf8"
|
| 246 |
+
| "utf-8"
|
| 247 |
+
| "utf16le"
|
| 248 |
+
| "utf-16le"
|
| 249 |
+
| "ucs2"
|
| 250 |
+
| "ucs-2"
|
| 251 |
+
| "base64"
|
| 252 |
+
| "base64url"
|
| 253 |
+
| "latin1"
|
| 254 |
+
| "binary"
|
| 255 |
+
| "hex";
|
| 256 |
+
/**
|
| 257 |
+
* Raw data is stored in instances of the Buffer class.
|
| 258 |
+
* A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized.
|
| 259 |
+
* Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'base64url'|'binary'(deprecated)|'hex'
|
| 260 |
+
*/
|
| 261 |
+
interface BufferConstructor {
|
| 262 |
+
// see buffer.buffer.d.ts for implementation specific to TypeScript 5.7 and later
|
| 263 |
+
// see ts5.6/buffer.buffer.d.ts for implementation specific to TypeScript 5.6 and earlier
|
| 264 |
+
|
| 265 |
+
/**
|
| 266 |
+
* Returns `true` if `obj` is a `Buffer`, `false` otherwise.
|
| 267 |
+
*
|
| 268 |
+
* ```js
|
| 269 |
+
* import { Buffer } from 'node:buffer';
|
| 270 |
+
*
|
| 271 |
+
* Buffer.isBuffer(Buffer.alloc(10)); // true
|
| 272 |
+
* Buffer.isBuffer(Buffer.from('foo')); // true
|
| 273 |
+
* Buffer.isBuffer('a string'); // false
|
| 274 |
+
* Buffer.isBuffer([]); // false
|
| 275 |
+
* Buffer.isBuffer(new Uint8Array(1024)); // false
|
| 276 |
+
* ```
|
| 277 |
+
* @since v0.1.101
|
| 278 |
+
*/
|
| 279 |
+
isBuffer(obj: any): obj is Buffer;
|
| 280 |
+
/**
|
| 281 |
+
* Returns `true` if `encoding` is the name of a supported character encoding,
|
| 282 |
+
* or `false` otherwise.
|
| 283 |
+
*
|
| 284 |
+
* ```js
|
| 285 |
+
* import { Buffer } from 'node:buffer';
|
| 286 |
+
*
|
| 287 |
+
* console.log(Buffer.isEncoding('utf8'));
|
| 288 |
+
* // Prints: true
|
| 289 |
+
*
|
| 290 |
+
* console.log(Buffer.isEncoding('hex'));
|
| 291 |
+
* // Prints: true
|
| 292 |
+
*
|
| 293 |
+
* console.log(Buffer.isEncoding('utf/8'));
|
| 294 |
+
* // Prints: false
|
| 295 |
+
*
|
| 296 |
+
* console.log(Buffer.isEncoding(''));
|
| 297 |
+
* // Prints: false
|
| 298 |
+
* ```
|
| 299 |
+
* @since v0.9.1
|
| 300 |
+
* @param encoding A character encoding name to check.
|
| 301 |
+
*/
|
| 302 |
+
isEncoding(encoding: string): encoding is BufferEncoding;
|
| 303 |
+
/**
|
| 304 |
+
* Returns the byte length of a string when encoded using `encoding`.
|
| 305 |
+
* This is not the same as [`String.prototype.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length), which does not account
|
| 306 |
+
* for the encoding that is used to convert the string into bytes.
|
| 307 |
+
*
|
| 308 |
+
* For `'base64'`, `'base64url'`, and `'hex'`, this function assumes valid input.
|
| 309 |
+
* For strings that contain non-base64/hex-encoded data (e.g. whitespace), the
|
| 310 |
+
* return value might be greater than the length of a `Buffer` created from the
|
| 311 |
+
* string.
|
| 312 |
+
*
|
| 313 |
+
* ```js
|
| 314 |
+
* import { Buffer } from 'node:buffer';
|
| 315 |
+
*
|
| 316 |
+
* const str = '\u00bd + \u00bc = \u00be';
|
| 317 |
+
*
|
| 318 |
+
* console.log(`${str}: ${str.length} characters, ` +
|
| 319 |
+
* `${Buffer.byteLength(str, 'utf8')} bytes`);
|
| 320 |
+
* // Prints: ½ + ¼ = ¾: 9 characters, 12 bytes
|
| 321 |
+
* ```
|
| 322 |
+
*
|
| 323 |
+
* When `string` is a
|
| 324 |
+
* `Buffer`/[`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView)/[`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/-
|
| 325 |
+
* Reference/Global_Objects/TypedArray)/[`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)/[`SharedArrayBuffer`](https://develop-
|
| 326 |
+
* er.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer), the byte length as reported by `.byteLength`is returned.
|
| 327 |
+
* @since v0.1.90
|
| 328 |
+
* @param string A value to calculate the length of.
|
| 329 |
+
* @param [encoding='utf8'] If `string` is a string, this is its encoding.
|
| 330 |
+
* @return The number of bytes contained within `string`.
|
| 331 |
+
*/
|
| 332 |
+
byteLength(
|
| 333 |
+
string: string | Buffer | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
|
| 334 |
+
encoding?: BufferEncoding,
|
| 335 |
+
): number;
|
| 336 |
+
/**
|
| 337 |
+
* Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of `Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
|
| 338 |
+
*
|
| 339 |
+
* ```js
|
| 340 |
+
* import { Buffer } from 'node:buffer';
|
| 341 |
+
*
|
| 342 |
+
* const buf1 = Buffer.from('1234');
|
| 343 |
+
* const buf2 = Buffer.from('0123');
|
| 344 |
+
* const arr = [buf1, buf2];
|
| 345 |
+
*
|
| 346 |
+
* console.log(arr.sort(Buffer.compare));
|
| 347 |
+
* // Prints: [ <Buffer 30 31 32 33>, <Buffer 31 32 33 34> ]
|
| 348 |
+
* // (This result is equal to: [buf2, buf1].)
|
| 349 |
+
* ```
|
| 350 |
+
* @since v0.11.13
|
| 351 |
+
* @return Either `-1`, `0`, or `1`, depending on the result of the comparison. See `compare` for details.
|
| 352 |
+
*/
|
| 353 |
+
compare(buf1: Uint8Array, buf2: Uint8Array): -1 | 0 | 1;
|
| 354 |
+
/**
|
| 355 |
+
* This is the size (in bytes) of pre-allocated internal `Buffer` instances used
|
| 356 |
+
* for pooling. This value may be modified.
|
| 357 |
+
* @since v0.11.3
|
| 358 |
+
*/
|
| 359 |
+
poolSize: number;
|
| 360 |
+
}
|
| 361 |
+
interface Buffer {
|
| 362 |
+
// see buffer.buffer.d.ts for implementation specific to TypeScript 5.7 and later
|
| 363 |
+
// see ts5.6/buffer.buffer.d.ts for implementation specific to TypeScript 5.6 and earlier
|
| 364 |
+
|
| 365 |
+
/**
|
| 366 |
+
* Writes `string` to `buf` at `offset` according to the character encoding in`encoding`. The `length` parameter is the number of bytes to write. If `buf` did
|
| 367 |
+
* not contain enough space to fit the entire string, only part of `string` will be
|
| 368 |
+
* written. However, partially encoded characters will not be written.
|
| 369 |
+
*
|
| 370 |
+
* ```js
|
| 371 |
+
* import { Buffer } from 'node:buffer';
|
| 372 |
+
*
|
| 373 |
+
* const buf = Buffer.alloc(256);
|
| 374 |
+
*
|
| 375 |
+
* const len = buf.write('\u00bd + \u00bc = \u00be', 0);
|
| 376 |
+
*
|
| 377 |
+
* console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`);
|
| 378 |
+
* // Prints: 12 bytes: ½ + ¼ = ¾
|
| 379 |
+
*
|
| 380 |
+
* const buffer = Buffer.alloc(10);
|
| 381 |
+
*
|
| 382 |
+
* const length = buffer.write('abcd', 8);
|
| 383 |
+
*
|
| 384 |
+
* console.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`);
|
| 385 |
+
* // Prints: 2 bytes : ab
|
| 386 |
+
* ```
|
| 387 |
+
* @since v0.1.90
|
| 388 |
+
* @param string String to write to `buf`.
|
| 389 |
+
* @param [offset=0] Number of bytes to skip before starting to write `string`.
|
| 390 |
+
* @param [length=buf.length - offset] Maximum number of bytes to write (written bytes will not exceed `buf.length - offset`).
|
| 391 |
+
* @param [encoding='utf8'] The character encoding of `string`.
|
| 392 |
+
* @return Number of bytes written.
|
| 393 |
+
*/
|
| 394 |
+
write(string: string, encoding?: BufferEncoding): number;
|
| 395 |
+
write(string: string, offset: number, encoding?: BufferEncoding): number;
|
| 396 |
+
write(string: string, offset: number, length: number, encoding?: BufferEncoding): number;
|
| 397 |
+
/**
|
| 398 |
+
* Decodes `buf` to a string according to the specified character encoding in`encoding`. `start` and `end` may be passed to decode only a subset of `buf`.
|
| 399 |
+
*
|
| 400 |
+
* If `encoding` is `'utf8'` and a byte sequence in the input is not valid UTF-8,
|
| 401 |
+
* then each invalid byte is replaced with the replacement character `U+FFFD`.
|
| 402 |
+
*
|
| 403 |
+
* The maximum length of a string instance (in UTF-16 code units) is available
|
| 404 |
+
* as {@link constants.MAX_STRING_LENGTH}.
|
| 405 |
+
*
|
| 406 |
+
* ```js
|
| 407 |
+
* import { Buffer } from 'node:buffer';
|
| 408 |
+
*
|
| 409 |
+
* const buf1 = Buffer.allocUnsafe(26);
|
| 410 |
+
*
|
| 411 |
+
* for (let i = 0; i < 26; i++) {
|
| 412 |
+
* // 97 is the decimal ASCII value for 'a'.
|
| 413 |
+
* buf1[i] = i + 97;
|
| 414 |
+
* }
|
| 415 |
+
*
|
| 416 |
+
* console.log(buf1.toString('utf8'));
|
| 417 |
+
* // Prints: abcdefghijklmnopqrstuvwxyz
|
| 418 |
+
* console.log(buf1.toString('utf8', 0, 5));
|
| 419 |
+
* // Prints: abcde
|
| 420 |
+
*
|
| 421 |
+
* const buf2 = Buffer.from('tést');
|
| 422 |
+
*
|
| 423 |
+
* console.log(buf2.toString('hex'));
|
| 424 |
+
* // Prints: 74c3a97374
|
| 425 |
+
* console.log(buf2.toString('utf8', 0, 3));
|
| 426 |
+
* // Prints: té
|
| 427 |
+
* console.log(buf2.toString(undefined, 0, 3));
|
| 428 |
+
* // Prints: té
|
| 429 |
+
* ```
|
| 430 |
+
* @since v0.1.90
|
| 431 |
+
* @param [encoding='utf8'] The character encoding to use.
|
| 432 |
+
* @param [start=0] The byte offset to start decoding at.
|
| 433 |
+
* @param [end=buf.length] The byte offset to stop decoding at (not inclusive).
|
| 434 |
+
*/
|
| 435 |
+
toString(encoding?: BufferEncoding, start?: number, end?: number): string;
|
| 436 |
+
/**
|
| 437 |
+
* Returns a JSON representation of `buf`. [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) implicitly calls
|
| 438 |
+
* this function when stringifying a `Buffer` instance.
|
| 439 |
+
*
|
| 440 |
+
* `Buffer.from()` accepts objects in the format returned from this method.
|
| 441 |
+
* In particular, `Buffer.from(buf.toJSON())` works like `Buffer.from(buf)`.
|
| 442 |
+
*
|
| 443 |
+
* ```js
|
| 444 |
+
* import { Buffer } from 'node:buffer';
|
| 445 |
+
*
|
| 446 |
+
* const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]);
|
| 447 |
+
* const json = JSON.stringify(buf);
|
| 448 |
+
*
|
| 449 |
+
* console.log(json);
|
| 450 |
+
* // Prints: {"type":"Buffer","data":[1,2,3,4,5]}
|
| 451 |
+
*
|
| 452 |
+
* const copy = JSON.parse(json, (key, value) => {
|
| 453 |
+
* return value && value.type === 'Buffer' ?
|
| 454 |
+
* Buffer.from(value) :
|
| 455 |
+
* value;
|
| 456 |
+
* });
|
| 457 |
+
*
|
| 458 |
+
* console.log(copy);
|
| 459 |
+
* // Prints: <Buffer 01 02 03 04 05>
|
| 460 |
+
* ```
|
| 461 |
+
* @since v0.9.2
|
| 462 |
+
*/
|
| 463 |
+
toJSON(): {
|
| 464 |
+
type: "Buffer";
|
| 465 |
+
data: number[];
|
| 466 |
+
};
|
| 467 |
+
/**
|
| 468 |
+
* Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,`false` otherwise. Equivalent to `buf.compare(otherBuffer) === 0`.
|
| 469 |
+
*
|
| 470 |
+
* ```js
|
| 471 |
+
* import { Buffer } from 'node:buffer';
|
| 472 |
+
*
|
| 473 |
+
* const buf1 = Buffer.from('ABC');
|
| 474 |
+
* const buf2 = Buffer.from('414243', 'hex');
|
| 475 |
+
* const buf3 = Buffer.from('ABCD');
|
| 476 |
+
*
|
| 477 |
+
* console.log(buf1.equals(buf2));
|
| 478 |
+
* // Prints: true
|
| 479 |
+
* console.log(buf1.equals(buf3));
|
| 480 |
+
* // Prints: false
|
| 481 |
+
* ```
|
| 482 |
+
* @since v0.11.13
|
| 483 |
+
* @param otherBuffer A `Buffer` or {@link Uint8Array} with which to compare `buf`.
|
| 484 |
+
*/
|
| 485 |
+
equals(otherBuffer: Uint8Array): boolean;
|
| 486 |
+
/**
|
| 487 |
+
* Compares `buf` with `target` and returns a number indicating whether `buf`comes before, after, or is the same as `target` in sort order.
|
| 488 |
+
* Comparison is based on the actual sequence of bytes in each `Buffer`.
|
| 489 |
+
*
|
| 490 |
+
* * `0` is returned if `target` is the same as `buf`
|
| 491 |
+
* * `1` is returned if `target` should come _before_`buf` when sorted.
|
| 492 |
+
* * `-1` is returned if `target` should come _after_`buf` when sorted.
|
| 493 |
+
*
|
| 494 |
+
* ```js
|
| 495 |
+
* import { Buffer } from 'node:buffer';
|
| 496 |
+
*
|
| 497 |
+
* const buf1 = Buffer.from('ABC');
|
| 498 |
+
* const buf2 = Buffer.from('BCD');
|
| 499 |
+
* const buf3 = Buffer.from('ABCD');
|
| 500 |
+
*
|
| 501 |
+
* console.log(buf1.compare(buf1));
|
| 502 |
+
* // Prints: 0
|
| 503 |
+
* console.log(buf1.compare(buf2));
|
| 504 |
+
* // Prints: -1
|
| 505 |
+
* console.log(buf1.compare(buf3));
|
| 506 |
+
* // Prints: -1
|
| 507 |
+
* console.log(buf2.compare(buf1));
|
| 508 |
+
* // Prints: 1
|
| 509 |
+
* console.log(buf2.compare(buf3));
|
| 510 |
+
* // Prints: 1
|
| 511 |
+
* console.log([buf1, buf2, buf3].sort(Buffer.compare));
|
| 512 |
+
* // Prints: [ <Buffer 41 42 43>, <Buffer 41 42 43 44>, <Buffer 42 43 44> ]
|
| 513 |
+
* // (This result is equal to: [buf1, buf3, buf2].)
|
| 514 |
+
* ```
|
| 515 |
+
*
|
| 516 |
+
* The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd` arguments can be used to limit the comparison to specific ranges within `target` and `buf` respectively.
|
| 517 |
+
*
|
| 518 |
+
* ```js
|
| 519 |
+
* import { Buffer } from 'node:buffer';
|
| 520 |
+
*
|
| 521 |
+
* const buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
| 522 |
+
* const buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]);
|
| 523 |
+
*
|
| 524 |
+
* console.log(buf1.compare(buf2, 5, 9, 0, 4));
|
| 525 |
+
* // Prints: 0
|
| 526 |
+
* console.log(buf1.compare(buf2, 0, 6, 4));
|
| 527 |
+
* // Prints: -1
|
| 528 |
+
* console.log(buf1.compare(buf2, 5, 6, 5));
|
| 529 |
+
* // Prints: 1
|
| 530 |
+
* ```
|
| 531 |
+
*
|
| 532 |
+
* `ERR_OUT_OF_RANGE` is thrown if `targetStart < 0`, `sourceStart < 0`, `targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`.
|
| 533 |
+
* @since v0.11.13
|
| 534 |
+
* @param target A `Buffer` or {@link Uint8Array} with which to compare `buf`.
|
| 535 |
+
* @param [targetStart=0] The offset within `target` at which to begin comparison.
|
| 536 |
+
* @param [targetEnd=target.length] The offset within `target` at which to end comparison (not inclusive).
|
| 537 |
+
* @param [sourceStart=0] The offset within `buf` at which to begin comparison.
|
| 538 |
+
* @param [sourceEnd=buf.length] The offset within `buf` at which to end comparison (not inclusive).
|
| 539 |
+
*/
|
| 540 |
+
compare(
|
| 541 |
+
target: Uint8Array,
|
| 542 |
+
targetStart?: number,
|
| 543 |
+
targetEnd?: number,
|
| 544 |
+
sourceStart?: number,
|
| 545 |
+
sourceEnd?: number,
|
| 546 |
+
): -1 | 0 | 1;
|
| 547 |
+
/**
|
| 548 |
+
* Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`.
|
| 549 |
+
*
|
| 550 |
+
* [`TypedArray.prototype.set()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set) performs the same operation, and is available
|
| 551 |
+
* for all TypedArrays, including Node.js `Buffer`s, although it takes
|
| 552 |
+
* different function arguments.
|
| 553 |
+
*
|
| 554 |
+
* ```js
|
| 555 |
+
* import { Buffer } from 'node:buffer';
|
| 556 |
+
*
|
| 557 |
+
* // Create two `Buffer` instances.
|
| 558 |
+
* const buf1 = Buffer.allocUnsafe(26);
|
| 559 |
+
* const buf2 = Buffer.allocUnsafe(26).fill('!');
|
| 560 |
+
*
|
| 561 |
+
* for (let i = 0; i < 26; i++) {
|
| 562 |
+
* // 97 is the decimal ASCII value for 'a'.
|
| 563 |
+
* buf1[i] = i + 97;
|
| 564 |
+
* }
|
| 565 |
+
*
|
| 566 |
+
* // Copy `buf1` bytes 16 through 19 into `buf2` starting at byte 8 of `buf2`.
|
| 567 |
+
* buf1.copy(buf2, 8, 16, 20);
|
| 568 |
+
* // This is equivalent to:
|
| 569 |
+
* // buf2.set(buf1.subarray(16, 20), 8);
|
| 570 |
+
*
|
| 571 |
+
* console.log(buf2.toString('ascii', 0, 25));
|
| 572 |
+
* // Prints: !!!!!!!!qrst!!!!!!!!!!!!!
|
| 573 |
+
* ```
|
| 574 |
+
*
|
| 575 |
+
* ```js
|
| 576 |
+
* import { Buffer } from 'node:buffer';
|
| 577 |
+
*
|
| 578 |
+
* // Create a `Buffer` and copy data from one region to an overlapping region
|
| 579 |
+
* // within the same `Buffer`.
|
| 580 |
+
*
|
| 581 |
+
* const buf = Buffer.allocUnsafe(26);
|
| 582 |
+
*
|
| 583 |
+
* for (let i = 0; i < 26; i++) {
|
| 584 |
+
* // 97 is the decimal ASCII value for 'a'.
|
| 585 |
+
* buf[i] = i + 97;
|
| 586 |
+
* }
|
| 587 |
+
*
|
| 588 |
+
* buf.copy(buf, 0, 4, 10);
|
| 589 |
+
*
|
| 590 |
+
* console.log(buf.toString());
|
| 591 |
+
* // Prints: efghijghijklmnopqrstuvwxyz
|
| 592 |
+
* ```
|
| 593 |
+
* @since v0.1.90
|
| 594 |
+
* @param target A `Buffer` or {@link Uint8Array} to copy into.
|
| 595 |
+
* @param [targetStart=0] The offset within `target` at which to begin writing.
|
| 596 |
+
* @param [sourceStart=0] The offset within `buf` from which to begin copying.
|
| 597 |
+
* @param [sourceEnd=buf.length] The offset within `buf` at which to stop copying (not inclusive).
|
| 598 |
+
* @return The number of bytes copied.
|
| 599 |
+
*/
|
| 600 |
+
copy(target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
| 601 |
+
/**
|
| 602 |
+
* Writes `value` to `buf` at the specified `offset` as big-endian.
|
| 603 |
+
*
|
| 604 |
+
* `value` is interpreted and written as a two's complement signed integer.
|
| 605 |
+
*
|
| 606 |
+
* ```js
|
| 607 |
+
* import { Buffer } from 'node:buffer';
|
| 608 |
+
*
|
| 609 |
+
* const buf = Buffer.allocUnsafe(8);
|
| 610 |
+
*
|
| 611 |
+
* buf.writeBigInt64BE(0x0102030405060708n, 0);
|
| 612 |
+
*
|
| 613 |
+
* console.log(buf);
|
| 614 |
+
* // Prints: <Buffer 01 02 03 04 05 06 07 08>
|
| 615 |
+
* ```
|
| 616 |
+
* @since v12.0.0, v10.20.0
|
| 617 |
+
* @param value Number to be written to `buf`.
|
| 618 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`.
|
| 619 |
+
* @return `offset` plus the number of bytes written.
|
| 620 |
+
*/
|
| 621 |
+
writeBigInt64BE(value: bigint, offset?: number): number;
|
| 622 |
+
/**
|
| 623 |
+
* Writes `value` to `buf` at the specified `offset` as little-endian.
|
| 624 |
+
*
|
| 625 |
+
* `value` is interpreted and written as a two's complement signed integer.
|
| 626 |
+
*
|
| 627 |
+
* ```js
|
| 628 |
+
* import { Buffer } from 'node:buffer';
|
| 629 |
+
*
|
| 630 |
+
* const buf = Buffer.allocUnsafe(8);
|
| 631 |
+
*
|
| 632 |
+
* buf.writeBigInt64LE(0x0102030405060708n, 0);
|
| 633 |
+
*
|
| 634 |
+
* console.log(buf);
|
| 635 |
+
* // Prints: <Buffer 08 07 06 05 04 03 02 01>
|
| 636 |
+
* ```
|
| 637 |
+
* @since v12.0.0, v10.20.0
|
| 638 |
+
* @param value Number to be written to `buf`.
|
| 639 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`.
|
| 640 |
+
* @return `offset` plus the number of bytes written.
|
| 641 |
+
*/
|
| 642 |
+
writeBigInt64LE(value: bigint, offset?: number): number;
|
| 643 |
+
/**
|
| 644 |
+
* Writes `value` to `buf` at the specified `offset` as big-endian.
|
| 645 |
+
*
|
| 646 |
+
* This function is also available under the `writeBigUint64BE` alias.
|
| 647 |
+
*
|
| 648 |
+
* ```js
|
| 649 |
+
* import { Buffer } from 'node:buffer';
|
| 650 |
+
*
|
| 651 |
+
* const buf = Buffer.allocUnsafe(8);
|
| 652 |
+
*
|
| 653 |
+
* buf.writeBigUInt64BE(0xdecafafecacefaden, 0);
|
| 654 |
+
*
|
| 655 |
+
* console.log(buf);
|
| 656 |
+
* // Prints: <Buffer de ca fa fe ca ce fa de>
|
| 657 |
+
* ```
|
| 658 |
+
* @since v12.0.0, v10.20.0
|
| 659 |
+
* @param value Number to be written to `buf`.
|
| 660 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`.
|
| 661 |
+
* @return `offset` plus the number of bytes written.
|
| 662 |
+
*/
|
| 663 |
+
writeBigUInt64BE(value: bigint, offset?: number): number;
|
| 664 |
+
/**
|
| 665 |
+
* @alias Buffer.writeBigUInt64BE
|
| 666 |
+
* @since v14.10.0, v12.19.0
|
| 667 |
+
*/
|
| 668 |
+
writeBigUint64BE(value: bigint, offset?: number): number;
|
| 669 |
+
/**
|
| 670 |
+
* Writes `value` to `buf` at the specified `offset` as little-endian
|
| 671 |
+
*
|
| 672 |
+
* ```js
|
| 673 |
+
* import { Buffer } from 'node:buffer';
|
| 674 |
+
*
|
| 675 |
+
* const buf = Buffer.allocUnsafe(8);
|
| 676 |
+
*
|
| 677 |
+
* buf.writeBigUInt64LE(0xdecafafecacefaden, 0);
|
| 678 |
+
*
|
| 679 |
+
* console.log(buf);
|
| 680 |
+
* // Prints: <Buffer de fa ce ca fe fa ca de>
|
| 681 |
+
* ```
|
| 682 |
+
*
|
| 683 |
+
* This function is also available under the `writeBigUint64LE` alias.
|
| 684 |
+
* @since v12.0.0, v10.20.0
|
| 685 |
+
* @param value Number to be written to `buf`.
|
| 686 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`.
|
| 687 |
+
* @return `offset` plus the number of bytes written.
|
| 688 |
+
*/
|
| 689 |
+
writeBigUInt64LE(value: bigint, offset?: number): number;
|
| 690 |
+
/**
|
| 691 |
+
* @alias Buffer.writeBigUInt64LE
|
| 692 |
+
* @since v14.10.0, v12.19.0
|
| 693 |
+
*/
|
| 694 |
+
writeBigUint64LE(value: bigint, offset?: number): number;
|
| 695 |
+
/**
|
| 696 |
+
* Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined
|
| 697 |
+
* when `value` is anything other than an unsigned integer.
|
| 698 |
+
*
|
| 699 |
+
* This function is also available under the `writeUintLE` alias.
|
| 700 |
+
*
|
| 701 |
+
* ```js
|
| 702 |
+
* import { Buffer } from 'node:buffer';
|
| 703 |
+
*
|
| 704 |
+
* const buf = Buffer.allocUnsafe(6);
|
| 705 |
+
*
|
| 706 |
+
* buf.writeUIntLE(0x1234567890ab, 0, 6);
|
| 707 |
+
*
|
| 708 |
+
* console.log(buf);
|
| 709 |
+
* // Prints: <Buffer ab 90 78 56 34 12>
|
| 710 |
+
* ```
|
| 711 |
+
* @since v0.5.5
|
| 712 |
+
* @param value Number to be written to `buf`.
|
| 713 |
+
* @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`.
|
| 714 |
+
* @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`.
|
| 715 |
+
* @return `offset` plus the number of bytes written.
|
| 716 |
+
*/
|
| 717 |
+
writeUIntLE(value: number, offset: number, byteLength: number): number;
|
| 718 |
+
/**
|
| 719 |
+
* @alias Buffer.writeUIntLE
|
| 720 |
+
* @since v14.9.0, v12.19.0
|
| 721 |
+
*/
|
| 722 |
+
writeUintLE(value: number, offset: number, byteLength: number): number;
|
| 723 |
+
/**
|
| 724 |
+
* Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined
|
| 725 |
+
* when `value` is anything other than an unsigned integer.
|
| 726 |
+
*
|
| 727 |
+
* This function is also available under the `writeUintBE` alias.
|
| 728 |
+
*
|
| 729 |
+
* ```js
|
| 730 |
+
* import { Buffer } from 'node:buffer';
|
| 731 |
+
*
|
| 732 |
+
* const buf = Buffer.allocUnsafe(6);
|
| 733 |
+
*
|
| 734 |
+
* buf.writeUIntBE(0x1234567890ab, 0, 6);
|
| 735 |
+
*
|
| 736 |
+
* console.log(buf);
|
| 737 |
+
* // Prints: <Buffer 12 34 56 78 90 ab>
|
| 738 |
+
* ```
|
| 739 |
+
* @since v0.5.5
|
| 740 |
+
* @param value Number to be written to `buf`.
|
| 741 |
+
* @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`.
|
| 742 |
+
* @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`.
|
| 743 |
+
* @return `offset` plus the number of bytes written.
|
| 744 |
+
*/
|
| 745 |
+
writeUIntBE(value: number, offset: number, byteLength: number): number;
|
| 746 |
+
/**
|
| 747 |
+
* @alias Buffer.writeUIntBE
|
| 748 |
+
* @since v14.9.0, v12.19.0
|
| 749 |
+
*/
|
| 750 |
+
writeUintBE(value: number, offset: number, byteLength: number): number;
|
| 751 |
+
/**
|
| 752 |
+
* Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined
|
| 753 |
+
* when `value` is anything other than a signed integer.
|
| 754 |
+
*
|
| 755 |
+
* ```js
|
| 756 |
+
* import { Buffer } from 'node:buffer';
|
| 757 |
+
*
|
| 758 |
+
* const buf = Buffer.allocUnsafe(6);
|
| 759 |
+
*
|
| 760 |
+
* buf.writeIntLE(0x1234567890ab, 0, 6);
|
| 761 |
+
*
|
| 762 |
+
* console.log(buf);
|
| 763 |
+
* // Prints: <Buffer ab 90 78 56 34 12>
|
| 764 |
+
* ```
|
| 765 |
+
* @since v0.11.15
|
| 766 |
+
* @param value Number to be written to `buf`.
|
| 767 |
+
* @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`.
|
| 768 |
+
* @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`.
|
| 769 |
+
* @return `offset` plus the number of bytes written.
|
| 770 |
+
*/
|
| 771 |
+
writeIntLE(value: number, offset: number, byteLength: number): number;
|
| 772 |
+
/**
|
| 773 |
+
* Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined when`value` is anything other than a
|
| 774 |
+
* signed integer.
|
| 775 |
+
*
|
| 776 |
+
* ```js
|
| 777 |
+
* import { Buffer } from 'node:buffer';
|
| 778 |
+
*
|
| 779 |
+
* const buf = Buffer.allocUnsafe(6);
|
| 780 |
+
*
|
| 781 |
+
* buf.writeIntBE(0x1234567890ab, 0, 6);
|
| 782 |
+
*
|
| 783 |
+
* console.log(buf);
|
| 784 |
+
* // Prints: <Buffer 12 34 56 78 90 ab>
|
| 785 |
+
* ```
|
| 786 |
+
* @since v0.11.15
|
| 787 |
+
* @param value Number to be written to `buf`.
|
| 788 |
+
* @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`.
|
| 789 |
+
* @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`.
|
| 790 |
+
* @return `offset` plus the number of bytes written.
|
| 791 |
+
*/
|
| 792 |
+
writeIntBE(value: number, offset: number, byteLength: number): number;
|
| 793 |
+
/**
|
| 794 |
+
* Reads an unsigned, big-endian 64-bit integer from `buf` at the specified`offset`.
|
| 795 |
+
*
|
| 796 |
+
* This function is also available under the `readBigUint64BE` alias.
|
| 797 |
+
*
|
| 798 |
+
* ```js
|
| 799 |
+
* import { Buffer } from 'node:buffer';
|
| 800 |
+
*
|
| 801 |
+
* const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);
|
| 802 |
+
*
|
| 803 |
+
* console.log(buf.readBigUInt64BE(0));
|
| 804 |
+
* // Prints: 4294967295n
|
| 805 |
+
* ```
|
| 806 |
+
* @since v12.0.0, v10.20.0
|
| 807 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`.
|
| 808 |
+
*/
|
| 809 |
+
readBigUInt64BE(offset?: number): bigint;
|
| 810 |
+
/**
|
| 811 |
+
* @alias Buffer.readBigUInt64BE
|
| 812 |
+
* @since v14.10.0, v12.19.0
|
| 813 |
+
*/
|
| 814 |
+
readBigUint64BE(offset?: number): bigint;
|
| 815 |
+
/**
|
| 816 |
+
* Reads an unsigned, little-endian 64-bit integer from `buf` at the specified`offset`.
|
| 817 |
+
*
|
| 818 |
+
* This function is also available under the `readBigUint64LE` alias.
|
| 819 |
+
*
|
| 820 |
+
* ```js
|
| 821 |
+
* import { Buffer } from 'node:buffer';
|
| 822 |
+
*
|
| 823 |
+
* const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);
|
| 824 |
+
*
|
| 825 |
+
* console.log(buf.readBigUInt64LE(0));
|
| 826 |
+
* // Prints: 18446744069414584320n
|
| 827 |
+
* ```
|
| 828 |
+
* @since v12.0.0, v10.20.0
|
| 829 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`.
|
| 830 |
+
*/
|
| 831 |
+
readBigUInt64LE(offset?: number): bigint;
|
| 832 |
+
/**
|
| 833 |
+
* @alias Buffer.readBigUInt64LE
|
| 834 |
+
* @since v14.10.0, v12.19.0
|
| 835 |
+
*/
|
| 836 |
+
readBigUint64LE(offset?: number): bigint;
|
| 837 |
+
/**
|
| 838 |
+
* Reads a signed, big-endian 64-bit integer from `buf` at the specified `offset`.
|
| 839 |
+
*
|
| 840 |
+
* Integers read from a `Buffer` are interpreted as two's complement signed
|
| 841 |
+
* values.
|
| 842 |
+
* @since v12.0.0, v10.20.0
|
| 843 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`.
|
| 844 |
+
*/
|
| 845 |
+
readBigInt64BE(offset?: number): bigint;
|
| 846 |
+
/**
|
| 847 |
+
* Reads a signed, little-endian 64-bit integer from `buf` at the specified`offset`.
|
| 848 |
+
*
|
| 849 |
+
* Integers read from a `Buffer` are interpreted as two's complement signed
|
| 850 |
+
* values.
|
| 851 |
+
* @since v12.0.0, v10.20.0
|
| 852 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`.
|
| 853 |
+
*/
|
| 854 |
+
readBigInt64LE(offset?: number): bigint;
|
| 855 |
+
/**
|
| 856 |
+
* Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as an unsigned, little-endian integer supporting
|
| 857 |
+
* up to 48 bits of accuracy.
|
| 858 |
+
*
|
| 859 |
+
* This function is also available under the `readUintLE` alias.
|
| 860 |
+
*
|
| 861 |
+
* ```js
|
| 862 |
+
* import { Buffer } from 'node:buffer';
|
| 863 |
+
*
|
| 864 |
+
* const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
|
| 865 |
+
*
|
| 866 |
+
* console.log(buf.readUIntLE(0, 6).toString(16));
|
| 867 |
+
* // Prints: ab9078563412
|
| 868 |
+
* ```
|
| 869 |
+
* @since v0.11.15
|
| 870 |
+
* @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`.
|
| 871 |
+
* @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`.
|
| 872 |
+
*/
|
| 873 |
+
readUIntLE(offset: number, byteLength: number): number;
|
| 874 |
+
/**
|
| 875 |
+
* @alias Buffer.readUIntLE
|
| 876 |
+
* @since v14.9.0, v12.19.0
|
| 877 |
+
*/
|
| 878 |
+
readUintLE(offset: number, byteLength: number): number;
|
| 879 |
+
/**
|
| 880 |
+
* Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as an unsigned big-endian integer supporting
|
| 881 |
+
* up to 48 bits of accuracy.
|
| 882 |
+
*
|
| 883 |
+
* This function is also available under the `readUintBE` alias.
|
| 884 |
+
*
|
| 885 |
+
* ```js
|
| 886 |
+
* import { Buffer } from 'node:buffer';
|
| 887 |
+
*
|
| 888 |
+
* const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
|
| 889 |
+
*
|
| 890 |
+
* console.log(buf.readUIntBE(0, 6).toString(16));
|
| 891 |
+
* // Prints: 1234567890ab
|
| 892 |
+
* console.log(buf.readUIntBE(1, 6).toString(16));
|
| 893 |
+
* // Throws ERR_OUT_OF_RANGE.
|
| 894 |
+
* ```
|
| 895 |
+
* @since v0.11.15
|
| 896 |
+
* @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`.
|
| 897 |
+
* @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`.
|
| 898 |
+
*/
|
| 899 |
+
readUIntBE(offset: number, byteLength: number): number;
|
| 900 |
+
/**
|
| 901 |
+
* @alias Buffer.readUIntBE
|
| 902 |
+
* @since v14.9.0, v12.19.0
|
| 903 |
+
*/
|
| 904 |
+
readUintBE(offset: number, byteLength: number): number;
|
| 905 |
+
/**
|
| 906 |
+
* Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as a little-endian, two's complement signed value
|
| 907 |
+
* supporting up to 48 bits of accuracy.
|
| 908 |
+
*
|
| 909 |
+
* ```js
|
| 910 |
+
* import { Buffer } from 'node:buffer';
|
| 911 |
+
*
|
| 912 |
+
* const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
|
| 913 |
+
*
|
| 914 |
+
* console.log(buf.readIntLE(0, 6).toString(16));
|
| 915 |
+
* // Prints: -546f87a9cbee
|
| 916 |
+
* ```
|
| 917 |
+
* @since v0.11.15
|
| 918 |
+
* @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`.
|
| 919 |
+
* @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`.
|
| 920 |
+
*/
|
| 921 |
+
readIntLE(offset: number, byteLength: number): number;
|
| 922 |
+
/**
|
| 923 |
+
* Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as a big-endian, two's complement signed value
|
| 924 |
+
* supporting up to 48 bits of accuracy.
|
| 925 |
+
*
|
| 926 |
+
* ```js
|
| 927 |
+
* import { Buffer } from 'node:buffer';
|
| 928 |
+
*
|
| 929 |
+
* const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
|
| 930 |
+
*
|
| 931 |
+
* console.log(buf.readIntBE(0, 6).toString(16));
|
| 932 |
+
* // Prints: 1234567890ab
|
| 933 |
+
* console.log(buf.readIntBE(1, 6).toString(16));
|
| 934 |
+
* // Throws ERR_OUT_OF_RANGE.
|
| 935 |
+
* console.log(buf.readIntBE(1, 0).toString(16));
|
| 936 |
+
* // Throws ERR_OUT_OF_RANGE.
|
| 937 |
+
* ```
|
| 938 |
+
* @since v0.11.15
|
| 939 |
+
* @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`.
|
| 940 |
+
* @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`.
|
| 941 |
+
*/
|
| 942 |
+
readIntBE(offset: number, byteLength: number): number;
|
| 943 |
+
/**
|
| 944 |
+
* Reads an unsigned 8-bit integer from `buf` at the specified `offset`.
|
| 945 |
+
*
|
| 946 |
+
* This function is also available under the `readUint8` alias.
|
| 947 |
+
*
|
| 948 |
+
* ```js
|
| 949 |
+
* import { Buffer } from 'node:buffer';
|
| 950 |
+
*
|
| 951 |
+
* const buf = Buffer.from([1, -2]);
|
| 952 |
+
*
|
| 953 |
+
* console.log(buf.readUInt8(0));
|
| 954 |
+
* // Prints: 1
|
| 955 |
+
* console.log(buf.readUInt8(1));
|
| 956 |
+
* // Prints: 254
|
| 957 |
+
* console.log(buf.readUInt8(2));
|
| 958 |
+
* // Throws ERR_OUT_OF_RANGE.
|
| 959 |
+
* ```
|
| 960 |
+
* @since v0.5.0
|
| 961 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`.
|
| 962 |
+
*/
|
| 963 |
+
readUInt8(offset?: number): number;
|
| 964 |
+
/**
|
| 965 |
+
* @alias Buffer.readUInt8
|
| 966 |
+
* @since v14.9.0, v12.19.0
|
| 967 |
+
*/
|
| 968 |
+
readUint8(offset?: number): number;
|
| 969 |
+
/**
|
| 970 |
+
* Reads an unsigned, little-endian 16-bit integer from `buf` at the specified `offset`.
|
| 971 |
+
*
|
| 972 |
+
* This function is also available under the `readUint16LE` alias.
|
| 973 |
+
*
|
| 974 |
+
* ```js
|
| 975 |
+
* import { Buffer } from 'node:buffer';
|
| 976 |
+
*
|
| 977 |
+
* const buf = Buffer.from([0x12, 0x34, 0x56]);
|
| 978 |
+
*
|
| 979 |
+
* console.log(buf.readUInt16LE(0).toString(16));
|
| 980 |
+
* // Prints: 3412
|
| 981 |
+
* console.log(buf.readUInt16LE(1).toString(16));
|
| 982 |
+
* // Prints: 5634
|
| 983 |
+
* console.log(buf.readUInt16LE(2).toString(16));
|
| 984 |
+
* // Throws ERR_OUT_OF_RANGE.
|
| 985 |
+
* ```
|
| 986 |
+
* @since v0.5.5
|
| 987 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`.
|
| 988 |
+
*/
|
| 989 |
+
readUInt16LE(offset?: number): number;
|
| 990 |
+
/**
|
| 991 |
+
* @alias Buffer.readUInt16LE
|
| 992 |
+
* @since v14.9.0, v12.19.0
|
| 993 |
+
*/
|
| 994 |
+
readUint16LE(offset?: number): number;
|
| 995 |
+
/**
|
| 996 |
+
* Reads an unsigned, big-endian 16-bit integer from `buf` at the specified`offset`.
|
| 997 |
+
*
|
| 998 |
+
* This function is also available under the `readUint16BE` alias.
|
| 999 |
+
*
|
| 1000 |
+
* ```js
|
| 1001 |
+
* import { Buffer } from 'node:buffer';
|
| 1002 |
+
*
|
| 1003 |
+
* const buf = Buffer.from([0x12, 0x34, 0x56]);
|
| 1004 |
+
*
|
| 1005 |
+
* console.log(buf.readUInt16BE(0).toString(16));
|
| 1006 |
+
* // Prints: 1234
|
| 1007 |
+
* console.log(buf.readUInt16BE(1).toString(16));
|
| 1008 |
+
* // Prints: 3456
|
| 1009 |
+
* ```
|
| 1010 |
+
* @since v0.5.5
|
| 1011 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`.
|
| 1012 |
+
*/
|
| 1013 |
+
readUInt16BE(offset?: number): number;
|
| 1014 |
+
/**
|
| 1015 |
+
* @alias Buffer.readUInt16BE
|
| 1016 |
+
* @since v14.9.0, v12.19.0
|
| 1017 |
+
*/
|
| 1018 |
+
readUint16BE(offset?: number): number;
|
| 1019 |
+
/**
|
| 1020 |
+
* Reads an unsigned, little-endian 32-bit integer from `buf` at the specified`offset`.
|
| 1021 |
+
*
|
| 1022 |
+
* This function is also available under the `readUint32LE` alias.
|
| 1023 |
+
*
|
| 1024 |
+
* ```js
|
| 1025 |
+
* import { Buffer } from 'node:buffer';
|
| 1026 |
+
*
|
| 1027 |
+
* const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);
|
| 1028 |
+
*
|
| 1029 |
+
* console.log(buf.readUInt32LE(0).toString(16));
|
| 1030 |
+
* // Prints: 78563412
|
| 1031 |
+
* console.log(buf.readUInt32LE(1).toString(16));
|
| 1032 |
+
* // Throws ERR_OUT_OF_RANGE.
|
| 1033 |
+
* ```
|
| 1034 |
+
* @since v0.5.5
|
| 1035 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
|
| 1036 |
+
*/
|
| 1037 |
+
readUInt32LE(offset?: number): number;
|
| 1038 |
+
/**
|
| 1039 |
+
* @alias Buffer.readUInt32LE
|
| 1040 |
+
* @since v14.9.0, v12.19.0
|
| 1041 |
+
*/
|
| 1042 |
+
readUint32LE(offset?: number): number;
|
| 1043 |
+
/**
|
| 1044 |
+
* Reads an unsigned, big-endian 32-bit integer from `buf` at the specified`offset`.
|
| 1045 |
+
*
|
| 1046 |
+
* This function is also available under the `readUint32BE` alias.
|
| 1047 |
+
*
|
| 1048 |
+
* ```js
|
| 1049 |
+
* import { Buffer } from 'node:buffer';
|
| 1050 |
+
*
|
| 1051 |
+
* const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);
|
| 1052 |
+
*
|
| 1053 |
+
* console.log(buf.readUInt32BE(0).toString(16));
|
| 1054 |
+
* // Prints: 12345678
|
| 1055 |
+
* ```
|
| 1056 |
+
* @since v0.5.5
|
| 1057 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
|
| 1058 |
+
*/
|
| 1059 |
+
readUInt32BE(offset?: number): number;
|
| 1060 |
+
/**
|
| 1061 |
+
* @alias Buffer.readUInt32BE
|
| 1062 |
+
* @since v14.9.0, v12.19.0
|
| 1063 |
+
*/
|
| 1064 |
+
readUint32BE(offset?: number): number;
|
| 1065 |
+
/**
|
| 1066 |
+
* Reads a signed 8-bit integer from `buf` at the specified `offset`.
|
| 1067 |
+
*
|
| 1068 |
+
* Integers read from a `Buffer` are interpreted as two's complement signed values.
|
| 1069 |
+
*
|
| 1070 |
+
* ```js
|
| 1071 |
+
* import { Buffer } from 'node:buffer';
|
| 1072 |
+
*
|
| 1073 |
+
* const buf = Buffer.from([-1, 5]);
|
| 1074 |
+
*
|
| 1075 |
+
* console.log(buf.readInt8(0));
|
| 1076 |
+
* // Prints: -1
|
| 1077 |
+
* console.log(buf.readInt8(1));
|
| 1078 |
+
* // Prints: 5
|
| 1079 |
+
* console.log(buf.readInt8(2));
|
| 1080 |
+
* // Throws ERR_OUT_OF_RANGE.
|
| 1081 |
+
* ```
|
| 1082 |
+
* @since v0.5.0
|
| 1083 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`.
|
| 1084 |
+
*/
|
| 1085 |
+
readInt8(offset?: number): number;
|
| 1086 |
+
/**
|
| 1087 |
+
* Reads a signed, little-endian 16-bit integer from `buf` at the specified`offset`.
|
| 1088 |
+
*
|
| 1089 |
+
* Integers read from a `Buffer` are interpreted as two's complement signed values.
|
| 1090 |
+
*
|
| 1091 |
+
* ```js
|
| 1092 |
+
* import { Buffer } from 'node:buffer';
|
| 1093 |
+
*
|
| 1094 |
+
* const buf = Buffer.from([0, 5]);
|
| 1095 |
+
*
|
| 1096 |
+
* console.log(buf.readInt16LE(0));
|
| 1097 |
+
* // Prints: 1280
|
| 1098 |
+
* console.log(buf.readInt16LE(1));
|
| 1099 |
+
* // Throws ERR_OUT_OF_RANGE.
|
| 1100 |
+
* ```
|
| 1101 |
+
* @since v0.5.5
|
| 1102 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`.
|
| 1103 |
+
*/
|
| 1104 |
+
readInt16LE(offset?: number): number;
|
| 1105 |
+
/**
|
| 1106 |
+
* Reads a signed, big-endian 16-bit integer from `buf` at the specified `offset`.
|
| 1107 |
+
*
|
| 1108 |
+
* Integers read from a `Buffer` are interpreted as two's complement signed values.
|
| 1109 |
+
*
|
| 1110 |
+
* ```js
|
| 1111 |
+
* import { Buffer } from 'node:buffer';
|
| 1112 |
+
*
|
| 1113 |
+
* const buf = Buffer.from([0, 5]);
|
| 1114 |
+
*
|
| 1115 |
+
* console.log(buf.readInt16BE(0));
|
| 1116 |
+
* // Prints: 5
|
| 1117 |
+
* ```
|
| 1118 |
+
* @since v0.5.5
|
| 1119 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`.
|
| 1120 |
+
*/
|
| 1121 |
+
readInt16BE(offset?: number): number;
|
| 1122 |
+
/**
|
| 1123 |
+
* Reads a signed, little-endian 32-bit integer from `buf` at the specified`offset`.
|
| 1124 |
+
*
|
| 1125 |
+
* Integers read from a `Buffer` are interpreted as two's complement signed values.
|
| 1126 |
+
*
|
| 1127 |
+
* ```js
|
| 1128 |
+
* import { Buffer } from 'node:buffer';
|
| 1129 |
+
*
|
| 1130 |
+
* const buf = Buffer.from([0, 0, 0, 5]);
|
| 1131 |
+
*
|
| 1132 |
+
* console.log(buf.readInt32LE(0));
|
| 1133 |
+
* // Prints: 83886080
|
| 1134 |
+
* console.log(buf.readInt32LE(1));
|
| 1135 |
+
* // Throws ERR_OUT_OF_RANGE.
|
| 1136 |
+
* ```
|
| 1137 |
+
* @since v0.5.5
|
| 1138 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
|
| 1139 |
+
*/
|
| 1140 |
+
readInt32LE(offset?: number): number;
|
| 1141 |
+
/**
|
| 1142 |
+
* Reads a signed, big-endian 32-bit integer from `buf` at the specified `offset`.
|
| 1143 |
+
*
|
| 1144 |
+
* Integers read from a `Buffer` are interpreted as two's complement signed values.
|
| 1145 |
+
*
|
| 1146 |
+
* ```js
|
| 1147 |
+
* import { Buffer } from 'node:buffer';
|
| 1148 |
+
*
|
| 1149 |
+
* const buf = Buffer.from([0, 0, 0, 5]);
|
| 1150 |
+
*
|
| 1151 |
+
* console.log(buf.readInt32BE(0));
|
| 1152 |
+
* // Prints: 5
|
| 1153 |
+
* ```
|
| 1154 |
+
* @since v0.5.5
|
| 1155 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
|
| 1156 |
+
*/
|
| 1157 |
+
readInt32BE(offset?: number): number;
|
| 1158 |
+
/**
|
| 1159 |
+
* Reads a 32-bit, little-endian float from `buf` at the specified `offset`.
|
| 1160 |
+
*
|
| 1161 |
+
* ```js
|
| 1162 |
+
* import { Buffer } from 'node:buffer';
|
| 1163 |
+
*
|
| 1164 |
+
* const buf = Buffer.from([1, 2, 3, 4]);
|
| 1165 |
+
*
|
| 1166 |
+
* console.log(buf.readFloatLE(0));
|
| 1167 |
+
* // Prints: 1.539989614439558e-36
|
| 1168 |
+
* console.log(buf.readFloatLE(1));
|
| 1169 |
+
* // Throws ERR_OUT_OF_RANGE.
|
| 1170 |
+
* ```
|
| 1171 |
+
* @since v0.11.15
|
| 1172 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
|
| 1173 |
+
*/
|
| 1174 |
+
readFloatLE(offset?: number): number;
|
| 1175 |
+
/**
|
| 1176 |
+
* Reads a 32-bit, big-endian float from `buf` at the specified `offset`.
|
| 1177 |
+
*
|
| 1178 |
+
* ```js
|
| 1179 |
+
* import { Buffer } from 'node:buffer';
|
| 1180 |
+
*
|
| 1181 |
+
* const buf = Buffer.from([1, 2, 3, 4]);
|
| 1182 |
+
*
|
| 1183 |
+
* console.log(buf.readFloatBE(0));
|
| 1184 |
+
* // Prints: 2.387939260590663e-38
|
| 1185 |
+
* ```
|
| 1186 |
+
* @since v0.11.15
|
| 1187 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`.
|
| 1188 |
+
*/
|
| 1189 |
+
readFloatBE(offset?: number): number;
|
| 1190 |
+
/**
|
| 1191 |
+
* Reads a 64-bit, little-endian double from `buf` at the specified `offset`.
|
| 1192 |
+
*
|
| 1193 |
+
* ```js
|
| 1194 |
+
* import { Buffer } from 'node:buffer';
|
| 1195 |
+
*
|
| 1196 |
+
* const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
|
| 1197 |
+
*
|
| 1198 |
+
* console.log(buf.readDoubleLE(0));
|
| 1199 |
+
* // Prints: 5.447603722011605e-270
|
| 1200 |
+
* console.log(buf.readDoubleLE(1));
|
| 1201 |
+
* // Throws ERR_OUT_OF_RANGE.
|
| 1202 |
+
* ```
|
| 1203 |
+
* @since v0.11.15
|
| 1204 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`.
|
| 1205 |
+
*/
|
| 1206 |
+
readDoubleLE(offset?: number): number;
|
| 1207 |
+
/**
|
| 1208 |
+
* Reads a 64-bit, big-endian double from `buf` at the specified `offset`.
|
| 1209 |
+
*
|
| 1210 |
+
* ```js
|
| 1211 |
+
* import { Buffer } from 'node:buffer';
|
| 1212 |
+
*
|
| 1213 |
+
* const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
|
| 1214 |
+
*
|
| 1215 |
+
* console.log(buf.readDoubleBE(0));
|
| 1216 |
+
* // Prints: 8.20788039913184e-304
|
| 1217 |
+
* ```
|
| 1218 |
+
* @since v0.11.15
|
| 1219 |
+
* @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`.
|
| 1220 |
+
*/
|
| 1221 |
+
readDoubleBE(offset?: number): number;
|
| 1222 |
+
reverse(): this;
|
| 1223 |
+
/**
|
| 1224 |
+
* Interprets `buf` as an array of unsigned 16-bit integers and swaps the
|
| 1225 |
+
* byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 2.
|
| 1226 |
+
*
|
| 1227 |
+
* ```js
|
| 1228 |
+
* import { Buffer } from 'node:buffer';
|
| 1229 |
+
*
|
| 1230 |
+
* const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
|
| 1231 |
+
*
|
| 1232 |
+
* console.log(buf1);
|
| 1233 |
+
* // Prints: <Buffer 01 02 03 04 05 06 07 08>
|
| 1234 |
+
*
|
| 1235 |
+
* buf1.swap16();
|
| 1236 |
+
*
|
| 1237 |
+
* console.log(buf1);
|
| 1238 |
+
* // Prints: <Buffer 02 01 04 03 06 05 08 07>
|
| 1239 |
+
*
|
| 1240 |
+
* const buf2 = Buffer.from([0x1, 0x2, 0x3]);
|
| 1241 |
+
*
|
| 1242 |
+
* buf2.swap16();
|
| 1243 |
+
* // Throws ERR_INVALID_BUFFER_SIZE.
|
| 1244 |
+
* ```
|
| 1245 |
+
*
|
| 1246 |
+
* One convenient use of `buf.swap16()` is to perform a fast in-place conversion
|
| 1247 |
+
* between UTF-16 little-endian and UTF-16 big-endian:
|
| 1248 |
+
*
|
| 1249 |
+
* ```js
|
| 1250 |
+
* import { Buffer } from 'node:buffer';
|
| 1251 |
+
*
|
| 1252 |
+
* const buf = Buffer.from('This is little-endian UTF-16', 'utf16le');
|
| 1253 |
+
* buf.swap16(); // Convert to big-endian UTF-16 text.
|
| 1254 |
+
* ```
|
| 1255 |
+
* @since v5.10.0
|
| 1256 |
+
* @return A reference to `buf`.
|
| 1257 |
+
*/
|
| 1258 |
+
swap16(): this;
|
| 1259 |
+
/**
|
| 1260 |
+
* Interprets `buf` as an array of unsigned 32-bit integers and swaps the
|
| 1261 |
+
* byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4.
|
| 1262 |
+
*
|
| 1263 |
+
* ```js
|
| 1264 |
+
* import { Buffer } from 'node:buffer';
|
| 1265 |
+
*
|
| 1266 |
+
* const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
|
| 1267 |
+
*
|
| 1268 |
+
* console.log(buf1);
|
| 1269 |
+
* // Prints: <Buffer 01 02 03 04 05 06 07 08>
|
| 1270 |
+
*
|
| 1271 |
+
* buf1.swap32();
|
| 1272 |
+
*
|
| 1273 |
+
* console.log(buf1);
|
| 1274 |
+
* // Prints: <Buffer 04 03 02 01 08 07 06 05>
|
| 1275 |
+
*
|
| 1276 |
+
* const buf2 = Buffer.from([0x1, 0x2, 0x3]);
|
| 1277 |
+
*
|
| 1278 |
+
* buf2.swap32();
|
| 1279 |
+
* // Throws ERR_INVALID_BUFFER_SIZE.
|
| 1280 |
+
* ```
|
| 1281 |
+
* @since v5.10.0
|
| 1282 |
+
* @return A reference to `buf`.
|
| 1283 |
+
*/
|
| 1284 |
+
swap32(): this;
|
| 1285 |
+
/**
|
| 1286 |
+
* Interprets `buf` as an array of 64-bit numbers and swaps byte order _in-place_.
|
| 1287 |
+
* Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8.
|
| 1288 |
+
*
|
| 1289 |
+
* ```js
|
| 1290 |
+
* import { Buffer } from 'node:buffer';
|
| 1291 |
+
*
|
| 1292 |
+
* const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
|
| 1293 |
+
*
|
| 1294 |
+
* console.log(buf1);
|
| 1295 |
+
* // Prints: <Buffer 01 02 03 04 05 06 07 08>
|
| 1296 |
+
*
|
| 1297 |
+
* buf1.swap64();
|
| 1298 |
+
*
|
| 1299 |
+
* console.log(buf1);
|
| 1300 |
+
* // Prints: <Buffer 08 07 06 05 04 03 02 01>
|
| 1301 |
+
*
|
| 1302 |
+
* const buf2 = Buffer.from([0x1, 0x2, 0x3]);
|
| 1303 |
+
*
|
| 1304 |
+
* buf2.swap64();
|
| 1305 |
+
* // Throws ERR_INVALID_BUFFER_SIZE.
|
| 1306 |
+
* ```
|
| 1307 |
+
* @since v6.3.0
|
| 1308 |
+
* @return A reference to `buf`.
|
| 1309 |
+
*/
|
| 1310 |
+
swap64(): this;
|
| 1311 |
+
/**
|
| 1312 |
+
* Writes `value` to `buf` at the specified `offset`. `value` must be a
|
| 1313 |
+
* valid unsigned 8-bit integer. Behavior is undefined when `value` is anything
|
| 1314 |
+
* other than an unsigned 8-bit integer.
|
| 1315 |
+
*
|
| 1316 |
+
* This function is also available under the `writeUint8` alias.
|
| 1317 |
+
*
|
| 1318 |
+
* ```js
|
| 1319 |
+
* import { Buffer } from 'node:buffer';
|
| 1320 |
+
*
|
| 1321 |
+
* const buf = Buffer.allocUnsafe(4);
|
| 1322 |
+
*
|
| 1323 |
+
* buf.writeUInt8(0x3, 0);
|
| 1324 |
+
* buf.writeUInt8(0x4, 1);
|
| 1325 |
+
* buf.writeUInt8(0x23, 2);
|
| 1326 |
+
* buf.writeUInt8(0x42, 3);
|
| 1327 |
+
*
|
| 1328 |
+
* console.log(buf);
|
| 1329 |
+
* // Prints: <Buffer 03 04 23 42>
|
| 1330 |
+
* ```
|
| 1331 |
+
* @since v0.5.0
|
| 1332 |
+
* @param value Number to be written to `buf`.
|
| 1333 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`.
|
| 1334 |
+
* @return `offset` plus the number of bytes written.
|
| 1335 |
+
*/
|
| 1336 |
+
writeUInt8(value: number, offset?: number): number;
|
| 1337 |
+
/**
|
| 1338 |
+
* @alias Buffer.writeUInt8
|
| 1339 |
+
* @since v14.9.0, v12.19.0
|
| 1340 |
+
*/
|
| 1341 |
+
writeUint8(value: number, offset?: number): number;
|
| 1342 |
+
/**
|
| 1343 |
+
* Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid unsigned 16-bit integer. Behavior is undefined when `value` is
|
| 1344 |
+
* anything other than an unsigned 16-bit integer.
|
| 1345 |
+
*
|
| 1346 |
+
* This function is also available under the `writeUint16LE` alias.
|
| 1347 |
+
*
|
| 1348 |
+
* ```js
|
| 1349 |
+
* import { Buffer } from 'node:buffer';
|
| 1350 |
+
*
|
| 1351 |
+
* const buf = Buffer.allocUnsafe(4);
|
| 1352 |
+
*
|
| 1353 |
+
* buf.writeUInt16LE(0xdead, 0);
|
| 1354 |
+
* buf.writeUInt16LE(0xbeef, 2);
|
| 1355 |
+
*
|
| 1356 |
+
* console.log(buf);
|
| 1357 |
+
* // Prints: <Buffer ad de ef be>
|
| 1358 |
+
* ```
|
| 1359 |
+
* @since v0.5.5
|
| 1360 |
+
* @param value Number to be written to `buf`.
|
| 1361 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`.
|
| 1362 |
+
* @return `offset` plus the number of bytes written.
|
| 1363 |
+
*/
|
| 1364 |
+
writeUInt16LE(value: number, offset?: number): number;
|
| 1365 |
+
/**
|
| 1366 |
+
* @alias Buffer.writeUInt16LE
|
| 1367 |
+
* @since v14.9.0, v12.19.0
|
| 1368 |
+
*/
|
| 1369 |
+
writeUint16LE(value: number, offset?: number): number;
|
| 1370 |
+
/**
|
| 1371 |
+
* Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid unsigned 16-bit integer. Behavior is undefined when `value`is anything other than an
|
| 1372 |
+
* unsigned 16-bit integer.
|
| 1373 |
+
*
|
| 1374 |
+
* This function is also available under the `writeUint16BE` alias.
|
| 1375 |
+
*
|
| 1376 |
+
* ```js
|
| 1377 |
+
* import { Buffer } from 'node:buffer';
|
| 1378 |
+
*
|
| 1379 |
+
* const buf = Buffer.allocUnsafe(4);
|
| 1380 |
+
*
|
| 1381 |
+
* buf.writeUInt16BE(0xdead, 0);
|
| 1382 |
+
* buf.writeUInt16BE(0xbeef, 2);
|
| 1383 |
+
*
|
| 1384 |
+
* console.log(buf);
|
| 1385 |
+
* // Prints: <Buffer de ad be ef>
|
| 1386 |
+
* ```
|
| 1387 |
+
* @since v0.5.5
|
| 1388 |
+
* @param value Number to be written to `buf`.
|
| 1389 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`.
|
| 1390 |
+
* @return `offset` plus the number of bytes written.
|
| 1391 |
+
*/
|
| 1392 |
+
writeUInt16BE(value: number, offset?: number): number;
|
| 1393 |
+
/**
|
| 1394 |
+
* @alias Buffer.writeUInt16BE
|
| 1395 |
+
* @since v14.9.0, v12.19.0
|
| 1396 |
+
*/
|
| 1397 |
+
writeUint16BE(value: number, offset?: number): number;
|
| 1398 |
+
/**
|
| 1399 |
+
* Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid unsigned 32-bit integer. Behavior is undefined when `value` is
|
| 1400 |
+
* anything other than an unsigned 32-bit integer.
|
| 1401 |
+
*
|
| 1402 |
+
* This function is also available under the `writeUint32LE` alias.
|
| 1403 |
+
*
|
| 1404 |
+
* ```js
|
| 1405 |
+
* import { Buffer } from 'node:buffer';
|
| 1406 |
+
*
|
| 1407 |
+
* const buf = Buffer.allocUnsafe(4);
|
| 1408 |
+
*
|
| 1409 |
+
* buf.writeUInt32LE(0xfeedface, 0);
|
| 1410 |
+
*
|
| 1411 |
+
* console.log(buf);
|
| 1412 |
+
* // Prints: <Buffer ce fa ed fe>
|
| 1413 |
+
* ```
|
| 1414 |
+
* @since v0.5.5
|
| 1415 |
+
* @param value Number to be written to `buf`.
|
| 1416 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
|
| 1417 |
+
* @return `offset` plus the number of bytes written.
|
| 1418 |
+
*/
|
| 1419 |
+
writeUInt32LE(value: number, offset?: number): number;
|
| 1420 |
+
/**
|
| 1421 |
+
* @alias Buffer.writeUInt32LE
|
| 1422 |
+
* @since v14.9.0, v12.19.0
|
| 1423 |
+
*/
|
| 1424 |
+
writeUint32LE(value: number, offset?: number): number;
|
| 1425 |
+
/**
|
| 1426 |
+
* Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid unsigned 32-bit integer. Behavior is undefined when `value`is anything other than an
|
| 1427 |
+
* unsigned 32-bit integer.
|
| 1428 |
+
*
|
| 1429 |
+
* This function is also available under the `writeUint32BE` alias.
|
| 1430 |
+
*
|
| 1431 |
+
* ```js
|
| 1432 |
+
* import { Buffer } from 'node:buffer';
|
| 1433 |
+
*
|
| 1434 |
+
* const buf = Buffer.allocUnsafe(4);
|
| 1435 |
+
*
|
| 1436 |
+
* buf.writeUInt32BE(0xfeedface, 0);
|
| 1437 |
+
*
|
| 1438 |
+
* console.log(buf);
|
| 1439 |
+
* // Prints: <Buffer fe ed fa ce>
|
| 1440 |
+
* ```
|
| 1441 |
+
* @since v0.5.5
|
| 1442 |
+
* @param value Number to be written to `buf`.
|
| 1443 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
|
| 1444 |
+
* @return `offset` plus the number of bytes written.
|
| 1445 |
+
*/
|
| 1446 |
+
writeUInt32BE(value: number, offset?: number): number;
|
| 1447 |
+
/**
|
| 1448 |
+
* @alias Buffer.writeUInt32BE
|
| 1449 |
+
* @since v14.9.0, v12.19.0
|
| 1450 |
+
*/
|
| 1451 |
+
writeUint32BE(value: number, offset?: number): number;
|
| 1452 |
+
/**
|
| 1453 |
+
* Writes `value` to `buf` at the specified `offset`. `value` must be a valid
|
| 1454 |
+
* signed 8-bit integer. Behavior is undefined when `value` is anything other than
|
| 1455 |
+
* a signed 8-bit integer.
|
| 1456 |
+
*
|
| 1457 |
+
* `value` is interpreted and written as a two's complement signed integer.
|
| 1458 |
+
*
|
| 1459 |
+
* ```js
|
| 1460 |
+
* import { Buffer } from 'node:buffer';
|
| 1461 |
+
*
|
| 1462 |
+
* const buf = Buffer.allocUnsafe(2);
|
| 1463 |
+
*
|
| 1464 |
+
* buf.writeInt8(2, 0);
|
| 1465 |
+
* buf.writeInt8(-2, 1);
|
| 1466 |
+
*
|
| 1467 |
+
* console.log(buf);
|
| 1468 |
+
* // Prints: <Buffer 02 fe>
|
| 1469 |
+
* ```
|
| 1470 |
+
* @since v0.5.0
|
| 1471 |
+
* @param value Number to be written to `buf`.
|
| 1472 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`.
|
| 1473 |
+
* @return `offset` plus the number of bytes written.
|
| 1474 |
+
*/
|
| 1475 |
+
writeInt8(value: number, offset?: number): number;
|
| 1476 |
+
/**
|
| 1477 |
+
* Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid signed 16-bit integer. Behavior is undefined when `value` is
|
| 1478 |
+
* anything other than a signed 16-bit integer.
|
| 1479 |
+
*
|
| 1480 |
+
* The `value` is interpreted and written as a two's complement signed integer.
|
| 1481 |
+
*
|
| 1482 |
+
* ```js
|
| 1483 |
+
* import { Buffer } from 'node:buffer';
|
| 1484 |
+
*
|
| 1485 |
+
* const buf = Buffer.allocUnsafe(2);
|
| 1486 |
+
*
|
| 1487 |
+
* buf.writeInt16LE(0x0304, 0);
|
| 1488 |
+
*
|
| 1489 |
+
* console.log(buf);
|
| 1490 |
+
* // Prints: <Buffer 04 03>
|
| 1491 |
+
* ```
|
| 1492 |
+
* @since v0.5.5
|
| 1493 |
+
* @param value Number to be written to `buf`.
|
| 1494 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`.
|
| 1495 |
+
* @return `offset` plus the number of bytes written.
|
| 1496 |
+
*/
|
| 1497 |
+
writeInt16LE(value: number, offset?: number): number;
|
| 1498 |
+
/**
|
| 1499 |
+
* Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid signed 16-bit integer. Behavior is undefined when `value` is
|
| 1500 |
+
* anything other than a signed 16-bit integer.
|
| 1501 |
+
*
|
| 1502 |
+
* The `value` is interpreted and written as a two's complement signed integer.
|
| 1503 |
+
*
|
| 1504 |
+
* ```js
|
| 1505 |
+
* import { Buffer } from 'node:buffer';
|
| 1506 |
+
*
|
| 1507 |
+
* const buf = Buffer.allocUnsafe(2);
|
| 1508 |
+
*
|
| 1509 |
+
* buf.writeInt16BE(0x0102, 0);
|
| 1510 |
+
*
|
| 1511 |
+
* console.log(buf);
|
| 1512 |
+
* // Prints: <Buffer 01 02>
|
| 1513 |
+
* ```
|
| 1514 |
+
* @since v0.5.5
|
| 1515 |
+
* @param value Number to be written to `buf`.
|
| 1516 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`.
|
| 1517 |
+
* @return `offset` plus the number of bytes written.
|
| 1518 |
+
*/
|
| 1519 |
+
writeInt16BE(value: number, offset?: number): number;
|
| 1520 |
+
/**
|
| 1521 |
+
* Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid signed 32-bit integer. Behavior is undefined when `value` is
|
| 1522 |
+
* anything other than a signed 32-bit integer.
|
| 1523 |
+
*
|
| 1524 |
+
* The `value` is interpreted and written as a two's complement signed integer.
|
| 1525 |
+
*
|
| 1526 |
+
* ```js
|
| 1527 |
+
* import { Buffer } from 'node:buffer';
|
| 1528 |
+
*
|
| 1529 |
+
* const buf = Buffer.allocUnsafe(4);
|
| 1530 |
+
*
|
| 1531 |
+
* buf.writeInt32LE(0x05060708, 0);
|
| 1532 |
+
*
|
| 1533 |
+
* console.log(buf);
|
| 1534 |
+
* // Prints: <Buffer 08 07 06 05>
|
| 1535 |
+
* ```
|
| 1536 |
+
* @since v0.5.5
|
| 1537 |
+
* @param value Number to be written to `buf`.
|
| 1538 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
|
| 1539 |
+
* @return `offset` plus the number of bytes written.
|
| 1540 |
+
*/
|
| 1541 |
+
writeInt32LE(value: number, offset?: number): number;
|
| 1542 |
+
/**
|
| 1543 |
+
* Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid signed 32-bit integer. Behavior is undefined when `value` is
|
| 1544 |
+
* anything other than a signed 32-bit integer.
|
| 1545 |
+
*
|
| 1546 |
+
* The `value` is interpreted and written as a two's complement signed integer.
|
| 1547 |
+
*
|
| 1548 |
+
* ```js
|
| 1549 |
+
* import { Buffer } from 'node:buffer';
|
| 1550 |
+
*
|
| 1551 |
+
* const buf = Buffer.allocUnsafe(4);
|
| 1552 |
+
*
|
| 1553 |
+
* buf.writeInt32BE(0x01020304, 0);
|
| 1554 |
+
*
|
| 1555 |
+
* console.log(buf);
|
| 1556 |
+
* // Prints: <Buffer 01 02 03 04>
|
| 1557 |
+
* ```
|
| 1558 |
+
* @since v0.5.5
|
| 1559 |
+
* @param value Number to be written to `buf`.
|
| 1560 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
|
| 1561 |
+
* @return `offset` plus the number of bytes written.
|
| 1562 |
+
*/
|
| 1563 |
+
writeInt32BE(value: number, offset?: number): number;
|
| 1564 |
+
/**
|
| 1565 |
+
* Writes `value` to `buf` at the specified `offset` as little-endian. Behavior is
|
| 1566 |
+
* undefined when `value` is anything other than a JavaScript number.
|
| 1567 |
+
*
|
| 1568 |
+
* ```js
|
| 1569 |
+
* import { Buffer } from 'node:buffer';
|
| 1570 |
+
*
|
| 1571 |
+
* const buf = Buffer.allocUnsafe(4);
|
| 1572 |
+
*
|
| 1573 |
+
* buf.writeFloatLE(0xcafebabe, 0);
|
| 1574 |
+
*
|
| 1575 |
+
* console.log(buf);
|
| 1576 |
+
* // Prints: <Buffer bb fe 4a 4f>
|
| 1577 |
+
* ```
|
| 1578 |
+
* @since v0.11.15
|
| 1579 |
+
* @param value Number to be written to `buf`.
|
| 1580 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
|
| 1581 |
+
* @return `offset` plus the number of bytes written.
|
| 1582 |
+
*/
|
| 1583 |
+
writeFloatLE(value: number, offset?: number): number;
|
| 1584 |
+
/**
|
| 1585 |
+
* Writes `value` to `buf` at the specified `offset` as big-endian. Behavior is
|
| 1586 |
+
* undefined when `value` is anything other than a JavaScript number.
|
| 1587 |
+
*
|
| 1588 |
+
* ```js
|
| 1589 |
+
* import { Buffer } from 'node:buffer';
|
| 1590 |
+
*
|
| 1591 |
+
* const buf = Buffer.allocUnsafe(4);
|
| 1592 |
+
*
|
| 1593 |
+
* buf.writeFloatBE(0xcafebabe, 0);
|
| 1594 |
+
*
|
| 1595 |
+
* console.log(buf);
|
| 1596 |
+
* // Prints: <Buffer 4f 4a fe bb>
|
| 1597 |
+
* ```
|
| 1598 |
+
* @since v0.11.15
|
| 1599 |
+
* @param value Number to be written to `buf`.
|
| 1600 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`.
|
| 1601 |
+
* @return `offset` plus the number of bytes written.
|
| 1602 |
+
*/
|
| 1603 |
+
writeFloatBE(value: number, offset?: number): number;
|
| 1604 |
+
/**
|
| 1605 |
+
* Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a JavaScript number. Behavior is undefined when `value` is anything
|
| 1606 |
+
* other than a JavaScript number.
|
| 1607 |
+
*
|
| 1608 |
+
* ```js
|
| 1609 |
+
* import { Buffer } from 'node:buffer';
|
| 1610 |
+
*
|
| 1611 |
+
* const buf = Buffer.allocUnsafe(8);
|
| 1612 |
+
*
|
| 1613 |
+
* buf.writeDoubleLE(123.456, 0);
|
| 1614 |
+
*
|
| 1615 |
+
* console.log(buf);
|
| 1616 |
+
* // Prints: <Buffer 77 be 9f 1a 2f dd 5e 40>
|
| 1617 |
+
* ```
|
| 1618 |
+
* @since v0.11.15
|
| 1619 |
+
* @param value Number to be written to `buf`.
|
| 1620 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`.
|
| 1621 |
+
* @return `offset` plus the number of bytes written.
|
| 1622 |
+
*/
|
| 1623 |
+
writeDoubleLE(value: number, offset?: number): number;
|
| 1624 |
+
/**
|
| 1625 |
+
* Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a JavaScript number. Behavior is undefined when `value` is anything
|
| 1626 |
+
* other than a JavaScript number.
|
| 1627 |
+
*
|
| 1628 |
+
* ```js
|
| 1629 |
+
* import { Buffer } from 'node:buffer';
|
| 1630 |
+
*
|
| 1631 |
+
* const buf = Buffer.allocUnsafe(8);
|
| 1632 |
+
*
|
| 1633 |
+
* buf.writeDoubleBE(123.456, 0);
|
| 1634 |
+
*
|
| 1635 |
+
* console.log(buf);
|
| 1636 |
+
* // Prints: <Buffer 40 5e dd 2f 1a 9f be 77>
|
| 1637 |
+
* ```
|
| 1638 |
+
* @since v0.11.15
|
| 1639 |
+
* @param value Number to be written to `buf`.
|
| 1640 |
+
* @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`.
|
| 1641 |
+
* @return `offset` plus the number of bytes written.
|
| 1642 |
+
*/
|
| 1643 |
+
writeDoubleBE(value: number, offset?: number): number;
|
| 1644 |
+
/**
|
| 1645 |
+
* Fills `buf` with the specified `value`. If the `offset` and `end` are not given,
|
| 1646 |
+
* the entire `buf` will be filled:
|
| 1647 |
+
*
|
| 1648 |
+
* ```js
|
| 1649 |
+
* import { Buffer } from 'node:buffer';
|
| 1650 |
+
*
|
| 1651 |
+
* // Fill a `Buffer` with the ASCII character 'h'.
|
| 1652 |
+
*
|
| 1653 |
+
* const b = Buffer.allocUnsafe(50).fill('h');
|
| 1654 |
+
*
|
| 1655 |
+
* console.log(b.toString());
|
| 1656 |
+
* // Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
| 1657 |
+
*
|
| 1658 |
+
* // Fill a buffer with empty string
|
| 1659 |
+
* const c = Buffer.allocUnsafe(5).fill('');
|
| 1660 |
+
*
|
| 1661 |
+
* console.log(c.fill(''));
|
| 1662 |
+
* // Prints: <Buffer 00 00 00 00 00>
|
| 1663 |
+
* ```
|
| 1664 |
+
*
|
| 1665 |
+
* `value` is coerced to a `uint32` value if it is not a string, `Buffer`, or
|
| 1666 |
+
* integer. If the resulting integer is greater than `255` (decimal), `buf` will be
|
| 1667 |
+
* filled with `value & 255`.
|
| 1668 |
+
*
|
| 1669 |
+
* If the final write of a `fill()` operation falls on a multi-byte character,
|
| 1670 |
+
* then only the bytes of that character that fit into `buf` are written:
|
| 1671 |
+
*
|
| 1672 |
+
* ```js
|
| 1673 |
+
* import { Buffer } from 'node:buffer';
|
| 1674 |
+
*
|
| 1675 |
+
* // Fill a `Buffer` with character that takes up two bytes in UTF-8.
|
| 1676 |
+
*
|
| 1677 |
+
* console.log(Buffer.allocUnsafe(5).fill('\u0222'));
|
| 1678 |
+
* // Prints: <Buffer c8 a2 c8 a2 c8>
|
| 1679 |
+
* ```
|
| 1680 |
+
*
|
| 1681 |
+
* If `value` contains invalid characters, it is truncated; if no valid
|
| 1682 |
+
* fill data remains, an exception is thrown:
|
| 1683 |
+
*
|
| 1684 |
+
* ```js
|
| 1685 |
+
* import { Buffer } from 'node:buffer';
|
| 1686 |
+
*
|
| 1687 |
+
* const buf = Buffer.allocUnsafe(5);
|
| 1688 |
+
*
|
| 1689 |
+
* console.log(buf.fill('a'));
|
| 1690 |
+
* // Prints: <Buffer 61 61 61 61 61>
|
| 1691 |
+
* console.log(buf.fill('aazz', 'hex'));
|
| 1692 |
+
* // Prints: <Buffer aa aa aa aa aa>
|
| 1693 |
+
* console.log(buf.fill('zz', 'hex'));
|
| 1694 |
+
* // Throws an exception.
|
| 1695 |
+
* ```
|
| 1696 |
+
* @since v0.5.0
|
| 1697 |
+
* @param value The value with which to fill `buf`. Empty value (string, Uint8Array, Buffer) is coerced to `0`.
|
| 1698 |
+
* @param [offset=0] Number of bytes to skip before starting to fill `buf`.
|
| 1699 |
+
* @param [end=buf.length] Where to stop filling `buf` (not inclusive).
|
| 1700 |
+
* @param [encoding='utf8'] The encoding for `value` if `value` is a string.
|
| 1701 |
+
* @return A reference to `buf`.
|
| 1702 |
+
*/
|
| 1703 |
+
fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
|
| 1704 |
+
fill(value: string | Uint8Array | number, offset: number, encoding: BufferEncoding): this;
|
| 1705 |
+
fill(value: string | Uint8Array | number, encoding: BufferEncoding): this;
|
| 1706 |
+
/**
|
| 1707 |
+
* If `value` is:
|
| 1708 |
+
*
|
| 1709 |
+
* * a string, `value` is interpreted according to the character encoding in `encoding`.
|
| 1710 |
+
* * a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety.
|
| 1711 |
+
* To compare a partial `Buffer`, use `buf.subarray`.
|
| 1712 |
+
* * a number, `value` will be interpreted as an unsigned 8-bit integer
|
| 1713 |
+
* value between `0` and `255`.
|
| 1714 |
+
*
|
| 1715 |
+
* ```js
|
| 1716 |
+
* import { Buffer } from 'node:buffer';
|
| 1717 |
+
*
|
| 1718 |
+
* const buf = Buffer.from('this is a buffer');
|
| 1719 |
+
*
|
| 1720 |
+
* console.log(buf.indexOf('this'));
|
| 1721 |
+
* // Prints: 0
|
| 1722 |
+
* console.log(buf.indexOf('is'));
|
| 1723 |
+
* // Prints: 2
|
| 1724 |
+
* console.log(buf.indexOf(Buffer.from('a buffer')));
|
| 1725 |
+
* // Prints: 8
|
| 1726 |
+
* console.log(buf.indexOf(97));
|
| 1727 |
+
* // Prints: 8 (97 is the decimal ASCII value for 'a')
|
| 1728 |
+
* console.log(buf.indexOf(Buffer.from('a buffer example')));
|
| 1729 |
+
* // Prints: -1
|
| 1730 |
+
* console.log(buf.indexOf(Buffer.from('a buffer example').slice(0, 8)));
|
| 1731 |
+
* // Prints: 8
|
| 1732 |
+
*
|
| 1733 |
+
* const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le');
|
| 1734 |
+
*
|
| 1735 |
+
* console.log(utf16Buffer.indexOf('\u03a3', 0, 'utf16le'));
|
| 1736 |
+
* // Prints: 4
|
| 1737 |
+
* console.log(utf16Buffer.indexOf('\u03a3', -4, 'utf16le'));
|
| 1738 |
+
* // Prints: 6
|
| 1739 |
+
* ```
|
| 1740 |
+
*
|
| 1741 |
+
* If `value` is not a string, number, or `Buffer`, this method will throw a `TypeError`. If `value` is a number, it will be coerced to a valid byte value,
|
| 1742 |
+
* an integer between 0 and 255.
|
| 1743 |
+
*
|
| 1744 |
+
* If `byteOffset` is not a number, it will be coerced to a number. If the result
|
| 1745 |
+
* of coercion is `NaN` or `0`, then the entire buffer will be searched. This
|
| 1746 |
+
* behavior matches [`String.prototype.indexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf).
|
| 1747 |
+
*
|
| 1748 |
+
* ```js
|
| 1749 |
+
* import { Buffer } from 'node:buffer';
|
| 1750 |
+
*
|
| 1751 |
+
* const b = Buffer.from('abcdef');
|
| 1752 |
+
*
|
| 1753 |
+
* // Passing a value that's a number, but not a valid byte.
|
| 1754 |
+
* // Prints: 2, equivalent to searching for 99 or 'c'.
|
| 1755 |
+
* console.log(b.indexOf(99.9));
|
| 1756 |
+
* console.log(b.indexOf(256 + 99));
|
| 1757 |
+
*
|
| 1758 |
+
* // Passing a byteOffset that coerces to NaN or 0.
|
| 1759 |
+
* // Prints: 1, searching the whole buffer.
|
| 1760 |
+
* console.log(b.indexOf('b', undefined));
|
| 1761 |
+
* console.log(b.indexOf('b', {}));
|
| 1762 |
+
* console.log(b.indexOf('b', null));
|
| 1763 |
+
* console.log(b.indexOf('b', []));
|
| 1764 |
+
* ```
|
| 1765 |
+
*
|
| 1766 |
+
* If `value` is an empty string or empty `Buffer` and `byteOffset` is less
|
| 1767 |
+
* than `buf.length`, `byteOffset` will be returned. If `value` is empty and`byteOffset` is at least `buf.length`, `buf.length` will be returned.
|
| 1768 |
+
* @since v1.5.0
|
| 1769 |
+
* @param value What to search for.
|
| 1770 |
+
* @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`.
|
| 1771 |
+
* @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`.
|
| 1772 |
+
* @return The index of the first occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`.
|
| 1773 |
+
*/
|
| 1774 |
+
indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
| 1775 |
+
indexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number;
|
| 1776 |
+
/**
|
| 1777 |
+
* Identical to `buf.indexOf()`, except the last occurrence of `value` is found
|
| 1778 |
+
* rather than the first occurrence.
|
| 1779 |
+
*
|
| 1780 |
+
* ```js
|
| 1781 |
+
* import { Buffer } from 'node:buffer';
|
| 1782 |
+
*
|
| 1783 |
+
* const buf = Buffer.from('this buffer is a buffer');
|
| 1784 |
+
*
|
| 1785 |
+
* console.log(buf.lastIndexOf('this'));
|
| 1786 |
+
* // Prints: 0
|
| 1787 |
+
* console.log(buf.lastIndexOf('buffer'));
|
| 1788 |
+
* // Prints: 17
|
| 1789 |
+
* console.log(buf.lastIndexOf(Buffer.from('buffer')));
|
| 1790 |
+
* // Prints: 17
|
| 1791 |
+
* console.log(buf.lastIndexOf(97));
|
| 1792 |
+
* // Prints: 15 (97 is the decimal ASCII value for 'a')
|
| 1793 |
+
* console.log(buf.lastIndexOf(Buffer.from('yolo')));
|
| 1794 |
+
* // Prints: -1
|
| 1795 |
+
* console.log(buf.lastIndexOf('buffer', 5));
|
| 1796 |
+
* // Prints: 5
|
| 1797 |
+
* console.log(buf.lastIndexOf('buffer', 4));
|
| 1798 |
+
* // Prints: -1
|
| 1799 |
+
*
|
| 1800 |
+
* const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le');
|
| 1801 |
+
*
|
| 1802 |
+
* console.log(utf16Buffer.lastIndexOf('\u03a3', undefined, 'utf16le'));
|
| 1803 |
+
* // Prints: 6
|
| 1804 |
+
* console.log(utf16Buffer.lastIndexOf('\u03a3', -5, 'utf16le'));
|
| 1805 |
+
* // Prints: 4
|
| 1806 |
+
* ```
|
| 1807 |
+
*
|
| 1808 |
+
* If `value` is not a string, number, or `Buffer`, this method will throw a `TypeError`. If `value` is a number, it will be coerced to a valid byte value,
|
| 1809 |
+
* an integer between 0 and 255.
|
| 1810 |
+
*
|
| 1811 |
+
* If `byteOffset` is not a number, it will be coerced to a number. Any arguments
|
| 1812 |
+
* that coerce to `NaN`, like `{}` or `undefined`, will search the whole buffer.
|
| 1813 |
+
* This behavior matches [`String.prototype.lastIndexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf).
|
| 1814 |
+
*
|
| 1815 |
+
* ```js
|
| 1816 |
+
* import { Buffer } from 'node:buffer';
|
| 1817 |
+
*
|
| 1818 |
+
* const b = Buffer.from('abcdef');
|
| 1819 |
+
*
|
| 1820 |
+
* // Passing a value that's a number, but not a valid byte.
|
| 1821 |
+
* // Prints: 2, equivalent to searching for 99 or 'c'.
|
| 1822 |
+
* console.log(b.lastIndexOf(99.9));
|
| 1823 |
+
* console.log(b.lastIndexOf(256 + 99));
|
| 1824 |
+
*
|
| 1825 |
+
* // Passing a byteOffset that coerces to NaN.
|
| 1826 |
+
* // Prints: 1, searching the whole buffer.
|
| 1827 |
+
* console.log(b.lastIndexOf('b', undefined));
|
| 1828 |
+
* console.log(b.lastIndexOf('b', {}));
|
| 1829 |
+
*
|
| 1830 |
+
* // Passing a byteOffset that coerces to 0.
|
| 1831 |
+
* // Prints: -1, equivalent to passing 0.
|
| 1832 |
+
* console.log(b.lastIndexOf('b', null));
|
| 1833 |
+
* console.log(b.lastIndexOf('b', []));
|
| 1834 |
+
* ```
|
| 1835 |
+
*
|
| 1836 |
+
* If `value` is an empty string or empty `Buffer`, `byteOffset` will be returned.
|
| 1837 |
+
* @since v6.0.0
|
| 1838 |
+
* @param value What to search for.
|
| 1839 |
+
* @param [byteOffset=buf.length - 1] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`.
|
| 1840 |
+
* @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`.
|
| 1841 |
+
* @return The index of the last occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`.
|
| 1842 |
+
*/
|
| 1843 |
+
lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
| 1844 |
+
lastIndexOf(value: string | number | Uint8Array, encoding: BufferEncoding): number;
|
| 1845 |
+
/**
|
| 1846 |
+
* Equivalent to `buf.indexOf() !== -1`.
|
| 1847 |
+
*
|
| 1848 |
+
* ```js
|
| 1849 |
+
* import { Buffer } from 'node:buffer';
|
| 1850 |
+
*
|
| 1851 |
+
* const buf = Buffer.from('this is a buffer');
|
| 1852 |
+
*
|
| 1853 |
+
* console.log(buf.includes('this'));
|
| 1854 |
+
* // Prints: true
|
| 1855 |
+
* console.log(buf.includes('is'));
|
| 1856 |
+
* // Prints: true
|
| 1857 |
+
* console.log(buf.includes(Buffer.from('a buffer')));
|
| 1858 |
+
* // Prints: true
|
| 1859 |
+
* console.log(buf.includes(97));
|
| 1860 |
+
* // Prints: true (97 is the decimal ASCII value for 'a')
|
| 1861 |
+
* console.log(buf.includes(Buffer.from('a buffer example')));
|
| 1862 |
+
* // Prints: false
|
| 1863 |
+
* console.log(buf.includes(Buffer.from('a buffer example').slice(0, 8)));
|
| 1864 |
+
* // Prints: true
|
| 1865 |
+
* console.log(buf.includes('this', 4));
|
| 1866 |
+
* // Prints: false
|
| 1867 |
+
* ```
|
| 1868 |
+
* @since v5.3.0
|
| 1869 |
+
* @param value What to search for.
|
| 1870 |
+
* @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`.
|
| 1871 |
+
* @param [encoding='utf8'] If `value` is a string, this is its encoding.
|
| 1872 |
+
* @return `true` if `value` was found in `buf`, `false` otherwise.
|
| 1873 |
+
*/
|
| 1874 |
+
includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
|
| 1875 |
+
includes(value: string | number | Buffer, encoding: BufferEncoding): boolean;
|
| 1876 |
+
}
|
| 1877 |
+
var Buffer: BufferConstructor;
|
| 1878 |
+
/**
|
| 1879 |
+
* Decodes a string of Base64-encoded data into bytes, and encodes those bytes
|
| 1880 |
+
* into a string using Latin-1 (ISO-8859-1).
|
| 1881 |
+
*
|
| 1882 |
+
* The `data` may be any JavaScript-value that can be coerced into a string.
|
| 1883 |
+
*
|
| 1884 |
+
* **This function is only provided for compatibility with legacy web platform APIs**
|
| 1885 |
+
* **and should never be used in new code, because they use strings to represent**
|
| 1886 |
+
* **binary data and predate the introduction of typed arrays in JavaScript.**
|
| 1887 |
+
* **For code running using Node.js APIs, converting between base64-encoded strings**
|
| 1888 |
+
* **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.**
|
| 1889 |
+
* @since v15.13.0, v14.17.0
|
| 1890 |
+
* @legacy Use `Buffer.from(data, 'base64')` instead.
|
| 1891 |
+
* @param data The Base64-encoded input string.
|
| 1892 |
+
*/
|
| 1893 |
+
function atob(data: string): string;
|
| 1894 |
+
/**
|
| 1895 |
+
* Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes
|
| 1896 |
+
* into a string using Base64.
|
| 1897 |
+
*
|
| 1898 |
+
* The `data` may be any JavaScript-value that can be coerced into a string.
|
| 1899 |
+
*
|
| 1900 |
+
* **This function is only provided for compatibility with legacy web platform APIs**
|
| 1901 |
+
* **and should never be used in new code, because they use strings to represent**
|
| 1902 |
+
* **binary data and predate the introduction of typed arrays in JavaScript.**
|
| 1903 |
+
* **For code running using Node.js APIs, converting between base64-encoded strings**
|
| 1904 |
+
* **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.**
|
| 1905 |
+
* @since v15.13.0, v14.17.0
|
| 1906 |
+
* @legacy Use `buf.toString('base64')` instead.
|
| 1907 |
+
* @param data An ASCII (Latin1) string.
|
| 1908 |
+
*/
|
| 1909 |
+
function btoa(data: string): string;
|
| 1910 |
+
interface Blob extends _Blob {}
|
| 1911 |
+
/**
|
| 1912 |
+
* `Blob` class is a global reference for `import { Blob } from 'node:buffer'`
|
| 1913 |
+
* https://nodejs.org/api/buffer.html#class-blob
|
| 1914 |
+
* @since v18.0.0
|
| 1915 |
+
*/
|
| 1916 |
+
var Blob: typeof globalThis extends { onmessage: any; Blob: infer T } ? T
|
| 1917 |
+
: typeof import("buffer").Blob;
|
| 1918 |
+
interface File extends _File {}
|
| 1919 |
+
/**
|
| 1920 |
+
* `File` class is a global reference for `import { File } from 'node:buffer'`
|
| 1921 |
+
* https://nodejs.org/api/buffer.html#class-file
|
| 1922 |
+
* @since v20.0.0
|
| 1923 |
+
*/
|
| 1924 |
+
var File: typeof globalThis extends { onmessage: any; File: infer T } ? T
|
| 1925 |
+
: typeof import("buffer").File;
|
| 1926 |
+
}
|
| 1927 |
+
}
|
| 1928 |
+
declare module "node:buffer" {
|
| 1929 |
+
export * from "buffer";
|
| 1930 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/child_process.d.ts
ADDED
|
@@ -0,0 +1,1549 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* The `node:child_process` module provides the ability to spawn subprocesses in
|
| 3 |
+
* a manner that is similar, but not identical, to [`popen(3)`](http://man7.org/linux/man-pages/man3/popen.3.html). This capability
|
| 4 |
+
* is primarily provided by the {@link spawn} function:
|
| 5 |
+
*
|
| 6 |
+
* ```js
|
| 7 |
+
* import { spawn } from 'node:child_process';
|
| 8 |
+
* const ls = spawn('ls', ['-lh', '/usr']);
|
| 9 |
+
*
|
| 10 |
+
* ls.stdout.on('data', (data) => {
|
| 11 |
+
* console.log(`stdout: ${data}`);
|
| 12 |
+
* });
|
| 13 |
+
*
|
| 14 |
+
* ls.stderr.on('data', (data) => {
|
| 15 |
+
* console.error(`stderr: ${data}`);
|
| 16 |
+
* });
|
| 17 |
+
*
|
| 18 |
+
* ls.on('close', (code) => {
|
| 19 |
+
* console.log(`child process exited with code ${code}`);
|
| 20 |
+
* });
|
| 21 |
+
* ```
|
| 22 |
+
*
|
| 23 |
+
* By default, pipes for `stdin`, `stdout`, and `stderr` are established between
|
| 24 |
+
* the parent Node.js process and the spawned subprocess. These pipes have
|
| 25 |
+
* limited (and platform-specific) capacity. If the subprocess writes to
|
| 26 |
+
* stdout in excess of that limit without the output being captured, the
|
| 27 |
+
* subprocess blocks waiting for the pipe buffer to accept more data. This is
|
| 28 |
+
* identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }` option if the output will not be consumed.
|
| 29 |
+
*
|
| 30 |
+
* The command lookup is performed using the `options.env.PATH` environment
|
| 31 |
+
* variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is
|
| 32 |
+
* used. If `options.env` is set without `PATH`, lookup on Unix is performed
|
| 33 |
+
* on a default search path search of `/usr/bin:/bin` (see your operating system's
|
| 34 |
+
* manual for execvpe/execvp), on Windows the current processes environment
|
| 35 |
+
* variable `PATH` is used.
|
| 36 |
+
*
|
| 37 |
+
* On Windows, environment variables are case-insensitive. Node.js
|
| 38 |
+
* lexicographically sorts the `env` keys and uses the first one that
|
| 39 |
+
* case-insensitively matches. Only first (in lexicographic order) entry will be
|
| 40 |
+
* passed to the subprocess. This might lead to issues on Windows when passing
|
| 41 |
+
* objects to the `env` option that have multiple variants of the same key, such as `PATH` and `Path`.
|
| 42 |
+
*
|
| 43 |
+
* The {@link spawn} method spawns the child process asynchronously,
|
| 44 |
+
* without blocking the Node.js event loop. The {@link spawnSync} function provides equivalent functionality in a synchronous manner that blocks
|
| 45 |
+
* the event loop until the spawned process either exits or is terminated.
|
| 46 |
+
*
|
| 47 |
+
* For convenience, the `node:child_process` module provides a handful of
|
| 48 |
+
* synchronous and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on
|
| 49 |
+
* top of {@link spawn} or {@link spawnSync}.
|
| 50 |
+
*
|
| 51 |
+
* * {@link exec}: spawns a shell and runs a command within that
|
| 52 |
+
* shell, passing the `stdout` and `stderr` to a callback function when
|
| 53 |
+
* complete.
|
| 54 |
+
* * {@link execFile}: similar to {@link exec} except
|
| 55 |
+
* that it spawns the command directly without first spawning a shell by
|
| 56 |
+
* default.
|
| 57 |
+
* * {@link fork}: spawns a new Node.js process and invokes a
|
| 58 |
+
* specified module with an IPC communication channel established that allows
|
| 59 |
+
* sending messages between parent and child.
|
| 60 |
+
* * {@link execSync}: a synchronous version of {@link exec} that will block the Node.js event loop.
|
| 61 |
+
* * {@link execFileSync}: a synchronous version of {@link execFile} that will block the Node.js event loop.
|
| 62 |
+
*
|
| 63 |
+
* For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
|
| 64 |
+
* the synchronous methods can have significant impact on performance due to
|
| 65 |
+
* stalling the event loop while spawned processes complete.
|
| 66 |
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/child_process.js)
|
| 67 |
+
*/
|
| 68 |
+
declare module "child_process" {
|
| 69 |
+
import { ObjectEncodingOptions } from "node:fs";
|
| 70 |
+
import { Abortable, EventEmitter } from "node:events";
|
| 71 |
+
import * as dgram from "node:dgram";
|
| 72 |
+
import * as net from "node:net";
|
| 73 |
+
import { Pipe, Readable, Stream, Writable } from "node:stream";
|
| 74 |
+
import { URL } from "node:url";
|
| 75 |
+
type Serializable = string | object | number | boolean | bigint;
|
| 76 |
+
type SendHandle = net.Socket | net.Server | dgram.Socket | undefined;
|
| 77 |
+
/**
|
| 78 |
+
* Instances of the `ChildProcess` represent spawned child processes.
|
| 79 |
+
*
|
| 80 |
+
* Instances of `ChildProcess` are not intended to be created directly. Rather,
|
| 81 |
+
* use the {@link spawn}, {@link exec},{@link execFile}, or {@link fork} methods to create
|
| 82 |
+
* instances of `ChildProcess`.
|
| 83 |
+
* @since v2.2.0
|
| 84 |
+
*/
|
| 85 |
+
class ChildProcess extends EventEmitter {
|
| 86 |
+
/**
|
| 87 |
+
* A `Writable Stream` that represents the child process's `stdin`.
|
| 88 |
+
*
|
| 89 |
+
* If a child process waits to read all of its input, the child will not continue
|
| 90 |
+
* until this stream has been closed via `end()`.
|
| 91 |
+
*
|
| 92 |
+
* If the child was spawned with `stdio[0]` set to anything other than `'pipe'`,
|
| 93 |
+
* then this will be `null`.
|
| 94 |
+
*
|
| 95 |
+
* `subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will
|
| 96 |
+
* refer to the same value.
|
| 97 |
+
*
|
| 98 |
+
* The `subprocess.stdin` property can be `null` or `undefined` if the child process could not be successfully spawned.
|
| 99 |
+
* @since v0.1.90
|
| 100 |
+
*/
|
| 101 |
+
stdin: Writable | null;
|
| 102 |
+
/**
|
| 103 |
+
* A `Readable Stream` that represents the child process's `stdout`.
|
| 104 |
+
*
|
| 105 |
+
* If the child was spawned with `stdio[1]` set to anything other than `'pipe'`,
|
| 106 |
+
* then this will be `null`.
|
| 107 |
+
*
|
| 108 |
+
* `subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will
|
| 109 |
+
* refer to the same value.
|
| 110 |
+
*
|
| 111 |
+
* ```js
|
| 112 |
+
* import { spawn } from 'node:child_process';
|
| 113 |
+
*
|
| 114 |
+
* const subprocess = spawn('ls');
|
| 115 |
+
*
|
| 116 |
+
* subprocess.stdout.on('data', (data) => {
|
| 117 |
+
* console.log(`Received chunk ${data}`);
|
| 118 |
+
* });
|
| 119 |
+
* ```
|
| 120 |
+
*
|
| 121 |
+
* The `subprocess.stdout` property can be `null` or `undefined` if the child process could not be successfully spawned.
|
| 122 |
+
* @since v0.1.90
|
| 123 |
+
*/
|
| 124 |
+
stdout: Readable | null;
|
| 125 |
+
/**
|
| 126 |
+
* A `Readable Stream` that represents the child process's `stderr`.
|
| 127 |
+
*
|
| 128 |
+
* If the child was spawned with `stdio[2]` set to anything other than `'pipe'`,
|
| 129 |
+
* then this will be `null`.
|
| 130 |
+
*
|
| 131 |
+
* `subprocess.stderr` is an alias for `subprocess.stdio[2]`. Both properties will
|
| 132 |
+
* refer to the same value.
|
| 133 |
+
*
|
| 134 |
+
* The `subprocess.stderr` property can be `null` or `undefined` if the child process could not be successfully spawned.
|
| 135 |
+
* @since v0.1.90
|
| 136 |
+
*/
|
| 137 |
+
stderr: Readable | null;
|
| 138 |
+
/**
|
| 139 |
+
* The `subprocess.channel` property is a reference to the child's IPC channel. If
|
| 140 |
+
* no IPC channel exists, this property is `undefined`.
|
| 141 |
+
* @since v7.1.0
|
| 142 |
+
*/
|
| 143 |
+
readonly channel?: Pipe | null | undefined;
|
| 144 |
+
/**
|
| 145 |
+
* A sparse array of pipes to the child process, corresponding with positions in
|
| 146 |
+
* the `stdio` option passed to {@link spawn} that have been set
|
| 147 |
+
* to the value `'pipe'`. `subprocess.stdio[0]`, `subprocess.stdio[1]`, and `subprocess.stdio[2]` are also available as `subprocess.stdin`, `subprocess.stdout`, and `subprocess.stderr`,
|
| 148 |
+
* respectively.
|
| 149 |
+
*
|
| 150 |
+
* In the following example, only the child's fd `1` (stdout) is configured as a
|
| 151 |
+
* pipe, so only the parent's `subprocess.stdio[1]` is a stream, all other values
|
| 152 |
+
* in the array are `null`.
|
| 153 |
+
*
|
| 154 |
+
* ```js
|
| 155 |
+
* import assert from 'node:assert';
|
| 156 |
+
* import fs from 'node:fs';
|
| 157 |
+
* import child_process from 'node:child_process';
|
| 158 |
+
*
|
| 159 |
+
* const subprocess = child_process.spawn('ls', {
|
| 160 |
+
* stdio: [
|
| 161 |
+
* 0, // Use parent's stdin for child.
|
| 162 |
+
* 'pipe', // Pipe child's stdout to parent.
|
| 163 |
+
* fs.openSync('err.out', 'w'), // Direct child's stderr to a file.
|
| 164 |
+
* ],
|
| 165 |
+
* });
|
| 166 |
+
*
|
| 167 |
+
* assert.strictEqual(subprocess.stdio[0], null);
|
| 168 |
+
* assert.strictEqual(subprocess.stdio[0], subprocess.stdin);
|
| 169 |
+
*
|
| 170 |
+
* assert(subprocess.stdout);
|
| 171 |
+
* assert.strictEqual(subprocess.stdio[1], subprocess.stdout);
|
| 172 |
+
*
|
| 173 |
+
* assert.strictEqual(subprocess.stdio[2], null);
|
| 174 |
+
* assert.strictEqual(subprocess.stdio[2], subprocess.stderr);
|
| 175 |
+
* ```
|
| 176 |
+
*
|
| 177 |
+
* The `subprocess.stdio` property can be `undefined` if the child process could
|
| 178 |
+
* not be successfully spawned.
|
| 179 |
+
* @since v0.7.10
|
| 180 |
+
*/
|
| 181 |
+
readonly stdio: [
|
| 182 |
+
Writable | null,
|
| 183 |
+
// stdin
|
| 184 |
+
Readable | null,
|
| 185 |
+
// stdout
|
| 186 |
+
Readable | null,
|
| 187 |
+
// stderr
|
| 188 |
+
Readable | Writable | null | undefined,
|
| 189 |
+
// extra
|
| 190 |
+
Readable | Writable | null | undefined, // extra
|
| 191 |
+
];
|
| 192 |
+
/**
|
| 193 |
+
* The `subprocess.killed` property indicates whether the child process
|
| 194 |
+
* successfully received a signal from `subprocess.kill()`. The `killed` property
|
| 195 |
+
* does not indicate that the child process has been terminated.
|
| 196 |
+
* @since v0.5.10
|
| 197 |
+
*/
|
| 198 |
+
readonly killed: boolean;
|
| 199 |
+
/**
|
| 200 |
+
* Returns the process identifier (PID) of the child process. If the child process
|
| 201 |
+
* fails to spawn due to errors, then the value is `undefined` and `error` is
|
| 202 |
+
* emitted.
|
| 203 |
+
*
|
| 204 |
+
* ```js
|
| 205 |
+
* import { spawn } from 'node:child_process';
|
| 206 |
+
* const grep = spawn('grep', ['ssh']);
|
| 207 |
+
*
|
| 208 |
+
* console.log(`Spawned child pid: ${grep.pid}`);
|
| 209 |
+
* grep.stdin.end();
|
| 210 |
+
* ```
|
| 211 |
+
* @since v0.1.90
|
| 212 |
+
*/
|
| 213 |
+
readonly pid?: number | undefined;
|
| 214 |
+
/**
|
| 215 |
+
* The `subprocess.connected` property indicates whether it is still possible to
|
| 216 |
+
* send and receive messages from a child process. When `subprocess.connected` is `false`, it is no longer possible to send or receive messages.
|
| 217 |
+
* @since v0.7.2
|
| 218 |
+
*/
|
| 219 |
+
readonly connected: boolean;
|
| 220 |
+
/**
|
| 221 |
+
* The `subprocess.exitCode` property indicates the exit code of the child process.
|
| 222 |
+
* If the child process is still running, the field will be `null`.
|
| 223 |
+
*/
|
| 224 |
+
readonly exitCode: number | null;
|
| 225 |
+
/**
|
| 226 |
+
* The `subprocess.signalCode` property indicates the signal received by
|
| 227 |
+
* the child process if any, else `null`.
|
| 228 |
+
*/
|
| 229 |
+
readonly signalCode: NodeJS.Signals | null;
|
| 230 |
+
/**
|
| 231 |
+
* The `subprocess.spawnargs` property represents the full list of command-line
|
| 232 |
+
* arguments the child process was launched with.
|
| 233 |
+
*/
|
| 234 |
+
readonly spawnargs: string[];
|
| 235 |
+
/**
|
| 236 |
+
* The `subprocess.spawnfile` property indicates the executable file name of
|
| 237 |
+
* the child process that is launched.
|
| 238 |
+
*
|
| 239 |
+
* For {@link fork}, its value will be equal to `process.execPath`.
|
| 240 |
+
* For {@link spawn}, its value will be the name of
|
| 241 |
+
* the executable file.
|
| 242 |
+
* For {@link exec}, its value will be the name of the shell
|
| 243 |
+
* in which the child process is launched.
|
| 244 |
+
*/
|
| 245 |
+
readonly spawnfile: string;
|
| 246 |
+
/**
|
| 247 |
+
* The `subprocess.kill()` method sends a signal to the child process. If no
|
| 248 |
+
* argument is given, the process will be sent the `'SIGTERM'` signal. See [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a list of available signals. This function
|
| 249 |
+
* returns `true` if [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) succeeds, and `false` otherwise.
|
| 250 |
+
*
|
| 251 |
+
* ```js
|
| 252 |
+
* import { spawn } from 'node:child_process';
|
| 253 |
+
* const grep = spawn('grep', ['ssh']);
|
| 254 |
+
*
|
| 255 |
+
* grep.on('close', (code, signal) => {
|
| 256 |
+
* console.log(
|
| 257 |
+
* `child process terminated due to receipt of signal ${signal}`);
|
| 258 |
+
* });
|
| 259 |
+
*
|
| 260 |
+
* // Send SIGHUP to process.
|
| 261 |
+
* grep.kill('SIGHUP');
|
| 262 |
+
* ```
|
| 263 |
+
*
|
| 264 |
+
* The `ChildProcess` object may emit an `'error'` event if the signal
|
| 265 |
+
* cannot be delivered. Sending a signal to a child process that has already exited
|
| 266 |
+
* is not an error but may have unforeseen consequences. Specifically, if the
|
| 267 |
+
* process identifier (PID) has been reassigned to another process, the signal will
|
| 268 |
+
* be delivered to that process instead which can have unexpected results.
|
| 269 |
+
*
|
| 270 |
+
* While the function is called `kill`, the signal delivered to the child process
|
| 271 |
+
* may not actually terminate the process.
|
| 272 |
+
*
|
| 273 |
+
* See [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for reference.
|
| 274 |
+
*
|
| 275 |
+
* On Windows, where POSIX signals do not exist, the `signal` argument will be
|
| 276 |
+
* ignored, and the process will be killed forcefully and abruptly (similar to `'SIGKILL'`).
|
| 277 |
+
* See `Signal Events` for more details.
|
| 278 |
+
*
|
| 279 |
+
* On Linux, child processes of child processes will not be terminated
|
| 280 |
+
* when attempting to kill their parent. This is likely to happen when running a
|
| 281 |
+
* new process in a shell or with the use of the `shell` option of `ChildProcess`:
|
| 282 |
+
*
|
| 283 |
+
* ```js
|
| 284 |
+
* 'use strict';
|
| 285 |
+
* import { spawn } from 'node:child_process';
|
| 286 |
+
*
|
| 287 |
+
* const subprocess = spawn(
|
| 288 |
+
* 'sh',
|
| 289 |
+
* [
|
| 290 |
+
* '-c',
|
| 291 |
+
* `node -e "setInterval(() => {
|
| 292 |
+
* console.log(process.pid, 'is alive')
|
| 293 |
+
* }, 500);"`,
|
| 294 |
+
* ], {
|
| 295 |
+
* stdio: ['inherit', 'inherit', 'inherit'],
|
| 296 |
+
* },
|
| 297 |
+
* );
|
| 298 |
+
*
|
| 299 |
+
* setTimeout(() => {
|
| 300 |
+
* subprocess.kill(); // Does not terminate the Node.js process in the shell.
|
| 301 |
+
* }, 2000);
|
| 302 |
+
* ```
|
| 303 |
+
* @since v0.1.90
|
| 304 |
+
*/
|
| 305 |
+
kill(signal?: NodeJS.Signals | number): boolean;
|
| 306 |
+
/**
|
| 307 |
+
* Calls {@link ChildProcess.kill} with `'SIGTERM'`.
|
| 308 |
+
* @since v20.5.0
|
| 309 |
+
*/
|
| 310 |
+
[Symbol.dispose](): void;
|
| 311 |
+
/**
|
| 312 |
+
* When an IPC channel has been established between the parent and child (
|
| 313 |
+
* i.e. when using {@link fork}), the `subprocess.send()` method can
|
| 314 |
+
* be used to send messages to the child process. When the child process is a
|
| 315 |
+
* Node.js instance, these messages can be received via the `'message'` event.
|
| 316 |
+
*
|
| 317 |
+
* The message goes through serialization and parsing. The resulting
|
| 318 |
+
* message might not be the same as what is originally sent.
|
| 319 |
+
*
|
| 320 |
+
* For example, in the parent script:
|
| 321 |
+
*
|
| 322 |
+
* ```js
|
| 323 |
+
* import cp from 'node:child_process';
|
| 324 |
+
* const n = cp.fork(`${__dirname}/sub.js`);
|
| 325 |
+
*
|
| 326 |
+
* n.on('message', (m) => {
|
| 327 |
+
* console.log('PARENT got message:', m);
|
| 328 |
+
* });
|
| 329 |
+
*
|
| 330 |
+
* // Causes the child to print: CHILD got message: { hello: 'world' }
|
| 331 |
+
* n.send({ hello: 'world' });
|
| 332 |
+
* ```
|
| 333 |
+
*
|
| 334 |
+
* And then the child script, `'sub.js'` might look like this:
|
| 335 |
+
*
|
| 336 |
+
* ```js
|
| 337 |
+
* process.on('message', (m) => {
|
| 338 |
+
* console.log('CHILD got message:', m);
|
| 339 |
+
* });
|
| 340 |
+
*
|
| 341 |
+
* // Causes the parent to print: PARENT got message: { foo: 'bar', baz: null }
|
| 342 |
+
* process.send({ foo: 'bar', baz: NaN });
|
| 343 |
+
* ```
|
| 344 |
+
*
|
| 345 |
+
* Child Node.js processes will have a `process.send()` method of their own
|
| 346 |
+
* that allows the child to send messages back to the parent.
|
| 347 |
+
*
|
| 348 |
+
* There is a special case when sending a `{cmd: 'NODE_foo'}` message. Messages
|
| 349 |
+
* containing a `NODE_` prefix in the `cmd` property are reserved for use within
|
| 350 |
+
* Node.js core and will not be emitted in the child's `'message'` event. Rather, such messages are emitted using the `'internalMessage'` event and are consumed internally by Node.js.
|
| 351 |
+
* Applications should avoid using such messages or listening for `'internalMessage'` events as it is subject to change without notice.
|
| 352 |
+
*
|
| 353 |
+
* The optional `sendHandle` argument that may be passed to `subprocess.send()` is
|
| 354 |
+
* for passing a TCP server or socket object to the child process. The child will
|
| 355 |
+
* receive the object as the second argument passed to the callback function
|
| 356 |
+
* registered on the `'message'` event. Any data that is received and buffered in
|
| 357 |
+
* the socket will not be sent to the child. Sending IPC sockets is not supported on Windows.
|
| 358 |
+
*
|
| 359 |
+
* The optional `callback` is a function that is invoked after the message is
|
| 360 |
+
* sent but before the child may have received it. The function is called with a
|
| 361 |
+
* single argument: `null` on success, or an `Error` object on failure.
|
| 362 |
+
*
|
| 363 |
+
* If no `callback` function is provided and the message cannot be sent, an `'error'` event will be emitted by the `ChildProcess` object. This can
|
| 364 |
+
* happen, for instance, when the child process has already exited.
|
| 365 |
+
*
|
| 366 |
+
* `subprocess.send()` will return `false` if the channel has closed or when the
|
| 367 |
+
* backlog of unsent messages exceeds a threshold that makes it unwise to send
|
| 368 |
+
* more. Otherwise, the method returns `true`. The `callback` function can be
|
| 369 |
+
* used to implement flow control.
|
| 370 |
+
*
|
| 371 |
+
* #### Example: sending a server object
|
| 372 |
+
*
|
| 373 |
+
* The `sendHandle` argument can be used, for instance, to pass the handle of
|
| 374 |
+
* a TCP server object to the child process as illustrated in the example below:
|
| 375 |
+
*
|
| 376 |
+
* ```js
|
| 377 |
+
* import { createServer } from 'node:net';
|
| 378 |
+
* import { fork } from 'node:child_process';
|
| 379 |
+
* const subprocess = fork('subprocess.js');
|
| 380 |
+
*
|
| 381 |
+
* // Open up the server object and send the handle.
|
| 382 |
+
* const server = createServer();
|
| 383 |
+
* server.on('connection', (socket) => {
|
| 384 |
+
* socket.end('handled by parent');
|
| 385 |
+
* });
|
| 386 |
+
* server.listen(1337, () => {
|
| 387 |
+
* subprocess.send('server', server);
|
| 388 |
+
* });
|
| 389 |
+
* ```
|
| 390 |
+
*
|
| 391 |
+
* The child would then receive the server object as:
|
| 392 |
+
*
|
| 393 |
+
* ```js
|
| 394 |
+
* process.on('message', (m, server) => {
|
| 395 |
+
* if (m === 'server') {
|
| 396 |
+
* server.on('connection', (socket) => {
|
| 397 |
+
* socket.end('handled by child');
|
| 398 |
+
* });
|
| 399 |
+
* }
|
| 400 |
+
* });
|
| 401 |
+
* ```
|
| 402 |
+
*
|
| 403 |
+
* Once the server is now shared between the parent and child, some connections
|
| 404 |
+
* can be handled by the parent and some by the child.
|
| 405 |
+
*
|
| 406 |
+
* While the example above uses a server created using the `node:net` module, `node:dgram` module servers use exactly the same workflow with the exceptions of
|
| 407 |
+
* listening on a `'message'` event instead of `'connection'` and using `server.bind()` instead of `server.listen()`. This is, however, only
|
| 408 |
+
* supported on Unix platforms.
|
| 409 |
+
*
|
| 410 |
+
* #### Example: sending a socket object
|
| 411 |
+
*
|
| 412 |
+
* Similarly, the `sendHandler` argument can be used to pass the handle of a
|
| 413 |
+
* socket to the child process. The example below spawns two children that each
|
| 414 |
+
* handle connections with "normal" or "special" priority:
|
| 415 |
+
*
|
| 416 |
+
* ```js
|
| 417 |
+
* import { createServer } from 'node:net';
|
| 418 |
+
* import { fork } from 'node:child_process';
|
| 419 |
+
* const normal = fork('subprocess.js', ['normal']);
|
| 420 |
+
* const special = fork('subprocess.js', ['special']);
|
| 421 |
+
*
|
| 422 |
+
* // Open up the server and send sockets to child. Use pauseOnConnect to prevent
|
| 423 |
+
* // the sockets from being read before they are sent to the child process.
|
| 424 |
+
* const server = createServer({ pauseOnConnect: true });
|
| 425 |
+
* server.on('connection', (socket) => {
|
| 426 |
+
*
|
| 427 |
+
* // If this is special priority...
|
| 428 |
+
* if (socket.remoteAddress === '74.125.127.100') {
|
| 429 |
+
* special.send('socket', socket);
|
| 430 |
+
* return;
|
| 431 |
+
* }
|
| 432 |
+
* // This is normal priority.
|
| 433 |
+
* normal.send('socket', socket);
|
| 434 |
+
* });
|
| 435 |
+
* server.listen(1337);
|
| 436 |
+
* ```
|
| 437 |
+
*
|
| 438 |
+
* The `subprocess.js` would receive the socket handle as the second argument
|
| 439 |
+
* passed to the event callback function:
|
| 440 |
+
*
|
| 441 |
+
* ```js
|
| 442 |
+
* process.on('message', (m, socket) => {
|
| 443 |
+
* if (m === 'socket') {
|
| 444 |
+
* if (socket) {
|
| 445 |
+
* // Check that the client socket exists.
|
| 446 |
+
* // It is possible for the socket to be closed between the time it is
|
| 447 |
+
* // sent and the time it is received in the child process.
|
| 448 |
+
* socket.end(`Request handled with ${process.argv[2]} priority`);
|
| 449 |
+
* }
|
| 450 |
+
* }
|
| 451 |
+
* });
|
| 452 |
+
* ```
|
| 453 |
+
*
|
| 454 |
+
* Do not use `.maxConnections` on a socket that has been passed to a subprocess.
|
| 455 |
+
* The parent cannot track when the socket is destroyed.
|
| 456 |
+
*
|
| 457 |
+
* Any `'message'` handlers in the subprocess should verify that `socket` exists,
|
| 458 |
+
* as the connection may have been closed during the time it takes to send the
|
| 459 |
+
* connection to the child.
|
| 460 |
+
* @since v0.5.9
|
| 461 |
+
* @param sendHandle `undefined`, or a [`net.Socket`](https://nodejs.org/docs/latest-v24.x/api/net.html#class-netsocket), [`net.Server`](https://nodejs.org/docs/latest-v24.x/api/net.html#class-netserver), or [`dgram.Socket`](https://nodejs.org/docs/latest-v24.x/api/dgram.html#class-dgramsocket) object.
|
| 462 |
+
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
|
| 463 |
+
*/
|
| 464 |
+
send(message: Serializable, callback?: (error: Error | null) => void): boolean;
|
| 465 |
+
send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean;
|
| 466 |
+
send(
|
| 467 |
+
message: Serializable,
|
| 468 |
+
sendHandle?: SendHandle,
|
| 469 |
+
options?: MessageOptions,
|
| 470 |
+
callback?: (error: Error | null) => void,
|
| 471 |
+
): boolean;
|
| 472 |
+
/**
|
| 473 |
+
* Closes the IPC channel between parent and child, allowing the child to exit
|
| 474 |
+
* gracefully once there are no other connections keeping it alive. After calling
|
| 475 |
+
* this method the `subprocess.connected` and `process.connected` properties in
|
| 476 |
+
* both the parent and child (respectively) will be set to `false`, and it will be
|
| 477 |
+
* no longer possible to pass messages between the processes.
|
| 478 |
+
*
|
| 479 |
+
* The `'disconnect'` event will be emitted when there are no messages in the
|
| 480 |
+
* process of being received. This will most often be triggered immediately after
|
| 481 |
+
* calling `subprocess.disconnect()`.
|
| 482 |
+
*
|
| 483 |
+
* When the child process is a Node.js instance (e.g. spawned using {@link fork}), the `process.disconnect()` method can be invoked
|
| 484 |
+
* within the child process to close the IPC channel as well.
|
| 485 |
+
* @since v0.7.2
|
| 486 |
+
*/
|
| 487 |
+
disconnect(): void;
|
| 488 |
+
/**
|
| 489 |
+
* By default, the parent will wait for the detached child to exit. To prevent the
|
| 490 |
+
* parent from waiting for a given `subprocess` to exit, use the `subprocess.unref()` method. Doing so will cause the parent's event loop to not
|
| 491 |
+
* include the child in its reference count, allowing the parent to exit
|
| 492 |
+
* independently of the child, unless there is an established IPC channel between
|
| 493 |
+
* the child and the parent.
|
| 494 |
+
*
|
| 495 |
+
* ```js
|
| 496 |
+
* import { spawn } from 'node:child_process';
|
| 497 |
+
*
|
| 498 |
+
* const subprocess = spawn(process.argv[0], ['child_program.js'], {
|
| 499 |
+
* detached: true,
|
| 500 |
+
* stdio: 'ignore',
|
| 501 |
+
* });
|
| 502 |
+
*
|
| 503 |
+
* subprocess.unref();
|
| 504 |
+
* ```
|
| 505 |
+
* @since v0.7.10
|
| 506 |
+
*/
|
| 507 |
+
unref(): void;
|
| 508 |
+
/**
|
| 509 |
+
* Calling `subprocess.ref()` after making a call to `subprocess.unref()` will
|
| 510 |
+
* restore the removed reference count for the child process, forcing the parent
|
| 511 |
+
* to wait for the child to exit before exiting itself.
|
| 512 |
+
*
|
| 513 |
+
* ```js
|
| 514 |
+
* import { spawn } from 'node:child_process';
|
| 515 |
+
*
|
| 516 |
+
* const subprocess = spawn(process.argv[0], ['child_program.js'], {
|
| 517 |
+
* detached: true,
|
| 518 |
+
* stdio: 'ignore',
|
| 519 |
+
* });
|
| 520 |
+
*
|
| 521 |
+
* subprocess.unref();
|
| 522 |
+
* subprocess.ref();
|
| 523 |
+
* ```
|
| 524 |
+
* @since v0.7.10
|
| 525 |
+
*/
|
| 526 |
+
ref(): void;
|
| 527 |
+
/**
|
| 528 |
+
* events.EventEmitter
|
| 529 |
+
* 1. close
|
| 530 |
+
* 2. disconnect
|
| 531 |
+
* 3. error
|
| 532 |
+
* 4. exit
|
| 533 |
+
* 5. message
|
| 534 |
+
* 6. spawn
|
| 535 |
+
*/
|
| 536 |
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
| 537 |
+
addListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 538 |
+
addListener(event: "disconnect", listener: () => void): this;
|
| 539 |
+
addListener(event: "error", listener: (err: Error) => void): this;
|
| 540 |
+
addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 541 |
+
addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
| 542 |
+
addListener(event: "spawn", listener: () => void): this;
|
| 543 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 544 |
+
emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean;
|
| 545 |
+
emit(event: "disconnect"): boolean;
|
| 546 |
+
emit(event: "error", err: Error): boolean;
|
| 547 |
+
emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
|
| 548 |
+
emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean;
|
| 549 |
+
emit(event: "spawn", listener: () => void): boolean;
|
| 550 |
+
on(event: string, listener: (...args: any[]) => void): this;
|
| 551 |
+
on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 552 |
+
on(event: "disconnect", listener: () => void): this;
|
| 553 |
+
on(event: "error", listener: (err: Error) => void): this;
|
| 554 |
+
on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 555 |
+
on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
| 556 |
+
on(event: "spawn", listener: () => void): this;
|
| 557 |
+
once(event: string, listener: (...args: any[]) => void): this;
|
| 558 |
+
once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 559 |
+
once(event: "disconnect", listener: () => void): this;
|
| 560 |
+
once(event: "error", listener: (err: Error) => void): this;
|
| 561 |
+
once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 562 |
+
once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
| 563 |
+
once(event: "spawn", listener: () => void): this;
|
| 564 |
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
| 565 |
+
prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 566 |
+
prependListener(event: "disconnect", listener: () => void): this;
|
| 567 |
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
| 568 |
+
prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 569 |
+
prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
| 570 |
+
prependListener(event: "spawn", listener: () => void): this;
|
| 571 |
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
| 572 |
+
prependOnceListener(
|
| 573 |
+
event: "close",
|
| 574 |
+
listener: (code: number | null, signal: NodeJS.Signals | null) => void,
|
| 575 |
+
): this;
|
| 576 |
+
prependOnceListener(event: "disconnect", listener: () => void): this;
|
| 577 |
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
| 578 |
+
prependOnceListener(
|
| 579 |
+
event: "exit",
|
| 580 |
+
listener: (code: number | null, signal: NodeJS.Signals | null) => void,
|
| 581 |
+
): this;
|
| 582 |
+
prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
| 583 |
+
prependOnceListener(event: "spawn", listener: () => void): this;
|
| 584 |
+
}
|
| 585 |
+
// return this object when stdio option is undefined or not specified
|
| 586 |
+
interface ChildProcessWithoutNullStreams extends ChildProcess {
|
| 587 |
+
stdin: Writable;
|
| 588 |
+
stdout: Readable;
|
| 589 |
+
stderr: Readable;
|
| 590 |
+
readonly stdio: [
|
| 591 |
+
Writable,
|
| 592 |
+
Readable,
|
| 593 |
+
Readable,
|
| 594 |
+
// stderr
|
| 595 |
+
Readable | Writable | null | undefined,
|
| 596 |
+
// extra, no modification
|
| 597 |
+
Readable | Writable | null | undefined, // extra, no modification
|
| 598 |
+
];
|
| 599 |
+
}
|
| 600 |
+
// return this object when stdio option is a tuple of 3
|
| 601 |
+
interface ChildProcessByStdio<I extends null | Writable, O extends null | Readable, E extends null | Readable>
|
| 602 |
+
extends ChildProcess
|
| 603 |
+
{
|
| 604 |
+
stdin: I;
|
| 605 |
+
stdout: O;
|
| 606 |
+
stderr: E;
|
| 607 |
+
readonly stdio: [
|
| 608 |
+
I,
|
| 609 |
+
O,
|
| 610 |
+
E,
|
| 611 |
+
Readable | Writable | null | undefined,
|
| 612 |
+
// extra, no modification
|
| 613 |
+
Readable | Writable | null | undefined, // extra, no modification
|
| 614 |
+
];
|
| 615 |
+
}
|
| 616 |
+
interface MessageOptions {
|
| 617 |
+
keepOpen?: boolean | undefined;
|
| 618 |
+
}
|
| 619 |
+
type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
|
| 620 |
+
type StdioOptions = IOType | Array<IOType | "ipc" | Stream | number | null | undefined>;
|
| 621 |
+
type SerializationType = "json" | "advanced";
|
| 622 |
+
interface MessagingOptions extends Abortable {
|
| 623 |
+
/**
|
| 624 |
+
* Specify the kind of serialization used for sending messages between processes.
|
| 625 |
+
* @default 'json'
|
| 626 |
+
*/
|
| 627 |
+
serialization?: SerializationType | undefined;
|
| 628 |
+
/**
|
| 629 |
+
* The signal value to be used when the spawned process will be killed by the abort signal.
|
| 630 |
+
* @default 'SIGTERM'
|
| 631 |
+
*/
|
| 632 |
+
killSignal?: NodeJS.Signals | number | undefined;
|
| 633 |
+
/**
|
| 634 |
+
* In milliseconds the maximum amount of time the process is allowed to run.
|
| 635 |
+
*/
|
| 636 |
+
timeout?: number | undefined;
|
| 637 |
+
}
|
| 638 |
+
interface ProcessEnvOptions {
|
| 639 |
+
uid?: number | undefined;
|
| 640 |
+
gid?: number | undefined;
|
| 641 |
+
cwd?: string | URL | undefined;
|
| 642 |
+
env?: NodeJS.ProcessEnv | undefined;
|
| 643 |
+
}
|
| 644 |
+
interface CommonOptions extends ProcessEnvOptions {
|
| 645 |
+
/**
|
| 646 |
+
* @default false
|
| 647 |
+
*/
|
| 648 |
+
windowsHide?: boolean | undefined;
|
| 649 |
+
/**
|
| 650 |
+
* @default 0
|
| 651 |
+
*/
|
| 652 |
+
timeout?: number | undefined;
|
| 653 |
+
}
|
| 654 |
+
interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable {
|
| 655 |
+
argv0?: string | undefined;
|
| 656 |
+
/**
|
| 657 |
+
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
|
| 658 |
+
* If passed as an array, the first element is used for `stdin`, the second for
|
| 659 |
+
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
| 660 |
+
* specify the `stdio` behavior beyond the standard streams. See
|
| 661 |
+
* {@link ChildProcess.stdio} for more information.
|
| 662 |
+
*
|
| 663 |
+
* @default 'pipe'
|
| 664 |
+
*/
|
| 665 |
+
stdio?: StdioOptions | undefined;
|
| 666 |
+
shell?: boolean | string | undefined;
|
| 667 |
+
windowsVerbatimArguments?: boolean | undefined;
|
| 668 |
+
}
|
| 669 |
+
interface SpawnOptions extends CommonSpawnOptions {
|
| 670 |
+
detached?: boolean | undefined;
|
| 671 |
+
}
|
| 672 |
+
interface SpawnOptionsWithoutStdio extends SpawnOptions {
|
| 673 |
+
stdio?: StdioPipeNamed | StdioPipe[] | undefined;
|
| 674 |
+
}
|
| 675 |
+
type StdioNull = "inherit" | "ignore" | Stream;
|
| 676 |
+
type StdioPipeNamed = "pipe" | "overlapped";
|
| 677 |
+
type StdioPipe = undefined | null | StdioPipeNamed;
|
| 678 |
+
interface SpawnOptionsWithStdioTuple<
|
| 679 |
+
Stdin extends StdioNull | StdioPipe,
|
| 680 |
+
Stdout extends StdioNull | StdioPipe,
|
| 681 |
+
Stderr extends StdioNull | StdioPipe,
|
| 682 |
+
> extends SpawnOptions {
|
| 683 |
+
stdio: [Stdin, Stdout, Stderr];
|
| 684 |
+
}
|
| 685 |
+
/**
|
| 686 |
+
* The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults
|
| 687 |
+
* to an empty array.
|
| 688 |
+
*
|
| 689 |
+
* **If the `shell` option is enabled, do not pass unsanitized user input to this**
|
| 690 |
+
* **function. Any input containing shell metacharacters may be used to trigger**
|
| 691 |
+
* **arbitrary command execution.**
|
| 692 |
+
*
|
| 693 |
+
* A third argument may be used to specify additional options, with these defaults:
|
| 694 |
+
*
|
| 695 |
+
* ```js
|
| 696 |
+
* const defaults = {
|
| 697 |
+
* cwd: undefined,
|
| 698 |
+
* env: process.env,
|
| 699 |
+
* };
|
| 700 |
+
* ```
|
| 701 |
+
*
|
| 702 |
+
* Use `cwd` to specify the working directory from which the process is spawned.
|
| 703 |
+
* If not given, the default is to inherit the current working directory. If given,
|
| 704 |
+
* but the path does not exist, the child process emits an `ENOENT` error
|
| 705 |
+
* and exits immediately. `ENOENT` is also emitted when the command
|
| 706 |
+
* does not exist.
|
| 707 |
+
*
|
| 708 |
+
* Use `env` to specify environment variables that will be visible to the new
|
| 709 |
+
* process, the default is `process.env`.
|
| 710 |
+
*
|
| 711 |
+
* `undefined` values in `env` will be ignored.
|
| 712 |
+
*
|
| 713 |
+
* Example of running `ls -lh /usr`, capturing `stdout`, `stderr`, and the
|
| 714 |
+
* exit code:
|
| 715 |
+
*
|
| 716 |
+
* ```js
|
| 717 |
+
* import { spawn } from 'node:child_process';
|
| 718 |
+
* const ls = spawn('ls', ['-lh', '/usr']);
|
| 719 |
+
*
|
| 720 |
+
* ls.stdout.on('data', (data) => {
|
| 721 |
+
* console.log(`stdout: ${data}`);
|
| 722 |
+
* });
|
| 723 |
+
*
|
| 724 |
+
* ls.stderr.on('data', (data) => {
|
| 725 |
+
* console.error(`stderr: ${data}`);
|
| 726 |
+
* });
|
| 727 |
+
*
|
| 728 |
+
* ls.on('close', (code) => {
|
| 729 |
+
* console.log(`child process exited with code ${code}`);
|
| 730 |
+
* });
|
| 731 |
+
* ```
|
| 732 |
+
*
|
| 733 |
+
* Example: A very elaborate way to run `ps ax | grep ssh`
|
| 734 |
+
*
|
| 735 |
+
* ```js
|
| 736 |
+
* import { spawn } from 'node:child_process';
|
| 737 |
+
* const ps = spawn('ps', ['ax']);
|
| 738 |
+
* const grep = spawn('grep', ['ssh']);
|
| 739 |
+
*
|
| 740 |
+
* ps.stdout.on('data', (data) => {
|
| 741 |
+
* grep.stdin.write(data);
|
| 742 |
+
* });
|
| 743 |
+
*
|
| 744 |
+
* ps.stderr.on('data', (data) => {
|
| 745 |
+
* console.error(`ps stderr: ${data}`);
|
| 746 |
+
* });
|
| 747 |
+
*
|
| 748 |
+
* ps.on('close', (code) => {
|
| 749 |
+
* if (code !== 0) {
|
| 750 |
+
* console.log(`ps process exited with code ${code}`);
|
| 751 |
+
* }
|
| 752 |
+
* grep.stdin.end();
|
| 753 |
+
* });
|
| 754 |
+
*
|
| 755 |
+
* grep.stdout.on('data', (data) => {
|
| 756 |
+
* console.log(data.toString());
|
| 757 |
+
* });
|
| 758 |
+
*
|
| 759 |
+
* grep.stderr.on('data', (data) => {
|
| 760 |
+
* console.error(`grep stderr: ${data}`);
|
| 761 |
+
* });
|
| 762 |
+
*
|
| 763 |
+
* grep.on('close', (code) => {
|
| 764 |
+
* if (code !== 0) {
|
| 765 |
+
* console.log(`grep process exited with code ${code}`);
|
| 766 |
+
* }
|
| 767 |
+
* });
|
| 768 |
+
* ```
|
| 769 |
+
*
|
| 770 |
+
* Example of checking for failed `spawn`:
|
| 771 |
+
*
|
| 772 |
+
* ```js
|
| 773 |
+
* import { spawn } from 'node:child_process';
|
| 774 |
+
* const subprocess = spawn('bad_command');
|
| 775 |
+
*
|
| 776 |
+
* subprocess.on('error', (err) => {
|
| 777 |
+
* console.error('Failed to start subprocess.');
|
| 778 |
+
* });
|
| 779 |
+
* ```
|
| 780 |
+
*
|
| 781 |
+
* Certain platforms (macOS, Linux) will use the value of `argv[0]` for the process
|
| 782 |
+
* title while others (Windows, SunOS) will use `command`.
|
| 783 |
+
*
|
| 784 |
+
* Node.js overwrites `argv[0]` with `process.execPath` on startup, so `process.argv[0]` in a Node.js child process will not match the `argv0` parameter passed to `spawn` from the parent. Retrieve
|
| 785 |
+
* it with the `process.argv0` property instead.
|
| 786 |
+
*
|
| 787 |
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
|
| 788 |
+
* the error passed to the callback will be an `AbortError`:
|
| 789 |
+
*
|
| 790 |
+
* ```js
|
| 791 |
+
* import { spawn } from 'node:child_process';
|
| 792 |
+
* const controller = new AbortController();
|
| 793 |
+
* const { signal } = controller;
|
| 794 |
+
* const grep = spawn('grep', ['ssh'], { signal });
|
| 795 |
+
* grep.on('error', (err) => {
|
| 796 |
+
* // This will be called with err being an AbortError if the controller aborts
|
| 797 |
+
* });
|
| 798 |
+
* controller.abort(); // Stops the child process
|
| 799 |
+
* ```
|
| 800 |
+
* @since v0.1.90
|
| 801 |
+
* @param command The command to run.
|
| 802 |
+
* @param args List of string arguments.
|
| 803 |
+
*/
|
| 804 |
+
function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
|
| 805 |
+
function spawn(
|
| 806 |
+
command: string,
|
| 807 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
|
| 808 |
+
): ChildProcessByStdio<Writable, Readable, Readable>;
|
| 809 |
+
function spawn(
|
| 810 |
+
command: string,
|
| 811 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
|
| 812 |
+
): ChildProcessByStdio<Writable, Readable, null>;
|
| 813 |
+
function spawn(
|
| 814 |
+
command: string,
|
| 815 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
|
| 816 |
+
): ChildProcessByStdio<Writable, null, Readable>;
|
| 817 |
+
function spawn(
|
| 818 |
+
command: string,
|
| 819 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
|
| 820 |
+
): ChildProcessByStdio<null, Readable, Readable>;
|
| 821 |
+
function spawn(
|
| 822 |
+
command: string,
|
| 823 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
|
| 824 |
+
): ChildProcessByStdio<Writable, null, null>;
|
| 825 |
+
function spawn(
|
| 826 |
+
command: string,
|
| 827 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
|
| 828 |
+
): ChildProcessByStdio<null, Readable, null>;
|
| 829 |
+
function spawn(
|
| 830 |
+
command: string,
|
| 831 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
|
| 832 |
+
): ChildProcessByStdio<null, null, Readable>;
|
| 833 |
+
function spawn(
|
| 834 |
+
command: string,
|
| 835 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
|
| 836 |
+
): ChildProcessByStdio<null, null, null>;
|
| 837 |
+
function spawn(command: string, options: SpawnOptions): ChildProcess;
|
| 838 |
+
// overloads of spawn with 'args'
|
| 839 |
+
function spawn(
|
| 840 |
+
command: string,
|
| 841 |
+
args?: readonly string[],
|
| 842 |
+
options?: SpawnOptionsWithoutStdio,
|
| 843 |
+
): ChildProcessWithoutNullStreams;
|
| 844 |
+
function spawn(
|
| 845 |
+
command: string,
|
| 846 |
+
args: readonly string[],
|
| 847 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
|
| 848 |
+
): ChildProcessByStdio<Writable, Readable, Readable>;
|
| 849 |
+
function spawn(
|
| 850 |
+
command: string,
|
| 851 |
+
args: readonly string[],
|
| 852 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
|
| 853 |
+
): ChildProcessByStdio<Writable, Readable, null>;
|
| 854 |
+
function spawn(
|
| 855 |
+
command: string,
|
| 856 |
+
args: readonly string[],
|
| 857 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
|
| 858 |
+
): ChildProcessByStdio<Writable, null, Readable>;
|
| 859 |
+
function spawn(
|
| 860 |
+
command: string,
|
| 861 |
+
args: readonly string[],
|
| 862 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
|
| 863 |
+
): ChildProcessByStdio<null, Readable, Readable>;
|
| 864 |
+
function spawn(
|
| 865 |
+
command: string,
|
| 866 |
+
args: readonly string[],
|
| 867 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
|
| 868 |
+
): ChildProcessByStdio<Writable, null, null>;
|
| 869 |
+
function spawn(
|
| 870 |
+
command: string,
|
| 871 |
+
args: readonly string[],
|
| 872 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
|
| 873 |
+
): ChildProcessByStdio<null, Readable, null>;
|
| 874 |
+
function spawn(
|
| 875 |
+
command: string,
|
| 876 |
+
args: readonly string[],
|
| 877 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
|
| 878 |
+
): ChildProcessByStdio<null, null, Readable>;
|
| 879 |
+
function spawn(
|
| 880 |
+
command: string,
|
| 881 |
+
args: readonly string[],
|
| 882 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
|
| 883 |
+
): ChildProcessByStdio<null, null, null>;
|
| 884 |
+
function spawn(command: string, args: readonly string[], options: SpawnOptions): ChildProcess;
|
| 885 |
+
interface ExecOptions extends CommonOptions {
|
| 886 |
+
shell?: string | undefined;
|
| 887 |
+
signal?: AbortSignal | undefined;
|
| 888 |
+
maxBuffer?: number | undefined;
|
| 889 |
+
killSignal?: NodeJS.Signals | number | undefined;
|
| 890 |
+
}
|
| 891 |
+
interface ExecOptionsWithStringEncoding extends ExecOptions {
|
| 892 |
+
encoding: BufferEncoding;
|
| 893 |
+
}
|
| 894 |
+
interface ExecOptionsWithBufferEncoding extends ExecOptions {
|
| 895 |
+
encoding: BufferEncoding | null; // specify `null`.
|
| 896 |
+
}
|
| 897 |
+
interface ExecException extends Error {
|
| 898 |
+
cmd?: string | undefined;
|
| 899 |
+
killed?: boolean | undefined;
|
| 900 |
+
code?: number | undefined;
|
| 901 |
+
signal?: NodeJS.Signals | undefined;
|
| 902 |
+
stdout?: string;
|
| 903 |
+
stderr?: string;
|
| 904 |
+
}
|
| 905 |
+
/**
|
| 906 |
+
* Spawns a shell then executes the `command` within that shell, buffering any
|
| 907 |
+
* generated output. The `command` string passed to the exec function is processed
|
| 908 |
+
* directly by the shell and special characters (vary based on [shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters))
|
| 909 |
+
* need to be dealt with accordingly:
|
| 910 |
+
*
|
| 911 |
+
* ```js
|
| 912 |
+
* import { exec } from 'node:child_process';
|
| 913 |
+
*
|
| 914 |
+
* exec('"/path/to/test file/test.sh" arg1 arg2');
|
| 915 |
+
* // Double quotes are used so that the space in the path is not interpreted as
|
| 916 |
+
* // a delimiter of multiple arguments.
|
| 917 |
+
*
|
| 918 |
+
* exec('echo "The \\$HOME variable is $HOME"');
|
| 919 |
+
* // The $HOME variable is escaped in the first instance, but not in the second.
|
| 920 |
+
* ```
|
| 921 |
+
*
|
| 922 |
+
* **Never pass unsanitized user input to this function. Any input containing shell**
|
| 923 |
+
* **metacharacters may be used to trigger arbitrary command execution.**
|
| 924 |
+
*
|
| 925 |
+
* If a `callback` function is provided, it is called with the arguments `(error, stdout, stderr)`. On success, `error` will be `null`. On error, `error` will be an instance of `Error`. The
|
| 926 |
+
* `error.code` property will be
|
| 927 |
+
* the exit code of the process. By convention, any exit code other than `0` indicates an error. `error.signal` will be the signal that terminated the
|
| 928 |
+
* process.
|
| 929 |
+
*
|
| 930 |
+
* The `stdout` and `stderr` arguments passed to the callback will contain the
|
| 931 |
+
* stdout and stderr output of the child process. By default, Node.js will decode
|
| 932 |
+
* the output as UTF-8 and pass strings to the callback. The `encoding` option
|
| 933 |
+
* can be used to specify the character encoding used to decode the stdout and
|
| 934 |
+
* stderr output. If `encoding` is `'buffer'`, or an unrecognized character
|
| 935 |
+
* encoding, `Buffer` objects will be passed to the callback instead.
|
| 936 |
+
*
|
| 937 |
+
* ```js
|
| 938 |
+
* import { exec } from 'node:child_process';
|
| 939 |
+
* exec('cat *.js missing_file | wc -l', (error, stdout, stderr) => {
|
| 940 |
+
* if (error) {
|
| 941 |
+
* console.error(`exec error: ${error}`);
|
| 942 |
+
* return;
|
| 943 |
+
* }
|
| 944 |
+
* console.log(`stdout: ${stdout}`);
|
| 945 |
+
* console.error(`stderr: ${stderr}`);
|
| 946 |
+
* });
|
| 947 |
+
* ```
|
| 948 |
+
*
|
| 949 |
+
* If `timeout` is greater than `0`, the parent will send the signal
|
| 950 |
+
* identified by the `killSignal` property (the default is `'SIGTERM'`) if the
|
| 951 |
+
* child runs longer than `timeout` milliseconds.
|
| 952 |
+
*
|
| 953 |
+
* Unlike the [`exec(3)`](http://man7.org/linux/man-pages/man3/exec.3.html) POSIX system call, `child_process.exec()` does not replace
|
| 954 |
+
* the existing process and uses a shell to execute the command.
|
| 955 |
+
*
|
| 956 |
+
* If this method is invoked as its `util.promisify()` ed version, it returns
|
| 957 |
+
* a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned `ChildProcess` instance is attached to the `Promise` as a `child` property. In
|
| 958 |
+
* case of an error (including any error resulting in an exit code other than 0), a
|
| 959 |
+
* rejected promise is returned, with the same `error` object given in the
|
| 960 |
+
* callback, but with two additional properties `stdout` and `stderr`.
|
| 961 |
+
*
|
| 962 |
+
* ```js
|
| 963 |
+
* import util from 'node:util';
|
| 964 |
+
* import child_process from 'node:child_process';
|
| 965 |
+
* const exec = util.promisify(child_process.exec);
|
| 966 |
+
*
|
| 967 |
+
* async function lsExample() {
|
| 968 |
+
* const { stdout, stderr } = await exec('ls');
|
| 969 |
+
* console.log('stdout:', stdout);
|
| 970 |
+
* console.error('stderr:', stderr);
|
| 971 |
+
* }
|
| 972 |
+
* lsExample();
|
| 973 |
+
* ```
|
| 974 |
+
*
|
| 975 |
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
|
| 976 |
+
* the error passed to the callback will be an `AbortError`:
|
| 977 |
+
*
|
| 978 |
+
* ```js
|
| 979 |
+
* import { exec } from 'node:child_process';
|
| 980 |
+
* const controller = new AbortController();
|
| 981 |
+
* const { signal } = controller;
|
| 982 |
+
* const child = exec('grep ssh', { signal }, (error) => {
|
| 983 |
+
* console.error(error); // an AbortError
|
| 984 |
+
* });
|
| 985 |
+
* controller.abort();
|
| 986 |
+
* ```
|
| 987 |
+
* @since v0.1.90
|
| 988 |
+
* @param command The command to run, with space-separated arguments.
|
| 989 |
+
* @param callback called with the output when process terminates.
|
| 990 |
+
*/
|
| 991 |
+
function exec(
|
| 992 |
+
command: string,
|
| 993 |
+
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
| 994 |
+
): ChildProcess;
|
| 995 |
+
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
| 996 |
+
function exec(
|
| 997 |
+
command: string,
|
| 998 |
+
options: {
|
| 999 |
+
encoding: "buffer" | null;
|
| 1000 |
+
} & ExecOptions,
|
| 1001 |
+
callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void,
|
| 1002 |
+
): ChildProcess;
|
| 1003 |
+
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
|
| 1004 |
+
function exec(
|
| 1005 |
+
command: string,
|
| 1006 |
+
options: {
|
| 1007 |
+
encoding: BufferEncoding;
|
| 1008 |
+
} & ExecOptions,
|
| 1009 |
+
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
| 1010 |
+
): ChildProcess;
|
| 1011 |
+
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
| 1012 |
+
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
| 1013 |
+
function exec(
|
| 1014 |
+
command: string,
|
| 1015 |
+
options: {
|
| 1016 |
+
encoding: BufferEncoding;
|
| 1017 |
+
} & ExecOptions,
|
| 1018 |
+
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
| 1019 |
+
): ChildProcess;
|
| 1020 |
+
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
| 1021 |
+
function exec(
|
| 1022 |
+
command: string,
|
| 1023 |
+
options: ExecOptions,
|
| 1024 |
+
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
| 1025 |
+
): ChildProcess;
|
| 1026 |
+
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
| 1027 |
+
function exec(
|
| 1028 |
+
command: string,
|
| 1029 |
+
options: (ObjectEncodingOptions & ExecOptions) | undefined | null,
|
| 1030 |
+
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
| 1031 |
+
): ChildProcess;
|
| 1032 |
+
interface PromiseWithChild<T> extends Promise<T> {
|
| 1033 |
+
child: ChildProcess;
|
| 1034 |
+
}
|
| 1035 |
+
namespace exec {
|
| 1036 |
+
function __promisify__(command: string): PromiseWithChild<{
|
| 1037 |
+
stdout: string;
|
| 1038 |
+
stderr: string;
|
| 1039 |
+
}>;
|
| 1040 |
+
function __promisify__(
|
| 1041 |
+
command: string,
|
| 1042 |
+
options: {
|
| 1043 |
+
encoding: "buffer" | null;
|
| 1044 |
+
} & ExecOptions,
|
| 1045 |
+
): PromiseWithChild<{
|
| 1046 |
+
stdout: Buffer;
|
| 1047 |
+
stderr: Buffer;
|
| 1048 |
+
}>;
|
| 1049 |
+
function __promisify__(
|
| 1050 |
+
command: string,
|
| 1051 |
+
options: {
|
| 1052 |
+
encoding: BufferEncoding;
|
| 1053 |
+
} & ExecOptions,
|
| 1054 |
+
): PromiseWithChild<{
|
| 1055 |
+
stdout: string;
|
| 1056 |
+
stderr: string;
|
| 1057 |
+
}>;
|
| 1058 |
+
function __promisify__(
|
| 1059 |
+
command: string,
|
| 1060 |
+
options: ExecOptions,
|
| 1061 |
+
): PromiseWithChild<{
|
| 1062 |
+
stdout: string;
|
| 1063 |
+
stderr: string;
|
| 1064 |
+
}>;
|
| 1065 |
+
function __promisify__(
|
| 1066 |
+
command: string,
|
| 1067 |
+
options?: (ObjectEncodingOptions & ExecOptions) | null,
|
| 1068 |
+
): PromiseWithChild<{
|
| 1069 |
+
stdout: string | Buffer;
|
| 1070 |
+
stderr: string | Buffer;
|
| 1071 |
+
}>;
|
| 1072 |
+
}
|
| 1073 |
+
interface ExecFileOptions extends CommonOptions, Abortable {
|
| 1074 |
+
maxBuffer?: number | undefined;
|
| 1075 |
+
killSignal?: NodeJS.Signals | number | undefined;
|
| 1076 |
+
windowsVerbatimArguments?: boolean | undefined;
|
| 1077 |
+
shell?: boolean | string | undefined;
|
| 1078 |
+
signal?: AbortSignal | undefined;
|
| 1079 |
+
}
|
| 1080 |
+
interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
|
| 1081 |
+
encoding: BufferEncoding;
|
| 1082 |
+
}
|
| 1083 |
+
interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
|
| 1084 |
+
encoding: "buffer" | null;
|
| 1085 |
+
}
|
| 1086 |
+
interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {
|
| 1087 |
+
encoding: BufferEncoding;
|
| 1088 |
+
}
|
| 1089 |
+
type ExecFileException =
|
| 1090 |
+
& Omit<ExecException, "code">
|
| 1091 |
+
& Omit<NodeJS.ErrnoException, "code">
|
| 1092 |
+
& { code?: string | number | undefined | null };
|
| 1093 |
+
/**
|
| 1094 |
+
* The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified
|
| 1095 |
+
* executable `file` is spawned directly as a new process making it slightly more
|
| 1096 |
+
* efficient than {@link exec}.
|
| 1097 |
+
*
|
| 1098 |
+
* The same options as {@link exec} are supported. Since a shell is
|
| 1099 |
+
* not spawned, behaviors such as I/O redirection and file globbing are not
|
| 1100 |
+
* supported.
|
| 1101 |
+
*
|
| 1102 |
+
* ```js
|
| 1103 |
+
* import { execFile } from 'node:child_process';
|
| 1104 |
+
* const child = execFile('node', ['--version'], (error, stdout, stderr) => {
|
| 1105 |
+
* if (error) {
|
| 1106 |
+
* throw error;
|
| 1107 |
+
* }
|
| 1108 |
+
* console.log(stdout);
|
| 1109 |
+
* });
|
| 1110 |
+
* ```
|
| 1111 |
+
*
|
| 1112 |
+
* The `stdout` and `stderr` arguments passed to the callback will contain the
|
| 1113 |
+
* stdout and stderr output of the child process. By default, Node.js will decode
|
| 1114 |
+
* the output as UTF-8 and pass strings to the callback. The `encoding` option
|
| 1115 |
+
* can be used to specify the character encoding used to decode the stdout and
|
| 1116 |
+
* stderr output. If `encoding` is `'buffer'`, or an unrecognized character
|
| 1117 |
+
* encoding, `Buffer` objects will be passed to the callback instead.
|
| 1118 |
+
*
|
| 1119 |
+
* If this method is invoked as its `util.promisify()` ed version, it returns
|
| 1120 |
+
* a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned `ChildProcess` instance is attached to the `Promise` as a `child` property. In
|
| 1121 |
+
* case of an error (including any error resulting in an exit code other than 0), a
|
| 1122 |
+
* rejected promise is returned, with the same `error` object given in the
|
| 1123 |
+
* callback, but with two additional properties `stdout` and `stderr`.
|
| 1124 |
+
*
|
| 1125 |
+
* ```js
|
| 1126 |
+
* import util from 'node:util';
|
| 1127 |
+
* import child_process from 'node:child_process';
|
| 1128 |
+
* const execFile = util.promisify(child_process.execFile);
|
| 1129 |
+
* async function getVersion() {
|
| 1130 |
+
* const { stdout } = await execFile('node', ['--version']);
|
| 1131 |
+
* console.log(stdout);
|
| 1132 |
+
* }
|
| 1133 |
+
* getVersion();
|
| 1134 |
+
* ```
|
| 1135 |
+
*
|
| 1136 |
+
* **If the `shell` option is enabled, do not pass unsanitized user input to this**
|
| 1137 |
+
* **function. Any input containing shell metacharacters may be used to trigger**
|
| 1138 |
+
* **arbitrary command execution.**
|
| 1139 |
+
*
|
| 1140 |
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
|
| 1141 |
+
* the error passed to the callback will be an `AbortError`:
|
| 1142 |
+
*
|
| 1143 |
+
* ```js
|
| 1144 |
+
* import { execFile } from 'node:child_process';
|
| 1145 |
+
* const controller = new AbortController();
|
| 1146 |
+
* const { signal } = controller;
|
| 1147 |
+
* const child = execFile('node', ['--version'], { signal }, (error) => {
|
| 1148 |
+
* console.error(error); // an AbortError
|
| 1149 |
+
* });
|
| 1150 |
+
* controller.abort();
|
| 1151 |
+
* ```
|
| 1152 |
+
* @since v0.1.91
|
| 1153 |
+
* @param file The name or path of the executable file to run.
|
| 1154 |
+
* @param args List of string arguments.
|
| 1155 |
+
* @param callback Called with the output when process terminates.
|
| 1156 |
+
*/
|
| 1157 |
+
function execFile(file: string): ChildProcess;
|
| 1158 |
+
function execFile(
|
| 1159 |
+
file: string,
|
| 1160 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
| 1161 |
+
): ChildProcess;
|
| 1162 |
+
function execFile(file: string, args?: readonly string[] | null): ChildProcess;
|
| 1163 |
+
function execFile(
|
| 1164 |
+
file: string,
|
| 1165 |
+
args: readonly string[] | undefined | null,
|
| 1166 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
| 1167 |
+
): ChildProcess;
|
| 1168 |
+
// no `options` definitely means stdout/stderr are `string`.
|
| 1169 |
+
function execFile(
|
| 1170 |
+
file: string,
|
| 1171 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
| 1172 |
+
): ChildProcess;
|
| 1173 |
+
function execFile(
|
| 1174 |
+
file: string,
|
| 1175 |
+
args: readonly string[] | undefined | null,
|
| 1176 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
| 1177 |
+
): ChildProcess;
|
| 1178 |
+
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
| 1179 |
+
function execFile(
|
| 1180 |
+
file: string,
|
| 1181 |
+
options: ExecFileOptionsWithBufferEncoding,
|
| 1182 |
+
callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
|
| 1183 |
+
): ChildProcess;
|
| 1184 |
+
function execFile(
|
| 1185 |
+
file: string,
|
| 1186 |
+
args: readonly string[] | undefined | null,
|
| 1187 |
+
options: ExecFileOptionsWithBufferEncoding,
|
| 1188 |
+
callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
|
| 1189 |
+
): ChildProcess;
|
| 1190 |
+
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
|
| 1191 |
+
function execFile(
|
| 1192 |
+
file: string,
|
| 1193 |
+
options: ExecFileOptionsWithStringEncoding,
|
| 1194 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
| 1195 |
+
): ChildProcess;
|
| 1196 |
+
function execFile(
|
| 1197 |
+
file: string,
|
| 1198 |
+
args: readonly string[] | undefined | null,
|
| 1199 |
+
options: ExecFileOptionsWithStringEncoding,
|
| 1200 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
| 1201 |
+
): ChildProcess;
|
| 1202 |
+
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
| 1203 |
+
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
| 1204 |
+
function execFile(
|
| 1205 |
+
file: string,
|
| 1206 |
+
options: ExecFileOptionsWithOtherEncoding,
|
| 1207 |
+
callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
| 1208 |
+
): ChildProcess;
|
| 1209 |
+
function execFile(
|
| 1210 |
+
file: string,
|
| 1211 |
+
args: readonly string[] | undefined | null,
|
| 1212 |
+
options: ExecFileOptionsWithOtherEncoding,
|
| 1213 |
+
callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
| 1214 |
+
): ChildProcess;
|
| 1215 |
+
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
| 1216 |
+
function execFile(
|
| 1217 |
+
file: string,
|
| 1218 |
+
options: ExecFileOptions,
|
| 1219 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
| 1220 |
+
): ChildProcess;
|
| 1221 |
+
function execFile(
|
| 1222 |
+
file: string,
|
| 1223 |
+
args: readonly string[] | undefined | null,
|
| 1224 |
+
options: ExecFileOptions,
|
| 1225 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
| 1226 |
+
): ChildProcess;
|
| 1227 |
+
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
| 1228 |
+
function execFile(
|
| 1229 |
+
file: string,
|
| 1230 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
| 1231 |
+
callback:
|
| 1232 |
+
| ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
|
| 1233 |
+
| undefined
|
| 1234 |
+
| null,
|
| 1235 |
+
): ChildProcess;
|
| 1236 |
+
function execFile(
|
| 1237 |
+
file: string,
|
| 1238 |
+
args: readonly string[] | undefined | null,
|
| 1239 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
| 1240 |
+
callback:
|
| 1241 |
+
| ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
|
| 1242 |
+
| undefined
|
| 1243 |
+
| null,
|
| 1244 |
+
): ChildProcess;
|
| 1245 |
+
namespace execFile {
|
| 1246 |
+
function __promisify__(file: string): PromiseWithChild<{
|
| 1247 |
+
stdout: string;
|
| 1248 |
+
stderr: string;
|
| 1249 |
+
}>;
|
| 1250 |
+
function __promisify__(
|
| 1251 |
+
file: string,
|
| 1252 |
+
args: readonly string[] | undefined | null,
|
| 1253 |
+
): PromiseWithChild<{
|
| 1254 |
+
stdout: string;
|
| 1255 |
+
stderr: string;
|
| 1256 |
+
}>;
|
| 1257 |
+
function __promisify__(
|
| 1258 |
+
file: string,
|
| 1259 |
+
options: ExecFileOptionsWithBufferEncoding,
|
| 1260 |
+
): PromiseWithChild<{
|
| 1261 |
+
stdout: Buffer;
|
| 1262 |
+
stderr: Buffer;
|
| 1263 |
+
}>;
|
| 1264 |
+
function __promisify__(
|
| 1265 |
+
file: string,
|
| 1266 |
+
args: readonly string[] | undefined | null,
|
| 1267 |
+
options: ExecFileOptionsWithBufferEncoding,
|
| 1268 |
+
): PromiseWithChild<{
|
| 1269 |
+
stdout: Buffer;
|
| 1270 |
+
stderr: Buffer;
|
| 1271 |
+
}>;
|
| 1272 |
+
function __promisify__(
|
| 1273 |
+
file: string,
|
| 1274 |
+
options: ExecFileOptionsWithStringEncoding,
|
| 1275 |
+
): PromiseWithChild<{
|
| 1276 |
+
stdout: string;
|
| 1277 |
+
stderr: string;
|
| 1278 |
+
}>;
|
| 1279 |
+
function __promisify__(
|
| 1280 |
+
file: string,
|
| 1281 |
+
args: readonly string[] | undefined | null,
|
| 1282 |
+
options: ExecFileOptionsWithStringEncoding,
|
| 1283 |
+
): PromiseWithChild<{
|
| 1284 |
+
stdout: string;
|
| 1285 |
+
stderr: string;
|
| 1286 |
+
}>;
|
| 1287 |
+
function __promisify__(
|
| 1288 |
+
file: string,
|
| 1289 |
+
options: ExecFileOptionsWithOtherEncoding,
|
| 1290 |
+
): PromiseWithChild<{
|
| 1291 |
+
stdout: string | Buffer;
|
| 1292 |
+
stderr: string | Buffer;
|
| 1293 |
+
}>;
|
| 1294 |
+
function __promisify__(
|
| 1295 |
+
file: string,
|
| 1296 |
+
args: readonly string[] | undefined | null,
|
| 1297 |
+
options: ExecFileOptionsWithOtherEncoding,
|
| 1298 |
+
): PromiseWithChild<{
|
| 1299 |
+
stdout: string | Buffer;
|
| 1300 |
+
stderr: string | Buffer;
|
| 1301 |
+
}>;
|
| 1302 |
+
function __promisify__(
|
| 1303 |
+
file: string,
|
| 1304 |
+
options: ExecFileOptions,
|
| 1305 |
+
): PromiseWithChild<{
|
| 1306 |
+
stdout: string;
|
| 1307 |
+
stderr: string;
|
| 1308 |
+
}>;
|
| 1309 |
+
function __promisify__(
|
| 1310 |
+
file: string,
|
| 1311 |
+
args: readonly string[] | undefined | null,
|
| 1312 |
+
options: ExecFileOptions,
|
| 1313 |
+
): PromiseWithChild<{
|
| 1314 |
+
stdout: string;
|
| 1315 |
+
stderr: string;
|
| 1316 |
+
}>;
|
| 1317 |
+
function __promisify__(
|
| 1318 |
+
file: string,
|
| 1319 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
| 1320 |
+
): PromiseWithChild<{
|
| 1321 |
+
stdout: string | Buffer;
|
| 1322 |
+
stderr: string | Buffer;
|
| 1323 |
+
}>;
|
| 1324 |
+
function __promisify__(
|
| 1325 |
+
file: string,
|
| 1326 |
+
args: readonly string[] | undefined | null,
|
| 1327 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
| 1328 |
+
): PromiseWithChild<{
|
| 1329 |
+
stdout: string | Buffer;
|
| 1330 |
+
stderr: string | Buffer;
|
| 1331 |
+
}>;
|
| 1332 |
+
}
|
| 1333 |
+
interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable {
|
| 1334 |
+
execPath?: string | undefined;
|
| 1335 |
+
execArgv?: string[] | undefined;
|
| 1336 |
+
silent?: boolean | undefined;
|
| 1337 |
+
/**
|
| 1338 |
+
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
|
| 1339 |
+
* If passed as an array, the first element is used for `stdin`, the second for
|
| 1340 |
+
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
| 1341 |
+
* specify the `stdio` behavior beyond the standard streams. See
|
| 1342 |
+
* {@link ChildProcess.stdio} for more information.
|
| 1343 |
+
*
|
| 1344 |
+
* @default 'pipe'
|
| 1345 |
+
*/
|
| 1346 |
+
stdio?: StdioOptions | undefined;
|
| 1347 |
+
detached?: boolean | undefined;
|
| 1348 |
+
windowsVerbatimArguments?: boolean | undefined;
|
| 1349 |
+
}
|
| 1350 |
+
/**
|
| 1351 |
+
* The `child_process.fork()` method is a special case of {@link spawn} used specifically to spawn new Node.js processes.
|
| 1352 |
+
* Like {@link spawn}, a `ChildProcess` object is returned. The
|
| 1353 |
+
* returned `ChildProcess` will have an additional communication channel
|
| 1354 |
+
* built-in that allows messages to be passed back and forth between the parent and
|
| 1355 |
+
* child. See `subprocess.send()` for details.
|
| 1356 |
+
*
|
| 1357 |
+
* Keep in mind that spawned Node.js child processes are
|
| 1358 |
+
* independent of the parent with exception of the IPC communication channel
|
| 1359 |
+
* that is established between the two. Each process has its own memory, with
|
| 1360 |
+
* their own V8 instances. Because of the additional resource allocations
|
| 1361 |
+
* required, spawning a large number of child Node.js processes is not
|
| 1362 |
+
* recommended.
|
| 1363 |
+
*
|
| 1364 |
+
* By default, `child_process.fork()` will spawn new Node.js instances using the `process.execPath` of the parent process. The `execPath` property in the `options` object allows for an alternative
|
| 1365 |
+
* execution path to be used.
|
| 1366 |
+
*
|
| 1367 |
+
* Node.js processes launched with a custom `execPath` will communicate with the
|
| 1368 |
+
* parent process using the file descriptor (fd) identified using the
|
| 1369 |
+
* environment variable `NODE_CHANNEL_FD` on the child process.
|
| 1370 |
+
*
|
| 1371 |
+
* Unlike the [`fork(2)`](http://man7.org/linux/man-pages/man2/fork.2.html) POSIX system call, `child_process.fork()` does not clone the
|
| 1372 |
+
* current process.
|
| 1373 |
+
*
|
| 1374 |
+
* The `shell` option available in {@link spawn} is not supported by `child_process.fork()` and will be ignored if set.
|
| 1375 |
+
*
|
| 1376 |
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
|
| 1377 |
+
* the error passed to the callback will be an `AbortError`:
|
| 1378 |
+
*
|
| 1379 |
+
* ```js
|
| 1380 |
+
* if (process.argv[2] === 'child') {
|
| 1381 |
+
* setTimeout(() => {
|
| 1382 |
+
* console.log(`Hello from ${process.argv[2]}!`);
|
| 1383 |
+
* }, 1_000);
|
| 1384 |
+
* } else {
|
| 1385 |
+
* import { fork } from 'node:child_process';
|
| 1386 |
+
* const controller = new AbortController();
|
| 1387 |
+
* const { signal } = controller;
|
| 1388 |
+
* const child = fork(__filename, ['child'], { signal });
|
| 1389 |
+
* child.on('error', (err) => {
|
| 1390 |
+
* // This will be called with err being an AbortError if the controller aborts
|
| 1391 |
+
* });
|
| 1392 |
+
* controller.abort(); // Stops the child process
|
| 1393 |
+
* }
|
| 1394 |
+
* ```
|
| 1395 |
+
* @since v0.5.0
|
| 1396 |
+
* @param modulePath The module to run in the child.
|
| 1397 |
+
* @param args List of string arguments.
|
| 1398 |
+
*/
|
| 1399 |
+
function fork(modulePath: string | URL, options?: ForkOptions): ChildProcess;
|
| 1400 |
+
function fork(modulePath: string | URL, args?: readonly string[], options?: ForkOptions): ChildProcess;
|
| 1401 |
+
interface SpawnSyncOptions extends CommonSpawnOptions {
|
| 1402 |
+
input?: string | NodeJS.ArrayBufferView | undefined;
|
| 1403 |
+
maxBuffer?: number | undefined;
|
| 1404 |
+
encoding?: BufferEncoding | "buffer" | null | undefined;
|
| 1405 |
+
}
|
| 1406 |
+
interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
|
| 1407 |
+
encoding: BufferEncoding;
|
| 1408 |
+
}
|
| 1409 |
+
interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
|
| 1410 |
+
encoding?: "buffer" | null | undefined;
|
| 1411 |
+
}
|
| 1412 |
+
interface SpawnSyncReturns<T> {
|
| 1413 |
+
pid: number;
|
| 1414 |
+
output: Array<T | null>;
|
| 1415 |
+
stdout: T;
|
| 1416 |
+
stderr: T;
|
| 1417 |
+
status: number | null;
|
| 1418 |
+
signal: NodeJS.Signals | null;
|
| 1419 |
+
error?: Error | undefined;
|
| 1420 |
+
}
|
| 1421 |
+
/**
|
| 1422 |
+
* The `child_process.spawnSync()` method is generally identical to {@link spawn} with the exception that the function will not return
|
| 1423 |
+
* until the child process has fully closed. When a timeout has been encountered
|
| 1424 |
+
* and `killSignal` is sent, the method won't return until the process has
|
| 1425 |
+
* completely exited. If the process intercepts and handles the `SIGTERM` signal
|
| 1426 |
+
* and doesn't exit, the parent process will wait until the child process has
|
| 1427 |
+
* exited.
|
| 1428 |
+
*
|
| 1429 |
+
* **If the `shell` option is enabled, do not pass unsanitized user input to this**
|
| 1430 |
+
* **function. Any input containing shell metacharacters may be used to trigger**
|
| 1431 |
+
* **arbitrary command execution.**
|
| 1432 |
+
* @since v0.11.12
|
| 1433 |
+
* @param command The command to run.
|
| 1434 |
+
* @param args List of string arguments.
|
| 1435 |
+
*/
|
| 1436 |
+
function spawnSync(command: string): SpawnSyncReturns<Buffer>;
|
| 1437 |
+
function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
| 1438 |
+
function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
| 1439 |
+
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>;
|
| 1440 |
+
function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns<Buffer>;
|
| 1441 |
+
function spawnSync(
|
| 1442 |
+
command: string,
|
| 1443 |
+
args: readonly string[],
|
| 1444 |
+
options: SpawnSyncOptionsWithStringEncoding,
|
| 1445 |
+
): SpawnSyncReturns<string>;
|
| 1446 |
+
function spawnSync(
|
| 1447 |
+
command: string,
|
| 1448 |
+
args: readonly string[],
|
| 1449 |
+
options: SpawnSyncOptionsWithBufferEncoding,
|
| 1450 |
+
): SpawnSyncReturns<Buffer>;
|
| 1451 |
+
function spawnSync(
|
| 1452 |
+
command: string,
|
| 1453 |
+
args?: readonly string[],
|
| 1454 |
+
options?: SpawnSyncOptions,
|
| 1455 |
+
): SpawnSyncReturns<string | Buffer>;
|
| 1456 |
+
interface CommonExecOptions extends CommonOptions {
|
| 1457 |
+
input?: string | NodeJS.ArrayBufferView | undefined;
|
| 1458 |
+
/**
|
| 1459 |
+
* Can be set to 'pipe', 'inherit, or 'ignore', or an array of these strings.
|
| 1460 |
+
* If passed as an array, the first element is used for `stdin`, the second for
|
| 1461 |
+
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
| 1462 |
+
* specify the `stdio` behavior beyond the standard streams. See
|
| 1463 |
+
* {@link ChildProcess.stdio} for more information.
|
| 1464 |
+
*
|
| 1465 |
+
* @default 'pipe'
|
| 1466 |
+
*/
|
| 1467 |
+
stdio?: StdioOptions | undefined;
|
| 1468 |
+
killSignal?: NodeJS.Signals | number | undefined;
|
| 1469 |
+
maxBuffer?: number | undefined;
|
| 1470 |
+
encoding?: BufferEncoding | "buffer" | null | undefined;
|
| 1471 |
+
}
|
| 1472 |
+
interface ExecSyncOptions extends CommonExecOptions {
|
| 1473 |
+
shell?: string | undefined;
|
| 1474 |
+
}
|
| 1475 |
+
interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
|
| 1476 |
+
encoding: BufferEncoding;
|
| 1477 |
+
}
|
| 1478 |
+
interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
|
| 1479 |
+
encoding?: "buffer" | null | undefined;
|
| 1480 |
+
}
|
| 1481 |
+
/**
|
| 1482 |
+
* The `child_process.execSync()` method is generally identical to {@link exec} with the exception that the method will not return
|
| 1483 |
+
* until the child process has fully closed. When a timeout has been encountered
|
| 1484 |
+
* and `killSignal` is sent, the method won't return until the process has
|
| 1485 |
+
* completely exited. If the child process intercepts and handles the `SIGTERM` signal and doesn't exit, the parent process will wait until the child process
|
| 1486 |
+
* has exited.
|
| 1487 |
+
*
|
| 1488 |
+
* If the process times out or has a non-zero exit code, this method will throw.
|
| 1489 |
+
* The `Error` object will contain the entire result from {@link spawnSync}.
|
| 1490 |
+
*
|
| 1491 |
+
* **Never pass unsanitized user input to this function. Any input containing shell**
|
| 1492 |
+
* **metacharacters may be used to trigger arbitrary command execution.**
|
| 1493 |
+
* @since v0.11.12
|
| 1494 |
+
* @param command The command to run.
|
| 1495 |
+
* @return The stdout from the command.
|
| 1496 |
+
*/
|
| 1497 |
+
function execSync(command: string): Buffer;
|
| 1498 |
+
function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string;
|
| 1499 |
+
function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): Buffer;
|
| 1500 |
+
function execSync(command: string, options?: ExecSyncOptions): string | Buffer;
|
| 1501 |
+
interface ExecFileSyncOptions extends CommonExecOptions {
|
| 1502 |
+
shell?: boolean | string | undefined;
|
| 1503 |
+
}
|
| 1504 |
+
interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions {
|
| 1505 |
+
encoding: BufferEncoding;
|
| 1506 |
+
}
|
| 1507 |
+
interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
|
| 1508 |
+
encoding?: "buffer" | null; // specify `null`.
|
| 1509 |
+
}
|
| 1510 |
+
/**
|
| 1511 |
+
* The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not
|
| 1512 |
+
* return until the child process has fully closed. When a timeout has been
|
| 1513 |
+
* encountered and `killSignal` is sent, the method won't return until the process
|
| 1514 |
+
* has completely exited.
|
| 1515 |
+
*
|
| 1516 |
+
* If the child process intercepts and handles the `SIGTERM` signal and
|
| 1517 |
+
* does not exit, the parent process will still wait until the child process has
|
| 1518 |
+
* exited.
|
| 1519 |
+
*
|
| 1520 |
+
* If the process times out or has a non-zero exit code, this method will throw an `Error` that will include the full result of the underlying {@link spawnSync}.
|
| 1521 |
+
*
|
| 1522 |
+
* **If the `shell` option is enabled, do not pass unsanitized user input to this**
|
| 1523 |
+
* **function. Any input containing shell metacharacters may be used to trigger**
|
| 1524 |
+
* **arbitrary command execution.**
|
| 1525 |
+
* @since v0.11.12
|
| 1526 |
+
* @param file The name or path of the executable file to run.
|
| 1527 |
+
* @param args List of string arguments.
|
| 1528 |
+
* @return The stdout from the command.
|
| 1529 |
+
*/
|
| 1530 |
+
function execFileSync(file: string): Buffer;
|
| 1531 |
+
function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string;
|
| 1532 |
+
function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
| 1533 |
+
function execFileSync(file: string, options?: ExecFileSyncOptions): string | Buffer;
|
| 1534 |
+
function execFileSync(file: string, args: readonly string[]): Buffer;
|
| 1535 |
+
function execFileSync(
|
| 1536 |
+
file: string,
|
| 1537 |
+
args: readonly string[],
|
| 1538 |
+
options: ExecFileSyncOptionsWithStringEncoding,
|
| 1539 |
+
): string;
|
| 1540 |
+
function execFileSync(
|
| 1541 |
+
file: string,
|
| 1542 |
+
args: readonly string[],
|
| 1543 |
+
options: ExecFileSyncOptionsWithBufferEncoding,
|
| 1544 |
+
): Buffer;
|
| 1545 |
+
function execFileSync(file: string, args?: readonly string[], options?: ExecFileSyncOptions): string | Buffer;
|
| 1546 |
+
}
|
| 1547 |
+
declare module "node:child_process" {
|
| 1548 |
+
export * from "child_process";
|
| 1549 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/cluster.d.ts
ADDED
|
@@ -0,0 +1,579 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Clusters of Node.js processes can be used to run multiple instances of Node.js
|
| 3 |
+
* that can distribute workloads among their application threads. When process isolation
|
| 4 |
+
* is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html)
|
| 5 |
+
* module instead, which allows running multiple application threads within a single Node.js instance.
|
| 6 |
+
*
|
| 7 |
+
* The cluster module allows easy creation of child processes that all share
|
| 8 |
+
* server ports.
|
| 9 |
+
*
|
| 10 |
+
* ```js
|
| 11 |
+
* import cluster from 'node:cluster';
|
| 12 |
+
* import http from 'node:http';
|
| 13 |
+
* import { availableParallelism } from 'node:os';
|
| 14 |
+
* import process from 'node:process';
|
| 15 |
+
*
|
| 16 |
+
* const numCPUs = availableParallelism();
|
| 17 |
+
*
|
| 18 |
+
* if (cluster.isPrimary) {
|
| 19 |
+
* console.log(`Primary ${process.pid} is running`);
|
| 20 |
+
*
|
| 21 |
+
* // Fork workers.
|
| 22 |
+
* for (let i = 0; i < numCPUs; i++) {
|
| 23 |
+
* cluster.fork();
|
| 24 |
+
* }
|
| 25 |
+
*
|
| 26 |
+
* cluster.on('exit', (worker, code, signal) => {
|
| 27 |
+
* console.log(`worker ${worker.process.pid} died`);
|
| 28 |
+
* });
|
| 29 |
+
* } else {
|
| 30 |
+
* // Workers can share any TCP connection
|
| 31 |
+
* // In this case it is an HTTP server
|
| 32 |
+
* http.createServer((req, res) => {
|
| 33 |
+
* res.writeHead(200);
|
| 34 |
+
* res.end('hello world\n');
|
| 35 |
+
* }).listen(8000);
|
| 36 |
+
*
|
| 37 |
+
* console.log(`Worker ${process.pid} started`);
|
| 38 |
+
* }
|
| 39 |
+
* ```
|
| 40 |
+
*
|
| 41 |
+
* Running Node.js will now share port 8000 between the workers:
|
| 42 |
+
*
|
| 43 |
+
* ```console
|
| 44 |
+
* $ node server.js
|
| 45 |
+
* Primary 3596 is running
|
| 46 |
+
* Worker 4324 started
|
| 47 |
+
* Worker 4520 started
|
| 48 |
+
* Worker 6056 started
|
| 49 |
+
* Worker 5644 started
|
| 50 |
+
* ```
|
| 51 |
+
*
|
| 52 |
+
* On Windows, it is not yet possible to set up a named pipe server in a worker.
|
| 53 |
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/cluster.js)
|
| 54 |
+
*/
|
| 55 |
+
declare module "cluster" {
|
| 56 |
+
import * as child from "node:child_process";
|
| 57 |
+
import EventEmitter = require("node:events");
|
| 58 |
+
import * as net from "node:net";
|
| 59 |
+
type SerializationType = "json" | "advanced";
|
| 60 |
+
export interface ClusterSettings {
|
| 61 |
+
/**
|
| 62 |
+
* List of string arguments passed to the Node.js executable.
|
| 63 |
+
* @default process.execArgv
|
| 64 |
+
*/
|
| 65 |
+
execArgv?: string[] | undefined;
|
| 66 |
+
/**
|
| 67 |
+
* File path to worker file.
|
| 68 |
+
* @default process.argv[1]
|
| 69 |
+
*/
|
| 70 |
+
exec?: string | undefined;
|
| 71 |
+
/**
|
| 72 |
+
* String arguments passed to worker.
|
| 73 |
+
* @default process.argv.slice(2)
|
| 74 |
+
*/
|
| 75 |
+
args?: string[] | undefined;
|
| 76 |
+
/**
|
| 77 |
+
* Whether or not to send output to parent's stdio.
|
| 78 |
+
* @default false
|
| 79 |
+
*/
|
| 80 |
+
silent?: boolean | undefined;
|
| 81 |
+
/**
|
| 82 |
+
* Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must
|
| 83 |
+
* contain an `'ipc'` entry. When this option is provided, it overrides `silent`. See [`child_prcess.spawn()`](https://nodejs.org/docs/latest-v24.x/api/child_process.html#child_processspawncommand-args-options)'s
|
| 84 |
+
* [`stdio`](https://nodejs.org/docs/latest-v24.x/api/child_process.html#optionsstdio).
|
| 85 |
+
*/
|
| 86 |
+
stdio?: any[] | undefined;
|
| 87 |
+
/**
|
| 88 |
+
* Sets the user identity of the process. (See [`setuid(2)`](https://man7.org/linux/man-pages/man2/setuid.2.html).)
|
| 89 |
+
*/
|
| 90 |
+
uid?: number | undefined;
|
| 91 |
+
/**
|
| 92 |
+
* Sets the group identity of the process. (See [`setgid(2)`](https://man7.org/linux/man-pages/man2/setgid.2.html).)
|
| 93 |
+
*/
|
| 94 |
+
gid?: number | undefined;
|
| 95 |
+
/**
|
| 96 |
+
* Sets inspector port of worker. This can be a number, or a function that takes no arguments and returns a number.
|
| 97 |
+
* By default each worker gets its own port, incremented from the primary's `process.debugPort`.
|
| 98 |
+
*/
|
| 99 |
+
inspectPort?: number | (() => number) | undefined;
|
| 100 |
+
/**
|
| 101 |
+
* Specify the kind of serialization used for sending messages between processes. Possible values are `'json'` and `'advanced'`.
|
| 102 |
+
* See [Advanced serialization for `child_process`](https://nodejs.org/docs/latest-v24.x/api/child_process.html#advanced-serialization) for more details.
|
| 103 |
+
* @default false
|
| 104 |
+
*/
|
| 105 |
+
serialization?: SerializationType | undefined;
|
| 106 |
+
/**
|
| 107 |
+
* Current working directory of the worker process.
|
| 108 |
+
* @default undefined (inherits from parent process)
|
| 109 |
+
*/
|
| 110 |
+
cwd?: string | undefined;
|
| 111 |
+
/**
|
| 112 |
+
* Hide the forked processes console window that would normally be created on Windows systems.
|
| 113 |
+
* @default false
|
| 114 |
+
*/
|
| 115 |
+
windowsHide?: boolean | undefined;
|
| 116 |
+
}
|
| 117 |
+
export interface Address {
|
| 118 |
+
address: string;
|
| 119 |
+
port: number;
|
| 120 |
+
/**
|
| 121 |
+
* The `addressType` is one of:
|
| 122 |
+
*
|
| 123 |
+
* * `4` (TCPv4)
|
| 124 |
+
* * `6` (TCPv6)
|
| 125 |
+
* * `-1` (Unix domain socket)
|
| 126 |
+
* * `'udp4'` or `'udp6'` (UDPv4 or UDPv6)
|
| 127 |
+
*/
|
| 128 |
+
addressType: 4 | 6 | -1 | "udp4" | "udp6";
|
| 129 |
+
}
|
| 130 |
+
/**
|
| 131 |
+
* A `Worker` object contains all public information and method about a worker.
|
| 132 |
+
* In the primary it can be obtained using `cluster.workers`. In a worker
|
| 133 |
+
* it can be obtained using `cluster.worker`.
|
| 134 |
+
* @since v0.7.0
|
| 135 |
+
*/
|
| 136 |
+
export class Worker extends EventEmitter {
|
| 137 |
+
/**
|
| 138 |
+
* Each new worker is given its own unique id, this id is stored in the `id`.
|
| 139 |
+
*
|
| 140 |
+
* While a worker is alive, this is the key that indexes it in `cluster.workers`.
|
| 141 |
+
* @since v0.8.0
|
| 142 |
+
*/
|
| 143 |
+
id: number;
|
| 144 |
+
/**
|
| 145 |
+
* All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-v24.x/api/child_process.html#child_processforkmodulepath-args-options), the returned object
|
| 146 |
+
* from this function is stored as `.process`. In a worker, the global `process` is stored.
|
| 147 |
+
*
|
| 148 |
+
* See: [Child Process module](https://nodejs.org/docs/latest-v24.x/api/child_process.html#child_processforkmodulepath-args-options).
|
| 149 |
+
*
|
| 150 |
+
* Workers will call `process.exit(0)` if the `'disconnect'` event occurs
|
| 151 |
+
* on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
|
| 152 |
+
* accidental disconnection.
|
| 153 |
+
* @since v0.7.0
|
| 154 |
+
*/
|
| 155 |
+
process: child.ChildProcess;
|
| 156 |
+
/**
|
| 157 |
+
* Send a message to a worker or primary, optionally with a handle.
|
| 158 |
+
*
|
| 159 |
+
* In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`](https://nodejs.org/docs/latest-v24.x/api/child_process.html#subprocesssendmessage-sendhandle-options-callback).
|
| 160 |
+
*
|
| 161 |
+
* In a worker, this sends a message to the primary. It is identical to `process.send()`.
|
| 162 |
+
*
|
| 163 |
+
* This example will echo back all messages from the primary:
|
| 164 |
+
*
|
| 165 |
+
* ```js
|
| 166 |
+
* if (cluster.isPrimary) {
|
| 167 |
+
* const worker = cluster.fork();
|
| 168 |
+
* worker.send('hi there');
|
| 169 |
+
*
|
| 170 |
+
* } else if (cluster.isWorker) {
|
| 171 |
+
* process.on('message', (msg) => {
|
| 172 |
+
* process.send(msg);
|
| 173 |
+
* });
|
| 174 |
+
* }
|
| 175 |
+
* ```
|
| 176 |
+
* @since v0.7.0
|
| 177 |
+
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles.
|
| 178 |
+
*/
|
| 179 |
+
send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
|
| 180 |
+
send(
|
| 181 |
+
message: child.Serializable,
|
| 182 |
+
sendHandle: child.SendHandle,
|
| 183 |
+
callback?: (error: Error | null) => void,
|
| 184 |
+
): boolean;
|
| 185 |
+
send(
|
| 186 |
+
message: child.Serializable,
|
| 187 |
+
sendHandle: child.SendHandle,
|
| 188 |
+
options?: child.MessageOptions,
|
| 189 |
+
callback?: (error: Error | null) => void,
|
| 190 |
+
): boolean;
|
| 191 |
+
/**
|
| 192 |
+
* This function will kill the worker. In the primary worker, it does this by
|
| 193 |
+
* disconnecting the `worker.process`, and once disconnected, killing with `signal`. In the worker, it does it by killing the process with `signal`.
|
| 194 |
+
*
|
| 195 |
+
* The `kill()` function kills the worker process without waiting for a graceful
|
| 196 |
+
* disconnect, it has the same behavior as `worker.process.kill()`.
|
| 197 |
+
*
|
| 198 |
+
* This method is aliased as `worker.destroy()` for backwards compatibility.
|
| 199 |
+
*
|
| 200 |
+
* In a worker, `process.kill()` exists, but it is not this function;
|
| 201 |
+
* it is [`kill()`](https://nodejs.org/docs/latest-v24.x/api/process.html#processkillpid-signal).
|
| 202 |
+
* @since v0.9.12
|
| 203 |
+
* @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
|
| 204 |
+
*/
|
| 205 |
+
kill(signal?: string): void;
|
| 206 |
+
destroy(signal?: string): void;
|
| 207 |
+
/**
|
| 208 |
+
* In a worker, this function will close all servers, wait for the `'close'` event
|
| 209 |
+
* on those servers, and then disconnect the IPC channel.
|
| 210 |
+
*
|
| 211 |
+
* In the primary, an internal message is sent to the worker causing it to call `.disconnect()` on itself.
|
| 212 |
+
*
|
| 213 |
+
* Causes `.exitedAfterDisconnect` to be set.
|
| 214 |
+
*
|
| 215 |
+
* After a server is closed, it will no longer accept new connections,
|
| 216 |
+
* but connections may be accepted by any other listening worker. Existing
|
| 217 |
+
* connections will be allowed to close as usual. When no more connections exist,
|
| 218 |
+
* see `server.close()`, the IPC channel to the worker will close allowing it
|
| 219 |
+
* to die gracefully.
|
| 220 |
+
*
|
| 221 |
+
* The above applies _only_ to server connections, client connections are not
|
| 222 |
+
* automatically closed by workers, and disconnect does not wait for them to close
|
| 223 |
+
* before exiting.
|
| 224 |
+
*
|
| 225 |
+
* In a worker, `process.disconnect` exists, but it is not this function;
|
| 226 |
+
* it is `disconnect()`.
|
| 227 |
+
*
|
| 228 |
+
* Because long living server connections may block workers from disconnecting, it
|
| 229 |
+
* may be useful to send a message, so application specific actions may be taken to
|
| 230 |
+
* close them. It also may be useful to implement a timeout, killing a worker if
|
| 231 |
+
* the `'disconnect'` event has not been emitted after some time.
|
| 232 |
+
*
|
| 233 |
+
* ```js
|
| 234 |
+
* import net from 'node:net';
|
| 235 |
+
*
|
| 236 |
+
* if (cluster.isPrimary) {
|
| 237 |
+
* const worker = cluster.fork();
|
| 238 |
+
* let timeout;
|
| 239 |
+
*
|
| 240 |
+
* worker.on('listening', (address) => {
|
| 241 |
+
* worker.send('shutdown');
|
| 242 |
+
* worker.disconnect();
|
| 243 |
+
* timeout = setTimeout(() => {
|
| 244 |
+
* worker.kill();
|
| 245 |
+
* }, 2000);
|
| 246 |
+
* });
|
| 247 |
+
*
|
| 248 |
+
* worker.on('disconnect', () => {
|
| 249 |
+
* clearTimeout(timeout);
|
| 250 |
+
* });
|
| 251 |
+
*
|
| 252 |
+
* } else if (cluster.isWorker) {
|
| 253 |
+
* const server = net.createServer((socket) => {
|
| 254 |
+
* // Connections never end
|
| 255 |
+
* });
|
| 256 |
+
*
|
| 257 |
+
* server.listen(8000);
|
| 258 |
+
*
|
| 259 |
+
* process.on('message', (msg) => {
|
| 260 |
+
* if (msg === 'shutdown') {
|
| 261 |
+
* // Initiate graceful close of any connections to server
|
| 262 |
+
* }
|
| 263 |
+
* });
|
| 264 |
+
* }
|
| 265 |
+
* ```
|
| 266 |
+
* @since v0.7.7
|
| 267 |
+
* @return A reference to `worker`.
|
| 268 |
+
*/
|
| 269 |
+
disconnect(): this;
|
| 270 |
+
/**
|
| 271 |
+
* This function returns `true` if the worker is connected to its primary via its
|
| 272 |
+
* IPC channel, `false` otherwise. A worker is connected to its primary after it
|
| 273 |
+
* has been created. It is disconnected after the `'disconnect'` event is emitted.
|
| 274 |
+
* @since v0.11.14
|
| 275 |
+
*/
|
| 276 |
+
isConnected(): boolean;
|
| 277 |
+
/**
|
| 278 |
+
* This function returns `true` if the worker's process has terminated (either
|
| 279 |
+
* because of exiting or being signaled). Otherwise, it returns `false`.
|
| 280 |
+
*
|
| 281 |
+
* ```js
|
| 282 |
+
* import cluster from 'node:cluster';
|
| 283 |
+
* import http from 'node:http';
|
| 284 |
+
* import { availableParallelism } from 'node:os';
|
| 285 |
+
* import process from 'node:process';
|
| 286 |
+
*
|
| 287 |
+
* const numCPUs = availableParallelism();
|
| 288 |
+
*
|
| 289 |
+
* if (cluster.isPrimary) {
|
| 290 |
+
* console.log(`Primary ${process.pid} is running`);
|
| 291 |
+
*
|
| 292 |
+
* // Fork workers.
|
| 293 |
+
* for (let i = 0; i < numCPUs; i++) {
|
| 294 |
+
* cluster.fork();
|
| 295 |
+
* }
|
| 296 |
+
*
|
| 297 |
+
* cluster.on('fork', (worker) => {
|
| 298 |
+
* console.log('worker is dead:', worker.isDead());
|
| 299 |
+
* });
|
| 300 |
+
*
|
| 301 |
+
* cluster.on('exit', (worker, code, signal) => {
|
| 302 |
+
* console.log('worker is dead:', worker.isDead());
|
| 303 |
+
* });
|
| 304 |
+
* } else {
|
| 305 |
+
* // Workers can share any TCP connection. In this case, it is an HTTP server.
|
| 306 |
+
* http.createServer((req, res) => {
|
| 307 |
+
* res.writeHead(200);
|
| 308 |
+
* res.end(`Current process\n ${process.pid}`);
|
| 309 |
+
* process.kill(process.pid);
|
| 310 |
+
* }).listen(8000);
|
| 311 |
+
* }
|
| 312 |
+
* ```
|
| 313 |
+
* @since v0.11.14
|
| 314 |
+
*/
|
| 315 |
+
isDead(): boolean;
|
| 316 |
+
/**
|
| 317 |
+
* This property is `true` if the worker exited due to `.disconnect()`.
|
| 318 |
+
* If the worker exited any other way, it is `false`. If the
|
| 319 |
+
* worker has not exited, it is `undefined`.
|
| 320 |
+
*
|
| 321 |
+
* The boolean `worker.exitedAfterDisconnect` allows distinguishing between
|
| 322 |
+
* voluntary and accidental exit, the primary may choose not to respawn a worker
|
| 323 |
+
* based on this value.
|
| 324 |
+
*
|
| 325 |
+
* ```js
|
| 326 |
+
* cluster.on('exit', (worker, code, signal) => {
|
| 327 |
+
* if (worker.exitedAfterDisconnect === true) {
|
| 328 |
+
* console.log('Oh, it was just voluntary – no need to worry');
|
| 329 |
+
* }
|
| 330 |
+
* });
|
| 331 |
+
*
|
| 332 |
+
* // kill worker
|
| 333 |
+
* worker.kill();
|
| 334 |
+
* ```
|
| 335 |
+
* @since v6.0.0
|
| 336 |
+
*/
|
| 337 |
+
exitedAfterDisconnect: boolean;
|
| 338 |
+
/**
|
| 339 |
+
* events.EventEmitter
|
| 340 |
+
* 1. disconnect
|
| 341 |
+
* 2. error
|
| 342 |
+
* 3. exit
|
| 343 |
+
* 4. listening
|
| 344 |
+
* 5. message
|
| 345 |
+
* 6. online
|
| 346 |
+
*/
|
| 347 |
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
| 348 |
+
addListener(event: "disconnect", listener: () => void): this;
|
| 349 |
+
addListener(event: "error", listener: (error: Error) => void): this;
|
| 350 |
+
addListener(event: "exit", listener: (code: number, signal: string) => void): this;
|
| 351 |
+
addListener(event: "listening", listener: (address: Address) => void): this;
|
| 352 |
+
addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 353 |
+
addListener(event: "online", listener: () => void): this;
|
| 354 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 355 |
+
emit(event: "disconnect"): boolean;
|
| 356 |
+
emit(event: "error", error: Error): boolean;
|
| 357 |
+
emit(event: "exit", code: number, signal: string): boolean;
|
| 358 |
+
emit(event: "listening", address: Address): boolean;
|
| 359 |
+
emit(event: "message", message: any, handle: net.Socket | net.Server): boolean;
|
| 360 |
+
emit(event: "online"): boolean;
|
| 361 |
+
on(event: string, listener: (...args: any[]) => void): this;
|
| 362 |
+
on(event: "disconnect", listener: () => void): this;
|
| 363 |
+
on(event: "error", listener: (error: Error) => void): this;
|
| 364 |
+
on(event: "exit", listener: (code: number, signal: string) => void): this;
|
| 365 |
+
on(event: "listening", listener: (address: Address) => void): this;
|
| 366 |
+
on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 367 |
+
on(event: "online", listener: () => void): this;
|
| 368 |
+
once(event: string, listener: (...args: any[]) => void): this;
|
| 369 |
+
once(event: "disconnect", listener: () => void): this;
|
| 370 |
+
once(event: "error", listener: (error: Error) => void): this;
|
| 371 |
+
once(event: "exit", listener: (code: number, signal: string) => void): this;
|
| 372 |
+
once(event: "listening", listener: (address: Address) => void): this;
|
| 373 |
+
once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 374 |
+
once(event: "online", listener: () => void): this;
|
| 375 |
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
| 376 |
+
prependListener(event: "disconnect", listener: () => void): this;
|
| 377 |
+
prependListener(event: "error", listener: (error: Error) => void): this;
|
| 378 |
+
prependListener(event: "exit", listener: (code: number, signal: string) => void): this;
|
| 379 |
+
prependListener(event: "listening", listener: (address: Address) => void): this;
|
| 380 |
+
prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 381 |
+
prependListener(event: "online", listener: () => void): this;
|
| 382 |
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
| 383 |
+
prependOnceListener(event: "disconnect", listener: () => void): this;
|
| 384 |
+
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
| 385 |
+
prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this;
|
| 386 |
+
prependOnceListener(event: "listening", listener: (address: Address) => void): this;
|
| 387 |
+
prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 388 |
+
prependOnceListener(event: "online", listener: () => void): this;
|
| 389 |
+
}
|
| 390 |
+
export interface Cluster extends EventEmitter {
|
| 391 |
+
disconnect(callback?: () => void): void;
|
| 392 |
+
/**
|
| 393 |
+
* Spawn a new worker process.
|
| 394 |
+
*
|
| 395 |
+
* This can only be called from the primary process.
|
| 396 |
+
* @param env Key/value pairs to add to worker process environment.
|
| 397 |
+
* @since v0.6.0
|
| 398 |
+
*/
|
| 399 |
+
fork(env?: any): Worker;
|
| 400 |
+
/** @deprecated since v16.0.0 - use isPrimary. */
|
| 401 |
+
readonly isMaster: boolean;
|
| 402 |
+
/**
|
| 403 |
+
* True if the process is a primary. This is determined by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID`
|
| 404 |
+
* is undefined, then `isPrimary` is `true`.
|
| 405 |
+
* @since v16.0.0
|
| 406 |
+
*/
|
| 407 |
+
readonly isPrimary: boolean;
|
| 408 |
+
/**
|
| 409 |
+
* True if the process is not a primary (it is the negation of `cluster.isPrimary`).
|
| 410 |
+
* @since v0.6.0
|
| 411 |
+
*/
|
| 412 |
+
readonly isWorker: boolean;
|
| 413 |
+
/**
|
| 414 |
+
* The scheduling policy, either `cluster.SCHED_RR` for round-robin or `cluster.SCHED_NONE` to leave it to the operating system. This is a
|
| 415 |
+
* global setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clustersetupprimarysettings)
|
| 416 |
+
* is called, whichever comes first.
|
| 417 |
+
*
|
| 418 |
+
* `SCHED_RR` is the default on all operating systems except Windows. Windows will change to `SCHED_RR` once libuv is able to effectively distribute
|
| 419 |
+
* IOCP handles without incurring a large performance hit.
|
| 420 |
+
*
|
| 421 |
+
* `cluster.schedulingPolicy` can also be set through the `NODE_CLUSTER_SCHED_POLICY` environment variable. Valid values are `'rr'` and `'none'`.
|
| 422 |
+
* @since v0.11.2
|
| 423 |
+
*/
|
| 424 |
+
schedulingPolicy: number;
|
| 425 |
+
/**
|
| 426 |
+
* After calling [`.setupPrimary()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clustersetupprimarysettings)
|
| 427 |
+
* (or [`.fork()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clusterforkenv)) this settings object will contain
|
| 428 |
+
* the settings, including the default values.
|
| 429 |
+
*
|
| 430 |
+
* This object is not intended to be changed or set manually.
|
| 431 |
+
* @since v0.7.1
|
| 432 |
+
*/
|
| 433 |
+
readonly settings: ClusterSettings;
|
| 434 |
+
/** @deprecated since v16.0.0 - use [`.setupPrimary()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clustersetupprimarysettings) instead. */
|
| 435 |
+
setupMaster(settings?: ClusterSettings): void;
|
| 436 |
+
/**
|
| 437 |
+
* `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in `cluster.settings`.
|
| 438 |
+
*
|
| 439 |
+
* Any settings changes only affect future calls to [`.fork()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clusterforkenv)
|
| 440 |
+
* and have no effect on workers that are already running.
|
| 441 |
+
*
|
| 442 |
+
* The only attribute of a worker that cannot be set via `.setupPrimary()` is the `env` passed to
|
| 443 |
+
* [`.fork()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clusterforkenv).
|
| 444 |
+
*
|
| 445 |
+
* The defaults above apply to the first call only; the defaults for later calls are the current values at the time of
|
| 446 |
+
* `cluster.setupPrimary()` is called.
|
| 447 |
+
*
|
| 448 |
+
* ```js
|
| 449 |
+
* import cluster from 'node:cluster';
|
| 450 |
+
*
|
| 451 |
+
* cluster.setupPrimary({
|
| 452 |
+
* exec: 'worker.js',
|
| 453 |
+
* args: ['--use', 'https'],
|
| 454 |
+
* silent: true,
|
| 455 |
+
* });
|
| 456 |
+
* cluster.fork(); // https worker
|
| 457 |
+
* cluster.setupPrimary({
|
| 458 |
+
* exec: 'worker.js',
|
| 459 |
+
* args: ['--use', 'http'],
|
| 460 |
+
* });
|
| 461 |
+
* cluster.fork(); // http worker
|
| 462 |
+
* ```
|
| 463 |
+
*
|
| 464 |
+
* This can only be called from the primary process.
|
| 465 |
+
* @since v16.0.0
|
| 466 |
+
*/
|
| 467 |
+
setupPrimary(settings?: ClusterSettings): void;
|
| 468 |
+
/**
|
| 469 |
+
* A reference to the current worker object. Not available in the primary process.
|
| 470 |
+
*
|
| 471 |
+
* ```js
|
| 472 |
+
* import cluster from 'node:cluster';
|
| 473 |
+
*
|
| 474 |
+
* if (cluster.isPrimary) {
|
| 475 |
+
* console.log('I am primary');
|
| 476 |
+
* cluster.fork();
|
| 477 |
+
* cluster.fork();
|
| 478 |
+
* } else if (cluster.isWorker) {
|
| 479 |
+
* console.log(`I am worker #${cluster.worker.id}`);
|
| 480 |
+
* }
|
| 481 |
+
* ```
|
| 482 |
+
* @since v0.7.0
|
| 483 |
+
*/
|
| 484 |
+
readonly worker?: Worker | undefined;
|
| 485 |
+
/**
|
| 486 |
+
* A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process.
|
| 487 |
+
*
|
| 488 |
+
* A worker is removed from `cluster.workers` after the worker has disconnected _and_ exited. The order between these two events cannot be determined in advance. However, it
|
| 489 |
+
* is guaranteed that the removal from the `cluster.workers` list happens before the last `'disconnect'` or `'exit'` event is emitted.
|
| 490 |
+
*
|
| 491 |
+
* ```js
|
| 492 |
+
* import cluster from 'node:cluster';
|
| 493 |
+
*
|
| 494 |
+
* for (const worker of Object.values(cluster.workers)) {
|
| 495 |
+
* worker.send('big announcement to all workers');
|
| 496 |
+
* }
|
| 497 |
+
* ```
|
| 498 |
+
* @since v0.7.0
|
| 499 |
+
*/
|
| 500 |
+
readonly workers?: NodeJS.Dict<Worker> | undefined;
|
| 501 |
+
readonly SCHED_NONE: number;
|
| 502 |
+
readonly SCHED_RR: number;
|
| 503 |
+
/**
|
| 504 |
+
* events.EventEmitter
|
| 505 |
+
* 1. disconnect
|
| 506 |
+
* 2. exit
|
| 507 |
+
* 3. fork
|
| 508 |
+
* 4. listening
|
| 509 |
+
* 5. message
|
| 510 |
+
* 6. online
|
| 511 |
+
* 7. setup
|
| 512 |
+
*/
|
| 513 |
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
| 514 |
+
addListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
| 515 |
+
addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
| 516 |
+
addListener(event: "fork", listener: (worker: Worker) => void): this;
|
| 517 |
+
addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
| 518 |
+
addListener(
|
| 519 |
+
event: "message",
|
| 520 |
+
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
|
| 521 |
+
): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 522 |
+
addListener(event: "online", listener: (worker: Worker) => void): this;
|
| 523 |
+
addListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
| 524 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 525 |
+
emit(event: "disconnect", worker: Worker): boolean;
|
| 526 |
+
emit(event: "exit", worker: Worker, code: number, signal: string): boolean;
|
| 527 |
+
emit(event: "fork", worker: Worker): boolean;
|
| 528 |
+
emit(event: "listening", worker: Worker, address: Address): boolean;
|
| 529 |
+
emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
|
| 530 |
+
emit(event: "online", worker: Worker): boolean;
|
| 531 |
+
emit(event: "setup", settings: ClusterSettings): boolean;
|
| 532 |
+
on(event: string, listener: (...args: any[]) => void): this;
|
| 533 |
+
on(event: "disconnect", listener: (worker: Worker) => void): this;
|
| 534 |
+
on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
| 535 |
+
on(event: "fork", listener: (worker: Worker) => void): this;
|
| 536 |
+
on(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
| 537 |
+
on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 538 |
+
on(event: "online", listener: (worker: Worker) => void): this;
|
| 539 |
+
on(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
| 540 |
+
once(event: string, listener: (...args: any[]) => void): this;
|
| 541 |
+
once(event: "disconnect", listener: (worker: Worker) => void): this;
|
| 542 |
+
once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
| 543 |
+
once(event: "fork", listener: (worker: Worker) => void): this;
|
| 544 |
+
once(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
| 545 |
+
once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 546 |
+
once(event: "online", listener: (worker: Worker) => void): this;
|
| 547 |
+
once(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
| 548 |
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
| 549 |
+
prependListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
| 550 |
+
prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
| 551 |
+
prependListener(event: "fork", listener: (worker: Worker) => void): this;
|
| 552 |
+
prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
| 553 |
+
// the handle is a net.Socket or net.Server object, or undefined.
|
| 554 |
+
prependListener(
|
| 555 |
+
event: "message",
|
| 556 |
+
listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void,
|
| 557 |
+
): this;
|
| 558 |
+
prependListener(event: "online", listener: (worker: Worker) => void): this;
|
| 559 |
+
prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
| 560 |
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
| 561 |
+
prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
| 562 |
+
prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
| 563 |
+
prependOnceListener(event: "fork", listener: (worker: Worker) => void): this;
|
| 564 |
+
prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
| 565 |
+
// the handle is a net.Socket or net.Server object, or undefined.
|
| 566 |
+
prependOnceListener(
|
| 567 |
+
event: "message",
|
| 568 |
+
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
|
| 569 |
+
): this;
|
| 570 |
+
prependOnceListener(event: "online", listener: (worker: Worker) => void): this;
|
| 571 |
+
prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
| 572 |
+
}
|
| 573 |
+
const cluster: Cluster;
|
| 574 |
+
export default cluster;
|
| 575 |
+
}
|
| 576 |
+
declare module "node:cluster" {
|
| 577 |
+
export * from "cluster";
|
| 578 |
+
export { default as default } from "cluster";
|
| 579 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/compatibility/iterators.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Backwards-compatible iterator interfaces, augmented with iterator helper methods by lib.esnext.iterator in TypeScript 5.6.
|
| 2 |
+
// The IterableIterator interface does not contain these methods, which creates assignability issues in places where IteratorObjects
|
| 3 |
+
// are expected (eg. DOM-compatible APIs) if lib.esnext.iterator is loaded.
|
| 4 |
+
// Also ensures that iterators returned by the Node API, which inherit from Iterator.prototype, correctly expose the iterator helper methods
|
| 5 |
+
// if lib.esnext.iterator is loaded.
|
| 6 |
+
// TODO: remove once this package no longer supports TS 5.5, and replace NodeJS.BuiltinIteratorReturn with BuiltinIteratorReturn.
|
| 7 |
+
|
| 8 |
+
// Placeholders for TS <5.6
|
| 9 |
+
interface IteratorObject<T, TReturn, TNext> {}
|
| 10 |
+
interface AsyncIteratorObject<T, TReturn, TNext> {}
|
| 11 |
+
|
| 12 |
+
declare namespace NodeJS {
|
| 13 |
+
// Populate iterator methods for TS <5.6
|
| 14 |
+
interface Iterator<T, TReturn, TNext> extends globalThis.Iterator<T, TReturn, TNext> {}
|
| 15 |
+
interface AsyncIterator<T, TReturn, TNext> extends globalThis.AsyncIterator<T, TReturn, TNext> {}
|
| 16 |
+
|
| 17 |
+
// Polyfill for TS 5.6's instrinsic BuiltinIteratorReturn type, required for DOM-compatible iterators
|
| 18 |
+
type BuiltinIteratorReturn = ReturnType<any[][typeof Symbol.iterator]> extends
|
| 19 |
+
globalThis.Iterator<any, infer TReturn> ? TReturn
|
| 20 |
+
: any;
|
| 21 |
+
}
|
novas/novacore-zephyr/groq-code-cli/node_modules/@types/node/console.d.ts
ADDED
|
@@ -0,0 +1,452 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* The `node:console` module provides a simple debugging console that is similar to
|
| 3 |
+
* the JavaScript console mechanism provided by web browsers.
|
| 4 |
+
*
|
| 5 |
+
* The module exports two specific components:
|
| 6 |
+
*
|
| 7 |
+
* * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream.
|
| 8 |
+
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdout) and
|
| 9 |
+
* [`process.stderr`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module.
|
| 10 |
+
*
|
| 11 |
+
* _**Warning**_: The global console object's methods are neither consistently
|
| 12 |
+
* synchronous like the browser APIs they resemble, nor are they consistently
|
| 13 |
+
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v24.x/api/process.html#a-note-on-process-io) for
|
| 14 |
+
* more information.
|
| 15 |
+
*
|
| 16 |
+
* Example using the global `console`:
|
| 17 |
+
*
|
| 18 |
+
* ```js
|
| 19 |
+
* console.log('hello world');
|
| 20 |
+
* // Prints: hello world, to stdout
|
| 21 |
+
* console.log('hello %s', 'world');
|
| 22 |
+
* // Prints: hello world, to stdout
|
| 23 |
+
* console.error(new Error('Whoops, something bad happened'));
|
| 24 |
+
* // Prints error message and stack trace to stderr:
|
| 25 |
+
* // Error: Whoops, something bad happened
|
| 26 |
+
* // at [eval]:5:15
|
| 27 |
+
* // at Script.runInThisContext (node:vm:132:18)
|
| 28 |
+
* // at Object.runInThisContext (node:vm:309:38)
|
| 29 |
+
* // at node:internal/process/execution:77:19
|
| 30 |
+
* // at [eval]-wrapper:6:22
|
| 31 |
+
* // at evalScript (node:internal/process/execution:76:60)
|
| 32 |
+
* // at node:internal/main/eval_string:23:3
|
| 33 |
+
*
|
| 34 |
+
* const name = 'Will Robinson';
|
| 35 |
+
* console.warn(`Danger ${name}! Danger!`);
|
| 36 |
+
* // Prints: Danger Will Robinson! Danger!, to stderr
|
| 37 |
+
* ```
|
| 38 |
+
*
|
| 39 |
+
* Example using the `Console` class:
|
| 40 |
+
*
|
| 41 |
+
* ```js
|
| 42 |
+
* const out = getStreamSomehow();
|
| 43 |
+
* const err = getStreamSomehow();
|
| 44 |
+
* const myConsole = new console.Console(out, err);
|
| 45 |
+
*
|
| 46 |
+
* myConsole.log('hello world');
|
| 47 |
+
* // Prints: hello world, to out
|
| 48 |
+
* myConsole.log('hello %s', 'world');
|
| 49 |
+
* // Prints: hello world, to out
|
| 50 |
+
* myConsole.error(new Error('Whoops, something bad happened'));
|
| 51 |
+
* // Prints: [Error: Whoops, something bad happened], to err
|
| 52 |
+
*
|
| 53 |
+
* const name = 'Will Robinson';
|
| 54 |
+
* myConsole.warn(`Danger ${name}! Danger!`);
|
| 55 |
+
* // Prints: Danger Will Robinson! Danger!, to err
|
| 56 |
+
* ```
|
| 57 |
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/console.js)
|
| 58 |
+
*/
|
| 59 |
+
declare module "console" {
|
| 60 |
+
import console = require("node:console");
|
| 61 |
+
export = console;
|
| 62 |
+
}
|
| 63 |
+
declare module "node:console" {
|
| 64 |
+
import { InspectOptions } from "node:util";
|
| 65 |
+
global {
|
| 66 |
+
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
|
| 67 |
+
interface Console {
|
| 68 |
+
Console: console.ConsoleConstructor;
|
| 69 |
+
/**
|
| 70 |
+
* `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only
|
| 71 |
+
* writes a message and does not otherwise affect execution. The output always
|
| 72 |
+
* starts with `"Assertion failed"`. If provided, `message` is formatted using
|
| 73 |
+
* [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args).
|
| 74 |
+
*
|
| 75 |
+
* If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens.
|
| 76 |
+
*
|
| 77 |
+
* ```js
|
| 78 |
+
* console.assert(true, 'does nothing');
|
| 79 |
+
*
|
| 80 |
+
* console.assert(false, 'Whoops %s work', 'didn\'t');
|
| 81 |
+
* // Assertion failed: Whoops didn't work
|
| 82 |
+
*
|
| 83 |
+
* console.assert();
|
| 84 |
+
* // Assertion failed
|
| 85 |
+
* ```
|
| 86 |
+
* @since v0.1.101
|
| 87 |
+
* @param value The value tested for being truthy.
|
| 88 |
+
* @param message All arguments besides `value` are used as error message.
|
| 89 |
+
*/
|
| 90 |
+
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
| 91 |
+
/**
|
| 92 |
+
* When `stdout` is a TTY, calling `console.clear()` will attempt to clear the
|
| 93 |
+
* TTY. When `stdout` is not a TTY, this method does nothing.
|
| 94 |
+
*
|
| 95 |
+
* The specific operation of `console.clear()` can vary across operating systems
|
| 96 |
+
* and terminal types. For most Linux operating systems, `console.clear()` operates similarly to the `clear` shell command. On Windows, `console.clear()` will clear only the output in the
|
| 97 |
+
* current terminal viewport for the Node.js
|
| 98 |
+
* binary.
|
| 99 |
+
* @since v8.3.0
|
| 100 |
+
*/
|
| 101 |
+
clear(): void;
|
| 102 |
+
/**
|
| 103 |
+
* Maintains an internal counter specific to `label` and outputs to `stdout` the
|
| 104 |
+
* number of times `console.count()` has been called with the given `label`.
|
| 105 |
+
*
|
| 106 |
+
* ```js
|
| 107 |
+
* > console.count()
|
| 108 |
+
* default: 1
|
| 109 |
+
* undefined
|
| 110 |
+
* > console.count('default')
|
| 111 |
+
* default: 2
|
| 112 |
+
* undefined
|
| 113 |
+
* > console.count('abc')
|
| 114 |
+
* abc: 1
|
| 115 |
+
* undefined
|
| 116 |
+
* > console.count('xyz')
|
| 117 |
+
* xyz: 1
|
| 118 |
+
* undefined
|
| 119 |
+
* > console.count('abc')
|
| 120 |
+
* abc: 2
|
| 121 |
+
* undefined
|
| 122 |
+
* > console.count()
|
| 123 |
+
* default: 3
|
| 124 |
+
* undefined
|
| 125 |
+
* >
|
| 126 |
+
* ```
|
| 127 |
+
* @since v8.3.0
|
| 128 |
+
* @param [label='default'] The display label for the counter.
|
| 129 |
+
*/
|
| 130 |
+
count(label?: string): void;
|
| 131 |
+
/**
|
| 132 |
+
* Resets the internal counter specific to `label`.
|
| 133 |
+
*
|
| 134 |
+
* ```js
|
| 135 |
+
* > console.count('abc');
|
| 136 |
+
* abc: 1
|
| 137 |
+
* undefined
|
| 138 |
+
* > console.countReset('abc');
|
| 139 |
+
* undefined
|
| 140 |
+
* > console.count('abc');
|
| 141 |
+
* abc: 1
|
| 142 |
+
* undefined
|
| 143 |
+
* >
|
| 144 |
+
* ```
|
| 145 |
+
* @since v8.3.0
|
| 146 |
+
* @param [label='default'] The display label for the counter.
|
| 147 |
+
*/
|
| 148 |
+
countReset(label?: string): void;
|
| 149 |
+
/**
|
| 150 |
+
* The `console.debug()` function is an alias for {@link log}.
|
| 151 |
+
* @since v8.0.0
|
| 152 |
+
*/
|
| 153 |
+
debug(message?: any, ...optionalParams: any[]): void;
|
| 154 |
+
/**
|
| 155 |
+
* Uses [`util.inspect()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilinspectobject-options) on `obj` and prints the resulting string to `stdout`.
|
| 156 |
+
* This function bypasses any custom `inspect()` function defined on `obj`.
|
| 157 |
+
* @since v0.1.101
|
| 158 |
+
*/
|
| 159 |
+
dir(obj: any, options?: InspectOptions): void;
|
| 160 |
+
/**
|
| 161 |
+
* This method calls `console.log()` passing it the arguments received.
|
| 162 |
+
* This method does not produce any XML formatting.
|
| 163 |
+
* @since v8.0.0
|
| 164 |
+
*/
|
| 165 |
+
dirxml(...data: any[]): void;
|
| 166 |
+
/**
|
| 167 |
+
* Prints to `stderr` with newline. Multiple arguments can be passed, with the
|
| 168 |
+
* first used as the primary message and all additional used as substitution
|
| 169 |
+
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html)
|
| 170 |
+
* (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)).
|
| 171 |
+
*
|
| 172 |
+
* ```js
|
| 173 |
+
* const code = 5;
|
| 174 |
+
* console.error('error #%d', code);
|
| 175 |
+
* // Prints: error #5, to stderr
|
| 176 |
+
* console.error('error', code);
|
| 177 |
+
* // Prints: error 5, to stderr
|
| 178 |
+
* ```
|
| 179 |
+
*
|
| 180 |
+
* If formatting elements (e.g. `%d`) are not found in the first string then
|
| 181 |
+
* [`util.inspect()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilinspectobject-options) is called on each argument and the
|
| 182 |
+
* resulting string values are concatenated. See [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)
|
| 183 |
+
* for more information.
|
| 184 |
+
* @since v0.1.100
|
| 185 |
+
*/
|
| 186 |
+
error(message?: any, ...optionalParams: any[]): void;
|
| 187 |
+
/**
|
| 188 |
+
* Increases indentation of subsequent lines by spaces for `groupIndentation` length.
|
| 189 |
+
*
|
| 190 |
+
* If one or more `label`s are provided, those are printed first without the
|
| 191 |
+
* additional indentation.
|
| 192 |
+
* @since v8.5.0
|
| 193 |
+
*/
|
| 194 |
+
group(...label: any[]): void;
|
| 195 |
+
/**
|
| 196 |
+
* An alias for {@link group}.
|
| 197 |
+
* @since v8.5.0
|
| 198 |
+
*/
|
| 199 |
+
groupCollapsed(...label: any[]): void;
|
| 200 |
+
/**
|
| 201 |
+
* Decreases indentation of subsequent lines by spaces for `groupIndentation` length.
|
| 202 |
+
* @since v8.5.0
|
| 203 |
+
*/
|
| 204 |
+
groupEnd(): void;
|
| 205 |
+
/**
|
| 206 |
+
* The `console.info()` function is an alias for {@link log}.
|
| 207 |
+
* @since v0.1.100
|
| 208 |
+
*/
|
| 209 |
+
info(message?: any, ...optionalParams: any[]): void;
|
| 210 |
+
/**
|
| 211 |
+
* Prints to `stdout` with newline. Multiple arguments can be passed, with the
|
| 212 |
+
* first used as the primary message and all additional used as substitution
|
| 213 |
+
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html)
|
| 214 |
+
* (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)).
|
| 215 |
+
*
|
| 216 |
+
* ```js
|
| 217 |
+
* const count = 5;
|
| 218 |
+
* console.log('count: %d', count);
|
| 219 |
+
* // Prints: count: 5, to stdout
|
| 220 |
+
* console.log('count:', count);
|
| 221 |
+
* // Prints: count: 5, to stdout
|
| 222 |
+
* ```
|
| 223 |
+
*
|
| 224 |
+
* See [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args) for more information.
|
| 225 |
+
* @since v0.1.100
|
| 226 |
+
*/
|
| 227 |
+
log(message?: any, ...optionalParams: any[]): void;
|
| 228 |
+
/**
|
| 229 |
+
* Try to construct a table with the columns of the properties of `tabularData` (or use `properties`) and rows of `tabularData` and log it. Falls back to just
|
| 230 |
+
* logging the argument if it can't be parsed as tabular.
|
| 231 |
+
*
|
| 232 |
+
* ```js
|
| 233 |
+
* // These can't be parsed as tabular data
|
| 234 |
+
* console.table(Symbol());
|
| 235 |
+
* // Symbol()
|
| 236 |
+
*
|
| 237 |
+
* console.table(undefined);
|
| 238 |
+
* // undefined
|
| 239 |
+
*
|
| 240 |
+
* console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]);
|
| 241 |
+
* // ┌─────────┬─────┬─────┐
|
| 242 |
+
* // │ (index) │ a │ b │
|
| 243 |
+
* // ├─────────┼─────┼─────┤
|
| 244 |
+
* // │ 0 │ 1 │ 'Y' │
|
| 245 |
+
* // │ 1 │ 'Z' │ 2 │
|
| 246 |
+
* // └─────────┴─────┴─────┘
|
| 247 |
+
*
|
| 248 |
+
* console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']);
|
| 249 |
+
* // ┌─────────┬─────┐
|
| 250 |
+
* // │ (index) │ a │
|
| 251 |
+
* // ├─────────┼─────┤
|
| 252 |
+
* // │ 0 │ 1 │
|
| 253 |
+
* // │ 1 │ 'Z' │
|
| 254 |
+
* // └─────────┴─────┘
|
| 255 |
+
* ```
|
| 256 |
+
* @since v10.0.0
|
| 257 |
+
* @param properties Alternate properties for constructing the table.
|
| 258 |
+
*/
|
| 259 |
+
table(tabularData: any, properties?: readonly string[]): void;
|
| 260 |
+
/**
|
| 261 |
+
* Starts a timer that can be used to compute the duration of an operation. Timers
|
| 262 |
+
* are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in
|
| 263 |
+
* suitable time units to `stdout`. For example, if the elapsed
|
| 264 |
+
* time is 3869ms, `console.timeEnd()` displays "3.869s".
|
| 265 |
+
* @since v0.1.104
|
| 266 |
+
* @param [label='default']
|
| 267 |
+
*/
|
| 268 |
+
time(label?: string): void;
|
| 269 |
+
/**
|
| 270 |
+
* Stops a timer that was previously started by calling {@link time} and
|
| 271 |
+
* prints the result to `stdout`:
|
| 272 |
+
*
|
| 273 |
+
* ```js
|
| 274 |
+
* console.time('bunch-of-stuff');
|
| 275 |
+
* // Do a bunch of stuff.
|
| 276 |
+
* console.timeEnd('bunch-of-stuff');
|
| 277 |
+
* // Prints: bunch-of-stuff: 225.438ms
|
| 278 |
+
* ```
|
| 279 |
+
* @since v0.1.104
|
| 280 |
+
* @param [label='default']
|
| 281 |
+
*/
|
| 282 |
+
timeEnd(label?: string): void;
|
| 283 |
+
/**
|
| 284 |
+
* For a timer that was previously started by calling {@link time}, prints
|
| 285 |
+
* the elapsed time and other `data` arguments to `stdout`:
|
| 286 |
+
*
|
| 287 |
+
* ```js
|
| 288 |
+
* console.time('process');
|
| 289 |
+
* const value = expensiveProcess1(); // Returns 42
|
| 290 |
+
* console.timeLog('process', value);
|
| 291 |
+
* // Prints "process: 365.227ms 42".
|
| 292 |
+
* doExpensiveProcess2(value);
|
| 293 |
+
* console.timeEnd('process');
|
| 294 |
+
* ```
|
| 295 |
+
* @since v10.7.0
|
| 296 |
+
* @param [label='default']
|
| 297 |
+
*/
|
| 298 |
+
timeLog(label?: string, ...data: any[]): void;
|
| 299 |
+
/**
|
| 300 |
+
* Prints to `stderr` the string `'Trace: '`, followed by the [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)
|
| 301 |
+
* formatted message and stack trace to the current position in the code.
|
| 302 |
+
*
|
| 303 |
+
* ```js
|
| 304 |
+
* console.trace('Show me');
|
| 305 |
+
* // Prints: (stack trace will vary based on where trace is called)
|
| 306 |
+
* // Trace: Show me
|
| 307 |
+
* // at repl:2:9
|
| 308 |
+
* // at REPLServer.defaultEval (repl.js:248:27)
|
| 309 |
+
* // at bound (domain.js:287:14)
|
| 310 |
+
* // at REPLServer.runBound [as eval] (domain.js:300:12)
|
| 311 |
+
* // at REPLServer.<anonymous> (repl.js:412:12)
|
| 312 |
+
* // at emitOne (events.js:82:20)
|
| 313 |
+
* // at REPLServer.emit (events.js:169:7)
|
| 314 |
+
* // at REPLServer.Interface._onLine (readline.js:210:10)
|
| 315 |
+
* // at REPLServer.Interface._line (readline.js:549:8)
|
| 316 |
+
* // at REPLServer.Interface._ttyWrite (readline.js:826:14)
|
| 317 |
+
* ```
|
| 318 |
+
* @since v0.1.104
|
| 319 |
+
*/
|
| 320 |
+
trace(message?: any, ...optionalParams: any[]): void;
|
| 321 |
+
/**
|
| 322 |
+
* The `console.warn()` function is an alias for {@link error}.
|
| 323 |
+
* @since v0.1.100
|
| 324 |
+
*/
|
| 325 |
+
warn(message?: any, ...optionalParams: any[]): void;
|
| 326 |
+
// --- Inspector mode only ---
|
| 327 |
+
/**
|
| 328 |
+
* This method does not display anything unless used in the inspector. The `console.profile()`
|
| 329 |
+
* method starts a JavaScript CPU profile with an optional label until {@link profileEnd}
|
| 330 |
+
* is called. The profile is then added to the Profile panel of the inspector.
|
| 331 |
+
*
|
| 332 |
+
* ```js
|
| 333 |
+
* console.profile('MyLabel');
|
| 334 |
+
* // Some code
|
| 335 |
+
* console.profileEnd('MyLabel');
|
| 336 |
+
* // Adds the profile 'MyLabel' to the Profiles panel of the inspector.
|
| 337 |
+
* ```
|
| 338 |
+
* @since v8.0.0
|
| 339 |
+
*/
|
| 340 |
+
profile(label?: string): void;
|
| 341 |
+
/**
|
| 342 |
+
* This method does not display anything unless used in the inspector. Stops the current
|
| 343 |
+
* JavaScript CPU profiling session if one has been started and prints the report to the
|
| 344 |
+
* Profiles panel of the inspector. See {@link profile} for an example.
|
| 345 |
+
*
|
| 346 |
+
* If this method is called without a label, the most recently started profile is stopped.
|
| 347 |
+
* @since v8.0.0
|
| 348 |
+
*/
|
| 349 |
+
profileEnd(label?: string): void;
|
| 350 |
+
/**
|
| 351 |
+
* This method does not display anything unless used in the inspector. The `console.timeStamp()`
|
| 352 |
+
* method adds an event with the label `'label'` to the Timeline panel of the inspector.
|
| 353 |
+
* @since v8.0.0
|
| 354 |
+
*/
|
| 355 |
+
timeStamp(label?: string): void;
|
| 356 |
+
}
|
| 357 |
+
/**
|
| 358 |
+
* The `console` module provides a simple debugging console that is similar to the
|
| 359 |
+
* JavaScript console mechanism provided by web browsers.
|
| 360 |
+
*
|
| 361 |
+
* The module exports two specific components:
|
| 362 |
+
*
|
| 363 |
+
* * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream.
|
| 364 |
+
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdout) and
|
| 365 |
+
* [`process.stderr`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module.
|
| 366 |
+
*
|
| 367 |
+
* _**Warning**_: The global console object's methods are neither consistently
|
| 368 |
+
* synchronous like the browser APIs they resemble, nor are they consistently
|
| 369 |
+
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v24.x/api/process.html#a-note-on-process-io) for
|
| 370 |
+
* more information.
|
| 371 |
+
*
|
| 372 |
+
* Example using the global `console`:
|
| 373 |
+
*
|
| 374 |
+
* ```js
|
| 375 |
+
* console.log('hello world');
|
| 376 |
+
* // Prints: hello world, to stdout
|
| 377 |
+
* console.log('hello %s', 'world');
|
| 378 |
+
* // Prints: hello world, to stdout
|
| 379 |
+
* console.error(new Error('Whoops, something bad happened'));
|
| 380 |
+
* // Prints error message and stack trace to stderr:
|
| 381 |
+
* // Error: Whoops, something bad happened
|
| 382 |
+
* // at [eval]:5:15
|
| 383 |
+
* // at Script.runInThisContext (node:vm:132:18)
|
| 384 |
+
* // at Object.runInThisContext (node:vm:309:38)
|
| 385 |
+
* // at node:internal/process/execution:77:19
|
| 386 |
+
* // at [eval]-wrapper:6:22
|
| 387 |
+
* // at evalScript (node:internal/process/execution:76:60)
|
| 388 |
+
* // at node:internal/main/eval_string:23:3
|
| 389 |
+
*
|
| 390 |
+
* const name = 'Will Robinson';
|
| 391 |
+
* console.warn(`Danger ${name}! Danger!`);
|
| 392 |
+
* // Prints: Danger Will Robinson! Danger!, to stderr
|
| 393 |
+
* ```
|
| 394 |
+
*
|
| 395 |
+
* Example using the `Console` class:
|
| 396 |
+
*
|
| 397 |
+
* ```js
|
| 398 |
+
* const out = getStreamSomehow();
|
| 399 |
+
* const err = getStreamSomehow();
|
| 400 |
+
* const myConsole = new console.Console(out, err);
|
| 401 |
+
*
|
| 402 |
+
* myConsole.log('hello world');
|
| 403 |
+
* // Prints: hello world, to out
|
| 404 |
+
* myConsole.log('hello %s', 'world');
|
| 405 |
+
* // Prints: hello world, to out
|
| 406 |
+
* myConsole.error(new Error('Whoops, something bad happened'));
|
| 407 |
+
* // Prints: [Error: Whoops, something bad happened], to err
|
| 408 |
+
*
|
| 409 |
+
* const name = 'Will Robinson';
|
| 410 |
+
* myConsole.warn(`Danger ${name}! Danger!`);
|
| 411 |
+
* // Prints: Danger Will Robinson! Danger!, to err
|
| 412 |
+
* ```
|
| 413 |
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/console.js)
|
| 414 |
+
*/
|
| 415 |
+
namespace console {
|
| 416 |
+
interface ConsoleConstructorOptions {
|
| 417 |
+
stdout: NodeJS.WritableStream;
|
| 418 |
+
stderr?: NodeJS.WritableStream | undefined;
|
| 419 |
+
/**
|
| 420 |
+
* Ignore errors when writing to the underlying streams.
|
| 421 |
+
* @default true
|
| 422 |
+
*/
|
| 423 |
+
ignoreErrors?: boolean | undefined;
|
| 424 |
+
/**
|
| 425 |
+
* Set color support for this `Console` instance. Setting to true enables coloring while inspecting
|
| 426 |
+
* values. Setting to `false` disables coloring while inspecting values. Setting to `'auto'` makes color
|
| 427 |
+
* support depend on the value of the `isTTY` property and the value returned by `getColorDepth()` on the
|
| 428 |
+
* respective stream. This option can not be used, if `inspectOptions.colors` is set as well.
|
| 429 |
+
* @default auto
|
| 430 |
+
*/
|
| 431 |
+
colorMode?: boolean | "auto" | undefined;
|
| 432 |
+
/**
|
| 433 |
+
* Specifies options that are passed along to
|
| 434 |
+
* [`util.inspect()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilinspectobject-options).
|
| 435 |
+
*/
|
| 436 |
+
inspectOptions?: InspectOptions | undefined;
|
| 437 |
+
/**
|
| 438 |
+
* Set group indentation.
|
| 439 |
+
* @default 2
|
| 440 |
+
*/
|
| 441 |
+
groupIndentation?: number | undefined;
|
| 442 |
+
}
|
| 443 |
+
interface ConsoleConstructor {
|
| 444 |
+
prototype: Console;
|
| 445 |
+
new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
|
| 446 |
+
new(options: ConsoleConstructorOptions): Console;
|
| 447 |
+
}
|
| 448 |
+
}
|
| 449 |
+
var console: Console;
|
| 450 |
+
}
|
| 451 |
+
export = globalThis.console;
|
| 452 |
+
}
|